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
6769947a1a5959ae826a09e30d2ade129001d2cd
185
py
Python
lambdas/pkgevents/tests/conftest.py
rekon/quilt
38e6dd64c8f66ab5d8c0303af9bca2646b79cff8
[ "Apache-2.0" ]
1,115
2017-02-10T14:15:43.000Z
2022-03-25T14:52:12.000Z
lambdas/pkgevents/tests/conftest.py
rekon/quilt
38e6dd64c8f66ab5d8c0303af9bca2646b79cff8
[ "Apache-2.0" ]
1,790
2017-02-22T19:25:58.000Z
2022-03-31T16:55:57.000Z
lambdas/pkgevents/tests/conftest.py
rekon/quilt
38e6dd64c8f66ab5d8c0303af9bca2646b79cff8
[ "Apache-2.0" ]
84
2017-02-14T02:35:46.000Z
2022-03-25T03:10:44.000Z
import os def pytest_configure(config): os.environ['AWS_ACCESS_KEY_ID'] = 'foo' os.environ['AWS_SECRET_ACCESS_KEY'] = 'bar' os.environ['AWS_DEFAULT_REGION'] = 'us-east-1'
23.125
50
0.697297
28
185
4.285714
0.678571
0.225
0.3
0
0
0
0
0
0
0
0
0.006329
0.145946
185
7
51
26.428571
0.753165
0
0
0
0
0
0.383784
0.113514
0
0
0
0
0
1
0.2
false
0
0.2
0
0.4
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
67898aa38272d389c452c636d08d5a645ea76a96
23
py
Python
scrape_ptt/package_beauty/__init__.py
Coslate/Crawler
d212ef93297ffc93bdf12ca68409bf85269e30d8
[ "MIT" ]
null
null
null
scrape_ptt/package_beauty/__init__.py
Coslate/Crawler
d212ef93297ffc93bdf12ca68409bf85269e30d8
[ "MIT" ]
null
null
null
scrape_ptt/package_beauty/__init__.py
Coslate/Crawler
d212ef93297ffc93bdf12ca68409bf85269e30d8
[ "MIT" ]
null
null
null
''' package beauty '''
5.75
14
0.565217
2
23
6.5
1
0
0
0
0
0
0
0
0
0
0
0
0.173913
23
3
15
7.666667
0.684211
0.608696
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
67bc562ab4364e8488fd5cdcaa7bcc37ae4cd4f7
88
py
Python
F_Function/F_Query/apps.py
FalseG0d/AdvancedDjango
52715ffea132e591f98f94b781960fc12a8613e4
[ "MIT" ]
9
2020-10-17T14:03:35.000Z
2022-01-12T17:51:14.000Z
F_Function/F_Query/apps.py
FalseG0d/AdvancedDjango
52715ffea132e591f98f94b781960fc12a8613e4
[ "MIT" ]
null
null
null
F_Function/F_Query/apps.py
FalseG0d/AdvancedDjango
52715ffea132e591f98f94b781960fc12a8613e4
[ "MIT" ]
4
2020-10-20T06:52:26.000Z
2022-01-07T23:51:59.000Z
from django.apps import AppConfig class FQueryConfig(AppConfig): name = 'F_Query'
14.666667
33
0.75
11
88
5.909091
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.170455
88
5
34
17.6
0.890411
0
0
0
0
0
0.079545
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
67dfbbb38bfc66ad770d410af7407c1d4ee8a665
434
py
Python
ipython/startup/import_ray.py
dycw/dotfiles2
9e23c4989e9813080da3658a8f98dbb1e03776f2
[ "MIT" ]
null
null
null
ipython/startup/import_ray.py
dycw/dotfiles2
9e23c4989e9813080da3658a8f98dbb1e03776f2
[ "MIT" ]
null
null
null
ipython/startup/import_ray.py
dycw/dotfiles2
9e23c4989e9813080da3658a8f98dbb1e03776f2
[ "MIT" ]
null
null
null
from contextlib import suppress with suppress(ModuleNotFoundError): import ray # noqa: F401 from ray import get # noqa: F401 from ray import init as _init from ray import put # noqa: F401 from ray import remote # noqa: F401 from ray import shutdown # noqa: F401 from ray import wait # noqa: F401 from ray.remote_function import RemoteFunction # noqa: F401 _init(ignore_reinit_error=True)
28.933333
64
0.707373
60
434
5.033333
0.366667
0.18543
0.238411
0.298013
0.347682
0
0
0
0
0
0
0.064024
0.24424
434
14
65
31
0.856707
0.175115
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.818182
0
0.818182
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
db18c14d0ecc50e0b670977b153954ec0fbac2dc
138
py
Python
src/netbox_example/apps.py
steffann/netbox-example-plugin
9f1c22ae60bb21e7d4685219eb76687c62f0161e
[ "Apache-2.0" ]
4
2020-01-19T04:14:07.000Z
2020-06-03T17:36:19.000Z
src/netbox_example/apps.py
steffann/netbox-example-plugin
9f1c22ae60bb21e7d4685219eb76687c62f0161e
[ "Apache-2.0" ]
null
null
null
src/netbox_example/apps.py
steffann/netbox-example-plugin
9f1c22ae60bb21e7d4685219eb76687c62f0161e
[ "Apache-2.0" ]
1
2020-09-17T17:02:43.000Z
2020-09-17T17:02:43.000Z
from django.apps import AppConfig class NetboxExampleConfig(AppConfig): name = 'netbox_example' verbose_name = 'Netbox Example'
19.714286
37
0.76087
15
138
6.866667
0.733333
0.194175
0.330097
0
0
0
0
0
0
0
0
0
0.166667
138
6
38
23
0.895652
0
0
0
0
0
0.202899
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
e1e517c11a23817989bbde78bd0eaf7a690e1230
96
py
Python
enthought/mayavi/tools/engine_manager.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/mayavi/tools/engine_manager.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/mayavi/tools/engine_manager.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from mayavi.tools.engine_manager import *
24
41
0.84375
13
96
5.769231
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.114583
96
3
42
32
0.882353
0.125
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
c0280a738029dc4925e14dc43530dd89bda1f7ab
137
py
Python
thulac/base/WordWithTag.py
nasyxx/THULAC-Python
3f1f126cd92c3d2aebdf4ab4850de3c9428a3b66
[ "MIT" ]
1,771
2016-05-19T12:02:07.000Z
2022-03-30T08:02:02.000Z
thulac/base/WordWithTag.py
panmengqiang/THULAC-Python
3f1f126cd92c3d2aebdf4ab4850de3c9428a3b66
[ "MIT" ]
108
2016-06-14T13:03:51.000Z
2022-03-25T08:37:50.000Z
thulac/base/WordWithTag.py
panmengqiang/THULAC-Python
3f1f126cd92c3d2aebdf4ab4850de3c9428a3b66
[ "MIT" ]
361
2016-06-07T04:00:45.000Z
2022-03-26T00:36:40.000Z
class WordWithTag: word = "" tag = "" separator = '' def __init__(self, separator): self.separator = separator
15.222222
34
0.569343
12
137
6.166667
0.666667
0.351351
0
0
0
0
0
0
0
0
0
0
0.313869
137
8
35
17.125
0.787234
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.833333
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
1
0
0
4
c041647cf05a3e73bbb32848fc46de11b4457a0a
432
py
Python
compress_pickle/compressers/__init__.py
jungerm2/compress_pickle
2ea2ea4ee33e6411868d1ea93a384ec2306b44bb
[ "MIT" ]
null
null
null
compress_pickle/compressers/__init__.py
jungerm2/compress_pickle
2ea2ea4ee33e6411868d1ea93a384ec2306b44bb
[ "MIT" ]
null
null
null
compress_pickle/compressers/__init__.py
jungerm2/compress_pickle
2ea2ea4ee33e6411868d1ea93a384ec2306b44bb
[ "MIT" ]
null
null
null
from . import base from . import registry from . import no_compression from . import gzip from . import bz2 from . import lzma from . import zipfile from . import lz4 from .base import BaseCompresser from .registry import * from .no_compression import NoCompresser from .gzip import GzipCompresser from .bz2 import Bz2Compresser from .lzma import LzmaCompresser from .zipfile import ZipfileCompresser from .lz4 import Lz4Compresser
25.411765
40
0.8125
57
432
6.122807
0.315789
0.229226
0
0
0
0
0
0
0
0
0
0.016304
0.148148
432
16
41
27
0.932065
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
c0653fb78931ef5b2de6064eccc433bb9c9b5be1
410
py
Python
tests/asp/cautious/choice.example3.cautious.asp.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
19
2015-12-03T08:53:45.000Z
2022-03-31T02:09:43.000Z
tests/asp/cautious/choice.example3.cautious.asp.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
80
2017-11-25T07:57:32.000Z
2018-06-10T19:03:30.000Z
tests/asp/cautious/choice.example3.cautious.asp.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
6
2015-01-15T07:51:48.000Z
2020-06-18T14:47:48.000Z
input = """ 3 2 2 3 1 0 4 2 5 2 0 1 2 3 1 1 2 1 5 4 2 6 2 0 2 2 3 1 1 2 0 6 4 1 4 0 0 3 3 7 8 9 1 0 10 2 11 3 0 1 7 8 9 1 1 2 1 11 10 2 12 3 0 2 7 8 9 1 1 2 0 12 10 1 10 0 0 1 13 1 0 9 1 14 1 0 8 1 15 1 0 7 1 16 1 0 9 1 17 1 0 7 1 18 1 1 17 1 19 2 0 14 13 1 20 3 0 14 18 15 1 1 2 1 20 2 1 1 2 1 19 3 0 16 i 3 e 20 s 13 f 9 a 14 g 17 l 8 b 18 p 2 d 19 r 15 h 7 c 0 B+ 0 B- 1 0 1 """ output = """ INCOHERENT """
8.367347
17
0.534146
169
410
1.295858
0.218935
0.073059
0.082192
0.073059
0.100457
0.054795
0
0
0
0
0
0.778723
0.426829
410
48
18
8.541667
0.153191
0
0
0.041667
0
0
0.92439
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
c068ae9dfd3965620ccef4b2bf9eb0a264b43eaf
11,212
py
Python
gamestonk_terminal/economy/wsj_model.py
minhhoang1023/GamestonkTerminal
195dc19b491052df080178c0cc6a9d535a91a704
[ "MIT" ]
1
2022-03-15T13:05:40.000Z
2022-03-15T13:05:40.000Z
gamestonk_terminal/economy/wsj_model.py
minhhoang1023/GamestonkTerminal
195dc19b491052df080178c0cc6a9d535a91a704
[ "MIT" ]
null
null
null
gamestonk_terminal/economy/wsj_model.py
minhhoang1023/GamestonkTerminal
195dc19b491052df080178c0cc6a9d535a91a704
[ "MIT" ]
null
null
null
"""WSJ model""" __docformat__ = "numpy" import logging import pandas as pd import requests from gamestonk_terminal.decorators import log_start_end from gamestonk_terminal.helper_funcs import get_user_agent logger = logging.getLogger(__name__) @log_start_end(log=logger) def us_indices() -> pd.DataFrame: """Get the top US indices Returns ------- indices: pd.DataFrame Dataframe containing name, price, net change and percent change """ data = requests.get( "https://www.wsj.com/market-data/stocks?id=%7B%22application%22%3A%22WSJ%22%2C%22instruments%22%3A%5B%7B" "%22symbol%22%3A%22INDEX%2FUS%2F%2FDJIA%22%2C%22name%22%3A%22DJIA%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FUS%2F" "%2FCOMP%22%2C%22name%22%3A%22Nasdaq%20Composite%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FUS%2F%2FSPX%22%2C%22name" "%22%3A%22S%26P%20500%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FUS%2F%2FDWCF%22%2C%22name%22%3A%22DJ%20Total%20Stock" "%20Market%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FUS%2F%2FRUT%22%2C%22name%22%3A%22Russell%202000%22%7D%2C%7B" "%22symbol%22%3A%22INDEX%2FUS%2F%2FNYA%22%2C%22name%22%3A%22NYSE%20Composite%22%7D%2C%7B%22symbol%22%3A%22INDEX" "%2FUS%2F%2FB400%22%2C%22name%22%3A%22Barron%27s%20400%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FUS%2F%2FVIX%22%2C%22" "name%22%3A%22CBOE%20Volatility%22%7D%2C%7B%22symbol%22%3A%22FUTURE%2FUS%2F%2FDJIA%20FUTURES%22%2C%22name%22%3A%" "22DJIA%20Futures%22%7D%2C%7B%22symbol%22%3A%22FUTURE%2FUS%2F%2FS%26P%20500%20FUTURES%22%2C%22name%22%3A%22S%26P" "%20500%20Futures%22%7D%5D%7D&type=mdc_quotes", headers={"User-Agent": get_user_agent()}, ).json() name, last_price, net_change, percent_change = [], [], [], [] for entry in data["data"]["instruments"]: name.append(entry["formattedName"]) last_price.append(entry["lastPrice"]) net_change.append(entry["priceChange"]) percent_change.append(entry["percentChange"]) indices = pd.DataFrame( {" ": name, "Price": last_price, "Chg": net_change, "%Chg": percent_change} ) return indices @log_start_end(log=logger) def market_overview() -> pd.DataFrame: """Scrape data for market overview Returns ------- overview: pd.DataFrame Dataframe containing name, price, net change and percent change """ data = requests.get( "https://www.wsj.com/market-data?id=%7B%22application%22%3A%22WSJ%22%2C%22instruments%22%3A%5B%7B%22symbol%22" "%3A%22INDEX%2FUS%2F%2FDJIA%22%2C%22name%22%3A%22DJIA%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FUS%2F%2FSPX%22%2C%22" "name%22%3A%22S%26P%20500%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FUS%2F%2FCOMP%22%2C%22name%22%3A%22Nasdaq%20" "Composite%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FJP%2F%2FNIK%22%2C%22name%22%3A%22Japan%3A%20Nikkei%20225%22%7D%" "2C%7B%22symbol%22%3A%22INDEX%2FUK%2F%2FUKX%22%2C%22name%22%3A%22UK%3A%20FTSE%20100%22%7D%2C%7B%22symbol%22%3A%" "22FUTURE%2FUS%2F%2FCRUDE%20OIL%20-%20ELECTRONIC%22%2C%22name%22%3A%22Crude%20Oil%20Futures%22%7D%2C%7B%22symbol" "%22%3A%22FUTURE%2FUS%2F%2FGOLD%22%2C%22name%22%3A%22Gold%20Futures%22%7D%2C%7B%22symbol%22%3A%22CURRENCY%2FUS%2" "F%2FUSDJPY%22%2C%22name%22%3A%22Yen%22%7D%2C%7B%22symbol%22%3A%22CURRENCY%2FUS%2F%2FEURUSD%22%2C%22name%22%3A%" "22Euro%22%7D%5D%7D&type=mdc_quotes", headers={"User-Agent": get_user_agent()}, ).json() name, last_price, net_change, percent_change = [], [], [], [] for entry in data["data"]["instruments"]: name.append(entry["formattedName"]) last_price.append(entry["lastPrice"]) net_change.append(entry["priceChange"]) percent_change.append(entry["percentChange"]) overview = pd.DataFrame( {" ": name, "Price": last_price, "Chg": net_change, "%Chg": percent_change} ) return overview @log_start_end(log=logger) def top_commodities() -> pd.DataFrame: """Scrape data for top commodities Returns ------- commodities: pd.DataFrame Dataframe containing name, price, net change and percent change """ data = requests.get( "https://www.wsj.com/market-data/commodities?id=%7B%22application%22%3A%22WSJ%22%2C%22instruments%22%3A%5B%7" "B%22symbol%22%3A%22FUTURE%2FUS%2F%2FCRUDE%20OIL%20-%20ELECTRONIC%22%2C%22name%22%3A%22Crude%20Oil%20Futures" "%22%7D%2C%7B%22symbol%22%3A%22FUTURE%2FUK%2F%2FBRENT%20CRUDE%22%2C%22name%22%3A%22Brent%20Crude%20Futures%22" "%7D%2C%7B%22symbol%22%3A%22FUTURE%2FUS%2F%2FGOLD%22%2C%22name%22%3A%22Gold%20Futures%22%7D%2C%7B%22symbol%22%" "3A%22FUTURE%2FUS%2F%2FSILVER%22%2C%22name%22%3A%22Silver%20Futures%22%7D%2C%7B%22symbol%22%3A%22FUTURE%2FUS%2F" "%2FNATURAL%20GAS%22%2C%22name%22%3A%22Natural%20Gas%20Futures%22%7D%2C%7B%22symbol%22%3A%22FUTURE%2FUS%2F%2" "FUNLEADED%20GASOLINE%22%2C%22name%22%3A%22Unleaded%20Gasoline%20Futures%22%7D%2C%7B%22symbol%22%3A%22FUTURE%" "2FUS%2F%2FCOPPER%22%2C%22name%22%3A%22Copper%20Futures%22%7D%2C%7B%22symbol%22%3A%22FUTURE%2FUS%2F%2FCORN%22%2" "C%22name%22%3A%22Corn%20Futures%22%7D%2C%7B%22symbol%22%3A%22FUTURE%2FUS%2F%2FWHEAT%22%2C%22name%22%3A%22Wheat" "%20Futures%22%7D%2C%7B%22symbol%22%3A%22INDEX%2FXX%2F%2FBCOM%22%7D%5D%7D&type=mdc_quotes", headers={"User-Agent": get_user_agent()}, ).json() name, last_price, net_change, percent_change = [], [], [], [] for entry in data["data"]["instruments"]: name.append(entry["formattedName"]) last_price.append(entry["lastPrice"]) net_change.append(entry["priceChange"]) percent_change.append(entry["percentChange"]) commodities = pd.DataFrame( {" ": name, "Price": last_price, "Chg": net_change, "%Chg": percent_change} ) return commodities @log_start_end(log=logger) def us_bonds() -> pd.DataFrame: """Scrape data for us bonds Returns ------- bonds: pd.DataFrame Dataframe containing name, coupon rate, yield and change in yield """ data = requests.get( "https://www.wsj.com/market-data?id=%7B%22application%22%3A%22WSJ%22%2C%22instruments%22%3A%5B" "%7B%22symbol%22%3A%22BOND%2FBX%2F%2FTMUBMUSD30Y%22%2C%22name%22%3A%2230-Year%20Bond%22%7D%2C%7" "B%22symbol%22%3A%22BOND%2FBX%2F%2FTMUBMUSD10Y%22%2C%22name%22%3A%2210-Year%20Note%22%7D%2C%7B%2" "2symbol%22%3A%22BOND%2FBX%2F%2FTMUBMUSD07Y%22%2C%22name%22%3A%227-Year%20Note%22%7D%2C%7B%22sym" "bol%22%3A%22BOND%2FBX%2F%2FTMUBMUSD05Y%22%2C%22name%22%3A%225-Year%20Note%22%7D%2C%7B%22symbol" "%22%3A%22BOND%2FBX%2F%2FTMUBMUSD03Y%22%2C%22name%22%3A%223-Year%20Note%22%7D%2C%7B%22symbol%22%" "3A%22BOND%2FBX%2F%2FTMUBMUSD02Y%22%2C%22name%22%3A%222-Year%20Note%22%7D%2C%7B%22symbol%22%3A%" "22BOND%2FBX%2F%2FTMUBMUSD01Y%22%2C%22name%22%3A%221-Year%20Bill%22%7D%2C%7B%22symbol%22%3A%22" "BOND%2FBX%2F%2FTMUBMUSD06M%22%2C%22name%22%3A%226-Month%20Bill%22%7D%2C%7B%22symbol%22%3A%22BON" "D%2FBX%2F%2FTMUBMUSD03M%22%2C%22name%22%3A%223-Month%20Bill%22%7D%2C%7B%22symbol%22%3A%22BOND%" "2FBX%2F%2FTMUBMUSD01M%22%2C%22name%22%3A%221-Month%20Bill%22%7D%5D%7D&type=mdc_quotes", headers={"User-Agent": get_user_agent()}, ).json() name, yield_pct, rate, yld_chng = [], [], [], [] for entry in data["data"]["instruments"]: name.append(entry["formattedName"]) yield_pct.append(entry["bond"]["yield"]) rate.append(entry["bond"]["couponRate"]) yld_chng.append(entry["bond"]["yieldChange"]) bonds = pd.DataFrame( {" ": name, "Rate (%)": rate, "Yld (%)": yield_pct, "Yld Chg (%)": yld_chng} ) return bonds @log_start_end(log=logger) def global_bonds() -> pd.DataFrame: """Scrape data for global bonds Returns ------- bonds: pd.DataFrame Dataframe containing name, coupon rate, yield and change in yield """ data = requests.get( "https://www.wsj.com/market-data?id=%7B%22application%22%3A%22WSJ%22%2C%22bonds%22%3A%5" "B%7B%22symbol%22%3A%22TMUBMUSD10Y%22%2C%22name%22%3A%22U.S.%2010%20Year%22%7D%2C%7B%22symbol" "%22%3A%22TMBMKDE-10Y%22%2C%22name%22%3A%22Germany%2010%20Year%22%7D%2C%7B%22symbol%22%3A%22TMB" "MKGB-10Y%22%2C%22name%22%3A%22U.K.%2010%20Year%22%7D%2C%7B%22symbol%22%3A%22TMBMKJP-10Y%22%2C%" "22name%22%3A%22Japan%2010%20Year%22%7D%2C%7B%22symbol%22%3A%22TMBMKAU-10Y%22%2C%22name%22%3A%2" "2Australia%2010%20Year%22%7D%2C%7B%22symbol%22%3A%22AMBMKRM-10Y%22%2C%22name%22%3A%22China%2010" "%20Year%22%7D%5D%7D&type=mdc_governmentbonds", headers={"User-Agent": get_user_agent()}, ).json() name, yield_pct, rate, yld_chng = [], [], [], [] for entry in data["data"]["instruments"]: name.append(entry["djLegalName"]) yield_pct.append(entry["yieldPercent"]) rate.append(entry["couponPercent"]) yld_chng.append(entry["yieldChange"]) bonds = pd.DataFrame( {" ": name, "Rate (%)": rate, "Yld (%)": yield_pct, "Yld Chg (%)": yld_chng} ) return bonds @log_start_end(log=logger) def global_currencies() -> pd.DataFrame: """Scrape data for global currencies Returns ------- currencies: pd.DataFrame Dataframe containing name, price, net change and percent change """ data = requests.get( "https://www.wsj.com/market-data?id=%7B%22application%22%3A%22WSJ%22%2C%22instruments%22%3A%5" "B%7B%22symbol%22%3A%22CURRENCY%2FUS%2F%2FEURUSD%22%2C%22name%22%3A%22Euro%20(EUR%2FUSD)%22%7D%" "2C%7B%22symbol%22%3A%22CURRENCY%2FUS%2F%2FUSDJPY%22%2C%22name%22%3A%22Japanese%20Yen%20(USD%2F" "JPY)%22%7D%2C%7B%22symbol%22%3A%22CURRENCY%2FUS%2F%2FGBPUSD%22%2C%22name%22%3A%22U.K.%20Poun" "d%20(GBP%2FUSD)%22%7D%2C%7B%22symbol%22%3A%22CURRENCY%2FUS%2F%2FUSDCHF%22%2C%22name%22%3A%22Sw" "iss%20Franc%20(USD%2FCHF)%22%7D%2C%7B%22symbol%22%3A%22CURRENCY%2FUS%2F%2FUSDCNY%22%2C%22name%2" "2%3A%22Chinese%20Yuan%20(USD%2FCNY)%22%7D%2C%7B%22symbol%22%3A%22CURRENCY%2FUS%2F%2FUSDCAD%22%2C" "%22name%22%3A%22Canadian%20%24%20(USD%2FCAD)%22%7D%2C%7B%22symbol%22%3A%22CURRENCY%2FUS%2F%2F" "USDMXN%22%2C%22name%22%3A%22Mexican%20Peso%20(USD%2FMXN)%22%7D%2C%7B%22symbol%22%3A%22CRYPTO" "CURRENCY%2FUS%2F%2FBTCUSD%22%2C%22name%22%3A%22Bitcoin%20(BTC%2FUSD)%22%7D%2C%7B%22symbol%22%3A" "%22INDEX%2FXX%2F%2FBUXX%22%2C%22name%22%3A%22WSJ%20Dollar%20Index%22%7D%2C%7B%22symbol%22%3A%2" "2INDEX%2FUS%2F%2FDXY%22%2C%22name%22%3A%22U.S.%20Dollar%20Index%22%7D%5D%7D&type=mdc_quotes", headers={"User-Agent": get_user_agent()}, ).json() name, last_price, price_change, pct_change = [], [], [], [] for entry in data["data"]["instruments"]: name.append(entry["formattedName"]) last_price.append(entry["lastPrice"]) price_change.append(entry["priceChange"]) pct_change.append(entry["percentChange"]) currencies = pd.DataFrame( {" ": name, "Last": last_price, "Chng": price_change, "%Chng": pct_change} ) return currencies
48.327586
121
0.672851
1,741
11,212
4.276278
0.147042
0.064473
0.085426
0.095903
0.760107
0.707455
0.642445
0.619073
0.599328
0.571659
0
0.180277
0.142615
11,212
231
122
48.536797
0.594195
0.074385
0
0.378205
0
0.358974
0.615407
0.504503
0
0
0
0
0
1
0.038462
false
0
0.032051
0
0.108974
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
0
1
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
fbecfb563572bbce34bdbeeb0627c815686f8042
55,021
py
Python
manilaclient/tests/unit/osc/v2/test_share.py
sapcc/python-manilaclient
a0985c56a55563ea5ad4e8303a8ac5b8cffa6bde
[ "CNRI-Python", "Apache-1.1" ]
37
2015-01-29T20:10:49.000Z
2021-10-01T23:31:23.000Z
manilaclient/tests/unit/osc/v2/test_share.py
sapcc/python-manilaclient
a0985c56a55563ea5ad4e8303a8ac5b8cffa6bde
[ "CNRI-Python", "Apache-1.1" ]
1
2017-04-12T13:57:10.000Z
2017-04-12T13:57:10.000Z
manilaclient/tests/unit/osc/v2/test_share.py
sapcc/python-manilaclient
a0985c56a55563ea5ad4e8303a8ac5b8cffa6bde
[ "CNRI-Python", "Apache-1.1" ]
21
2015-09-23T09:15:14.000Z
2022-03-12T16:38:17.000Z
# Copyright 2019 Red Hat Inc. All rights reserved. # # 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. # import argparse from unittest import mock import uuid from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes from osc_lib import exceptions as osc_exceptions from osc_lib import utils as oscutils from manilaclient import api_versions from manilaclient.api_versions import MAX_VERSION from manilaclient.common.apiclient import exceptions from manilaclient.common import cliutils from manilaclient.osc.v2 import share as osc_shares from manilaclient.tests.unit.osc import osc_fakes from manilaclient.tests.unit.osc import osc_utils from manilaclient.tests.unit.osc.v2 import fakes as manila_fakes class TestShare(manila_fakes.TestShare): def setUp(self): super(TestShare, self).setUp() self.shares_mock = self.app.client_manager.share.shares self.shares_mock.reset_mock() self.export_locations_mock = ( self.app.client_manager.share.share_export_locations ) self.export_locations_mock.reset_mock() self.projects_mock = self.app.client_manager.identity.projects self.projects_mock.reset_mock() self.users_mock = self.app.client_manager.identity.users self.users_mock.reset_mock() self.snapshots_mock = self.app.client_manager.share.share_snapshots self.snapshots_mock.reset_mock() self.share_types_mock = self.app.client_manager.share.share_types self.share_types_mock.reset_mock() self.app.client_manager.share.api_version = api_versions.APIVersion( MAX_VERSION) def setup_shares_mock(self, count): shares = manila_fakes.FakeShare.create_shares(count=count) self.shares_mock.get = manila_fakes.FakeShare.get_shares( shares, 0) return shares class TestShareCreate(TestShare): def setUp(self): super(TestShareCreate, self).setUp() self.new_share = manila_fakes.FakeShare.create_one_share( attrs={'status': 'available'} ) self.shares_mock.create.return_value = self.new_share self.shares_mock.get.return_value = self.new_share self.share_snapshot = ( manila_fakes.FakeShareSnapshot.create_one_snapshot()) self.snapshots_mock.get.return_value = self.share_snapshot # Get the command object to test self.cmd = osc_shares.CreateShare(self.app, None) self.datalist = tuple(self.new_share._info.values()) self.columns = tuple(self.new_share._info.keys()) def test_share_create_required_args(self): """Verifies required arguments.""" arglist = [ self.new_share.share_proto, str(self.new_share.size), ] verifylist = [ ('share_proto', self.new_share.share_proto), ('size', self.new_share.size) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.create.assert_called_with( availability_zone=None, description=None, is_public=False, metadata={}, name=None, share_group_id=None, share_network=None, share_proto=self.new_share.share_proto, share_type=None, size=self.new_share.size, snapshot_id=None, scheduler_hints={} ) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) def test_share_create_missing_required_arg(self): """Verifies missing required arguments.""" arglist = [ self.new_share.share_proto, ] verifylist = [ ('share_proto', self.new_share.share_proto) ] self.assertRaises(osc_utils.ParserException, self.check_parser, self.cmd, arglist, verifylist) def test_share_create_metadata(self): arglist = [ self.new_share.share_proto, str(self.new_share.size), '--property', 'Manila=zorilla', '--property', 'Zorilla=manila' ] verifylist = [ ('share_proto', self.new_share.share_proto), ('size', self.new_share.size), ('property', {'Manila': 'zorilla', 'Zorilla': 'manila'}), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.create.assert_called_with( availability_zone=None, description=None, is_public=False, metadata={'Manila': 'zorilla', 'Zorilla': 'manila'}, name=None, share_group_id=None, share_network=None, share_proto=self.new_share.share_proto, share_type=None, size=self.new_share.size, snapshot_id=None, scheduler_hints={} ) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) def test_share_create_scheduler_hints(self): """Verifies scheduler hints are parsed correctly.""" self.app.client_manager.share.api_version = api_versions.APIVersion( "2.65") shares = self.setup_shares_mock(count=2) share1_name = shares[0].name share2_name = shares[1].name arglist = [ self.new_share.share_proto, str(self.new_share.size), '--scheduler-hint', ('same_host=%s' % share1_name), '--scheduler-hint', ('different_host=%s' % share2_name), ] verifylist = [ ('share_proto', self.new_share.share_proto), ('size', self.new_share.size), ('scheduler_hint', {'same_host': share1_name, 'different_host': share2_name}), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.create.assert_called_with( availability_zone=None, description=None, is_public=False, metadata={}, name=None, share_group_id=None, share_network=None, share_proto=self.new_share.share_proto, share_type=None, size=self.new_share.size, snapshot_id=None, scheduler_hints={'same_host': shares[0].id, 'different_host': shares[1].id}, ) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) def test_share_create_with_snapshot(self): """Verifies create share from snapshot.""" arglist = [ self.new_share.share_proto, str(self.new_share.size), '--snapshot-id', self.share_snapshot.id ] verifylist = [ ('share_proto', self.new_share.share_proto), ('size', self.new_share.size), ('snapshot_id', self.share_snapshot.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.create.assert_called_with( availability_zone=None, description=None, is_public=False, metadata={}, name=None, share_group_id=None, share_network=None, share_proto=self.new_share.share_proto, share_type=None, size=self.new_share.size, snapshot_id=self.share_snapshot.id, scheduler_hints={} ) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) def test_share_create_wait(self): arglist = [ self.new_share.share_proto, str(self.new_share.size), '--wait' ] verifylist = [ ('share_proto', self.new_share.share_proto), ('size', self.new_share.size), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.create.assert_called_with( availability_zone=None, description=None, is_public=False, metadata={}, name=None, share_group_id=None, share_network=None, share_proto=self.new_share.share_proto, share_type=None, size=self.new_share.size, snapshot_id=None, scheduler_hints={} ) self.shares_mock.get.assert_called_with(self.new_share.id) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) @mock.patch('manilaclient.osc.v2.share.LOG') def test_share_create_wait_error(self, mock_logger): arglist = [ self.new_share.share_proto, str(self.new_share.size), '--wait' ] verifylist = [ ('share_proto', self.new_share.share_proto), ('size', self.new_share.size), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) with mock.patch('osc_lib.utils.wait_for_status', return_value=False): columns, data = self.cmd.take_action(parsed_args) self.shares_mock.create.assert_called_with( availability_zone=None, description=None, is_public=False, metadata={}, name=None, share_group_id=None, share_network=None, share_proto=self.new_share.share_proto, share_type=None, size=self.new_share.size, snapshot_id=None, scheduler_hints={} ) mock_logger.error.assert_called_with( "ERROR: Share is in error state.") self.shares_mock.get.assert_called_with(self.new_share.id) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) class TestShareDelete(TestShare): def setUp(self): super(TestShareDelete, self).setUp() self.shares_mock.delete = mock.Mock() self.shares_mock.delete.return_value = None # Get the command object to test self.cmd = osc_shares.DeleteShare(self.app, None) def test_share_delete_one(self): shares = self.setup_shares_mock(count=1) arglist = [ shares[0].name ] verifylist = [ ("force", False), ("share_group", None), ('shares', [shares[0].name]) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) self.shares_mock.delete.assert_called_with(shares[0], None) self.assertIsNone(result) def test_share_delete_many(self): shares = self.setup_shares_mock(count=3) arglist = [v.id for v in shares] verifylist = [ ("force", False), ("share_group", None), ('shares', arglist), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) calls = [mock.call(s, None) for s in shares] self.shares_mock.delete.assert_has_calls(calls) self.assertIsNone(result) def test_share_delete_with_force(self): shares = self.setup_shares_mock(count=1) arglist = [ '--force', shares[0].name, ] verifylist = [ ('force', True), ("share_group", None), ('shares', [shares[0].name]), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) self.shares_mock.force_delete.assert_called_once_with(shares[0]) self.assertIsNone(result) def test_share_delete_wrong_name(self): shares = self.setup_shares_mock(count=1) arglist = [ shares[0].name + '-wrong-name' ] verifylist = [ ("force", False), ("share_group", None), ('shares', [shares[0].name + '-wrong-name']) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) self.assertIsNone(result) self.shares_mock.delete.side_effect = exceptions.CommandError() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) def test_share_delete_no_name(self): # self.setup_shares_mock(count=1) arglist = [] verifylist = [ ("force", False), ("share_group", None), ('shares', '') ] self.assertRaises(osc_utils.ParserException, self.check_parser, self.cmd, arglist, verifylist) def test_share_delete_wait(self): shares = self.setup_shares_mock(count=1) arglist = [ shares[0].name, '--wait' ] verifylist = [ ("force", False), ("share_group", None), ('shares', [shares[0].name]), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) with mock.patch('osc_lib.utils.wait_for_delete', return_value=True): result = self.cmd.take_action(parsed_args) self.shares_mock.delete.assert_called_with(shares[0], None) self.shares_mock.get.assert_called_with(shares[0].name) self.assertIsNone(result) def test_share_delete_wait_error(self): shares = self.setup_shares_mock(count=1) arglist = [ shares[0].name, '--wait' ] verifylist = [ ("force", False), ("share_group", None), ('shares', [shares[0].name]), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) with mock.patch('osc_lib.utils.wait_for_delete', return_value=False): self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args ) class TestShareList(TestShare): project = identity_fakes.FakeProject.create_one_project() user = identity_fakes.FakeUser.create_one_user() columns = [ 'ID', 'Name', 'Size', 'Share Proto', 'Status', 'Is Public', 'Share Type Name', 'Host', 'Availability Zone' ] def setUp(self): super(TestShareList, self).setUp() self.new_share = manila_fakes.FakeShare.create_one_share() self.shares_mock.list.return_value = [self.new_share] self.users_mock.get.return_value = self.user self.projects_mock.get.return_value = self.project # Get the command object to test self.cmd = osc_shares.ListShare(self.app, None) def _get_data(self): data = (( self.new_share.id, self.new_share.name, self.new_share.size, self.new_share.share_proto, self.new_share.status, self.new_share.is_public, self.new_share.share_type_name, self.new_share.host, self.new_share.availability_zone, ),) return data def _get_search_opts(self): search_opts = { 'all_tenants': False, 'is_public': False, 'metadata': {}, 'extra_specs': {}, 'limit': None, 'name': None, 'status': None, 'host': None, 'share_server_id': None, 'share_network_id': None, 'share_type_id': None, 'snapshot_id': None, 'share_group_id': None, 'project_id': None, 'user_id': None, 'offset': None, 'name~': None, 'description~': None, } return search_opts def test_share_list_no_options(self): arglist = [] verifylist = [ ('long', False), ('all_projects', False), ('name', None), ('status', None), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_share_list_project(self): arglist = [ '--project', self.project.name, ] verifylist = [ ('project', self.project.name), ('long', False), ('all_projects', False), ('status', None), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() search_opts['project_id'] = self.project.id search_opts['all_tenants'] = True self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_share_list_project_domain(self): arglist = [ '--project', self.project.name, '--project-domain', self.project.domain_id, ] verifylist = [ ('project', self.project.name), ('project_domain', self.project.domain_id), ('long', False), ('all_projects', False), ('status', None), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() search_opts['project_id'] = self.project.id search_opts['all_tenants'] = True self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_share_list_user(self): arglist = [ '--user', self.user.name, ] verifylist = [ ('user', self.user.name), ('long', False), ('all_projects', False), ('status', None), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() search_opts['user_id'] = self.user.id self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_share_list_user_domain(self): arglist = [ '--user', self.user.name, '--user-domain', self.user.domain_id, ] verifylist = [ ('user', self.user.name), ('user_domain', self.user.domain_id), ('long', False), ('all_projects', False), ('status', None), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() search_opts['user_id'] = self.user.id self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_share_list_name(self): arglist = [ '--name', self.new_share.name, ] verifylist = [ ('long', False), ('all_projects', False), ('name', self.new_share.name), ('status', None), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() search_opts['name'] = self.new_share.name self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_share_list_status(self): arglist = [ '--status', self.new_share.status, ] verifylist = [ ('long', False), ('all_projects', False), ('name', None), ('status', self.new_share.status), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() search_opts['status'] = self.new_share.status self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_share_list_all_tenants(self): arglist = [ '--all-projects', ] verifylist = [ ('long', False), ('all_projects', True), ('name', None), ('status', None), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() search_opts['all_tenants'] = True self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_share_list_long(self): arglist = [ '--long', ] verifylist = [ ('long', True), ('all_projects', False), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) collist = [ 'ID', 'Name', 'Size', 'Share Protocol', 'Status', 'Is Public', 'Share Type Name', 'Availability Zone', 'Description', 'Share Network ID', 'Share Server ID', 'Share Type', 'Share Group ID', 'Host', 'User ID', 'Project ID', 'Access Rules Status', 'Source Snapshot ID', 'Supports Creating Snapshots', 'Supports Cloning Snapshots', 'Supports Mounting snapshots', 'Supports Reverting to Snapshot', 'Migration Task Status', 'Source Share Group Snapshot Member ID', 'Replication Type', 'Has Replicas', 'Created At', 'Properties', ] self.assertEqual(collist, cmd_columns) data = (( self.new_share.id, self.new_share.name, self.new_share.size, self.new_share.share_proto, self.new_share.status, self.new_share.is_public, self.new_share.share_type_name, self.new_share.availability_zone, self.new_share.description, self.new_share.share_network_id, self.new_share.share_server_id, self.new_share.share_type, self.new_share.share_group_id, self.new_share.host, self.new_share.user_id, self.new_share.project_id, self.new_share.access_rules_status, self.new_share.snapshot_id, self.new_share.snapshot_support, self.new_share.create_share_from_snapshot_support, self.new_share.mount_snapshot_support, self.new_share.revert_to_snapshot_support, self.new_share.task_state, self.new_share.source_share_group_snapshot_member_id, self.new_share.replication_type, self.new_share.has_replicas, self.new_share.created_at, self.new_share.metadata ),) self.assertEqual(data, tuple(cmd_data)) def test_share_list_with_marker_and_limit(self): arglist = [ "--marker", self.new_share.id, "--limit", "2", ] verifylist = [ ('long', False), ('all_projects', False), ('name', None), ('status', None), ('marker', self.new_share.id), ('limit', 2), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) self.assertEqual(self.columns, cmd_columns) search_opts = self._get_search_opts() search_opts['limit'] = 2 search_opts['offset'] = self.new_share.id data = self._get_data() self.shares_mock.list.assert_called_once_with( search_opts=search_opts ) self.assertEqual(data, tuple(cmd_data)) def test_share_list_negative_limit(self): arglist = [ "--limit", "-2", ] verifylist = [ ("limit", -2), ] self.assertRaises(argparse.ArgumentTypeError, self.check_parser, self.cmd, arglist, verifylist) def test_share_list_name_description_filter(self): arglist = [ '--name~', self.new_share.name, '--description~', self.new_share.description, ] verifylist = [ ('name~', self.new_share.name), ('description~', self.new_share.description), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cmd_columns, cmd_data = self.cmd.take_action(parsed_args) search_opts = self._get_search_opts() search_opts['name~'] = self.new_share.name search_opts['description~'] = self.new_share.description self.shares_mock.list.assert_called_once_with( search_opts=search_opts, ) self.assertEqual(self.columns, cmd_columns) data = self._get_data() self.assertEqual(data, tuple(cmd_data)) def test_list_share_api_version_exception(self): self.app.client_manager.share.api_version = api_versions.APIVersion( "2.35") arglist = [ '--name~', 'Name', '--description~', 'Description', ] verifylist = [ ('name~', 'Name'), ('description~', 'Description'), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) class TestShareShow(TestShare): def setUp(self): super(TestShareShow, self).setUp() self._share = manila_fakes.FakeShare.create_one_share() self.shares_mock.get.return_value = self._share self._export_location = ( manila_fakes.FakeShareExportLocation.create_one_export_location()) # Get the command object to test self.cmd = osc_shares.ShowShare(self.app, None) def test_share_show(self): arglist = [ self._share.id ] verifylist = [ ("share", self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) cliutils.convert_dict_list_to_string = mock.Mock() cliutils.convert_dict_list_to_string.return_value = dict( self._export_location) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.get.assert_called_with(self._share.id) self.assertEqual( manila_fakes.FakeShare.get_share_columns(self._share), columns) self.assertEqual( manila_fakes.FakeShare.get_share_data(self._share), data) class TestShareSet(TestShare): def setUp(self): super(TestShareSet, self).setUp() self._share = manila_fakes.FakeShare.create_one_share( methods={"reset_state": None} ) self.shares_mock.get.return_value = self._share # Get the command object to test self.cmd = osc_shares.SetShare(self.app, None) def test_share_set_property(self): arglist = [ '--property', 'Zorilla=manila', self._share.id, ] verifylist = [ ('property', {'Zorilla': 'manila'}), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.set_metadata.assert_called_with( self._share.id, {'Zorilla': 'manila'}) def test_share_set_name(self): new_name = uuid.uuid4().hex arglist = [ '--name', new_name, self._share.id, ] verifylist = [ ('name', new_name), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.update.assert_called_with( self._share.id, display_name=parsed_args.name) def test_share_set_description(self): new_description = uuid.uuid4().hex arglist = [ '--description', new_description, self._share.id, ] verifylist = [ ('description', new_description), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.update.assert_called_with( self._share.id, display_description=parsed_args.description) def test_share_set_visibility(self): arglist = [ '--public', 'true', self._share.id, ] verifylist = [ ('public', 'true'), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.update.assert_called_with( self._share.id, is_public='true') def test_share_set_visibility_exception(self): arglist = [ '--public', 'not_a_boolean_value', self._share.id, ] verifylist = [ ('public', 'not_a_boolean_value'), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.update.assert_called_with( self._share.id, is_public='not_a_boolean_value') # '--public' takes only boolean value, would raise a BadRequest self.shares_mock.update.side_effect = exceptions.BadRequest() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) def test_share_set_property_exception(self): arglist = [ '--property', 'key=', self._share.id, ] verifylist = [ ('property', {'key': ''}), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.set_metadata.assert_called_with( self._share.id, {'key': ''}) # '--property' takes key=value arguments # missing a value would raise a BadRequest self.shares_mock.set_metadata.side_effect = exceptions.BadRequest() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) def test_share_set_status(self): new_status = 'available' arglist = [ self._share.id, '--status', new_status ] verifylist = [ ('share', self._share.id), ('status', new_status) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) self._share.reset_state.assert_called_with(new_status) self.assertIsNone(result) def test_share_set_status_exception(self): new_status = 'available' arglist = [ self._share.id, '--status', new_status ] verifylist = [ ('share', self._share.id), ('status', new_status) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self._share.reset_state.side_effect = Exception() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) class TestShareUnset(TestShare): def setUp(self): super(TestShareUnset, self).setUp() self._share = manila_fakes.FakeShare.create_one_share() self.shares_mock.get.return_value = self._share # Get the command objects to test self.cmd = osc_shares.UnsetShare(self.app, None) def test_share_unset_property(self): arglist = [ '--property', 'Manila', self._share.id, ] verifylist = [ ('property', ['Manila']), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.delete_metadata.assert_called_with( self._share.id, parsed_args.property) def test_share_unset_name(self): arglist = [ '--name', self._share.id, ] verifylist = [ ('name', True), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.update.assert_called_with( self._share.id, display_name=None) def test_share_unset_description(self): arglist = [ '--description', self._share.id, ] verifylist = [ ('description', True), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.update.assert_called_with( self._share.id, display_description=None) def test_share_unset_name_exception(self): arglist = [ '--name', self._share.id, ] verifylist = [ ('name', True), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.shares_mock.update.side_effect = exceptions.BadRequest() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) def test_share_unset_property_exception(self): arglist = [ '--property', 'Manila', self._share.id, ] verifylist = [ ('property', ['Manila']), ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.delete_metadata.assert_called_with( self._share.id, parsed_args.property) # 404 Not Found would be raised, if property 'Manila' doesn't exist self.shares_mock.delete_metadata.side_effect = exceptions.NotFound() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) class TestResizeShare(TestShare): def setUp(self): super(TestResizeShare, self).setUp() self._share = manila_fakes.FakeShare.create_one_share( attrs={'size': 2, 'status': 'available'}) self.shares_mock.get.return_value = self._share # Get the command objects to test self.cmd = osc_shares.ResizeShare(self.app, None) def test_share_shrink(self): arglist = [ self._share.id, '1' ] verifylist = [ ('share', self._share.id), ('new_size', 1) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.shrink.assert_called_with( self._share, 1 ) def test_share_shrink_exception(self): arglist = [ self._share.id, '1' ] verifylist = [ ('share', self._share.id), ('new_size', 1) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.shares_mock.shrink.side_effect = Exception() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) def test_share_extend(self): arglist = [ self._share.id, '3' ] verifylist = [ ('share', self._share.id), ('new_size', 3) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.extend.assert_called_with( self._share, 3 ) def test_share_extend_exception(self): arglist = [ self._share.id, '3' ] verifylist = [ ('share', self._share.id), ('new_size', 3) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.shares_mock.extend.side_effect = Exception() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) def test_share_resize_already_required_size(self): arglist = [ self._share.id, '2' ] verifylist = [ ('share', self._share.id), ('new_size', 2) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args ) def test_share_missing_args(self): arglist = [ self._share.id ] verifylist = [ ('share', self._share.id) ] self.assertRaises(osc_utils.ParserException, self.check_parser, self.cmd, arglist, verifylist) def test_share_resize_wait(self): arglist = [ self._share.id, '3', '--wait' ] verifylist = [ ('share', self._share.id), ('new_size', 3), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.shares_mock.extend.assert_called_with( self._share, 3 ) self.shares_mock.get.assert_called_with(self._share.id) def test_share_resize_wait_error(self): arglist = [ self._share.id, '3', '--wait' ] verifylist = [ ('share', self._share.id), ('new_size', 3), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) with mock.patch('osc_lib.utils.wait_for_status', return_value=False): self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args ) class TestAdoptShare(TestShare): def setUp(self): super(TestAdoptShare, self).setUp() self._share_type = manila_fakes.FakeShareType.create_one_sharetype() self.share_types_mock.get.return_value = self._share_type self._share = manila_fakes.FakeShare.create_one_share( attrs={ 'status': 'available', 'share_type': self._share_type.id, 'share_server_id': 'server-id' + uuid.uuid4().hex}) self.shares_mock.get.return_value = self._share self.shares_mock.manage.return_value = self._share # Get the command objects to test self.cmd = osc_shares.AdoptShare(self.app, None) self.datalist = tuple(self._share._info.values()) self.columns = tuple(self._share._info.keys()) def test_share_adopt_missing_args(self): arglist = [] verifylist = [] self.assertRaises(osc_utils.ParserException, self.check_parser, self.cmd, arglist, verifylist) def test_share_adopt_required_args(self): arglist = [ 'some.host@driver#pool', 'NFS', '10.0.0.1:/example_path' ] verifylist = [ ('service_host', 'some.host@driver#pool'), ('protocol', 'NFS'), ('export_path', '10.0.0.1:/example_path') ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.manage.assert_called_with( description=None, export_path='10.0.0.1:/example_path', name=None, protocol='NFS', service_host='some.host@driver#pool' ) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) def test_share_adopt(self): arglist = [ 'some.host@driver#pool', 'NFS', '10.0.0.1:/example_path', '--name', self._share.id, '--description', self._share.description, '--share-type', self._share.share_type, '--driver-options', 'key1=value1', 'key2=value2', '--wait', '--public', '--share-server-id', self._share.share_server_id ] verifylist = [ ('service_host', 'some.host@driver#pool'), ('protocol', 'NFS'), ('export_path', '10.0.0.1:/example_path'), ('name', self._share.id), ('description', self._share.description), ('share_type', self._share_type.id), ('driver_options', ['key1=value1', 'key2=value2']), ('wait', True), ('public', True), ('share_server_id', self._share.share_server_id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.manage.assert_called_with( description=self._share.description, driver_options={'key1': 'value1', 'key2': 'value2'}, export_path='10.0.0.1:/example_path', name=self._share.id, protocol='NFS', service_host='some.host@driver#pool', share_server_id=self._share.share_server_id, share_type=self._share_type.id, public=True ) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) @mock.patch('manilaclient.osc.v2.share.LOG') def test_share_adopt_wait_error(self, mock_logger): arglist = [ 'some.host@driver#pool', 'NFS', '10.0.0.1:/example_path', '--wait' ] verifylist = [ ('service_host', 'some.host@driver#pool'), ('protocol', 'NFS'), ('export_path', '10.0.0.1:/example_path'), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) with mock.patch('osc_lib.utils.wait_for_status', return_value=False): columns, data = self.cmd.take_action(parsed_args) self.shares_mock.manage.assert_called_with( description=None, export_path='10.0.0.1:/example_path', name=None, protocol='NFS', service_host='some.host@driver#pool' ) mock_logger.error.assert_called_with( "ERROR: Share is in error state.") self.shares_mock.get.assert_called_with(self._share.id) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) def test_share_adopt_visibility_api_version_exception(self): self.app.client_manager.share.api_version = api_versions.APIVersion( "2.7") arglist = [ 'some.host@driver#pool', 'NFS', '10.0.0.1:/example_path', '--public' ] verifylist = [ ('service_host', 'some.host@driver#pool'), ('protocol', 'NFS'), ('export_path', '10.0.0.1:/example_path'), ('public', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) def test_share_adopt_share_server_api_version_exception(self): self.app.client_manager.share.api_version = api_versions.APIVersion( "2.48") arglist = [ 'some.host@driver#pool', 'NFS', '10.0.0.1:/example_path', '--share-server-id', self._share.share_server_id ] verifylist = [ ('service_host', 'some.host@driver#pool'), ('protocol', 'NFS'), ('export_path', '10.0.0.1:/example_path'), ('share_server_id', self._share.share_server_id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args) class TestAbandonShare(TestShare): def setUp(self): super(TestAbandonShare, self).setUp() self._share = manila_fakes.FakeShare.create_one_share( attrs={'status': 'available'}) self.shares_mock.get.return_value = self._share # Get the command objects to test self.cmd = osc_shares.AbandonShare(self.app, None) def test_share_abandon(self): arglist = [ self._share.id, ] verifylist = [ ('share', [self._share.id]), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) self.shares_mock.unmanage.assert_called_with(self._share) self.assertIsNone(result) def test_share_abandon_wait(self): arglist = [ self._share.id, '--wait' ] verifylist = [ ('share', [self._share.id]), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) with mock.patch('osc_lib.utils.wait_for_delete', return_value=True): result = self.cmd.take_action(parsed_args) self.shares_mock.unmanage.assert_called_with(self._share) self.assertIsNone(result) def test_share_abandon_wait_error(self): arglist = [ self._share.id, '--wait' ] verifylist = [ ('share', [self._share.id]), ('wait', True) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) with mock.patch('osc_lib.utils.wait_for_delete', return_value=False): self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args ) class TestShareExportLocationShow(TestShare): def setUp(self): super(TestShareExportLocationShow, self).setUp() self._share = manila_fakes.FakeShare.create_one_share() self.shares_mock.get.return_value = self._share self._export_location = ( manila_fakes.FakeShareExportLocation.create_one_export_location()) self.export_locations_mock.get.return_value = ( self._export_location ) # Get the command object to test self.cmd = osc_shares.ShareExportLocationShow(self.app, None) def test_share_show_export_location(self): arglist = [ self._share.id, self._export_location.fake_uuid ] verifylist = [ ('share', self._share.id), ('export_location', self._export_location.fake_uuid) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.export_locations_mock.get.assert_called_with( share=self._share, export_location=self._export_location.fake_uuid ) self.assertEqual(tuple(self._export_location._info.keys()), columns) self.assertCountEqual(self._export_location._info.values(), data) class TestShareExportLocationList(TestShare): columns = ['ID', 'Path', 'Preferred'] def setUp(self): super(TestShareExportLocationList, self).setUp() self._share = manila_fakes.FakeShare.create_one_share() self.shares_mock.get.return_value = self._share self._export_locations = [ manila_fakes.FakeShareExportLocation.create_one_export_location()] self.export_locations_mock.list.return_value = ( self._export_locations ) self.values = (oscutils.get_dict_properties( e._info, self.columns) for e in self._export_locations) # Get the command object to test self.cmd = osc_shares.ShareExportLocationList(self.app, None) def test_share_list_export_location(self): arglist = [ self._share.id ] verifylist = [ ('share', self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.export_locations_mock.list.assert_called_with( share=self._share ) self.assertEqual(self.columns, columns) self.assertCountEqual(self.values, data) class TestShowShareProperties(TestShare): properties = { 'key1': 'value1', 'key2': 'value2' } def setUp(self): super(TestShowShareProperties, self).setUp() self._share = manila_fakes.FakeShare.create_one_share( attrs={ 'metadata': osc_fakes.FakeResource( info=self.properties) } ) self.shares_mock.get.return_value = self._share self.shares_mock.get_metadata.return_value = self._share.metadata # Get the command object to test self.cmd = osc_shares.ShowShareProperties(self.app, None) self.datalist = tuple(self._share.metadata._info.values()) self.columns = tuple(self._share.metadata._info.keys()) def test_share_show_properties(self): arglist = [ self._share.id ] verifylist = [ ("share", self._share.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) columns, data = self.cmd.take_action(parsed_args) self.shares_mock.get.assert_called_with(self._share.id) self.shares_mock.get_metadata.assert_called_with(self._share) self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.datalist, data) class TestShareRevert(TestShare): def setUp(self): super(TestShareRevert, self).setUp() self.share = manila_fakes.FakeShare.create_one_share( attrs={'revert_to_snapshot_support': True}, methods={'revert_to_snapshot': None} ) self.share_snapshot = ( manila_fakes.FakeShareSnapshot.create_one_snapshot( attrs={'share_id': self.share.id})) self.shares_mock.get.return_value = self.share self.snapshots_mock.get.return_value = self.share_snapshot self.cmd = osc_shares.RevertShare(self.app, None) def test_share_revert(self): arglist = [ self.share_snapshot.id ] verifylist = [ ('snapshot', self.share_snapshot.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) self.shares_mock.get.assert_called_with(self.share_snapshot.share_id) self.share.revert_to_snapshot.assert_called_with(self.share_snapshot) self.assertIsNone(result) def test_share_revert_exception(self): arglist = [ self.share_snapshot.id ] verifylist = [ ('snapshot', self.share_snapshot.id) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.share.revert_to_snapshot.side_effect = Exception() self.assertRaises( osc_exceptions.CommandError, self.cmd.take_action, parsed_args)
30.533296
78
0.582741
5,955
55,021
5.10529
0.056087
0.042629
0.039076
0.039372
0.813762
0.758963
0.71765
0.675252
0.660779
0.649332
0
0.004389
0.308519
55,021
1,801
79
30.55025
0.794696
0.024681
0
0.592011
0
0
0.075561
0.01578
0
0
0
0
0.094151
1
0.057061
false
0
0.009986
0
0.082739
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
220ef795128833f7c3aac34e5a9154df11f1aa1f
132
py
Python
Chapter14/ch14_cleaningDemo3.py
PacktPublishing/Applied-Computational-Thinking-with-Python
fd9982383c5b473ffa1640998540d602876816e5
[ "MIT" ]
18
2020-11-27T22:41:12.000Z
2021-12-27T08:20:46.000Z
Chapter14/ch14_cleaningDemo3.py
PacktPublishing/Applied-Computational-Thinking-with-Python
fd9982383c5b473ffa1640998540d602876816e5
[ "MIT" ]
null
null
null
Chapter14/ch14_cleaningDemo3.py
PacktPublishing/Applied-Computational-Thinking-with-Python
fd9982383c5b473ffa1640998540d602876816e5
[ "MIT" ]
8
2020-11-30T17:51:11.000Z
2021-12-25T05:23:02.000Z
import pandas as pd myData = pd.read_csv('C:\\Users\\sofia.dejesus\\Documents\\02_book\\demo_missing.csv') print(myData.fillna(0))
26.4
86
0.75
22
132
4.363636
0.863636
0
0
0
0
0
0
0
0
0
0
0.02439
0.068182
132
4
87
33
0.756098
0
0
0
0
0
0.473282
0.473282
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
221222d5b0fddaed7e8773b65de3ab4aad887ee9
4,563
py
Python
jogo_da_forca.py
BRUNOOLIVEIRA13/python_games
a216303b2d1726bf556df540a3b46ca81c49544c
[ "MIT" ]
null
null
null
jogo_da_forca.py
BRUNOOLIVEIRA13/python_games
a216303b2d1726bf556df540a3b46ca81c49544c
[ "MIT" ]
null
null
null
jogo_da_forca.py
BRUNOOLIVEIRA13/python_games
a216303b2d1726bf556df540a3b46ca81c49544c
[ "MIT" ]
null
null
null
import random def jogar(): welcome_message() palavra_secreta = load_secret_key() letras_acertadas = init_correct_letter(palavra_secreta) print("Você precisa advinhar a palavra", letras_acertadas) enforcou = False acertou = False erros = 0 while (not enforcou and not acertou): chute = guess_letter() if (chute in palavra_secreta): verify_guessed_word(chute, letras_acertadas, palavra_secreta) else: erros += 1 desenha_forca(erros) if (erros == 4): print("Dica: é uma fruta!") enforcou = erros == 7 acertou = "_" not in letras_acertadas print("\n", letras_acertadas, "\n") if ("_" in letras_acertadas): letras_faltando = int(str(letras_acertadas.count('_'))) print("Ainda faltam acertar {} letras".format(letras_faltando)) else: print("Você acertou a palavra secreta {}!".format(palavra_secreta)) if (acertou): win_message() else: lose_message(palavra_secreta) ### Funções ### def welcome_message(): print("*" * 32) print("Bem vindo ao jogo da Forca!") print("*" * 32, "\n") def load_secret_key(nome_arquivo="palavras.txt"): palavras = [] with open(nome_arquivo, "r", encoding="utf-8") as arquivo: for linha in arquivo: linha = linha.strip() palavras.append(linha) numero = random.randrange(0, len(palavras)) palavra_secreta = palavras[numero].upper() return palavra_secreta def init_correct_letter(palavra): return ["_" for letra in palavra] def guess_letter(): chute = input("Me diga, qual letra você acha que compõe essa palavra? ") chute = chute.strip().upper() return chute def verify_guessed_word(chute, letras_acertadas, palavra_secreta): index = 0 for letra in palavra_secreta: if (chute == letra): letras_acertadas[index] = letra index += 1 def win_message(): print(" G A N H O U !! ") print(" ___________ ") print(" '._==_==_=_.' ") print(" .-\\: /-. ") print(" | (|:. |) | ") print(" '-|:. |-' ") print(" \\::. / ") print(" '::. .' ") print(" ) ( ") print(" _.' '._ ") print(" '-------' ") def lose_message(palavra_secreta): print("P E R D E U !! Você foi enforcado :( ") print("A palavra era {}".format(palavra_secreta)) print(" _______________ ") print(" / \ ") print(" / \ ") print("// \/\ ") print("\| XXXX XXXX | / ") print(" | XXXX XXXX |/ ") print(" | XXX XXX | ") print(" | | ") print(" \__ XXX __/ ") print(" |\ XXX /| ") print(" | | | | ") print(" | I I I I I I I | ") print(" | I I I I I I | ") print(" \_ _/ ") print(" \_ _/ ") print(" \_______/ ") print(" Tente de novo! ") def desenha_forca(erros): print(" _______ ") print(" |/ | ") if (erros == 1): print(" | (_) ") print(" | ") print(" | ") print(" | ") if (erros == 2): print(" | (_) ") print(" | \ ") print(" | ") print(" | ") if (erros == 3): print(" | (_) ") print(" | \| ") print(" | ") print(" | ") if (erros == 4): print(" | (_) ") print(" | \|/ ") print(" | ") print(" | ") if (erros == 5): print(" | (_) ") print(" | \|/ ") print(" | | ") print(" | ") if (erros == 6): print(" | (_) ") print(" | \|/ ") print(" | | ") print(" | / ") if (erros == 7): print(" | (_) ") print(" | \|/ ") print(" | | ") print(" | / \ ") print(" | ") print("_|___ ") print() ## FIM DAS FUNÇÕES ## if (__name__ == "__main__"): jogar()
26.074286
79
0.414201
382
4,563
4.623037
0.308901
0.243488
0.254813
0.226501
0.227633
0.213477
0.121744
0.08607
0.028313
0
0
0.007316
0.430857
4,563
174
80
26.224138
0.672699
0.00526
0
0.269231
0
0
0.323172
0
0
0
0
0
0
1
0.069231
false
0
0.007692
0.007692
0.1
0.546154
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
1
0
4
22269dcda4aa79ee8daebc8a2fdc3d77d2efee2f
3,640
py
Python
tensorflow_checkpoint_reader/pb/tensorflow/core/protobuf/tpu/compilation_result_pb2.py
shawwn/tensorflow-checkpoint-reader
f0e65548411e3bd66a07e36bb1850907a05952d0
[ "MIT" ]
1
2021-12-02T15:06:09.000Z
2021-12-02T15:06:09.000Z
tensorflow_checkpoint_reader/pb/tensorflow/core/protobuf/tpu/compilation_result_pb2.py
shawwn/tensorflow-checkpoint-reader
f0e65548411e3bd66a07e36bb1850907a05952d0
[ "MIT" ]
null
null
null
tensorflow_checkpoint_reader/pb/tensorflow/core/protobuf/tpu/compilation_result_pb2.py
shawwn/tensorflow-checkpoint-reader
f0e65548411e3bd66a07e36bb1850907a05952d0
[ "MIT" ]
null
null
null
'Generated protocol buffer code.' from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database _sym_db = _symbol_database.Default() from .....tensorflow.compiler.xla.service import hlo_pb2 as tensorflow_dot_compiler_dot_xla_dot_service_dot_hlo__pb2 from .....tensorflow.core.protobuf import error_codes_pb2 as tensorflow_dot_core_dot_protobuf_dot_error__codes__pb2 DESCRIPTOR = _descriptor.FileDescriptor(name='tensorflow/core/protobuf/tpu/compilation_result.proto', package='tensorflow.tpu', syntax='proto3', serialized_options=b'\xf8\x01\x01', create_key=_descriptor._internal_create_key, serialized_pb=b'\n5tensorflow/core/protobuf/tpu/compilation_result.proto\x12\x0etensorflow.tpu\x1a)tensorflow/compiler/xla/service/hlo.proto\x1a*tensorflow/core/protobuf/error_codes.proto"\x86\x01\n\x16CompilationResultProto\x12+\n\x0bstatus_code\x18\x01 \x01(\x0e2\x16.tensorflow.error.Code\x12\x1c\n\x14status_error_message\x18\x02 \x01(\t\x12!\n\nhlo_protos\x18\x03 \x03(\x0b2\r.xla.HloProtoB\x03\xf8\x01\x01b\x06proto3', dependencies=[tensorflow_dot_compiler_dot_xla_dot_service_dot_hlo__pb2.DESCRIPTOR, tensorflow_dot_core_dot_protobuf_dot_error__codes__pb2.DESCRIPTOR]) _COMPILATIONRESULTPROTO = _descriptor.Descriptor(name='CompilationResultProto', full_name='tensorflow.tpu.CompilationResultProto', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='status_code', full_name='tensorflow.tpu.CompilationResultProto.status_code', index=0, number=1, type=14, cpp_type=8, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='status_error_message', full_name='tensorflow.tpu.CompilationResultProto.status_error_message', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b''.decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='hlo_protos', full_name='tensorflow.tpu.CompilationResultProto.hlo_protos', index=2, number=3, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[], serialized_start=161, serialized_end=295) _COMPILATIONRESULTPROTO.fields_by_name['status_code'].enum_type = tensorflow_dot_core_dot_protobuf_dot_error__codes__pb2._CODE _COMPILATIONRESULTPROTO.fields_by_name['hlo_protos'].message_type = tensorflow_dot_compiler_dot_xla_dot_service_dot_hlo__pb2._HLOPROTO DESCRIPTOR.message_types_by_name['CompilationResultProto'] = _COMPILATIONRESULTPROTO _sym_db.RegisterFileDescriptor(DESCRIPTOR) CompilationResultProto = _reflection.GeneratedProtocolMessageType('CompilationResultProto', (_message.Message,), {'DESCRIPTOR': _COMPILATIONRESULTPROTO, '__module__': 'tensorflow.core.protobuf.tpu.compilation_result_pb2'}) _sym_db.RegisterMessage(CompilationResultProto) DESCRIPTOR._options = None
191.578947
1,624
0.851374
484
3,640
6.004132
0.241736
0.03097
0.045767
0.046456
0.443221
0.413627
0.300757
0.300757
0.274604
0.259463
0
0.028064
0.040659
3,640
18
1,625
202.222222
0.804124
0.008516
0
0
1
0.058824
0.253916
0.210223
0
0
0
0
0
1
0
false
0
0.352941
0
0.352941
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
2246d3939e8b635d23e0c9d9be0ad88edc821be9
2,268
py
Python
DailyProgrammer/DP20121103C.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
2
2020-12-23T18:59:22.000Z
2021-04-14T13:16:09.000Z
DailyProgrammer/DP20121103C.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
null
null
null
DailyProgrammer/DP20121103C.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
null
null
null
""" [11/3/2012] Challenge #110 [Difficult] You can't handle the truth! https://www.reddit.com/r/dailyprogrammer/comments/12k3xw/1132012_challenge_110_difficult_you_cant_handle/ **Description:** [Truth Tables](http://en.wikipedia.org/wiki/Truth_table) are a simple table that demonstrates all possible results given a Boolean algebra function. An example Boolean algebra function would be "A or B", where there are four possible combinations, one of which is "A:false, B:false, Result: false" Your goal is to write a Boolean algebra function truth-table generator for statements that are up to 4 variables (always A, B, C, or D) and for only the following operators: [not](http://en.wikipedia.org/wiki/Logical_NOT), [and](http://en.wikipedia.org/wiki/Logical_AND), [or](http://en.wikipedia.org/wiki/Logical_OR), [nand](http://en.wikipedia.org/wiki/Logical_NAND), and [nor](http://en.wikipedia.org/wiki/Logical_NOR). Note that you must maintain order of operator correctness, though evaluate left-to-right if there are ambiguous statements. **Formal Inputs & Outputs:** *Input Description:* String BoolFunction - A string of one or more variables (always A, B, C, or D) and keyboards (not, and, or, nand, nor). This string is guaranteed to be valid *Output Description:* Your application must print all possible combinations of states for all variables, with the last variable being "Result", which should the correct result if the given variables were set to the given values. An example row would be "A:false, B:false, Result: false" **Sample Inputs & Outputs:** Given "A and B", your program should print the following: A:false, B:false, Result: false A:true, B:false, Result: false A:false, B:true, Result: false A:true, B:true, Result: true **Notes:** To help with cycling through all boolean combinations, realize that when counting from 0 to 3 in binary, you generate a table of all combinations of 2 variables (00, 01, 10, 11). You can extrapolate this out to itterating through all table rows for a given variable count. [Challenge #105](http://www.reddit.com/r/dailyprogrammer/comments/11shtj/10202012_challenge_105_intermediate_boolean_logic/) has a very similar premise to this challenge. """ def main(): pass if __name__ == "__main__": main()
50.4
119
0.765873
366
2,268
4.677596
0.418033
0.021028
0.05257
0.063084
0.231308
0.195093
0.028037
0.028037
0
0
0
0.025888
0.131393
2,268
44
120
51.545455
0.843147
0.968254
0
0
0
0
0.125
0
0
0
0
0
0
1
0.25
true
0.25
0
0
0.25
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
1
1
0
0
0
0
0
4
97d737139948820e64955902a911eca0be4a101f
70
py
Python
app/app/calc.py
AlextheGrace/recipe-app-api
9779f38a58954eaf949b35ad26d885363e8f8039
[ "MIT" ]
null
null
null
app/app/calc.py
AlextheGrace/recipe-app-api
9779f38a58954eaf949b35ad26d885363e8f8039
[ "MIT" ]
null
null
null
app/app/calc.py
AlextheGrace/recipe-app-api
9779f38a58954eaf949b35ad26d885363e8f8039
[ "MIT" ]
null
null
null
def add(x,y): """add two numbers together""" return x + y
10
34
0.528571
11
70
3.363636
0.727273
0.108108
0
0
0
0
0
0
0
0
0
0
0.314286
70
6
35
11.666667
0.770833
0.342857
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
97fc585bb948b81c7f7304d094ec943d613200a9
3,669
py
Python
src/orion/core/io/convert.py
DatCorno/orion
59caa57f03691d0670fe005cc64bdaf12b7d061f
[ "BSD-3-Clause" ]
null
null
null
src/orion/core/io/convert.py
DatCorno/orion
59caa57f03691d0670fe005cc64bdaf12b7d061f
[ "BSD-3-Clause" ]
null
null
null
src/orion/core/io/convert.py
DatCorno/orion
59caa57f03691d0670fe005cc64bdaf12b7d061f
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- """ :mod:`orion.core.worker.convert` -- Parse and generate user script's configuration ================================================================================== .. module:: convert :platform: Unix :synopsis: Defines and instantiates a converter for configuration file types. Given a file path infer which configuration file parser/emitter it corresponds to. Define `Converter` classes with a common interface for many popular configuration file types. Currently supported: - YAML - JSON """ from abc import (ABC, abstractmethod) import importlib import os from orion.core.utils import Factory def infer_converter_from_file_type(config_path): """Use filetype extension to infer and build the correct configuration file converter. """ _, ext_type = os.path.splitext(os.path.abspath(config_path)) for klass in Converter.types: if ext_type in klass.file_extensions: return klass() error = "Could not recognise file extension '{0}'.".format(ext_type) error += "Supported converters: {0}".format(Converter.types) raise NotImplementedError(error) class BaseConverter(ABC): """Base class for configuration parsers/generators. Attributes ---------- file_extensions : list of strings Strings starting with '.' which identify usually a file type as a common convention. For instance, ``['.yml', '.yaml']`` for YAML files. """ file_extensions = [] @abstractmethod def parse(self, filepath): """Read dictionary out of the configuration file. Parameters ---------- filepath : str Full path to the original user script's configuration. """ pass @abstractmethod def generate(self, filepath, data): """Create a configuration file at `filepath` using dictionary `data`.""" pass class YAMLConverter(BaseConverter): """Converter for YAML files.""" file_extensions = ['.yml', '.yaml'] def __init__(self): """Try to dynamically import yaml module.""" self.yaml = importlib.import_module('yaml') def parse(self, filepath): """Read dictionary out of the configuration file. Parameters ---------- file : str Full path to the original user script's configuration. """ with open(filepath) as f: return self.yaml.load(stream=f) def generate(self, filepath, data): """Create a configuration file at `filepath` using dictionary `data`.""" with open(filepath, 'w') as f: self.yaml.dump(data, stream=f) class JSONConverter(BaseConverter): """Converter for JSON files.""" file_extensions = ['.json'] def __init__(self): """Try to dynamically import json module.""" self.json = importlib.import_module('json') def parse(self, filepath): """Read dictionary out of the configuration file. Parameters ---------- file : str Full path to the original user script's configuration. """ with open(filepath) as f: return self.json.load(f) def generate(self, filepath, data): """Create a configuration file at `filepath` using dictionary `data`.""" with open(filepath, 'w') as f: self.json.dump(data, f) # pylint: disable=too-few-public-methods,abstract-method class Converter(BaseConverter, metaclass=Factory): """Class used to inject dependency on a configuration file parser/generator. .. seealso:: `Factory` metaclass and `BaseConverter` interface. """ pass
27.586466
82
0.627691
416
3,669
5.475962
0.329327
0.08209
0.019315
0.042142
0.36216
0.339333
0.339333
0.31036
0.31036
0.31036
0
0.001077
0.240665
3,669
132
83
27.795455
0.816583
0.493322
0
0.404762
1
0
0.055762
0
0
0
0
0
0
1
0.214286
false
0.071429
0.142857
0
0.595238
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
1
0
1
0
0
1
0
0
4
3f0694c217b5533310060349ecfb27b50a290c6f
218
py
Python
app/main/forms/user_research.py
alphagov-mirror/digitalmarketplace-user-frontend
d45c76d5e8f52246423d00bd50ac93e19485e6ca
[ "MIT" ]
null
null
null
app/main/forms/user_research.py
alphagov-mirror/digitalmarketplace-user-frontend
d45c76d5e8f52246423d00bd50ac93e19485e6ca
[ "MIT" ]
86
2017-09-14T09:20:13.000Z
2021-07-01T10:31:52.000Z
app/main/forms/user_research.py
alphagov-mirror/digitalmarketplace-user-frontend
d45c76d5e8f52246423d00bd50ac93e19485e6ca
[ "MIT" ]
6
2017-09-14T09:34:06.000Z
2021-04-10T18:07:14.000Z
from flask_wtf import FlaskForm from wtforms import BooleanField class UserResearchOptInForm(FlaskForm): user_research_opt_in = BooleanField("Send me emails about opportunities to get involved in user research")
31.142857
110
0.830275
28
218
6.321429
0.75
0.135593
0
0
0
0
0
0
0
0
0
0
0.133028
218
6
111
36.333333
0.936508
0
0
0
0
0
0.307339
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
3f0b05e516193b1b1174306ad35669d040e5b1ee
14
py
Python
data/studio21_generated/interview/1780/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
data/studio21_generated/interview/1780/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
data/studio21_generated/interview/1780/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
def prod(u):
7
12
0.571429
3
14
2.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.214286
14
2
13
7
0.727273
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
3f0bcd24676e8d01d71717798663dea11acf6f11
83
py
Python
tests/function_keyword/my_program.py
aroberge/importhooks
57483ce24d265d391587f6321954f2ed60f04afd
[ "MIT" ]
36
2020-02-23T19:06:24.000Z
2022-02-20T22:53:02.000Z
tests/function_keyword/my_program.py
aroberge/importhooks
57483ce24d265d391587f6321954f2ed60f04afd
[ "MIT" ]
13
2020-02-21T15:25:40.000Z
2021-07-01T09:56:35.000Z
tests/function_keyword/my_program.py
aroberge/importhooks
57483ce24d265d391587f6321954f2ed60f04afd
[ "MIT" ]
1
2020-11-05T13:12:07.000Z
2020-11-05T13:12:07.000Z
square = function x: x**2 print("From my_program: the square of 3 is", square(3))
20.75
55
0.686747
16
83
3.5
0.75
0
0
0
0
0
0
0
0
0
0
0.043478
0.168675
83
3
56
27.666667
0.768116
0
0
0
0
0
0.421687
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
1
0
4
3f37c8b6cf8bf3476d9e54669e3eaadba29c8158
174
py
Python
src/day8.py
initsysctrl/data_analysis
29f767c2a59342bc5ec6bcf4e1611b4cba9fdd70
[ "MIT" ]
null
null
null
src/day8.py
initsysctrl/data_analysis
29f767c2a59342bc5ec6bcf4e1611b4cba9fdd70
[ "MIT" ]
null
null
null
src/day8.py
initsysctrl/data_analysis
29f767c2a59342bc5ec6bcf4e1611b4cba9fdd70
[ "MIT" ]
null
null
null
from sympy import solve, sin, cos, pprint from sympy.abc import x, y from sympy.plotting import plot import numpy as np sol = solve(x**2+2*x+5, x) pprint(sol) plot(sin(x))
17.4
41
0.718391
35
174
3.571429
0.514286
0.216
0
0
0
0
0
0
0
0
0
0.020548
0.16092
174
9
42
19.333333
0.835616
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.571429
0
0.571429
0.285714
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
3f4e638fb88f1c567b417d48c30e490da31185a5
24
py
Python
.buildozer/android/platform/build-armeabi-v7a/build/venv/lib/python3.7/os.py
VPetras/mobile-test-app
6708dade6873ae2fb1ecb13aa70662f95fb42dc6
[ "MIT" ]
12
2019-08-02T07:58:16.000Z
2022-01-31T23:45:08.000Z
.buildozer/android/platform/build-armeabi-v7a/build/venv/lib/python3.7/os.py
VPetras/mobile-test-app
6708dade6873ae2fb1ecb13aa70662f95fb42dc6
[ "MIT" ]
9
2020-06-06T01:18:22.000Z
2022-02-10T10:08:20.000Z
.buildozer/android/platform/build-armeabi-v7a/build/venv/lib/python3.7/os.py
VPetras/mobile-test-app
6708dade6873ae2fb1ecb13aa70662f95fb42dc6
[ "MIT" ]
11
2019-07-31T16:23:36.000Z
2022-01-29T08:30:07.000Z
/usr/lib/python3.7/os.py
24
24
0.75
6
24
3
1
0
0
0
0
0
0
0
0
0
0
0.083333
0
24
1
24
24
0.666667
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
3f594c07041fe6c23ffa1e89f1967522fc36634f
98
py
Python
educa/students/admin.py
kformanowicz/educa
290883dc973345c6d3784c6bb0cb784cec80fa60
[ "MIT" ]
null
null
null
educa/students/admin.py
kformanowicz/educa
290883dc973345c6d3784c6bb0cb784cec80fa60
[ "MIT" ]
9
2020-06-05T20:29:39.000Z
2022-03-12T00:10:48.000Z
educa/students/admin.py
kformanowicz/educa
290883dc973345c6d3784c6bb0cb784cec80fa60
[ "MIT" ]
null
null
null
from django.contrib import admin admin.site.index_template = 'memcache_status/admin_index.html'
19.6
62
0.826531
14
98
5.571429
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.091837
98
4
63
24.5
0.876404
0
0
0
0
0
0.326531
0.326531
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
3f6dd54c62f1cbb6f05c7a43f292594ea7acd01c
94
py
Python
util/cmd.py
Mael-zys/Deep-Learning-Methods-for-Cervical-Cancer-Classifier
9d5fa406137178782a63348d67d0237c2e7f714e
[ "MIT" ]
null
null
null
util/cmd.py
Mael-zys/Deep-Learning-Methods-for-Cervical-Cancer-Classifier
9d5fa406137178782a63348d67d0237c2e7f714e
[ "MIT" ]
null
null
null
util/cmd.py
Mael-zys/Deep-Learning-Methods-for-Cervical-Cancer-Classifier
9d5fa406137178782a63348d67d0237c2e7f714e
[ "MIT" ]
null
null
null
#encoding = utf-8 def Cmd(cmd): import subprocess return subprocess.getoutput(cmd)
13.428571
36
0.691489
12
94
5.416667
0.75
0
0
0
0
0
0
0
0
0
0
0.013514
0.212766
94
6
37
15.666667
0.864865
0.170213
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
0
0
0
4
3f73306dd6a0effac0817a15d595129fd7a3aa99
50
py
Python
day37_habit_tracking_app/main.py
frnkvsk/python100days
70d607ca58a526f0d66544ed65405b2425718108
[ "Unlicense" ]
null
null
null
day37_habit_tracking_app/main.py
frnkvsk/python100days
70d607ca58a526f0d66544ed65405b2425718108
[ "Unlicense" ]
null
null
null
day37_habit_tracking_app/main.py
frnkvsk/python100days
70d607ca58a526f0d66544ed65405b2425718108
[ "Unlicense" ]
null
null
null
# import create_graph # import post_graph_pixel
16.666667
25
0.8
7
50
5.285714
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.16
50
3
25
16.666667
0.880952
0.86
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
58c217833facac8b4b60a00255e4aeb8afb24410
96
py
Python
main.py
wwagner4/robocup-soccer
b0af42cfb39a69e4a65be6059564a5c89ca7cbad
[ "MIT" ]
null
null
null
main.py
wwagner4/robocup-soccer
b0af42cfb39a69e4a65be6059564a5c89ca7cbad
[ "MIT" ]
null
null
null
main.py
wwagner4/robocup-soccer
b0af42cfb39a69e4a65be6059564a5c89ca7cbad
[ "MIT" ]
null
null
null
import fire from aigent.runner import Runner if __name__ == '__main__': fire.Fire(Runner)
13.714286
32
0.729167
13
96
4.769231
0.615385
0
0
0
0
0
0
0
0
0
0
0
0.177083
96
6
33
16
0.78481
0
0
0
0
0
0.083333
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
58cb3113bfaa70762ecb900928c8f57e7f68dbe7
48
py
Python
files/python_by_examples/02_variables/01_strings/02_concatenate.py
Sher-Chowdhury/CentOS7-Python
2282aa2b8396891a060a132a3b340cc810bbf746
[ "Apache-2.0" ]
null
null
null
files/python_by_examples/02_variables/01_strings/02_concatenate.py
Sher-Chowdhury/CentOS7-Python
2282aa2b8396891a060a132a3b340cc810bbf746
[ "Apache-2.0" ]
null
null
null
files/python_by_examples/02_variables/01_strings/02_concatenate.py
Sher-Chowdhury/CentOS7-Python
2282aa2b8396891a060a132a3b340cc810bbf746
[ "Apache-2.0" ]
null
null
null
message = 'My name is ' 'Tom' print(message)
8
29
0.625
7
48
4.285714
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.229167
48
5
30
9.6
0.810811
0
0
0
0
0
0.297872
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
58d973a5eb1e581cbff251d382f2afe608500f68
192
py
Python
ch02/myproject_virtualenv/src/django-myproject/myproject/apps/ideas2/apps.py
PacktPublishing/Django-3-Web-Development-Cookbook
6ffe6e0add93a43a9abaff62e0147dc1f4f5351a
[ "MIT" ]
159
2019-11-13T14:11:39.000Z
2022-03-24T05:47:10.000Z
ch02/myproject_virtualenv/src/django-myproject/myproject/apps/ideas2/apps.py
PacktPublishing/Django-3-Web-Development-Cookbook
6ffe6e0add93a43a9abaff62e0147dc1f4f5351a
[ "MIT" ]
34
2019-11-06T08:32:48.000Z
2022-01-14T11:31:29.000Z
ch02/myproject_virtualenv/src/django-myproject/myproject/apps/ideas2/apps.py
PacktPublishing/Django-3-Web-Development-Cookbook
6ffe6e0add93a43a9abaff62e0147dc1f4f5351a
[ "MIT" ]
103
2019-08-15T21:35:26.000Z
2022-03-20T05:29:11.000Z
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class Ideas2AppConfig(AppConfig): name = "myproject.apps.ideas2" verbose_name = _("Ideas 2")
24
54
0.765625
24
192
5.958333
0.75
0.13986
0
0
0
0
0
0
0
0
0
0.018405
0.151042
192
7
55
27.428571
0.858896
0
0
0
0
0
0.145833
0.109375
0
0
0
0
0
1
0
false
0
0.4
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
58df4e3609640f38804d22fec43cb38b5e1fee54
1,140
py
Python
tensorflow/python/framework/experimental/thread_local_stack.py
EricRemmerswaal/tensorflow
141ff27877579c81a213fa113bd1b474c1749aca
[ "Apache-2.0" ]
190,993
2015-11-09T13:17:30.000Z
2022-03-31T23:05:27.000Z
tensorflow/python/framework/experimental/thread_local_stack.py
EricRemmerswaal/tensorflow
141ff27877579c81a213fa113bd1b474c1749aca
[ "Apache-2.0" ]
48,461
2015-11-09T14:21:11.000Z
2022-03-31T23:17:33.000Z
tensorflow/python/framework/experimental/thread_local_stack.py
EricRemmerswaal/tensorflow
141ff27877579c81a213fa113bd1b474c1749aca
[ "Apache-2.0" ]
104,981
2015-11-09T13:40:17.000Z
2022-03-31T19:51:54.000Z
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # 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. # ============================================================================== """Thread-local stack.""" import threading # TODO(srbs): Move this to C++. class ThreadLocalStack(threading.local): """A thread-local stack of objects for providing implicit defaults.""" def __init__(self): super(ThreadLocalStack, self).__init__() self._stack = [] def peek(self): return self._stack[-1] if self._stack else None def push(self, ctx): return self._stack.append(ctx) def pop(self): self._stack.pop()
31.666667
80
0.67807
155
1,140
4.903226
0.612903
0.078947
0.034211
0.042105
0
0
0
0
0
0
0
0.009434
0.163158
1,140
35
81
32.571429
0.787212
0.680702
0
0
0
0
0
0
0
0
0
0.028571
0
1
0.363636
false
0
0.090909
0.181818
0.727273
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
4
451ad9d2320128b05571266a9b5a591031d3d556
129
py
Python
www/user/__init__.py
tcmug/flacker
08fdd9e9ebb33084ec6c476cae57245064301f42
[ "MIT" ]
null
null
null
www/user/__init__.py
tcmug/flacker
08fdd9e9ebb33084ec6c476cae57245064301f42
[ "MIT" ]
null
null
null
www/user/__init__.py
tcmug/flacker
08fdd9e9ebb33084ec6c476cae57245064301f42
[ "MIT" ]
null
null
null
# USER from flask import Blueprint, abort user = Blueprint('user', __name__, template_folder='templates') from views import *
16.125
63
0.751938
16
129
5.75
0.6875
0
0
0
0
0
0
0
0
0
0
0
0.147287
129
7
64
18.428571
0.836364
0.031008
0
0
0
0
0.105691
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0.666667
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
1
0
4
451afe10f7c330c86c4cc6f699c83ad3c9627829
573
py
Python
src/wai/annotations/core/component/util/__init__.py
waikato-ufdl/wai-annotations-core
bac3429e9488efb456972c74f9d462f951c4af3d
[ "Apache-2.0" ]
null
null
null
src/wai/annotations/core/component/util/__init__.py
waikato-ufdl/wai-annotations-core
bac3429e9488efb456972c74f9d462f951c4af3d
[ "Apache-2.0" ]
3
2021-06-30T23:42:47.000Z
2022-03-01T03:45:07.000Z
src/wai/annotations/core/component/util/__init__.py
waikato-ufdl/wai-annotations-core
bac3429e9488efb456972c74f9d462f951c4af3d
[ "Apache-2.0" ]
null
null
null
""" Utility classes for building conversion components. """ from ._AnnotationFileProcessor import AnnotationFileProcessor from ._Buffer import Buffer from ._Enumerator import Enumerator from ._JSONFileWriter import JSONFileWriter from ._LocalFilenameSource import LocalFilenameSource from ._LocalFileWriter import LocalFileWriter, ExpectsFile, ExpectsDirectory, iterate_files from ._SeparateFileWriter import SeparateFileWriter from ._splitting import SplitSink, SplitState, RequiresNoSplitFinalisation, WithPersistentSplitFiles from ._WithRandomness import WithRandomness
44.076923
100
0.874346
49
573
10.020408
0.510204
0
0
0
0
0
0
0
0
0
0
0
0.08726
573
12
101
47.75
0.938815
0.089005
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
1884887ef918dfe466059e988ce2d1c068c15721
87
py
Python
subframe/error.py
joshbode/subframe
af035ee75f2c9a0d11f538dd88b9491c92389b65
[ "MIT" ]
2
2015-08-24T02:19:01.000Z
2015-08-24T03:31:06.000Z
subframe/error.py
joshbode/subframe
af035ee75f2c9a0d11f538dd88b9491c92389b65
[ "MIT" ]
null
null
null
subframe/error.py
joshbode/subframe
af035ee75f2c9a0d11f538dd88b9491c92389b65
[ "MIT" ]
null
null
null
""" Exceptions """ class SubFrameError(Exception): """General error.""" pass
9.666667
31
0.609195
7
87
7.571429
1
0
0
0
0
0
0
0
0
0
0
0
0.206897
87
8
32
10.875
0.768116
0.287356
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
188825f51454e32dce51e09deb2805db5a86cb08
137
py
Python
edmundbotadder/__main__.py
thebeanogamer/edmund-botadder
91e71ce572f3206b99e1f7a68d40bc37b947daf5
[ "MIT" ]
null
null
null
edmundbotadder/__main__.py
thebeanogamer/edmund-botadder
91e71ce572f3206b99e1f7a68d40bc37b947daf5
[ "MIT" ]
null
null
null
edmundbotadder/__main__.py
thebeanogamer/edmund-botadder
91e71ce572f3206b99e1f7a68d40bc37b947daf5
[ "MIT" ]
null
null
null
"""Entry point for the 'python -m edmundbotadder' command.""" import edmundbotadder if __name__ == '__main__': edmundbotadder.main()
17.125
61
0.729927
15
137
6.133333
0.8
0
0
0
0
0
0
0
0
0
0
0
0.138686
137
7
62
19.571429
0.779661
0.40146
0
0
0
0
0.105263
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
4
188e79b0affddbc2d4b83451aa4cc60c5810a1ae
2,986
py
Python
api/tacticalrmm/winupdate/migrations/0010_auto_20210119_0052.py
infinite8co/tacticalrmm
bd7ce5417ec672552ec3cba325318795ccde972e
[ "MIT" ]
903
2019-10-22T22:56:42.000Z
2022-03-18T14:15:54.000Z
api/tacticalrmm/winupdate/migrations/0010_auto_20210119_0052.py
infinite8co/tacticalrmm
bd7ce5417ec672552ec3cba325318795ccde972e
[ "MIT" ]
720
2019-12-07T08:11:26.000Z
2022-03-17T21:47:04.000Z
api/tacticalrmm/winupdate/migrations/0010_auto_20210119_0052.py
infinite8co/tacticalrmm
bd7ce5417ec672552ec3cba325318795ccde972e
[ "MIT" ]
231
2020-02-11T14:14:21.000Z
2022-03-16T21:23:10.000Z
# Generated by Django 3.1.5 on 2021-01-19 00:52 import django.contrib.postgres.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("winupdate", "0009_auto_20200922_1344"), ] operations = [ migrations.AddField( model_name="winupdate", name="categories", field=django.contrib.postgres.fields.ArrayField( base_field=models.CharField(blank=True, max_length=255, null=True), blank=True, default=list, null=True, size=None, ), ), migrations.AddField( model_name="winupdate", name="category_ids", field=django.contrib.postgres.fields.ArrayField( base_field=models.CharField(blank=True, max_length=255, null=True), blank=True, default=list, null=True, size=None, ), ), migrations.AddField( model_name="winupdate", name="kb_article_ids", field=django.contrib.postgres.fields.ArrayField( base_field=models.CharField(blank=True, max_length=255, null=True), blank=True, default=list, null=True, size=None, ), ), migrations.AddField( model_name="winupdate", name="more_info_urls", field=django.contrib.postgres.fields.ArrayField( base_field=models.TextField(blank=True, null=True), blank=True, default=list, null=True, size=None, ), ), migrations.AddField( model_name="winupdate", name="revision_number", field=models.IntegerField(blank=True, null=True), ), migrations.AddField( model_name="winupdate", name="support_url", field=models.TextField(blank=True, null=True), ), migrations.AlterField( model_name="winupdate", name="date_installed", field=models.DateTimeField(blank=True, null=True), ), migrations.AlterField( model_name="winupdate", name="description", field=models.TextField(blank=True, null=True), ), migrations.AlterField( model_name="winupdate", name="guid", field=models.CharField(blank=True, max_length=255, null=True), ), migrations.AlterField( model_name="winupdate", name="kb", field=models.CharField(blank=True, max_length=100, null=True), ), migrations.AlterField( model_name="winupdate", name="title", field=models.TextField(blank=True, null=True), ), ]
31.765957
83
0.526457
271
2,986
5.686347
0.250923
0.087605
0.128488
0.157041
0.786502
0.772875
0.72096
0.66061
0.600909
0.56392
0
0.024274
0.365372
2,986
93
84
32.107527
0.788918
0.01507
0
0.724138
1
0
0.082681
0.007826
0
0
0
0
0
1
0
false
0
0.022989
0
0.057471
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
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
18ae7f4723b4862a6332c32fa2e20d2cfdb6eb2d
288
py
Python
api/exceptions/root.py
aarongrisez/bellga.me2API
324fe95f455f2c8053473202f294a0f1d100305b
[ "MIT" ]
null
null
null
api/exceptions/root.py
aarongrisez/bellga.me2API
324fe95f455f2c8053473202f294a0f1d100305b
[ "MIT" ]
null
null
null
api/exceptions/root.py
aarongrisez/bellga.me2API
324fe95f455f2c8053473202f294a0f1d100305b
[ "MIT" ]
null
null
null
import importlib import os from api.config.settings import settings from api.core.autoloading import get_initialization def is_handler(name): """ """ return name in settings.allowed_handlers def init(app): return get_initialization("handlers", __file__, is_handler)(app)
24
68
0.763889
38
288
5.552632
0.578947
0.066351
0
0
0
0
0
0
0
0
0
0
0.149306
288
12
68
24
0.861224
0
0
0
0
0
0.028777
0
0
0
0
0
0
1
0.25
false
0
0.5
0.125
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
4
18b8c25ccc960dacd32df62409c34e1a9fbf3e63
59
py
Python
klak/__init__.py
aubricus/clack
6f8b4efb329251f02005c9859091be7345beb717
[ "MIT" ]
1
2018-03-22T19:28:20.000Z
2018-03-22T19:28:20.000Z
klak/__init__.py
aubricus/clack
6f8b4efb329251f02005c9859091be7345beb717
[ "MIT" ]
133
2018-03-30T19:31:00.000Z
2020-01-11T04:33:46.000Z
klak/__init__.py
aubricus/klak
6f8b4efb329251f02005c9859091be7345beb717
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Top-level package for klak."""
14.75
33
0.542373
8
59
4
1
0
0
0
0
0
0
0
0
0
0
0.020408
0.169492
59
3
34
19.666667
0.632653
0.847458
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
18bd88c4afd0fce2b76383e11bd288eff4492b7f
18
py
Python
data/studio21_generated/introductory/2925/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
data/studio21_generated/introductory/2925/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
data/studio21_generated/introductory/2925/starter_code.py
vijaykumawat256/Prompt-Summarization
614f5911e2acd2933440d909de2b4f86653dc214
[ "Apache-2.0" ]
null
null
null
def multiply(n):
9
16
0.666667
3
18
4
1
0
0
0
0
0
0
0
0
0
0
0
0.166667
18
2
17
9
0.8
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
7a126c1f7b2e86222c73a6c985496f9482a981f8
113
py
Python
atlas/signer.py
mediconnect/backend
be49ffe7182fe21b2d41e4c7cc3b853b870d87c7
[ "Apache-2.0" ]
null
null
null
atlas/signer.py
mediconnect/backend
be49ffe7182fe21b2d41e4c7cc3b853b870d87c7
[ "Apache-2.0" ]
14
2018-03-21T02:38:57.000Z
2018-11-17T06:38:51.000Z
atlas/signer.py
mediconnect/backend
be49ffe7182fe21b2d41e4c7cc3b853b870d87c7
[ "Apache-2.0" ]
null
null
null
from django.core.signing import Signer,TimestampSigner,BadSignature,SignatureExpired signer = TimestampSigner()
28.25
84
0.858407
11
113
8.818182
0.818182
0.43299
0
0
0
0
0
0
0
0
0
0
0.070796
113
3
85
37.666667
0.92381
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
e139075bb549aff47f6633bf7598fb23777fe170
294
py
Python
paquetes/ej5-ecommerce/inventario/modelos/producto.py
gabvillacis/modulos_y_paquetes
67895f81d266961486de06b75d8a1e0c86714e15
[ "MIT" ]
null
null
null
paquetes/ej5-ecommerce/inventario/modelos/producto.py
gabvillacis/modulos_y_paquetes
67895f81d266961486de06b75d8a1e0c86714e15
[ "MIT" ]
null
null
null
paquetes/ej5-ecommerce/inventario/modelos/producto.py
gabvillacis/modulos_y_paquetes
67895f81d266961486de06b75d8a1e0c86714e15
[ "MIT" ]
null
null
null
class Producto: def __init__(self, codigo: str, nombre: str, precio: float) -> None: self.codigo = codigo self.nombre = nombre self.precio = precio def __str__(self) -> str: return f'(Código: {self.codigo}, Nombre: {self.nombre}, Precio: {self.precio})'
36.75
87
0.615646
36
294
4.805556
0.388889
0.17341
0
0
0
0
0
0
0
0
0
0
0.244898
294
8
87
36.75
0.779279
0
0
0
0
0.142857
0.233898
0
0
0
0
0
0
1
0.285714
false
0
0
0.142857
0.571429
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
1
1
0
0
4
e139a1d6b7d75f8aa652a7086d7bde0130d9f908
95
py
Python
src/adminboard/apps.py
georgy-komarov/innopolis-sec.deploy
dee116738de7e209b6ba54506431b815aaf1789f
[ "MIT" ]
4
2018-08-24T11:54:56.000Z
2018-08-24T18:13:10.000Z
src/adminboard/apps.py
georgy-komarov/innopolis-sec.deploy
dee116738de7e209b6ba54506431b815aaf1789f
[ "MIT" ]
null
null
null
src/adminboard/apps.py
georgy-komarov/innopolis-sec.deploy
dee116738de7e209b6ba54506431b815aaf1789f
[ "MIT" ]
null
null
null
from django.apps import AppConfig class AdminboardConfig(AppConfig): name = 'adminboard'
15.833333
34
0.768421
10
95
7.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.157895
95
5
35
19
0.9125
0
0
0
0
0
0.105263
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
e14aabea363b466d29dcf7334167ea97148613bf
206
py
Python
app/recommend/recommend.py
ExFly/AcademicResearchTraining
14df50c88d5b6d50fc0cf87c8b8887c16e0a66b5
[ "MIT" ]
11
2016-04-18T09:08:15.000Z
2021-07-16T07:07:03.000Z
app/recommend/recommend.py
ExFly/AcademicResearchTraining
14df50c88d5b6d50fc0cf87c8b8887c16e0a66b5
[ "MIT" ]
1
2016-10-03T20:43:27.000Z
2016-10-03T20:43:27.000Z
app/recommend/recommend.py
ExFly/AcademicResearchTraining
14df50c88d5b6d50fc0cf87c8b8887c16e0a66b5
[ "MIT" ]
7
2016-09-23T15:53:33.000Z
2020-10-09T08:38:47.000Z
# coding:utf-8 from custor.handlers.basehandler import BaseRequestHandler class RecommendHandler(BaseRequestHandler): def get(self, *args, **kwargs): self.render('recommend/recommend.html')
20.6
58
0.747573
22
206
7
0.863636
0
0
0
0
0
0
0
0
0
0
0.00565
0.140777
206
9
59
22.888889
0.864407
0.058252
0
0
0
0
0.125654
0.125654
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
e156244c0dc3c0d05c0aaf7fa393fd8422cc3cf9
224
py
Python
profiles/api/filters.py
EmiM/portal_backend
277ec6fdcb3cf50aaecef6b8841b88e0f52f2bff
[ "Apache-2.0" ]
1
2019-05-04T11:34:44.000Z
2019-05-04T11:34:44.000Z
profiles/api/filters.py
EmiM/portal_backend
277ec6fdcb3cf50aaecef6b8841b88e0f52f2bff
[ "Apache-2.0" ]
18
2019-06-19T15:06:56.000Z
2021-06-10T17:55:00.000Z
profiles/api/filters.py
EmiM/portal_backend
277ec6fdcb3cf50aaecef6b8841b88e0f52f2bff
[ "Apache-2.0" ]
6
2019-06-11T11:02:06.000Z
2020-10-04T11:05:41.000Z
from django_filters import rest_framework as filters from ..models import PlayerCharacter class PlayerCharacterFilter(filters.FilterSet): class Meta: model = PlayerCharacter fields = ("owner", "dead")
22.4
52
0.732143
23
224
7.043478
0.73913
0
0
0
0
0
0
0
0
0
0
0
0.196429
224
9
53
24.888889
0.9
0
0
0
0
0
0.040179
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
e179f1ac85a6e67b3820ee2a014c62875a3b41f8
123
py
Python
forms_builder/forms/signals.py
maqmigh/django-forms-builder
1a0068d1d07498f4a2e160c46ec85b9a5f2ddd98
[ "BSD-2-Clause" ]
null
null
null
forms_builder/forms/signals.py
maqmigh/django-forms-builder
1a0068d1d07498f4a2e160c46ec85b9a5f2ddd98
[ "BSD-2-Clause" ]
null
null
null
forms_builder/forms/signals.py
maqmigh/django-forms-builder
1a0068d1d07498f4a2e160c46ec85b9a5f2ddd98
[ "BSD-2-Clause" ]
null
null
null
from __future__ import unicode_literals from django.dispatch import Signal form_invalid = Signal() form_valid = Signal()
17.571429
39
0.813008
16
123
5.8125
0.6875
0.215054
0
0
0
0
0
0
0
0
0
0
0.130081
123
6
40
20.5
0.869159
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
e190b6c94ecaa545ec24a50795d4ec28bac34a48
43
py
Python
colab_everything/__init__.py
Ankur-singh/colab_everything
bbc7c8cb4c2bc94f1dc9a6017e9e2816873d5c8f
[ "Apache-2.0" ]
21
2020-10-23T03:54:45.000Z
2022-03-27T04:34:11.000Z
colab_everything/__init__.py
Ankur-singh/colab_everything
bbc7c8cb4c2bc94f1dc9a6017e9e2816873d5c8f
[ "Apache-2.0" ]
4
2020-10-23T03:54:39.000Z
2022-02-26T10:07:28.000Z
colab_everything/__init__.py
Ankur-singh/colab_everything
bbc7c8cb4c2bc94f1dc9a6017e9e2816873d5c8f
[ "Apache-2.0" ]
4
2021-01-30T16:05:17.000Z
2021-07-03T04:58:19.000Z
__version__ = "0.0.10" from .core import *
14.333333
22
0.674419
7
43
3.571429
0.857143
0
0
0
0
0
0
0
0
0
0
0.111111
0.162791
43
2
23
21.5
0.583333
0
0
0
0
0
0.139535
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
e19b3cc590d0dfda3b5e7b7bc406add19431a409
203
py
Python
lib_rovpp/as_classes/v2/v2_aggressive/rovpp_v2a_simple_as.py
jfuruness/lib_rovpp
67032c2dc296fa1804a8305d8cb671339b8e45e0
[ "BSD-3-Clause" ]
1
2021-09-27T14:20:12.000Z
2021-09-27T14:20:12.000Z
lib_rovpp/as_classes/v2/v2_aggressive/rovpp_v2a_simple_as.py
jfuruness/lib_rovpp
67032c2dc296fa1804a8305d8cb671339b8e45e0
[ "BSD-3-Clause" ]
null
null
null
lib_rovpp/as_classes/v2/v2_aggressive/rovpp_v2a_simple_as.py
jfuruness/lib_rovpp
67032c2dc296fa1804a8305d8cb671339b8e45e0
[ "BSD-3-Clause" ]
1
2021-10-01T16:30:33.000Z
2021-10-01T16:30:33.000Z
from .rovpp_v2a_lite_simple_as import ROVPPV2aLiteSimpleAS from ...non_lite import NonLite class ROVPPV2aSimpleAS(NonLite, ROVPPV2aLiteSimpleAS): __slots__ = tuple() name = "ROV++V2a Simple"
20.3
58
0.773399
23
203
6.434783
0.695652
0
0
0
0
0
0
0
0
0
0
0.028902
0.147783
203
9
59
22.555556
0.82659
0
0
0
0
0
0.073892
0
0
0
0
0
0
1
0
false
0
0.4
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
e19db5d2f6c782c8958201f23fbc1ff257d55994
939
py
Python
tests/test_stack.py
dkrichards86/dsa
289cd079e64fc79892ef664f01d2b8671bdaf047
[ "MIT" ]
null
null
null
tests/test_stack.py
dkrichards86/dsa
289cd079e64fc79892ef664f01d2b8671bdaf047
[ "MIT" ]
null
null
null
tests/test_stack.py
dkrichards86/dsa
289cd079e64fc79892ef664f01d2b8671bdaf047
[ "MIT" ]
null
null
null
import unittest from src.stack import Stack class TestStack(unittest.TestCase): def setUp(self): self.stack = Stack() def tearDown(self): self.stack = None def test_push(self): self.stack.push("foo") self.assertTrue(self.stack.stack.head.data == "foo") self.assertTrue(self.stack.stack.head.next is None) self.stack.push("bar") self.assertTrue(self.stack.stack.head.data == "bar") self.assertTrue(self.stack.stack.head.next.data == "foo") def test_pop(self): self.stack.push("foo") self.stack.push("bar") self.assertTrue(self.stack.stack.head.data == "bar") self.assertTrue(self.stack.stack.head.next.data == "foo") self.stack.pop() self.assertTrue(self.stack.stack.head.data == "foo") self.assertTrue(self.stack.stack.head.next is None) if __name__ == '__main__': unittest.main()
26.828571
65
0.621938
123
939
4.666667
0.211382
0.235192
0.219512
0.320557
0.69338
0.69338
0.62892
0.623693
0.623693
0.623693
0
0
0.227902
939
34
66
27.617647
0.791724
0
0
0.5
0
0
0.040469
0
0
0
0
0
0.333333
1
0.166667
false
0
0.083333
0
0.291667
0
0
0
0
null
1
1
1
0
0
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
4
e1a8ff508921b7f1bf56fb17743e40f3214e6b27
47
py
Python
Flask-todolist-Sqlite3-master/venv/lib/python3.6/struct.py
IncredibleDraco/MyScholar
272aafa33f7227d1bc0d937d046788cbabede453
[ "Apache-2.0" ]
null
null
null
Flask-todolist-Sqlite3-master/venv/lib/python3.6/struct.py
IncredibleDraco/MyScholar
272aafa33f7227d1bc0d937d046788cbabede453
[ "Apache-2.0" ]
null
null
null
Flask-todolist-Sqlite3-master/venv/lib/python3.6/struct.py
IncredibleDraco/MyScholar
272aafa33f7227d1bc0d937d046788cbabede453
[ "Apache-2.0" ]
1
2019-11-25T10:25:21.000Z
2019-11-25T10:25:21.000Z
/home/sheldon/anaconda3/lib/python3.6/struct.py
47
47
0.829787
8
47
4.875
1
0
0
0
0
0
0
0
0
0
0
0.06383
0
47
1
47
47
0.765957
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
bee0e4922d08970a221111b0d09c5b98cd6fe342
270
py
Python
trinity/extensibility/__init__.py
mneedham91/py-evm
512b6809ce9c33ebed088702e6e22128bf6183af
[ "MIT" ]
137
2017-03-17T11:37:51.000Z
2022-03-07T07:51:28.000Z
trinity/extensibility/__init__.py
mneedham91/py-evm
512b6809ce9c33ebed088702e6e22128bf6183af
[ "MIT" ]
102
2017-04-07T10:43:03.000Z
2018-11-11T18:01:56.000Z
trinity/extensibility/__init__.py
mneedham91/py-evm
512b6809ce9c33ebed088702e6e22128bf6183af
[ "MIT" ]
39
2017-03-17T11:38:52.000Z
2021-02-18T23:05:17.000Z
from trinity.extensibility.events import ( # noqa: F401 BaseEvent ) from trinity.extensibility.plugin import ( # noqa: F401 BasePlugin, DebugPlugin, PluginContext, ) from trinity.extensibility.plugin_manager import ( # noqa: F401 PluginManager, )
22.5
64
0.725926
27
270
7.222222
0.518519
0.169231
0.369231
0.307692
0
0
0
0
0
0
0
0.041284
0.192593
270
11
65
24.545455
0.853211
0.118519
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.272727
0
0.272727
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
bef0ee5ac6a09c1f6089d05ce265f0f956843bab
105
py
Python
playerlist.py
AllenThomasDev/Football-League-Simulator
30461095cb6c7cc32e33776a0f2d75b76f02aeb5
[ "Apache-2.0" ]
16
2020-06-14T07:07:25.000Z
2021-01-18T18:11:52.000Z
playerlist.py
galahyde/Football-Simulator
3c6bed794efa40fa5bd648a2be9de9984f7d4b3d
[ "Apache-2.0" ]
1
2021-02-27T07:50:03.000Z
2021-03-09T04:18:55.000Z
playerlist.py
galahyde/Football-Simulator
3c6bed794efa40fa5bd648a2be9de9984f7d4b3d
[ "Apache-2.0" ]
5
2021-03-25T04:40:05.000Z
2022-03-27T17:53:15.000Z
import pickle as pickle import pandas as pd df=pd.read_pickle('playerdata') # print(df['club'].unique())
26.25
31
0.742857
17
105
4.529412
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.104762
105
4
32
26.25
0.819149
0.247619
0
0
0
0
0.128205
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
83017da0ff758759557f25e172e04dead97ca478
1,556
py
Python
common/xrd-ui-tests-qautomate/common_lib/component_ss_backup.py
nordic-institute/X-Road-tests
e030661a0ad8ceab74dd8122b751e88025a3474a
[ "MIT" ]
1
2019-02-09T00:16:54.000Z
2019-02-09T00:16:54.000Z
common/xrd-ui-tests-qautomate/common_lib/component_ss_backup.py
nordic-institute/X-Road-tests
e030661a0ad8ceab74dd8122b751e88025a3474a
[ "MIT" ]
1
2018-06-06T08:33:32.000Z
2018-06-06T08:33:32.000Z
common/xrd-ui-tests-qautomate/common_lib/component_ss_backup.py
nordic-institute/X-Road-tests
e030661a0ad8ceab74dd8122b751e88025a3474a
[ "MIT" ]
3
2018-07-09T08:51:00.000Z
2020-07-23T18:40:24.000Z
# -*- coding: utf-8 -*- from QAutoLibrary.extension import TESTDATA from selenium.webdriver.common.by import By from QAutoLibrary.QAutoSelenium import * from time import sleep from pagemodel.ss_backup_restore import Ss_backup_restore from pagemodel.ss_backup_restore_back_up_config import Ss_backup_restore_back_up_config from pagemodel.ss_backup_restore_confirm_delete import Ss_backup_restore_confirm_delete from pagemodel.ss_backup_restore_confirm_restore import Ss_backup_restore_confirm_restore class Component_ss_backup(CommonUtils): """ Components common to security server backup view Changelog: * 11.07.2017 | Documentation updated """ ss_backup_restore = Ss_backup_restore() ss_backup_restore_back_up_config = Ss_backup_restore_back_up_config() ss_backup_restore_confirm_delete = Ss_backup_restore_confirm_delete() ss_backup_restore_confirm_restore = Ss_backup_restore_confirm_restore() def generate_backup(self): """ Generate backup """ self.ss_backup_restore.click_button_id_backup() self.ss_backup_restore_back_up_config.click_button_ok() def restore_backup(self): """ Restore backup """ self.ss_backup_restore.click_element_first_row_restore() self.ss_backup_restore_confirm_restore.click_button_confirm() self.ss_backup_restore_back_up_config.click_button_ok() self.ss_backup_restore.click_element_first_row_delete() self.ss_backup_restore_confirm_delete.click_button_confirm()
36.186047
89
0.782134
205
1,556
5.414634
0.234146
0.172973
0.310811
0.198198
0.665766
0.43964
0.268468
0.268468
0.198198
0.079279
0
0.006881
0.159383
1,556
42
90
37.047619
0.841743
0.100257
0
0.090909
0
0
0
0
0
0
0
0
0
1
0.090909
false
0
0.363636
0
0.681818
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
1
0
0
4
8317dcb2df906a404bbb31fcbc6dd05bea1b349b
250
py
Python
a-practical-introduction-to-python-programming-brian-heinold/chapter-05/exercise-08.py
elarabyelaidy19/awesome-reading
5c01a4272ba58e4f7ea665aab14b4c0aa252ea89
[ "MIT" ]
31
2021-11-02T19:51:13.000Z
2022-02-17T10:55:26.000Z
a-practical-introduction-to-python-programming-brian-heinold/chapter-05/exercise-08.py
MosTafaHoSamm/awesome-reading
469408fefc049d78ed53a2b2331b5d5cecdc6c06
[ "MIT" ]
1
2022-01-18T12:27:54.000Z
2022-01-18T12:27:54.000Z
a-practical-introduction-to-python-programming-brian-heinold/chapter-05/exercise-08.py
MosTafaHoSamm/awesome-reading
469408fefc049d78ed53a2b2331b5d5cecdc6c06
[ "MIT" ]
3
2022-01-11T05:01:34.000Z
2022-02-05T14:36:29.000Z
# 8. Write a program that swaps the values of three variables x,y, and z, so that x gets the value # of y, y gets the value of z, and z gets the value of x. x, y, z = 5, 10, 15 x, y, z = y, z, x # The power of Python ;) # print(x, y, z) : 10 15 5
31.25
98
0.616
59
250
2.610169
0.40678
0.051948
0.233766
0.272727
0
0
0
0
0
0
0
0.06044
0.272
250
7
99
35.714286
0.785714
0.8
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
832b883c9a5c1883d844d3f61ea3c4b5a7d620ae
511
py
Python
RecoParticleFlow/PFProducer/python/pfSuperClusterReader_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
RecoParticleFlow/PFProducer/python/pfSuperClusterReader_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
RecoParticleFlow/PFProducer/python/pfSuperClusterReader_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
import FWCore.ParameterSet.Config as cms pfSuperClusterReader = cms.EDAnalyzer("PFSuperClusterReader", GSFTracks = cms.InputTag("electronGsfTracks"), SuperClusterRefMap = cms.InputTag("pfElectronTranslator:pf"), MVAMap = cms.InputTag("pfElectronTranslator:pf"), PFCandidate = cms.InputTag("particleFlowTmp:electrons") )
56.777778
99
0.510763
29
511
9
0.62069
0.168582
0.237548
0.252874
0
0
0
0
0
0
0
0
0.412916
511
8
100
63.875
0.87
0
0
0
0
0
0.21135
0.138943
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
834740d347faa5a5391a855a470f516fe89eb7af
99
py
Python
databasetext/apps.py
eldarion-client/hedera
a01d44232fadab4e60e8d06971feba9fad21e3f2
[ "MIT" ]
null
null
null
databasetext/apps.py
eldarion-client/hedera
a01d44232fadab4e60e8d06971feba9fad21e3f2
[ "MIT" ]
null
null
null
databasetext/apps.py
eldarion-client/hedera
a01d44232fadab4e60e8d06971feba9fad21e3f2
[ "MIT" ]
null
null
null
from django.apps import AppConfig class DatabasetextConfig(AppConfig): name = "databasetext"
16.5
36
0.777778
10
99
7.7
0.9
0
0
0
0
0
0
0
0
0
0
0
0.151515
99
5
37
19.8
0.916667
0
0
0
0
0
0.121212
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
835a914c615246b8231592991ac670d934985c39
464
py
Python
yunionclient/shells/__init__.py
yousong/python_yunionsdk
9e03d962ea5ef16e68090b659a1ee6d499c93555
[ "Apache-2.0" ]
null
null
null
yunionclient/shells/__init__.py
yousong/python_yunionsdk
9e03d962ea5ef16e68090b659a1ee6d499c93555
[ "Apache-2.0" ]
null
null
null
yunionclient/shells/__init__.py
yousong/python_yunionsdk
9e03d962ea5ef16e68090b659a1ee6d499c93555
[ "Apache-2.0" ]
null
null
null
from shell import * from sched import * from networks import * from servers import * from disks import * from events import * from users import * from tenants import * from roles import * from services import * from endpoints import * from images import * from secgroups import * from dnsrecords import * from notify import * from groups import * from monitors import * from baremetals import * from schedtags import * from metadatas import *
22.095238
24
0.739224
60
464
5.716667
0.366667
0.553936
0
0
0
0
0
0
0
0
0
0
0.217672
464
20
25
23.2
0.944904
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
55e549d610d8c45d89198b9d9f2a5665d1cbf415
1,613
py
Python
web/landingPageStats.py
rihatrahman/openAlt
34463008d426043289b5fce5ed1802341c6f32ec
[ "MIT" ]
null
null
null
web/landingPageStats.py
rihatrahman/openAlt
34463008d426043289b5fce5ed1802341c6f32ec
[ "MIT" ]
22
2020-12-01T15:10:02.000Z
2020-12-11T19:07:44.000Z
web/landingPageStats.py
rihatrahman/openAlt
34463008d426043289b5fce5ed1802341c6f32ec
[ "MIT" ]
4
2021-01-22T16:15:15.000Z
2021-04-20T12:24:38.000Z
#import flask import flask #define function to retrieve the total number of events in the database def landingPageStats(mysql): #global mysql cursor = mysql.connection.cursor() #string to query the database to sum up all events from all 13 sources listed below totalSumQuery=" SELECT( (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.cambiaevent)+ (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.crossrefevent) + (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.dataciteevent) + (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.hypothesisevent) + (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.newsfeedevent) +(SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.redditevent) + (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.redditlinksevent) +(SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.stackexchangeevent) + (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.twitterevent) +(SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.webevent) + (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.wikipediaevent) + (SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.wordpressevent) +(SELECT COUNT( DISTINCT eventID) FROM crossrefeventdatamain.f1000event))AS sumCount;" #execute string's query using cursor cursor.execute(totalSumQuery) #commit mysql.connection.commit() #fetch result totalSum = cursor.fetchone() #close cursor cursor.close() #return result fetched from the dictionary return (totalSum['sumCount'])
55.62069
1,034
0.784873
167
1,613
7.580838
0.371257
0.112954
0.195103
0.266983
0.523697
0.523697
0
0
0
0
0
0.004326
0.140112
1,613
28
1,035
57.607143
0.908435
0.175449
0
0
0
0.111111
0.775417
0.35736
0
0
0
0
0
1
0.111111
false
0
0.111111
0
0.333333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
36173cb16eaf74e870b950cbc9af4193ef885e20
43
py
Python
Tools/freeze/flag.py
sireliah/polish-python
605df4944c2d3bc25f8bf6964b274c0a0d297cc3
[ "PSF-2.0" ]
1
2018-06-21T18:21:24.000Z
2018-06-21T18:21:24.000Z
Tools/freeze/flag.py
sireliah/polish-python
605df4944c2d3bc25f8bf6964b274c0a0d297cc3
[ "PSF-2.0" ]
null
null
null
Tools/freeze/flag.py
sireliah/polish-python
605df4944c2d3bc25f8bf6964b274c0a0d297cc3
[ "PSF-2.0" ]
null
null
null
initialized = Prawda print("Hello world!")
14.333333
21
0.744186
5
43
6.4
1
0
0
0
0
0
0
0
0
0
0
0
0.116279
43
2
22
21.5
0.842105
0
0
0
0
0
0.27907
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
362285bf912fd3513b4d9f5346a46311750a7aa4
239
py
Python
src/components/convLayerRelu.py
JasonYuJjyu/unsupFlownet
3f652d7aaa0ce99efb767114ec119a3c23e3051b
[ "MIT" ]
24
2018-09-25T14:39:45.000Z
2022-03-29T10:44:50.000Z
src/components/convLayerRelu.py
y788zhan/joint_seg_flow
4c0082e9c1f625d6f6f1e1195a2c3d9dbf82bec0
[ "MIT" ]
6
2018-09-28T18:03:26.000Z
2019-03-25T01:43:29.000Z
src/components/convLayerRelu.py
y788zhan/joint_seg_flow
4c0082e9c1f625d6f6f1e1195a2c3d9dbf82bec0
[ "MIT" ]
7
2018-10-19T03:19:55.000Z
2022-02-22T02:42:28.000Z
import tensorflow as tf from leakyRelu import * from convLayer import * def convLayerRelu(x,kernelSize,outMaps,stride): with tf.variable_scope(None,default_name="reluConv"): return leakyRelu(convLayer(x,kernelSize,outMaps,stride),0.1)
29.875
62
0.803347
33
239
5.757576
0.69697
0.115789
0.189474
0.252632
0
0
0
0
0
0
0
0.009217
0.09205
239
7
63
34.142857
0.866359
0
0
0
0
0
0.033473
0
0
0
0
0
0
1
0.166667
false
0
0.5
0
0.833333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
3627706be3dacd4009e184c028e9abe63358f565
79
py
Python
wikimedia_cli/__init__.py
awesomeplaya211/WikiEdits
4b44ce0d8bfba3c303ede9333d23a7d471d28e3d
[ "MIT" ]
1
2022-02-24T17:45:07.000Z
2022-02-24T17:45:07.000Z
wikimedia_cli/__init__.py
awesomeplaya211/WikiEdits
4b44ce0d8bfba3c303ede9333d23a7d471d28e3d
[ "MIT" ]
null
null
null
wikimedia_cli/__init__.py
awesomeplaya211/WikiEdits
4b44ce0d8bfba3c303ede9333d23a7d471d28e3d
[ "MIT" ]
null
null
null
from importlib.metadata import version __version__ = version("wikimedia-cli")
19.75
38
0.810127
9
79
6.666667
0.777778
0.466667
0
0
0
0
0
0
0
0
0
0
0.101266
79
3
39
26.333333
0.84507
0
0
0
0
0
0.164557
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
3630a006ae1ad63191233f9be24cf2d697286a22
1,447
py
Python
pytimetools/utctools.py
pydtools/pytimetools
f86b3251e40f0c7fdfb71c2936bad1076218ac70
[ "MIT" ]
null
null
null
pytimetools/utctools.py
pydtools/pytimetools
f86b3251e40f0c7fdfb71c2936bad1076218ac70
[ "MIT" ]
1
2021-01-06T09:21:06.000Z
2021-01-06T09:21:06.000Z
pytimetools/utctools.py
pydtools/pytimetools
f86b3251e40f0c7fdfb71c2936bad1076218ac70
[ "MIT" ]
null
null
null
#!/usr/bin/env python """ doc: utc time tools utc: utc -> local utc -> timestamp utc -> gmt """ import datetime import pytz from pytimetools.tztools import get_current_timezone def get_now(tz=pytz.UTC): """ :return: 返回tz时区的当前时间, 默认返回utc时间 """ return datetime.datetime.now(tz=tz) def get_now_from_delta(seconds=1): """ 获取过去距离今天现在的某一天 :param seconds: :return: """ now = get_now() seconds = datetime.timedelta(seconds=seconds) passed_time = now - seconds return passed_time def utc_to_localtime(utctime): """ naive time 与 active time的概念 1.数据库中的DateTimeFiled需要转换localtime 2.前端传入的时间最好时utctime astimezone: 可以将一个时区的时间转换成另一个时区的时间, 前提是这个被转换的时间必须是一个aware时间 https://www.cnblogs.com/limaomao/p/9257014.html :param utctime: :return: """ # naive time(不知道自己时区) => aware time(有时区) utc = utctime.replace(tzinfo=pytz.UTC) local_time = utc.astimezone(get_current_timezone()) return local_time def utc_to_gmt(utc_time): """ UTC -> GMT :param utc_time: :return: """ # todo pass def utc_to_timestamp(utc_time): """ 时间戳转utc :param utc_time: :return: """ timestamp = utc_time.timestamp() return timestamp def utc_to_timestamp_ms(utc_time): """ 时间戳转utc :param utc_time: :return: """ timestamp = utc_to_timestamp(utc_time) return int(timestamp) * 1000
17.023529
55
0.647547
170
1,447
5.323529
0.382353
0.069613
0.035359
0.059669
0.132597
0.097238
0.097238
0.097238
0.097238
0
0
0.012762
0.24188
1,447
84
56
17.22619
0.812215
0.366275
0
0
0
0
0
0
0
0
0
0.011905
0
1
0.272727
false
0.136364
0.136364
0
0.636364
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
1
0
0
1
0
0
4
365295aa74a35a7ff220672e5e7c969a0f27fc95
288
py
Python
clge/plugs/DefaultAssets/__init__.py
RafayelGardishyan/CLGE
12afb3612963c7631406c3693cdcff4442379c1c
[ "MIT" ]
2
2018-02-20T06:13:44.000Z
2019-10-31T21:55:00.000Z
clge/plugs/DefaultAssets/__init__.py
RafayelGardishyan/CLGE
12afb3612963c7631406c3693cdcff4442379c1c
[ "MIT" ]
6
2018-02-03T12:33:35.000Z
2018-09-10T17:27:57.000Z
clge/plugs/DefaultAssets/__init__.py
RafayelGardishyan/CLGE
12afb3612963c7631406c3693cdcff4442379c1c
[ "MIT" ]
1
2018-02-13T14:02:28.000Z
2018-02-13T14:02:28.000Z
# Old Files :: Not deleted for future change from .sample_object import SampleObject from .sample_player import SamplePlayer from .sample_polygon import SamplePolygon # Player Controller for future from .PlayerController import PlayerController # New Behaviour Object Logic Coming Soon
28.8
46
0.833333
36
288
6.583333
0.638889
0.126582
0
0
0
0
0
0
0
0
0
0
0.135417
288
9
47
32
0.951807
0.381944
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
3670c425c444b23dda112659ad3c398b9f1db89a
462
py
Python
dynamicserialize/dstypes/gov/noaa/nws/ncep/common/dataplugin/gempak/request/GetStationsRequest.py
srcarter3/python-awips
d981062662968cf3fb105e8e23d955950ae2497e
[ "BSD-3-Clause" ]
33
2016-03-17T01:21:18.000Z
2022-02-08T10:41:06.000Z
dynamicserialize/dstypes/gov/noaa/nws/ncep/common/dataplugin/gempak/request/GetStationsRequest.py
srcarter3/python-awips
d981062662968cf3fb105e8e23d955950ae2497e
[ "BSD-3-Clause" ]
15
2016-04-19T16:34:08.000Z
2020-09-09T19:57:54.000Z
dynamicserialize/dstypes/gov/noaa/nws/ncep/common/dataplugin/gempak/request/GetStationsRequest.py
Unidata/python-awips
8459aa756816e5a45d2e5bea534d23d5b1dd1690
[ "BSD-3-Clause" ]
20
2016-03-12T01:46:58.000Z
2022-02-08T06:53:22.000Z
# # SOFTWARE HISTORY # # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # Sep 16, 2016 pmoyer Generated class GetStationsRequest(object): def __init__(self): self.pluginName = None def getPluginName(self): return self.pluginName def setPluginName(self, pluginName): self.pluginName = pluginName
24.315789
77
0.484848
33
462
6.666667
0.666667
0.254545
0
0
0
0
0
0
0
0
0
0.019417
0.331169
462
18
78
25.666667
0.692557
0.45671
0
0
0
0
0
0
0
0
0
0
0
1
0.428571
false
0
0
0.142857
0.714286
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
3693a8ef92cbca97a789b7e244adf0d5d0821340
822
py
Python
imdb/vos/vos_imdb.py
YeLyuUT/VOSDetectron
add644f8f8ad3dd17098f0afa161335d457f05d6
[ "MIT" ]
2
2019-10-08T11:33:20.000Z
2021-05-21T10:10:27.000Z
imdb/vos/vos_imdb.py
YeLyuUT/VOSDetectron
add644f8f8ad3dd17098f0afa161335d457f05d6
[ "MIT" ]
null
null
null
imdb/vos/vos_imdb.py
YeLyuUT/VOSDetectron
add644f8f8ad3dd17098f0afa161335d457f05d6
[ "MIT" ]
2
2019-10-08T11:33:22.000Z
2022-02-20T16:07:37.000Z
from easydict import EasyDict class vos_imdb(): def __init__(self,name): self._edicts = [] self._dbname = name self._sequences = [] def add_seq_info_dict(self): self._edicts.append(EasyDict()) #return dict and its index return self._edicts[-1],len(self._edicts)-1 def get_seq_info(self, ind): return self._edicts[ind] def num_sequence(self): return len(self._sequences) def get_sequence(self,index): return self._sequences[index] def get_image(self,seq_ind,t_ind): """ Args: seq_ind: seqence index. t_ind: time index in a sequence. """ pass def get_label(self,seq_ind,t_ind): """ Args: seq_ind: seqence index. t_ind: time index in a sequence. """ pass @property def name(self): return self._dbname
19.571429
47
0.644769
117
822
4.25641
0.324786
0.100402
0.064257
0.044177
0.257028
0.257028
0.257028
0.257028
0.257028
0.257028
0
0.00321
0.242092
822
41
48
20.04878
0.796148
0.193431
0
0.090909
0
0
0
0
0
0
0
0
0
1
0.363636
false
0.090909
0.045455
0.181818
0.681818
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
4
36a325bb8ba0184894a4f8ac338bb9bf1fa0ece5
60
py
Python
code/answer_5-2-3.py
KoyanagiHitoshi/AtCoder-Python-Introduction
6d014e333a873f545b4d32d438e57cf428b10b96
[ "MIT" ]
1
2022-03-29T13:50:12.000Z
2022-03-29T13:50:12.000Z
code/answer_5-2-3.py
KoyanagiHitoshi/AtCoder-Python-Introduction
6d014e333a873f545b4d32d438e57cf428b10b96
[ "MIT" ]
null
null
null
code/answer_5-2-3.py
KoyanagiHitoshi/AtCoder-Python-Introduction
6d014e333a873f545b4d32d438e57cf428b10b96
[ "MIT" ]
null
null
null
A1, A2, A3 = sorted(map(int, input().split())) print(A3-A1)
20
46
0.616667
11
60
3.363636
0.818182
0
0
0
0
0
0
0
0
0
0
0.09434
0.116667
60
2
47
30
0.603774
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
0
0
0
0
1
0
4
36d4baed0da2584a5cafadf2b0ad7a9aecebff08
132
py
Python
tests/test_db/__init__.py
sun2589886503/EverydayWechat
b4cc7b250eaba11bd24bc106482424b723d77297
[ "MIT" ]
9,940
2019-03-12T06:05:45.000Z
2022-03-31T16:09:34.000Z
tests/test_db/__init__.py
githan2020/EverydayWechat
f760d47af98be748efe58a7332b7c41d0ecae708
[ "MIT" ]
199
2019-03-13T12:11:37.000Z
2022-02-05T07:51:27.000Z
tests/test_db/__init__.py
githan2020/EverydayWechat
f760d47af98be748efe58a7332b7c41d0ecae708
[ "MIT" ]
2,293
2019-03-12T06:42:39.000Z
2022-03-29T13:13:49.000Z
# -*- coding: utf-8 -*- """ Project: EverydayWechat-Github Creator: DoubleThunder Create time: 2019-07-12 19:09 Introduction: """
13.2
30
0.689394
16
132
5.6875
1
0
0
0
0
0
0
0
0
0
0
0.114035
0.136364
132
9
31
14.666667
0.684211
0.909091
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
36fa55bac4606b8c9504252b8aeab131e4567058
287
py
Python
pacote-download/PythonTeste/aula12.py
Mariana02Santos/Python
a7bf3489b58d691578f888719c1ad6227ad39d74
[ "MIT" ]
null
null
null
pacote-download/PythonTeste/aula12.py
Mariana02Santos/Python
a7bf3489b58d691578f888719c1ad6227ad39d74
[ "MIT" ]
null
null
null
pacote-download/PythonTeste/aula12.py
Mariana02Santos/Python
a7bf3489b58d691578f888719c1ad6227ad39d74
[ "MIT" ]
null
null
null
n = input('Qual é o seu nome? ') if n == 'Mariana': print('Seu nome é muito bonito!') elif n == 'Maria' or n == 'Pedro' or n == 'Paulo': print('Seu nome é bem comum no Brasil.') else: print('Seu nome é bem normal...') print('Tenha um bom dia, \033[33m{}\033[33m!'.format(n))
31.888889
56
0.595819
51
287
3.352941
0.588235
0.163743
0.210526
0.22807
0.187135
0
0
0
0
0
0
0.04386
0.205575
287
8
57
35.875
0.70614
0
0
0
0
0
0.547038
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
0
4
7fcfa6d55eca18ee451d379b7940b723aa0d9b21
154
py
Python
Curso-em-video-Python3-mundo1/ex030.py
bernardombraga/Solucoes-exercicios-cursos-gratuitos
0347a8325443fce84e0a753c96f523a22858537b
[ "MIT" ]
null
null
null
Curso-em-video-Python3-mundo1/ex030.py
bernardombraga/Solucoes-exercicios-cursos-gratuitos
0347a8325443fce84e0a753c96f523a22858537b
[ "MIT" ]
null
null
null
Curso-em-video-Python3-mundo1/ex030.py
bernardombraga/Solucoes-exercicios-cursos-gratuitos
0347a8325443fce84e0a753c96f523a22858537b
[ "MIT" ]
null
null
null
n = int(input('Me diga um número qualquer: ')) if (n % 2 == 0): print('O número {} é PAR'.format(n)) else: print('O número {} é IMPAR'.format(n))
25.666667
46
0.571429
27
154
3.259259
0.666667
0.136364
0.272727
0.295455
0
0
0
0
0
0
0
0.016529
0.214286
154
5
47
30.8
0.710744
0
0
0
0
0
0.415584
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
7fdf11fa0486a09f5de3952df5cc850c181f65d1
346
py
Python
sdustoj_server/judge/models.py
KWY-Q/sdustoj-judge-webserver
4dec55ea1a901d4b52c6694f6c03bef346307138
[ "Apache-2.0" ]
null
null
null
sdustoj_server/judge/models.py
KWY-Q/sdustoj-judge-webserver
4dec55ea1a901d4b52c6694f6c03bef346307138
[ "Apache-2.0" ]
null
null
null
sdustoj_server/judge/models.py
KWY-Q/sdustoj-judge-webserver
4dec55ea1a901d4b52c6694f6c03bef346307138
[ "Apache-2.0" ]
null
null
null
from django.db import models from utils.models import ModifyInfo, StatusMixin class Environment(ModifyInfo, StatusMixin): id = models.BigAutoField(primary_key=True) eid = models.CharField(max_length=16, unique=True, help_text='供各Judge机决定编译方式的唯一标识符。') language = models.CharField(max_length=32, help_text='阅读题目以及提交题目时对外显示的编程环境名称。')
34.6
89
0.789017
41
346
6.536585
0.658537
0.156716
0.134328
0.179104
0
0
0
0
0
0
0
0.013029
0.112717
346
9
90
38.444444
0.859935
0
0
0
0
0
0.127168
0.127168
0
0
0
0
0
1
0
false
0
0.333333
0
1
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
1
0
0
4
3d02e88ddfaa0576f3aa4170feec5967b0bfa93c
131
py
Python
chutzpah/admin.py
lgb2002/club
099f5777699abe48f067684fc5fd2b7c7e97e07d
[ "MIT" ]
1
2019-09-15T01:23:32.000Z
2019-09-15T01:23:32.000Z
chutzpah/admin.py
lgb2002/club
099f5777699abe48f067684fc5fd2b7c7e97e07d
[ "MIT" ]
1
2022-02-12T05:22:29.000Z
2022-02-12T05:22:29.000Z
chutzpah/admin.py
lgb2002/club
099f5777699abe48f067684fc5fd2b7c7e97e07d
[ "MIT" ]
null
null
null
from django.contrib import admin from chutzpah.models import UserRank admin.site.register(UserRank) # Register your models here.
18.714286
36
0.816794
18
131
5.944444
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.122137
131
6
37
21.833333
0.930435
0.198473
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
3d070e496ea8ebc319777776521a58cbb197ad1a
191
py
Python
watchmen/security/key/db/key_model.py
Insurance-Metrics-Measure-Advisory/watchman-data-connector
8ecab0c5b28174f1611e51deba8d94a42f53d51d
[ "MIT" ]
125
2021-03-13T07:39:46.000Z
2022-02-28T03:14:17.000Z
pipeline/security/key/db/key_model.py
Indexical-Metrics-Measure-Advisory/watchmen-pipeline-engine
fb39695d2f7a1c5212a3871b04c4a8a9f03ee16e
[ "MIT" ]
null
null
null
pipeline/security/key/db/key_model.py
Indexical-Metrics-Measure-Advisory/watchmen-pipeline-engine
fb39695d2f7a1c5212a3871b04c4a8a9f03ee16e
[ "MIT" ]
17
2021-03-13T07:31:58.000Z
2021-05-20T09:38:02.000Z
from typing import Dict from model.model.common.watchmen_model import WatchmenModel class KeyStore(WatchmenModel): tenantId: str = None params: Dict = None keyType: str = None
19.1
59
0.743455
24
191
5.875
0.625
0.099291
0
0
0
0
0
0
0
0
0
0
0.193717
191
9
60
21.222222
0.915584
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
3d193b13726ed8fb91bf4fb492f3fde542a26901
99
py
Python
cafeteria/crawler/apps.py
devGW/PostApp
fda99fbc838ee809b1ff28445d66cbd48e2b5016
[ "MIT" ]
null
null
null
cafeteria/crawler/apps.py
devGW/PostApp
fda99fbc838ee809b1ff28445d66cbd48e2b5016
[ "MIT" ]
1
2019-08-31T01:07:46.000Z
2019-09-01T15:10:42.000Z
cafeteria/crawler/apps.py
devGW/PostApp
fda99fbc838ee809b1ff28445d66cbd48e2b5016
[ "MIT" ]
null
null
null
from django.apps import AppConfig class CrawlerConfig(AppConfig): name = 'cafeteria.crawler'
16.5
33
0.767677
11
99
6.909091
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.151515
99
5
34
19.8
0.904762
0
0
0
0
0
0.171717
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
3d4086c84b4ea0d2d4e6f48fc70f885937314082
230
py
Python
datacatalog/tokens/__init__.py
SD2E/python-datacatalog
51ab366639505fb6e8a14cd6b446de37080cd20d
[ "CNRI-Python" ]
null
null
null
datacatalog/tokens/__init__.py
SD2E/python-datacatalog
51ab366639505fb6e8a14cd6b446de37080cd20d
[ "CNRI-Python" ]
2
2019-07-25T15:39:04.000Z
2019-10-21T15:31:46.000Z
datacatalog/tokens/__init__.py
SD2E/python-datacatalog
51ab366639505fb6e8a14cd6b446de37080cd20d
[ "CNRI-Python" ]
1
2019-10-15T14:33:44.000Z
2019-10-15T14:33:44.000Z
__version__ = '0.7.0' from .salt import generate_salt, Salt from .token import get_token, validate_token, Token from .admin import (get_admin_token, validate_admin_token, get_admin_lifetime, InvalidAdminToken)
38.333333
58
0.752174
31
230
5.16129
0.419355
0.1125
0
0
0
0
0
0
0
0
0
0.015873
0.178261
230
5
59
46
0.830688
0
0
0
1
0
0.021739
0
0
0
0
0
0
1
0
false
0
0.6
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
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
e9e913f2423bb2b83f1262497787ea3aac43eff9
3,889
py
Python
ycyc/tests/libs/statelib/test_state.py
MrLYC/ycyc
1938493294fbad3a461cc3a752c5385d30a6e51d
[ "MIT" ]
22
2015-07-21T03:15:36.000Z
2021-02-23T07:58:03.000Z
ycyc/tests/libs/statelib/test_state.py
MrLYC/ycyc
1938493294fbad3a461cc3a752c5385d30a6e51d
[ "MIT" ]
3
2016-03-20T12:06:07.000Z
2018-01-16T10:34:19.000Z
ycyc/tests/libs/statelib/test_state.py
MrLYC/ycyc
1938493294fbad3a461cc3a752c5385d30a6e51d
[ "MIT" ]
3
2015-05-08T00:55:38.000Z
2017-02-25T03:30:14.000Z
#!/usr/bin/env python # encoding: utf-8 from unittest import TestCase from ycyc.libs.statelib.state import ( FreeState, SequenceState, QSequenceState, StateNotAllowError, EndOfSequenceStateError, SequenceStateFinishedError, ) class TestFreeState(TestCase): def test_usage(self): state = FreeState("init") self.assertEqual(state.state, "init") self.assertEqual(state.exception, None) self.assertEqual(state.last_state, None) with state.processing("init", "state1", "error1"): pass self.assertEqual(state.state, "state1") self.assertEqual(state.exception, None) self.assertEqual(state.last_state, "init") with self.assertRaises(StateNotAllowError): with state.processing("nothing", "", ""): pass self.assertEqual(state.state, "state1") self.assertEqual(state.exception, None) self.assertEqual(state.last_state, "init") with self.assertRaises(ValueError): with state.processing("state1", "state2", "error2"): raise ValueError() self.assertEqual(state.state, "error2") self.assertIsInstance(state.exception, ValueError) self.assertEqual(state.last_state, "state1") with state.processing(("error2", "state3"), "state3", "error3"): pass self.assertEqual(state.state, "state3") self.assertEqual(state.exception, None) self.assertEqual(state.last_state, "error2") with state.processing(("error2", "state3"), "state4", "error4"): pass self.assertEqual(state.state, "state4") self.assertEqual(state.exception, None) self.assertEqual(state.last_state, "state3") class TestSequenceState(TestCase): def test_usage(self): class TSequenceState(SequenceState): __SequenceStates__ = ("init", "state1", "state2", "state3") state = TSequenceState() self.assertEqual(state.state, "init") self.assertEqual(state.index, 0) self.assertEqual(state.exception, None) self.assertEqual(state.last_state, None) self.assertEqual(state.next_state, "state1") self.assertEqual(state.is_finished, False) with state.processing(): pass self.assertEqual(state.state, "state1") self.assertEqual(state.index, 1) self.assertEqual(state.exception, None) self.assertEqual(state.last_state, "init") self.assertEqual(state.next_state, "state2") self.assertEqual(state.is_finished, False) with state.processing(): pass self.assertEqual(state.state, "state2") self.assertEqual(state.index, 2) self.assertEqual(state.exception, None) self.assertEqual(state.last_state, "state1") self.assertEqual(state.next_state, "state3") self.assertEqual(state.is_finished, False) with self.assertRaises(ValueError): with state.processing(): raise ValueError() self.assertEqual(state.state, "error") self.assertEqual(state.index, 2) self.assertIsInstance(state.exception, ValueError) self.assertEqual(state.last_state, "state2") self.assertEqual(state.next_state, "state3") self.assertEqual(state.is_finished, True) with self.assertRaises(SequenceStateFinishedError): with state.processing(): pass self.assertEqual(state.state, "error") self.assertEqual(state.index, 2) self.assertIsInstance(state.exception, ValueError) self.assertEqual(state.last_state, "state2") self.assertEqual(state.next_state, "state3") self.assertEqual(state.is_finished, True)
38.127451
77
0.630753
380
3,889
6.384211
0.160526
0.278236
0.370981
0.113355
0.779472
0.676422
0.638087
0.603875
0.562242
0.551525
0
0.013769
0.253021
3,889
101
78
38.504951
0.821343
0.009257
0
0.662651
0
0
0.067467
0
0
0
0
0
0.626506
1
0.024096
false
0.084337
0.024096
0
0.084337
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
1
0
0
0
1
0
0
0
0
0
4
1803c300720f42dce38749ce17f2bcf325413d45
65
py
Python
algo/implementation/easy/sequence-equation.py
rivergillis/hackerrank-practice
16b1d448c011f22b202b1ccadac09c71f646aa5e
[ "MIT" ]
null
null
null
algo/implementation/easy/sequence-equation.py
rivergillis/hackerrank-practice
16b1d448c011f22b202b1ccadac09c71f646aa5e
[ "MIT" ]
null
null
null
algo/implementation/easy/sequence-equation.py
rivergillis/hackerrank-practice
16b1d448c011f22b202b1ccadac09c71f646aa5e
[ "MIT" ]
null
null
null
# https://www.hackerrank.com/challenges/permutation-equation #?
16.25
60
0.769231
7
65
7.142857
1
0
0
0
0
0
0
0
0
0
0
0
0.061538
65
3
61
21.666667
0.819672
0.907692
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
1812ebccc8db269b5a6dfe3a73077f974045f443
124
py
Python
tutorials/IntegersAndFloats/stringnumbers.py
sserperior/pythonstuff
6f80d005f3fdcf5047dd415beeb8b4603677d27d
[ "MIT" ]
null
null
null
tutorials/IntegersAndFloats/stringnumbers.py
sserperior/pythonstuff
6f80d005f3fdcf5047dd415beeb8b4603677d27d
[ "MIT" ]
null
null
null
tutorials/IntegersAndFloats/stringnumbers.py
sserperior/pythonstuff
6f80d005f3fdcf5047dd415beeb8b4603677d27d
[ "MIT" ]
null
null
null
num1 = '100' num2 = '200' # 100200 print(num1 + num2) # Casting - 300 num1 = int(num1) num2 = int(num2) print(num1 + num2)
12.4
18
0.629032
19
124
4.105263
0.473684
0.307692
0.333333
0
0
0
0
0
0
0
0
0.252525
0.201613
124
10
19
12.4
0.535354
0.16129
0
0.333333
0
0
0.058824
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
1822e9adeafd02240516aefa0bcf35dc6b5439ce
313
py
Python
xga/sourcetools/__init__.py
DavidT3/XGA
cde51c3f29f98b5f1e981fb6d327c04072b0ba38
[ "BSD-3-Clause" ]
12
2020-05-16T09:45:45.000Z
2022-02-14T14:41:46.000Z
xga/sourcetools/__init__.py
DavidT3/XGA
cde51c3f29f98b5f1e981fb6d327c04072b0ba38
[ "BSD-3-Clause" ]
684
2020-05-28T08:52:09.000Z
2022-03-31T10:56:24.000Z
xga/sourcetools/__init__.py
DavidT3/XGA
cde51c3f29f98b5f1e981fb6d327c04072b0ba38
[ "BSD-3-Clause" ]
2
2022-02-04T10:55:55.000Z
2022-02-04T11:30:56.000Z
# This code is a part of XMM: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS). # Last modified by David J Turner (david.turner@sussex.ac.uk) 02/09/2020, 14:05. Copyright (c) David J Turner from .match import simple_xmm_match from .misc import rad_to_ang, ang_to_rad, nh_lookup
39.125
110
0.753994
58
313
3.948276
0.758621
0.052402
0.104803
0
0
0
0
0
0
0
0
0.045802
0.162939
313
7
111
44.714286
0.828244
0.690096
0
0
1
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
1861b6a3ea63923467fd39521bd93a20075bf9dc
1,129
py
Python
dict.py
Te020370/python_lesson_3
3e922bd3fd37372bf2cd591c1a364faa1a279fc0
[ "MIT" ]
null
null
null
dict.py
Te020370/python_lesson_3
3e922bd3fd37372bf2cd591c1a364faa1a279fc0
[ "MIT" ]
null
null
null
dict.py
Te020370/python_lesson_3
3e922bd3fd37372bf2cd591c1a364faa1a279fc0
[ "MIT" ]
null
null
null
# Тип данных СЛОВРИ (dict) # Инициализация dict_temp = {} print(type(dict_temp), dict_temp) dict_temp = {'dict1' : 1, 'dict2' : 2.1, 'dict3': 'name', 'dict4':[1,2,3]} print(type(dict_temp), dict_temp) dict_temp = dict.fromkeys(['a', 'b'], [12, 2020]) print(type(dict_temp), dict_temp) dict_temp = dict(brend = 'volvo', volume_engine = 1.5) print(type(dict_temp), dict_temp) dict_temp = {a: a**2 for a in range(5)} print(type(dict_temp), dict_temp) # Обращения к содержимому словаря print(dict_temp[2]) # Функции со словарями print(list(dict_temp.keys())) print(list(dict_temp.values())) print(list(dict_temp.items())) print('____________________________') # Работа с элементами dict_temp[0] = 100 print(type(dict_temp), dict_temp) dict_temp['name'] = 'Dima' print(type(dict_temp), dict_temp) # Методы # keys, values, items см выше temp = dict_temp.pop('name') print(type(temp), temp) # Итерирование по словарю for pair in dict_temp.items(): print(pair) for kay, value in dict_temp.items(): print(kay, value) for kay in dict_temp.keys(): print(kay) for value in dict_temp.values(): print(value)
20.527273
74
0.70062
179
1,129
4.089385
0.312849
0.327869
0.229508
0.262295
0.362022
0.307377
0.273224
0.236339
0.101093
0
0
0.025667
0.13729
1,129
54
75
20.907407
0.725873
0.150576
0
0.241379
0
0
0.074816
0.029505
0
0
0
0
0
1
0
false
0
0
0
0
0.586207
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
1
0
4
18666a7a5d6771973f30bc18ea97dc69c9939ac7
182
py
Python
python-basic/calendar/leapdays.py
nkhn37/python-tech-sample-source
e8aea7ed3d810494682b3c2dde952ddd0f7acf84
[ "MIT" ]
null
null
null
python-basic/calendar/leapdays.py
nkhn37/python-tech-sample-source
e8aea7ed3d810494682b3c2dde952ddd0f7acf84
[ "MIT" ]
null
null
null
python-basic/calendar/leapdays.py
nkhn37/python-tech-sample-source
e8aea7ed3d810494682b3c2dde952ddd0f7acf84
[ "MIT" ]
null
null
null
"""カレンダーを作成する方法 calendarモジュール 指定した期間の閏年の回数を返す [説明ページ] https://tech.nkhn37.net/python-calendar-basic/#_leapdays """ import calendar # 閏年の回数を調べる print(calendar.leapdays(2000, 2022))
16.545455
56
0.785714
20
182
7.1
0.85
0
0
0
0
0
0
0
0
0
0
0.059524
0.076923
182
10
57
18.2
0.785714
0.653846
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
4
186b15183ac390a3ec7a8f8222c77dcb2263149b
1,284
py
Python
backend/transport/models.py
Akay7/SWGraph
5323d51983d9445868d13aeba5497220394d93fe
[ "BSD-3-Clause" ]
null
null
null
backend/transport/models.py
Akay7/SWGraph
5323d51983d9445868d13aeba5497220394d93fe
[ "BSD-3-Clause" ]
null
null
null
backend/transport/models.py
Akay7/SWGraph
5323d51983d9445868d13aeba5497220394d93fe
[ "BSD-3-Clause" ]
null
null
null
from django.db import models from swgraph.models import DateTimeModel from people.models import People class Transport(DateTimeModel): name = models.CharField(max_length=40) model = models.CharField(max_length=40) manufacturer = models.CharField(max_length=80) cost_in_credits = models.CharField(max_length=40) length = models.CharField(max_length=40) max_atmosphering_speed = models.CharField(max_length=40) crew = models.CharField(max_length=40) passengers = models.CharField(max_length=40) cargo_capacity = models.CharField(max_length=40) consumables = models.CharField(max_length=40) def __str__(self): return self.name class Starship(Transport): """ A starship is a transport with a hypderdrive """ hyperdrive_rating = models.CharField(max_length=40) MGLT = models.CharField(max_length=40) starship_class = models.CharField(max_length=40) pilots = models.ManyToManyField( People, related_name="starships", blank=True ) class Vehicle(Transport): """ A vehicle is anything without hyperdrive capability """ vehicle_class = models.CharField(max_length=40) pilots = models.ManyToManyField( People, related_name="vehicles", blank=True )
30.571429
63
0.718069
155
1,284
5.767742
0.329032
0.234899
0.281879
0.375839
0.487696
0.167785
0.167785
0.167785
0.167785
0.167785
0
0.026923
0.190031
1,284
41
64
31.317073
0.832692
0.075545
0
0.1875
0
0
0.014493
0
0
0
0
0
0
1
0.03125
false
0.03125
0.09375
0.03125
0.75
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
1
0
0
4
43e534188a29b73fa187610014230aeba0f2d1be
19,078
py
Python
pyuavcan/transport/udp/__init__.py
subakio/pyuavcan
4ec55a80f8fd3dd21a3d08102837c43d832b71a3
[ "MIT" ]
89
2015-06-10T11:42:06.000Z
2022-03-28T08:34:06.000Z
pyuavcan/transport/udp/__init__.py
subakio/pyuavcan
4ec55a80f8fd3dd21a3d08102837c43d832b71a3
[ "MIT" ]
195
2015-06-10T12:02:44.000Z
2022-03-28T15:30:50.000Z
pyuavcan/transport/udp/__init__.py
subakio/pyuavcan
4ec55a80f8fd3dd21a3d08102837c43d832b71a3
[ "MIT" ]
96
2016-02-29T07:47:15.000Z
2022-03-19T06:05:44.000Z
# Copyright (c) 2019 UAVCAN Consortium # This software is distributed under the terms of the MIT License. # Author: Pavel Kirienko <pavel@uavcan.org> r""" UAVCAN/UDP transport overview +++++++++++++++++++++++++++++ The UAVCAN/UDP transport is experimental and is not yet part of the UAVCAN specification. Future revisions may break wire compatibility until the transport is formally specified. Context: https://forum.uavcan.org/t/alternative-transport-protocols-in-uavcan/324/45?u=pavel.kirienko. The UAVCAN/UDP transport is essentially a trivial stateless UDP blaster based on IP multicasting. This transport is intended for low-latency, high-throughput switched Ethernet networks with complex topologies. In the spirit of UAVCAN, it is designed to be simple and robust; much of the data handling work is offloaded to the standard underlying UDP/IP stack. Both IPv4 and IPv6 are supported by this design, although it is expected that the advantages of IPv6 over IPv4 are less relevant in an intravehicular setting. The concept of anonymous transfer is not defined for UAVCAN/UDP; in this transport, in order to be able to emit a transfer, the node shall have a valid node-ID value. This means that an anonymous UAVCAN/UDP node can only listen to network traffic (i.e., can subscribe to subjects) but cannot transmit anything. If address auto-configuration is desired, lower-level solutions should be used, such as DHCP. This transport module contains no media sublayers because the media abstraction is handled directly by the standard UDP/IP stack of the underlying operating system. Per the UAVCAN transport model provided in the UAVCAN specification, the following transfer categories are supported: +--------------------+--------------------------+---------------------------+ | Supported transfers| Unicast | Broadcast | +====================+==========================+===========================+ |**Message** | No | Yes | +--------------------+--------------------------+---------------------------+ |**Service** | Yes | Banned by Specification | +--------------------+--------------------------+---------------------------+ Protocol definition +++++++++++++++++++ The entirety of the session specifier (:class:`pyuavcan.transport.SessionSpecifier`) is reified through the standard UDP/IP stack without any special extensions. The transfer-ID, transfer priority, and the multi-frame transfer reassembly metadata are allocated in the UAVCAN-specific UDP datagram header. +---------------------------------------+---------------------------------------------------------------------------+ | Parameter | Manifested in | +=======================================+===========================================================================+ | Transfer priority | | +---------------------------------------+ UDP datagram payload (frame header) | | Transfer-ID | | +-------------------+-------------------+---------------------------------------------------------------------------+ | | Route specifier | 16 least significant bits of the IP address | | Session specifier +-------------------+---------------------------------------------------------------------------+ | | Data specifier | For message transfers: 16 least significant bits of the | | | | multicast group address. | | | | For service transfers: UDP destination port number. | +-------------------+-------------------+---------------------------------------------------------------------------+ There are two data types that model UAVCAN/UDP protocol data: :class:`UDPFrame` and :class:`RawPacket`. The latter is never used during normal operation but only during on-line capture sessions for reporting captured packets (see :class:`UDPCaptured`). IP address mapping ~~~~~~~~~~~~~~~~~~ The IPv4 address of a node is structured as follows:: xxxxxxxx.xddddddd.nnnnnnnn.nnnnnnnn \________/\_____/ \_______________/ (9 bits) (7 bits) (16 bits) prefix subnet-ID node-ID Incoming traffic from IP addresses whose 16 most significant bits are different is rejected; this behavior enables co-existence of multiple independent UAVCAN/UDP networks along with other UDP protocols on the same network. The *subnet-ID* is used to differentiate independent UAVCAN/UDP transport networks sharing the same IP network (e.g., multiple UAVCAN/UDP networks running on localhost or on some physical network). This is similar to the domain identifier in DDS. This value is not used anywhere else in the protocol other than in the construction of the multicast group address, as will be shown below. Message transfers ~~~~~~~~~~~~~~~~~ Message transfers are executed as IP multicast transfers. The IPv4 multicast group address is computed statically as follows:: fixed reserved (9 bits) (3 bits) ________ _ / \ / \ 11101111.0ddddddd.000sssss.ssssssss \__/ \_____/ \____________/ (4 bits) (7 bits) (13 bits) IPv4 subnet-ID subject-ID multicast \_______________________/ prefix (23 bits) collision-free multicast addressing limit of Ethernet MAC for IPv4 From the most significant bit to the least significant bit, the IPv4 multicast group address components are as follows: - IPv4 multicast prefix is defined by RFC 1112. - The following 5 bits are set to 0b11110 by this Specification. The motivation is as follows: - Setting the four least significant bits of the most significant byte to 0b1111 moves the address range into the administratively-scoped range (239.0.0.0/8, RFC 2365), which ensures that there may be no conflicts with well-known multicast groups. - Setting the most significant bit of the second octet to zero ensures that there may be no conflict with reserved sub-ranges within the administratively-scoped range. The resulting range 239.0.0.0/9 is entirely ad-hoc defined. - Fixing the 5+4=9 most significant bits of the multicast group address ensures that the variability is confined to the 23 least significant bits of the address only, which is desirable because the IPv4 Ethernet MAC layer does not differentiate beyond the 23 least significant bits of the multicast group address (i.e., addresses that differ only in the 9 MSb collide at the MAC layer, which is unacceptable in a real-time system; see RFC 1112 section 6.4). Without this limitation, an engineer deploying a network might inadvertently create a configuration that causes MAC-layer collisions which may be difficult to detect. - The following 7 bits (the least significant bits of the second octet) are used to differentiate independent UAVCAN/UDP networks sharing the same physical IP network. Since the 9 most significant bits of the node IP address are not represented in the multicast group address, nodes whose IP addresses differ only by the 9 MSb are not distinguished by UAVCAN/UDP. This limitation does not appear to be significant, though, because such configurations are easy to avoid. It follows that there may be up to 128 independent UAVCAN/UDP networks sharing the same IP subnet. - The following 16 bits define the data specifier: - 3 bits reserved for future use. - 13 bits represent the subject-ID as-is. Per RFC 1112, the default TTL is 1, which is unacceptable. Therefore, publishers should use the TTL value of 16 by default, which is chosen as a sensible default suitable for any intravehicular network. Per RFC 1112, in order to emit a multicast packet, a limited level-1 implementation without the full support of IGMP and multicast-specific packet handling policies is sufficient. Due to the dependency on the dynamic IGMP configuration, a newly configured subscriber may not immediately receive data from the subject -- a brief *subscription initialization latency* may occur (typically it is well under one second). This is because the underlying IP stack needs to inform the network switch/router about its interest in a particular multicast group by sending an IGMP membership report first. A high-integrity application may choose to rely on a static switch configuration, in which case no initialization delay will take place. Example:: Node IP address: 01111111 00000010 00000000 00001000 127 2 0 8 Subject-ID: 00010 00101010 Multicast group: 11101111 00000010 00000010 00101010 239 2 2 42 Example:: Node IP address: 11000000 10101000 00000000 00000001 192 168 0 1 Subject-ID: 00010 00101010 Multicast group: 11101111 00101000 00000010 00101010 239 40 2 42 Service transfers ~~~~~~~~~~~~~~~~~ Service transfers are executed as regular IP unicast transfers. The service data specifier (:class:`pyuavcan.transport.ServiceDataSpecifier`) is manifested on the wire as the destination UDP port number; the mapping function is implemented in :func:`udp_port_from_data_specifier`. The source port number can be arbitrary (ephemeral), its value is ignored. UAVCAN uses a wide range of UDP ports. UDP/IP stacks that comply with the IANA ephemeral port range recommendations are expected to be compatible with this; otherwise, there may be port assignment conflicts. This, however, is not a problem for any major modern OS. Datagram header format ~~~~~~~~~~~~~~~~~~~~~~ Every UAVCAN/UDP frame contains the following header before the payload, encoded in the little-endian byte order, expressed here in the DSDL notation:: uint8 version # =0 in this revision; ignore frame otherwise. uint8 priority # Like in CAN: 0 -- highest priority, 7 -- lowest priority. void16 # Set to zero when transmitting, ignore when receiving. uint32 frame_index_eot # MSB is set if the current frame is the last frame of the transfer. uint64 transfer_id # The transfer-ID never overflows. void64 # This space may be used later for runtime type identification. The 31 least significant bits of the field ``frame_index_eot`` contain the frame index within the current transfer; the most significant bit (31st) is set if the current frame is the last frame of the transfer. Also see the documentation for :class:`UDPFrame`. Multi-frame transfers contain four bytes of CRC32-C (Castagnoli) at the end computed over the entire transfer payload. For more info on multi-frame transfers, please see :class:`pyuavcan.transport.commons.high_overhead_transport.TransferReassembler`. Unreliable networks and temporal redundancy +++++++++++++++++++++++++++++++++++++++++++ For unreliable networks, deterministic data loss mitigation is supported. This measure is only available for service transfers, not for message transfers due to their different semantics. If the probability of a frame loss exceeds the desired reliability threshold, the transport can be configured to repeat every outgoing service transfer a specified number of times, on the assumption that the probability of losing any given frame is uncorrelated (or weakly correlated) with that of its neighbors. Assuming that the probability of transfer loss ``P`` is time-invariant, the influence of the multiplier ``M`` can be approximated as ``P' = P^M``. For example, given a network that successfully delivers 99% of transfers, and the probabilities of adjacent transfer loss are uncorrelated, the multiplication factor of 2 can increase the link reliability up to ``100% - (100% - 99%)^2 = 99.99%``. The duplicates are emitted immediately following the original transfer. For example, suppose that a service transfer contains three frames, F0 to F2, and the service transfer multiplication factor is two, then the resulting frame sequence would be as follows:: F0 F1 F2 F0 F1 F2 \_______________/ \_______________/ main copy redundant copy (TX timestamp) (never TX-timestamped) ------------------ time ------------------> As shown on the diagram, if the transmission timestamping is requested, only the first copy is timestamped. Further, any errors occurring during the transmission of redundant copies may be silently ignored by the stack, provided that the main copy is transmitted successfully. The resulting behavior in the provided example is that the transport network may lose up to three unique frames without affecting the application. In the following example, the frames F0 and F2 of the main copy are lost, but the transfer survives:: F0 F1 F2 F0 F1 F2 | | | | | | x | x | | \_____ F2 __________________________ | | \________ F1 (redundant, discarded) x \ | \___________ F0 ________________________ | \_________________ F1 ______________________ \ | \ | | ----- time -----> v v v reassembled multi-frame transfer Removal of duplicate transfers at the opposite end of the link is natively guaranteed by the UAVCAN protocol; no special activities are needed there (read the UAVCAN Specification for background). For time-deterministic (real-time) networks this strategy is preferred over the conventional confirmation-retry approach (e.g., the TCP model) because it results in more predictable network load, lower worst-case latency, and is stateless (participants do not make assumptions about the state of other agents involved in data exchange). Implementation-specific details +++++++++++++++++++++++++++++++ Applications relying on this particular transport implementation will be unable to detect a node-ID conflict on the bus because the implementation discards all traffic originating from its own IP address. This is a very environment-specific edge case resulting from certain peculiarities of the Berkeley socket API. Other implementations of UAVCAN/UDP (particularly those for embedded systems) may not have this limitation. Usage +++++ Create two transport instances -- one with a node-ID, one anonymous: >>> import pyuavcan >>> import pyuavcan.transport.udp >>> tr_0 = pyuavcan.transport.udp.UDPTransport('127.9.1.42') >>> tr_0.local_node_id # Derived from the IP address: (1 << 8) + 42 = 298. 298 >>> tr_1 = pyuavcan.transport.udp.UDPTransport('127.9.15.254', local_node_id=None) # Anonymous is only for listening. >>> tr_1.local_node_id is None True Create an output and an input session: >>> pm = pyuavcan.transport.PayloadMetadata(1024) >>> ds = pyuavcan.transport.MessageDataSpecifier(111) >>> pub = tr_0.get_output_session(pyuavcan.transport.OutputSessionSpecifier(ds, None), pm) >>> pub.socket.getpeername() # UDP port is fixed, and the multicast group address is computed as shown above. ('239.9.0.111', 16383) >>> sub = tr_1.get_input_session(pyuavcan.transport.InputSessionSpecifier(ds, None), pm) Send a transfer from one instance to the other: >>> await_ = tr_1.loop.run_until_complete >>> await_(pub.send(pyuavcan.transport.Transfer(pyuavcan.transport.Timestamp.now(), ... pyuavcan.transport.Priority.LOW, ... 1111, ... fragmented_payload=[]), ... tr_1.loop.time() + 1.0)) True >>> await_(sub.receive(tr_1.loop.time() + 1.0)) TransferFrom(..., transfer_id=1111, ...) >>> tr_0.close() >>> tr_1.close() Tooling +++++++ Run UAVCAN networks on the local loopback interface (``127.x.y.z/8``) or create virtual interfaces for testing. Use Wireshark for monitoring and inspection. Use netcat for trivial monitoring; e.g., listen to a UDP port like this: ``nc -ul 48469``. List all open UDP ports on the local machine: ``netstat -vpaun`` (GNU/Linux). Inheritance diagram +++++++++++++++++++ .. inheritance-diagram:: pyuavcan.transport.udp._udp pyuavcan.transport.udp._frame pyuavcan.transport.udp._session._input pyuavcan.transport.udp._session._output pyuavcan.transport.udp._socket_reader pyuavcan.transport.udp._tracer :parts: 1 """ from ._udp import UDPTransport as UDPTransport from ._udp import UDPTransportStatistics as UDPTransportStatistics from ._session import UDPInputSession as UDPInputSession from ._session import PromiscuousUDPInputSession as PromiscuousUDPInputSession from ._session import SelectiveUDPInputSession as SelectiveUDPInputSession from ._session import UDPInputSessionStatistics as UDPInputSessionStatistics from ._session import PromiscuousUDPInputSessionStatistics as PromiscuousUDPInputSessionStatistics from ._session import SelectiveUDPInputSessionStatistics as SelectiveUDPInputSessionStatistics from ._session import UDPOutputSession as UDPOutputSession from ._session import UDPFeedback as UDPFeedback from ._frame import UDPFrame as UDPFrame from ._ip import IP_ADDRESS_NODE_ID_MASK as IP_ADDRESS_NODE_ID_MASK from ._ip import SUBJECT_PORT as SUBJECT_PORT from ._ip import node_id_to_unicast_ip as node_id_to_unicast_ip from ._ip import unicast_ip_to_node_id as unicast_ip_to_node_id from ._ip import message_data_specifier_to_multicast_group as message_data_specifier_to_multicast_group from ._ip import multicast_group_to_message_data_specifier as multicast_group_to_message_data_specifier from ._ip import service_data_specifier_to_udp_port as service_data_specifier_to_udp_port from ._ip import udp_port_to_service_data_specifier as udp_port_to_service_data_specifier from ._ip import LinkLayerPacket as LinkLayerPacket from ._tracer import IPPacket as IPPacket from ._tracer import IPv4Packet as IPv4Packet from ._tracer import IPv6Packet as IPv6Packet from ._tracer import UDPIPPacket as UDPIPPacket from ._tracer import UDPCapture as UDPCapture from ._tracer import UDPTracer as UDPTracer from ._tracer import UDPErrorTrace as UDPErrorTrace
50.337731
119
0.668309
2,369
19,078
5.228789
0.300971
0.00888
0.012352
0.014531
0.116816
0.079357
0.03536
0.015339
0.007912
0.007912
0
0.029891
0.224919
19,078
378
120
50.470899
0.807804
0.907013
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.964286
0
0.964286
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
0
1
0
1
0
0
4
43ed8f7b8c8dd0a6bd8587bd27d729e8f4d6c1e9
322
py
Python
seqp/integration/fairseq/__init__.py
noe/seqp
b765d014047ec4b44b32aa3dd0f56680b71bb869
[ "MIT" ]
1
2020-05-15T15:41:43.000Z
2020-05-15T15:41:43.000Z
seqp/integration/fairseq/__init__.py
noe/seqp
b765d014047ec4b44b32aa3dd0f56680b71bb869
[ "MIT" ]
null
null
null
seqp/integration/fairseq/__init__.py
noe/seqp
b765d014047ec4b44b32aa3dd0f56680b71bb869
[ "MIT" ]
null
null
null
# Copyright (c) 2019-present, Noe Casas # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. from seqp.integration.fairseq.dictionary import vocab_to_dictionary from seqp.integration.fairseq.dataset import MonolingualDataset
24.769231
77
0.801242
46
322
5.565217
0.73913
0.078125
0.148438
0.203125
0
0
0
0
0
0
0
0.014545
0.145963
322
12
78
26.833333
0.916364
0.540373
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
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
43fb7e8432fc35ade580de4d2e72d68c080577e3
414
py
Python
test/test_class.py
iskandr/serializable
ed309a6f8f2590b525fc0f93c00549223c8c944f
[ "Apache-2.0" ]
null
null
null
test/test_class.py
iskandr/serializable
ed309a6f8f2590b525fc0f93c00549223c8c944f
[ "Apache-2.0" ]
1
2016-08-08T17:31:46.000Z
2016-08-08T18:03:28.000Z
test/test_class.py
iskandr/serializable
ed309a6f8f2590b525fc0f93c00549223c8c944f
[ "Apache-2.0" ]
1
2020-06-19T04:55:56.000Z
2020-06-19T04:55:56.000Z
from serializable import ( from_serializable_repr, to_serializable_repr ) from nose.tools import eq_ class A(object): pass def test_serialize_custom_class(): A_reconstructed = from_serializable_repr(to_serializable_repr(A)) eq_(A, A_reconstructed) def test_serialize_builtin_class(): int_reconstructed = from_serializable_repr(to_serializable_repr(int)) eq_(int, int_reconstructed)
23
73
0.785024
54
414
5.555556
0.351852
0.32
0.2
0.22
0.466667
0.466667
0.34
0
0
0
0
0
0.144928
414
17
74
24.352941
0.847458
0
0
0
0
0
0
0
0
0
0
0
0
1
0.153846
false
0.076923
0.153846
0
0.384615
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
a1005a6b89424a63632232b569b79f4e185e4c2d
154
py
Python
smorest_sfs/plugins/rpc/__init__.py
ssfdust/smorest-sfs
139f6817989ab041c81761d183169de20a26597e
[ "Apache-2.0" ]
8
2020-05-11T07:11:03.000Z
2022-03-25T01:58:18.000Z
smorest_sfs/plugins/rpc/__init__.py
ssfdust/smorest-sfs
139f6817989ab041c81761d183169de20a26597e
[ "Apache-2.0" ]
null
null
null
smorest_sfs/plugins/rpc/__init__.py
ssfdust/smorest-sfs
139f6817989ab041c81761d183169de20a26597e
[ "Apache-2.0" ]
2
2020-05-11T03:53:38.000Z
2021-03-25T01:11:15.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- from .publisher import Publisher from .subscriber import Subscriber __all__ = ["Publisher", "Subscriber"]
19.25
37
0.707792
18
154
5.833333
0.666667
0
0
0
0
0
0
0
0
0
0
0.007519
0.136364
154
7
38
22
0.781955
0.272727
0
0
0
0
0.172727
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a10c9013caf67f4bfcf516ddf591246e76295054
1,519
py
Python
env/lib/python3.6/site-packages/odf/dr3d.py
anthowen/duplify
846d01c1b21230937fdf0281b0cf8c0b08a8c24e
[ "MIT" ]
5,079
2015-01-01T03:39:46.000Z
2022-03-31T07:38:22.000Z
env/lib/python3.6/site-packages/odf/dr3d.py
anthowen/duplify
846d01c1b21230937fdf0281b0cf8c0b08a8c24e
[ "MIT" ]
1,623
2015-01-01T08:06:24.000Z
2022-03-30T19:48:52.000Z
env/lib/python3.6/site-packages/odf/dr3d.py
anthowen/duplify
846d01c1b21230937fdf0281b0cf8c0b08a8c24e
[ "MIT" ]
2,033
2015-01-04T07:18:02.000Z
2022-03-28T19:55:47.000Z
# -*- coding: utf-8 -*- # Copyright (C) 2006-2007 Søren Roug, European Environment Agency # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Contributor(s): # import sys, os.path sys.path.append(os.path.dirname(__file__)) from odf.namespaces import DR3DNS from odf.element import Element from odf.draw import StyleRefElement # Autogenerated def Cube(**args): return StyleRefElement(qname = (DR3DNS,'cube'), **args) def Extrude(**args): return StyleRefElement(qname = (DR3DNS,'extrude'), **args) def Light(Element): return StyleRefElement(qname = (DR3DNS,'light'), **args) def Rotate(**args): return StyleRefElement(qname = (DR3DNS,'rotate'), **args) def Scene(**args): return StyleRefElement(qname = (DR3DNS,'scene'), **args) def Sphere(**args): return StyleRefElement(qname = (DR3DNS,'sphere'), **args)
33.021739
80
0.732719
214
1,519
5.182243
0.537383
0.113616
0.140667
0.173129
0.25248
0.090171
0.061317
0
0
0
0
0.022727
0.159974
1,519
45
81
33.755556
0.846395
0.537854
0
0
0
0
0.048529
0
0
0
0
0
0
1
0.352941
false
0
0.235294
0.352941
0.941176
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
a134b8ac1c74f0cc096c43ab9c2e12e673ea5cde
741
py
Python
models/ProtocolAccrual.py
UF-OCR/OCR-API
6be6982c3f8aabda01d2d6deb52f854d53d929bc
[ "Apache-2.0" ]
1
2019-03-19T20:47:30.000Z
2019-03-19T20:47:30.000Z
models/ProtocolAccrual.py
UF-OCR/OCR-API
6be6982c3f8aabda01d2d6deb52f854d53d929bc
[ "Apache-2.0" ]
7
2019-11-13T03:29:11.000Z
2020-05-04T13:29:50.000Z
models/ProtocolAccrual.py
UF-OCR/OCR-API
6be6982c3f8aabda01d2d6deb52f854d53d929bc
[ "Apache-2.0" ]
2
2019-07-10T19:47:19.000Z
2020-02-05T20:37:41.000Z
from sqlalchemy import Column, String, Integer from models.Model import Model class ProtocolAccrual(Model): __tablename__ = 'sv_pcl_accrual' __table_args__ = {"schema": "oncore"} protocol_id = Column(Integer, primary_key=True, nullable=False) consented_count = Column(Integer, nullable=True) on_study_count= Column(Integer, nullable=True) on_treatment_count = Column(Integer, nullable=True) off_treatment_count = Column(Integer, nullable=True) on_follow_up_count = Column(Integer, nullable=True) off_study_count = Column(Integer, nullable=True) expired_count = Column(Integer, nullable=True) on_ltfu_count = Column(Integer, nullable=True) not_eligible_count = Column(Integer, nullable=True)
41.166667
67
0.759784
93
741
5.731183
0.397849
0.243902
0.30394
0.439024
0.585366
0.472796
0
0
0
0
0
0
0.147099
741
17
68
43.588235
0.843354
0
0
0
0
0
0.035135
0
0
0
0
0
0
1
0
false
0
0.133333
0
1
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
1
0
0
4
a15132c4dac578efd959d14df5565a509ffae7c1
74
py
Python
tests/encodings/bad_encoding.py
RobbiNespu/Rummage
f2240fcbd3941ff4d31621a7460c65b13a0140d4
[ "MIT" ]
null
null
null
tests/encodings/bad_encoding.py
RobbiNespu/Rummage
f2240fcbd3941ff4d31621a7460c65b13a0140d4
[ "MIT" ]
null
null
null
tests/encodings/bad_encoding.py
RobbiNespu/Rummage
f2240fcbd3941ff4d31621a7460c65b13a0140d4
[ "MIT" ]
null
null
null
# -*- coding: utf-fake -*- """Python test file with bad encode string."""
24.666667
46
0.621622
10
74
4.6
1
0
0
0
0
0
0
0
0
0
0
0
0.162162
74
2
47
37
0.741935
0.891892
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
a17702150a7df3995a638a087ea4912e3d5cc5e9
736
py
Python
src/scripts/client/gui/mods/mod_recent_stat_provider.py
n1tr0s4n/TheRecentStatOfYou
e40cf90bfe726c444bac761af36756bc3e704e88
[ "Apache-2.0" ]
1
2019-03-26T03:06:08.000Z
2019-03-26T03:06:08.000Z
src/scripts/client/gui/mods/mod_recent_stat_provider.py
n1tr0s4n/TheRecentStatOfYou
e40cf90bfe726c444bac761af36756bc3e704e88
[ "Apache-2.0" ]
null
null
null
src/scripts/client/gui/mods/mod_recent_stat_provider.py
n1tr0s4n/TheRecentStatOfYou
e40cf90bfe726c444bac761af36756bc3e704e88
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # https://www.apache.org/licenses/LICENSE-2.0.html from abc import ABCMeta, abstractmethod import traceback from mod_recent_stat_logging import logError class StatProvider: __metaclass__ = ABCMeta def getStatistics(self, region, nickname, playerId, playerIdToData): # type: (str, str, int, dict) -> None try: self._getStatistics(region, nickname, playerId, playerIdToData) except BaseException: logError("Error in getStatistics(%s, %s, %s)" % (region, nickname, playerId), traceback.format_exc()) @abstractmethod def _getStatistics(self, region, nickname, playerId, playerIdToData): # type: (str, str, int, dict) -> None pass
30.666667
113
0.673913
80
736
6.075
0.5875
0.115226
0.18107
0.222222
0.316872
0.316872
0.316872
0.316872
0.316872
0.316872
0
0.005172
0.211957
736
23
114
32
0.832759
0.192935
0
0
0
0
0.057725
0
0
0
0
0
0
1
0.153846
false
0.076923
0.230769
0
0.538462
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
a17d47478521f125df0620182358c142cb56576c
2,504
py
Python
relations/serializers.py
acdh-oeaw/apisbaseproject
bb3a6ec280cb431e6252c4595f425261b6c551c9
[ "MIT" ]
null
null
null
relations/serializers.py
acdh-oeaw/apisbaseproject
bb3a6ec280cb431e6252c4595f425261b6c551c9
[ "MIT" ]
6
2018-06-13T15:05:30.000Z
2021-06-10T20:15:37.000Z
relations/serializers.py
acdh-oeaw/metarita
de7484adc689fcb461cbe0abe40672e05e78e37e
[ "MIT" ]
null
null
null
from rest_framework import serializers from .models import (InstitutionInstitution, PersonInstitution, PersonPlace, PersonPerson, PersonEvent, PersonWork, InstitutionPlace, InstitutionEvent, InstitutionWork, PlaceEvent, PlaceWork,PlacePlace, EventWork, EventEvent, WorkWork) class InstitutionInstitutionSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = InstitutionInstitution class PersonInstitutionSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = PersonInstitution class PersonPlaceSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = PersonPlace class PersonPersonSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = PersonPerson class PersonEventSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = PersonEvent class PersonWorkSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = PersonWork class InstitutionPlaceSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = InstitutionPlace class InstitutionEventSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = InstitutionEvent class InstitutionWorkSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = InstitutionWork class PlaceEventSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = PlaceEvent class PlaceWorkSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = PlaceWork class PlacePlaceSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = PlacePlace class EventWorkSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = EventWork class EventEventSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = EventEvent class WorkWorkSerializer(serializers.HyperlinkedModelSerializer): class Meta: fields = '__all__' model = WorkWork
22.763636
98
0.716454
173
2,504
10.017341
0.242775
0.320254
0.363531
0.398153
0.519331
0.519331
0.519331
0
0
0
0
0
0.222843
2,504
109
99
22.972477
0.890545
0
0
0.46875
0
0
0.041933
0
0
0
0
0
0
1
0
false
0
0.03125
0
0.5
0
0
0
1
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
4
a180fd5c6f672af59537a0851057cfec7114c3e5
261
py
Python
scripts/load_xlm_large.py
MaratSaidov/artificial-text-detection
74b2100294232ec361db84fdc3a24fdeba1fce49
[ "MIT" ]
12
2021-11-15T08:59:46.000Z
2022-03-06T15:42:24.000Z
scripts/load_xlm_large.py
MaratSaidov/artificial-text-detection
74b2100294232ec361db84fdc3a24fdeba1fce49
[ "MIT" ]
2
2021-11-14T15:50:00.000Z
2021-11-20T12:17:29.000Z
scripts/load_xlm_large.py
MaratSaidov/artificial-text-detection
74b2100294232ec361db84fdc3a24fdeba1fce49
[ "MIT" ]
null
null
null
from transformers import XLMRobertaModel, XLMRobertaTokenizer tokenizer = XLMRobertaTokenizer.from_pretrained("xlm-roberta-large") model = XLMRobertaModel.from_pretrained( "xlm-roberta-large", add_pooling_layer=False ) # $HOME/atd-models/xlm-roberta-large
32.625
68
0.819923
29
261
7.241379
0.62069
0.142857
0.214286
0.228571
0.27619
0
0
0
0
0
0
0
0.08046
261
7
69
37.285714
0.875
0.130268
0
0
0
0
0.151111
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a1932832413cf7eb1a145ce733db1480ebc9880b
146
py
Python
physics/__init__.py
dwahme/physics_calc_enabler
f0fc4c9214cd024344c5f0d3684b29666339395e
[ "MIT" ]
null
null
null
physics/__init__.py
dwahme/physics_calc_enabler
f0fc4c9214cd024344c5f0d3684b29666339395e
[ "MIT" ]
1
2018-12-31T17:49:59.000Z
2018-12-31T17:49:59.000Z
physics/__init__.py
dwahme/physics_calc_enabler
f0fc4c9214cd024344c5f0d3684b29666339395e
[ "MIT" ]
null
null
null
''' A library to speed up physics data analysis. Contains functions for error analysis and calculations for various physics mechanics values. '''
24.333333
54
0.794521
20
146
5.8
0.85
0
0
0
0
0
0
0
0
0
0
0
0.150685
146
6
55
24.333333
0.935484
0.945205
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
a1a1913394357276f466061ac9b12863b48a5a89
409
py
Python
transactions/apps/__init__.py
cnds/wxdemo
a445ea19ccd0b47caf6ea94e1ddec2ce3faf7d5e
[ "MIT" ]
null
null
null
transactions/apps/__init__.py
cnds/wxdemo
a445ea19ccd0b47caf6ea94e1ddec2ce3faf7d5e
[ "MIT" ]
null
null
null
transactions/apps/__init__.py
cnds/wxdemo
a445ea19ccd0b47caf6ea94e1ddec2ce3faf7d5e
[ "MIT" ]
null
null
null
from .orders import Orders, Order from .promotions import Promotions, Promotion from .payment_detail import PaymentDetail from .coupons import Coupons, Coupon from .reductions import Reductions, Reduction from .discounts import Discount, Discounts from .user_coupons import UserCoupons, UserCouponRemover from .points import PointsDecrease, PointsIncrease, Points from .user_points_mall import UserPointsMall
40.9
58
0.850856
48
409
7.166667
0.479167
0.075581
0
0
0
0
0
0
0
0
0
0
0.107579
409
9
59
45.444444
0.942466
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
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
a1b8c2566de1acd4fa6ccbf20efb52df6b8152ac
918
py
Python
quantify_core/visualization/_appnope.py
quantify-os/quantify-core
748c29b374ed91f92c264be6ce6dd110f8f79842
[ "BSD-4-Clause" ]
1
2022-01-08T14:42:58.000Z
2022-01-08T14:42:58.000Z
quantify_core/visualization/_appnope.py
quantify-os/quantify-core
748c29b374ed91f92c264be6ce6dd110f8f79842
[ "BSD-4-Clause" ]
null
null
null
quantify_core/visualization/_appnope.py
quantify-os/quantify-core
748c29b374ed91f92c264be6ce6dd110f8f79842
[ "BSD-4-Clause" ]
null
null
null
# Repository: https://gitlab.com/quantify-os/quantify-core # Licensed according to the LICENCE file on the master branch """Wrapper of appnope to avoid App Nap (macOS) of Quantify process.""" import platform import sys from distutils.version import LooseVersion as V # Necessary issues with the power-saving features on macOS # See also: # https://github.com/pyqtgraph/pyqtgraph/pull/1092 # https://forum.libcinder.org/topic/os-x-how-to-keep-rendering-in-background import appnope def requires_appnope(): """ Used to check if `appnope` is necessary """ # extracted from `appnope` source return (sys.platform == "darwin") and V(platform.mac_ver()[0]) > V("10.9") def refresh_nope(): """ Communicate to the macOS that the process needs to stay awake and must not be sent to App Nap. This refresh needs to be triggered recurrently (e.g. QtCore.QTimer) """ appnope.nope()
29.612903
78
0.715686
135
918
4.844444
0.659259
0.015291
0
0
0
0
0
0
0
0
0
0.010554
0.174292
918
30
79
30.6
0.852243
0.663399
0
0
0
0
0.03861
0
0
0
0
0
0
1
0.25
true
0
0.5
0
0.875
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
1
0
1
0
0
4
a1bfc74267cb06565b2f699b0034ba6c00cb6e45
21,480
py
Python
UI/crypto/mnemonic/mnemonic.py
lakewik/storj-gui-client
9eef7717a72cce8b46f971d8cf1dbe4561d6cb2c
[ "MIT" ]
40
2017-03-23T19:42:32.000Z
2017-07-13T23:43:00.000Z
UI/crypto/mnemonic/mnemonic.py
Abd-Elrazek/EasyStorj
9eef7717a72cce8b46f971d8cf1dbe4561d6cb2c
[ "MIT" ]
80
2017-04-10T19:47:23.000Z
2017-06-29T17:38:12.000Z
UI/crypto/mnemonic/mnemonic.py
Abd-Elrazek/EasyStorj
9eef7717a72cce8b46f971d8cf1dbe4561d6cb2c
[ "MIT" ]
9
2017-04-13T08:06:14.000Z
2017-06-27T23:57:55.000Z
# # Copyright (c) 2013 Pavol Rusnak # Copyright (c) 2017 mruddy # # 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 binascii import bisect import hashlib import hmac import itertools import os import sys import unicodedata from pbkdf2 import PBKDF2 PBKDF2_ROUNDS = 2048 class ConfigurationError(Exception): pass # From <http://tinyurl.com/p54ocsk> def binary_search(a, x, lo=0, hi=None): # can't use a to specify default for hi hi = hi if hi is not None else len(a) # hi defaults to len(a) pos = bisect.bisect_left(a, x, lo, hi) # find insertion position return (pos if pos != hi and a[pos] == x else -1) # don't walk off the end class Mnemonic(object): def __init__(self, language): self.radix = 2048 english_wordlist = 'abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit august aunt author auto autumn average avocado avoid awake aware away awesome awful awkward axis baby bachelor bacon badge bag balance balcony ball bamboo banana banner bar barely bargain barrel base basic basket battle beach bean beauty because become beef before begin behave behind believe below belt bench benefit best betray better between beyond bicycle bid bike bind biology bird birth bitter black blade blame blanket blast bleak bless blind blood blossom blouse blue blur blush board boat body boil bomb bone bonus book boost border boring borrow boss bottom bounce box boy bracket brain brand brass brave bread breeze brick bridge brief bright bring brisk broccoli broken bronze broom brother brown brush bubble buddy budget buffalo build bulb bulk bullet bundle bunker burden burger burst bus business busy butter buyer buzz cabbage cabin cable cactus cage cake call calm camera camp can canal cancel candy cannon canoe canvas canyon capable capital captain car carbon card cargo carpet carry cart case cash casino castle casual cat catalog catch category cattle caught cause caution cave ceiling celery cement census century cereal certain chair chalk champion change chaos chapter charge chase chat cheap check cheese chef cherry chest chicken chief child chimney choice choose chronic chuckle chunk churn cigar cinnamon circle citizen city civil claim clap clarify claw clay clean clerk clever click client cliff climb clinic clip clock clog close cloth cloud clown club clump cluster clutch coach coast coconut code coffee coil coin collect color column combine come comfort comic common company concert conduct confirm congress connect consider control convince cook cool copper copy coral core corn correct cost cotton couch country couple course cousin cover coyote crack cradle craft cram crane crash crater crawl crazy cream credit creek crew cricket crime crisp critic crop cross crouch crowd crucial cruel cruise crumble crunch crush cry crystal cube culture cup cupboard curious current curtain curve cushion custom cute cycle dad damage damp dance danger daring dash daughter dawn day deal debate debris decade december decide decline decorate decrease deer defense define defy degree delay deliver demand demise denial dentist deny depart depend deposit depth deputy derive describe desert design desk despair destroy detail detect develop device devote diagram dial diamond diary dice diesel diet differ digital dignity dilemma dinner dinosaur direct dirt disagree discover disease dish dismiss disorder display distance divert divide divorce dizzy doctor document dog doll dolphin domain donate donkey donor door dose double dove draft dragon drama drastic draw dream dress drift drill drink drip drive drop drum dry duck dumb dune during dust dutch duty dwarf dynamic eager eagle early earn earth easily east easy echo ecology economy edge edit educate effort egg eight either elbow elder electric elegant element elephant elevator elite else embark embody embrace emerge emotion employ empower empty enable enact end endless endorse enemy energy enforce engage engine enhance enjoy enlist enough enrich enroll ensure enter entire entry envelope episode equal equip era erase erode erosion error erupt escape essay essence estate eternal ethics evidence evil evoke evolve exact example excess exchange excite exclude excuse execute exercise exhaust exhibit exile exist exit exotic expand expect expire explain expose express extend extra eye eyebrow fabric face faculty fade faint faith fall false fame family famous fan fancy fantasy farm fashion fat fatal father fatigue fault favorite feature february federal fee feed feel female fence festival fetch fever few fiber fiction field figure file film filter final find fine finger finish fire firm first fiscal fish fit fitness fix flag flame flash flat flavor flee flight flip float flock floor flower fluid flush fly foam focus fog foil fold follow food foot force forest forget fork fortune forum forward fossil foster found fox fragile frame frequent fresh friend fringe frog front frost frown frozen fruit fuel fun funny furnace fury future gadget gain galaxy gallery game gap garage garbage garden garlic garment gas gasp gate gather gauge gaze general genius genre gentle genuine gesture ghost giant gift giggle ginger giraffe girl give glad glance glare glass glide glimpse globe gloom glory glove glow glue goat goddess gold good goose gorilla gospel gossip govern gown grab grace grain grant grape grass gravity great green grid grief grit grocery group grow grunt guard guess guide guilt guitar gun gym habit hair half hammer hamster hand happy harbor hard harsh harvest hat have hawk hazard head health heart heavy hedgehog height hello helmet help hen hero hidden high hill hint hip hire history hobby hockey hold hole holiday hollow home honey hood hope horn horror horse hospital host hotel hour hover hub huge human humble humor hundred hungry hunt hurdle hurry hurt husband hybrid ice icon idea identify idle ignore ill illegal illness image imitate immense immune impact impose improve impulse inch include income increase index indicate indoor industry infant inflict inform inhale inherit initial inject injury inmate inner innocent input inquiry insane insect inside inspire install intact interest into invest invite involve iron island isolate issue item ivory jacket jaguar jar jazz jealous jeans jelly jewel job join joke journey joy judge juice jump jungle junior junk just kangaroo keen keep ketchup key kick kid kidney kind kingdom kiss kit kitchen kite kitten kiwi knee knife knock know lab label labor ladder lady lake lamp language laptop large later latin laugh laundry lava law lawn lawsuit layer lazy leader leaf learn leave lecture left leg legal legend leisure lemon lend length lens leopard lesson letter level liar liberty library license life lift light like limb limit link lion liquid list little live lizard load loan lobster local lock logic lonely long loop lottery loud lounge love loyal lucky luggage lumber lunar lunch luxury lyrics machine mad magic magnet maid mail main major make mammal man manage mandate mango mansion manual maple marble march margin marine market marriage mask mass master match material math matrix matter maximum maze meadow mean measure meat mechanic medal media melody melt member memory mention menu mercy merge merit merry mesh message metal method middle midnight milk million mimic mind minimum minor minute miracle mirror misery miss mistake mix mixed mixture mobile model modify mom moment monitor monkey monster month moon moral more morning mosquito mother motion motor mountain mouse move movie much muffin mule multiply muscle museum mushroom music must mutual myself mystery myth naive name napkin narrow nasty nation nature near neck need negative neglect neither nephew nerve nest net network neutral never news next nice night noble noise nominee noodle normal north nose notable note nothing notice novel now nuclear number nurse nut oak obey object oblige obscure observe obtain obvious occur ocean october odor off offer office often oil okay old olive olympic omit once one onion online only open opera opinion oppose option orange orbit orchard order ordinary organ orient original orphan ostrich other outdoor outer output outside oval oven over own owner oxygen oyster ozone pact paddle page pair palace palm panda panel panic panther paper parade parent park parrot party pass patch path patient patrol pattern pause pave payment peace peanut pear peasant pelican pen penalty pencil people pepper perfect permit person pet phone photo phrase physical piano picnic picture piece pig pigeon pill pilot pink pioneer pipe pistol pitch pizza place planet plastic plate play please pledge pluck plug plunge poem poet point polar pole police pond pony pool popular portion position possible post potato pottery poverty powder power practice praise predict prefer prepare present pretty prevent price pride primary print priority prison private prize problem process produce profit program project promote proof property prosper protect proud provide public pudding pull pulp pulse pumpkin punch pupil puppy purchase purity purpose purse push put puzzle pyramid quality quantum quarter question quick quit quiz quote rabbit raccoon race rack radar radio rail rain raise rally ramp ranch random range rapid rare rate rather raven raw razor ready real reason rebel rebuild recall receive recipe record recycle reduce reflect reform refuse region regret regular reject relax release relief rely remain remember remind remove render renew rent reopen repair repeat replace report require rescue resemble resist resource response result retire retreat return reunion reveal review reward rhythm rib ribbon rice rich ride ridge rifle right rigid ring riot ripple risk ritual rival river road roast robot robust rocket romance roof rookie room rose rotate rough round route royal rubber rude rug rule run runway rural sad saddle sadness safe sail salad salmon salon salt salute same sample sand satisfy satoshi sauce sausage save say scale scan scare scatter scene scheme school science scissors scorpion scout scrap screen script scrub sea search season seat second secret section security seed seek segment select sell seminar senior sense sentence series service session settle setup seven shadow shaft shallow share shed shell sheriff shield shift shine ship shiver shock shoe shoot shop short shoulder shove shrimp shrug shuffle shy sibling sick side siege sight sign silent silk silly silver similar simple since sing siren sister situate six size skate sketch ski skill skin skirt skull slab slam sleep slender slice slide slight slim slogan slot slow slush small smart smile smoke smooth snack snake snap sniff snow soap soccer social sock soda soft solar soldier solid solution solve someone song soon sorry sort soul sound soup source south space spare spatial spawn speak special speed spell spend sphere spice spider spike spin spirit split spoil sponsor spoon sport spot spray spread spring spy square squeeze squirrel stable stadium staff stage stairs stamp stand start state stay steak steel stem step stereo stick still sting stock stomach stone stool story stove strategy street strike strong struggle student stuff stumble style subject submit subway success such sudden suffer sugar suggest suit summer sun sunny sunset super supply supreme sure surface surge surprise surround survey suspect sustain swallow swamp swap swarm swear sweet swift swim swing switch sword symbol symptom syrup system table tackle tag tail talent talk tank tape target task taste tattoo taxi teach team tell ten tenant tennis tent term test text thank that theme then theory there they thing this thought three thrive throw thumb thunder ticket tide tiger tilt timber time tiny tip tired tissue title toast tobacco today toddler toe together toilet token tomato tomorrow tone tongue tonight tool tooth top topic topple torch tornado tortoise toss total tourist toward tower town toy track trade traffic tragic train transfer trap trash travel tray treat tree trend trial tribe trick trigger trim trip trophy trouble truck true truly trumpet trust truth try tube tuition tumble tuna tunnel turkey turn turtle twelve twenty twice twin twist two type typical ugly umbrella unable unaware uncle uncover under undo unfair unfold unhappy uniform unique unit universe unknown unlock until unusual unveil update upgrade uphold upon upper upset urban urge usage use used useful useless usual utility vacant vacuum vague valid valley valve van vanish vapor various vast vault vehicle velvet vendor venture venue verb verify version very vessel veteran viable vibrant vicious victory video view village vintage violin virtual virus visa visit visual vital vivid vocal voice void volcano volume vote voyage wage wagon wait walk wall walnut want warfare warm warrior wash wasp waste water wave way wealth weapon wear weasel weather web wedding weekend weird welcome west wet whale what wheat wheel when where whip whisper wide width wife wild will win window wine wing wink winner winter wire wisdom wise wish witness wolf woman wonder wood wool word work world worry worth wrap wreck wrestle wrist write wrong yard year yellow you young youth zebra zero zone zoo' english_wordlist_array = english_wordlist.split(" ") #with open('%s/%s.py' % (self._get_directory(), language), 'r') as f: self.wordlist = [w.strip().decode('utf8') if sys.version < '3' else w.strip() for w in english_wordlist_array] print self.wordlist if len(self.wordlist) != self.radix: raise ConfigurationError('Wordlist should contain %d words, but it contains %d words.' % (self.radix, len(self.wordlist))) @classmethod def _get_directory(cls): return os.path.join(os.path.dirname(__file__), 'wordlist') @classmethod def list_languages(cls): return [f.split('.')[0] for f in os.listdir(cls._get_directory()) if f.endswith('.txt')] @classmethod def normalize_string(cls, txt): if isinstance(txt, str if sys.version < '3' else bytes): utxt = txt.decode('utf8') elif isinstance(txt, unicode if sys.version < '3' else str): utxt = txt else: raise TypeError("String value expected") return unicodedata.normalize('NFKD', utxt) @classmethod def detect_language(cls, code): #code = cls.normalize_string(code) #first = code.split(' ')[0] #languages = cls.list_languages() #for lang in languages: # mnemo = cls(lang) # if first in mnemo.wordlist: # return lang return "english" #raise ConfigurationError("Language not detected") vbnj def generate(self, strength=128): if strength not in [128, 160, 192, 224, 256]: raise ValueError('Strength should be one of the following [128, 160, 192, 224, 256], but it is not (%d).' % strength) return self.to_mnemonic(os.urandom(strength // 8)) # Adapted from <http://tinyurl.com/oxmn476> def to_entropy(self, words): if not isinstance(words, list): words = words.split(' ') if len(words) not in [12, 15, 18, 21, 24]: raise ValueError('Number of words must be one of the following: [12, 15, 18, 21, 24], but it is not (%d).' % len(words)) # Look up all the words in the list and construct the # concatenation of the original entropy and the checksum. concatLenBits = len(words) * 11 concatBits = [False] * concatLenBits wordindex = 0 if self.detect_language(' '.join(words)) == 'english': use_binary_search = True else: use_binary_search = False for word in words: # Find the words index in the wordlist ndx = binary_search(self.wordlist, word) if use_binary_search else self.wordlist.index(word) if ndx < 0: raise LookupError('Unable to find "%s" in word list.' % word) # Set the next 11 bits to the value of the index. for ii in range(11): concatBits[(wordindex * 11) + ii] = (ndx & (1 << (10 - ii))) != 0 wordindex += 1 checksumLengthBits = concatLenBits // 33 entropyLengthBits = concatLenBits - checksumLengthBits # Extract original entropy as bytes. entropy = bytearray(entropyLengthBits // 8) for ii in range(len(entropy)): for jj in range(8): if concatBits[(ii * 8) + jj]: entropy[ii] |= 1 << (7 - jj) # Take the digest of the entropy. hashBytes = hashlib.sha256(entropy).digest() if sys.version < '3': hashBits = list(itertools.chain.from_iterable(([ord(c) & (1 << (7 - i)) != 0 for i in range(8)] for c in hashBytes))) else: hashBits = list(itertools.chain.from_iterable(([c & (1 << (7 - i)) != 0 for i in range(8)] for c in hashBytes))) # Check all the checksum bits. for i in range(checksumLengthBits): if concatBits[entropyLengthBits + i] != hashBits[i]: raise ValueError('Failed checksum.') return entropy def to_mnemonic(self, data): if len(data) not in [16, 20, 24, 28, 32]: raise ValueError('Data length should be one of the following: [16, 20, 24, 28, 32], but it is not (%d).' % len(data)) h = hashlib.sha256(data).hexdigest() b = bin(int(binascii.hexlify(data), 16))[2:].zfill(len(data) * 8) + \ bin(int(h, 16))[2:].zfill(256)[:len(data) * 8 // 32] result = [] for i in range(len(b) // 11): idx = int(b[i * 11:(i + 1) * 11], 2) result.append(self.wordlist[idx]) if self.detect_language(' '.join(result)) == 'japanese': # Japanese must be joined by ideographic space. result_phrase = u'\u3000'.join(result) else: result_phrase = ' '.join(result) return result_phrase def check(self, mnemonic): mnemonic = self.normalize_string(mnemonic).split(' ') if len(mnemonic) % 3 > 0: return False try: idx = map(lambda x: bin(self.wordlist.index(x))[2:].zfill(11), mnemonic) b = ''.join(idx) except: return False l = len(b) d = b[:l // 33 * 32] h = b[-l // 33:] nd = binascii.unhexlify(hex(int(d, 2))[2:].rstrip('L').zfill(l // 33 * 8)) nh = bin(int(hashlib.sha256(nd).hexdigest(), 16))[2:].zfill(256)[:l // 33] return h == nh def expand_word(self, prefix): if prefix in self.wordlist: return prefix else: matches = [word for word in self.wordlist if word.startswith(prefix)] if len(matches) == 1: # matched exactly one word in the wordlist return matches[0] else: # exact match not found. # this is not a validation routine, just return the input return prefix def expand(self, mnemonic): return ' '.join(map(self.expand_word, mnemonic.split(' '))) @classmethod def to_seed(cls, mnemonic, passphrase=''): mnemonic = cls.normalize_string(mnemonic) passphrase = cls.normalize_string(passphrase) return PBKDF2(mnemonic, u'mnemonic' + passphrase, iterations=PBKDF2_ROUNDS, macmodule=hmac, digestmodule=hashlib.sha512).read(64) def main(): import binascii import sys if len(sys.argv) > 1: data = sys.argv[1] else: data = sys.stdin.readline().strip() data = binascii.unhexlify(data) m = Mnemonic('english') print(m.to_mnemonic(data)) if __name__ == '__main__': main()
103.269231
13,144
0.752514
3,157
21,480
5.100729
0.729807
0.007452
0.002981
0.003229
0.025896
0.013538
0.003974
0.003974
0.003974
0.003974
0
0.012096
0.203305
21,480
207
13,145
103.768116
0.928884
0.093855
0
0.142857
0
0.028571
0.69999
0
0
0
0
0
0
0
null
null
0.035714
0.078571
null
null
0.021429
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
a1c3c7f1578bbbbe1b4c72b03ed0cb281b2ea5ea
1,266
py
Python
test/test_block_api.py
Pluxbox/radiomanager-python-client
a25450c079110fb12d8e5b00f8b96c2619ed6172
[ "MIT" ]
null
null
null
test/test_block_api.py
Pluxbox/radiomanager-python-client
a25450c079110fb12d8e5b00f8b96c2619ed6172
[ "MIT" ]
1
2018-09-05T08:51:24.000Z
2018-09-06T14:56:30.000Z
test/test_block_api.py
Pluxbox/radiomanager-python-client
a25450c079110fb12d8e5b00f8b96c2619ed6172
[ "MIT" ]
null
null
null
# coding: utf-8 """ RadioManager RadioManager # noqa: E501 OpenAPI spec version: 2.0 Contact: support@pluxbox.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import radiomanager_sdk from radiomanager_sdk.api.block_api import BlockApi # noqa: E501 from radiomanager_sdk.rest import ApiException class TestBlockApi(unittest.TestCase): """BlockApi unit test stubs""" def setUp(self): self.api = radiomanager_sdk.api.block_api.BlockApi() # noqa: E501 def tearDown(self): pass def test_get_block_by_id(self): """Test case for get_block_by_id Get block by id # noqa: E501 """ pass def test_get_current_block(self): """Test case for get_current_block Get current Block # noqa: E501 """ pass def test_get_next_block(self): """Test case for get_next_block Get upcoming Block # noqa: E501 """ pass def test_list_blocks(self): """Test case for list_blocks Get a list of all blocks currently in your station. # noqa: E501 """ pass if __name__ == '__main__': unittest.main()
20.095238
74
0.639021
162
1,266
4.753086
0.388889
0.072727
0.057143
0.077922
0.245455
0.154545
0
0
0
0
0
0.026144
0.274882
1,266
62
75
20.419355
0.812636
0.398894
0
0.25
1
0
0.012539
0
0
0
0
0
0
1
0.3
false
0.25
0.25
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
b800ef83f8de54a1830fbf2f220a723c97ddbe6f
56
py
Python
source/libs/get_color/__init__.py
eaxr/elasticsearch-cli
4eae551d8099f02a30443749eae09efbb636ea57
[ "MIT" ]
4
2019-07-13T13:29:31.000Z
2021-04-01T10:05:25.000Z
source/libs/get_color/__init__.py
eaxr/elasticsearch-cli
4eae551d8099f02a30443749eae09efbb636ea57
[ "MIT" ]
null
null
null
source/libs/get_color/__init__.py
eaxr/elasticsearch-cli
4eae551d8099f02a30443749eae09efbb636ea57
[ "MIT" ]
4
2019-08-21T15:59:37.000Z
2021-04-01T11:48:41.000Z
from .get_color import get_color __all__ = [get_color]
14
32
0.785714
9
56
4.111111
0.555556
0.648649
0
0
0
0
0
0
0
0
0
0
0.142857
56
3
33
18.666667
0.770833
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
b813a2f42ecce8c97cbe44038db1f49d80357cfb
2,941
py
Python
docs_build/tutorials_templates/model_management/introduction/mds.py
dataloop-ai/sdk_examples
422d5629df5af343d2dc275e9570bb83c4e2f49d
[ "MIT" ]
3
2022-01-07T20:33:49.000Z
2022-03-22T12:41:30.000Z
docs_build/tutorials_templates/model_management/introduction/mds.py
dataloop-ai/sdk_examples
422d5629df5af343d2dc275e9570bb83c4e2f49d
[ "MIT" ]
null
null
null
docs_build/tutorials_templates/model_management/introduction/mds.py
dataloop-ai/sdk_examples
422d5629df5af343d2dc275e9570bb83c4e2f49d
[ "MIT" ]
3
2021-12-29T13:11:30.000Z
2022-03-22T12:25:50.000Z
def func1(): """ # Model Management ## Introduction Dataloop's Model Management is here to provide Machine Learning engineers the ability to manage their research and production process. We want to introduce Dataloop entities to create, manage, view, compare, restore, and deploy training sessions. Our Model Management gives a separation between Model code, weights and configuration, and the data. in Offline mode, there is no need to do any code integration with Dataloop - just create a model and snapshots entities and you can start managing your work on the platform create reproducible training: - same configurations and dataset to reproduce the training - view project/org models and snapshots in the platform - view training metrics and results - compare experiments NOTE: all functions from the codebase can be used in FaaS and pipelines only with custom functions! User must create a FaaS and expose those functions any way he’d like Online Mode: In the online mode, you can train and deploy your models easily anywhere on the platform. All you need to do is create a Model Adapter class and expose some functions to build an API between Dataloop and your model. After that, you can easily add model blocks to pipelines, add UI slots in the studio, one-button-training etc ### Model and Snapshot entities #### Model The model entity is basically the algorithm, the architecture of the model, e.g Yolov5, Inception, SVM, etc. - In online it should contain the Model Adapter to create a Dataloop API #### Snapshot Using the Model (architecture), Dataset and Ontology (data and labels) and configuration (a dictionary) we can create a Snapshot of a training process. The Snapshot contains the weights and any other artifact needed to load the trained model a snapshot can be used as a parent to another snapshot - to start for that point (fine-tune and transfer learning) #### Buckets and Codebase 1. local 2. item 3. git 4. GCS ### The Model Adapter The Model Adapter is a python class to create a single API between Dataloop's platform and your Model 1. Train 2. Predict 3. load/save model weights 4. annotation conversion if needed We enable two modes of work: in Offline mode, everything is local, you don't have to upload any model code or any weights to platform, which causes the platform integration to be minimal. For example, you cannot use the Model Management components in a pipeline, can easily create a button interface with your model's inference and more. In Online mode - once you build an Adapter, our platform can interact with your model and trained snapshots and you can connect buttons and slots inside the platform to create, train, inference etc and connect the model and any train snapshot to the UI or to add to a pipeline """
49.016667
280
0.745665
459
2,941
4.777778
0.40305
0.029184
0.02052
0
0
0
0
0
0
0
0
0.004352
0.218633
2,941
59
281
49.847458
0.949956
0.938116
0
0
0
0
0
0
0
0
0
0
0
1
1
true
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
1
0
0
4
b81b6525db48ae452a1ed3b8d1805743f9f43a58
1,794
py
Python
4.4 Global_local.py
HeyArtem/python_lesson_4
9b4fed95d5dd652c9b2afa941a154478b7d3d67c
[ "MIT" ]
null
null
null
4.4 Global_local.py
HeyArtem/python_lesson_4
9b4fed95d5dd652c9b2afa941a154478b7d3d67c
[ "MIT" ]
null
null
null
4.4 Global_local.py
HeyArtem/python_lesson_4
9b4fed95d5dd652c9b2afa941a154478b7d3d67c
[ "MIT" ]
null
null
null
global_var = 10 def func_exemple(local_var_1, local_var_2): print(local_var_1, local_var_2, global_var) func_exemple(11, 12) # След пример, мы пытаемся изменить значение перем Global_var в нутри перемен print(' След пример, мы пытаемся изменить значение перем Global_var в нутри перемен ') def func_exemple_1(local_var_1, local_var_2): global_var = 20 print(local_var_1, local_var_2, global_var, id(global_var)) func_exemple_1(11, 12) # Поменялось ли значение прем global_var??? Проверим print(' Поменялось ли значение прем global_var??? Проверим') print(global_var, id(global_var)) # Не поменялось, потому что Global_Var = 10 (ГЛОБАЛЬНАЯ) и Global_var = 20 (ЛОКАЛЬНАЯ) не имеют НИ ЧЕГО ОБЩЕГО print('! Не поменялось, потому что Global_Var = 10 (ГЛОБАЛЬНАЯ) и Global_var = 20 (ЛОКАЛЬНАЯ) не имеют НИ ЧЕГО ОБЩЕГО !! ') print() # Служебное слово GLOBAL. Для спец. манипупуляц. с переменными print(' Служебное слово GLOBAL. Для спец. манипупуляц. с переменными ') def func_exemple_1(local_var_1, local_var_2): global global_var global_var = 20 print(local_var_1, local_var_2, global_var, id(global_var)) func_exemple_1(11, 12) print(global_var, id(global_var)) print() # Так же есть служебное слово - nonlocal - . C помощью nonlocal можно делать переопределение внутренней области. print(' Так же есть служебное слово - nonlocal - . C помощью nonlocal можно делать переопределение внутренней области. ') def counter(): num = 0 def plus_one(): nonlocal num num+=1 return num return plus_one count = counter() print(count) print('*') print(count()) # Я не понял!! Что то написали..работает.. а не должно.. еще что то. Более подробный материал будет прикреплен к лекции print('* * ') print(count())
31.473684
128
0.729097
271
1,794
4.616236
0.287823
0.151079
0.057554
0.067146
0.794564
0.794564
0.744205
0.744205
0.670663
0.561151
0
0.029912
0.180045
1,794
57
129
31.473684
0.82053
0.295429
0
0.4
0
0.028571
0.350556
0
0
0
0
0
0
1
0.142857
false
0
0
0
0.2
0.485714
0
0
0
null
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
62da5700e738c7d054498b4ebec5f50ab1bafe45
2,049
py
Python
DailyProgrammer/DP20160504C.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
2
2020-12-23T18:59:22.000Z
2021-04-14T13:16:09.000Z
DailyProgrammer/DP20160504C.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
null
null
null
DailyProgrammer/DP20160504C.py
DayGitH/Python-Challenges
bc32f1332a92fcc2dfa6f5ea4d95f8a8d64c3edf
[ "MIT" ]
null
null
null
""" [2016-05-04] Challenge #265 [Hard] Permutations with repeat https://www.reddit.com/r/dailyprogrammer/comments/4i3xrm/20160504_challenge_265_hard_permutations_with/ The number of permutations of a list that includes repeats is `(factorial of list length) / (product of factorials of each items repeat frequency) for the list `0 0 1 2` the permutations in order are 0 0 1 2 0 0 2 1 0 1 0 2 0 1 2 0 0 2 0 1 0 2 1 0 1 0 0 2 1 0 2 0 1 2 0 0 2 0 0 1 2 0 1 0 2 1 0 0 #1. Calculate permutation number of list that may include repeats The permutation number is similar to Monday and Wednesday's challenge. But only wednesday's approach of calculating it without generating the full list will work (fast) for the longer inputs. The input varies from previous ones in that you are provided a list rather than a number to account for possible repeats. If there are no repeats, then the answer is the same as the part 2 (wednesday) challenge. **input:** 5 4 3 2 1 0 2 1 0 0 5 0 1 2 5 0 1 2 0 0 1 1 5 4 3 2 1 0 8 8 8 8 8 8 8 8 8 7 7 7 6 5 0 1 2 5 0 1 2 0 0 1 1 5 4 3 2 1 0 6 7 8 **output:** (0 based indexes) 719 11 10577286119 3269605362042919527837624 # 2. retrieve list from permutation number and sorted list input is in format: permutation_number, sorted list to permute output format is above part 1 input rows. **input:** 719, 0 1 2 3 4 5 11, 0 0 1 2 10577286119, 0 0 0 0 0 1 1 1 1 1 2 2 2 3 4 5 5 5 3269605362042919527837624, 0 0 0 0 0 1 1 1 1 1 2 2 2 3 4 5 5 5 6 6 7 7 7 7 8 8 8 8 8 8 8 8 8 8 # bonus use the above function and wednesday's combination number (optional) to compress/encode a list into a fixed set of numbers (with enough information to decode it) **input:** hello, heely owler world! You might wish to convert to ascii, then calculate the combination number for the unique ascii codes, then calculate the permutation number with each letter replaced by contiguous indexes. """ def main(): pass if __name__ == "__main__": main()
34.15
119
0.702294
420
2,049
3.392857
0.319048
0.02807
0.031579
0.036491
0.149474
0.101053
0.086316
0.077895
0.077895
0.064561
0
0.186727
0.249878
2,049
59
120
34.728814
0.740403
0.964861
0
0
0
0
0.125
0
0
0
0
0
0
1
0.25
true
0.25
0
0
0.25
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
1
1
0
0
0
0
0
4
1a136b7c70017679911b79af18068864ad1c4cc9
468
py
Python
pytpp/attributes/agent_certificate_driver.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
4
2022-02-04T23:58:55.000Z
2022-02-15T18:53:08.000Z
pytpp/attributes/agent_certificate_driver.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
null
null
null
pytpp/attributes/agent_certificate_driver.py
Venafi/pytpp
42af655b2403b8c9447c86962abd4aaa0201f646
[ "MIT" ]
null
null
null
from pytpp.attributes._helper import IterableMeta from pytpp.attributes.agent_certificate_base import AgentCertificateBaseAttributes from pytpp.attributes.agent_driver_base import AgentDriverBaseAttributes from pytpp.attributes.schedule_base import ScheduleBaseAttributes class AgentCertificateDriverAttributes(AgentCertificateBaseAttributes, AgentDriverBaseAttributes, ScheduleBaseAttributes, metaclass=IterableMeta): __config_class__ = "Agent Certificate Driver"
52
146
0.899573
41
468
10
0.439024
0.087805
0.185366
0.117073
0
0
0
0
0
0
0
0
0.061966
468
8
147
58.5
0.933941
0
0
0
0
0
0.051282
0
0
0
0
0
0
1
0
false
0
0.666667
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
1a1420b08424aa1222d42438d53baf4b83517737
368
py
Python
netQuil/__init__.py
att-innovate/qnetdes
459d688e92139ab3219416cdb9e3b20ff082dc1d
[ "MIT" ]
4
2019-11-14T21:30:35.000Z
2021-12-13T08:34:33.000Z
netQuil/__init__.py
att-innovate/qnetdes
459d688e92139ab3219416cdb9e3b20ff082dc1d
[ "MIT" ]
null
null
null
netQuil/__init__.py
att-innovate/qnetdes
459d688e92139ab3219416cdb9e3b20ff082dc1d
[ "MIT" ]
null
null
null
# netQuil: A Distributed Quantum Network Simulator # Copyright (c) 2019 AT&T, Zac Espinosa, Matthew Radzihovsky name = 'netQuil' # Load all modules from netQuil.agents import * from netQuil.simulator import * from netQuil.connections import * from netQuil.devices import * from netQuil.noise import * from netQuil.clock import * from netQuil.distributedGates import *
33.454545
60
0.790761
48
368
6.0625
0.5625
0.264605
0.350515
0
0
0
0
0
0
0
0
0.012618
0.138587
368
11
61
33.454545
0.905363
0.336957
0
0
0
0
0.029046
0
0
0
0
0
0
1
0
false
0
0.875
0
0.875
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
1
0
1
0
0
4
1a1e073b3ada1217cb23635feb54474fb0d93b86
739
py
Python
src/tests/isIAPS_test.py
kekavigi/PySastrawi
0d4fcd2e49b3e798cfdb33a77931cbeaabdd0099
[ "MIT" ]
null
null
null
src/tests/isIAPS_test.py
kekavigi/PySastrawi
0d4fcd2e49b3e798cfdb33a77931cbeaabdd0099
[ "MIT" ]
null
null
null
src/tests/isIAPS_test.py
kekavigi/PySastrawi
0d4fcd2e49b3e798cfdb33a77931cbeaabdd0099
[ "MIT" ]
null
null
null
import unittest from sastrawi.rules import isIAPS class Test_isIAPSTest(unittest.TestCase): def setUp(self): self.isIAPS = isIAPS return super(Test_isIAPSTest, self).setUp() def test_containsInvalidAffixPair(self): self.assertFalse(self.isIAPS('memberikan')) self.assertFalse(self.isIAPS('ketahui')) self.assertTrue(self.isIAPS('berjatuhi')) self.assertTrue(self.isIAPS('dipukulan')) self.assertTrue(self.isIAPS('ketiduri')) self.assertTrue(self.isIAPS('ketidurkan')) self.assertTrue(self.isIAPS('menduaan')) self.assertTrue(self.isIAPS('terduaan')) self.assertTrue(self.isIAPS('perkataan')) if __name__ == '__main__': unittest.main()
32.130435
51
0.682003
78
739
6.320513
0.384615
0.20284
0.255578
0.340771
0
0
0
0
0
0
0
0
0.184032
739
22
52
33.590909
0.817579
0
0
0
0
0
0.116373
0
0
0
0
0
0.5
1
0.111111
false
0
0.111111
0
0.333333
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4