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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
52e1a4d9caecf8fe94d1f16dee07f2830a9b1bec
| 1,241
|
py
|
Python
|
tests/v2/test_service_response_data.py
|
anbnyc/datadog-api-client-python
|
162bd0c6f2523a809aec08a3197e85dc74b78c21
|
[
"Apache-2.0"
] | null | null | null |
tests/v2/test_service_response_data.py
|
anbnyc/datadog-api-client-python
|
162bd0c6f2523a809aec08a3197e85dc74b78c21
|
[
"Apache-2.0"
] | null | null | null |
tests/v2/test_service_response_data.py
|
anbnyc/datadog-api-client-python
|
162bd0c6f2523a809aec08a3197e85dc74b78c21
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import sys
import unittest
import datadog_api_client.v2
from datadog_api_client.v2.model.service_relationships import ServiceRelationships
from datadog_api_client.v2.model.service_response_attributes import ServiceResponseAttributes
from datadog_api_client.v2.model.service_type import ServiceType
globals()['ServiceRelationships'] = ServiceRelationships
globals()['ServiceResponseAttributes'] = ServiceResponseAttributes
globals()['ServiceType'] = ServiceType
from datadog_api_client.v2.model.service_response_data import ServiceResponseData
class TestServiceResponseData(unittest.TestCase):
"""ServiceResponseData unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testServiceResponseData(self):
"""Test ServiceResponseData"""
# FIXME: construct object with mandatory attributes with example values
# model = ServiceResponseData() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
| 31.820513
| 108
| 0.775181
| 136
| 1,241
| 6.897059
| 0.558824
| 0.053305
| 0.085288
| 0.095949
| 0.162047
| 0.162047
| 0.162047
| 0.089552
| 0
| 0
| 0
| 0.014178
| 0.147462
| 1,241
| 38
| 109
| 32.657895
| 0.872401
| 0.333602
| 0
| 0.157895
| 0
| 0
| 0.079012
| 0.030864
| 0
| 0
| 0
| 0.026316
| 0
| 1
| 0.157895
| false
| 0.157895
| 0.368421
| 0
| 0.578947
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 4
|
5e0f9ec800c06344b82d12a8fe344794f62f7fa9
| 53
|
py
|
Python
|
custom_components/xboxone/__init__.py
|
batfasturd/xboxone-home-assistant
|
3ae29cda17e56700310f941315a0c9a23abdc2b5
|
[
"MIT"
] | 32
|
2020-02-28T13:00:42.000Z
|
2021-05-29T17:50:55.000Z
|
custom_components/xboxone/__init__.py
|
batfasturd/xboxone-home-assistant
|
3ae29cda17e56700310f941315a0c9a23abdc2b5
|
[
"MIT"
] | 28
|
2020-03-01T04:45:37.000Z
|
2020-10-31T14:30:39.000Z
|
custom_components/xboxone/__init__.py
|
batfasturd/xboxone-home-assistant
|
3ae29cda17e56700310f941315a0c9a23abdc2b5
|
[
"MIT"
] | 20
|
2020-04-05T08:46:08.000Z
|
2021-06-09T17:21:41.000Z
|
"""Xbox one smartglass - media player integration"""
| 26.5
| 52
| 0.735849
| 6
| 53
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132075
| 53
| 1
| 53
| 53
| 0.847826
| 0.867925
| 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
|
5e3a4dc87b369775a2e4fed6ba5ca4f50a1e8428
| 121
|
py
|
Python
|
app/exceptions/invalid_content_type.py
|
Pocket/proxy-server
|
f7a6d668224dd2b93d0b9b0c41c91744c5b042d3
|
[
"Apache-2.0"
] | 13
|
2019-11-04T23:55:18.000Z
|
2021-11-26T07:07:46.000Z
|
app/exceptions/invalid_content_type.py
|
Pocket/proxy-server
|
f7a6d668224dd2b93d0b9b0c41c91744c5b042d3
|
[
"Apache-2.0"
] | 12
|
2020-02-02T10:54:21.000Z
|
2021-06-10T16:12:55.000Z
|
app/exceptions/invalid_content_type.py
|
Pocket/proxy-server
|
f7a6d668224dd2b93d0b9b0c41c91744c5b042d3
|
[
"Apache-2.0"
] | 2
|
2020-01-15T07:38:24.000Z
|
2022-01-19T19:55:59.000Z
|
from app.exceptions.base_exception import BaseException
class InvalidContentType(BaseException):
status_code = 400
| 20.166667
| 55
| 0.826446
| 13
| 121
| 7.538462
| 0.923077
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028302
| 0.123967
| 121
| 5
| 56
| 24.2
| 0.896226
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
eae02c0529c1b4e8d36f6c01d314d2b28a631e80
| 189
|
py
|
Python
|
Basic_Python/getting_started3.py
|
vibhgupta/python-basics
|
c898f292eccc39a4fded7d1f1a4f90084bf934ab
|
[
"MIT"
] | null | null | null |
Basic_Python/getting_started3.py
|
vibhgupta/python-basics
|
c898f292eccc39a4fded7d1f1a4f90084bf934ab
|
[
"MIT"
] | null | null | null |
Basic_Python/getting_started3.py
|
vibhgupta/python-basics
|
c898f292eccc39a4fded7d1f1a4f90084bf934ab
|
[
"MIT"
] | null | null | null |
import sys
sys.stderr.write("This is the stderr test\n")
sys.stderr.flush()
sys.stderr.write('this is my first sys tutorial\n')
print (sys.argv)
print datetime.datetime.now
| 15.75
| 52
| 0.698413
| 31
| 189
| 4.258065
| 0.548387
| 0.204545
| 0.212121
| 0.272727
| 0.30303
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179894
| 189
| 11
| 53
| 17.181818
| 0.851613
| 0
| 0
| 0
| 0
| 0
| 0.314607
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.166667
| null | null | 0.333333
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d816ef1d65379ebcb0d6888e5a2de9ffba06d92c
| 17,116
|
py
|
Python
|
src/hydrogen/tags.py
|
beesperester/python-markup
|
93e826db37a894354001a36690506966677dcbce
|
[
"MIT"
] | null | null | null |
src/hydrogen/tags.py
|
beesperester/python-markup
|
93e826db37a894354001a36690506966677dcbce
|
[
"MIT"
] | null | null | null |
src/hydrogen/tags.py
|
beesperester/python-markup
|
93e826db37a894354001a36690506966677dcbce
|
[
"MIT"
] | null | null | null |
from __future__ import annotations
from typing import Any
from hydrogen.elements import Element, T_element
class a(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("a", *children, **attributes)
class abbr(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("abbr", *children, **attributes)
class address(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("address", *children, **attributes)
class area(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("area", *children, **attributes)
class article(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("article", *children, **attributes)
class aside(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("aside", *children, **attributes)
class audio(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("audio", *children, **attributes)
class b(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("b", *children, **attributes)
class base(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("base", *children, **attributes)
class bdi(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("bdi", *children, **attributes)
class bdo(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("bdo", *children, **attributes)
class blockquote(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("blockquote", *children, **attributes)
class body(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("body", *children, **attributes)
class br(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("br", *children, **attributes)
class button(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("button", *children, **attributes)
class canvas(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("canvas", *children, **attributes)
class caption(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("caption", *children, **attributes)
class cite(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("cite", *children, **attributes)
class code(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("code", *children, **attributes)
class col(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("col", *children, **attributes)
class colgroup(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("colgroup", *children, **attributes)
class data(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("data", *children, **attributes)
class datalist(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("datalist", *children, **attributes)
class dd(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("dd", *children, **attributes)
class deleted(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("del", *children, **attributes)
class details(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("details", *children, **attributes)
class dfn(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("dfn", *children, **attributes)
class dialog(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("dialog", *children, **attributes)
class div(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("div", *children, **attributes)
class dl(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("dl", *children, **attributes)
class dt(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("dt", *children, **attributes)
class em(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("em", *children, **attributes)
class embed(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("embed", *children, **attributes)
class fieldset(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("fieldset", *children, **attributes)
class figcaption(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("figcaption", *children, **attributes)
class figure(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("figure", *children, **attributes)
class footer(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("footer", *children, **attributes)
class form(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("form", *children, **attributes)
class h1(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("h1", *children, **attributes)
class h2(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("h2", *children, **attributes)
class h3(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("h3", *children, **attributes)
class h4(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("h4", *children, **attributes)
class h5(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("h5", *children, **attributes)
class h6(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("h6", *children, **attributes)
class head(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("head", *children, **attributes)
class header(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("header", *children, **attributes)
class hr(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("hr", *children, **attributes)
class html(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("html", *children, **attributes)
class i(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("i", *children, **attributes)
class iframe(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("iframe", *children, **attributes)
class img(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("img", *children, **attributes)
class input(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("input", *children, **attributes)
class ins(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("ins", *children, **attributes)
class kbd(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("kbd", *children, **attributes)
class label(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("label", *children, **attributes)
class legend(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("legend", *children, **attributes)
class li(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("li", *children, **attributes)
class link(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("link", *children, **attributes)
class main(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("main", *children, **attributes)
class map(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("map", *children, **attributes)
class mark(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("mark", *children, **attributes)
class meta(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("meta", *children, **attributes)
class meter(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("meter", *children, **attributes)
class nav(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("nav", *children, **attributes)
class noscript(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("noscript", *children, **attributes)
class object(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("object", *children, **attributes)
class ol(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("ol", *children, **attributes)
class optgroup(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("optgroup", *children, **attributes)
class option(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("option", *children, **attributes)
class p(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("p", *children, **attributes)
class param(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("param", *children, **attributes)
class picture(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("picture", *children, **attributes)
class pre(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("pre", *children, **attributes)
class progress(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("progress", *children, **attributes)
class q(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("q", *children, **attributes)
class rp(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("rp", *children, **attributes)
class rt(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("rt", *children, **attributes)
class ruby(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("ruby", *children, **attributes)
class s(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("s", *children, **attributes)
class samp(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("samp", *children, **attributes)
class script(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("script", *children, **attributes)
class section(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("section", *children, **attributes)
class select(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("select", *children, **attributes)
class small(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("small", *children, **attributes)
class source(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("source", *children, **attributes)
class span(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("span", *children, **attributes)
class strong(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("strong", *children, **attributes)
class style(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("style", *children, **attributes)
class sub(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("sub", *children, **attributes)
class summary(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("summary", *children, **attributes)
class sup(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("sup", *children, **attributes)
class svg(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("svg", *children, **attributes)
class table(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("table", *children, **attributes)
class title(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("title", *children, **attributes)
class tbody(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("tbody", *children, **attributes)
class td(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("td", *children, **attributes)
class template(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("template", *children, **attributes)
class textarea(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("textarea", *children, **attributes)
class tfoot(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("tfoot", *children, **attributes)
class th(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("th", *children, **attributes)
class thead(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("thead", *children, **attributes)
class time(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("time", *children, **attributes)
class tile(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("tile", *children, **attributes)
class tr(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("tr", *children, **attributes)
class track(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("track", *children, **attributes)
class u(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("u", *children, **attributes)
class ul(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("ul", *children, **attributes)
class var(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("var", *children, **attributes)
class video(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("video", *children, **attributes)
class wbr(Element):
def __init__(self, *children: T_element, **attributes: Any) -> None:
super().__init__("wbr", *children, **attributes)
| 30.728905
| 72
| 0.651905
| 1,885
| 17,116
| 5.391512
| 0.068435
| 0.087376
| 0.15153
| 0.194824
| 0.649415
| 0.649415
| 0.649415
| 0.649415
| 0.649415
| 0.649415
| 0
| 0.000849
| 0.174457
| 17,116
| 556
| 73
| 30.784173
| 0.718401
| 0
| 0
| 0.33033
| 0
| 0
| 0.02752
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.33033
| false
| 0
| 0.009009
| 0
| 0.66967
| 0
| 0
| 0
| 0
| null | 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
d83448a771b43ddb92df4dc7b8de8d2c78cba0dc
| 57
|
py
|
Python
|
statdepth/__init__.py
|
braingeneers/functional_depth_methods
|
40bbd91fb1e154e5f6b9f21e76e6fb79976dad38
|
[
"MIT"
] | 1
|
2021-01-18T21:45:02.000Z
|
2021-01-18T21:45:02.000Z
|
statdepth/__init__.py
|
braingeneers/functional_depth_methods
|
40bbd91fb1e154e5f6b9f21e76e6fb79976dad38
|
[
"MIT"
] | 1
|
2021-03-22T16:03:20.000Z
|
2021-03-22T16:03:20.000Z
|
statdepth/__init__.py
|
braingeneers/functional_depth_methods
|
40bbd91fb1e154e5f6b9f21e76e6fb79976dad38
|
[
"MIT"
] | null | null | null |
from .depth.depth import FunctionalDepth, PointcloudDepth
| 57
| 57
| 0.877193
| 6
| 57
| 8.333333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.070175
| 57
| 1
| 57
| 57
| 0.943396
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
d834a51f7c3145aa94bf185f7ebf0d7888c21bf7
| 31
|
py
|
Python
|
graph_weather/models/layers/__init__.py
|
openclimatefix/graph_weather
|
e00b75418d62181d213fede2925bb100b4091f57
|
[
"MIT"
] | 6
|
2022-02-25T09:27:57.000Z
|
2022-03-28T22:26:56.000Z
|
graph_weather/models/layers/__init__.py
|
openclimatefix/graph_weather
|
e00b75418d62181d213fede2925bb100b4091f57
|
[
"MIT"
] | 11
|
2022-02-25T08:24:17.000Z
|
2022-03-30T18:31:16.000Z
|
graph_weather/models/layers/__init__.py
|
openclimatefix/graph_weather
|
e00b75418d62181d213fede2925bb100b4091f57
|
[
"MIT"
] | null | null | null |
"""Layers for use in models"""
| 15.5
| 30
| 0.645161
| 5
| 31
| 4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.16129
| 31
| 1
| 31
| 31
| 0.769231
| 0.774194
| 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
|
dc243ef423c0fbf9ec38ba85cd04651704aef416
| 105
|
py
|
Python
|
AbuseCh/__init__.py
|
colingrady/AbuseCh
|
0aff00fd12bdfaba9bd2d47150173e0ff5bbacf7
|
[
"Apache-2.0"
] | null | null | null |
AbuseCh/__init__.py
|
colingrady/AbuseCh
|
0aff00fd12bdfaba9bd2d47150173e0ff5bbacf7
|
[
"Apache-2.0"
] | null | null | null |
AbuseCh/__init__.py
|
colingrady/AbuseCh
|
0aff00fd12bdfaba9bd2d47150173e0ff5bbacf7
|
[
"Apache-2.0"
] | null | null | null |
from ._version import __version__
from .malwarebazaar import MalwareBazaar
from .urlhaus import URLhaus
| 21
| 40
| 0.847619
| 12
| 105
| 7
| 0.416667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12381
| 105
| 4
| 41
| 26.25
| 0.913043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
dc2e666e95f98cab7c6d9ec14f7843e1d3340ef4
| 421
|
py
|
Python
|
Document.py
|
BeatrizRCorreia/health-informatics-project2
|
e26dd1a0be6c209fd756b22aa8fa912fbfb46b1c
|
[
"MIT"
] | null | null | null |
Document.py
|
BeatrizRCorreia/health-informatics-project2
|
e26dd1a0be6c209fd756b22aa8fa912fbfb46b1c
|
[
"MIT"
] | null | null | null |
Document.py
|
BeatrizRCorreia/health-informatics-project2
|
e26dd1a0be6c209fd756b22aa8fa912fbfb46b1c
|
[
"MIT"
] | null | null | null |
class Document:
def __init__(self, docID, docTitle, docContent, docAll):
self.docID = docID
self.docTitle = docTitle
self.docContent = docContent
self.docAll = docAll
def get_docID(self):
return self.docID
def get_docTitle(self):
return self.docTitle
def get_docContent(self):
return self.docContent
def get_docAll(self):
return self.docAll
def set_docAll(self, newAll):
self.docAll = newAll
| 19.136364
| 57
| 0.741093
| 57
| 421
| 5.315789
| 0.22807
| 0.079208
| 0.184818
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168646
| 421
| 22
| 58
| 19.136364
| 0.865714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.375
| false
| 0
| 0
| 0.25
| 0.6875
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
dc84ea7f37843ce480eb90d3e001d624b05cd735
| 529
|
py
|
Python
|
scfmsp/controlflowanalysis/instructions/InstructionAdd.py
|
sepidehpouyan/SCF-MSP430
|
1d7565bf38d9f42e775031d4ea8515ff99bef778
|
[
"MIT"
] | 1
|
2020-07-03T21:26:52.000Z
|
2020-07-03T21:26:52.000Z
|
scfmsp/controlflowanalysis/instructions/InstructionAdd.py
|
sepidehpouyan/SCF-MSP430
|
1d7565bf38d9f42e775031d4ea8515ff99bef778
|
[
"MIT"
] | null | null | null |
scfmsp/controlflowanalysis/instructions/InstructionAdd.py
|
sepidehpouyan/SCF-MSP430
|
1d7565bf38d9f42e775031d4ea8515ff99bef778
|
[
"MIT"
] | null | null | null |
from scfmsp.controlflowanalysis.instructions.AbstractInstructionTwoRegisters import AbstractInstructionTwoRegisters
class InstructionAdd(AbstractInstructionTwoRegisters):
name = 'add'
def get_execution_time(self):
return self.clock
def execute_judgment(self, ac):
super(InstructionAdd, self).execute_judgment(ac)
self._execute_judgment_carry(ac)
self._execute_judgment_zero(ac)
self._execute_judgment_negative(ac)
self._execute_judgment_overflow(ac)
| 33.0625
| 116
| 0.742911
| 51
| 529
| 7.392157
| 0.490196
| 0.238727
| 0.251989
| 0.222812
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190926
| 529
| 15
| 117
| 35.266667
| 0.880841
| 0
| 0
| 0
| 0
| 0
| 0.005837
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.181818
| false
| 0
| 0.090909
| 0.090909
| 0.545455
| 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
|
dc85b2581325920f87d17d9b15241283b03a95fe
| 3,928
|
py
|
Python
|
serial/src/serial_test3.py
|
Choi-Laboratory/SOBIT-Bringup
|
89a921ac5922b2963155d80739013c7ef4c67abf
|
[
"Apache-2.0"
] | null | null | null |
serial/src/serial_test3.py
|
Choi-Laboratory/SOBIT-Bringup
|
89a921ac5922b2963155d80739013c7ef4c67abf
|
[
"Apache-2.0"
] | null | null | null |
serial/src/serial_test3.py
|
Choi-Laboratory/SOBIT-Bringup
|
89a921ac5922b2963155d80739013c7ef4c67abf
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import serial
ser=serial.Serial(
port = '/dev/vsrc',
baudrate = 115200,
parity = serial.PARITY_NONE,
bytesize = serial.EIGHTBITS,
stopbits = serial.STOPBITS_ONE,
timeout = None,
xonxoff = 0,
rtscts = 0,
# interCharTimeout = None
)
joint_name = ["","L_wheel","R_wheel","L_shoulder_roll","L_shoulder_pitch","L_elbow_yaw","L_shoulder_pitch", "R_shoulder_roll","R_shoulder_pitch","R_elbow_yaw","R_elbow_pitch", "neck_pitch","neck_roll\t","neck_yaw\t","nouse","nouse","nouse","nouse","nouse", "L_hand_yaw","L_hand_thumb","L_hand_index","L_hand_mid","L_hand_ring","L_hand_pinky", "R_hand_yaw","R_hand_thumb","R_hand_index","R_hand_mid","R_hand_ring","R_hand_pinky"]
#ser.open()
while True:
try:
print("\n1.pose_init 2.R 3.get_enc 4.gain_on 5.gain_off 6.motion 0.exit")
command = input("select>>")
##############################################################################################
#<pose_init>
if command == 1:
ser.write("@00c8:T8000:T8000:T8000:T0000:T8000:T8000:T8000:T8000:T8000:T8000:T8000:T8000:T8000::::::T8000:T8000:T6800:T9800:T6800:T9800:T8000:T8000:T9800:T6800:T9800:T6800\n")
print ser.readline(),
##############################################################################################
#<R>
elif command == 2:
ser.write("R\n")
print ser.readline(),
##############################################################################################
#<get_enc>
elif command == 3:
ser.write(":Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx::::::Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx:Cxxxx\n");
str = ser.readline(),
print str[0]
position_list = str[0].split(";")
#print str[0].split(";")
for i in range(1,31):
position_list[i] = position_list[i][1:]
#print type(position_list[i])
#position_list[i] = hex(position_list[i])
#print type(position_list[i])
if len(position_list[i]) != 0:
position_list[i] = int(position_list[i],16)
else:
pass
#print '%2d'%i,")", joint_name[i] ,"\t:", position_list_16[i], position_list_10[i]
print '%2d'%i,")", joint_name[i] ,"\t:", position_list[i]
##############################################################################################
#<gain_on>
elif command == 4:
ser.write(":P0100:P0100:P0040:P0080:P0045:P0040:P0040:P0080:P0045:P0040:P0080:P0200:P0016::::::P0001:P0001:P0001:P0001:P0001:P0001:P0001:P0001:P0001:P0001:P0001:P0001\n")
print ser.readline(),
##############################################################################################
#<gain_off>
elif command == 5:
ser.write("P0000\n")
print ser.readline(),
##############################################################################################
#<motion>
elif command == 6:
print "move left_shoulder_pitch"
motion_deg = input("take in(0-180>")
if motion_deg < 0:
print "range out"
motion_deg = 0
motion_shoulder_pitch = motion_deg * 97
print motion_shoulder_pitch
motion_shoulder_pitch = '%x' % motion_shoulder_pitch
print motion_shoulder_pitch
motion = "@00c8:T8000:T8000:T8000T"+motion_shouler_pitch+"T8000:T8000:T8000:T8000:T8000:T8000:T8000:T8000:T8000::::::T8000:T8000:T6800:T9800:T6800:T9800:T8000:T8000:T9800:T6800:T9800:T6800\n"
print motion
#ser.write("@00c8:T8000:T8000:T" + motion_shoulder_roll + ":T0000:T8000:T8000:T8000:T8000:T8000:T8000:T8000:T8000:T8000::::::T8000:T8000:T6800:T9800:T6800:T9800:T9E37:T8000:T9800:T6800:T9800:T6800\n")
print ser.readline(),
##############################################################################################
elif command == 0:
ser.close()
break
elif command == "":
ser.close()
break
else:
ser.close()
break
except:
print "except"
break
| 33.57265
| 429
| 0.555244
| 490
| 3,928
| 4.261224
| 0.244898
| 0.172414
| 0.201149
| 0.229885
| 0.380268
| 0.315613
| 0.290709
| 0.290709
| 0.290709
| 0.235632
| 0
| 0.131987
| 0.130092
| 3,928
| 116
| 430
| 33.862069
| 0.479075
| 0.135947
| 0
| 0.246154
| 0
| 0.076923
| 0.407353
| 0.232353
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0.015385
| 0.015385
| null | null | 0.215385
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
dc8cc626a4b58ba41326004e9570b4cfe377aed5
| 57
|
py
|
Python
|
__init__.py
|
Jalepeno112/SphinxWePayApi
|
111d2b4a792c06406a55053d38000985c87c0d67
|
[
"Apache-2.0"
] | null | null | null |
__init__.py
|
Jalepeno112/SphinxWePayApi
|
111d2b4a792c06406a55053d38000985c87c0d67
|
[
"Apache-2.0"
] | null | null | null |
__init__.py
|
Jalepeno112/SphinxWePayApi
|
111d2b4a792c06406a55053d38000985c87c0d67
|
[
"Apache-2.0"
] | null | null | null |
#__init__.py file so that this directory can be imported
| 28.5
| 56
| 0.807018
| 10
| 57
| 4.2
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 57
| 1
| 57
| 57
| 0.875
| 0.964912
| 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
|
dcb43f8468694be88a09207fcbc3927860cf178f
| 48
|
py
|
Python
|
06/00/4.py
|
pylangstudy/201706
|
f1cc6af6b18e5bd393cda27f5166067c4645d4d3
|
[
"CC0-1.0"
] | null | null | null |
06/00/4.py
|
pylangstudy/201706
|
f1cc6af6b18e5bd393cda27f5166067c4645d4d3
|
[
"CC0-1.0"
] | 70
|
2017-06-01T11:02:51.000Z
|
2017-06-30T00:35:32.000Z
|
06/00/4.py
|
pylangstudy/201706
|
f1cc6af6b18e5bd393cda27f5166067c4645d4d3
|
[
"CC0-1.0"
] | null | null | null |
for item in reversed(range(5)):
print(item)
| 16
| 31
| 0.666667
| 8
| 48
| 4
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025641
| 0.1875
| 48
| 2
| 32
| 24
| 0.794872
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
f4b858aace0468758291d45e88234ecf540ae898
| 346
|
py
|
Python
|
edam_data/streams.py
|
galaxyproject/edam_data
|
0fa349214d70994cd43752e252c465e5eb52bf17
|
[
"MIT"
] | 4
|
2021-07-26T16:12:11.000Z
|
2021-07-29T00:29:51.000Z
|
edam_data/streams.py
|
galaxyproject/edam_data
|
0fa349214d70994cd43752e252c465e5eb52bf17
|
[
"MIT"
] | null | null | null |
edam_data/streams.py
|
galaxyproject/edam_data
|
0fa349214d70994cd43752e252c465e5eb52bf17
|
[
"MIT"
] | null | null | null |
"""Return text streams to EDAM data.
Keep parsing and such to minimum to maintain maximum backward compatibility.
"""
from importlib.resources import open_text
from typing import TextIO
def tabular_stream() -> TextIO:
"""Yield EDAM data in TSV format as a Python UTF-8 encoded text stream."""
return open_text("edam_data", 'EDAM.tsv')
| 28.833333
| 78
| 0.748555
| 52
| 346
| 4.903846
| 0.673077
| 0.094118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00346
| 0.16474
| 346
| 11
| 79
| 31.454545
| 0.878893
| 0.520231
| 0
| 0
| 0
| 0
| 0.11039
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| true
| 0
| 0.5
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
f4d3bb534fbad7ed4687e12693434eb57d5667e0
| 185
|
py
|
Python
|
signbank/settings/pruebas.py
|
GDiaz16/signbank
|
fe492965a6e1294eb036c3a2adc54d1c8ba19f0f
|
[
"BSD-3-Clause"
] | null | null | null |
signbank/settings/pruebas.py
|
GDiaz16/signbank
|
fe492965a6e1294eb036c3a2adc54d1c8ba19f0f
|
[
"BSD-3-Clause"
] | 3
|
2020-04-30T14:18:57.000Z
|
2021-06-10T22:30:30.000Z
|
signbank/settings/pruebas.py
|
GDiaz16/signbank
|
fe492965a6e1294eb036c3a2adc54d1c8ba19f0f
|
[
"BSD-3-Clause"
] | null | null | null |
import os
BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJECT_DIR = os.path.dirname(BASE_DIR)
print(os.path.join(os.path.dirname(BASE_DIR), "static_collect"))
| 46.25
| 70
| 0.783784
| 32
| 185
| 4.25
| 0.40625
| 0.264706
| 0.382353
| 0.25
| 0.294118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.048649
| 185
| 4
| 71
| 46.25
| 0.772727
| 0
| 0
| 0
| 0
| 0
| 0.075269
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0.25
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7608a5b82d5d7405d1f5ccb0b1303b55d5b9f242
| 698
|
py
|
Python
|
src/graph_db/access/db.py
|
ilya16/graph-db
|
6b35130c3fb540f030e65cdf309419f75f94cedf
|
[
"MIT"
] | 9
|
2018-04-27T07:49:08.000Z
|
2021-03-15T12:06:23.000Z
|
src/graph_db/access/db.py
|
ilya16/graph-db
|
6b35130c3fb540f030e65cdf309419f75f94cedf
|
[
"MIT"
] | 14
|
2018-04-10T13:09:34.000Z
|
2018-05-07T21:40:01.000Z
|
src/graph_db/access/db.py
|
ilya16/graph-db
|
6b35130c3fb540f030e65cdf309419f75f94cedf
|
[
"MIT"
] | null | null | null |
from graph_db.access.cursor import Cursor
from graph_db.engine.api import EngineAPI
from graph_db.engine.graph_engine import GraphEngine
class GraphDB:
def __init__(self, config_path: str):
self.config_path = config_path
self.graph_engine: EngineAPI = GraphEngine(config_path)
def cursor(self):
return Cursor(self.graph_engine)
def close(self):
self.graph_engine.close()
def get_graph(self):
return self.graph_engine.get_graph()
def get_stats(self):
return self.graph_engine.get_stats()
def get_engine(self):
return self.graph_engine
def connect(config_path: str):
db = GraphDB(config_path)
return db
| 23.266667
| 63
| 0.704871
| 96
| 698
| 4.864583
| 0.239583
| 0.164882
| 0.192719
| 0.122056
| 0.173448
| 0.119914
| 0
| 0
| 0
| 0
| 0
| 0
| 0.213467
| 698
| 29
| 64
| 24.068966
| 0.850638
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.35
| false
| 0
| 0.15
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
761b1c20fee4b1f922a5a4307eb111834db41917
| 203
|
py
|
Python
|
setup.py
|
CoveoWhisper/ModelGenerator
|
f20743ab075d9a965df00e63eaf4907aa57ed849
|
[
"MIT"
] | null | null | null |
setup.py
|
CoveoWhisper/ModelGenerator
|
f20743ab075d9a965df00e63eaf4907aa57ed849
|
[
"MIT"
] | null | null | null |
setup.py
|
CoveoWhisper/ModelGenerator
|
f20743ab075d9a965df00e63eaf4907aa57ed849
|
[
"MIT"
] | null | null | null |
from distutils.core import setup
setup(
name='Model Generator',
version='1',
packages=['generator'],
license='MIT',
long_description='Project to generate model for Whisper product'
)
| 22.555556
| 68
| 0.694581
| 24
| 203
| 5.833333
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006061
| 0.187192
| 203
| 9
| 69
| 22.555556
| 0.842424
| 0
| 0
| 0
| 1
| 0
| 0.357843
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.125
| 0
| 0.125
| 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
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7624431f2f64cf8f39a7bfc79019058714754ed5
| 159
|
py
|
Python
|
slack/python/mongo/config.py
|
m4573rn3rd/scripts
|
df29a79b5ed6a996ccf0357e4fe495dd05377848
|
[
"MIT"
] | null | null | null |
slack/python/mongo/config.py
|
m4573rn3rd/scripts
|
df29a79b5ed6a996ccf0357e4fe495dd05377848
|
[
"MIT"
] | null | null | null |
slack/python/mongo/config.py
|
m4573rn3rd/scripts
|
df29a79b5ed6a996ccf0357e4fe495dd05377848
|
[
"MIT"
] | null | null | null |
import pymongo
import pandas as pd
from pymongo import MongoClient
from datetime import datetime
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
| 22.714286
| 60
| 0.81761
| 20
| 159
| 6.5
| 0.6
| 0.2
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.035461
| 0.113208
| 159
| 6
| 61
| 26.5
| 0.886525
| 0
| 0
| 0
| 0
| 0
| 0.163522
| 0.163522
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.8
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
523509b77492645ad2ced51dab575976e2c72385
| 53
|
py
|
Python
|
src/sandbox/fred.py
|
knead/code
|
8826233da319cab90dac1338a481ef4ec1476770
|
[
"BSD-2-Clause"
] | null | null | null |
src/sandbox/fred.py
|
knead/code
|
8826233da319cab90dac1338a481ef4ec1476770
|
[
"BSD-2-Clause"
] | null | null | null |
src/sandbox/fred.py
|
knead/code
|
8826233da319cab90dac1338a481ef4ec1476770
|
[
"BSD-2-Clause"
] | null | null | null |
def lp(x: float) -> float:
y=f(x)
return y+(1-y)
| 13.25
| 26
| 0.528302
| 12
| 53
| 2.333333
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02439
| 0.226415
| 53
| 3
| 27
| 17.666667
| 0.658537
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
524735b478f9c88462cfc72c86a3b47f271db39a
| 310
|
py
|
Python
|
py_moysklad/entities/price.py
|
upmarket-cc/py_moysklad
|
e026e611344c38f8a8d4f428781fcfb315aaaa60
|
[
"MIT"
] | null | null | null |
py_moysklad/entities/price.py
|
upmarket-cc/py_moysklad
|
e026e611344c38f8a8d4f428781fcfb315aaaa60
|
[
"MIT"
] | null | null | null |
py_moysklad/entities/price.py
|
upmarket-cc/py_moysklad
|
e026e611344c38f8a8d4f428781fcfb315aaaa60
|
[
"MIT"
] | null | null | null |
from decimal import Decimal
from typing import Optional
from py_moysklad.entities.currency import Currency
from py_moysklad.entities.entity import Entity
from py_moysklad.entities.price_type import PriceType
class Price(Entity):
price_type: Optional[PriceType]
currency: Currency
value: Decimal
| 23.846154
| 53
| 0.816129
| 41
| 310
| 6.04878
| 0.365854
| 0.072581
| 0.169355
| 0.266129
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.13871
| 310
| 12
| 54
| 25.833333
| 0.928839
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.555556
| 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
|
5273834c10d61e52b27a9693bf5c8003b9cdf77c
| 215
|
py
|
Python
|
frontend/urls.py
|
jphacks/E_2010
|
b2dcddf7910f539c274069f26bf7220b762204f9
|
[
"MIT"
] | null | null | null |
frontend/urls.py
|
jphacks/E_2010
|
b2dcddf7910f539c274069f26bf7220b762204f9
|
[
"MIT"
] | 1
|
2020-11-07T05:42:33.000Z
|
2020-11-07T05:42:33.000Z
|
frontend/urls.py
|
jphacks/E_2010
|
b2dcddf7910f539c274069f26bf7220b762204f9
|
[
"MIT"
] | null | null | null |
from django.conf.urls.static import static
from django.urls import path
from django.urls.conf import re_path
from . import views
from django.conf import settings
urlpatterns = [
re_path('^.*$', views.index),
]
| 21.5
| 42
| 0.753488
| 32
| 215
| 5
| 0.375
| 0.25
| 0.175
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.144186
| 215
| 9
| 43
| 23.888889
| 0.869565
| 0
| 0
| 0
| 0
| 0
| 0.018605
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.625
| 0
| 0.625
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
527a9a25357fb0b0bda2f16fdfcd1bb044cfaa18
| 120
|
py
|
Python
|
src_py/hat/gui/__main__.py
|
hat-open/hat-gui
|
5937dbcd443c4f7bba87f9b0d268fe1d057b0164
|
[
"Apache-2.0"
] | 1
|
2022-02-01T13:43:11.000Z
|
2022-02-01T13:43:11.000Z
|
src_py/hat/gui/__main__.py
|
hat-open/hat-gui
|
5937dbcd443c4f7bba87f9b0d268fe1d057b0164
|
[
"Apache-2.0"
] | null | null | null |
src_py/hat/gui/__main__.py
|
hat-open/hat-gui
|
5937dbcd443c4f7bba87f9b0d268fe1d057b0164
|
[
"Apache-2.0"
] | null | null | null |
import sys
from hat.gui.main import main
if __name__ == '__main__':
sys.argv[0] = 'hat-gui'
sys.exit(main())
| 13.333333
| 29
| 0.633333
| 19
| 120
| 3.578947
| 0.578947
| 0.176471
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010526
| 0.208333
| 120
| 8
| 30
| 15
| 0.705263
| 0
| 0
| 0
| 0
| 0
| 0.125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
bfe9653809f570b12fe7c927f8f0056fb265406e
| 252
|
py
|
Python
|
tests/test_utilities/conftest.py
|
coinator/hp-VPINNs
|
04565217e2fdc84c48a6d36c3bd160b17af89c07
|
[
"MIT"
] | null | null | null |
tests/test_utilities/conftest.py
|
coinator/hp-VPINNs
|
04565217e2fdc84c48a6d36c3bd160b17af89c07
|
[
"MIT"
] | null | null | null |
tests/test_utilities/conftest.py
|
coinator/hp-VPINNs
|
04565217e2fdc84c48a6d36c3bd160b17af89c07
|
[
"MIT"
] | null | null | null |
import pytest
from hp_VPINN.utilities import np as numpy
from hp_VPINN.utilities import tf as tensorflow
tensorflow.set_random_seed(0)
numpy.random.seed(0)
@pytest.fixture
def tf():
return tensorflow
@pytest.fixture
def np():
return numpy
| 15.75
| 47
| 0.769841
| 39
| 252
| 4.871795
| 0.461538
| 0.063158
| 0.115789
| 0.210526
| 0.273684
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00939
| 0.154762
| 252
| 15
| 48
| 16.8
| 0.882629
| 0
| 0
| 0.181818
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.181818
| true
| 0
| 0.272727
| 0.181818
| 0.636364
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
bffc444a1de315349bffe78d7e610bdf0ef24582
| 278
|
py
|
Python
|
tests/bi_encoders/qa/tfhub/test_lareqa_qa.py
|
boba-and-beer/vectorhub
|
fc536a59c77755f4051af37338839e24e0add5c4
|
[
"Apache-2.0"
] | 385
|
2020-10-26T13:12:11.000Z
|
2021-10-07T15:14:48.000Z
|
tests/bi_encoders/qa/tfhub/test_lareqa_qa.py
|
boba-and-beer/vectorhub
|
fc536a59c77755f4051af37338839e24e0add5c4
|
[
"Apache-2.0"
] | 24
|
2020-10-29T13:16:31.000Z
|
2021-08-31T06:47:33.000Z
|
tests/bi_encoders/qa/tfhub/test_lareqa_qa.py
|
boba-and-beer/vectorhub
|
fc536a59c77755f4051af37338839e24e0add5c4
|
[
"Apache-2.0"
] | 45
|
2020-10-29T15:25:19.000Z
|
2021-09-05T21:50:57.000Z
|
from vectorhub.bi_encoders.qa.tfhub import LAReQA2Vec
from ....test_utils import assert_encoder_works
def test_lare_qa_works():
"""
Testing for LAReQA works
"""
encoder = LAReQA2Vec()
assert_encoder_works(encoder, data_type='text', model_type='bi_encoder')
| 27.8
| 76
| 0.741007
| 37
| 278
| 5.243243
| 0.594595
| 0.134021
| 0.185567
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008511
| 0.154676
| 278
| 9
| 77
| 30.888889
| 0.817021
| 0.086331
| 0
| 0
| 0
| 0
| 0.058824
| 0
| 0
| 0
| 0
| 0
| 0.4
| 1
| 0.2
| false
| 0
| 0.4
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
873dc2e4e399b596c4b670fef5ae4e6b4fd22401
| 238
|
py
|
Python
|
toggl_dinero/__init__.py
|
esben/toggl-dinero
|
f836d45cda04e2993844463a9669408700fd3f29
|
[
"MIT"
] | 1
|
2021-07-01T08:19:00.000Z
|
2021-07-01T08:19:00.000Z
|
toggl_dinero/__init__.py
|
esben/toggl-dinero
|
f836d45cda04e2993844463a9669408700fd3f29
|
[
"MIT"
] | null | null | null |
toggl_dinero/__init__.py
|
esben/toggl-dinero
|
f836d45cda04e2993844463a9669408700fd3f29
|
[
"MIT"
] | 1
|
2020-08-18T14:07:41.000Z
|
2020-08-18T14:07:41.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dinero invoicing from Toggl time entries.
.. currentmodule:: toggl_dinero
.. moduleauthor:: Esben Haabendal <esben@geanix.com>
"""
from .version import __version__, __release__ # noqa
| 19.833333
| 53
| 0.705882
| 28
| 238
| 5.678571
| 0.821429
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004902
| 0.142857
| 238
| 11
| 54
| 21.636364
| 0.77451
| 0.735294
| 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
| 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
|
8746c62d72a0975395bec35eefb18741a57bcb6f
| 4,394
|
py
|
Python
|
client.py
|
MingzheHu-Duke/Heart-Rate-Sentinel-Server
|
3f6a7cad7cd50c67221e168fae1fee1183de9d66
|
[
"MIT"
] | null | null | null |
client.py
|
MingzheHu-Duke/Heart-Rate-Sentinel-Server
|
3f6a7cad7cd50c67221e168fae1fee1183de9d66
|
[
"MIT"
] | null | null | null |
client.py
|
MingzheHu-Duke/Heart-Rate-Sentinel-Server
|
3f6a7cad7cd50c67221e168fae1fee1183de9d66
|
[
"MIT"
] | null | null | null |
import requests
from server import init_db
print("\n")
print("Add an attending with his phone number is not string")
# should be 400
new_attending = {"attending_username": "Everett",
"attending_email": "Every@outlook.com",
"attending_phone": 9191111110}
r = requests.post("http://127.0.0.1:5000/api/new_attending",
json=new_attending)
print(r.status_code)
print(r.text)
print("\n")
print("Add an attending with his phone number is correct string")
# should be 400
new_attending = {"attending_username": "Everett",
"attending_email": "Every@outlook.com",
"attending_phone": "919-1111-110"}
r = requests.post("http://127.0.0.1:5000/api/new_attending",
json=new_attending)
print(r.status_code)
print(r.text)
print("\n")
print("Add new patient 101 with str age")
# Should be 200
new_patient = {"patient_id": 101, "attending_username": "Everett",
"patient_age": "18"}
r = requests.post("http://127.0.0.1:5000/api/new_patient", json=new_patient)
print(r.status_code)
print(r.text)
print("\n")
print("Add an good attending with correct info type")
# should be 200
new_attending = {"attending_username": "Trump",
"attending_email": "DTrump@whitehouse.com",
"attending_phone": "100000000"}
r = requests.post("http://127.0.0.1:5000/api/new_attending",
json=new_attending)
print(r.status_code)
print(r.text)
print("\n")
print("Add an existed attending though correct info type")
# should be 400
new_attending = {"attending_username": "Trump",
"attending_email": "whatever",
"attending_phone": "whatever"}
r = requests.post("http://127.0.0.1:5000/api/new_attending",
json=new_attending)
print(r.status_code)
print(r.text)
print("\n")
print("Get the heart rate info from ID:10 which doesn't exist")
# should be 400
id = "10"
r = requests.get("http://127.0.0.1:5000/api/status/" + id)
print(r.status_code)
print(r.text)
print("\n")
print("Get patient 120 's latest heart rate info")
# status code should be 200
id = "120"
r = requests.get("http://127.0.0.1:5000/api/status/" + id)
print(r.status_code)
print(r.text)
print("\n")
print("Get patient 500's latest heart rate info, which is empty")
# should be 400
id = "500"
r = requests.get("http://127.0.0.1:5000/api/status/" + id)
print(r.status_code)
print(r.text)
print("\n")
print("Get patient 120 's average heart rate (101+104)/2")
# should be 200
id = "120"
r = requests.get("http://127.0.0.1:5000/api/heart_rate/average/" + id)
print(r.status_code)
print(r.text)
print("\n")
#
#
print("Get a non-existing attending Flora's all patient info list")
# should be 400
attending_username = "Flora"
r = requests.get("http://127.0.0.1:5000/api/patients/" + attending_username)
print(r.status_code)
print(r.text)
print("\n")
#
#
print("Get a invalid attending name Flora666's all patient info list")
# should be 400
attending_username = 'Flora666'
r = requests.get("http://127.0.0.1:5000/api/patients/" + attending_username)
print(r.status_code)
print(r.text)
print("\n")
#
#
print("Get attending Tom's all patient info list")
# should be 200
attending_username = "Tom"
r = requests.get("http://127.0.0.1:5000/api/patients/" + attending_username)
print(r.status_code)
print(r.text)
print("\n")
print("Post heart rate to a patient 101, tachycardic")
# Should be 200
new_patient = {"patient_id": 101, "heart_rate": 101}
r = requests.post("http://127.0.0.1:5000/api/heart_rate", json=new_patient)
print(r.status_code)
print(r.text)
print("\n")
print("Post heart rate to a patient 101, not tachycardic")
# Should be 200
new_patient = {"patient_id": 101, "heart_rate": 99}
r = requests.post("http://127.0.0.1:5000/api/heart_rate", json=new_patient)
print(r.status_code)
print(r.text)
print("\n")
print("Get patient 101's heart rate history list")
# should be 200
patient_id = "101"
r = requests.get("http://127.0.0.1:5000/api/heart_rate/" + patient_id)
print(r.status_code)
print(r.text)
print("\n")
print("Find an average heart rate")
# Should be 200
patient_timesince = {"patient_id": 101,
"heart_rate_average_since": "2020-10-22 15:16:42"}
r = requests.post("http://127.0.0.1:5000/api/heart_rate/interval_average",
json=patient_timesince)
print(r.status_code)
print(r.text)
| 26.957055
| 76
| 0.676604
| 700
| 4,394
| 4.14
| 0.147143
| 0.066253
| 0.060732
| 0.049689
| 0.777433
| 0.743616
| 0.743616
| 0.688406
| 0.677019
| 0.677019
| 0
| 0.086721
| 0.160218
| 4,394
| 162
| 77
| 27.123457
| 0.698645
| 0.053482
| 0
| 0.637168
| 0
| 0
| 0.451886
| 0.01088
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.017699
| 0
| 0.017699
| 0.566372
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
5e4918f123f9a9e05fad31d3960697de89c57a82
| 185
|
py
|
Python
|
src/charma/common/__init__.py
|
mononobi/charma-server
|
ed90f5ec0b5ff3996232d5fe49a4f77f96d82ced
|
[
"BSD-3-Clause"
] | 1
|
2020-01-16T23:36:10.000Z
|
2020-01-16T23:36:10.000Z
|
src/charma/common/__init__.py
|
mononobi/imovie-server
|
ed90f5ec0b5ff3996232d5fe49a4f77f96d82ced
|
[
"BSD-3-Clause"
] | 24
|
2020-06-08T18:27:04.000Z
|
2021-06-06T12:01:39.000Z
|
src/charma/common/__init__.py
|
mononobi/charma-server
|
ed90f5ec0b5ff3996232d5fe49a4f77f96d82ced
|
[
"BSD-3-Clause"
] | 1
|
2020-12-20T05:29:04.000Z
|
2020-12-20T05:29:04.000Z
|
# -*- coding: utf-8 -*-
"""
common package.
"""
from pyrin.packaging.base import Package
class CommonPackage(Package):
"""
common package class.
"""
NAME = __name__
| 12.333333
| 40
| 0.610811
| 19
| 185
| 5.736842
| 0.684211
| 0.238532
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007042
| 0.232432
| 185
| 14
| 41
| 13.214286
| 0.760563
| 0.324324
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
5e74394e58c61d14394be61a0d7cbed418dbba1e
| 81
|
py
|
Python
|
src/plntter/opnav/sun/sun.py
|
acgardner/plntter
|
d8d5b8e1fb2d7c1c4e21ec9e66cbb3c7419a7825
|
[
"MIT"
] | null | null | null |
src/plntter/opnav/sun/sun.py
|
acgardner/plntter
|
d8d5b8e1fb2d7c1c4e21ec9e66cbb3c7419a7825
|
[
"MIT"
] | null | null | null |
src/plntter/opnav/sun/sun.py
|
acgardner/plntter
|
d8d5b8e1fb2d7c1c4e21ec9e66cbb3c7419a7825
|
[
"MIT"
] | null | null | null |
"""
Placeholder file for sun image processing algorithms
"""
import numpy as np
| 13.5
| 52
| 0.753086
| 11
| 81
| 5.545455
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.17284
| 81
| 5
| 53
| 16.2
| 0.910448
| 0.641975
| 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
|
5e8a7c90e55b99a8d9c753684e325e79d6523049
| 196
|
py
|
Python
|
hello.py
|
Eieiphyu/flask-with-jinja
|
36da7b46599cae0f3516369d6c046cff3c2ae970
|
[
"MIT"
] | null | null | null |
hello.py
|
Eieiphyu/flask-with-jinja
|
36da7b46599cae0f3516369d6c046cff3c2ae970
|
[
"MIT"
] | null | null | null |
hello.py
|
Eieiphyu/flask-with-jinja
|
36da7b46599cae0f3516369d6c046cff3c2ae970
|
[
"MIT"
] | null | null | null |
from flask import Flask,render_template,url_for
myapp=Flask(__name__)
@myapp.route("/")
def hello():
return render_template("index1.html")
if __name__=="__main__":
myapp.run(debug=True)
| 21.777778
| 48
| 0.734694
| 27
| 196
| 4.777778
| 0.740741
| 0.217054
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00578
| 0.117347
| 196
| 8
| 49
| 24.5
| 0.739884
| 0
| 0
| 0
| 0
| 0
| 0.102564
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.142857
| 0.142857
| 0.428571
| 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
| 1
| 0
| 0
|
0
| 4
|
5eaa57261888e4f1b1e3bd7eea9b88f6bb5870b8
| 135
|
py
|
Python
|
src/signalflow_algorithms/common/json_dict.py
|
naaeef/signalflowgrapher
|
0ac3b4a8f11830e5cd7665264ab4e723b5ddaad9
|
[
"Artistic-2.0"
] | 17
|
2020-09-15T11:25:32.000Z
|
2022-02-02T18:20:45.000Z
|
src/signalflow_algorithms/common/json_dict.py
|
hzhikai97/signalflowgrapher
|
928a1c072d22bc606d03197ca3c326dd8e0ae89e
|
[
"Artistic-2.0"
] | 29
|
2020-09-16T16:23:28.000Z
|
2021-05-08T17:29:34.000Z
|
src/signalflow_algorithms/common/json_dict.py
|
hzhikai97/signalflowgrapher
|
928a1c072d22bc606d03197ca3c326dd8e0ae89e
|
[
"Artistic-2.0"
] | 6
|
2020-09-21T06:32:19.000Z
|
2022-03-05T17:33:14.000Z
|
from typing import Dict
import abc
class JSONDict(abc.ABC):
@abc.abstractmethod
def to_dict(self) -> Dict:
return {}
| 15
| 30
| 0.659259
| 18
| 135
| 4.888889
| 0.666667
| 0.136364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.244444
| 135
| 8
| 31
| 16.875
| 0.862745
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0.333333
| 0.166667
| 0.833333
| 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
| 1
| 0
| 0
|
0
| 4
|
5eb236110e3b237b34883b18e8c1c713db5cbea6
| 339
|
py
|
Python
|
000000stepikProgBasKirFed/Stepik000000ProgBasKirFedсh01p01st05TASK05_20210205_print.py
|
SafonovMikhail/python_000577
|
739f764e80f1ca354386f00b8e9db1df8c96531d
|
[
"Apache-2.0"
] | null | null | null |
000000stepikProgBasKirFed/Stepik000000ProgBasKirFedсh01p01st05TASK05_20210205_print.py
|
SafonovMikhail/python_000577
|
739f764e80f1ca354386f00b8e9db1df8c96531d
|
[
"Apache-2.0"
] | null | null | null |
000000stepikProgBasKirFed/Stepik000000ProgBasKirFedсh01p01st05TASK05_20210205_print.py
|
SafonovMikhail/python_000577
|
739f764e80f1ca354386f00b8e9db1df8c96531d
|
[
"Apache-2.0"
] | null | null | null |
'''
Напишите программу, которая объявляет переменную "s" и присваивает ей значение
"Мы изучаем язык программирования Python".
После инициализации переменной программа должна напечатать значение этой переменной.
Sample Input:
Sample Output:
Мы изучаем язык программирования Python
'''
s = 'Мы изучаем язык программирования Python'
print(s)
| 30.818182
| 84
| 0.814159
| 41
| 339
| 6.731707
| 0.634146
| 0.097826
| 0.141304
| 0.315217
| 0.380435
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.126844
| 339
| 10
| 85
| 33.9
| 0.932432
| 0.811209
| 0
| 0
| 0
| 0
| 0.696429
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
5eb4f05efcf96285aaa8c5f0ace832258f9118c8
| 217
|
py
|
Python
|
src/ashley/machina_extensions/forum_conversation/__init__.py
|
openfun/ashley
|
33af6a46bc22c86417c200fdd84876c2c46b02ce
|
[
"MIT"
] | 6
|
2020-05-05T11:50:29.000Z
|
2021-09-19T06:01:39.000Z
|
src/ashley/machina_extensions/forum_conversation/__init__.py
|
openfun/ashley
|
33af6a46bc22c86417c200fdd84876c2c46b02ce
|
[
"MIT"
] | 93
|
2020-02-17T16:28:57.000Z
|
2022-03-18T14:06:45.000Z
|
src/ashley/machina_extensions/forum_conversation/__init__.py
|
openfun/ashley
|
33af6a46bc22c86417c200fdd84876c2c46b02ce
|
[
"MIT"
] | 1
|
2020-03-02T04:36:12.000Z
|
2020-03-02T04:36:12.000Z
|
"""This application overrides to django-machina's forum_conversation app."""
# pylint: disable=invalid-name
default_app_config = (
"ashley.machina_extensions.forum_conversation.apps.ForumConversationAppConfig"
)
| 31
| 82
| 0.806452
| 24
| 217
| 7.083333
| 0.833333
| 0.2
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092166
| 217
| 6
| 83
| 36.166667
| 0.862944
| 0.460829
| 0
| 0
| 0
| 0
| 0.684685
| 0.684685
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0d70ed3c458caf069ce800d443b7953d7e59582b
| 95
|
py
|
Python
|
playsounds/apps.py
|
jedrzej2j/nemo
|
85b8274a922359aa781cf3b297b854c01c83be5b
|
[
"MIT"
] | null | null | null |
playsounds/apps.py
|
jedrzej2j/nemo
|
85b8274a922359aa781cf3b297b854c01c83be5b
|
[
"MIT"
] | null | null | null |
playsounds/apps.py
|
jedrzej2j/nemo
|
85b8274a922359aa781cf3b297b854c01c83be5b
|
[
"MIT"
] | null | null | null |
from django.apps import AppConfig
class PlaysoundsConfig(AppConfig):
name = 'playsounds'
| 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
|
0d8fed3e4d0b2c11c98bf409cf4d466a83969786
| 1,851
|
py
|
Python
|
stix2generator/test/test_object_generator_number.py
|
majacQ/cti-stix-generator
|
7465ecd29ef6caabf9f1b60ad45dad789c475028
|
[
"BSD-3-Clause"
] | 20
|
2020-12-10T18:16:28.000Z
|
2022-02-20T19:30:53.000Z
|
stix2generator/test/test_object_generator_number.py
|
majacQ/cti-stix-generator
|
7465ecd29ef6caabf9f1b60ad45dad789c475028
|
[
"BSD-3-Clause"
] | 26
|
2021-01-13T23:32:19.000Z
|
2022-03-29T06:47:02.000Z
|
stix2generator/test/test_object_generator_number.py
|
majacQ/cti-stix-generator
|
7465ecd29ef6caabf9f1b60ad45dad789c475028
|
[
"BSD-3-Clause"
] | 8
|
2020-12-14T23:10:16.000Z
|
2021-12-06T13:07:24.000Z
|
import pytest
import stix2generator.exceptions
def test_number_closed(object_generator, num_trials):
for _ in range(num_trials):
value = object_generator.generate_from_spec({
"type": "number",
"minimum": 0,
"maximum": 1
})
assert 0 <= value <= 1
assert isinstance(value, float)
def test_number_open(object_generator, num_trials):
for _ in range(num_trials):
value = object_generator.generate_from_spec({
"type": "number",
"exclusiveMinimum": 0,
"exclusiveMaximum": 1
})
assert 0 < value < 1
def test_number_half_open_lower(object_generator, num_trials):
for _ in range(num_trials):
value = object_generator.generate_from_spec({
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1
})
assert 0 < value <= 1
def test_number_half_open_upper(object_generator, num_trials):
for _ in range(num_trials):
value = object_generator.generate_from_spec({
"type": "number",
"minimum": 0,
"exclusiveMaximum": 1
})
assert 0 <= value < 1
def test_number_very_large(object_generator):
with pytest.raises(stix2generator.exceptions.ObjectGenerationError):
# floats have a different, smaller range than ints. This upper bound
# is outside the range of floats.
object_generator.generate_from_spec({
"type": "number",
"minimum": 0,
"maximum": 10**10000
})
def test_number_inverted_bounds(object_generator):
with pytest.raises(stix2generator.exceptions.ObjectGenerationError):
object_generator.generate_from_spec({
"type": "number",
"minimum": 1,
"maximum": 0
})
| 26.826087
| 77
| 0.603998
| 195
| 1,851
| 5.45641
| 0.282051
| 0.169173
| 0.073308
| 0.152256
| 0.769737
| 0.769737
| 0.769737
| 0.75
| 0.56203
| 0.56203
| 0
| 0.022325
| 0.298217
| 1,851
| 68
| 78
| 27.220588
| 0.796767
| 0.053485
| 0
| 0.673469
| 1
| 0
| 0.102916
| 0
| 0
| 0
| 0
| 0
| 0.102041
| 1
| 0.122449
| false
| 0
| 0.040816
| 0
| 0.163265
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0d995c80fc83c53f61c0891b3a9a3fe2f23eb5eb
| 387
|
py
|
Python
|
Task1F.py
|
StanleyHou117/group66_LentTermProject
|
0255310cb202f21cada8cf7c0f45a045a9b72c1f
|
[
"MIT"
] | null | null | null |
Task1F.py
|
StanleyHou117/group66_LentTermProject
|
0255310cb202f21cada8cf7c0f45a045a9b72c1f
|
[
"MIT"
] | null | null | null |
Task1F.py
|
StanleyHou117/group66_LentTermProject
|
0255310cb202f21cada8cf7c0f45a045a9b72c1f
|
[
"MIT"
] | null | null | null |
from floodsystem.station import inconsistent_typical_range_stations
from floodsystem.stationdata import build_station_list
def run():
print(sorted(inconsistent_typical_range_stations(build_station_list())))
print(len(inconsistent_typical_range_stations(build_station_list())))
if __name__ == "__main__":
print("*** Task 1F: CUED Part IA Flood Warning System ***")
run()
| 38.7
| 76
| 0.78553
| 48
| 387
| 5.854167
| 0.5625
| 0.202847
| 0.256228
| 0.341637
| 0.341637
| 0.341637
| 0.341637
| 0
| 0
| 0
| 0
| 0.002915
| 0.113695
| 387
| 10
| 77
| 38.7
| 0.816327
| 0
| 0
| 0
| 0
| 0
| 0.149485
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| true
| 0
| 0.25
| 0
| 0.375
| 0.375
| 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
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0da38a2c31acd6e55f600d018ec0f0215babf42e
| 153
|
py
|
Python
|
arbitrage/public_markets/bitfinexusd.py
|
fiona-pet/bitcoin-arbitrage
|
a955b5930997b2ad46d2bbfb29db4dcad5e6c3e7
|
[
"MIT"
] | 1,633
|
2015-01-05T00:47:41.000Z
|
2022-03-27T04:05:03.000Z
|
arbitrage/public_markets/bitfinexusd.py
|
fiona-pet/bitcoin-arbitrage
|
a955b5930997b2ad46d2bbfb29db4dcad5e6c3e7
|
[
"MIT"
] | 22
|
2015-02-16T09:31:32.000Z
|
2020-10-14T20:14:26.000Z
|
arbitrage/public_markets/bitfinexusd.py
|
fiona-pet/bitcoin-arbitrage
|
a955b5930997b2ad46d2bbfb29db4dcad5e6c3e7
|
[
"MIT"
] | 531
|
2015-01-02T10:13:01.000Z
|
2022-03-26T16:06:19.000Z
|
from arbitrage.public_markets._bitfinex import Bitfinex
class BitfinexUSD(Bitfinex):
def __init__(self):
super().__init__("USD", "btcusd")
| 21.857143
| 55
| 0.72549
| 17
| 153
| 5.941176
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.156863
| 153
| 6
| 56
| 25.5
| 0.782946
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
0db2343a3b060f6419e5784c92b29e86549d8e60
| 171
|
py
|
Python
|
aladin/bin/django-admin.py
|
ApsRajput/oscar-extend
|
8828d66b78ae139a73d5ca707c0fe0710eac890a
|
[
"BSD-3-Clause"
] | null | null | null |
aladin/bin/django-admin.py
|
ApsRajput/oscar-extend
|
8828d66b78ae139a73d5ca707c0fe0710eac890a
|
[
"BSD-3-Clause"
] | null | null | null |
aladin/bin/django-admin.py
|
ApsRajput/oscar-extend
|
8828d66b78ae139a73d5ca707c0fe0710eac890a
|
[
"BSD-3-Clause"
] | null | null | null |
#!/home/ankit/Desktop/oscar-test/django-oscar/aladin/bin/python3
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 28.5
| 64
| 0.789474
| 23
| 171
| 5.391304
| 0.826087
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00641
| 0.087719
| 171
| 5
| 65
| 34.2
| 0.788462
| 0.368421
| 0
| 0
| 0
| 0
| 0.074766
| 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
|
0dc6d219e74b94d2f27520d71ba21dd192c125b4
| 184
|
py
|
Python
|
python-L2/one.py
|
MajhiRockzZ/py-dj-fswdbc
|
aa14da5febeb0280994e00936428bca67e800214
|
[
"MIT"
] | null | null | null |
python-L2/one.py
|
MajhiRockzZ/py-dj-fswdbc
|
aa14da5febeb0280994e00936428bca67e800214
|
[
"MIT"
] | null | null | null |
python-L2/one.py
|
MajhiRockzZ/py-dj-fswdbc
|
aa14da5febeb0280994e00936428bca67e800214
|
[
"MIT"
] | null | null | null |
def func():
print("func() in one.py")
print("TOP LEVEL ONE.PY")
if __name__ == "__main__":
print("one.py is being run directly")
else:
print("one.py has been imported")
| 16.727273
| 41
| 0.630435
| 29
| 184
| 3.724138
| 0.655172
| 0.185185
| 0.185185
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.201087
| 184
| 10
| 42
| 18.4
| 0.734694
| 0
| 0
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| true
| 0
| 0.142857
| 0
| 0.285714
| 0.571429
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
0dc6f7d7c442d5c0d6a44309e34b98f01e75d80e
| 5,867
|
py
|
Python
|
cmdb_extend_sdk/api/agent/agent_client.py
|
easyopsapis/easyops-api-python
|
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
|
[
"Apache-2.0"
] | 5
|
2019-07-31T04:11:05.000Z
|
2021-01-07T03:23:20.000Z
|
cmdb_extend_sdk/api/agent/agent_client.py
|
easyopsapis/easyops-api-python
|
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
|
[
"Apache-2.0"
] | null | null | null |
cmdb_extend_sdk/api/agent/agent_client.py
|
easyopsapis/easyops-api-python
|
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
import os
import sys
import cmdb_extend_sdk.api.agent.agent_install_pb2
import cmdb_extend_sdk.api.agent.agent_install_progress_pb2
import google.protobuf.empty_pb2
import cmdb_extend_sdk.api.agent.get_install_key_pb2
import cmdb_extend_sdk.utils.http_util
import google.protobuf.json_format
class AgentClient(object):
def __init__(self, server_ip="", server_port=0, service_name="", host=""):
"""
初始化client
:param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由
:param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由
:param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高
:param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com
"""
if server_ip == "" and server_port != 0 or server_ip != "" and server_port == 0:
raise Exception("server_ip和server_port必须同时指定")
self._server_ip = server_ip
self._server_port = server_port
self._service_name = service_name
self._host = host
def agent_install(self, request, org, user, timeout=10):
# type: (cmdb_extend_sdk.api.agent.agent_install_pb2.AgentInstallRequest, int, str, int) -> cmdb_extend_sdk.api.agent.agent_install_pb2.AgentInstallResponse
"""
安装agent
:param request: agent_install请求
:param org: 客户的org编号,为数字
:param user: 调用api使用的用户名
:param timeout: 调用超时时间,单位秒
:return: cmdb_extend_sdk.api.agent.agent_install_pb2.AgentInstallResponse
"""
headers = {"org": org, "user": user}
route_name = ""
server_ip = self._server_ip
if self._service_name != "":
route_name = self._service_name
elif self._server_ip != "":
route_name = "easyops.api.cmdb_extend.agent.AgentInstall"
uri = "/agent/install"
requestParam = request
rsp_obj = cmdb_extend_sdk.utils.http_util.do_api_request(
method="POST",
src_name="logic.cmdb_extend_sdk",
dst_name=route_name,
server_ip=server_ip,
server_port=self._server_port,
host=self._host,
uri=uri,
params=google.protobuf.json_format.MessageToDict(
requestParam, preserving_proto_field_name=True),
headers=headers,
timeout=timeout,
)
rsp = cmdb_extend_sdk.api.agent.agent_install_pb2.AgentInstallResponse()
google.protobuf.json_format.ParseDict(rsp_obj, rsp, ignore_unknown_fields=True)
return rsp
def agent_install_progress(self, request, org, user, timeout=10):
# type: (cmdb_extend_sdk.api.agent.agent_install_progress_pb2.AgentInstallProgressRequest, int, str, int) -> cmdb_extend_sdk.api.agent.agent_install_progress_pb2.AgentInstallProgressResponse
"""
获取agent安装进度
:param request: agent_install_progress请求
:param org: 客户的org编号,为数字
:param user: 调用api使用的用户名
:param timeout: 调用超时时间,单位秒
:return: cmdb_extend_sdk.api.agent.agent_install_progress_pb2.AgentInstallProgressResponse
"""
headers = {"org": org, "user": user}
route_name = ""
server_ip = self._server_ip
if self._service_name != "":
route_name = self._service_name
elif self._server_ip != "":
route_name = "easyops.api.cmdb_extend.agent.AgentInstallProgress"
uri = "/agent/install/progress"
requestParam = request
rsp_obj = cmdb_extend_sdk.utils.http_util.do_api_request(
method="POST",
src_name="logic.cmdb_extend_sdk",
dst_name=route_name,
server_ip=server_ip,
server_port=self._server_port,
host=self._host,
uri=uri,
params=google.protobuf.json_format.MessageToDict(
requestParam, preserving_proto_field_name=True),
headers=headers,
timeout=timeout,
)
rsp = cmdb_extend_sdk.api.agent.agent_install_progress_pb2.AgentInstallProgressResponse()
google.protobuf.json_format.ParseDict(rsp_obj["data"], rsp, ignore_unknown_fields=True)
return rsp
def get_install_key(self, request, org, user, timeout=10):
# type: (google.protobuf.empty_pb2.Empty, int, str, int) -> cmdb_extend_sdk.api.agent.get_install_key_pb2.GetInstallKeyResponse
"""
获取agent安装密钥
:param request: get_install_key请求
:param org: 客户的org编号,为数字
:param user: 调用api使用的用户名
:param timeout: 调用超时时间,单位秒
:return: cmdb_extend_sdk.api.agent.get_install_key_pb2.GetInstallKeyResponse
"""
headers = {"org": org, "user": user}
route_name = ""
server_ip = self._server_ip
if self._service_name != "":
route_name = self._service_name
elif self._server_ip != "":
route_name = "easyops.api.cmdb_extend.agent.GetInstallKey"
uri = "/agent/install_key"
requestParam = request
rsp_obj = cmdb_extend_sdk.utils.http_util.do_api_request(
method="GET",
src_name="logic.cmdb_extend_sdk",
dst_name=route_name,
server_ip=server_ip,
server_port=self._server_port,
host=self._host,
uri=uri,
params=google.protobuf.json_format.MessageToDict(
requestParam, preserving_proto_field_name=True),
headers=headers,
timeout=timeout,
)
rsp = cmdb_extend_sdk.api.agent.get_install_key_pb2.GetInstallKeyResponse()
google.protobuf.json_format.ParseDict(rsp_obj, rsp, ignore_unknown_fields=True)
return rsp
| 37.851613
| 198
| 0.64002
| 663
| 5,867
| 5.31825
| 0.170437
| 0.068066
| 0.077425
| 0.063528
| 0.75865
| 0.756948
| 0.737096
| 0.714691
| 0.686047
| 0.640386
| 0
| 0.006069
| 0.269814
| 5,867
| 154
| 199
| 38.097403
| 0.816993
| 0.235214
| 0
| 0.648936
| 0
| 0
| 0.074546
| 0.058504
| 0
| 0
| 0
| 0
| 0
| 1
| 0.042553
| false
| 0
| 0.085106
| 0
| 0.170213
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0dd8cbc2411cb46ee5f68fc09b674f31a8a880b4
| 81
|
py
|
Python
|
jklib/db/__init__.py
|
Jordan-Kowal/jklib
|
84dc8ad64b9216926ba9af0ec11f1dbd5d8a53f4
|
[
"MIT"
] | 1
|
2020-02-28T21:53:51.000Z
|
2020-02-28T21:53:51.000Z
|
jklib/db/__init__.py
|
Jordan-Kowal/jklib
|
84dc8ad64b9216926ba9af0ec11f1dbd5d8a53f4
|
[
"MIT"
] | null | null | null |
jklib/db/__init__.py
|
Jordan-Kowal/jklib
|
84dc8ad64b9216926ba9af0ec11f1dbd5d8a53f4
|
[
"MIT"
] | null | null | null |
"""Package with utility functions for handling databases and storage packages"""
| 40.5
| 80
| 0.802469
| 10
| 81
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.123457
| 81
| 1
| 81
| 81
| 0.915493
| 0.91358
| 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
|
0de645b0ea458e896f43a9a51de2bcc5f5ce2f47
| 218
|
py
|
Python
|
example/notes/views.py
|
xunil154/ExampleREST
|
8c536d6368101857181e5eb6e6af893f4cc0e005
|
[
"MIT"
] | null | null | null |
example/notes/views.py
|
xunil154/ExampleREST
|
8c536d6368101857181e5eb6e6af893f4cc0e005
|
[
"MIT"
] | null | null | null |
example/notes/views.py
|
xunil154/ExampleREST
|
8c536d6368101857181e5eb6e6af893f4cc0e005
|
[
"MIT"
] | null | null | null |
from rest_framework import viewsets
from .models import Note
from .serializers import NoteSerializer
class NotesViewSet(viewsets.ModelViewSet):
queryset = Note.objects.all()
serializer_class = NoteSerializer
| 24.222222
| 42
| 0.807339
| 24
| 218
| 7.25
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.137615
| 218
| 8
| 43
| 27.25
| 0.925532
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
2194392c032be7c7d693634424f7cfd5cc02e0fa
| 81
|
py
|
Python
|
daw/apps.py
|
suzupro2019/Deeparture
|
74b4de5bc2fc07adb0ade0207ac623997b5a0689
|
[
"FTL"
] | 5
|
2020-02-09T03:42:44.000Z
|
2020-03-15T03:39:26.000Z
|
daw/apps.py
|
suzupro2019/Deeparture
|
74b4de5bc2fc07adb0ade0207ac623997b5a0689
|
[
"FTL"
] | null | null | null |
daw/apps.py
|
suzupro2019/Deeparture
|
74b4de5bc2fc07adb0ade0207ac623997b5a0689
|
[
"FTL"
] | null | null | null |
from django.apps import AppConfig
class DawConfig(AppConfig):
name = 'daw'
| 13.5
| 33
| 0.728395
| 10
| 81
| 5.9
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.185185
| 81
| 5
| 34
| 16.2
| 0.893939
| 0
| 0
| 0
| 0
| 0
| 0.037037
| 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
|
21c4cdc65a30c8f32d3eea7e46e550cde95a482c
| 13,453
|
py
|
Python
|
dop/atm/migrations/0001_initial.py
|
zhang5171291/dop
|
6c7e8645e290759c988932617606887b71ea2dd6
|
[
"Apache-2.0"
] | null | null | null |
dop/atm/migrations/0001_initial.py
|
zhang5171291/dop
|
6c7e8645e290759c988932617606887b71ea2dd6
|
[
"Apache-2.0"
] | 2
|
2019-10-17T05:18:13.000Z
|
2019-10-17T05:19:43.000Z
|
dop/atm/migrations/0001_initial.py
|
zhang5171291/dop
|
6c7e8645e290759c988932617606887b71ea2dd6
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='EditHistory',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('content', models.TextField(null=True, verbose_name='\u4fee\u6539\u5185\u5bb9', blank=True)),
('is_deleted', models.BooleanField(default=False, verbose_name='\u662f\u5426\u5df2\u5220\u9664')),
('ctime', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
('utime', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
],
options={
'db_table': 'edithistory',
'verbose_name': '\u4fee\u6539\u8bb0\u5f55',
'verbose_name_plural': '\u4fee\u6539\u8bb0\u5f55',
},
),
migrations.CreateModel(
name='ErrorCode',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('error_name', models.CharField(max_length=50, null=True, verbose_name='\u9519\u8bef\u7801\u540d\u79f0', blank=True)),
('display_message', models.CharField(max_length=200, null=True, verbose_name='\u63d0\u793a\u4fe1\u606f', blank=True)),
('description', models.TextField(null=True, verbose_name='\u9519\u8bef\u7801\u63cf\u8ff0', blank=True)),
('remark', models.TextField(null=True, verbose_name='\u5907\u6ce8', blank=True)),
('is_active', models.BooleanField(default=True, verbose_name='\u662f\u5426\u542f\u7528')),
('is_deleted', models.BooleanField(default=False, verbose_name='\u662f\u5426\u5df2\u5220\u9664')),
('ctime', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
('utime', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
('author', models.ForeignKey(related_name='errorcode_author', verbose_name='\u521b\u5efa\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'db_table': 'errorcode',
'verbose_name': '\u9519\u8bef\u7801',
'verbose_name_plural': '\u9519\u8bef\u7801',
},
),
migrations.CreateModel(
name='Interface',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('interface_name', models.CharField(max_length=200, null=True, verbose_name='API\u63a5\u53e3\u540d\u79f0', blank=True)),
('description', models.TextField(null=True, verbose_name='API\u63a5\u53e3\u63cf\u8ff0', blank=True)),
('url', models.CharField(max_length=200, unique=True, null=True, verbose_name='\u8bf7\u6c42\u5730\u5740', blank=True)),
('method', models.SmallIntegerField(default=1, verbose_name='\u8bf7\u6c42\u7c7b\u578b', choices=[(1, b'GET'), (2, b'POST'), (3, b'PUT'), (4, b'DELETE')])),
('content_type', models.SmallIntegerField(default=1, verbose_name='Content type', choices=[(1, b'application/json'), (2, b'text/html'), (3, b'x-www-form-urlencode')])),
('remark', models.TextField(null=True, verbose_name='\u5907\u6ce8', blank=True)),
('is_active', models.BooleanField(default=True, verbose_name='\u662f\u5426\u542f\u7528')),
('is_deleted', models.BooleanField(default=False, verbose_name='\u662f\u5426\u5df2\u5220\u9664')),
('ctime', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
('utime', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
('author', models.ForeignKey(related_name='interface_author', verbose_name='\u521b\u5efa\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
('modifier', models.ForeignKey(related_name='interface_modifier', verbose_name='\u4fee\u6539\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'db_table': 'interface',
'verbose_name': 'API\u5e94\u7528\u63a5\u53e3',
'verbose_name_plural': 'API\u5e94\u7528\u63a5\u53e3',
},
),
migrations.CreateModel(
name='LockInfo',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('is_locked', models.BooleanField(default=False, verbose_name='\u662f\u5426\u88ab\u9501')),
('is_deleted', models.BooleanField(default=False, verbose_name='\u662f\u5426\u5df2\u5220\u9664')),
('ctime', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
('utime', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
('interface', models.ForeignKey(related_name='lockinfo', verbose_name='API\u5e94\u7528\u63a5\u53e3', to='atm.Interface', null=True)),
('lock_user', models.ForeignKey(related_name='lockinfo', verbose_name='\u9501\u8868\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'db_table': 'lockinfo',
'verbose_name': '\u9501\u63a5\u53e3\u4fe1\u606f',
'verbose_name_plural': '\u9501\u63a5\u53e3\u4fe1\u606f',
},
),
migrations.CreateModel(
name='MetaData',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('position', models.SmallIntegerField(default=1, verbose_name='Postion', choices=[(1, b'ReqHeader'), (2, b'ReqPath'), (3, b'ReqQueryString'), (4, b'ReqForm'), (5, b'ReqBody'), (6, b'ReqCookie'), (7, b'RespHeader'), (8, b'RespBody ')])),
('metadata_name', models.CharField(max_length=200, null=True, verbose_name='\u5143\u6570\u636e\u540d\u79f0', blank=True)),
('data', models.TextField(null=True, verbose_name='\u6570\u636e\u503c', blank=True)),
('remark', models.TextField(null=True, verbose_name='\u5907\u6ce8', blank=True)),
('is_active', models.BooleanField(default=True, verbose_name='\u662f\u5426\u542f\u7528')),
('is_deleted', models.BooleanField(default=False, verbose_name='\u662f\u5426\u5df2\u5220\u9664')),
('ctime', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
('utime', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
('author', models.ForeignKey(related_name='metadata_author', verbose_name='\u521b\u5efa\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
('interface', models.ForeignKey(related_name='metadata', verbose_name='API\u5e94\u7528\u63a5\u53e3', to='atm.Interface', null=True)),
('modifier', models.ForeignKey(related_name='metadata_modifier', verbose_name='\u4fee\u6539\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'db_table': 'metadata',
'verbose_name': '\u5143\u6570\u636e',
'verbose_name_plural': '\u5143\u6570\u636e',
},
),
migrations.CreateModel(
name='Project',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('project_name', models.CharField(max_length=200, null=True, verbose_name='\u9879\u76ee\u540d\u79f0', blank=True)),
('description', models.TextField(null=True, verbose_name='\u9879\u76ee\u63cf\u8ff0', blank=True)),
('host', models.CharField(max_length=200, null=True, verbose_name='Host', blank=True)),
('remark', models.TextField(null=True, verbose_name='\u5907\u6ce8', blank=True)),
('is_active', models.BooleanField(default=True, verbose_name='\u662f\u5426\u542f\u7528')),
('is_deleted', models.BooleanField(default=False, verbose_name='\u662f\u5426\u5df2\u5220\u9664')),
('ctime', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
('utime', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
('author', models.ForeignKey(related_name='project_author', verbose_name='\u521b\u5efa\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
('modifier', models.ForeignKey(related_name='project_modifier', verbose_name='\u4fee\u6539\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'db_table': 'project',
'verbose_name': '\u9879\u76ee',
'verbose_name_plural': '\u9879\u76ee',
},
),
migrations.CreateModel(
name='ProjectMember',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('is_active', models.BooleanField(default=True, verbose_name='\u662f\u5426\u542f\u7528')),
('is_deleted', models.BooleanField(default=False, verbose_name='\u662f\u5426\u5df2\u5220\u9664')),
('ctime', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
('utime', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
('project', models.ForeignKey(related_name='projectmember', verbose_name='\u9879\u76ee', to='atm.Project', null=True)),
('user', models.ForeignKey(related_name='projectmember', verbose_name='\u6210\u5458', to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'db_table': 'projectmember',
'verbose_name': '\u9879\u76ee\u4eba\u5458',
'verbose_name_plural': '\u9879\u76ee\u4eba\u5458',
},
),
migrations.CreateModel(
name='Team',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('team_name', models.CharField(max_length=200, unique=True, null=True, verbose_name='\u56e2\u961f\u540d\u79f0', blank=True)),
('description', models.TextField(null=True, verbose_name='\u56e2\u961f\u63cf\u8ff0', blank=True)),
('remark', models.TextField(null=True, verbose_name='\u5907\u6ce8', blank=True)),
('is_active', models.BooleanField(default=True, verbose_name='\u662f\u5426\u542f\u7528')),
('is_deleted', models.BooleanField(default=False, verbose_name='\u662f\u5426\u5df2\u5220\u9664')),
('ctime', models.DateTimeField(auto_now_add=True, verbose_name='\u521b\u5efa\u65f6\u95f4')),
('utime', models.DateTimeField(auto_now=True, verbose_name='\u66f4\u65b0\u65f6\u95f4')),
('author', models.ForeignKey(related_name='team_author', verbose_name='\u521b\u5efa\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
('modifier', models.ForeignKey(related_name='team_modifier', verbose_name='\u4fee\u6539\u4eba', to=settings.AUTH_USER_MODEL, null=True)),
],
options={
'db_table': 'team',
'verbose_name': '\u56e2\u961f',
'verbose_name_plural': '\u56e2\u961f',
},
),
migrations.AddField(
model_name='project',
name='team',
field=models.ForeignKey(related_name='project', verbose_name='\u56e2\u961f', to='atm.Team', null=True),
),
migrations.AddField(
model_name='interface',
name='project',
field=models.ForeignKey(related_name='interface', verbose_name='\u9879\u76ee', to='atm.Project', null=True),
),
migrations.AddField(
model_name='errorcode',
name='interface',
field=models.ForeignKey(related_name='errorcode', verbose_name='API\u5e94\u7528\u63a5\u53e3', to='atm.Interface', null=True),
),
migrations.AddField(
model_name='errorcode',
name='modifier',
field=models.ForeignKey(related_name='errorcode_modifier', verbose_name='\u4fee\u6539\u4eba', to=settings.AUTH_USER_MODEL, null=True),
),
migrations.AddField(
model_name='edithistory',
name='interface',
field=models.ForeignKey(related_name='edithistory', verbose_name='API\u5e94\u7528\u63a5\u53e3', to='atm.Interface', null=True),
),
migrations.AddField(
model_name='edithistory',
name='modifier',
field=models.ForeignKey(related_name='edithistory', verbose_name='\u4fee\u6539\u4eba', to=settings.AUTH_USER_MODEL, null=True),
),
]
| 66.930348
| 252
| 0.614435
| 1,457
| 13,453
| 5.49897
| 0.12011
| 0.133175
| 0.07676
| 0.067399
| 0.825137
| 0.76348
| 0.727159
| 0.675487
| 0.644658
| 0.616201
| 0
| 0.09194
| 0.226269
| 13,453
| 200
| 253
| 67.265
| 0.677779
| 0.001561
| 0
| 0.530928
| 0
| 0
| 0.260164
| 0.107669
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.015464
| 0
| 0.030928
| 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
|
21d90e792322c93ef7de9258a6c7b95fa67748a5
| 80
|
py
|
Python
|
mal/const.py
|
Nearata/myanimelist-rest-api
|
f254e53e7f54415c6b11f5b2e9a8afe142975f70
|
[
"Unlicense"
] | 1
|
2020-11-11T14:55:23.000Z
|
2020-11-11T14:55:23.000Z
|
mal/const.py
|
Nearata/myanimelist-rest-api
|
f254e53e7f54415c6b11f5b2e9a8afe142975f70
|
[
"Unlicense"
] | 5
|
2021-03-31T19:26:31.000Z
|
2021-08-09T13:33:07.000Z
|
mal/const.py
|
Nearata/myanimelist-rest-api
|
f254e53e7f54415c6b11f5b2e9a8afe142975f70
|
[
"Unlicense"
] | null | null | null |
MAL_URL = "https://myanimelist.net"
MAL_CDN_URL = "https://cdn.myanimelist.net"
| 26.666667
| 43
| 0.7375
| 12
| 80
| 4.666667
| 0.5
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075
| 80
| 2
| 44
| 40
| 0.756757
| 0
| 0
| 0
| 0
| 0
| 0.625
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
0dfc92abb6852249364ca74a5ae98c9ddd82fbdd
| 38
|
py
|
Python
|
venv/lib/python3.6/encodings/cp1251.py
|
JamesMusyoka/Blog
|
fdcb51cf4541bbb3b9b3e7a1c3735a0b1f45f0b5
|
[
"Unlicense"
] | 2
|
2019-04-17T13:35:50.000Z
|
2021-12-21T00:11:36.000Z
|
venv/lib/python3.6/encodings/cp1251.py
|
JamesMusyoka/Blog
|
fdcb51cf4541bbb3b9b3e7a1c3735a0b1f45f0b5
|
[
"Unlicense"
] | 2
|
2021-03-31T19:51:24.000Z
|
2021-06-10T23:05:09.000Z
|
venv/lib/python3.6/encodings/cp1251.py
|
JamesMusyoka/Blog
|
fdcb51cf4541bbb3b9b3e7a1c3735a0b1f45f0b5
|
[
"Unlicense"
] | 2
|
2019-10-01T08:47:35.000Z
|
2020-07-11T06:32:16.000Z
|
/usr/lib/python3.6/encodings/cp1251.py
| 38
| 38
| 0.815789
| 7
| 38
| 4.428571
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.157895
| 0
| 38
| 1
| 38
| 38
| 0.657895
| 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
|
df1d80ef18daf65dc7b8ba3663d46ae6f3a47ba1
| 26
|
py
|
Python
|
Data Structure and Algorithm.py
|
lovefov/Python
|
ba8fc49e6e503927dc1f827f37b77f3e43b5d0c8
|
[
"MIT"
] | null | null | null |
Data Structure and Algorithm.py
|
lovefov/Python
|
ba8fc49e6e503927dc1f827f37b77f3e43b5d0c8
|
[
"MIT"
] | null | null | null |
Data Structure and Algorithm.py
|
lovefov/Python
|
ba8fc49e6e503927dc1f827f37b77f3e43b5d0c8
|
[
"MIT"
] | 1
|
2021-02-08T08:48:44.000Z
|
2021-02-08T08:48:44.000Z
|
''''
long way to work
'''
| 8.666667
| 17
| 0.5
| 4
| 26
| 3.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.230769
| 26
| 3
| 18
| 8.666667
| 0.65
| 0.730769
| 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
|
df588779d1483bbafdf7759fb633924b332c72a4
| 238
|
py
|
Python
|
src/metarl/torch/embeddings/__init__.py
|
icml2020submission6857/metarl
|
9b66cefa2b6bcb6a38096d629ce8853b47c7171d
|
[
"MIT"
] | 2
|
2020-03-15T14:35:15.000Z
|
2021-02-15T16:38:00.000Z
|
src/metarl/torch/embeddings/__init__.py
|
icml2020submission6857/metarl
|
9b66cefa2b6bcb6a38096d629ce8853b47c7171d
|
[
"MIT"
] | null | null | null |
src/metarl/torch/embeddings/__init__.py
|
icml2020submission6857/metarl
|
9b66cefa2b6bcb6a38096d629ce8853b47c7171d
|
[
"MIT"
] | 1
|
2020-02-24T03:04:23.000Z
|
2020-02-24T03:04:23.000Z
|
"""PyTorch embedding modules for meta-learning algorithms."""
from metarl.torch.embeddings.mlp_encoder import MLPEncoder
from metarl.torch.embeddings.recurrent_encoder import RecurrentEncoder
__all__ = ['MLPEncoder', 'RecurrentEncoder']
| 39.666667
| 70
| 0.827731
| 26
| 238
| 7.346154
| 0.692308
| 0.104712
| 0.157068
| 0.26178
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.079832
| 238
| 5
| 71
| 47.6
| 0.872146
| 0.231092
| 0
| 0
| 0
| 0
| 0.146893
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
df62e70dbb7e8540bf989df573035564f4e63513
| 72
|
py
|
Python
|
resdk/data_upload/__init__.py
|
tristanbrown/resolwe-bio-py
|
c911defde8a5e7e902ad1adf4f9e480f17002c18
|
[
"Apache-2.0"
] | null | null | null |
resdk/data_upload/__init__.py
|
tristanbrown/resolwe-bio-py
|
c911defde8a5e7e902ad1adf4f9e480f17002c18
|
[
"Apache-2.0"
] | null | null | null |
resdk/data_upload/__init__.py
|
tristanbrown/resolwe-bio-py
|
c911defde8a5e7e902ad1adf4f9e480f17002c18
|
[
"Apache-2.0"
] | null | null | null |
"""Collection of helper functions for uploading and annotating data."""
| 36
| 71
| 0.777778
| 9
| 72
| 6.222222
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 72
| 1
| 72
| 72
| 0.888889
| 0.902778
| 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
|
df81922e10c996c477ca2bd4e363c03b5ab6a04e
| 129
|
py
|
Python
|
plant_pathology/self_knowledge_distillation.py
|
bwolfson97/plant-pathology
|
4036889136d03236b427522ae87368fefc4f0025
|
[
"Apache-2.0"
] | null | null | null |
plant_pathology/self_knowledge_distillation.py
|
bwolfson97/plant-pathology
|
4036889136d03236b427522ae87368fefc4f0025
|
[
"Apache-2.0"
] | 3
|
2021-04-09T21:57:48.000Z
|
2021-04-12T01:49:25.000Z
|
plant_pathology/self_knowledge_distillation.py
|
bwolfson97/plant-pathology
|
4036889136d03236b427522ae87368fefc4f0025
|
[
"Apache-2.0"
] | null | null | null |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbks/05_self_knowledge_distillation.ipynb (unless otherwise specified).
__all__ = []
| 43
| 115
| 0.790698
| 17
| 129
| 5.588235
| 0.941176
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017544
| 0.116279
| 129
| 3
| 116
| 43
| 0.815789
| 0.875969
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
10f26e1070848c4fff68796ed179cae8485f4e7b
| 85
|
py
|
Python
|
config.py
|
CRImier/escaperoom-web
|
a03ec02eabd0dcf29ba1129583e0532fd90d6c2d
|
[
"MIT"
] | null | null | null |
config.py
|
CRImier/escaperoom-web
|
a03ec02eabd0dcf29ba1129583e0532fd90d6c2d
|
[
"MIT"
] | null | null | null |
config.py
|
CRImier/escaperoom-web
|
a03ec02eabd0dcf29ba1129583e0532fd90d6c2d
|
[
"MIT"
] | null | null | null |
import web
db_filename = "config.db"
DB = web.database(dbn='sqlite', db=db_filename)
| 21.25
| 47
| 0.741176
| 14
| 85
| 4.357143
| 0.571429
| 0.327869
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105882
| 85
| 3
| 48
| 28.333333
| 0.802632
| 0
| 0
| 0
| 0
| 0
| 0.176471
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
10fb813a33b3e1839627ca5449e541bc8ac93ccc
| 24
|
py
|
Python
|
cupy/_version.py
|
casheera/cupy
|
c670b6f6f1282665c9985180c10f498d8591f909
|
[
"MIT"
] | null | null | null |
cupy/_version.py
|
casheera/cupy
|
c670b6f6f1282665c9985180c10f498d8591f909
|
[
"MIT"
] | null | null | null |
cupy/_version.py
|
casheera/cupy
|
c670b6f6f1282665c9985180c10f498d8591f909
|
[
"MIT"
] | null | null | null |
__version__ = '7.0.0b3'
| 12
| 23
| 0.666667
| 4
| 24
| 3
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190476
| 0.125
| 24
| 1
| 24
| 24
| 0.380952
| 0
| 0
| 0
| 0
| 0
| 0.291667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
10fd30e77ebc57c1673a1219c96f972cf1a3b00c
| 242
|
py
|
Python
|
filter_plugins/custom.py
|
oscaromeu/k3s-playground
|
3790cde94050ae336f0469bbac9ce21285b8e123
|
[
"Apache-2.0"
] | 1
|
2021-03-17T08:44:57.000Z
|
2021-03-17T08:44:57.000Z
|
filter_plugins/custom.py
|
oscaromeu/k3s-ansible-deploy-monitoring-playground
|
a7086a590ee4be28cc812154812b29a8b8d44aa9
|
[
"Apache-2.0"
] | 1
|
2022-03-24T06:28:43.000Z
|
2022-03-24T06:28:43.000Z
|
filter_plugins/custom.py
|
oscaromeu/k3s-ansible-deploy-monitoring-playground
|
a7086a590ee4be28cc812154812b29a8b8d44aa9
|
[
"Apache-2.0"
] | null | null | null |
__author__ = "oscar romeu"
from ansible import errors
class FilterModule(object):
def filters(self):
return {
"is_list": self.is_list,
}
def is_list(self, value):
return isinstance(value, list)
| 17.285714
| 38
| 0.61157
| 28
| 242
| 5.035714
| 0.642857
| 0.12766
| 0.141844
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.293388
| 242
| 13
| 39
| 18.615385
| 0.824561
| 0
| 0
| 0
| 0
| 0
| 0.07438
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.111111
| 0.222222
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
801111c94b3c6722d6bedd6016a910a8153cd1e1
| 73,599
|
py
|
Python
|
tests/ui/stdio/test_commands.py
|
Matoking/siliqua
|
b943822631ab18dde85e95d1731ebd7ffd7ef14a
|
[
"CC0-1.0"
] | 8
|
2019-10-31T19:16:08.000Z
|
2021-12-04T00:09:24.000Z
|
tests/ui/stdio/test_commands.py
|
Matoking/siliqua
|
b943822631ab18dde85e95d1731ebd7ffd7ef14a
|
[
"CC0-1.0"
] | null | null | null |
tests/ui/stdio/test_commands.py
|
Matoking/siliqua
|
b943822631ab18dde85e95d1731ebd7ffd7ef14a
|
[
"CC0-1.0"
] | 1
|
2019-11-01T19:27:48.000Z
|
2019-11-01T19:27:48.000Z
|
import pytest
import json
import copy
from siliqua.server import WalletServer
from siliqua.wallet import Account, AccountSource, Block, LinkBlock
from siliqua.wallet.secret import Secret
from siliqua.ui.stdio import logger
from tests.util import hook
class TestCreateWallet:
def test_create_wallet_non_encrypted(
self, stdio, wallet_path, wallet_loader):
result = stdio(["create-wallet", str(wallet_path)], success=True)
assert "Saved wallet" in result["data"]["message"]
assert "test.wallet" in result["data"]["message"]
assert not result["data"]["wallet_encrypted"]
assert not result["data"]["secrets_encrypted"]
wallet = wallet_loader(wallet_path)
assert len(wallet.accounts) == 20
assert isinstance(wallet.accounts[0].private_key, str)
def test_create_wallet_existing_wallet(self, stdio, wallet_path):
with open(wallet_path, "w") as f:
f.write("I exist")
result = stdio(["create-wallet", str(wallet_path)], success=False)
assert result["data"]["error"] == "wallet_exists"
def test_create_wallet_seed(self, stdio, wallet_path, wallet_loader):
stdio(
["create-wallet", str(wallet_path)],
env={"SEED": "2df7255d3a93ebb8c8efb06f98a49064c9f8fdf1a0caf0ab579456c7f4db1bd7"}
)
wallet = wallet_loader(wallet_path)
assert wallet.properties.seed == \
"2df7255d3a93ebb8c8efb06f98a49064c9f8fdf1a0caf0ab579456c7f4db1bd7"
def test_create_wallet_gap_limit(self, stdio, wallet_path, wallet_loader):
stdio(
["create-wallet", str(wallet_path), "--gap-limit", "50"]
)
wallet = wallet_loader(wallet_path)
assert wallet.properties.gap_limit == 50
assert len(wallet.accounts) == 50
def test_create_wallet_invalid_seed(self, stdio, wallet_path):
result = stdio(
["create-wallet", str(wallet_path)],
env={"SEED": "invalid"},
success=False
)
assert result["data"]["error"] == "invalid_seed"
def test_create_wallet_encrypt(
self, stdio, wallet_path, wallet_loader):
result = stdio(
["create-wallet", str(wallet_path), "--encrypt-secrets"],
env={"PASSPHRASE": "test_password"}
)
assert result["data"]["secrets_encrypted"]
assert not result["data"]["wallet_encrypted"]
wallet = wallet_loader(wallet_path)
assert wallet.encryption.secrets_encrypted
assert not wallet.encryption.wallet_encrypted
wallet.unlock("test_password")
def test_create_wallet_encrypt_key_iteration_count(
self, stdio, wallet_path, wallet_loader):
stdio(
[
"create-wallet", str(wallet_path), "--encrypt-secrets",
"--key-iteration-count", "25000"
],
env={"PASSPHRASE": "test_password"}
)
wallet = wallet_loader(wallet_path)
assert wallet.encryption.key_iteration_count == 25000
def test_create_wallet_encrypt_no_passphrase(
self, stdio, wallet_path):
result = stdio(
["create-wallet", str(wallet_path), "--encrypt-secrets"],
success=False
)
assert result["data"]["error"] == "missing_passphrase"
class TestCalculateKeyIterationCount:
def test_calculate_key_iteration_count(self, stdio):
result = stdio(["calculate-key-iteration-count", "0.5"])
assert result["data"]["seconds"] == pytest.approx(0.5)
assert result["data"]["key_iteration_count"] > 0
assert isinstance(result["data"]["key_iteration_count"], int)
class TestChangeEncryption:
def test_change_encryption(self, stdio, wallet_path, wallet_loader):
# Change wallet's encryption from secrets encrypted to
# secrets + wallet encrypted, and change the passphrase at the same
# time
stdio(
["create-wallet", str(wallet_path), "--encrypt-secrets"],
env={"PASSPHRASE": "test_password"}
)
result = stdio(
[
"--wallet", str(wallet_path), "change-encryption",
"--encrypt-secrets", "--encrypt-wallet"
],
env={
"PASSPHRASE": "test_password",
"NEW_PASSPHRASE": "test_password2"
}
)
assert "Encryption changed" in result["data"]["message"]
wallet = wallet_loader(wallet_path, passphrase="test_password2")
assert wallet.encryption.secrets_encrypted
assert wallet.encryption.wallet_encrypted
def test_change_encryption_missing_passphrase(self, stdio, wallet_path):
stdio(
["create-wallet", str(wallet_path)],
)
result = stdio(
[
"--wallet", str(wallet_path), "change-encryption",
"--encrypt-secrets", "--encrypt-wallet"
],
success=False
)
assert result["data"]["error"] == "missing_passphrase"
def test_change_encryption_incorrect_passphrase(self, stdio, wallet_path):
# Try to change encryption with an incorrect passphrase
stdio(
["create-wallet", str(wallet_path), "--encrypt-wallet"],
env={"PASSPHRASE": "password"}
)
result = stdio(
[
"--wallet", str(wallet_path), "change-encryption",
"--encrypt-secrets"
],
env={"PASSPHRASE": "incorrect", "NEW_PASSPHRASE": "new"},
success=False
)
assert result["data"]["error"] == "incorrect_passphrase"
def test_change_encryption_key_iteration_count(
self, stdio, wallet_path, wallet_loader):
stdio(
["create-wallet", str(wallet_path), "--encrypt-wallet"],
env={"PASSPHRASE": "password"}
)
stdio(
[
"--wallet", str(wallet_path), "change-encryption",
"--encrypt-secrets", "--key-iteration-count", "25000"
],
env={"PASSPHRASE": "password", "NEW_PASSPHRASE": "password"},
)
wallet = wallet_loader(wallet_path)
assert wallet.encryption.key_iteration_count == 25000
@pytest.mark.add_encrypted_test
class TestChangeGapLimit:
def test_change_gap_limit(
self, stdio, wallet_path, wallet_factory, wallet_loader):
wallet = wallet_factory()
wallet.save(wallet_path)
# Increase the gap limit and ensure 5 new accounts are generated
result = stdio([
"--wallet", str(wallet_path), "change-gap-limit", "25"
])
assert len(result["data"]["new_accounts"]) == 5
assert result["data"]["gap_limit"] == 25
wallet = wallet_loader(wallet_path)
assert wallet.accounts[24].account_id == \
result["data"]["new_accounts"][4]
def test_change_gap_limit_seed_required(
self, stdio, wallet_path, wallet_factory):
wallet = wallet_factory()
wallet.properties.seed = None
wallet.save(wallet_path)
# Gap limit can't be changed if there is no seed
result = stdio([
"--wallet", str(wallet_path), "change-gap-limit", "25"
], success=False)
assert result["data"]["error"] == "seed_required"
@pytest.mark.add_encrypted_test
class TestGetWalletSeed:
def test_get_wallet_seed(
self, stdio, wallet_path, wallet_factory, wallet_loader,
is_encrypted_test):
wallet = wallet_factory(balance=10000)
if is_encrypted_test:
wallet.unlock("password")
seed = wallet.properties.get_secret(
"seed", secret_key=wallet.secret_key
)
wallet.lock()
else:
seed = wallet.properties.seed
wallet.save(wallet_path)
result = stdio(["--wallet", wallet_path, "get-wallet-seed"])
assert result["data"]["seed"] == seed
def test_get_wallet_seed_no_seed(
self, stdio, wallet_path, wallet_factory, wallet_loader):
wallet = wallet_factory()
wallet.properties.seed = None
wallet.properties.seed_algorithm = None
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "get-wallet-seed"
], success=False)
assert result["data"]["error"] == "seed_required"
@pytest.mark.add_encrypted_test
class TestGetBalance:
def test_get_balance(
self, stdio, wallet_path, empty_wallet, wallet_loader,
account_factory):
wallet = empty_wallet
account_a = account_factory(balance=1000, complete=True, confirm=True)
account_b = account_factory(balance=2000, complete=True, confirm=False)
account_b.name = "Test account"
# A watching-only account
account_c = account_factory(balance=4000, complete=True, confirm=True)
account_c.private_key = None
account_c.source = AccountSource.WATCHING
wallet.add_account(account_a)
wallet.add_account(account_b)
wallet.add_account(account_c)
wallet.save(wallet_path)
result = stdio(["--wallet", wallet_path, "get-balance"])
data = result["data"]
assert data["spendable_balance"] == "3000"
assert data["unspendable_balance"] == "4000"
assert data["accounts"][account_a.account_id]["spendable"]
assert data["accounts"][account_a.account_id]["balance"] == "1000"
assert data["accounts"][account_b.account_id]["name"] == \
"Test account"
assert not data["accounts"][account_c.account_id]["spendable"]
assert data["accounts"][account_c.account_id]["balance"] == "4000"
@pytest.mark.add_encrypted_test
class TestAddAccount:
def test_add_account_from_account_id(
self, stdio, wallet_path, zero_balance_wallet, wallet_loader):
wallet = zero_balance_wallet
wallet.save(wallet_path)
account_id = \
"xrb_175rc45en4483h9dr6h6s73rpard9rpnbnmu1zsgex3s9mmqft7he1yw65jx"
result = stdio([
"--wallet", str(wallet_path), "add-account",
"--account-id", account_id
])
assert result["data"]["account_id"] == account_id
wallet = wallet_loader(wallet_path)
assert wallet.account_map[account_id].account_id == account_id
assert wallet.account_map[account_id].source == AccountSource.WATCHING
def test_add_account_from_public_key(
self, stdio, wallet_path, zero_balance_wallet, wallet_loader):
wallet = zero_balance_wallet
wallet.save(wallet_path)
public_key = \
"2f532af1013ea8f17832f7ea509314160a55027014102be5dd5bbd2bc119b32d"
account_id = \
"xrb_1dtm7dri4hoay7w57xzcc4bja7iccn39171i7hkxtpxx7h1jmesfnq9risht"
result = stdio([
"--wallet", str(wallet_path), "add-account",
"--public-key", public_key
])
assert result["data"]["account_id"] == account_id
wallet = wallet_loader(wallet_path)
assert wallet.account_map[account_id].account_id == account_id
assert wallet.account_map[account_id].source == AccountSource.WATCHING
def test_add_account_from_private_key(
self, stdio, wallet_path, zero_balance_wallet, wallet_loader,
is_encrypted_test):
wallet = zero_balance_wallet
wallet.save(wallet_path)
private_key = \
"60611eb404754617f5dd72a9d2dcc3408bc77cca912ce4cab57b54e9c2e3152a"
account_id = \
"xrb_3eh3jd5ykeub88rstdbakhp331rjhuxyh4jdza6rc14p6uzzr6e33trwikpy"
result = stdio([
"--wallet", str(wallet_path), "add-account"
], env={"PRIVATE_KEY": private_key})
assert result["data"]["account_id"] == account_id
wallet = wallet_loader(wallet_path)
assert wallet.account_map[account_id].account_id == account_id
assert wallet.account_map[account_id].source == \
AccountSource.PRIVATE_KEY
if is_encrypted_test:
assert isinstance(
wallet.account_map[account_id].private_key, Secret
)
else:
assert wallet.account_map[account_id].private_key == private_key
def test_add_account_from_private_key_after_account_id(
self, stdio, wallet_path, zero_balance_wallet, wallet_loader,
is_encrypted_test):
wallet = zero_balance_wallet
wallet.save(wallet_path)
private_key = \
"60611eb404754617f5dd72a9d2dcc3408bc77cca912ce4cab57b54e9c2e3152a"
account_id = \
"xrb_3eh3jd5ykeub88rstdbakhp331rjhuxyh4jdza6rc14p6uzzr6e33trwikpy"
stdio([
"--wallet", wallet_path, "add-account", "--account-id",
account_id
])
result = stdio([
"--wallet", wallet_path, "add-account"
], env={"PRIVATE_KEY": private_key})
assert result["data"]["account_id"] == account_id
wallet = wallet_loader(wallet_path)
assert wallet.account_map[account_id].account_id == account_id
assert wallet.account_map[account_id].source == \
AccountSource.PRIVATE_KEY
if is_encrypted_test:
assert isinstance(
wallet.account_map[account_id].private_key, Secret
)
else:
assert wallet.account_map[account_id].private_key == private_key
def test_add_account_duplicate(
self, stdio, wallet_path, zero_balance_wallet, wallet_loader):
wallet = zero_balance_wallet
wallet.save(wallet_path)
account_id = \
"xrb_3eh3jd5ykeub88rstdbakhp331rjhuxyh4jdza6rc14p6uzzr6e33trwikpy"
args = [
"--wallet", str(wallet_path), "add-account", "--account-id",
account_id
]
stdio(args)
# Trying to add account twice causes an error
result = stdio(args, success=False)
assert result["data"]["error"] == "account_already_exists"
def test_add_account_multiple_args(
self, stdio, wallet_path, zero_balance_wallet, wallet_loader):
wallet = zero_balance_wallet
wallet.save(wallet_path)
private_key = \
"60611eb404754617f5dd72a9d2dcc3408bc77cca912ce4cab57b54e9c2e3152a"
account_id = \
"xrb_3eh3jd5ykeub88rstdbakhp331rjhuxyh4jdza6rc14p6uzzr6e33trwikpy"
result = stdio([
"--wallet", wallet_path, "add-account", "--account-id",
account_id
], env={"PRIVATE_KEY": private_key}, success=False)
assert result["data"]["error"] == "one_parameter_required"
@pytest.mark.add_encrypted_test
class TestRemoveAccount:
def test_remove_account(
self, stdio, zero_balance_wallet, wallet_path, wallet_loader):
wallet = zero_balance_wallet
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
assert len(wallet.accounts) == 20
result = stdio([
"--wallet", wallet_path, "remove-account", account_id
])
assert result["data"]["account_id"] == account_id
wallet = wallet_loader(wallet_path)
assert account_id not in wallet.account_map
assert len(wallet.accounts) == 19
def test_remove_account_account_not_found(
self, stdio, empty_wallet, wallet_path):
empty_wallet.save(wallet_path)
account_id = \
"xrb_3eh3jd5ykeub88rstdbakhp331rjhuxyh4jdza6rc14p6uzzr6e33trwikpy"
result = stdio([
"--wallet", wallet_path, "remove-account", account_id
], success=False)
assert result["data"]["error"] == "account_not_found"
@pytest.mark.add_encrypted_test
class TestGenerateAccount:
def test_generate_account(
self, stdio, zero_balance_wallet, wallet_path, wallet_loader):
wallet = zero_balance_wallet
assert len(wallet.accounts) == 20
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "generate-account"
])
account_id = result["data"]["new_accounts"][0]
wallet = wallet_loader(wallet_path)
assert len(wallet.accounts) == 21
assert wallet.accounts[20].account_id == account_id
assert wallet.accounts[20].source == AccountSource.SEED
def test_generate_account_count(
self, stdio, zero_balance_wallet, wallet_path, wallet_loader):
wallet = zero_balance_wallet
assert len(wallet.accounts) == 20
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "generate-account", "--count", "5"
])
new_account_ids = result["data"]["new_accounts"]
wallet = wallet_loader(wallet_path)
assert len(wallet.accounts) == 25
assert wallet.accounts[20].account_id == new_account_ids[0]
assert wallet.accounts[24].account_id == new_account_ids[4]
def test_generate_account_seed_required(
self, stdio, empty_wallet, wallet_path, wallet_loader):
wallet = empty_wallet
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "generate-account"
], success=False)
assert result["data"]["error"] == "seed_required"
@pytest.mark.add_encrypted_test
class TestSync:
def test_sync_receive(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader, pocketable_block_factory,
legacy_pocketable_block_factory):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id_a = wallet.accounts[0].account_id
account_id_b = wallet.accounts[1].account_id
link_block_a = legacy_pocketable_block_factory(
account_id=account_id_a,
amount=2000)
link_block_b = pocketable_block_factory(
account_id=account_id_b,
amount=4000)
wallet_mock_node.add_pocketable_blocks([link_block_a, link_block_b])
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "sync", "--timeout", "0"
])
data = result["data"]
assert len(data["new_blocks"]) == 2
assert data["new_blocks"][account_id_a][0]["tx_type"] == "receive"
assert data["new_blocks"][account_id_a][0]["amount"] == "2000"
assert data["new_blocks"][account_id_a][0]["block_data"]["account"] \
== account_id_a
assert data["new_blocks"][account_id_b][0]["tx_type"] == "open"
assert data["new_blocks"][account_id_b][0]["amount"] == "4000"
assert data["new_blocks"][account_id_b][0]["block_data"]["account"] \
== account_id_b
assert len(data["received_blocks"]) == 2
assert data["received_blocks"][account_id_a][0]["amount"] == "2000"
assert data["received_blocks"][account_id_a][0]["source"] == \
link_block_a.account
assert data["received_blocks"][account_id_b][0]["amount"] == "4000"
assert data["received_blocks"][account_id_b][0]["source"] == \
link_block_b.account
assert not data["rejected_blocks"]
wallet = wallet_loader(wallet_path)
assert len(wallet.accounts[0].blocks) == 2
assert len(wallet.accounts[1].blocks) == 1
# Account #0 has a balance of 12000
# (10000 from wallet_factory and 2000 we just received)
assert wallet.accounts[0].balance == 12000
assert wallet.accounts[1].balance == 4000
def test_sync_rejected(
self, low_difficulty, mock_node, wallet_factory, wallet_loader, wallet_path,
stdio):
# Create a bare-bones wallet with only one account
# This account contains one pending block which will be rejected
wallet = wallet_factory(balance=0)
wallet.properties.seed = None
wallet.properties.seed_algorithm = None
wallet.accounts = []
wallet.add_account(
Account(
account_id="xrb_1nanoftwk6741wmdznzangwm8prq95spu3zntb5gwpjdk8qd3p8eu5bxoehc",
source=AccountSource.WATCHING
)
)
wallet.accounts[0].add_block(
Block(
block_data={
"account": "xrb_1nanoftwk6741wmdznzangwm8prq95spu3zntb5gwpjdk8qd3p8eu5bxoehc",
"balance": "1000000000000000000000000000000",
"link": "82CDDC385108D25E520B9CB2C7CB539CDF2FD5C9C3D7F4992AB6E18D0135B85F",
"previous": "0000000000000000000000000000000000000000000000000000000000000000",
"representative": "xrb_3dmtrrws3pocycmbqwawk6xs7446qxa36fcncush4s1pejk16ksbmakis78m",
"signature": "043351B1248406BFF71D4F06F8BC53E988BC56CAD82484136C6A90E21D8A35A5A3A9EC6A99B6AD7F71605A4602CD6672E705B1F22EFA6DFDAD8E1E9A48209907",
"type": "state",
"work": "538a6fef558ffd93"
},
link_block=LinkBlock(
block_data={
"account": "xrb_11p7y8een13ggixxt1ruxz6cchposphsfpx9nxgjtyhrz64apesgnad9ot1x",
"previous": "4AF3568F9ADDC65302FEDBBF2BAD60FD2175D7E671DDA980D55AEA5D343D8BEA",
"representative": "xrb_1awsn43we17c1oshdru4azeqjz9wii41dy8npubm4rg11so7dx3jtqgoeahy",
"balance": "0",
"link": "5114AB75C910A20726BFD3E8A3B9335B1738F36D87F4D246EE5A2B91AEB0D8CC",
"link_as_account": "xrb_1nanoftwk6741wmdznzangwm8prq95spu3zntb5gwpjdk8qd3p8eu5bxoehc",
"signature": "AB85B448F40F482AC24006F7A3A00D25211B2017CE498CE40728435A41124E4E678675C8D994D4FC4596607499C23470A9188DE4A011253F54F8ABC00457CD0B",
"work": "9d86cf7e0bb936a9",
"type": "state"
},
amount=1000000000000000000000000000000
),
confirmed=True
)
)
wallet.accounts[0].add_block(
Block(
block_data={
"account": "xrb_1nanoftwk6741wmdznzangwm8prq95spu3zntb5gwpjdk8qd3p8eu5bxoehc",
"balance": "0",
"link": "7EB064709F33C1E93541D48CBCE68C833FF105D1F3F7A9EF6B34CB23A849AB53",
"previous": "E82CDC903E33AC80C2ACB6F3608FE9CFBDF610F11308F10CDDD8F6347F1CE058",
"representative": "xrb_3dmtrrws3pocycmbqwawk6xs7446qxa36fcncush4s1pejk16ksbmakis78m",
"signature": "505E3645F88CD37D4783A7242B8CF49BE9658E19576A17237B3F0BBF8A96249987596C9A65FA98BC904296BF0AB65EE3A9E5D48408A38ED30D9D474567083B0F",
"type": "state",
"work": "07ff830e5b022fbd"
},
confirmed=True
)
)
wallet.accounts[0].add_block(
Block(
block_data={
"account": "xrb_1nanoftwk6741wmdznzangwm8prq95spu3zntb5gwpjdk8qd3p8eu5bxoehc",
"previous": "96970559D7257F63ACB8383ED57CB510745DE744ABCEC4DC41590CE7E32179EA",
"representative": "xrb_1nanoftwk6741wmdznzangwm8prq95spu3zntb5gwpjdk8qd3p8eu5bxoehc",
"balance": "0",
"link": "0000000000000000000000000000000000000000000000000000000000000000",
"link_as_account": "xrb_1111111111111111111111111111111111111111111111111111hifc8npp",
"signature": "BBC27F177C2C2DD574AE8EB8523A1A504B5790C65C95ACE744E3033A63BB158DDF95F9B7B88B902C8D743A64EA25785662CD454044E9C3000BC79C3BF7F1E809",
"work": "561bab16393cb3c4",
"type": "state"
},
confirmed=False
)
)
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
mock_node.add_replay_datasets([
"state_broadcast_failure_previous_missing",
"active_difficulty", "version"
]).start()
result = stdio([
"--wallet", str(wallet_path), "sync", "--timeout", "0"
], success=False)
data = result["data"]
assert len(data["rejected_blocks"][account_id]) == 1
assert data["rejected_blocks"][account_id][0]["hash"] == \
"62EE070DA06632FE1E54BA32FD25B00A5FD4E8CF09354A9B176CBF6BC33CDBDB"
assert data["rejected_blocks"][account_id][0]["block_error"] == \
"previous_block_missing"
assert data["error"] == "block_rejected"
wallet = wallet_loader(wallet_path)
# The rejected block was removed
assert len(wallet.accounts[0].blocks) == 2
def test_sync_finish_work(
self, wallet_mock_node, wallet_factory, wallet_loader, wallet_path,
account_factory, stdio):
# Create a wallet with one account and 50 blocks to complete.
# Ensure that with '--finish-work' flag set, all blocks have complete
# PoW after the command has finished
wallet = wallet_factory(balance=0)
wallet.properties.seed = None
wallet.properties.seed_algorithm = None
wallet.accounts = []
wallet.add_account(
account_factory(balance=1000, block_count=50, complete=False)
)
assert not wallet.accounts[0].blocks[0].work
wallet.save(wallet_path)
wallet_mock_node.start()
stdio([
"--wallet", wallet_path, "sync", "--finish-work", "--timeout", "0"
])
wallet = wallet_loader(wallet_path)
for block in wallet.accounts[0].blocks[0:50]:
assert block.work
def test_sync_finish_sync(
self, wallet_mock_node, wallet_factory, wallet_loader, wallet_path,
account_factory, stdio):
# Create a wallet with one account and 50 blocks to complete.
# Ensure that with '--finish-sync' flag set, all blocks have been
# confirmed after the command has finished
wallet = wallet_factory(balance=0)
wallet.properties.seed = None
wallet.properties.seed_algorithm = None
wallet.accounts = []
wallet.add_account(
account_factory(
balance=1000, block_count=50, complete=True, confirm=False
)
)
assert not wallet.accounts[0].blocks[0].confirmed
wallet_mock_node.start()
wallet.save(wallet_path)
stdio([
"--wallet", wallet_path, "sync", "--finish-sync", "--timeout", "0"
])
wallet = wallet_loader(wallet_path)
for block in wallet.accounts[0].blocks[0:50]:
assert block.confirmed
def test_sync_block_count(
self, wallet_mock_node, wallet_factory, wallet_path,
pocketable_block_factory, account_factory, stdio):
wallet = wallet_factory(balance=0)
wallet.properties.seed = None
wallet.properties.seed_algorithm = None
account_id = wallet.accounts[0].account_id
link_blocks = [
pocketable_block_factory(account_id=account_id, amount=2000)
for _ in range(0, 20)
]
link_block_hashes = [
link_block.block_hash for link_block in link_blocks
]
wallet_mock_node.add_pocketable_blocks(link_blocks)
wallet_mock_node.start()
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "sync", "--finish-sync", "--timeout", "0",
"--result-count", "10"
])
# Only the ten latest confirmed blocks are returned
assert len(result["data"]["received_blocks"][account_id]) == 10
assert [
new_result["block_data"]["link"] for new_result
in result["data"]["new_blocks"][account_id]
] == link_block_hashes[10:]
def test_sync_empty_watching_only_pocketable(
self, wallet_mock_node, wallet_factory, wallet_path,
pocketable_block_factory, stdio):
"""
Watching-only account that has pending pocketable blocks
shouldn't stop the sync from completing
"""
wallet = wallet_factory(balance=0)
wallet.accounts = []
wallet.save(wallet_path)
stdio([
"--wallet", wallet_path, "add-account", "--account-id",
"xrb_3eh3jd5ykeub88rstdbakhp331rjhuxyh4jdza6rc14p6uzzr6e33trwikpy"
])
link_block = pocketable_block_factory(
account_id="xrb_3eh3jd5ykeub88rstdbakhp331rjhuxyh4jdza6rc14p6uzzr6e33trwikpy",
amount=4000
)
wallet_mock_node.add_pocketable_blocks([link_block])
wallet_mock_node.start()
result = stdio([
"--wallet", wallet_path, "sync", "--finish-sync", "--finish-work",
"--timeout", "0"
])
assert result["data"]["new_blocks"] == {}
assert result["data"]["received_blocks"] == {}
@pytest.mark.add_encrypted_test
class TestSend:
def test_send(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send",
account_id, destination, "6000"
])
wallet = wallet_loader(wallet_path)
block = wallet.accounts[0].blocks[-1]
assert block.confirmed
assert block.link_as_account == destination
assert block.amount == -6000
assert not block.description
data = result["data"]
assert data["hash"] == block.block_hash
assert data["confirmed"]
assert data["has_valid_work"]
assert data["amount"] == "-6000"
assert data["destination"] == destination
assert wallet.accounts[0].balance == 4000
def test_send_difficulty_change(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader, caplog):
"""
Send NANO to another account. The first broadcast will fail due to
increased network difficulty.
"""
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.start()
wallet_mock_node.raise_difficulty_after(block_count=0)
result = stdio([
"--wallet", str(wallet_path), "send",
account_id, destination, "6000"
])
wallet = wallet_loader(wallet_path)
block = wallet.accounts[0].blocks[-1]
block_hash = block.block_hash
assert block.confirmed
assert block.link_as_account == destination
assert block.amount == -6000
assert not block.description
data = result["data"]
assert data["hash"] == block.block_hash
assert data["confirmed"]
assert data["has_valid_work"]
assert data["amount"] == "-6000"
assert data["destination"] == destination
assert wallet.accounts[0].balance == 4000
# Check that proof-of-work was regenerated by reading logs
assert caplog.text.count(
"Regenerating proof-of-work for rejected block {}".format(
block_hash
),
1
)
assert caplog.text.count(
"Rejected block {}. Reason: insufficient_work".format(block_hash),
1
)
assert caplog.text.count("Confirmed block {}".format(block_hash), 1)
def test_send_no_wait(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send",
account_id, destination, "6000", "--no-wait-until-confirmed"
])
wallet = wallet_loader(wallet_path)
block = wallet.accounts[0].blocks[-1]
assert not block.confirmed
assert block.link_as_account == destination
assert block.amount == -6000
assert not block.description
data = result["data"]
assert data["hash"] == block.block_hash
assert not data["confirmed"]
assert not data["has_valid_work"]
assert data["amount"] == "-6000"
assert data["destination"] == destination
assert wallet.accounts[0].balance == 4000
def test_send_description(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.start()
stdio([
"--wallet", str(wallet_path), "send",
account_id, destination, "6000",
"--description", "A description for this block"
])
wallet = wallet_loader(wallet_path)
assert wallet.accounts[0].blocks[-1].description == \
"A description for this block"
def test_send_with_denomination(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send",
account_id, destination, "0.000000000000000000006 nano"
])
wallet = wallet_loader(wallet_path)
block = wallet.accounts[0].blocks[-1]
assert block.confirmed
assert block.link_as_account == destination
assert block.amount == -6000
data = result["data"]
assert data["hash"] == block.block_hash
assert data["confirmed"]
assert data["has_valid_work"]
assert data["amount"] == "-6000"
assert data["destination"] == destination
assert wallet.accounts[0].balance == 4000
def test_send_spendable_account_required(
self, stdio, wallet_mock_node, wallet_path, wallet_factory,
watching_account_factory):
wallet = wallet_factory(balance=0)
wallet.accounts = []
wallet.add_account(watching_account_factory())
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
wallet_mock_node.start()
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
result = stdio([
"--wallet", wallet_path, "send", account_id,
destination, "1000"
], success=False)
assert result["data"]["error"] == "spendable_account_required"
def test_send_duplicate_txid(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.start()
stdio([
"--wallet", wallet_path, "send", account_id, destination, "5000",
"--txid", "onlyonce"
])
result = stdio([
"--wallet", wallet_path, "send", account_id, destination, "5000",
"--txid", "onlyonce"
], success=False)
assert result["data"]["error"] == "transaction_already_exists"
def test_send_insufficient_balance(
self, wallet_mock_node, stdio, wallet_path, wallet_factory):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send",
account_id, destination, "10001"
], success=False)
assert result["data"]["error"] == "insufficient_balance"
def test_send_nonexistent_source(
self, wallet_mock_node, stdio, wallet_path, wallet_factory):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = \
"xrb_1111111111111111111111111111111111111111111111111111hifc8npp"
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send",
account_id, destination, "10001"
], success=False)
assert result["data"]["error"] == "account_not_found"
def test_send_broadcast_failure(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
wallet_mock_node.fail_broadcast_after(block_count=0)
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send",
account_id, destination, "5000"
], success=False)
assert result["data"]["block_error"] == "source_block_missing"
assert result["data"]["error"] == "block_rejected"
# Rejected block won't be saved
wallet = wallet_loader(wallet_path)
assert wallet.accounts[0].balance == 10000
def test_send_broadcast_timeout(
self, low_difficulty, mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
mock_node.add_replay_datasets(["active_difficulty", "version"]).start()
result = stdio([
"--wallet", wallet_path, "send", account_id, destination, "5000",
"--timeout", "1"
], success=False)
assert result["data"]["error"] == "network_timeout"
# In case of a timeout, the block is still saved to the wallet
wallet = wallet_loader(wallet_path)
assert len(wallet.accounts[0].blocks) == 2
assert wallet.accounts[0].blocks[-1].link_as_account == \
destination
DESTINATION_A = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
DESTINATION_B = \
"xrb_1q7weoyzfw9z4836o11yfjfnqmf953yq8o4hcyp1thdak6xymqup4xczs5n8"
@pytest.mark.add_encrypted_test
class TestSendMany:
def test_send_many(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(
balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send-many",
account_id,
"{},1000".format(DESTINATION_A),
"{},2000".format(DESTINATION_B)
])
wallet = wallet_loader(wallet_path)
block_a = wallet.accounts[0].blocks[-2]
block_b = wallet.accounts[0].blocks[-1]
assert block_a.link_as_account == DESTINATION_A
assert block_a.confirmed
assert block_a.amount == -1000
assert not block_a.description
assert block_b.link_as_account == DESTINATION_B
assert block_b.confirmed
assert block_b.amount == -2000
assert not block_b.description
data = result["data"]
assert data["blocks"][0]["destination"] == DESTINATION_A
assert data["blocks"][0]["amount"] == "-1000"
assert data["blocks"][0]["has_valid_work"]
assert data["blocks"][1]["destination"] == DESTINATION_B
assert data["blocks"][1]["amount"] == "-2000"
assert data["blocks"][1]["has_valid_work"]
assert wallet.accounts[0].balance == 7000
def test_send_many_no_wait(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(
balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send-many",
account_id,
"{},1000".format(DESTINATION_A),
"{},2000".format(DESTINATION_B),
"--no-wait-until-confirmed"
])
wallet = wallet_loader(wallet_path)
block_a = wallet.accounts[0].blocks[-2]
block_b = wallet.accounts[0].blocks[-1]
assert block_a.link_as_account == DESTINATION_A
assert not block_a.confirmed
assert block_a.amount == -1000
assert not block_a.description
assert block_b.link_as_account == DESTINATION_B
assert not block_b.confirmed
assert block_b.amount == -2000
assert not block_b.description
data = result["data"]
assert not data["blocks"][0]["confirmed"]
assert data["blocks"][0]["destination"] == DESTINATION_A
assert data["blocks"][0]["amount"] == "-1000"
assert "block_error" not in data["blocks"][0]
assert not data["blocks"][1]["confirmed"]
assert data["blocks"][1]["destination"] == DESTINATION_B
assert data["blocks"][1]["amount"] == "-2000"
assert "block_error" not in data["blocks"][1]
assert wallet.accounts[0].balance == 7000
def test_send_many_description(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(
balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination_a = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
destination_b = \
"xrb_1q7weoyzfw9z4836o11yfjfnqmf953yq8o4hcyp1thdak6xymqup4xczs5n8"
wallet_mock_node.start()
stdio([
"--wallet", str(wallet_path), "send-many",
account_id,
"{},1000".format(destination_a),
"{},2000".format(destination_b),
"--description", "Test description"
])
wallet = wallet_loader(wallet_path)
block_a = wallet.accounts[0].blocks[-2]
block_b = wallet.accounts[0].blocks[-1]
assert block_a.description == "Test description"
assert block_b.description == "Test description"
def test_send_many_with_denominations(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(
balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination_a = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
destination_b = \
"xrb_1q7weoyzfw9z4836o11yfjfnqmf953yq8o4hcyp1thdak6xymqup4xczs5n8"
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send-many",
account_id,
"{},0.000000000000000000001 nano".format(destination_a),
"{},0.000000000000000000000000002 Mnano".format(destination_b)
])
wallet = wallet_loader(wallet_path)
block_a = wallet.accounts[0].blocks[-2]
block_b = wallet.accounts[0].blocks[-1]
assert block_a.link_as_account == destination_a
assert block_a.confirmed
assert block_a.amount == -1000
assert block_b.link_as_account == destination_b
assert block_b.confirmed
assert block_b.amount == -2000
data = result["data"]
assert data["blocks"][0]["destination"] == destination_a
assert data["blocks"][0]["amount"] == "-1000"
assert data["blocks"][1]["destination"] == destination_b
assert data["blocks"][1]["amount"] == "-2000"
assert wallet.accounts[0].balance == 7000
def test_send_many_spendable_account_required(
self, stdio, wallet_mock_node, wallet_path, wallet_factory,
watching_account_factory):
wallet = wallet_factory(balance=0)
wallet.accounts = []
wallet.add_account(watching_account_factory())
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
wallet_mock_node.start()
destination_a = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
result = stdio([
"--wallet", wallet_path, "send-many", account_id,
"{},1000".format(destination_a)
], success=False)
assert result["data"]["error"] == "spendable_account_required"
def test_send_many_insufficient_balance(
self, wallet_mock_node, stdio, wallet_path, wallet_factory):
wallet = wallet_factory(
balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination_a = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
destination_b = \
"xrb_1q7weoyzfw9z4836o11yfjfnqmf953yq8o4hcyp1thdak6xymqup4xczs5n8"
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send-many",
account_id,
"{},5000".format(destination_a),
"{},5001".format(destination_b)
], success=False)
assert result["data"]["error"] == "insufficient_balance"
def test_send_many_nonexistent_source(
self, wallet_mock_node, stdio, wallet_path, wallet_factory):
wallet = wallet_factory(
balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = \
"xrb_1111111111111111111111111111111111111111111111111111hifc8npp"
destination_a = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
destination_b = \
"xrb_1q7weoyzfw9z4836o11yfjfnqmf953yq8o4hcyp1thdak6xymqup4xczs5n8"
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send-many",
account_id,
"{},5000".format(destination_a),
"{},5001".format(destination_b)
], success=False)
assert result["data"]["error"] == "account_not_found"
def test_send_many_invalid_destination(
self, wallet_mock_node, stdio, wallet_path, wallet_factory):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = \
"xrb_1111111111111111111111111111111111111111111111111111hifc8npp"
result = stdio([
"--wallet", str(wallet_path), "send-many",
account_id, "wrong,1000"
], raw=True)
assert "invalid 'destination': is not a valid account ID" in result
def test_send_many_broadcast_failure(
self, wallet_mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
# Send three transactions and cause the second one to fail,
# which also causes the third one to be rejected
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
destination_a = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
destination_b = \
"xrb_1q7weoyzfw9z4836o11yfjfnqmf953yq8o4hcyp1thdak6xymqup4xczs5n8"
destination_c = \
"xrb_33dd14f3jygie9mkq5s76oo9p1zf8137f1gt65mbsptnktijqb4uzs7hgdkm"
wallet_mock_node.fail_broadcast_after(block_count=1)
wallet_mock_node.start()
result = stdio([
"--wallet", str(wallet_path), "send-many",
account_id,
"{},1000".format(destination_a),
"{},2000".format(destination_b),
"{},3000".format(destination_c)
], success=False)
data = result["data"]
assert data["error"] == "block_rejected"
assert data["blocks"][0]["confirmed"]
assert data["blocks"][1]["block_error"] == "source_block_missing"
assert data["blocks"][2]["block_error"] == "previous_block_rejected"
# Rejected blocks (2nd and 3rd) won't be saved
wallet = wallet_loader(wallet_path)
assert wallet.accounts[0].balance == 9000
assert wallet.accounts[0].blocks[-1].amount == -1000
def test_send_many_broadcast_timeout(
self, mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
mock_node.add_replay_datasets(["active_difficulty", "version"]).start()
account_id = wallet.accounts[0].account_id
destination_a = \
"xrb_36t3jt9g5r33i817oimdpre1fyofoha5j4k4rq6ofokrokigf3q6xfhe6r6m"
destination_b = \
"xrb_1q7weoyzfw9z4836o11yfjfnqmf953yq8o4hcyp1thdak6xymqup4xczs5n8"
result = stdio([
"--wallet", wallet_path, "send-many", account_id,
"{},1000".format(destination_a), "{},2000".format(destination_b),
"--timeout", "1"
], success=False)
assert result["data"]["error"] == "network_timeout"
# The blocks are saved despite the timeout
wallet = wallet_loader(wallet_path)
assert wallet.accounts[0].blocks[-1].link_as_account == \
destination_b
assert wallet.accounts[0].blocks[-2].link_as_account == \
destination_a
@pytest.mark.add_encrypted_test
class TestListAccounts:
def test_list_accounts(self, stdio, wallet_path, wallet_loader):
stdio(["create-wallet", str(wallet_path)])
wallet = wallet_loader(wallet_path)
wallet.accounts[4].name = "Fifth account"
wallet.save(wallet_path)
result = stdio(["--wallet", str(wallet_path), "list-accounts"])
assert len(result["data"]["accounts"]) == 20
assert result["data"]["accounts"][4]["name"] == "Fifth account"
@pytest.mark.add_encrypted_test
class TestGetAccountPrivateKey:
def test_get_account_private_key(
self, stdio, wallet_path, wallet_factory, wallet_loader,
is_encrypted_test):
wallet = wallet_factory()
account_id = wallet.accounts[0].account_id
if is_encrypted_test:
wallet.unlock("password")
private_key = wallet.accounts[0].get_secret(
"private_key", secret_key=wallet.secret_key
)
wallet.lock()
else:
private_key = wallet.accounts[0].private_key
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "get-account-private-key",
account_id
])
assert result["data"]["account_id"] == account_id
assert result["data"]["private_key"] == private_key
def test_get_account_private_key_account_not_found(
self, stdio, wallet_path, wallet_factory):
wallet = wallet_factory()
wallet.save(wallet_path)
account_id = \
"xrb_1111111111111111111111111111111111111111111111111111hifc8npp"
result = stdio([
"--wallet", wallet_path, "get-account-private-key",
account_id
], success=False)
assert result["data"]["error"] == "account_not_found"
def test_get_account_private_key_watching_account(
self, stdio, wallet_path, wallet_factory):
wallet = wallet_factory()
account_id = wallet.accounts[0].account_id
wallet.accounts[0].private_key = None
wallet.accounts[0].source = AccountSource.WATCHING
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "get-account-private-key",
account_id
], success=False)
assert result["data"]["error"] == "spendable_account_required"
@pytest.mark.add_encrypted_test
class TestListBlocks:
@pytest.fixture(scope="function")
def active_wallet(self, wallet_factory, account_factory):
wallet = wallet_factory(balance=0)
wallet.accounts = []
wallet.add_account(
account_factory(
balance=500, block_count=50, complete=True, confirm=True
)
)
return wallet
def test_list_blocks(
self, stdio, wallet_path, active_wallet):
wallet = active_wallet
account = wallet.accounts[0]
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "list-blocks", account.account_id,
"--limit", "20"
])
data = result["data"]
assert data["count"] == 50
assert len(data["blocks"]) == 20
# By default, the blocks are returned in descending order
# eg. starting from newest to oldest blocks
assert data["blocks"][0]["hash"] == account.blocks[49].block_hash
assert data["blocks"][1]["hash"] == account.blocks[48].block_hash
assert data["blocks"][0]["balance"] == "500"
assert data["blocks"][0]["amount"] == "10"
def test_list_blocks_ascending(
self, stdio, wallet_path, active_wallet):
wallet = active_wallet
account = wallet.accounts[0]
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "list-blocks", account.account_id,
"--limit", "20", "--no-descending"
])
data = result["data"]
assert data["count"] == 50
assert len(data["blocks"]) == 20
assert data["blocks"][0]["hash"] == account.blocks[0].block_hash
assert data["blocks"][1]["hash"] == account.blocks[1].block_hash
assert data["blocks"][0]["balance"] == "10"
assert data["blocks"][0]["amount"] == "10"
def test_list_blocks_empty(
self, stdio, zero_balance_wallet, wallet_path):
# Empty accounts return an empty list
wallet = zero_balance_wallet
wallet.save(wallet_path)
account_id = wallet.accounts[0].account_id
result = stdio([
"--wallet", wallet_path, "list-blocks", account_id
])
assert result["data"]["count"] == 0
assert len(result["data"]["blocks"]) == 0
def test_list_blocks_offset(self, stdio, wallet_path, active_wallet):
wallet = active_wallet
account = wallet.accounts[0]
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "list-blocks", account.account_id,
"--offset", "5", "--limit", "20"
])
data = result["data"]
assert len(data["blocks"]) == 20
assert data["blocks"][0]["hash"] == account.blocks[44].block_hash
assert data["blocks"][1]["hash"] == account.blocks[43].block_hash
def test_list_blocks_ascending_offset(
self, stdio, wallet_path, active_wallet):
wallet = active_wallet
account = wallet.accounts[0]
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "list-blocks", account.account_id,
"--offset", "5", "--limit", "20", "--no-descending"
])
data = result["data"]
assert len(data["blocks"]) == 20
assert data["blocks"][0]["hash"] == account.blocks[5].block_hash
assert data["blocks"][1]["hash"] == account.blocks[6].block_hash
def test_list_blocks_offset_empty(
self, stdio, wallet_path, active_wallet):
# If an offset higher than the amount of blocks is given,
# return an empty list
wallet = active_wallet
account = wallet.accounts[0]
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "list-blocks", account.account_id,
"--offset", "50"
])
assert len(result["data"]["blocks"]) == 0
def test_list_blocks_offset_ascending_empty(
self, stdio, wallet_path, active_wallet):
wallet = active_wallet
account = wallet.accounts[0]
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "list-blocks", account.account_id,
"--offset", "50", "--no-descending"
])
assert len(result["data"]["blocks"]) == 0
@pytest.mark.add_encrypted_test
class TestGetBlock:
def test_get_block(self, stdio, wallet_factory, wallet_path):
wallet = wallet_factory(balance=10000, confirmed=True)
block = wallet.accounts[0].blocks[0]
block.description = "This is a test block"
block_hash = block.block_hash
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "get-block", block_hash
])
data = result["data"]
assert data["hash"] == block_hash
assert data["confirmed"]
assert not data["is_link_block"]
assert data["description"] == "This is a test block"
assert data["amount"] == "10000"
assert data["balance"] == "10000"
assert data["timestamp"]["date"].isdigit()
assert data["block_data"]["account"] == block.account
def test_get_block_block_not_found(
self, stdio, wallet_factory, wallet_path):
wallet = wallet_factory(balance=10000, confirmed=True)
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "get-block", "A"*64
], success=False)
assert result["data"]["error"] == "block_not_found"
def test_get_block_link_block(self, stdio, wallet_factory, wallet_path):
wallet = wallet_factory(balance=10000, confirmed=True)
block = wallet.accounts[0].blocks[0]
block_hash = block.link_block.block_hash
wallet.save(wallet_path)
result = stdio(["--wallet", wallet_path, "get-block", block_hash])
data = result["data"]
assert data["hash"] == block_hash
assert data["confirmed"]
assert data["is_link_block"]
assert data["amount"] == "-10000"
assert data["timestamp"]["date"].isdigit()
assert data["block_data"]["account"] == block.link_block.account
@pytest.mark.add_encrypted_test
class TestSetAccountName:
def test_set_account_name(
self, stdio, wallet_factory, wallet_path, wallet_loader):
wallet = wallet_factory()
account_id = wallet.accounts[3].account_id
wallet.save(str(wallet_path))
result = stdio([
"--wallet", str(wallet_path), "set-account-name",
account_id, "Account number four"
])
assert result["data"]["account_id"] == account_id
assert result["data"]["name"] == "Account number four"
wallet = wallet_loader(str(wallet_path))
assert wallet.accounts[3].name == "Account number four"
def test_set_account_name_account_not_found(
self, stdio, wallet_factory, wallet_path):
wallet = wallet_factory()
wallet.save(str(wallet_path))
result = stdio([
"--wallet", str(wallet_path), "set-account-name",
"xrb_1111111111111111111111111111111111111111111111111111hifc8npp",
"Nonexistent account"
], success=False)
assert result["data"]["error"] == "account_not_found"
@pytest.mark.add_encrypted_test
class TestClearAccountName:
def test_clear_account_name(
self, stdio, zero_balance_wallet, wallet_path, wallet_loader):
wallet = zero_balance_wallet
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
stdio([
"--wallet", str(wallet_path), "set-account-name",
account_id, "Test name"
])
# If 'name' is not provided, the name is removed
result = stdio([
"--wallet", str(wallet_path), "clear-account-name",
account_id
])
assert result["data"]["account_id"] == account_id
wallet = wallet_loader(wallet_path)
assert not wallet.accounts[0].name
def test_clear_account_name_account_not_found(
self, stdio, wallet_factory, wallet_path):
wallet = wallet_factory()
wallet.save(str(wallet_path))
result = stdio([
"--wallet", str(wallet_path), "clear-account-name",
"xrb_1111111111111111111111111111111111111111111111111111hifc8npp",
], success=False)
assert result["data"]["error"] == "account_not_found"
@pytest.mark.add_encrypted_test
class TestSetBlockDescription:
def test_set_block_description(
self, stdio, wallet_factory, wallet_loader, wallet_path):
wallet = wallet_factory(balance=1000)
account_id = wallet.accounts[0].account_id
block_hash = wallet.accounts[0].blocks[0].block_hash
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "set-block-description",
block_hash, "Test description"
])
data = result["data"]
assert data["account_id"] == account_id
assert data["hash"] == block_hash
assert data["description"] == "Test description"
wallet = wallet_loader(wallet_path)
assert wallet.accounts[0].blocks[0].description == "Test description"
def test_set_block_no_link_block(
self, stdio, wallet_factory, wallet_loader, wallet_path):
wallet = wallet_factory(balance=1000)
block_hash = wallet.accounts[0].blocks[0].link_block.block_hash
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "set-block-description",
block_hash, "Test description"
], success=False)
assert result["data"]["error"] == "link_block_not_allowed"
def test_set_block_missing_block(
self, stdio, wallet_factory, wallet_loader, wallet_path):
wallet = wallet_factory(balance=1000)
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "set-block-description",
"a"*64, "Test description"
], success=False)
assert result["data"]["error"] == "block_not_found"
@pytest.mark.add_encrypted_test
class TestClearBlockDescription:
def test_clear_block_description(
self, stdio, wallet_factory, wallet_loader, wallet_path):
wallet = wallet_factory(balance=1000)
wallet.accounts[0].blocks[0].description = "Test description"
block_hash = wallet.accounts[0].blocks[0].block_hash
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "clear-block-description",
block_hash
])
assert result["data"]["hash"] == block_hash
wallet = wallet_loader(wallet_path)
assert not wallet.accounts[0].blocks[0].description
def test_clear_block_description_no_link_block(
self, stdio, wallet_factory, wallet_loader, wallet_path):
wallet = wallet_factory(balance=1000)
block_hash = wallet.accounts[0].blocks[0].link_block.block_hash
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "clear-block-description",
block_hash
], success=False)
assert result["data"]["error"] == "link_block_not_allowed"
def test_clear_block_description_missing_block(
self, stdio, wallet_factory, wallet_loader, wallet_path):
wallet = wallet_factory(balance=1000)
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "clear-block-description",
"a"*64
], success=False)
assert result["data"]["error"] == "block_not_found"
@pytest.mark.add_encrypted_test
class TestAddToAddressBook:
def test_add_to_address_book(
self, stdio, wallet_path, wallet_loader, empty_wallet):
wallet = empty_wallet
wallet.save(wallet_path)
account_id = \
"xrb_1osyg4d5oshdzbxsnshk6er6sfk7ufjjh645ecob7ydo3r4e4jqd5yucuyja"
result = stdio([
"--wallet", wallet_path, "add-to-address-book", account_id,
"Test name"
])
assert result["data"]["account_id"] == account_id
assert result["data"]["name"] == "Test name"
wallet = wallet_loader(wallet_path)
assert wallet.address_book[account_id] == "Test name"
@pytest.mark.add_encrypted_test
class TestRemoveFromAddressBook:
def test_remove_from_address_book(
self, stdio, wallet_path, wallet_loader, empty_wallet):
account_id = \
"xrb_1osyg4d5oshdzbxsnshk6er6sfk7ufjjh645ecob7ydo3r4e4jqd5yucuyja"
wallet = empty_wallet
wallet.save(wallet_path)
stdio([
"--wallet", wallet_path, "add-to-address-book", account_id,
"Test name"
])
result = stdio([
"--wallet", wallet_path, "remove-from-address-book", account_id
])
assert result["data"]["account_id"] == account_id
wallet = wallet_loader(wallet_path)
assert account_id not in wallet.address_book
def test_remove_from_address_book_account_not_found(
self, stdio, wallet_path, wallet_loader, empty_wallet):
account_id = \
"xrb_1osyg4d5oshdzbxsnshk6er6sfk7ufjjh645ecob7ydo3r4e4jqd5yucuyja"
wallet = empty_wallet
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "remove-from-address-book", account_id
], success=False)
assert result["data"]["error"] == "account_not_found"
REPRESENTATIVE = \
"xrb_3t5uq974om59rwcs7wij5kis5e15tbgxe6ip6nu77jzs1n8b65hobnqdede8"
@pytest.mark.add_encrypted_test
class TestChangeAccountRepresentative:
def test_change_account_representative_empty_account(
self, stdio, wallet_path, wallet_loader, wallet_factory):
wallet = wallet_factory(balance=0)
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "change-account-representative",
account_id, REPRESENTATIVE
])
assert result["data"]["account_id"] == account_id
assert result["data"]["representative"] == REPRESENTATIVE
wallet = wallet_loader(wallet_path)
assert wallet.accounts[0].representative == REPRESENTATIVE
assert not wallet.accounts[0].blocks
def test_change_account_representative_with_confirmed_block(
self, stdio, wallet_mock_node, wallet_path, wallet_loader,
wallet_factory):
wallet = wallet_factory(balance=1000, confirmed=True)
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
wallet_mock_node.start()
result = stdio([
"--wallet", wallet_path, "change-account-representative",
account_id, REPRESENTATIVE, "--wait-until-confirmed"
])
data = result["data"]
assert data["account_id"] == account_id
assert data["confirmed"]
wallet = wallet_loader(wallet_path)
assert wallet.accounts[0].representative == REPRESENTATIVE
block = wallet.accounts[0].blocks[-1]
assert block.tx_type == "change"
assert data["hash"] == block.block_hash
def test_change_account_representative_without_confirmed_block(
self, stdio, wallet_path, wallet_loader, wallet_factory):
wallet = wallet_factory(balance=1000, confirmed=True)
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "change-account-representative",
account_id, REPRESENTATIVE
])
data = result["data"]
assert data["account_id"] == account_id
assert not data["confirmed"]
wallet = wallet_loader(wallet_path)
assert wallet.accounts[0].representative == REPRESENTATIVE
block = wallet.accounts[0].blocks[-1]
assert block.tx_type == "change"
assert data["hash"] == block.block_hash
def test_change_account_representative_with_failed_block(
self, stdio, wallet_mock_node, wallet_path, wallet_loader,
wallet_factory):
wallet = wallet_factory(balance=1000, confirmed=True)
account_id = wallet.accounts[0].account_id
original_representative = wallet.accounts[0].representative
wallet.save(wallet_path)
wallet_mock_node.fail_broadcast_after(block_count=0)
wallet_mock_node.start()
result = stdio([
"--wallet", wallet_path, "change-account-representative",
account_id, REPRESENTATIVE, "--wait-until-confirmed"
], success=False)
data = result["data"]
assert data["block_error"] == "source_block_missing"
assert data["error"] == "block_rejected"
assert not data["confirmed"]
assert "hash" not in data
wallet = wallet_loader(wallet_path)
assert len(wallet.accounts[0].blocks) == 1
assert wallet.accounts[0].representative == original_representative
def test_change_account_representative_with_timed_out_block(
self, mock_node, stdio, wallet_path, wallet_factory,
wallet_loader):
wallet = wallet_factory(balance=1000, confirmed=True)
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
mock_node.add_replay_datasets(["active_difficulty", "version"]).start()
result = stdio([
"--wallet", wallet_path, "change-account-representative",
account_id, REPRESENTATIVE, "--wait-until-confirmed",
"--timeout", "1"
], success=False)
data = result["data"]
assert data["block_error"] == "timeout"
assert data["error"] == "network_timeout"
wallet = wallet_loader(wallet_path)
# The timed out block is still saved
assert len(wallet.accounts[0].blocks) == 2
assert wallet.accounts[0].representative == REPRESENTATIVE
def test_change_account_representative_account_not_found(
self, stdio, empty_wallet, wallet_path):
empty_wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "change-account-representative",
"xrb_1111111111111111111111111111111111111111111111111111hifc8npp",
REPRESENTATIVE
], success=False)
assert result["data"]["error"] == "account_not_found"
def test_change_account_representative_spendable_account_required(
self, stdio, empty_wallet, wallet_path, watching_account_factory):
wallet = empty_wallet
wallet.add_account(watching_account_factory())
account_id = wallet.accounts[0].account_id
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "change-account-representative",
account_id, REPRESENTATIVE
], success=False)
assert result["data"]["error"] == "spendable_account_required"
@pytest.mark.add_encrypted_test
class TestListAddressBook:
def test_list_address_book(
self, stdio, wallet_factory, wallet_path, wallet_loader):
wallet = wallet_factory()
wallet.add_to_address_book(DESTINATION_A, "Destination 1")
wallet.add_to_address_book(DESTINATION_B, "Destination 2")
wallet.save(wallet_path)
result = stdio([
"--wallet", wallet_path, "list-address-book"
])
data = result["data"]
assert len(data["addresses"]) == 2
assert data["count"] == 2
assert data["addresses"][DESTINATION_A] == "Destination 1"
assert data["addresses"][DESTINATION_B] == "Destination 2"
| 34.848011
| 168
| 0.626245
| 7,513
| 73,599
| 5.874351
| 0.050446
| 0.07092
| 0.034667
| 0.033987
| 0.801967
| 0.759415
| 0.715888
| 0.679408
| 0.636493
| 0.610414
| 0
| 0.061206
| 0.265873
| 73,599
| 2,111
| 169
| 34.864519
| 0.755622
| 0.024321
| 0
| 0.674051
| 0
| 0
| 0.183582
| 0.086987
| 0
| 0
| 0
| 0
| 0.194937
| 1
| 0.058228
| false
| 0.012025
| 0.005063
| 0
| 0.079114
| 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
|
801b4dd2ecf29e7d5ba4349a775cdaacc33b708a
| 1,418
|
py
|
Python
|
InvenTree/part/settings.py
|
onurtatli/InvenTree
|
4ce479cf97cc62563ab08ed6123d3c6ca28ba6a3
|
[
"MIT"
] | null | null | null |
InvenTree/part/settings.py
|
onurtatli/InvenTree
|
4ce479cf97cc62563ab08ed6123d3c6ca28ba6a3
|
[
"MIT"
] | null | null | null |
InvenTree/part/settings.py
|
onurtatli/InvenTree
|
4ce479cf97cc62563ab08ed6123d3c6ca28ba6a3
|
[
"MIT"
] | null | null | null |
"""
User-configurable settings for the Part app
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from common.models import InvenTreeSetting
def part_assembly_default():
"""
Returns the default value for the 'assembly' field of a Part object
"""
return InvenTreeSetting.get_setting('PART_ASSEMBLY')
def part_template_default():
"""
Returns the default value for the 'is_template' field of a Part object
"""
return InvenTreeSetting.get_setting('PART_TEMPLATE')
def part_virtual_default():
"""
Returns the default value for the 'is_virtual' field of Part object
"""
return InvenTreeSetting.get_setting('PART_VIRTUAL')
def part_component_default():
"""
Returns the default value for the 'component' field of a Part object
"""
return InvenTreeSetting.get_setting('PART_COMPONENT')
def part_purchaseable_default():
"""
Returns the default value for the 'purchasable' field for a Part object
"""
return InvenTreeSetting.get_setting('PART_PURCHASEABLE')
def part_salable_default():
"""
Returns the default value for the 'salable' field for a Part object
"""
return InvenTreeSetting.get_setting('PART_SALABLE')
def part_trackable_default():
"""
Returns the defualt value fro the 'trackable' field for a Part object
"""
return InvenTreeSetting.get_setting('PART_TRACKABLE')
| 21.815385
| 75
| 0.71086
| 175
| 1,418
| 5.56
| 0.228571
| 0.043165
| 0.122302
| 0.230216
| 0.603289
| 0.603289
| 0.603289
| 0.412127
| 0.336074
| 0.336074
| 0
| 0.00088
| 0.198166
| 1,418
| 64
| 76
| 22.15625
| 0.854881
| 0.389281
| 0
| 0
| 0
| 0
| 0.126162
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4375
| true
| 0
| 0.125
| 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
| 1
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
80271f3d6310bf220424190d5f1d4daa92fd1369
| 792
|
py
|
Python
|
app/controller/ponto_verificacao_controller.py
|
Alfser/webservice-paem
|
ca018e98a04c62fc2da391ba9c835fb697dc17ff
|
[
"Apache-2.0"
] | null | null | null |
app/controller/ponto_verificacao_controller.py
|
Alfser/webservice-paem
|
ca018e98a04c62fc2da391ba9c835fb697dc17ff
|
[
"Apache-2.0"
] | null | null | null |
app/controller/ponto_verificacao_controller.py
|
Alfser/webservice-paem
|
ca018e98a04c62fc2da391ba9c835fb697dc17ff
|
[
"Apache-2.0"
] | 3
|
2021-07-06T17:46:06.000Z
|
2021-07-27T19:49:16.000Z
|
from ..model import PontoVerificacaoModel
from .base_controller import BaseHasUsuarioController, BaseHasNameController
class PontoVerificacaoController(BaseHasUsuarioController, BaseHasNameController):
@classmethod
def get(cls, id_usuario):
return super().get(id_usuario, PontoVerificacaoModel)
@classmethod
def post(cls, body, usuario):
return super().post(body, PontoVerificacaoModel, usuario=usuario)
@classmethod
def put(cls, body):
return super().put(body, PontoVerificacaoModel)
@classmethod
def delete(cls, id_ponto_verificacao):
return super().delete(id_ponto_verificacao, PontoVerificacaoModel)
@classmethod
def get_list(cls):
return super().get_all_names(PontoVerificacaoModel)
| 29.333333
| 82
| 0.728535
| 74
| 792
| 7.662162
| 0.364865
| 0.123457
| 0.185185
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190657
| 792
| 26
| 83
| 30.461538
| 0.884555
| 0
| 0
| 0.277778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.277778
| false
| 0
| 0.111111
| 0.277778
| 0.722222
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
8038cf12556598d9836724e314c50180d3f10d89
| 29,202
|
py
|
Python
|
Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/TypeInfo/FundamentalTypes/Serialization/UnitTests/StringSerialization_UnitTest.py
|
davidbrownell/v3-Common_Environment
|
8f42f256e573cbd83cbf9813db9958025ddf12f2
|
[
"BSL-1.0"
] | null | null | null |
Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/TypeInfo/FundamentalTypes/Serialization/UnitTests/StringSerialization_UnitTest.py
|
davidbrownell/v3-Common_Environment
|
8f42f256e573cbd83cbf9813db9958025ddf12f2
|
[
"BSL-1.0"
] | 1
|
2018-06-08T06:45:16.000Z
|
2018-06-08T06:45:16.000Z
|
Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/TypeInfo/FundamentalTypes/Serialization/UnitTests/StringSerialization_UnitTest.py
|
davidbrownell/v3-Common_Environment
|
8f42f256e573cbd83cbf9813db9958025ddf12f2
|
[
"BSL-1.0"
] | 1
|
2018-06-08T04:15:17.000Z
|
2018-06-08T04:15:17.000Z
|
# ----------------------------------------------------------------------
# |
# | StringSerialization_UnitTest.py
# |
# | David Brownell <db@DavidBrownell.com>
# | 2018-04-26 22:06:18
# |
# ----------------------------------------------------------------------
# |
# | Copyright David Brownell 2018-22.
# | Distributed under the Boost Software License, Version 1.0.
# | (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# |
# ----------------------------------------------------------------------
# """Unit test for StringSerialization.py"""
import datetime
import os
import re
import sys
import unittest
import uuid
import CommonEnvironment
from CommonEnvironment.TypeInfo.FundamentalTypes.All import *
from CommonEnvironment.TypeInfo.FundamentalTypes.Serialization.StringSerialization import RegularExpressionVisitor, \
StringSerialization, \
ValidationException
# ----------------------------------------------------------------------
_script_fullpath = CommonEnvironment.ThisFullpath()
_script_dir, _script_name = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
class RegularExpressionVisitorSuite(unittest.TestCase):
# ----------------------------------------------------------------------
def test_Standard(self):
# ----------------------------------------------------------------------
def Test(method, to_match, regex_index=0):
if not isinstance(to_match, list):
to_match = [ to_match, ]
regex_string = method()[regex_index]
if isinstance(regex_string, tuple):
regex_string, regex_options = regex_string
else:
regex_options = 0
regex = re.compile("^{}$".format(regex_string), regex_options)
for index, query in enumerate(to_match):
self.assertTrue(regex.match(query), "{} did not match {} ({})".format(query, regex_string, index))
# ----------------------------------------------------------------------
Test(lambda: RegularExpressionVisitor.OnBool(None), [ "True", "T", "t", "Yes", "yes", "Y", "y", "1", "False", "false", "F", "f", "No", "no", "N", "n", "0", ])
Test(lambda: RegularExpressionVisitor.OnDateTime(None), [ "2018-04-26 22:29:00", "2018-04-26T22:29:00", "2018-04-26T22:29:00Z", "2018-04-26T22:29:00+08:00", "2018-04-26T22:29:00-10:34", ])
Test(lambda: RegularExpressionVisitor.OnDate(None), [ "2018-04-26", "2018/04/26", "2018.04.26", ], regex_index=0)
Test(lambda: RegularExpressionVisitor.OnDate(None), [ "04-26-2018", "04/26/2018", "04.26.2018", ], regex_index=1)
Test(lambda: RegularExpressionVisitor.OnDate(None), [ "18-04-26", "18/04/26", "18.04.26", ], regex_index=2)
Test(lambda: RegularExpressionVisitor.OnDate(None), [ "04-26-18", "04/26/18", "04.26.18", ], regex_index=3)
Test(lambda: RegularExpressionVisitor.OnDirectory(None), "anything")
Test(lambda: RegularExpressionVisitor.OnDuration(None), [ "1.0:00:00.0", "1:0:00:00.0", "1.00:00:00", "1:00:00.0", "23:22:21", "23:22:21.20", ], regex_index=0)
Test(lambda: RegularExpressionVisitor.OnDuration(None), [ "P1Y", "P1MT2H", "PT1M", ], regex_index=1)
Test(lambda: RegularExpressionVisitor.OnDuration(None), [ "1", "1.2345", "3.4", ], regex_index=2)
Test(lambda: RegularExpressionVisitor.OnEnum(EnumTypeInfo([ "one", "two", ])), [ "one", "two", ])
Test(lambda: RegularExpressionVisitor.OnFilename(None), "anything")
Test(lambda: RegularExpressionVisitor.OnFloat(FloatTypeInfo()), [ "0.0", "10.2", "-3.14", ])
Test(lambda: RegularExpressionVisitor.OnGuid(None), "{54465641-ADF2-43B1-98EB-66BBD208622C}", regex_index=0)
Test(lambda: RegularExpressionVisitor.OnGuid(None), "54465641-ADF2-43B1-98EB-66BBD208622C", regex_index=1)
Test(lambda: RegularExpressionVisitor.OnGuid(None), "{54465641ADF243B198EB66BBD208622C}", regex_index=2)
Test(lambda: RegularExpressionVisitor.OnGuid(None), "54465641ADF243B198EB66BBD208622C", regex_index=3)
Test(lambda: RegularExpressionVisitor.OnInt(IntTypeInfo()), [ "-10", "10", "0", "20", ])
Test(lambda: RegularExpressionVisitor.OnString(StringTypeInfo()), [ "test", "again", "and another", ])
Test(lambda: RegularExpressionVisitor.OnTime(None), [ "11:22:33", "11:22:33.44", "11:22:33", ])
Test(lambda: RegularExpressionVisitor.OnUri(None), "http://one.two.three")
# ----------------------------------------------------------------------
def test_Float(self):
self.assertFalse(re.match("^{}$".format(RegularExpressionVisitor.OnFloat(FloatTypeInfo(min=0))[0]), "-3.0"))
self.assertFalse(re.match("^{}$".format(RegularExpressionVisitor.OnFloat(FloatTypeInfo(max=0))[0]), "3.0"))
self.assertFalse(re.match("^{}$".format(RegularExpressionVisitor.OnFloat(FloatTypeInfo(min=0, max=10))[0]), "130.01234"))
# ----------------------------------------------------------------------
def test_Int(self):
self.assertFalse(re.match("^{}$".format(RegularExpressionVisitor.OnInt(IntTypeInfo(min=0))[0]), "-3"))
self.assertFalse(re.match("^{}$".format(RegularExpressionVisitor.OnInt(IntTypeInfo(max=0))[0]), "3"))
self.assertFalse(re.match("^{}$".format(RegularExpressionVisitor.OnInt(IntTypeInfo(min=0, max=9))[0]), "130"))
# ----------------------------------------------------------------------
def test_String(self):
regex = re.compile("^{}$".format(RegularExpressionVisitor.OnString(StringTypeInfo(min_length=2))[0]))
self.assertTrue(regex.match("123"))
self.assertTrue(regex.match("12"))
self.assertFalse(regex.match("1"))
regex = re.compile("^{}$".format(RegularExpressionVisitor.OnString(StringTypeInfo(max_length=2))[0]))
self.assertTrue(regex.match("12"))
self.assertFalse(regex.match("123"))
regex = re.compile("^{}$".format(RegularExpressionVisitor.OnString(StringTypeInfo(min_length=2, max_length=3))[0]))
self.assertTrue(regex.match("123"))
self.assertTrue(regex.match("12"))
self.assertFalse(regex.match("1234"))
self.assertFalse(regex.match("1"))
regex = re.compile("^{}$".format(RegularExpressionVisitor.OnString(StringTypeInfo(validation_expression=".est"))[0]))
self.assertTrue(regex.match("test"))
self.assertTrue(regex.match("Test"))
self.assertTrue(regex.match("jest"))
self.assertFalse(regex.match("tEst"))
# ----------------------------------------------------------------------
class SerializationSuite(unittest.TestCase):
# ----------------------------------------------------------------------
def test_Bool(self):
self.assertEqual(StringSerialization.SerializeItem(BoolTypeInfo(), True), "True")
self.assertEqual(StringSerialization.SerializeItem(BoolTypeInfo(), False), "False")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(BoolTypeInfo(), "this is not a bool"))
# ----------------------------------------------------------------------
def test_DateTime(self):
self.assertEqual(StringSerialization.SerializeItem(DateTimeTypeInfo(), datetime.datetime(year=2018, month=4, day=28, hour=14, minute=46, second=12)), "2018-04-28 14:46:12")
self.assertEqual(StringSerialization.SerializeItem(DateTimeTypeInfo(), datetime.datetime(year=2018, month=4, day=28, hour=14, minute=46, second=12), sep='T'), "2018-04-28T14:46:12")
self.assertEqual(StringSerialization.SerializeItem(DateTimeTypeInfo(), datetime.datetime(year=2018, month=4, day=28, hour=14, minute=46, second=12, microsecond=3939)), "2018-04-28 14:46:12.003939")
self.assertEqual(StringSerialization.SerializeItem(DateTimeTypeInfo(), datetime.datetime(year=2018, month=4, day=28, hour=14, minute=46, second=12, microsecond=3939), microseconds=False), "2018-04-28 14:46:12")
self.assertEqual(StringSerialization.SerializeItem(DateTimeTypeInfo(), datetime.datetime(year=2018, month=4, day=28, hour=14, minute=46, second=12), regex_index=1), "@1524951972.0 00:00")
self.assertEqual(StringSerialization.SerializeItem(DateTimeTypeInfo(), datetime.datetime(year=2018, month=4, day=28, hour=14, minute=46, second=12), regex_index=2), "1524951972.0")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(DateTimeTypeInfo(), "this is not a datetime"))
# ----------------------------------------------------------------------
def test_Date(self):
self.assertEqual(StringSerialization.SerializeItem(DateTypeInfo(), datetime.date(year=2018, month=4, day=28)), "2018-04-28")
self.assertEqual(StringSerialization.SerializeItem(DateTypeInfo(), datetime.date(year=2018, month=4, day=28), regex_index=1), "04-28-2018")
self.assertEqual(StringSerialization.SerializeItem(DateTypeInfo(), datetime.date(year=2018, month=4, day=28), regex_index=2), "18-04-28")
self.assertEqual(StringSerialization.SerializeItem(DateTypeInfo(), datetime.date(year=2018, month=4, day=28), regex_index=3), "04-28-18")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(DateTypeInfo(), "this is not a valid date"))
# ----------------------------------------------------------------------
def test_Directory(self):
self.assertEqual(StringSerialization.SerializeItem(DirectoryTypeInfo(ensure_exists=False), os.path.join("foo", "bar")), "foo/bar")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(DirectoryTypeInfo(), os.path.join("foo", "bar")))
# ----------------------------------------------------------------------
def test_Duration(self):
self.assertEqual(StringSerialization.SerializeItem(DurationTypeInfo(), datetime.timedelta(hours=2)), "2:00:00")
self.assertEqual(StringSerialization.SerializeItem(DurationTypeInfo(), datetime.timedelta(days=1, hours=2)), "1.02:00:00")
self.assertEqual(StringSerialization.SerializeItem(DurationTypeInfo(), datetime.timedelta(days=1, hours=2), regex_index=1), "P1DT2H0M0S")
self.assertEqual(StringSerialization.SerializeItem(DurationTypeInfo(), datetime.timedelta(days=1, hours=2), sep=':'), "1:02:00:00")
self.assertEqual(StringSerialization.SerializeItem(DurationTypeInfo(), datetime.timedelta(days=1, hours=2, microseconds=3456)), "1.02:00:00.003456")
self.assertEqual(StringSerialization.SerializeItem(DurationTypeInfo(), datetime.timedelta(hours=2), regex_index=2), "7200")
self.assertEqual(StringSerialization.SerializeItem(DurationTypeInfo(), datetime.timedelta(hours=2, microseconds=3456), regex_index=2), "7200.003456")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(DurationTypeInfo(), "this is not a valid duration"))
# ----------------------------------------------------------------------
def test_Enum(self):
self.assertEqual(StringSerialization.SerializeItem(EnumTypeInfo([ "one", "two", ]), "one"), "one")
self.assertEqual(StringSerialization.SerializeItem(EnumTypeInfo([ "one", "two", ]), "two"), "two")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(EnumTypeInfo([ "one", "two", ]), "three"))
# ----------------------------------------------------------------------
def test_Filename(self):
self.assertEqual(StringSerialization.SerializeItem(FilenameTypeInfo(ensure_exists=False), os.path.join("foo", "bar")), "foo/bar")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(FilenameTypeInfo(), os.path.join("foo", "bar")))
# ----------------------------------------------------------------------
def test_Float(self):
self.assertEqual(StringSerialization.SerializeItem(FloatTypeInfo(), -10.5), "-10.5")
self.assertEqual(StringSerialization.SerializeItem(FloatTypeInfo(), 10), "10")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(FloatTypeInfo(), "this is not a valid float"))
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(FloatTypeInfo(min=0), -10))
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(FloatTypeInfo(max=10), 20))
# ----------------------------------------------------------------------
def test_Guid(self):
self.assertEqual(StringSerialization.SerializeItem(GuidTypeInfo(), uuid.UUID("363D3427-1871-40C5-83DF-3C9D5CE7B60D")), "{363D3427-1871-40C5-83DF-3C9D5CE7B60D}".lower())
self.assertEqual(StringSerialization.SerializeItem(GuidTypeInfo(), uuid.UUID("363D3427-1871-40C5-83DF-3C9D5CE7B60D"), regex_index=1), "363D3427-1871-40C5-83DF-3C9D5CE7B60D".lower())
self.assertEqual(StringSerialization.SerializeItem(GuidTypeInfo(), uuid.UUID("363D3427-1871-40C5-83DF-3C9D5CE7B60D"), regex_index=2), "{363D3427187140C583DF3C9D5CE7B60D}".lower())
self.assertEqual(StringSerialization.SerializeItem(GuidTypeInfo(), uuid.UUID("363D3427-1871-40C5-83DF-3C9D5CE7B60D"), regex_index=3), "363D3427187140C583DF3C9D5CE7B60D".lower())
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(GuidTypeInfo(), "this is not a valid guid"))
# ----------------------------------------------------------------------
def test_Int(self):
self.assertEqual(StringSerialization.SerializeItem(IntTypeInfo(), 20), "20")
self.assertEqual(StringSerialization.SerializeItem(IntTypeInfo(), -20), "-20")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(IntTypeInfo(), "this is not a valid int"))
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(IntTypeInfo(min=0), -10))
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(IntTypeInfo(max=10), 20))
# ----------------------------------------------------------------------
def test_String(self):
self.assertEqual(StringSerialization.SerializeItem(StringTypeInfo(), "test"), "test")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(StringTypeInfo(), 10))
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(StringTypeInfo(min_length=2), "1"))
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(StringTypeInfo(max_length=2), "123"))
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(StringTypeInfo(validation_expression="test"), "TEST"))
# ----------------------------------------------------------------------
def test_Time(self):
self.assertEqual(StringSerialization.SerializeItem(TimeTypeInfo(), datetime.time(hour=15, minute=15, second=12)), "15:15:12")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(TimeTypeInfo(), "this is not a valid time"))
# ----------------------------------------------------------------------
def test_Uri(self):
self.assertEqual(StringSerialization.SerializeItem(UriTypeInfo(), Uri.FromString("https://foo.bar.baz")), "https://foo.bar.baz")
self.assertRaises(ValidationException, lambda: StringSerialization.SerializeItem(UriTypeInfo(), "this is not a valid uri"))
# ----------------------------------------------------------------------
class DeserializationSuite(unittest.TestCase):
# ----------------------------------------------------------------------
def test_Bool(self):
self.assertTrue(StringSerialization.DeserializeItem(BoolTypeInfo(), "true"))
self.assertTrue(StringSerialization.DeserializeItem(BoolTypeInfo(), "t"))
self.assertTrue(StringSerialization.DeserializeItem(BoolTypeInfo(), "yes"))
self.assertTrue(StringSerialization.DeserializeItem(BoolTypeInfo(), "y"))
self.assertTrue(StringSerialization.DeserializeItem(BoolTypeInfo(), "1"))
self.assertFalse(StringSerialization.DeserializeItem(BoolTypeInfo(), "false"))
self.assertFalse(StringSerialization.DeserializeItem(BoolTypeInfo(), "f"))
self.assertFalse(StringSerialization.DeserializeItem(BoolTypeInfo(), "no"))
self.assertFalse(StringSerialization.DeserializeItem(BoolTypeInfo(), "n"))
self.assertFalse(StringSerialization.DeserializeItem(BoolTypeInfo(), "0"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(BoolTypeInfo(), "not_valid"))
# ----------------------------------------------------------------------
def test_DateTime(self):
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04-28 10:05:00"), datetime.datetime(year=2018, month=4, day=28, hour=10, minute=5, second=0))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04-28T10:05:00"), datetime.datetime(year=2018, month=4, day=28, hour=10, minute=5, second=0))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "1528171793"), datetime.datetime(2018, 6, 5, 4, 9, 53))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "@1528171793 -0700"), datetime.datetime(2018, 6, 5, 11, 9, 53))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "@1528171793 +0700"), datetime.datetime(2018, 6, 4, 21, 9, 53))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "@1528171793 0700"), datetime.datetime(2018, 6, 4, 21, 9, 53))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "1528171793.0"), datetime.datetime(2018, 6, 5, 4, 9, 53))
# python2 doesn't support deserialization with non-UTC time zones
if sys.version_info[0] == 2:
self.assertRaises(
ValueError, # "'z' is a bad directive in format.+",
lambda: StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04-28T10:05:00-0700"),
)
else:
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04-28T10:05:31.00Z"), datetime.datetime(year=2018, month=4, day=28, hour=10, minute=5, second=31, tzinfo=datetime.timezone.utc))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04-28T10:05:31.0000Z"), datetime.datetime(year=2018, month=4, day=28, hour=10, minute=5, second=31, tzinfo=datetime.timezone.utc))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04-28T10:05:00-0700"), datetime.datetime(year=2018, month=4, day=28, hour=10, minute=5, second=0, tzinfo=datetime.timezone(datetime.timedelta(hours=-7))))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04-28T10:05:00-07:00"), datetime.datetime(year=2018, month=4, day=28, hour=10, minute=5, second=0, tzinfo=datetime.timezone(datetime.timedelta(hours=-7))))
self.assertEqual(StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04-28T10:05:31.000-07:00"), datetime.datetime(year=2018, month=4, day=28, hour=10, minute=5, second=31, tzinfo=datetime.timezone(datetime.timedelta(hours=-7))))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(DateTimeTypeInfo(), "not a valid datetime"))
# ----------------------------------------------------------------------
def test_Date(self):
self.assertEqual(StringSerialization.DeserializeItem(DateTypeInfo(), "2018-04-28"), datetime.date(year=2018, month=4, day=28))
self.assertEqual(StringSerialization.DeserializeItem(DateTypeInfo(), "04-28-2018"), datetime.date(year=2018, month=4, day=28))
self.assertEqual(StringSerialization.DeserializeItem(DateTypeInfo(), "18-04-28"), datetime.date(year=2018, month=4, day=28))
self.assertEqual(StringSerialization.DeserializeItem(DateTypeInfo(), "04-28-18"), datetime.date(year=2018, month=4, day=28))
self.assertEqual(StringSerialization.DeserializeItem(DateTypeInfo(), "2018.04.28"), datetime.date(year=2018, month=4, day=28))
self.assertEqual(StringSerialization.DeserializeItem(DateTypeInfo(), "04.28.2018"), datetime.date(year=2018, month=4, day=28))
self.assertEqual(StringSerialization.DeserializeItem(DateTypeInfo(), "18.04.28"), datetime.date(year=2018, month=4, day=28))
self.assertEqual(StringSerialization.DeserializeItem(DateTypeInfo(), "04.28.18"), datetime.date(year=2018, month=4, day=28))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(DateTimeTypeInfo(), "2018-04.28"))
# ----------------------------------------------------------------------
def test_Directory(self):
self.assertEqual(StringSerialization.DeserializeItem(DirectoryTypeInfo(ensure_exists=False), "foo/bar"), os.path.realpath(os.path.normpath(os.path.join("foo", "bar"))))
self.assertEqual(StringSerialization.DeserializeItem(DirectoryTypeInfo(ensure_exists=False), "foo/bar", normalize=False), os.path.join("foo", "bar"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(DirectoryTypeInfo(), ''))
# ----------------------------------------------------------------------
def test_Duration(self):
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "1.02:03:04"), datetime.timedelta(days=1, hours=2, minutes=3, seconds=4))
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "1:02:03:04"), datetime.timedelta(days=1, hours=2, minutes=3, seconds=4))
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "02:03:04"), datetime.timedelta(hours=2, minutes=3, seconds=4))
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "1.02:03:04.5"), datetime.timedelta(days=1, hours=2, minutes=3, seconds=4, microseconds=5))
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "1:02:03:04.5"), datetime.timedelta(days=1, hours=2, minutes=3, seconds=4, microseconds=5))
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "02:03:04.5"), datetime.timedelta(hours=2, minutes=3, seconds=4, microseconds=5))
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "P2DT3M21S"), datetime.timedelta(days=2, minutes=3, seconds=21))
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "5"), datetime.timedelta(seconds=5))
self.assertEqual(StringSerialization.DeserializeItem(DurationTypeInfo(), "1.234"), datetime.timedelta(seconds=1, microseconds=234))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(DurationTypeInfo(), "not a valid duration"))
# ----------------------------------------------------------------------
def test_Enum(self):
self.assertEqual(StringSerialization.DeserializeItem(EnumTypeInfo([ "one", "two", ]), "one"), "one")
self.assertEqual(StringSerialization.DeserializeItem(EnumTypeInfo([ "one", "two", ]), "two"), "two")
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(EnumTypeInfo([ "one", "two", ]), "three"))
# ----------------------------------------------------------------------
def test_Filename(self):
self.assertEqual(StringSerialization.DeserializeItem(FilenameTypeInfo(ensure_exists=False), "foo/bar"), os.path.realpath(os.path.normpath(os.path.join("foo", "bar"))))
self.assertEqual(StringSerialization.DeserializeItem(FilenameTypeInfo(ensure_exists=False), "foo/bar", normalize=False), os.path.join("foo", "bar"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(DirectoryTypeInfo(), ''))
# ----------------------------------------------------------------------
def test_Float(self):
self.assertEqual(StringSerialization.DeserializeItem(FloatTypeInfo(), "10.5"), 10.5)
self.assertEqual(StringSerialization.DeserializeItem(FloatTypeInfo(), "10"), 10.0)
self.assertEqual(StringSerialization.DeserializeItem(FloatTypeInfo(), "-10.5"), -10.5)
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(FloatTypeInfo(), "not a valid float"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(FloatTypeInfo(min=0), "-10.5"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(FloatTypeInfo(max=10), "100.5"))
# ----------------------------------------------------------------------
def test_Guid(self):
self.assertEqual(StringSerialization.DeserializeItem(GuidTypeInfo(), "{9A3A5A9A-0755-4FAC-9019-176C609665C5}"), uuid.UUID("9A3A5A9A-0755-4FAC-9019-176C609665C5"))
self.assertEqual(StringSerialization.DeserializeItem(GuidTypeInfo(), "9A3A5A9A-0755-4FAC-9019-176C609665C5"), uuid.UUID("9A3A5A9A-0755-4FAC-9019-176C609665C5"))
self.assertEqual(StringSerialization.DeserializeItem(GuidTypeInfo(), "{9A3A5A9A07554FAC9019176C609665C5}"), uuid.UUID("9A3A5A9A-0755-4FAC-9019-176C609665C5"))
self.assertEqual(StringSerialization.DeserializeItem(GuidTypeInfo(), "9A3A5A9A07554FAC9019176C609665C5"), uuid.UUID("9A3A5A9A-0755-4FAC-9019-176C609665C5"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(GuidTypeInfo(), "not a valid guid"))
# ----------------------------------------------------------------------
def test_Int(self):
self.assertEqual(StringSerialization.DeserializeItem(IntTypeInfo(), "10"), 10)
self.assertEqual(StringSerialization.DeserializeItem(IntTypeInfo(), "-10"), -10)
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(IntTypeInfo(), "not a valid int"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(IntTypeInfo(min=0), "-10"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(IntTypeInfo(max=10), "100"))
# ----------------------------------------------------------------------
def test_String(self):
self.assertEqual(StringSerialization.DeserializeItem(StringTypeInfo(), "foo"), "foo")
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(StringTypeInfo(), ""))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(StringTypeInfo(min_length=2), "1"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(StringTypeInfo(max_length=2), "123"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(StringTypeInfo(validation_expression="test"), "not test"))
# ----------------------------------------------------------------------
def test_Time(self):
self.assertEqual(StringSerialization.DeserializeItem(TimeTypeInfo(), "10:15:01"), datetime.time(hour=10, minute=15, second=1))
self.assertEqual(StringSerialization.DeserializeItem(TimeTypeInfo(), "10:15:01.678"), datetime.time(hour=10, minute=15, second=1, microsecond=678000))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(TimeTypeInfo(), "not a valid time"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(TimeTypeInfo(), "10:15:01+10:30"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(TimeTypeInfo(), "10:15:01-03:13"))
# ----------------------------------------------------------------------
def test_Uri(self):
self.assertEqual(StringSerialization.DeserializeItem(UriTypeInfo(), "https://foo.bar.baz"), Uri.FromString("https://foo.bar.baz"))
self.assertRaises(ValidationException, lambda: StringSerialization.DeserializeItem(UriTypeInfo(), "not a valid uri"))
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
if __name__ == "__main__":
try: sys.exit(unittest.main(verbosity=2))
except KeyboardInterrupt: pass
| 78.289544
| 252
| 0.634991
| 2,702
| 29,202
| 6.822724
| 0.104367
| 0.066721
| 0.151234
| 0.127583
| 0.846379
| 0.784812
| 0.715216
| 0.623651
| 0.554001
| 0.482235
| 0
| 0.071257
| 0.130162
| 29,202
| 372
| 253
| 78.5
| 0.654502
| 0.119855
| 0
| 0.163934
| 0
| 0
| 0.106086
| 0.035929
| 0
| 0
| 0
| 0
| 0.635246
| 1
| 0.127049
| false
| 0.004098
| 0.036885
| 0
| 0.17623
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
80573f7d1e34b4a318836d16a3f92db9e1221d13
| 158
|
py
|
Python
|
meterer/__init__.py
|
dacut/meterer
|
441e7f021e3302597f56876948a40fe8799a3375
|
[
"Apache-2.0"
] | null | null | null |
meterer/__init__.py
|
dacut/meterer
|
441e7f021e3302597f56876948a40fe8799a3375
|
[
"Apache-2.0"
] | null | null | null |
meterer/__init__.py
|
dacut/meterer
|
441e7f021e3302597f56876948a40fe8799a3375
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python3
"""
Metering agent for general requests.
"""
from .client import Meterer
from .s3 import S3Meterer
__all__ = ["Meterer", "S3Meterer"]
| 17.555556
| 36
| 0.721519
| 20
| 158
| 5.5
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.029412
| 0.139241
| 158
| 8
| 37
| 19.75
| 0.779412
| 0.367089
| 0
| 0
| 0
| 0
| 0.173913
| 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
|
337a63584bfc18d2efd6aa11defad0d6d9d4fd29
| 181
|
py
|
Python
|
backend/__init__.py
|
jmather625/OSM_buildingdetector
|
7b814f6579dc399dc55b131becf6d1ae202b25bb
|
[
"MIT"
] | 6
|
2019-07-25T05:04:48.000Z
|
2021-11-05T04:48:22.000Z
|
backend/__init__.py
|
jmather625/OSM_buildingdetector
|
7b814f6579dc399dc55b131becf6d1ae202b25bb
|
[
"MIT"
] | 14
|
2019-02-24T15:36:40.000Z
|
2022-02-10T00:36:23.000Z
|
backend/__init__.py
|
jmather625/OSM_buildingdetector
|
7b814f6579dc399dc55b131becf6d1ae202b25bb
|
[
"MIT"
] | 2
|
2019-11-13T04:26:22.000Z
|
2019-12-18T01:01:41.000Z
|
# makes the backend folder's different python files callable
# essentially all combined into one big "backend" python file
from .OSMAPI_Interactor import *
from .citySearch import *
| 45.25
| 61
| 0.80663
| 25
| 181
| 5.8
| 0.84
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.143646
| 181
| 4
| 62
| 45.25
| 0.935484
| 0.651934
| 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
|
33ad5ed48c7d540c84f1d9e07165951d314f169a
| 512
|
py
|
Python
|
IA/Python/3/3.2/3.py
|
worthl3ss/random-small
|
ffb60781f57eb865acbd81aaa07056046bad32fe
|
[
"MIT"
] | 1
|
2022-02-23T12:47:00.000Z
|
2022-02-23T12:47:00.000Z
|
IA/Python/3/3.2/3.py
|
worthl3ss/random-small
|
ffb60781f57eb865acbd81aaa07056046bad32fe
|
[
"MIT"
] | null | null | null |
IA/Python/3/3.2/3.py
|
worthl3ss/random-small
|
ffb60781f57eb865acbd81aaa07056046bad32fe
|
[
"MIT"
] | null | null | null |
M = []
size1 = int(input())
for i in range(size1):
row = []
for j in range(size1):
row.append(int(input()))
M.append(row)
M2 = []
for i in range(size1):
row = []
for j in range(size1):
row.append(int(input()))
M2.append(row)
result = [ [ 0 for i in range(size1) ] for j in range(size1) ]
for i in range(size1):
for j in range(size1):
for k in range(size1):
result[i][j] += M[i][k] * M2[k][j]
for i in range(size1):
print(result[i])
| 20.48
| 62
| 0.529297
| 85
| 512
| 3.188235
| 0.188235
| 0.258303
| 0.442804
| 0.202952
| 0.690037
| 0.630996
| 0.630996
| 0.630996
| 0.630996
| 0.630996
| 0
| 0.041667
| 0.296875
| 512
| 24
| 63
| 21.333333
| 0.711111
| 0
| 0
| 0.55
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.05
| 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
|
33b6e84eefb8af820d7c3a39a730cf860eae20fe
| 242
|
py
|
Python
|
generate/util.py
|
kudoo-cloud/timeseries-prediction
|
daf5179b5cf5f2090401721bf668962b9f397868
|
[
"MIT"
] | null | null | null |
generate/util.py
|
kudoo-cloud/timeseries-prediction
|
daf5179b5cf5f2090401721bf668962b9f397868
|
[
"MIT"
] | null | null | null |
generate/util.py
|
kudoo-cloud/timeseries-prediction
|
daf5179b5cf5f2090401721bf668962b9f397868
|
[
"MIT"
] | null | null | null |
def currencyCodes():
"""
This function returns a list of currency codes.
It looks simple, but it can be improved without
affecting other components.
"""
currency_codes = ['USD', 'EUR', 'AUD']
return currency_codes
| 26.888889
| 51
| 0.661157
| 30
| 242
| 5.266667
| 0.833333
| 0.246835
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.243802
| 242
| 8
| 52
| 30.25
| 0.863388
| 0.508264
| 0
| 0
| 0
| 0
| 0.094737
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
d501a0b1765fbf9b55290fdfb930328386e1a43d
| 203
|
py
|
Python
|
intercom/job.py
|
affiliprint/python-intercom
|
d7d9de8deba3db1acc3a779c6f258d47620c16f4
|
[
"MIT"
] | 77
|
2018-01-12T20:14:37.000Z
|
2022-03-21T04:57:24.000Z
|
intercom/job.py
|
affiliprint/python-intercom
|
d7d9de8deba3db1acc3a779c6f258d47620c16f4
|
[
"MIT"
] | 40
|
2018-01-11T01:43:37.000Z
|
2022-02-16T19:24:35.000Z
|
intercom/job.py
|
affiliprint/python-intercom
|
d7d9de8deba3db1acc3a779c6f258d47620c16f4
|
[
"MIT"
] | 60
|
2018-03-20T00:38:56.000Z
|
2022-02-22T15:49:24.000Z
|
# -*- coding: utf-8 -*- # noqa
from intercom.traits.api_resource import Resource
class Job(Resource):
"""A Bulk API Job.
Ref: https://developers.intercom.io/reference#bulk-job-model
"""
| 18.454545
| 64
| 0.660099
| 27
| 203
| 4.925926
| 0.740741
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006024
| 0.182266
| 203
| 10
| 65
| 20.3
| 0.795181
| 0.527094
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
1d325920d18892822c4e266ce9b94444dbf78470
| 84
|
py
|
Python
|
textvinf/__init__.py
|
vikigenius/textvinf
|
65f1f5595c17488a01a56a064dc217a94d887399
|
[
"MIT"
] | null | null | null |
textvinf/__init__.py
|
vikigenius/textvinf
|
65f1f5595c17488a01a56a064dc217a94d887399
|
[
"MIT"
] | null | null | null |
textvinf/__init__.py
|
vikigenius/textvinf
|
65f1f5595c17488a01a56a064dc217a94d887399
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
from typing import Any, Dict
config: Dict[str, Any] = {}
| 12
| 28
| 0.583333
| 12
| 84
| 4.083333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015152
| 0.214286
| 84
| 6
| 29
| 14
| 0.727273
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
1d35884322495718ca19207e7b23f351c80819b6
| 12
|
py
|
Python
|
closures.py
|
elijahanderson/Python-Practice
|
881f3dad9d6050d4f3c268172187e6a17ed39426
|
[
"MIT"
] | null | null | null |
closures.py
|
elijahanderson/Python-Practice
|
881f3dad9d6050d4f3c268172187e6a17ed39426
|
[
"MIT"
] | null | null | null |
closures.py
|
elijahanderson/Python-Practice
|
881f3dad9d6050d4f3c268172187e6a17ed39426
|
[
"MIT"
] | null | null | null |
# Closures
| 4
| 10
| 0.666667
| 1
| 12
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 12
| 2
| 11
| 6
| 0.888889
| 0.666667
| 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
|
1d48f636ffb2f9cb48a598d5a8b1d8c61b76b342
| 1,438
|
py
|
Python
|
dicestimulate.py
|
FRANK732/Dice-Rolling
|
868258ae10afe4537252acbd245c7a0877d7c69e
|
[
"MIT"
] | 1
|
2020-12-21T15:34:34.000Z
|
2020-12-21T15:34:34.000Z
|
dicestimulate.py
|
FRANK732/Dice-Rolling
|
868258ae10afe4537252acbd245c7a0877d7c69e
|
[
"MIT"
] | null | null | null |
dicestimulate.py
|
FRANK732/Dice-Rolling
|
868258ae10afe4537252acbd245c7a0877d7c69e
|
[
"MIT"
] | null | null | null |
import random
title = "Dice Simulation"
y = title.center(70)
y = y.upper()
print(y)
x = "y"
while x == "y":
Numb = random.randint(1,6)
x = input("press y to continue ")
x = x.lower()
if x != "y":
break
if Numb == 1:
print("--------")
print("| |")
print("| 0 |")
print("| |")
print("--------")
print("1")
if Numb == 2:
print("--------")
print("| |")
print("| 00 |")
print("| |")
print("--------")
print("2")
if Numb == 3:
print("--------")
print("| |")
print("| 00 |")
print("| 0 |")
print("| |")
print("--------")
print("3")
if Numb == 4:
print("--------")
print("| |")
print("| 00 |")
print("| 00 |")
print("| |")
print("--------")
print("4")
if Numb == 5:
print("--------")
print("| |")
print("| 000 |")
print("| 00 |")
print("| |")
print("--------")
print("5")
if Numb == 6:
print("--------")
print("| |")
print("| 000 |")
print("| 000 |")
print("| |")
print("--------")
print("6")
| 21.147059
| 38
| 0.273296
| 111
| 1,438
| 3.540541
| 0.27027
| 0.610687
| 0.458015
| 0.129771
| 0.491094
| 0
| 0
| 0
| 0
| 0
| 0
| 0.049268
| 0.477747
| 1,438
| 67
| 39
| 21.462687
| 0.474035
| 0
| 0
| 0.586207
| 0
| 0
| 0.247257
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.017241
| 0
| 0.017241
| 0.706897
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
1d68b5c052e23ae31a5a50163bee912596213b3d
| 73
|
py
|
Python
|
haystack/graph_retriever/__init__.py
|
agolo/haystack
|
ff6bc38b85ecec3c4d3d7c47b0f2a60da6b1f898
|
[
"Apache-2.0"
] | 4,544
|
2019-11-14T11:57:49.000Z
|
2022-03-31T17:41:18.000Z
|
haystack/graph_retriever/__init__.py
|
agolo/haystack
|
ff6bc38b85ecec3c4d3d7c47b0f2a60da6b1f898
|
[
"Apache-2.0"
] | 1,679
|
2020-01-14T15:55:58.000Z
|
2022-03-31T20:55:25.000Z
|
haystack/graph_retriever/__init__.py
|
agolo/haystack
|
ff6bc38b85ecec3c4d3d7c47b0f2a60da6b1f898
|
[
"Apache-2.0"
] | 820
|
2019-11-27T13:01:42.000Z
|
2022-03-31T12:54:34.000Z
|
from haystack.graph_retriever.text_to_sparql import Text2SparqlRetriever
| 36.5
| 72
| 0.917808
| 9
| 73
| 7.111111
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014493
| 0.054795
| 73
| 1
| 73
| 73
| 0.913043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
d51828b90389cfe38e43c56a59687110caa10b9c
| 4,136
|
py
|
Python
|
pypond/exceptions.py
|
jkafader-esnet/pypond
|
01c440e9f7c1785e8867b3ba13a46530ffef42e1
|
[
"BSD-3-Clause-LBNL"
] | 5
|
2016-09-07T20:29:12.000Z
|
2018-02-16T08:21:34.000Z
|
pypond/exceptions.py
|
jkafader-esnet/pypond
|
01c440e9f7c1785e8867b3ba13a46530ffef42e1
|
[
"BSD-3-Clause-LBNL"
] | 23
|
2016-06-15T23:22:08.000Z
|
2018-09-20T20:49:49.000Z
|
pypond/exceptions.py
|
jkafader-esnet/pypond
|
01c440e9f7c1785e8867b3ba13a46530ffef42e1
|
[
"BSD-3-Clause-LBNL"
] | 2
|
2020-03-12T04:51:34.000Z
|
2021-11-03T21:02:40.000Z
|
# Copyright (c) 2016, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt
# of any required approvals from the U.S. Dept. of Energy).
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
Custom exception and warning classes.
"""
class EventException(Exception):
"""Custom Event exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class EventWarning(Warning):
"""Custom Event warning"""
pass
class TimeRangeException(Exception):
"""Custom TimeRange exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class TimeRangeWarning(Warning):
"""Custom TimeRange warning"""
pass
class IndexException(Exception):
"""Custom Index exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class IndexWarning(Warning):
"""Custom Index warning"""
pass
class UtilityException(Exception):
"""Custom Utility exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class UtilityWarning(Warning):
"""Custom Utility warning"""
pass
class PipelineException(Exception):
"""Custom Pipeline exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class PipelineWarning(Warning):
"""Custom Pipeline warning"""
pass
class PipelineIOException(Exception):
"""Custom PipelineIO exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class PipelineIOWarning(Warning):
"""Custom PipelineIO warning"""
pass
class CollectionException(Exception):
"""Custom Collection exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class CollectionWarning(Warning):
"""Custom Collection warning"""
pass
class TimeSeriesException(Exception):
"""Custom TimeSeries exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class TimeSeriesWarning(Warning):
"""Custom TimeSeries warning"""
pass
class ProcessorException(Exception):
"""Custom Processor exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class ProcessorWarning(Warning):
"""Custom Processor warning"""
pass
class FilterException(Exception):
"""Custom Filter exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class FilterWarning(Warning):
"""Custom Filter warning"""
pass
class FunctionException(Exception):
"""Custom Function exception"""
def __init__(self, value):
# pylint: disable=super-init-not-called
self.value = value
def __str__(self): # pragma: no cover
return repr(self.value)
class FunctionWarning(Warning):
"""Custom Function warning"""
pass
NAIVE_MESSAGE = 'non-naive (aware) datetime objects required'
| 21.768421
| 72
| 0.661025
| 464
| 4,136
| 5.700431
| 0.221983
| 0.112287
| 0.066541
| 0.083176
| 0.486578
| 0.486578
| 0.486578
| 0.486578
| 0.486578
| 0.486578
| 0
| 0.001256
| 0.229932
| 4,136
| 189
| 73
| 21.883598
| 0.829199
| 0.370648
| 0
| 0.705128
| 0
| 0
| 0.017501
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.282051
| false
| 0.141026
| 0
| 0.141026
| 0.705128
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
|
0
| 4
|
d551d850d82a961578dd0ecfb3ab33b3c5849af3
| 64
|
py
|
Python
|
dummy_config.py
|
jrigden/muckamuck
|
b77711d140a1229b6608d1c4269a74525bdaafc8
|
[
"MIT"
] | 2
|
2015-06-17T19:17:02.000Z
|
2015-06-17T19:17:04.000Z
|
dummy_config.py
|
jrigden/muckamuck
|
b77711d140a1229b6608d1c4269a74525bdaafc8
|
[
"MIT"
] | null | null | null |
dummy_config.py
|
jrigden/muckamuck
|
b77711d140a1229b6608d1c4269a74525bdaafc8
|
[
"MIT"
] | null | null | null |
PAGE_ITEM_LIMIT = 10
RSS_ITEM_LIMIT = 10
OUTPUT_DIRECTORY = ""
| 12.8
| 21
| 0.765625
| 10
| 64
| 4.4
| 0.7
| 0.409091
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.074074
| 0.15625
| 64
| 4
| 22
| 16
| 0.740741
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 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
|
d5665c295a12ddff20666945315cc89b12a158d1
| 343
|
py
|
Python
|
theapp/serializer.py
|
je-ss-y/awards
|
c7633c4cb8a50fcebc05003e8a4d3e2719b13ef3
|
[
"CNRI-Python"
] | null | null | null |
theapp/serializer.py
|
je-ss-y/awards
|
c7633c4cb8a50fcebc05003e8a4d3e2719b13ef3
|
[
"CNRI-Python"
] | 3
|
2020-06-05T23:53:13.000Z
|
2021-06-10T22:09:59.000Z
|
theapp/serializer.py
|
je-ss-y/awards
|
c7633c4cb8a50fcebc05003e8a4d3e2719b13ef3
|
[
"CNRI-Python"
] | null | null | null |
from rest_framework import serializers
from .models import *
class MerchSerializer(serializers.ModelSerializer):
class Meta:
model = Snap
fields = ('image', 'photoname', 'description')
class ProfSerializer(serializers.ModelSerializer):
class Meta:
model = Profile
fields = ('bio', 'profilepicture')
| 22.866667
| 54
| 0.685131
| 31
| 343
| 7.548387
| 0.645161
| 0.222222
| 0.264957
| 0.299145
| 0.34188
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.218659
| 343
| 14
| 55
| 24.5
| 0.873134
| 0
| 0
| 0.2
| 0
| 0
| 0.122807
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.6
| 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
|
d573d64b3495a15617e6902c47afd2480ec42fbb
| 583
|
py
|
Python
|
app/enquiry/migrations/0003_auto_20190622_1002.py
|
S3Infosoft/mvr-insights
|
ac73feff03c1592d5efd8e0b82f72dd4dbd3e921
|
[
"MIT"
] | null | null | null |
app/enquiry/migrations/0003_auto_20190622_1002.py
|
S3Infosoft/mvr-insights
|
ac73feff03c1592d5efd8e0b82f72dd4dbd3e921
|
[
"MIT"
] | 20
|
2019-06-17T11:01:25.000Z
|
2020-05-09T06:13:17.000Z
|
app/enquiry/migrations/0003_auto_20190622_1002.py
|
S3Infosoft/mvr-insights
|
ac73feff03c1592d5efd8e0b82f72dd4dbd3e921
|
[
"MIT"
] | 1
|
2020-03-03T11:13:57.000Z
|
2020-03-03T11:13:57.000Z
|
# Generated by Django 2.2.2 on 2019-06-22 10:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('enquiry', '0002_auto_20190607_0853'),
]
operations = [
migrations.AlterModelOptions(
name='ota',
options={'ordering': ('-id',)},
),
migrations.AlterModelOptions(
name='partner',
options={'ordering': ('-id',)},
),
migrations.AlterModelOptions(
name='review',
options={'ordering': ('-id',)},
),
]
| 22.423077
| 47
| 0.526587
| 49
| 583
| 6.204082
| 0.632653
| 0.266447
| 0.305921
| 0.177632
| 0.315789
| 0.315789
| 0
| 0
| 0
| 0
| 0
| 0.078481
| 0.32247
| 583
| 25
| 48
| 23.32
| 0.691139
| 0.077187
| 0
| 0.473684
| 1
| 0
| 0.147388
| 0.04291
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.052632
| 0
| 0.210526
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d57c96a7194940e3766cdce96c158dc34d4e2524
| 470
|
py
|
Python
|
locations/admin.py
|
moralrecordings/parkourdex
|
be0badf084b583588dbe672e53948a24ea82de95
|
[
"BSD-3-Clause"
] | null | null | null |
locations/admin.py
|
moralrecordings/parkourdex
|
be0badf084b583588dbe672e53948a24ea82de95
|
[
"BSD-3-Clause"
] | 8
|
2021-04-08T18:31:49.000Z
|
2022-03-11T23:31:32.000Z
|
locations/admin.py
|
moralrecordings/parkourdex
|
be0badf084b583588dbe672e53948a24ea82de95
|
[
"BSD-3-Clause"
] | null | null | null |
from django.contrib import admin
from django.contrib.gis.admin import GeoModelAdmin
from simple_history.admin import SimpleHistoryAdmin
from locations.models import FeatureCategory, Feature, Location, Comment, Photo
admin.site.register(FeatureCategory, SimpleHistoryAdmin)
admin.site.register(Feature, SimpleHistoryAdmin)
admin.site.register(Location, SimpleHistoryAdmin)
admin.site.register(Comment, SimpleHistoryAdmin)
admin.site.register(Photo, SimpleHistoryAdmin)
| 39.166667
| 79
| 0.857447
| 52
| 470
| 7.730769
| 0.365385
| 0.11194
| 0.211443
| 0.348259
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.068085
| 470
| 11
| 80
| 42.727273
| 0.917808
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.444444
| 0
| 0.444444
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
d5aaa3706d941ceac17dc7abc38c1c97e0c95fe0
| 161
|
py
|
Python
|
003/todo-app/main/todo/forms/create.py
|
akiracadet/django-projects-v1
|
35ab3b88ed9bb9fab7e3d32a8fb838fff6571937
|
[
"MIT"
] | null | null | null |
003/todo-app/main/todo/forms/create.py
|
akiracadet/django-projects-v1
|
35ab3b88ed9bb9fab7e3d32a8fb838fff6571937
|
[
"MIT"
] | 5
|
2021-03-30T14:07:08.000Z
|
2021-09-22T19:28:43.000Z
|
006/ui-design/main/todo/forms/create.py
|
akiracadet/django-projects-v1
|
35ab3b88ed9bb9fab7e3d32a8fb838fff6571937
|
[
"MIT"
] | null | null | null |
from django.forms import ModelForm
from todo.models import Todo
class CreateTodoForm(ModelForm):
class Meta:
model = Todo
fields = ['todo']
| 20.125
| 34
| 0.68323
| 19
| 161
| 5.789474
| 0.631579
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.242236
| 161
| 7
| 35
| 23
| 0.901639
| 0
| 0
| 0
| 0
| 0
| 0.024845
| 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
|
d5ad32c7c13c71a06ce8640185bdba528bd7bd43
| 199
|
py
|
Python
|
OpenCV Python/7. Camera Calibration & 3D Reconstruction/2. Pose Estimation/pose.py
|
Ashleshk/Machine-Learning-Data-Science-Deep-Learning
|
03357ab98155bf73b8f1d2fd53255cc16bea2333
|
[
"MIT"
] | 1
|
2020-05-24T06:55:31.000Z
|
2020-05-24T06:55:31.000Z
|
OpenCV Python/7. Camera Calibration & 3D Reconstruction/2. Pose Estimation/pose.py
|
Ashleshk/Machine-Learning-Data-Science-Deep-Learning
|
03357ab98155bf73b8f1d2fd53255cc16bea2333
|
[
"MIT"
] | null | null | null |
OpenCV Python/7. Camera Calibration & 3D Reconstruction/2. Pose Estimation/pose.py
|
Ashleshk/Machine-Learning-Data-Science-Deep-Learning
|
03357ab98155bf73b8f1d2fd53255cc16bea2333
|
[
"MIT"
] | null | null | null |
import cv2
import numpy as np
import glob
# Load previously saved data
with np.load('1. Camera Calibration\camera.py') as X:
mtx, dist, _, _ = [X[i] for i in ('mtx','dist','rvecs','tvecs')]
| 24.875
| 68
| 0.653266
| 33
| 199
| 3.878788
| 0.69697
| 0.109375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012422
| 0.190955
| 199
| 8
| 69
| 24.875
| 0.782609
| 0.130653
| 0
| 0
| 0
| 0
| 0.27907
| 0.122093
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 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
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
6394413f4c360a7b7e358f346610c597fc938e6e
| 141
|
py
|
Python
|
example/settings_authors.py
|
callowayproject/django-stories
|
ea0398d69ea597819d0a6c75d4a3f65820321e13
|
[
"Apache-2.0"
] | 10
|
2015-06-25T23:35:29.000Z
|
2021-08-20T04:22:00.000Z
|
example/settings_authors.py
|
callowayproject/django-stories
|
ea0398d69ea597819d0a6c75d4a3f65820321e13
|
[
"Apache-2.0"
] | null | null | null |
example/settings_authors.py
|
callowayproject/django-stories
|
ea0398d69ea597819d0a6c75d4a3f65820321e13
|
[
"Apache-2.0"
] | 2
|
2017-03-21T04:10:29.000Z
|
2020-04-06T12:38:12.000Z
|
from example.settings import *
STORY_SETTINGS.update({
'AUTHOR_MODEL': 'simpleapp.basicauthor',
'AUTHOR_MODEL_LIMIT_CHOICES': {}
})
| 20.142857
| 44
| 0.730496
| 15
| 141
| 6.533333
| 0.8
| 0.22449
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.134752
| 141
| 6
| 45
| 23.5
| 0.803279
| 0
| 0
| 0
| 0
| 0
| 0.41844
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.2
| 0
| 0.2
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
639bffa2c3a82b4de776b2aa9ab2fcbc7ee5a6ce
| 125
|
py
|
Python
|
miping/training/noGloveValueError.py
|
mclgoerg/MiningPersonalityInGerman
|
4c5811a0f72100b7afef9695475a6de9251444b7
|
[
"Apache-2.0"
] | 1
|
2020-09-11T01:11:19.000Z
|
2020-09-11T01:11:19.000Z
|
miping/training/noGloveValueError.py
|
mclgoerg/MiningPersonalityInGerman
|
4c5811a0f72100b7afef9695475a6de9251444b7
|
[
"Apache-2.0"
] | null | null | null |
miping/training/noGloveValueError.py
|
mclgoerg/MiningPersonalityInGerman
|
4c5811a0f72100b7afef9695475a6de9251444b7
|
[
"Apache-2.0"
] | 2
|
2020-08-12T15:57:06.000Z
|
2020-12-17T18:11:03.000Z
|
class NoGloveValueError(Exception):
"""
Raised if no value can be found in GloVe for a user's text.
"""
pass
| 20.833333
| 63
| 0.64
| 18
| 125
| 4.444444
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.272
| 125
| 5
| 64
| 25
| 0.879121
| 0.472
| 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
|
63c0e979df24bd01001b827dbd63c017bce3afe9
| 304
|
py
|
Python
|
application/model/dao/todo_dao.py
|
UniversidadeDeVassouras/labproghiper-todolist
|
6f2f6ba807afd97e1de0b31bd3a9d556db29b879
|
[
"Apache-2.0"
] | null | null | null |
application/model/dao/todo_dao.py
|
UniversidadeDeVassouras/labproghiper-todolist
|
6f2f6ba807afd97e1de0b31bd3a9d556db29b879
|
[
"Apache-2.0"
] | null | null | null |
application/model/dao/todo_dao.py
|
UniversidadeDeVassouras/labproghiper-todolist
|
6f2f6ba807afd97e1de0b31bd3a9d556db29b879
|
[
"Apache-2.0"
] | 1
|
2020-04-14T00:21:34.000Z
|
2020-04-14T00:21:34.000Z
|
from datetime import date
class ToDoDAO():
def __init__(self):
self._todo_list = []
def inserir(self, todo):
todo.set_id(len(self._todo_list) + 1)
todo.set_data(date.today())
self._todo_list.append(todo)
def listar(self):
return self._todo_list
| 21.714286
| 45
| 0.615132
| 41
| 304
| 4.219512
| 0.512195
| 0.231214
| 0.277457
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004505
| 0.269737
| 304
| 14
| 46
| 21.714286
| 0.774775
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3
| false
| 0
| 0.1
| 0.1
| 0.6
| 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
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
63c56a791ea1864ec8e1e9fbc46cb8168dfe81bd
| 204
|
py
|
Python
|
wsgi.py
|
stackean/sample-flask-restful
|
4cb3f63ddcde13645e56f6c553b6d50dcbeb501f
|
[
"MIT"
] | null | null | null |
wsgi.py
|
stackean/sample-flask-restful
|
4cb3f63ddcde13645e56f6c553b6d50dcbeb501f
|
[
"MIT"
] | null | null | null |
wsgi.py
|
stackean/sample-flask-restful
|
4cb3f63ddcde13645e56f6c553b6d50dcbeb501f
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
import sys
# working directory
sys.path.insert(0,"/var/www/webroot/ROOT/")
# write app name after from. for example if it is hello.py then write hello
from app import app as application
| 29.142857
| 75
| 0.759804
| 36
| 204
| 4.305556
| 0.805556
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005682
| 0.137255
| 204
| 6
| 76
| 34
| 0.875
| 0.529412
| 0
| 0
| 0
| 0
| 0.236559
| 0.236559
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
892550d49dad893714415ee4a1ddb645d8d02fd8
| 384
|
py
|
Python
|
backend/account/schema.py
|
elielagmay/react-budgeteer
|
49a25dbd6dd6ea5d8bc93421eefbc12808f585af
|
[
"Unlicense"
] | 2
|
2018-10-23T00:40:53.000Z
|
2021-05-31T08:19:40.000Z
|
backend/account/schema.py
|
elielagmay/react-budgeteer
|
49a25dbd6dd6ea5d8bc93421eefbc12808f585af
|
[
"Unlicense"
] | null | null | null |
backend/account/schema.py
|
elielagmay/react-budgeteer
|
49a25dbd6dd6ea5d8bc93421eefbc12808f585af
|
[
"Unlicense"
] | null | null | null |
import graphene
from graphene_django.types import DjangoObjectType
from . import models
class CategoryNode(DjangoObjectType):
class Meta:
model = models.Category
interfaces = (graphene.relay.Node, )
class AccountNode(DjangoObjectType):
class Meta:
model = models.Account
interfaces = (graphene.relay.Node, )
class Query(object):
pass
| 19.2
| 50
| 0.703125
| 39
| 384
| 6.897436
| 0.512821
| 0.156134
| 0.185874
| 0.223048
| 0.505576
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.221354
| 384
| 19
| 51
| 20.210526
| 0.899666
| 0
| 0
| 0.307692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.076923
| 0.230769
| 0
| 0.615385
| 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
|
896d76d0fd8727985beed88c52f4d5872cdca136
| 142
|
py
|
Python
|
examples/research/proj/load.py
|
fishjojo/pydmfe
|
93cfc655314933d3531b5733521a1f95a044f6cb
|
[
"MIT"
] | 3
|
2021-02-26T06:26:00.000Z
|
2022-02-20T08:58:20.000Z
|
examples/research/proj/load.py
|
fishjojo/pydmfet
|
93cfc655314933d3531b5733521a1f95a044f6cb
|
[
"MIT"
] | null | null | null |
examples/research/proj/load.py
|
fishjojo/pydmfet
|
93cfc655314933d3531b5733521a1f95a044f6cb
|
[
"MIT"
] | null | null | null |
from pyscf.tools import molden
mol, mo_energy, mo_coeff, mo_occ, irrep_labels, spins = molden.load("mo_lo.molden")
print (mo_coeff.shape)
| 17.75
| 83
| 0.760563
| 24
| 142
| 4.25
| 0.708333
| 0.137255
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.126761
| 142
| 7
| 84
| 20.285714
| 0.822581
| 0
| 0
| 0
| 0
| 0
| 0.084507
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
898a4df5ae359f76f02922e17204b3257d027a32
| 24,884
|
py
|
Python
|
tca_ng/example_maps.py
|
wichovw/tca-gt
|
ad862286f153e5cd83db8a44ff0bb6ae7c4925ce
|
[
"MIT"
] | 1
|
2016-09-09T15:51:38.000Z
|
2016-09-09T15:51:38.000Z
|
tca_ng/example_maps.py
|
wichovw/tca-gt
|
ad862286f153e5cd83db8a44ff0bb6ae7c4925ce
|
[
"MIT"
] | null | null | null |
tca_ng/example_maps.py
|
wichovw/tca-gt
|
ad862286f153e5cd83db8a44ff0bb6ae7c4925ce
|
[
"MIT"
] | null | null | null |
import tca_ng.cells
import tca_ng.models
def generate_street(length, rate=0.8):
topo = tca_ng.models.Topology()
entrance = tca_ng.cells.StreetEntranceCell()
topo.cells.append(entrance)
topo.endpoint_cells.append(entrance)
for _ in range(length - 2):
topo.cells.append(tca_ng.cells.StreetCell())
exit = tca_ng.cells.StreetExitCell()
topo.cells.append(exit)
topo.endpoint_cells.append(exit)
street = tca_ng.models.Street()
street.cells.append([])
street.length = length
street.lanes = 1
for i, cell in enumerate(topo.cells):
street.cells[0].append(cell)
cell.topology = topo
cell.viewer_address = [i, 0]
cell.street = street
cell.lane = 0
cell.cell = i
cell.cells_to_end = length - i
if i + 1 < len(topo.cells):
tca_ng.cells.front_cell = topo.cells[i + 1]
if isinstance(cell, tca_ng.cells.EndpointCell):
cell.rate = rate
# Eddy
topo.streets.append(street)
return topo
def generate_wide_street(length, lanes, rate=0.8):
topo = tca_ng.models.Topology()
for _ in range(lanes):
entrance = tca_ng.cells.StreetEntranceCell()
topo.cells.append(entrance)
topo.endpoint_cells.append(entrance)
for _ in range(length - 2):
for __ in range(lanes):
topo.cells.append(tca_ng.cells.StreetCell())
for _ in range(lanes):
exit = tca_ng.cells.StreetExitCell()
topo.cells.append(exit)
topo.endpoint_cells.append(exit)
street = tca_ng.models.Street()
for _ in range(lanes):
street.cells.append([])
street.length = length
street.lanes = lanes
lane = 0
for i, cell in enumerate(topo.cells):
street.cells[lane].append(cell)
cell.topology = topo
cell.viewer_address = [i//lanes, lane]
cell.street = street
cell.lane = lane
cell.cell = i // lanes
cell.cells_to_end = length - cell.cell
if i + 1 < len(topo.cells) - lanes:
cell.front_cell = topo.cells[i + lanes]
if lane + 1 < lanes:
cell.right_cell = topo.cells[i + 1]
if lane > 0:
cell.left_cell = topo.cells[i - 1]
if isinstance(cell, tca_ng.cells.EndpointCell):
cell.rate = rate
lane = (lane + 1) % lanes
# Eddy
topo.streets.append(street)
return topo
def simple_intersection(rate=0.8):
topo = tca_ng.models.Topology()
"""
v
1
> 0 4 2 >
3
v
"""
topo.cells = []
topo.cells.append(tca_ng.cells.IntersectionEntranceCell())
topo.cells.append(tca_ng.cells.IntersectionEntranceCell())
topo.cells.append(tca_ng.cells.IntersectionExitCell())
topo.cells.append(tca_ng.cells.IntersectionExitCell())
topo.cells.append(tca_ng.cells.IntersectionCell())
int_ = tca_ng.models.Intersection()
routes = []
int_.routes = routes
routes.append(tca_ng.models.Route())
routes.append(tca_ng.models.Route())
routes.append(tca_ng.models.Route())
routes.append(tca_ng.models.Route())
routes[0].cells = [topo.cells[0], topo.cells[4], topo.cells[2]]
routes[1].cells = [topo.cells[0], topo.cells[4], topo.cells[3]]
routes[2].cells = [topo.cells[1], topo.cells[4], topo.cells[3]]
routes[3].cells = [topo.cells[1], topo.cells[4], topo.cells[2]]
routes[0].entrance_lane = 0
routes[1].entrance_lane = 0
routes[2].entrance_lane = 0
routes[3].entrance_lane = 0
topo.cells[0].viewer_address = [0, 1]
topo.cells[0].topology = topo
topo.cells[0].intersection = int_
topo.cells[0].routes = [routes[0], routes[1]]
topo.cells[0].rate = rate
topo.cells[1].viewer_address = [1, 0]
topo.cells[1].topology = topo
topo.cells[1].intersection = int_
topo.cells[1].routes = [routes[2], routes[3]]
topo.cells[1].rate = rate
topo.cells[2].viewer_address = [2, 1]
topo.cells[2].topology = topo
topo.cells[2].intersection = int_
topo.cells[2].routes = [routes[0], routes[3]]
topo.cells[2].rate = rate
topo.cells[3].viewer_address = [1, 2]
topo.cells[3].topology = topo
topo.cells[3].intersection = int_
topo.cells[3].routes = [routes[1], routes[2]]
topo.cells[3].rate = rate
topo.cells[4].viewer_address = [1, 1]
topo.cells[4].topology = topo
topo.cells[4].intersection = int_
topo.cells[4].routes = [routes[0], routes[1], routes[2], routes[3]]
semaphore = tca_ng.models.Semaphore()
int_.semaphore = semaphore
topo.semaphores = [semaphore,]
lights = []
semaphore.lights = lights
topo.lights = lights
# Eddy
topo.intersections.append(int_)
lights.append(tca_ng.models.Light())
lights.append(tca_ng.models.Light())
lights[0].viewer_address = [0, 2]
lights[0].routes = [routes[0], routes[1]]
lights[1].viewer_address = [0, 0]
lights[1].routes = [routes[2], routes[3]]
semaphore.topology = topo
semaphore.set_schedule({
0: lights[0],
20: lights[1],
})
return topo
def simple_2lane_intersection(rate=0.8):
topo = tca_ng.models.Topology()
"""
v v
3 2
> 0 8 10 4 >
> 1 9 11 5 >
7 6
v v
"""
topo.cells = []
for _ in range(4):
topo.cells.append(tca_ng.cells.IntersectionEntranceCell())
for _ in range(4):
topo.cells.append(tca_ng.cells.IntersectionExitCell())
for _ in range(4):
topo.cells.append(tca_ng.cells.IntersectionCell())
int_ = tca_ng.models.Intersection()
routes = []
int_.routes = routes
for _ in range(6):
routes.append(tca_ng.models.Route())
routes[0].cells = [topo.cells[0], topo.cells[8], topo.cells[10], topo.cells[4]]
routes[1].cells = [topo.cells[1], topo.cells[9], topo.cells[11], topo.cells[5]]
routes[2].cells = [topo.cells[1], topo.cells[9], topo.cells[7]]
routes[3].cells = [topo.cells[3], topo.cells[8], topo.cells[9], topo.cells[7]]
routes[4].cells = [topo.cells[2], topo.cells[10], topo.cells[11], topo.cells[6]]
routes[5].cells = [topo.cells[2], topo.cells[10], topo.cells[4]]
routes[0].entrance_lane = 0
routes[1].entrance_lane = 1
routes[2].entrance_lane = 1
routes[3].entrance_lane = 1
routes[4].entrance_lane = 0
routes[5].entrance_lane = 0
for cell in topo.cells:
cell.topology = topo
cell.intersection = int_
cell.rate = rate
cell.routes = []
for route in routes:
for cell in route.cells:
cell.routes.append(route)
topo.cells[0].viewer_address = [0, 1]
topo.cells[1].viewer_address = [0, 2]
topo.cells[2].viewer_address = [2, 0]
topo.cells[3].viewer_address = [1, 0]
topo.cells[4].viewer_address = [3, 1]
topo.cells[5].viewer_address = [3, 2]
topo.cells[6].viewer_address = [2, 3]
topo.cells[7].viewer_address = [1, 3]
topo.cells[8].viewer_address = [1, 1]
topo.cells[9].viewer_address = [1, 2]
topo.cells[10].viewer_address = [2, 1]
topo.cells[11].viewer_address = [2, 2]
semaphore = tca_ng.models.Semaphore()
int_.semaphore = semaphore
topo.semaphores = [semaphore,]
lights = []
semaphore.lights = lights
topo.lights = lights
# Eddy
topo.intersections.append(int_)
lights.append(tca_ng.models.Light())
lights.append(tca_ng.models.Light())
lights[0].viewer_address = [0, 3]
lights[0].routes = [routes[0], routes[1], routes[2]]
lights[1].viewer_address = [0, 0]
lights[1].routes = [routes[3], routes[4], routes[5]]
semaphore.topology = topo
semaphore.set_schedule({
0: lights[0],
20: lights[1],
})
return topo
def simple_2lane_map(size=5, rate=0.8):
topo = tca_ng.models.Topology()
streets = []
streets.append(generate_wide_street(size, 2, rate))
streets.append(generate_wide_street(size, 2, rate))
streets.append(generate_wide_street(size, 2, rate))
streets.append(generate_wide_street(size, 2, rate))
int_ = simple_2lane_intersection()
# streets[0].cells[0].street.routes = int_.cells[0].routes + int_.cells[1].routes
# streets[0].cells[0].street.routes = int_.cells[2].routes + int_.cells[3].routes
for cell in streets[0].cells:
cell.viewer_address[1] += size + 1
for cell in streets[2].cells:
cell.viewer_address[0] += size + 4
cell.viewer_address[1] += size + 1
for cell in streets[1].cells:
x = cell.viewer_address[0]
cell.viewer_address[0] = size - cell.lane + 2
cell.viewer_address[1] = x
for cell in streets[3].cells:
x = cell.viewer_address[0]
cell.viewer_address[0] = size - cell.lane + 2
cell.viewer_address[1] = x + size + 4
for cell in int_.cells + int_.lights:
cell.viewer_address[0] += size
cell.viewer_address[1] += size
topo.streets = [s.cells[0].street for s in streets]
streets[0].cells[-2].connection = int_.cells[0]
streets[0].cells[-1].connection = int_.cells[1]
streets[1].cells[-2].connection = int_.cells[2]
streets[1].cells[-1].connection = int_.cells[3]
streets[2].cells[0].connection = int_.cells[4]
streets[2].cells[1].connection = int_.cells[5]
streets[3].cells[0].connection = int_.cells[6]
streets[3].cells[1].connection = int_.cells[7]
int_.cells[0].connection = streets[0].cells[-2]
int_.cells[1].connection = streets[0].cells[-1]
int_.cells[2].connection = streets[1].cells[-2]
int_.cells[3].connection = streets[1].cells[-1]
int_.cells[4].connection = streets[2].cells[0]
int_.cells[5].connection = streets[2].cells[1]
int_.cells[6].connection = streets[3].cells[0]
int_.cells[7].connection = streets[3].cells[1]
streets[0].cells[-2].front_cell = int_.cells[0]
streets[0].cells[-1].front_cell = int_.cells[1]
streets[1].cells[-2].front_cell = int_.cells[2]
streets[1].cells[-1].front_cell = int_.cells[3]
int_o = int_.cells[0].intersection
streets[0].cells[0].street.exit_routes.extend([int_o.routes[0], int_o.routes[1], int_o.routes[2]])
streets[1].cells[0].street.exit_routes.extend([int_o.routes[3], int_o.routes[4], int_o.routes[5]])
# Eddy
int_o.in_streets.append(streets[0].cells[0].street)
int_o.in_streets.append(streets[1].cells[0].street)
int_o.out_streets.append(streets[2].cells[0].street)
int_o.out_streets.append(streets[3].cells[0].street)
for street in streets:
topo.cells += street.cells
topo.cells += int_.cells
topo.endpoint_cells = [
streets[0].cells[0],
streets[0].cells[1],
streets[1].cells[0],
streets[1].cells[1],
streets[2].cells[-2],
streets[2].cells[-1],
streets[3].cells[-2],
streets[3].cells[-1],
]
topo.lights = int_.lights
topo.semaphores = int_.semaphores
for cell in topo.cells:
cell.topology = topo
for semaphore in topo.semaphores:
semaphore.topology = topo
return topo
def simple_map(size=5, rate=0.8):
topo = tca_ng.models.Topology()
streets = []
streets.append(generate_street(size, rate))
streets.append(generate_street(size, rate))
streets.append(generate_street(size, rate))
streets.append(generate_street(size, rate))
int_ = simple_intersection()
# streets[0].cells[0].street.routes = int_.cells[0].routes
# streets[1].cells[0].street.routes = int_.cells[0].routes
for cell in streets[0].cells:
cell.viewer_address[1] += size + 1
for cell in streets[2].cells:
cell.viewer_address[0] += size + 3
cell.viewer_address[1] += size + 1
for cell in streets[1].cells:
x = cell.viewer_address[0]
cell.viewer_address[0] = size + 1
cell.viewer_address[1] = x
for cell in streets[3].cells:
x = cell.viewer_address[0]
cell.viewer_address[0] = size + 1
cell.viewer_address[1] = x + size + 3
for cell in int_.cells + int_.lights:
cell.viewer_address[0] += size
cell.viewer_address[1] += size
streets[0].cells[-1].connection = int_.cells[0]
streets[1].cells[-1].connection = int_.cells[1]
streets[2].cells[0].connection = int_.cells[2]
streets[3].cells[0].connection = int_.cells[3]
int_.cells[0].connection = streets[0].cells[-1]
int_.cells[1].connection = streets[1].cells[-1]
int_.cells[2].connection = streets[2].cells[0]
int_.cells[3].connection = streets[3].cells[0]
streets[0].cells[-1].front_cell = int_.cells[0]
streets[1].cells[-1].front_cell = int_.cells[1]
int_o = int_.cells[0].intersection
streets[0].cells[0].street.exit_routes.extend([int_o.routes[0], int_o.routes[1]])
streets[1].cells[0].street.exit_routes.extend([int_o.routes[2], int_o.routes[3]])
# Eddy
int_o.in_streets.append(streets[0].cells[0].street)
int_o.in_streets.append(streets[1].cells[0].street)
int_o.out_streets.append(streets[2].cells[0].street)
int_o.out_streets.append(streets[3].cells[0].street)
for street in streets:
topo.cells += street.cells
topo.cells += int_.cells
topo.endpoint_cells = [
streets[0].cells[0],
streets[1].cells[0],
streets[2].cells[-1],
streets[3].cells[-1],
]
topo.lights = int_.lights
topo.semaphores = int_.semaphores
for cell in topo.cells:
cell.topology = topo
for semaphore in topo.semaphores:
semaphore.topology = topo
return topo
def totito_2lane_map(size=5, rate=0.8):
topo = tca_ng.models.Topology()
crosses = []
crosses.append(simple_2lane_map(size, rate))
crosses.append(simple_2lane_map(size, rate))
crosses.append(simple_2lane_map(size, rate))
crosses.append(simple_2lane_map(size, rate))
for cross in crosses:
topo.streets.extend(cross.streets)
side = size * 2 + 3
for cell in crosses[1].cells + crosses[1].lights:
y = cell.viewer_address[1]
cell.viewer_address[1] = side - cell.viewer_address[0]
cell.viewer_address[0] = y + side + 1
for cell in crosses[2].cells + crosses[2].lights:
cell.viewer_address[0] = side * 2 - cell.viewer_address[0] + 1
cell.viewer_address[1] = side * 2 - cell.viewer_address[1] + 1
for cell in crosses[3].cells + crosses[3].lights:
x = cell.viewer_address[0]
cell.viewer_address[0] = side - cell.viewer_address[1]
cell.viewer_address[1] = x + side + 1
crosses[0].cells[3 * size * 2 - 2].connection = crosses[1].cells[size * 2]
crosses[0].cells[3 * size * 2 - 1].connection = crosses[1].cells[size * 2 + 1]
crosses[2].cells[3 * size * 2 - 2].connection = crosses[3].cells[size * 2]
crosses[2].cells[3 * size * 2 - 1].connection = crosses[3].cells[size * 2 + 1]
crosses[0].cells[4 * size * 2 - 2].connection = crosses[3].cells[0]
crosses[0].cells[4 * size * 2 - 1].connection = crosses[3].cells[1]
crosses[2].cells[4 * size * 2 - 2].connection = crosses[1].cells[0]
crosses[2].cells[4 * size * 2 - 1].connection = crosses[1].cells[1]
crosses[1].cells[size * 2].connection = crosses[0].cells[3 * size * 2 - 2]
crosses[1].cells[size * 2 + 1].connection = crosses[0].cells[3 * size * 2 - 1]
crosses[3].cells[size * 2].connection = crosses[2].cells[3 * size * 2 - 2]
crosses[3].cells[size * 2 + 1].connection = crosses[2].cells[3 * size * 2 - 1]
crosses[1].cells[0].connection = crosses[2].cells[4 * size * 2 - 2]
crosses[1].cells[1].connection = crosses[2].cells[4 * size * 2 - 1]
crosses[3].cells[0].connection = crosses[0].cells[4 * size * 2 - 2]
crosses[3].cells[1].connection = crosses[0].cells[4 * size * 2 - 1]
crosses[0].cells[3 * size * 2 - 2].front_cell = crosses[1].cells[size * 2]
crosses[0].cells[3 * size * 2 - 1].front_cell = crosses[1].cells[size * 2 + 1]
crosses[2].cells[3 * size * 2 - 2].front_cell = crosses[3].cells[size * 2]
crosses[2].cells[3 * size * 2 - 1].front_cell = crosses[3].cells[size * 2 + 1]
crosses[0].cells[4 * size * 2 - 2].front_cell = crosses[3].cells[0]
crosses[0].cells[4 * size * 2 - 1].front_cell = crosses[3].cells[1]
crosses[2].cells[4 * size * 2 - 2].front_cell = crosses[1].cells[0]
crosses[2].cells[4 * size * 2 - 1].front_cell = crosses[1].cells[1]
# Eddy
crosses[0].cells[40].intersection.neighbors.append(crosses[1].cells[40].intersection)
crosses[2].cells[40].intersection.neighbors.append(crosses[3].cells[40].intersection)
crosses[0].cells[40].intersection.neighbors.append(crosses[3].cells[40].intersection)
crosses[2].cells[40].intersection.neighbors.append(crosses[1].cells[40].intersection)
crosses[1].cells[40].intersection.neighbors.append(crosses[0].cells[40].intersection)
crosses[3].cells[40].intersection.neighbors.append(crosses[2].cells[40].intersection)
crosses[3].cells[40].intersection.neighbors.append(crosses[0].cells[40].intersection)
crosses[1].cells[40].intersection.neighbors.append(crosses[2].cells[40].intersection)
for cross in crosses:
for cell in cross.endpoint_cells:
if cell.connection is None:
topo.endpoint_cells.append(cell)
topo.cells += cross.cells
topo.lights += cross.lights
topo.semaphores += cross.semaphores
for cell in topo.cells:
cell.topology = topo
for semaphore in topo.semaphores:
semaphore.topology = topo
return topo
def totito_map(size=5, rate=0.8):
topo = tca_ng.models.Topology()
crosses = []
crosses.append(simple_map(size, rate))
crosses.append(simple_map(size, rate))
crosses.append(simple_map(size, rate))
crosses.append(simple_map(size, rate))
side = size * 2 + 2
for cell in crosses[1].cells + crosses[1].lights:
y = cell.viewer_address[1]
cell.viewer_address[1] = side - cell.viewer_address[0]
cell.viewer_address[0] = y + side + 1
for cell in crosses[2].cells + crosses[2].lights:
cell.viewer_address[0] = side * 2 - cell.viewer_address[0] + 1
cell.viewer_address[1] = side * 2 - cell.viewer_address[1] + 1
for cell in crosses[3].cells + crosses[3].lights:
x = cell.viewer_address[0]
cell.viewer_address[0] = side - cell.viewer_address[1]
cell.viewer_address[1] = x + side + 1
crosses[0].cells[3 * size - 1].connection = crosses[1].cells[size]
crosses[2].cells[3 * size - 1].connection = crosses[3].cells[size]
crosses[0].cells[4 * size - 1].connection = crosses[3].cells[0]
crosses[2].cells[4 * size - 1].connection = crosses[1].cells[0]
# Eddy
crosses[0].cells[40].intersection.neighbors.append(crosses[1].cells[40].intersection)
crosses[2].cells[40].intersection.neighbors.append(crosses[3].cells[40].intersection)
crosses[0].cells[40].intersection.neighbors.append(crosses[3].cells[40].intersection)
crosses[2].cells[40].intersection.neighbors.append(crosses[1].cells[40].intersection)
crosses[1].cells[40].intersection.neighbors.append(crosses[0].cells[40].intersection)
crosses[3].cells[40].intersection.neighbors.append(crosses[2].cells[40].intersection)
crosses[3].cells[40].intersection.neighbors.append(crosses[0].cells[40].intersection)
crosses[1].cells[40].intersection.neighbors.append(crosses[2].cells[40].intersection)
crosses[0].cells[3 * size - 1].front_cell = crosses[1].cells[size]
crosses[2].cells[3 * size - 1].front_cell = crosses[3].cells[size]
crosses[0].cells[4 * size - 1].front_cell = crosses[3].cells[0]
crosses[2].cells[4 * size - 1].front_cell = crosses[1].cells[0]
crosses[1].cells[size].connection = crosses[0].cells[3 * size - 1]
crosses[3].cells[size].connection = crosses[2].cells[3 * size - 1]
crosses[3].cells[0].connection = crosses[0].cells[4 * size - 1]
crosses[1].cells[0].connection = crosses[2].cells[4 * size - 1]
for cross in crosses:
topo.cells += cross.cells
topo.lights += cross.lights
topo.semaphores += cross.semaphores
topo.endpoint_cells = [
crosses[0].cells[0],
crosses[0].cells[size],
crosses[1].cells[3 * size - 1],
crosses[1].cells[4 * size - 1],
crosses[2].cells[0],
crosses[2].cells[size],
crosses[3].cells[3 * size - 1],
crosses[3].cells[4 * size - 1],
]
for cell in topo.cells:
cell.topology = topo
for semaphore in topo.semaphores:
semaphore.topology = topo
return topo
def simple_2_streets(size=5, rate=0.8):
topo = tca_ng.models.Topology()
street1 = generate_street(size, rate)
street2 = generate_street(size, rate)
for cell in street2.cells:
cell.viewer_address[0] += size
exit = street1.cells[size - 1]
entrance = street2.cells[0]
exit.connection = entrance
entrance.connection = exit
exit.front_cell = entrance
topo.cells = street1.cells + street2.cells
topo.endpoint_cells = [street1.cells[0], street2.cells[size - 1]]
for cell in topo.cells:
cell.topology = topo
return topo
def grid_2lane_map(size=5, width=2, height=2, rate=0.8):
topo = tca_ng.models.Topology()
totitos = []
matrix = []
for _ in range(height):
row = []
matrix.append(row)
for __ in range(width):
totito = totito_2lane_map(size, rate)
row.append(totito)
totitos.append(totito)
for totito in totitos:
topo.streets.extend(totito.streets)
totito_size = size * 4 + 8
for i in range(height):
for j in range(width):
totito = matrix[i][j]
for cell in totito.cells + totito.lights:
cell.viewer_address[0] += totito_size * j
cell.viewer_address[1] += totito_size * i
if i > 0:
totito.cells[10].connection = matrix[i - 1][j].cells[184]
totito.cells[11].connection = matrix[i - 1][j].cells[185]
totito.cells[80].connection = matrix[i - 1][j].cells[114]
totito.cells[81].connection = matrix[i - 1][j].cells[115]
totito.cells[80].front_cell = matrix[i - 1][j].cells[114]
totito.cells[81].front_cell = matrix[i - 1][j].cells[115]
if i < height - 1:
totito.cells[114].connection = matrix[i + 1][j].cells[80]
totito.cells[115].connection = matrix[i + 1][j].cells[81]
totito.cells[184].connection = matrix[i + 1][j].cells[10]
totito.cells[185].connection = matrix[i + 1][j].cells[11]
totito.cells[184].front_cell = matrix[i + 1][j].cells[10]
totito.cells[185].front_cell = matrix[i + 1][j].cells[11]
if j > 0:
totito.cells[0].connection = matrix[i][j - 1].cells[90]
totito.cells[1].connection = matrix[i][j - 1].cells[91]
totito.cells[194].connection = matrix[i][j - 1].cells[104]
totito.cells[195].connection = matrix[i][j - 1].cells[105]
totito.cells[194].front_cell = matrix[i][j - 1].cells[104]
totito.cells[195].front_cell = matrix[i][j - 1].cells[105]
if j < width - 1:
totito.cells[90].connection = matrix[i][j + 1].cells[0]
totito.cells[91].connection = matrix[i][j + 1].cells[1]
totito.cells[104].connection = matrix[i][j + 1].cells[194]
totito.cells[105].connection = matrix[i][j + 1].cells[195]
totito.cells[90].front_cell = matrix[i][j + 1].cells[0]
totito.cells[91].front_cell = matrix[i][j + 1].cells[1]
topo.cells += totito.cells
topo.lights += totito.lights
topo.semaphores += totito.semaphores
for totito in totitos:
for cell in totito.endpoint_cells:
if cell.connection is None:
topo.endpoint_cells.append(cell)
for cell in topo.cells:
cell.topology = topo
for semaphore in topo.semaphores:
semaphore.topology = topo
return topo
| 36.327007
| 102
| 0.607418
| 3,506
| 24,884
| 4.21563
| 0.031375
| 0.066373
| 0.05866
| 0.031664
| 0.837551
| 0.798782
| 0.734777
| 0.638701
| 0.6023
| 0.548173
| 0
| 0.053371
| 0.241762
| 24,884
| 685
| 103
| 36.327007
| 0.729966
| 0.013061
| 0
| 0.518027
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.018975
| false
| 0
| 0.003795
| 0
| 0.041746
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
899e3296d2b0b8e7d95ffa27505e5d672e160728
| 169
|
py
|
Python
|
client/client/functions/commands/get_client_mac.py
|
IchBInHanz/clientnet
|
20a75df953eee08d9bc1135a20cc662ba87efea1
|
[
"MIT"
] | 1
|
2021-01-08T15:27:29.000Z
|
2021-01-08T15:27:29.000Z
|
client/client/functions/commands/get_client_mac.py
|
IchBInHanz/clientnet
|
20a75df953eee08d9bc1135a20cc662ba87efea1
|
[
"MIT"
] | null | null | null |
client/client/functions/commands/get_client_mac.py
|
IchBInHanz/clientnet
|
20a75df953eee08d9bc1135a20cc662ba87efea1
|
[
"MIT"
] | null | null | null |
def getClientMac():
import uuid
mac = ':'.join(['{:02x}'.format((uuid.getnode() >> ele) & 0xff) for ele in range(0,8*6,8)][::-1])
return "Client MAC: " + mac
| 42.25
| 101
| 0.56213
| 25
| 169
| 3.8
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058394
| 0.189349
| 169
| 4
| 102
| 42.25
| 0.635037
| 0
| 0
| 0
| 0
| 0
| 0.111765
| 0
| 0
| 0
| 0.023529
| 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
|
89ad09670ba90ebb38d2513cc437bd11d0bc083c
| 1,296
|
py
|
Python
|
cemc/tools/__init__.py
|
davidkleiven/WangLandau
|
0b253dd98033c53560fe95c76f5e38257834bdf6
|
[
"MIT"
] | 2
|
2022-02-10T00:38:53.000Z
|
2022-03-17T22:08:40.000Z
|
cemc/tools/__init__.py
|
davidkleiven/CEMC
|
0b253dd98033c53560fe95c76f5e38257834bdf6
|
[
"MIT"
] | 30
|
2018-05-21T14:52:00.000Z
|
2021-02-24T07:45:09.000Z
|
cemc/tools/__init__.py
|
davidkleiven/WangLandau
|
0b253dd98033c53560fe95c76f5e38257834bdf6
|
[
"MIT"
] | 3
|
2018-10-09T14:03:32.000Z
|
2022-02-09T05:36:05.000Z
|
# Empty file
from cemc.tools.gsfinder import GSFinder
from cemc.tools.free_energy import FreeEnergy
from cemc.tools.dataset_averager import DatasetAverager
from cemc.tools.phase_boundary_tracker import PhaseBoundaryTracker
from cemc.tools.canonical_free_energy import CanonicalFreeEnergy
from cemc.tools.chemical_potential_roi import ChemicalPotentialROI
from cemc.tools.phase_track_utils import save_phase_boundary
from cemc.tools.phase_track_utils import process_phase_boundary
from cemc.tools.util import rot_matrix, to_mandel, to_full_tensor
from cemc.tools.util import rot_matrix_spherical_coordinates
from cemc.tools.util import rotate_tensor, rotate_rank4_tensor
from cemc.tools.util import to_mandel_rank4, to_full_rank4, rotate_rank4_mandel
from cemc.tools.strain_energy import StrainEnergy
from cemc.tools.peak_extractor import PeakExtractor
from cemc.tools.harmonics_fit import HarmonicsFit
from cemc.tools.wulff_construction import WulffConstruction
from cemc.tools.multivariate_gaussian import MultivariateGaussian
from cemc.tools.isotropic_strain_energy import IsotropicStrainEnergy
from cemc.tools.landau_polynomial import TwoPhaseLandauPolynomial
from cemc.tools.binary_coexistence import BinaryCriticalPoints
from cemc.tools.multithread_performance import MultithreadPerformance
| 56.347826
| 79
| 0.891975
| 175
| 1,296
| 6.365714
| 0.36
| 0.150808
| 0.245063
| 0.061041
| 0.193896
| 0.14991
| 0.118492
| 0
| 0
| 0
| 0
| 0.003322
| 0.070988
| 1,296
| 22
| 80
| 58.909091
| 0.921927
| 0.007716
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
89ba5a24c5e2e6f290426c0285f8736aa164b43f
| 120
|
py
|
Python
|
tests/cluecode/data/ics/chromium-testing-gmock-scripts/upload.py
|
s4-2/scancode-toolkit
|
8931b42e2630b94d0cabc834dfb3c16f01f82321
|
[
"Apache-2.0",
"CC-BY-4.0"
] | 1,511
|
2015-07-01T15:29:03.000Z
|
2022-03-30T13:40:05.000Z
|
tests/cluecode/data/ics/chromium-testing-gmock-scripts/upload.py
|
s4-2/scancode-toolkit
|
8931b42e2630b94d0cabc834dfb3c16f01f82321
|
[
"Apache-2.0",
"CC-BY-4.0"
] | 2,695
|
2015-07-01T16:01:35.000Z
|
2022-03-31T19:17:44.000Z
|
tests/cluecode/data/ics/chromium-testing-gmock-scripts/upload.py
|
s4-2/scancode-toolkit
|
8931b42e2630b94d0cabc834dfb3c16f01f82321
|
[
"Apache-2.0",
"CC-BY-4.0"
] | 540
|
2015-07-01T15:08:19.000Z
|
2022-03-31T12:13:11.000Z
|
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
| 24
| 65
| 0.708333
| 18
| 120
| 4.722222
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 0.15
| 120
| 5
| 65
| 24
| 0.77451
| 0.925
| 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
|
98257e89e108a155825f65d71395859587358827
| 232
|
py
|
Python
|
server/rideshare/forms.py
|
aadabi/tagrides
|
980a6f7df62f1bb9b396eca79421388c36987f45
|
[
"Unlicense"
] | 2
|
2018-03-21T23:32:09.000Z
|
2018-03-22T01:39:51.000Z
|
server/rideshare/forms.py
|
aadabi/Cruzer
|
980a6f7df62f1bb9b396eca79421388c36987f45
|
[
"Unlicense"
] | null | null | null |
server/rideshare/forms.py
|
aadabi/Cruzer
|
980a6f7df62f1bb9b396eca79421388c36987f45
|
[
"Unlicense"
] | null | null | null |
from django import forms
class UploadFileForm(forms.Form):
user_email = forms.CharField(max_length=150)
image = forms.FileField()
class DownloadFileForm(forms.Form):
user_email = forms.CharField(max_length=150)
| 29
| 49
| 0.741379
| 29
| 232
| 5.793103
| 0.551724
| 0.107143
| 0.154762
| 0.214286
| 0.52381
| 0.52381
| 0.52381
| 0.52381
| 0.52381
| 0
| 0
| 0.030928
| 0.163793
| 232
| 8
| 50
| 29
| 0.835052
| 0
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 1
| 0
| 1
| 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
| 0
| 0
| 1
| 0
|
0
| 4
|
988a9258575b12423828e9d590bc5d36d8a43e80
| 162
|
py
|
Python
|
tests/test_filerecorder.py
|
hopper-maker/openxc-python
|
2054c3d7a7ba09b8f0eeecc2348185857dc22f5f
|
[
"BSD-3-Clause"
] | 81
|
2015-01-17T04:21:55.000Z
|
2022-01-12T16:54:26.000Z
|
tests/test_filerecorder.py
|
hopper-maker/openxc-python
|
2054c3d7a7ba09b8f0eeecc2348185857dc22f5f
|
[
"BSD-3-Clause"
] | 84
|
2015-01-14T20:17:44.000Z
|
2020-10-19T21:46:25.000Z
|
tests/test_filerecorder.py
|
hopper-maker/openxc-python
|
2054c3d7a7ba09b8f0eeecc2348185857dc22f5f
|
[
"BSD-3-Clause"
] | 32
|
2015-03-08T14:03:53.000Z
|
2022-01-04T12:21:59.000Z
|
import unittest
from openxc.sinks import FileRecorderSink
class FileRecorderSinkTest(unittest.TestCase):
def test_create(self):
FileRecorderSink()
| 18
| 46
| 0.777778
| 16
| 162
| 7.8125
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.160494
| 162
| 8
| 47
| 20.25
| 0.919118
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
7f4066b0a8be1b0f63906cad618b87e4915d031e
| 4,656
|
py
|
Python
|
src/test_deque.py
|
Tsarcastic/data_structures_wr
|
a17e9caa668ccc4415bf2baf74df37d2d5d89792
|
[
"MIT"
] | null | null | null |
src/test_deque.py
|
Tsarcastic/data_structures_wr
|
a17e9caa668ccc4415bf2baf74df37d2d5d89792
|
[
"MIT"
] | 1
|
2018-01-08T05:17:26.000Z
|
2018-01-08T05:17:26.000Z
|
src/test_deque.py
|
Tsarcastic/data_structures_wr
|
a17e9caa668ccc4415bf2baf74df37d2d5d89792
|
[
"MIT"
] | null | null | null |
"""."""
import pytest
def test_node_exists_in_continuum01():
"""Test for previous."""
from deque import Node, Deque
dq = Deque()
dq.append_left('banana')
dq.append_left('orange')
assert dq.head.next_node.previous.data == 'orange'
def test_node_exists_in_continuum02():
"""Test for previous."""
from deque import Node, Deque
dq = Deque()
dq.append_left('banana')
dq.append_left('orange')
assert dq.head.next_node.data == 'banana'
def test_node_exists_in_continuum03():
"""Test for previous."""
from deque import Node, Deque
dq = Deque()
dq.append_left('banana')
dq.append_left('orange')
assert dq.head.next_node.next_node is None
def test_pop_left_off_01():
"""Pop one off and return correct value."""
from deque import Node, Deque
dq = Deque()
dq.append_left('banana')
dq.append_left('orange')
dq.popleft()
assert dq.head.data == 'banana'
def test_pop_off_02():
"""Pop one off and return correct value."""
from deque import Node, Deque
dq = Deque()
dq.append_left('banana')
dq.append_left('orange')
dq.popleft()
assert not dq.head.previous
def test_shift_from_tail_changes_length():
"""Can append_left 2 remove 1 and length is 1."""
from deque import Node, Deque
dq = Deque()
dq.append_left('banana')
dq.append_left('orange')
dq.pop()
assert len(dq) == 1
def test_pop_from_tail_removes_last():
"""append_left 2 in, pop one and data is correct."""
from deque import Node, Deque
dq = Deque()
dq.append_left('banana')
dq.append_left('orange')
dq.pop()
assert dq.tail.data == "orange"
def test_pop_from_tail_one_item_head_is_tail():
"""Tail is correct."""
from deque import Node, Deque
dq = Deque()
dq.append_left('banana')
dq.append_left('orange')
dq.pop()
assert dq.tail == dq.head
def test_pop_on_empty_deque_raises_exception():
"""Shift on empty deque raises exception."""
from deque import Node, Deque
dq = Deque()
with pytest.raises(IndexError):
dq.pop()
def test_popleft_on_empty_deque_raises_exception():
"""Shift on empty deque raises exception."""
from deque import Node, Deque
dq = Deque()
with pytest.raises(IndexError):
dq.popleft()
def test_append_on_deque_makes_head_and_tail_same():
"""Appending an item to an empty deque makes that item head and tail."""
from deque import Node, Deque
dq = Deque()
dq.append("blue")
assert dq.head == dq.tail
def test_append_left_on_deque_makes_head_and_tail_same():
"""Appending an item to an empty deque makes that item head and tail."""
from deque import Node, Deque
dq = Deque()
dq.append_left("blue")
assert dq.head == dq.tail
def test_append_increments_counter():
"""Size goes up correctly."""
from deque import Node, Deque
dq = Deque()
dq.append("blue")
assert dq.size() == 1
def test_pop_left_decreases_counter():
"""Size goes down correctly."""
from deque import Node, Deque
dq = Deque()
dq.append("blue")
dq.popleft()
assert dq.size() == 0
def test_pop_decreases_counter():
"""Size goes down correctly."""
from deque import Node, Deque
dq = Deque()
dq.append("blue")
dq.pop()
assert dq.size() == 0
def test_append_left_increments_counter():
"""Size goes up correctly."""
from deque import Node, Deque
dq = Deque()
dq.append_left("blue")
assert dq.size() == 1
def test_append_changes_tail_when_deque_has_multiple_nodes():
"""Tail shifts correctly when appended."""
from deque import Node, Deque
dq = Deque()
dq.append("blue")
dq.append("red")
assert dq.tail.data != "blue"
def test_append_retains_correct_next_node_for_nodes():
"""A node's 'next_node' is retained properly through appending."""
from deque import Node, Deque
dq = Deque()
dq.append("blue")
dq.append("red")
assert dq.head.next_node.data == "red"
def test_deque_head_equals_tail():
"""An empty node's head and tail are equal."""
from deque import Node, Deque
dq = Deque()
assert dq.head == dq.tail
def test_peek_returns_value_of_tail():
"""Peeking will return the value of the tail."""
from deque import Node, Deque
dq = Deque()
dq.append("blue")
dq.append("red")
assert dq.peek() == 'red'
def test_peek_left_returns_value_of_head():
"""Peeking will return the value of the tail."""
from deque import Node, Deque
dq = Deque()
dq.append("blue")
dq.append("red")
assert dq.peekleft() == 'blue'
| 25.032258
| 76
| 0.656357
| 674
| 4,656
| 4.332344
| 0.137982
| 0.093493
| 0.107877
| 0.136644
| 0.764726
| 0.732877
| 0.712329
| 0.684932
| 0.684932
| 0.669178
| 0
| 0.005211
| 0.216924
| 4,656
| 185
| 77
| 25.167568
| 0.795666
| 0.167311
| 0
| 0.725806
| 0
| 0
| 0.049389
| 0
| 0
| 0
| 0
| 0
| 0.153226
| 1
| 0.169355
| false
| 0
| 0.177419
| 0
| 0.346774
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7f5849095b8be8c5f688cf2a57a832b5a019aa8c
| 232
|
py
|
Python
|
js/jquery_elastic/__init__.py
|
fanstatic/js.jquery_elastic
|
8a25992b188ce3c6dbf2103b6e8863c9286858b0
|
[
"BSD-3-Clause"
] | null | null | null |
js/jquery_elastic/__init__.py
|
fanstatic/js.jquery_elastic
|
8a25992b188ce3c6dbf2103b6e8863c9286858b0
|
[
"BSD-3-Clause"
] | null | null | null |
js/jquery_elastic/__init__.py
|
fanstatic/js.jquery_elastic
|
8a25992b188ce3c6dbf2103b6e8863c9286858b0
|
[
"BSD-3-Clause"
] | null | null | null |
from fanstatic import Library, Resource
from js.jquery import jquery
library = Library('jquery_elastic', 'resources')
elastic = Resource(library,
'jquery.elastic.source.js',
depends=[jquery])
| 25.777778
| 48
| 0.650862
| 24
| 232
| 6.25
| 0.458333
| 0.173333
| 0.266667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 232
| 8
| 49
| 29
| 0.862069
| 0
| 0
| 0
| 0
| 0
| 0.202586
| 0.103448
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
7f74e0e309e51015d4e9b96bade504316589475e
| 150
|
py
|
Python
|
tests/pyexp_tests.py
|
nguyentu1602/pyexp
|
36527f299f92ce8600910879a942d70afeb7b4d2
|
[
"MIT"
] | null | null | null |
tests/pyexp_tests.py
|
nguyentu1602/pyexp
|
36527f299f92ce8600910879a942d70afeb7b4d2
|
[
"MIT"
] | 2
|
2015-09-02T22:34:46.000Z
|
2015-09-02T22:36:15.000Z
|
tests/pyexp_tests.py
|
nguyentu1602/pyexp
|
36527f299f92ce8600910879a942d70afeb7b4d2
|
[
"MIT"
] | null | null | null |
from nose.tools import *
import pyexp
def setup():
print("Setup.")
def teardown():
print("Tear down.")
def test_basic():
print("Ran.")
| 12.5
| 24
| 0.62
| 20
| 150
| 4.6
| 0.7
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.206667
| 150
| 11
| 25
| 13.636364
| 0.773109
| 0
| 0
| 0
| 0
| 0
| 0.133333
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.375
| true
| 0
| 0.25
| 0
| 0.625
| 0.375
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
7f7525695b41f2bf9bd17b5bf5e053a31b070165
| 258
|
py
|
Python
|
Python/Strings/Easy/String-Formatting.py
|
Justin-Teng/HackerRank
|
bb501715d4fb0322ccffa70b75c4d6df1463a334
|
[
"MIT"
] | null | null | null |
Python/Strings/Easy/String-Formatting.py
|
Justin-Teng/HackerRank
|
bb501715d4fb0322ccffa70b75c4d6df1463a334
|
[
"MIT"
] | null | null | null |
Python/Strings/Easy/String-Formatting.py
|
Justin-Teng/HackerRank
|
bb501715d4fb0322ccffa70b75c4d6df1463a334
|
[
"MIT"
] | null | null | null |
def print_formatted(number):
binlen = len(str(bin(number))) - 2
for i in range(1, number+1):
print("{0} {1} {2} {3}".format(str(i).rjust(binlen), str(oct(i))[1:].rjust(binlen), format(i, 'x').upper().rjust(binlen), bin(i)[2:].rjust(binlen)))
| 51.6
| 156
| 0.596899
| 44
| 258
| 3.477273
| 0.477273
| 0.287582
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.040541
| 0.139535
| 258
| 4
| 157
| 64.5
| 0.648649
| 0
| 0
| 0
| 0
| 0
| 0.062016
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.25
| 0.5
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
7f928e28689b19265ffb9b40c5977afcfcc40d76
| 5,574
|
py
|
Python
|
eggs/nose-0.11.1-py2.7.egg/nose/plugins/__init__.py
|
bopopescu/phyG
|
023f505b705ab953f502cbc55e90612047867583
|
[
"CC-BY-3.0"
] | null | null | null |
eggs/nose-0.11.1-py2.7.egg/nose/plugins/__init__.py
|
bopopescu/phyG
|
023f505b705ab953f502cbc55e90612047867583
|
[
"CC-BY-3.0"
] | null | null | null |
eggs/nose-0.11.1-py2.7.egg/nose/plugins/__init__.py
|
bopopescu/phyG
|
023f505b705ab953f502cbc55e90612047867583
|
[
"CC-BY-3.0"
] | 1
|
2020-07-25T21:03:18.000Z
|
2020-07-25T21:03:18.000Z
|
"""
Writing Plugins
---------------
nose supports plugins for test collection, selection, observation and
reporting. There are two basic rules for plugins:
* Plugin classes should subclass :class:`nose.plugins.Plugin`.
* Plugins may implement any of the methods described in the class
:doc:`IPluginInterface <interface>` in nose.plugins.base. Please note that
this class is for documentary purposes only; plugins may not subclass
IPluginInterface.
Registering
===========
.. Note::
Important note: the following applies only to the default
plugin manager. Other plugin managers may use different means to
locate and load plugins.
For nose to find a plugin, it must be part of a package that uses
setuptools_, and the plugin must be included in the entry points defined
in the setup.py for the package:
.. code-block:: python
setup(name='Some plugin',
# ...
entry_points = {
'nose.plugins.0.10': [
'someplugin = someplugin:SomePlugin'
]
},
# ...
)
Once the package is installed with install or develop, nose will be able
to load the plugin.
.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
Registering a plugin without setuptools
=======================================
It is currently possible to register a plugin programmatically by
creating a custom nose runner like this :
.. code-block:: python
import nose
from yourplugin import YourPlugin
if __name__ == '__main__':
nose.main(addplugins=[YourPlugin()])
Defining options
================
All plugins must implement the methods ``options(self, parser, env)``
and ``configure(self, options, conf)``. Subclasses of nose.plugins.Plugin
that want the standard options should call the superclass methods.
nose uses optparse.OptionParser from the standard library to parse
arguments. A plugin's ``options()`` method receives a parser
instance. It's good form for a plugin to use that instance only to add
additional arguments that take only long arguments (--like-this). Most
of nose's built-in arguments get their default value from an environment
variable.
A plugin's ``configure()`` method receives the parsed ``OptionParser`` options
object, as well as the current config object. Plugins should configure their
behavior based on the user-selected settings, and may raise exceptions
if the configured behavior is nonsensical.
Logging
=======
nose uses the logging classes from the standard library. To enable users
to view debug messages easily, plugins should use ``logging.getLogger()`` to
acquire a logger in the ``nose.plugins`` namespace.
Recipes
=======
* Writing a plugin that monitors or controls test result output
Implement any or all of ``addError``, ``addFailure``, etc., to monitor test
results. If you also want to monitor output, implement
``setOutputStream`` and keep a reference to the output stream. If you
want to prevent the builtin ``TextTestResult`` output, implement
``setOutputSteam`` and *return a dummy stream*. The default output will go
to the dummy stream, while you send your desired output to the real stream.
Example: `examples/html_plugin/htmlplug.py`_
* Writing a plugin that handles exceptions
Subclass :doc:`ErrorClassPlugin <errorclasses>`.
Examples: :doc:`nose.plugins.deprecated <deprecated>`,
:doc:`nose.plugins.skip <skip>`
* Writing a plugin that adds detail to error reports
Implement ``formatError`` and/or ``formatFailture``. The error tuple
you return (error class, error message, traceback) will replace the
original error tuple.
Examples: :doc:`nose.plugins.capture <capture>`,
:doc:`nose.plugins.failuredetail <failuredetail>`
* Writing a plugin that loads tests from files other than python modules
Implement ``wantFile`` and ``loadTestsFromFile``. In ``wantFile``,
return True for files that you want to examine for tests. In
``loadTestsFromFile``, for those files, return an iterable
containing TestCases (or yield them as you find them;
``loadTestsFromFile`` may also be a generator).
Example: :doc:`nose.plugins.doctests <doctests>`
* Writing a plugin that prints a report
Implement ``begin`` if you need to perform setup before testing
begins. Implement ``report`` and output your report to the provided stream.
Examples: :doc:`nose.plugins.cover <cover>`, :doc:`nose.plugins.prof <prof>`
* Writing a plugin that selects or rejects tests
Implement any or all ``want*`` methods. Return False to reject the test
candidate, True to accept it -- which means that the test candidate
will pass through the rest of the system, so you must be prepared to
load tests from it if tests can't be loaded by the core loader or
another plugin -- and None if you don't care.
Examples: :doc:`nose.plugins.attrib <attrib>`,
:doc:`nose.plugins.doctests <doctests>`, :doc:`nose.plugins.testid <testid>`
More Examples
=============
See any builtin plugin or example plugin in the examples_ directory in
the nose source distribution. There is a list of third-party plugins
`on jottit`_.
.. _examples/html_plugin/htmlplug.py: http://python-nose.googlecode.com/svn/trunk/examples/html_plugin/htmlplug.py
.. _examples: http://python-nose.googlecode.com/svn/trunk/examples
.. _on jottit: http://nose-plugins.jottit.com/
"""
from nose.plugins.base import Plugin
from nose.plugins.manager import *
from nose.plugins.plugintest import PluginTester
if __name__ == '__main__':
import doctest
doctest.testmod()
| 34.196319
| 114
| 0.726229
| 768
| 5,574
| 5.234375
| 0.376302
| 0.05199
| 0.034826
| 0.026866
| 0.067164
| 0.021393
| 0.021393
| 0.021393
| 0
| 0
| 0
| 0.000651
| 0.173843
| 5,574
| 162
| 115
| 34.407407
| 0.872313
| 0.962684
| 0
| 0
| 0
| 0
| 0.040816
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.666667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
7fa8073122a562c1580019d02eaf11aa0e0461de
| 496
|
py
|
Python
|
model/history.py
|
LianGee/akalid
|
bb2246f423ea28f37e834081b58495b30ae33f1c
|
[
"MIT"
] | null | null | null |
model/history.py
|
LianGee/akalid
|
bb2246f423ea28f37e834081b58495b30ae33f1c
|
[
"MIT"
] | null | null | null |
model/history.py
|
LianGee/akalid
|
bb2246f423ea28f37e834081b58495b30ae33f1c
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : history.py
# @Author: zaoshu
# @Date : 2020-02-08
# @Desc :
from sqlalchemy import String, Column, BigInteger
from model.base import BaseModel
from model.db import Model
class History(Model, BaseModel):
__tablename__ = 'history'
date = Column(String)
confirmed = Column(BigInteger, default=0)
cured = Column(BigInteger, default=0)
dead = Column(BigInteger, default=0)
suspected = Column(BigInteger, default=0)
| 24.8
| 49
| 0.691532
| 62
| 496
| 5.467742
| 0.564516
| 0.235988
| 0.271386
| 0.283186
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.03202
| 0.181452
| 496
| 19
| 50
| 26.105263
| 0.802956
| 0.215726
| 0
| 0
| 0
| 0
| 0.018277
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.3
| 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
|
7fb3b5d4398572c9fac31bc463fa66ab558d4173
| 226
|
py
|
Python
|
vsclibaries.py
|
MarianneLawless/Project-2018-Programming-and-Scripting
|
495350d642c8f0f33e696e7a16ccf156610ce1ff
|
[
"Apache-2.0"
] | null | null | null |
vsclibaries.py
|
MarianneLawless/Project-2018-Programming-and-Scripting
|
495350d642c8f0f33e696e7a16ccf156610ce1ff
|
[
"Apache-2.0"
] | null | null | null |
vsclibaries.py
|
MarianneLawless/Project-2018-Programming-and-Scripting
|
495350d642c8f0f33e696e7a16ccf156610ce1ff
|
[
"Apache-2.0"
] | null | null | null |
import sys
print("Pyhton: {}".format(sys.version))
import numpy
print("numpy: {}" .format(numpy.version))
import matplotlib
print("matplotlib {}".format(matplotlib))
import pandas
print("pandas {}".format(pandas))
| 20.545455
| 42
| 0.69469
| 26
| 226
| 6.038462
| 0.346154
| 0.165605
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128319
| 226
| 10
| 43
| 22.6
| 0.796954
| 0
| 0
| 0
| 0
| 0
| 0.191589
| 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
|
f6e89948a0d4e9bc820b8ed9dcbce5a54e2e99d8
| 11,234
|
py
|
Python
|
python/classifications_backup.py
|
montycheese/UGA-Hacks-digits-webapp
|
09bb048898f7587207005d3cd6463c21d0952145
|
[
"CC-BY-3.0"
] | null | null | null |
python/classifications_backup.py
|
montycheese/UGA-Hacks-digits-webapp
|
09bb048898f7587207005d3cd6463c21d0952145
|
[
"CC-BY-3.0"
] | null | null | null |
python/classifications_backup.py
|
montycheese/UGA-Hacks-digits-webapp
|
09bb048898f7587207005d3cd6463c21d0952145
|
[
"CC-BY-3.0"
] | null | null | null |
# ASL ALPHABET, j,Z OMITTED
language = {
'letter_a' : [
"http://science.opposingviews.com/DM-Resize/photos.demandstudios.com/getty/article/81/210/78033946.jpg?w=600&h=600&keep_ratio=1",
"http://www.lifeprint.com/asl101/signjpegs/a/a.jpg",
"http://thumbs.dreamstime.com/x/letter-sign-language-587184.jpg",
"http://i.imgur.com/ei3jaNZ.jpg",
'http://imgur.com/dEzAAdf.jpg',
'http://imgur.com/Cq98daW.jpg',
"http://i.imgur.com/idEI6pF.jpg",
"http://i.imgur.com/AmaKsIu.jpg",
'http://i.imgur.com/pcRSprF.jpg'
],
'letter_b' : [
"https://s3.amazonaws.com/bankstreet_web/media/filer_public/filer_public/2013/03/04/asl_b.jpg",
"http://www.wpclipart.com/sign_language/American_ABC_Photos/sign_language_photo_B.png",
"http://thumbs.dreamstime.com/z/letter-b-sign-language-587210.jpg",
"http://images2.pics4learning.com/catalog/b/b.jpg",
"http://www.lifeprint.com/asl101/signjpegs/b/b1.jpg",
"http://i.imgur.com/pU4pXE8.jpg",
'http://imgur.com/qbbPAW6.jpg',
'http://imgur.com/XBQ9nXx.jpg',
'http://imgur.com/lqvt8f0.jpg',
'http://i.imgur.com/Dw6FEFS.jpg',
'http://i.imgur.com/F9s68Ks.jpg',
'http://i.imgur.com/AwhYJjn.jpg',
'http://i.imgur.com/cmkzC7d.jpg',
'http://i.imgur.com/tiey392.jpg'
],
'letter_c' : [
"http://images2.pics4learning.com/catalog/c/c.jpg",
"http://www.wpclipart.com/sign_language/American_ABC_Photos/sign_language_photo_C.png",
'http://i233.photobucket.com/albums/ee159/lintpicker/30801_9184.jpg',
'http://imgur.com/d3YIDeM.jpg',
'http://www.lifeprint.com/asl101/signjpegs/c/c.jpg',
'http://imgur.com/ZKY6quh.jpg',
'http://imgur.com/5oaD2DA.jpg',
'http://i.imgur.com/Iin7dhC.jpg',
'http://i.imgur.com/4yHKhIg.jpg',
'http://i.imgur.com/98WqyNm.jpg',
'http://i.imgur.com/5vMj1xa.jpg'
],
'letter_d' : [
"http://www.lifeprint.com/asl101/signjpegs/d/d.jpg",
"http://images2.pics4learning.com/catalog/d/thumbs/d_thumb.jpg",
'http://users.manchester.edu/Student/SMCarmichael/MyWebpage/MPj03857270000[1]1.jpg',
'http://imgur.com/N8WTUo8.jpg',
'http://imgur.com/U1DTGet.jpg',
'http://i.imgur.com/P6tw9wt.jpg',
'http://i.imgur.com/Ci4c5Dz.jpg',
'http://i.imgur.com/Hbpg93V.jpg'
],
'letter_e' : [
"http://www.lifeprint.com/asl101/signjpegs/e/e.jpg",
'http://images2.pics4learning.com/catalog/e/thumbs/e_thumb.jpg',
'http://www.wtsd.tn.org/kylah_webpage/MPj03857280000%5B1%5D.jpg',
'http://imgur.com/xtKJdhs.jpg',
'http://imgur.com/I8SsKfZ.jpg',
'http://i.imgur.com/vlTE1A2.jpg',
'http://i.imgur.com/vQwuSpI.jpg',
'http://i.imgur.com/bmHkR4g.jpg',
'http://i.imgur.com/N1RjYaJ.jpg',
'http://i.imgur.com/UhYgnPZ.jpg'
],
'letter_f' : [
'http://www.lifeprint.com/asl101/signjpegs/f/f.jpg',
'https://www.signingsavvy.com/images/words/alphabet/2/f1.jpg',
'http://images2.pics4learning.com/catalog/f/thumbs/f_thumb.jpg',
'http://imgur.com/18mJQcx.jpg',
'http://i.imgur.com/G6C4q8D.jpg',
'http://i.imgur.com/dA5SGV9.jpg',
'http://i.imgur.com/g5xoIpn.jpg',
'http://i.imgur.com/kkFqone.jpg',
'http://i.imgur.com/tu93sTL.jpg',
'http://i.imgur.com/tu93sTL.jpg'
],
'letter_g' : [
'http://www.lifeprint.com/asl101/signjpegs/g/g1.jpg',
'http://www.lifeprint.com/asl101/signjpegs/g/g2.jpg',
'http://images2.pics4learning.com/catalog/g/thumbs/g_thumb.jpg',
'http://imgur.com/wog08bz.jpg',
'http://i.imgur.com/xsPrfCk.jpg',
'http://i.imgur.com/RQJEDNa.jpg',
'http://i.imgur.com/9NfbVpb.jpg',
'http://i.imgur.com/5fofc5J.jpg',
'http://i.imgur.com/VB1Zb3l.jpg'
],
'letter_h' : [
'http://www.lifeprint.com/asl101/signjpegs/h/h1.jpg',
'http://www.lifeprint.com/asl101/signjpegs/h/h2.jpg',
'http://www.lifeprint.com/asl101/signjpegs/h/h3.jpg',
'http://images2.pics4learning.com/catalog/h/h.jpg',
'http://imgur.com/CWStAMd.jpg',
'http://imgur.com/LCOuoqr.jpg',
'http://i.imgur.com/O28D9QU.jpg',
'http://i.imgur.com/5M3X0RP.jpg',
'http://i.imgur.com/cWbi2Ul.jpg',
'http://i.imgur.com/719dcYC.jpg',
'http://i.imgur.com/BsqRJGS.jpg'
],
'letter_i' : [
'http://www.lifeprint.com/asl101/signjpegs/j/i1.jpg',
'http://images2.pics4learning.com/catalog/i/i.jpg',
'http://imgur.com/TbSpe7K.jpg',
'http://i.imgur.com/jeDqEJd.jpg',
'http://i.imgur.com/yRydMLJ.jpg',
'http://i.imgur.com/RlBX7Cw.jpg',
'http://i.imgur.com/lTM5vRg.jpg',
'http://i.imgur.com/Nc3DR34.jpg',
'http://i.imgur.com/s7DeARK.jpg',
'http://i.imgur.com/U4Xf04c.jpg',
'http://i.imgur.com/AWFRgh1.jpg'
],
'letter_k' : [
"http://www.lifeprint.com/asl101/signjpegs/k/k.jpg",
"http://www.lifeprint.com/asl101/signjpegs/k/k1.jpg",
"http://www.lifeprint.com/asl101/signjpegs/k/k2.jpg",
'http://images2.pics4learning.com/catalog/k/k.jpg',
'http://imgur.com/oth4JHl.jpg',
'http://imgur.com/RX9GheD.jpg'
],
'letter_l' : [
'http://www.lifeprint.com/asl101/signjpegs/l/l.jpg',
'http://images2.pics4learning.com/catalog/l/l.jpg',
'http://imgur.com/3Wrr83R.jpg',
'http://i.imgur.com/Kk00yJi.jpg',
'http://i.imgur.com/Y3PfW5E.jpg'
'http://i.imgur.com/c4VbfM7.jpg',
'http://i.imgur.com/VgEXOrD.jpg',
'http://i.imgur.com/QK3otVV.jpg',
'http://i.imgur.com/tqy78Tw.jpg',
'http://i.imgur.com/HFcYyWC.jpg',
'http://vignette1.wikia.nocookie.net/glee/images/5/53/L_to_Loser.jpg/revision/latest?cb=20100919121543',
'http://i.imgur.com/Sy3MQh5.jpg'
],
'letter_m' : [
'http://www.lifeprint.com/asl101/signjpegs/m/m1.jpg',
'http://www.lifeprint.com/asl101/signjpegs/m/m2.jpg',
'http://images2.pics4learning.com/catalog/m/m.jpg',
'http://i.imgur.com/wJ14Xsp.jpg',
'http://i.imgur.com/cH4Ctwz.jpg',
'http://i.imgur.com/eLcC1Hy.jpg',
'http://i.imgur.com/BH3bj3e.jpg',
'http://i.imgur.com/sf3ylPt.jpg',
'http://i.imgur.com/A6CEht0.jpg'
],
'letter_n' : [
'http://www.lifeprint.com/asl101/signjpegs/n/n1.jpg',
'http://www.lifeprint.com/asl101/signjpegs/n/n2.jpg',
'http://images2.pics4learning.com/catalog/n/n.jpg',
'http://i.imgur.com/pqa8Zyw.jpg',
'http://i.imgur.com/JY0JKp4.jpg',
'http://i.imgur.com/CaOevfe.jpg',
'http://i.imgur.com/zAMaTo6.jpg',
'http://i.imgur.com/phLgLZx.jpg',
'http://i.imgur.com/8YXDFcx.jpg',
'http://i.imgur.com/LB8gklq.jpg'
],
'letter_o':[
'http://www.lifeprint.com/asl101/signjpegs/o/o1.jpg',
'http://www.lifeprint.com/asl101/signjpegs/o/o2.jpg',
'http://www.lifeprint.com/asl101/signjpegs/o/o3.jpg',
'http://images2.pics4learning.com/catalog/o/o.jpg',
'http://imgur.com/85LJSka.jpg',
'http://i.imgur.com/y6ArfBV.jpg',
'http://i.imgur.com/1SED8NN.jpg',
'http://i.imgur.com/do3X45q.jpg',
'http://i.imgur.com/kNEYY1M.jpg',
'http://i.imgur.com/7GGzriv.jpg',
'http://i.imgur.com/8IrR5L9.jpg',
'http://i.imgur.com/CJ4tKYs.jpg'
],
'letter_p': [
'http://www.lifeprint.com/asl101/signjpegs/p/p1.jpg',
'http://www.lifeprint.com/asl101/signjpegs/p/p2.jpg',
'http://www.lifeprint.com/asl101/signjpegs/p/p3.jpg',
'http://images2.pics4learning.com/catalog/p/p.jpg',
'http://i.imgur.com/tkDcZMe.jpg',
'http://i.imgur.com/egNs3cW.jpg',
'http://i.imgur.com/pJ4o3yH.jpg',
'http://i.imgur.com/y3KfSeG.jpg',
'http://i.imgur.com/krug936.jpg',
'http://i.imgur.com/jo63UDp.jpg',
'http://i.imgur.com/ZyiAxwd.jpg'
],
'letter_q': [
'http://www.lifeprint.com/asl101/signjpegs/q/q1.jpg',
'http://www.lifeprint.com/asl101/signjpegs/q/q2.jpg',
'http://images2.pics4learning.com/catalog/q/q.jpg',
'http://imgur.com/jidKKYK.jpg',
'http://i.imgur.com/3eG0iPQ.jpg',
'http://i.imgur.com/RJlOzHO.jpg',
'http://i.imgur.com/kT5qkFL.jpg',
'http://i.imgur.com/La5ytRV.jpg',
'http://i.imgur.com/vM81Zk2.jpg',
'http://i.imgur.com/eKGg70h.jpg',
'http://i.imgur.com/FLEGaaq.jpg',
'http://i.imgur.com/ZV7qQHK.jpg',
'http://i.imgur.com/W6gWT8a.jpg'
],
'letter_r' : [
'http://www.lifeprint.com/asl101/signjpegs/r/r.jpg',
'http://images2.pics4learning.com/catalog/r/thumbs/r_thumb.jpg',
'http://i.imgur.com/9wwRZDc.jpg',
'http://i.imgur.com/xfGtPRf.jpg',
'http://i.imgur.com/uDojFj2.jpg',
'http://i.imgur.com/T7kJULr.jpg',
'http://i.imgur.com/MIZWPZI.jpg',
'http://i.imgur.com/F4MkT8m.jpg',
'http://i.imgur.com/N6Gx7vl.jpg'
],
'letter_s': [
"http://www.lifeprint.com/asl101/signjpegs/s/s.jpg",
'http://images2.pics4learning.com/catalog/s/thumbs/s_thumb.jpg',
'http://i.imgur.com/rmf5jgR.jpg',
'http://i.imgur.com/P3Zq5Dd.jpg',
'http://i.imgur.com/xClBmxV.jpg',
'http://i.imgur.com/hQjYMPn.jpg',
'http://i.imgur.com/2mX9w8T.jpg',
'http://i.imgur.com/Fa70wX8.jpg'
],
'letter_t' : [
'http://www.lifeprint.com/asl101/signjpegs/t/t.jpg',
'http://images2.pics4learning.com/catalog/t/thumbs/t_thumb.jpg',
'http://imgur.com/cirlKJB.jpg',
'http://i.imgur.com/nnDEPLf.jpg',
'http://i.imgur.com/HLxur9q.jpg',
'http://i.imgur.com/bljZk3l.jpg',
'http://i.imgur.com/9GUDD82.jpg',
'http://i.imgur.com/KLL2zzt.jpg',
'http://i.imgur.com/vSvZ15A.jpg',
'http://i.imgur.com/jmKPaJz.jpg'
],
'letter_u': [
'http://www.lifeprint.com/asl101/signjpegs/u/u.jpg',
'http://images2.pics4learning.com/catalog/u/thumbs/u_thumb.jpg',
'http://imgur.com/wgP9cZw.jpg',
'http://i.imgur.com/u9YwhBP.jpg',
'http://i.imgur.com/zUyMaWD.jpg',
'http://i.imgur.com/39rVd1f.jpg',
'http://i.imgur.com/W1SiHte.jpg',
'http://i.imgur.com/zqJ7ziC.jpg',
'http://i.imgur.com/FT9gSS2.jpg',
'http://i.imgur.com/oXrvDE5.jpg',
'http://i.imgur.com/5WOntzk.jpg'
],
'letter_v' : [
'http://www.lifeprint.com/asl101/signjpegs/v/v.jpg',
'http://images2.pics4learning.com/catalog/v/thumbs/v_thumb.jpg',
'http://imgur.com/nXyOWzj.jpg',
'http://i.imgur.com/69NrFjG.jpg',
'http://i.imgur.com/GPyiPNv.jpg',
'http://i.imgur.com/OkHpWff.jpg',
'http://i.imgur.com/NX2G7JW.jpg',
'http://i.imgur.com/Su0ByBz.jpg',
'http://i.imgur.com/rnO7sVH.jpg',
'http://i.imgur.com/YAtArlj.jpg',
'http://i.imgur.com/xDwSHGg.jpg',
'http://i.imgur.com/skhHAqq.jpg'
],
'letter_w' : [
'http://www.lifeprint.com/asl101/signjpegs/w/w.jpg',
'http://images2.pics4learning.com/catalog/w/thumbs/w_thumb.jpg',
'http://i.imgur.com/ep9SPS6.jpg',
'http://i.imgur.com/kyhQ5D4.jpg',
'http://i.imgur.com/mHGWgy4.jpg',
'http://i.imgur.com/BQVK36B.jpg',
'http://i.imgur.com/2lPUvlM.jpg',
'http://i.imgur.com/Zs5QqU8.jpg',
'http://i.imgur.com/WfTMaDV.jpg',
'http://i.imgur.com/5pMmYeR.jpg'
],
'letter_x': [
'http://www.lifeprint.com/asl101/signjpegs/x/x1.jpg',
'http://www.lifeprint.com/asl101/signjpegs/x/x2.jpg',
'http://images2.pics4learning.com/catalog/x/thumbs/x_thumb.jpg',
'http://i.imgur.com/BzGhtvx.jpg',
'http://i.imgur.com/M8oXvMg.jpg',
'http://i.imgur.com/EAGSTO5.jpg',
'http://i.imgur.com/jANf5IK.jpg',
'http://i.imgur.com/BfsrKmH.jpg',
'http://i.imgur.com/KjPCC57.jpg'
],
'letter_y' : [
'http://www.lifeprint.com/asl101/signjpegs/y/y.jpg',
'http://images2.pics4learning.com/catalog/y/thumbs/y_thumb.jpg',
'http://i.imgur.com/lFCvuYs.jpg',
'http://i.imgur.com/cqsOgCx.jpg',
'http://i.imgur.com/BagarbG.jpg',
'http://i.imgur.com/LVhlWhQ.jpg',
'http://i.imgur.com/uKSmVuv.jpg',
'http://i.imgur.com/QYrdAW3.jpg',
'http://i.imgur.com/5RrMIez.jpg',
'http://i.imgur.com/6nhuW9v.jpg',
'http://i.imgur.com/h1AumoX.jpg',
'http://i.imgur.com/v74QoHw.jpg'
],
'applause' : [ "http://www.churchleaders.com/wp-content/uploads/files/article_images/clap_or_not_937398406.jpg",
"http://i.imgur.com/GxvFP6h.jpg",
"http://i.imgur.com/LgXOHBL.jpg",
"http://i.imgur.com/JKmWCEn.jpg",
"http://i.imgur.com/iJkf0st.jpg",
"http://i.imgur.com/Dx1EULd.jpg",
"https://image.freepik.com/free-photo/cook--cosmetics--clapping--hand_3256176.jpg"
]
}
| 33.837349
| 130
| 0.691116
| 1,831
| 11,234
| 4.206445
| 0.185691
| 0.202675
| 0.202545
| 0.263308
| 0.640223
| 0.315373
| 0.138665
| 0.057128
| 0.017658
| 0.017658
| 0
| 0.048263
| 0.051985
| 11,234
| 331
| 131
| 33.939577
| 0.67493
| 0.002225
| 0
| 0.078689
| 0
| 0.022951
| 0.868374
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.121311
| 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
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
100315f0c4c11a88ca1e2f510b90be2734f1cf20
| 133
|
py
|
Python
|
jupyterlab2pymolpysnips/Selection/duplicateObject.py
|
MooersLab/pymolpysnips
|
50a89c85adf8006d85c1d6cd3f8aad7e440a0b92
|
[
"MIT"
] | null | null | null |
jupyterlab2pymolpysnips/Selection/duplicateObject.py
|
MooersLab/pymolpysnips
|
50a89c85adf8006d85c1d6cd3f8aad7e440a0b92
|
[
"MIT"
] | null | null | null |
jupyterlab2pymolpysnips/Selection/duplicateObject.py
|
MooersLab/pymolpysnips
|
50a89c85adf8006d85c1d6cd3f8aad7e440a0b92
|
[
"MIT"
] | null | null | null |
"""
cmd.do('create ${1:t4l}, ${2:1lw9};')
"""
cmd.do('create t4l, 1lw9;')
# Description: Duplicate object.
# Source: placeHolder
| 14.777778
| 37
| 0.609023
| 17
| 133
| 4.764706
| 0.705882
| 0.123457
| 0.271605
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.070175
| 0.142857
| 133
| 8
| 38
| 16.625
| 0.640351
| 0.684211
| 0
| 0
| 0
| 0
| 0.53125
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
101a7d321334b8d15ebfc36762c971697884507e
| 207
|
py
|
Python
|
C_Tut/tutorials/admin.py
|
jaydeep11/C-tutorial-web-application
|
3ec0225efda834fe93a678d887044906124de59b
|
[
"MIT"
] | null | null | null |
C_Tut/tutorials/admin.py
|
jaydeep11/C-tutorial-web-application
|
3ec0225efda834fe93a678d887044906124de59b
|
[
"MIT"
] | null | null | null |
C_Tut/tutorials/admin.py
|
jaydeep11/C-tutorial-web-application
|
3ec0225efda834fe93a678d887044906124de59b
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Tutorial
# Register your models here.
class TutorialAdmin(admin.ModelAdmin):
list_filter=('created_date',)
admin.site.register(Tutorial,TutorialAdmin)
| 34.5
| 43
| 0.811594
| 26
| 207
| 6.384615
| 0.692308
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.096618
| 207
| 6
| 43
| 34.5
| 0.887701
| 0.125604
| 0
| 0
| 0
| 0
| 0.066667
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
122d9b62a77856545299598352c98c228d58d7b3
| 467
|
py
|
Python
|
Apartment_Renting_App/backend/models/admin.py
|
sushilkplassar/csc848_LiveGator
|
e95d861679f1dfb8f547d5b9f7d9b7a4fa530c8d
|
[
"MIT"
] | null | null | null |
Apartment_Renting_App/backend/models/admin.py
|
sushilkplassar/csc848_LiveGator
|
e95d861679f1dfb8f547d5b9f7d9b7a4fa530c8d
|
[
"MIT"
] | 1
|
2021-03-20T05:01:15.000Z
|
2021-03-20T05:01:15.000Z
|
Apartment_Renting_App/backend/models/admin.py
|
pancreaspinch/LiveGator
|
680592aaf7a6c1603c0ae798a8094ca5f3ff250f
|
[
"MIT"
] | null | null | null |
####################################
# File name: admin.py #
# Description:
# Author: Team-13 #
# Submission: Spring-2019 #
# Instructor: Dragutin Petkovic #
####################################
from ..db import DButils
def approve_new_listing(house_id):
DButils.approve_new_listing(house_id)
def block_user(user_id):
DButils.block_user(user_id)
def get_all_to_approve():
return DButils.get_all_to_approve()
| 23.35
| 41
| 0.563169
| 51
| 467
| 4.843137
| 0.588235
| 0.080972
| 0.137652
| 0.178138
| 0.194332
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016129
| 0.203426
| 467
| 20
| 42
| 23.35
| 0.647849
| 0.308351
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.428571
| false
| 0
| 0.142857
| 0.142857
| 0.714286
| 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
|
12389f902c027e864fc9e94cac9bdb0966c22ede
| 129
|
py
|
Python
|
value_assessment/sos_processes/generic_value_assessment/__init__.py
|
os-climate/sostrades-value-assessment
|
ec93df566ef557f2342f6b21db9a0ba3b6097900
|
[
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
value_assessment/sos_processes/generic_value_assessment/__init__.py
|
os-climate/sostrades-value-assessment
|
ec93df566ef557f2342f6b21db9a0ba3b6097900
|
[
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
value_assessment/sos_processes/generic_value_assessment/__init__.py
|
os-climate/sostrades-value-assessment
|
ec93df566ef557f2342f6b21db9a0ba3b6097900
|
[
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
LABEL = 'Generic Value Assessment Process'
DESCRIPTION = 'Process to calculate a value assessment for any manufacturing usecase'
| 43
| 85
| 0.813953
| 16
| 129
| 6.5625
| 0.8125
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139535
| 129
| 2
| 86
| 64.5
| 0.945946
| 0
| 0
| 0
| 0
| 0
| 0.782946
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
124d3bcf7bd4cc790009dd826f1eb5843fae131d
| 220
|
py
|
Python
|
tests/test_miners.py
|
brucelit/skelevision
|
693e9edb3a83fbd5dde27c5b7ba39706b5b02840
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_miners.py
|
brucelit/skelevision
|
693e9edb3a83fbd5dde27c5b7ba39706b5b02840
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_miners.py
|
brucelit/skelevision
|
693e9edb3a83fbd5dde27c5b7ba39706b5b02840
|
[
"BSD-3-Clause"
] | null | null | null |
import os
import pytest
from skelevision import TraceLog, IllegalLogAction, LogSkeleton
HERE = os.path.dirname(os.path.abspath(__file__))
DATA = os.path.join(HERE, "datasets")
class TestLogSkeleton(object):
pass
| 18.333333
| 63
| 0.772727
| 28
| 220
| 5.928571
| 0.714286
| 0.108434
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.127273
| 220
| 12
| 64
| 18.333333
| 0.864583
| 0
| 0
| 0
| 0
| 0
| 0.036199
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.142857
| 0.428571
| 0
| 0.571429
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 4
|
1255bd128acd466951b80030f6d54b6e46ef487d
| 202
|
py
|
Python
|
test.py
|
Rahul-RB/titanium-silver
|
7d62e194e26adf15e26f6a84cbfc454cf5db5a7e
|
[
"MIT"
] | 1
|
2019-09-13T18:55:43.000Z
|
2019-09-13T18:55:43.000Z
|
test.py
|
Rahul-RB/titanium-silver
|
7d62e194e26adf15e26f6a84cbfc454cf5db5a7e
|
[
"MIT"
] | 1
|
2019-04-22T15:49:49.000Z
|
2019-04-22T15:49:50.000Z
|
test.py
|
Rahul-RB/titanium-silver
|
7d62e194e26adf15e26f6a84cbfc454cf5db5a7e
|
[
"MIT"
] | null | null | null |
from titanium_silver.docker_client import Docker_Client
dcli = Docker_Client()
import os
dcli.spawn_process(name='usn-%d'%1, num=1, params='%d 5000'%1, path=os.getcwd()+'/tests/SC', lang='CContainer')
| 33.666667
| 111
| 0.747525
| 33
| 202
| 4.424242
| 0.69697
| 0.246575
| 0.246575
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037634
| 0.079208
| 202
| 5
| 112
| 40.4
| 0.747312
| 0
| 0
| 0
| 0
| 0
| 0.159204
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
89ec34500add6dc7f8c392da2b67be31a4f80c1d
| 37,101
|
py
|
Python
|
backend/config_app/config_decider_ensemble/config_app_data_endpoints.py
|
co-demos/apiviz-backend
|
8a86b92dce728e81c1c935427b890da590edd720
|
[
"MIT"
] | 1
|
2019-12-17T22:31:00.000Z
|
2019-12-17T22:31:00.000Z
|
backend/config_app/config_decider_ensemble/config_app_data_endpoints.py
|
co-demos/apiviz-backend
|
8a86b92dce728e81c1c935427b890da590edd720
|
[
"MIT"
] | 10
|
2019-05-28T19:57:28.000Z
|
2021-06-01T23:46:00.000Z
|
backend/config_app/config_decider_ensemble/config_app_data_endpoints.py
|
co-demos/apiviz-backend
|
8a86b92dce728e81c1c935427b890da590edd720
|
[
"MIT"
] | null | null | null |
# -*- encoding: utf-8 -*-
from . import version, uuid_models
default_data_endpoints_config = [
### - - - - - - - - - - - - - - - ###
### CONFIG DECIDER ENSEMBLE
### - - - - - - - - - - - - - - - ###
### USER MANAGEMENT
### - - - - - - - - - - - - - - - ###
### AUTH ROOT URLS
{ "field" : "app_data_API_root_auth",
"data_type" : "user",
"endpoint_type" : "auth_root",
"content" : u"apiviz default API endpoint for user authentication (root urls)",
"auth_activated" : True,
"root_url" : {
### needs a local instance of toktok if not changed
"default" : "http://localhost:4100/api", # toktok instance on local machine
"default_docker" : "http://host.docker.internal:4100/api", # toktok instance on local machine + docker
### on server ...
"server" : "http://localhost:4100/api", # toktok instance on server
"server_docker" : "http://host.docker.internal:4100/api", # toktok instance on server + docker
"distant_preprod" : "https://preprod.toktok-auth.com/api",
"distant_prod" : "https://toktok-auth.com/api"
},
"args_options" : [
],
"request_header_auth_options" : [
{ "header_field" : u"Accept", "header_value" : "application/json", "is_var" : False, "app_var_name" : None, "header_value_prefix" : None },
{ "header_field" : u"Content-type", "header_value" : "application/json", "is_var" : False, "app_var_name" : None, "header_value_prefix" : None },
{ "header_field" : u"Authorization", "header_value" : None, "is_var" : True, "app_var_name" : "token", "header_value_prefix" : None },
],
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoints for authentication",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### CONFIRM JWT
{ "field" : "app_data_API_user_auth",
"data_type" : "user",
"endpoint_type" : "confirm_jwt",
"content" : u"apiviz default API endpoint for user authentication (confirm acces)",
"root_url" : "/auth/tokens/confirm_access",
"args_options" : [
{ "app_arg" : "authToken", "arg" : "token", "optional" : False, "in" : ["url","header"], "default" : "", "type" : "str" },
],
"resp_fields" : {
"access_token" : { "path" : "tokens/access_token" },
"refresh_token" : { "path" : "tokens/refresh_token" },
"msg" : { "path" : "msg" },
"user_role" : { "path" : "data/auth/role" },
"user_id" : { "path" : "data/_id" },
"user_name" : { "path" : "data/infos/name" },
"user_surname" : { "path" : "data/infos/surname" },
"user_pseudo" : { "path" : "data/infos/pseudo" },
"user_email" : { "path" : "data/infos/email" },
},
"roles" : {
### defining roles in frontend
"admin" : { "resp_role" : "admin", "help" : "can access all backoffice (lox level access)" },
"staff" : { "resp_role" : "staff", "help" : "can access backoffice (high level access)" },
"registred" : { "resp_role" : "registred", "help" : "registred user" },
"guest" : { "resp_role" : "guest", "help" : "logged but not registred" },
"anonymous" : { "resp_role" : "anonymous", "help" : "logged as anonymous" },
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint for a JWT check",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### NEW ACCESS JWT
{ "field" : "app_data_API_user_new_access_token",
"data_type" : "user",
"endpoint_type" : "new_access_token",
"content" : u"apiviz default API endpoint for user authentication (new acces token) : needs a valid refresh token as token ",
"root_url" : "/auth/tokens/new_access_token",
"args_options" : [
{ "app_arg" : "authToken", "arg" : "token", "optional" : False, "in" : ["url","header"], "default" : "", "type" : "str" },
],
"resp_fields" : {
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint for a new access JWT ",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### REGISTER
{ "field" : "app_data_API_user_register",
"data_type" : "user",
"endpoint_type" : "register",
"content" : u"apiviz default API endpoint for registering a new user",
"root_url" : "/usr/register",
"args_options" : [
{ "app_arg" : "name", "arg" : "name", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
{ "app_arg" : "surname", "arg" : "surname", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
{ "app_arg" : "email", "arg" : "email", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
{ "app_arg" : "password", "arg" : "pwd", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
{ "app_arg" : "agreement", "arg" : "agreement", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
{ "app_arg" : "locale", "arg" : "lang", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
{ "app_arg" : "u_data", "arg" : "u_data", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
],
"resp_fields" : {
},
"app_version" : version,
"method" : "POST",
"help" : u"define the endpoint for registering a new user",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"needs_form" : True,
"is_default" : True
},
### LOGIN
{ "field" : "app_data_API_user_login",
"data_type" : "user",
"endpoint_type" : "login",
"content" : u"apiviz default API endpoint for login",
"root_url" : "/auth/login",
"args_options" : [
{ "app_arg" : "email", "arg" : "email", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
{ "app_arg" : "password", "arg" : "pwd", "optional" : False, "in" : ["payload"], "default" : "", "type" : "str" },
],
"resp_fields" : {
},
"app_version" : version,
"method" : "POST",
"help" : u"define the endpoint for login an user",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"needs_form" : True,
"is_default" : True
},
### USER LIST
{ "field" : "app_data_API_user_list",
"data_type" : "user",
"endpoint_type" : "user_modif",
"content" : u"apiviz default API endpoint for users list",
"root_url" : "/usr/infos/list",
"args_options" : [
{ "app_arg" : "authToken", "arg" : "token", "optional" : False, "in" : ["url","header"], "default" : "", "type" : "str" },
{ "app_arg" : "pageUser", "arg" : "page", "optional" : True, "in" : ["url"], "default" : 1, "type": "int" },
{ "app_arg" : "perPageUser", "arg" : "per_page", "optional" : True, "in" : ["url"], "default" : 50, "type": "int" },
],
"resp_fields" : {
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : an user ",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### USER INFOS
{ "field" : "app_data_API_user_infos",
"data_type" : "user",
"endpoint_type" : "user_modif",
"content" : u"apiviz default API endpoint for user infos",
"root_url" : "/usr/infos/get_one",
"args_options" : [
{ "app_arg" : "authToken", "arg" : "token", "optional" : False, "in" : ["url","header"], "default" : "", "type" : "str" },
{ "app_arg" : "userID", "arg" : "doc_id", "optional" : True, "in" : ["url"], "default" : "", "type" : "str"}
],
"resp_fields" : {
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : an user ",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### USER EDIT
{ "field" : "app_data_API_user_edit",
"data_type" : "user",
"endpoint_type" : "user_modif",
"content" : u"apiviz default API endpoint for editing an user",
"root_url" : "/auth/edit/",
"args_options" : [
{ "app_arg" : "authToken", "arg" : "token", "optional" : False, "in" : ["url","header"], "default" : "", "type" : "str" },
{ "app_arg" : "userID", "arg" : "doc_id", "optional" : True, "in" : ["url"], "default" : "", "type" : "str"}
],
"resp_fields" : {
},
"app_version" : version,
"method" : "PUT",
"help" : u"define the endpoint to get data for : an user ",
"needs_form" : True,
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### USER DELETE
{ "field" : "app_data_API_user_delete",
"data_type" : "user",
"endpoint_type" : "user_modif",
"content" : u"apiviz default API endpoint for deleting an user",
"root_url" : "/auth/edit/",
"args_options" : [
{ "app_arg" : "authToken", "arg" : "token", "optional" : False, "in" : ["url","header"], "default" : "", "type" : "str" },
{ "app_arg" : "userID", "arg" : "doc_id", "optional" : True, "in" : ["url"], "default" : "", "type" : "str"}
],
"resp_fields" : {
},
"app_version" : version,
"method" : "DELETE",
"help" : u"define the endpoint to get data for : an user ",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### USER FORGOT PWD
{ "field" : "app_data_API_forgot_pwd",
"data_type" : "user",
"endpoint_type" : "user_modif",
"content" : u"apiviz default API endpoint for changing password",
"root_url" : "/auth/password/password_forgotten",
"args_options" : [
{ "app_arg" : "authToken", "arg" : "token", "optional" : False, "in" : ["url","header"], "default" : "", "type" : "str" },
],
"resp_fields" : {
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : an user ",
"needs_form" : True,
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### - - - - - - - - - - - - - - - ###
### DATA ENDPOINTS
### - - - - - - - - - - - - - - - ###
### DATA FILTERS
{ "field" : "tl_data_API_filters",
"is_visible" : True,
"is_disabled" : False,
"data_type" : "data",
"endpoint_type" : "filters",
"dataset_uri" : "fiches",
"available_views" : ['VIEW_LIST', 'VIEW_MAP'],
"has_shuffle" : False,
"has_pagination" : False,
"has_export" : True,
"pagination_options" : {
"per_page" : [ 5, 10, 25, 100 ],
},
"has_infinite_scroll" : True,
"has_order_by" : False,
"order_by_options" : {
"order_by_list" : [],
},
"placeholder" : [
{"locale" : "en", "text" : "Enter the name of a project"},{"locale" : "es", "text" : "pendiente"},{"locale" : "tr", "text" : "yapılmamış"},{"locale" : "de", "text" : "ungemacht"}, {"locale" : "fr", "text" : "Tapez le nom d'un projet" }
],
"items_found" : [
{"locale" : "en", "text" : "files found"},{"locale" : "es", "text" : "pendiente"},{"locale" : "tr", "text" : "yapılmamış"},{"locale" : "de", "text" : "ungemacht"}, {"locale" : "fr", "text" : "fiches trouvées" }
],
"stats_text" : [
{"locale" : "en", "text" : "experimental"},{"locale" : "es", "text" : "experimental"},{"locale" : "tr", "text" : "yapılmamış"},{"locale" : "de", "text" : "ungemacht"}, {"locale" : "fr", "text" : "expérimental" }
],
"reset" : [
{"locale" : "en", "text" : "reset"},{"locale" : "es", "text" : "pendiente"},{"locale" : "tr", "text" : "yapılmamış"},{"locale" : "de", "text" : "ungemacht"}, {"locale" : "fr", "text" : "effacer" }
],
"content" : u"apiviz default API endpoint for navbar filters",
"root_url" : "https://solidata-api.co-demos.com/api/dsi/infos/get_one/5e8f4f59328ed74e1eea3ca6",
"args_options" : [
{ "app_arg" : "dataToken", "arg" : "token", "optional" : True, "in" : ["url","header"], "default" : "", "type": "str" },
{ "app_arg" : "filtersList", "arg" : "get_filters", "optional" : False, "in" : ["url"], "default" : True, "type": "bool" }, # also working with dsi?
{ "app_arg" : "filterChoices", "arg" : "get_uniques", "optional" : False, "in" : ["url"], "default" : "tag", "type": "str" },
],
"filter_options" : [
{ "name" : u"code_thematique__",
"id" : "filter_1",
"col_name" : "code_thematique",
"dataType" : "text",
"filter_title" : [{"locale" : "en", "text" : "Themas"},{"locale" : "es", "text" : "pendiente"},{"locale" : "tr", "text" : "yapılmamış"},{"locale" : "de", "text" : "ungemacht"}, {"locale" : "fr", "text" : "Thématique principale" }],
"choices" : [
{'name' : u'ACT', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Action et inclusion sociale' }]},
# {'name' : u'BUD', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Budget' }]},
# {'name' : u'VIE', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Cadre de vie' }]},
# {'name' : u'CUL', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Culture' }]},
# {'name' : u'DEM', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Démocratie et citoyenneté' }]},
{'name' : u'JEU', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Jeunesse, Education et Culture' }]},
{'name' : u'ENV', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Environnement' }]},
# {'name' : u'LOG', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Logement' }]},
# {'name' : u'SER', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Organisation des services publics' }]},
{'name' : u'SAN', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Santé' }]},
# {'name' : u'MOB', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Transports & mobilité' }]},
{'name' : u'URB', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Urbanisme et Aménagement' }]},
{'name' : u'MTH', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Multithématique' }]},
],
},
{ "name" : u"code_dispositif__",
"id" : "filter_3",
"col_name" : "code_dispositif",
"dataType" : "text",
"filter_title" : [{"locale" : "en", "text" : "Dispositifs"},{"locale" : "es", "text" : "pendiente"},{"locale" : "tr", "text" : "yapılmamış"},{"locale" : "de", "text" : "ungemacht"}, {"locale" : "fr", "text" : "Type de démarche" }],
"choices" : [
{'name' : u'BP', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Budget et financement participatif' }]},
{'name' : u'DPP', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Dialogue parties prenantes' }]},
# {'name' : u'EP', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Exercice de prospective' }]},
{'name' : u'DC', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Dispositif de consultation' }]},
{'name' : u'IP', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Instance de participation' }]},
{'name' : u'IC', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Interpellation et initiatives citoyennes' }]},
{'name' : u'PN', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Participation en ligne' }]},
{'name' : u'AU', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Autre' }]},
],
},
{ "name" : u"code_structure__",
"id" : "filter_2",
"col_name" : "code_structure",
"dataType" : "text",
"filter_title" : [{"locale" : "en", "text" : "Structures"},{"locale" : "es", "text" : "pendiente"},{"locale" : "tr", "text" : "yapılmamış"},{"locale" : "de", "text" : "ungemacht"}, {"locale" : "fr", "text" : "Porteur de projet" }],
"choices" : [
{'name' : u'AE', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : "Administration d'Etat" }]},
{'name' : u'RG', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Région' }]},
{'name' : u'DEP', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Département' }]},
{'name' : u'GV', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Grande ville, communauté urbaine, métropole' }]},
{'name' : u'VM', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Ville moyenne ou EPCI (20 000 à 100 000 hab.)' }]},
{'name' : u'PV', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Petite ville ou EPCI (moins de 20 000 hab.)' }]},
{'name' : u'AC', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Association ou collectif citoyen' }]},
{'name' : u'ENT', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Entreprise' }]},
{'name' : u'AUT', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Autre' }]},
],
},
# { "name" : u"code_etape__",
# "id" : "filter_4",
# "col_name" : "code_etape",
# "dataType" : "text",
# "filter_title" : [{"locale" : "en", "text" : "Etapes"},{"locale" : "es", "text" : "pendiente"},{"locale" : "tr", "text" : "yapılmamış"},{"locale" : "de", "text" : "ungemacht"}, {"locale" : "fr", "text" : "Etapes" }],
# "choices" : [
# {'name' : u'DER_BUD', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Déroulé du budget participatif' }]},
# {'name' : u'DER_PRO', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Déroulé du projet' }]},
# {'name' : u'DER_SEQ', 'choice_title' : [{'locale' : 'en', 'text' : 'todo'},{'locale' : 'es', 'text' : 'pendiente'},{'locale' : 'tr', 'text' : 'to do'},{'locale' : 'de', 'text' : 'to do'}, {'locale' : 'fr', 'text' : 'Déroulé de la séquence démocratique' }]},
# ],
# },
],
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : filters in search navbar",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### DATA TABLE
{ "field" : "tl_data_API_table",
"is_visible" : True,
"is_disabled" : False,
"data_type" : "data",
"endpoint_type" : "table",
"dataset_uri" : "fiches",
"content" : u"apiviz default API endpoint for list results",
"root_url" : "https://solidata-api.co-demos.com/api/dsi/infos/get_one/5e8f4f59328ed74e1eea3ca6", ## V2
"args_options" : [
{ "app_arg" : "dataToken", "arg" : "token", "optional" : True, "in" : ["url","header"], "default" : "", "type": "str" },
{ "app_arg" : "page", "arg" : "page", "optional" : True, "in" : ["url"], "default" : 1, "type": "int" },
{ "app_arg" : "perPage", "arg" : "per_page", "optional" : True, "in" : ["url"], "default" : 25, "type": "int", "authorized" : [10, 25, 50, 100, 200, 300] },
{ "app_arg" : "sortBy", "arg" : "sort_by", "optional" : True, "in" : ["url"], "default" : "titre_projet", "type": "str" },
{ "app_arg" : "sortIsDescending", "arg" : "descending", "optional" : False, "in" : ["url"], "default" : False, "type": "bool" },
{ "app_arg" : "query", "arg" : "search_for", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
{ "app_arg" : "filters", "arg" : "search_filters", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
{ "app_arg" : "shuffleSeed", "arg" : "shuffle_seed", "optional" : True, "in" : ["url"], "default" : None , "type": "int" },
],
"resp_fields" : {
"projects" : { "resp_format" : "list", "path" : "data/data_raw/f_data" },
"total" : { "resp_format" : "int", "path" : "data/data_raw/f_data_count" },
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : a view list",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### DATA LIST
{ "field" : "tl_data_API_list",
"is_visible" : True,
"is_disabled" : False,
"data_type" : "data",
"endpoint_type" : "list",
"dataset_uri" : "fiches",
"content" : u"apiviz default API endpoint for list results",
"root_url" : "https://solidata-api.co-demos.com/api/dsi/infos/get_one/5e8f4f59328ed74e1eea3ca6", ## V2
"args_options" : [
{ "app_arg" : "dataToken", "arg" : "token", "optional" : True, "in" : ["url","header"], "default" : "", "type": "str" },
{ "app_arg" : "page", "arg" : "page", "optional" : True, "in" : ["url"], "default" : 1, "type": "int" },
{ "app_arg" : "perPage", "arg" : "per_page", "optional" : True, "in" : ["url"], "default" : 50, "type": "int", "authorized" : [10, 25, 50, 100, 200, 300] },
{ "app_arg" : "query", "arg" : "search_for", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
{ "app_arg" : "filters", "arg" : "search_filters", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
{ "app_arg" : "shuffleSeed","arg" : "shuffle_seed", "optional" : True, "in" : ["url"], "default" : None , "type": "int" },
],
"resp_fields" : {
"projects" : { "resp_format" : "list", "path" : "data/data_raw/f_data" },
"total" : { "resp_format" : "int", "path" : "data/data_raw/f_data_count" },
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : a view list",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### DATA DETAIL
{ "field" : "tl_data_API_detail",
"is_visible" : True,
"is_disabled" : False,
"data_type" : "data",
"endpoint_type" : "detail",
"dataset_uri" : "fiches",
"content" : u"apiviz default API endpoint for detailled results",
"root_url" : "https://solidata-api.co-demos.com/api/dsi/infos/get_one/5e8f4f59328ed74e1eea3ca6", ## V2
"args_options" : [
{ "app_arg" : "dataToken", "arg" : "token", "optional" : True, "in" : ["url","header"], "default" : "", "type": "str" },
# { "app_arg" : "itemId", "arg" : "item_id", "optional" : False, "in" : ["url"], "default" : "", "type": "str" },
{ "app_arg" : "itemId", "arg" : "item_id", "optional" : False, "in" : ["url"], "default" : "", "type": "str", "replace_arg": { "arg" : "search_filters", "sub_arg" : "slug", "sep" : "__" }},
],
"resp_fields" : {
"projects" : { "resp_format" : "list", "path" : "data/data_raw/f_data" },
"total" : { "resp_format" : "int", "path" : "data/data_raw/f_data_count" },
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : a detailled data",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### DATA STATS
{ "field" : "tl_data_API_stats",
"is_visible" : False,
"is_disabled" : False,
"data_type" : "data",
"endpoint_type" : "stat",
"dataset_uri" : "fiches",
"content" : u"apiviz default API endpoint for stats results",
"root_url" : "https://solidata-api.co-demos.com/api/dsi/infos/get_one_stats/5e8f4f59328ed74e1eea3ca6", ## V2
"args_options" : [
{ "app_arg" : "dataToken", "arg" : "token", "optional" : True, "in" : ["url","header"], "default" : "", "type": "str" },
{ "app_arg" : "query", "arg" : "search_for", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
{ "app_arg" : "filters", "arg" : "search_filters", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
],
"payload_options" : {
# "payload_format" : "list",
"payload_queries" : [
{
"serie_id" : "tl-stat-bar-horiz",
"agg_fields" : [
{
"agg_field" : "TYPOLOGIE",
"agg_sum_type" : "count_items",
"agg_needs_unwind" : True,
"agg_unwind_separator" : "-"
},
{
"agg_field" : "result_context",
"agg_sum_type" : "count_items",
"agg_needs_unwind" : False,
"agg_unwind_separator" : "-"
}
]
},
{
"serie_id" : "tl-stat-donut",
"agg_fields" : [
{
"agg_field" : "TYPOLOGIE",
"agg_sum_type" : "count_items",
"agg_needs_unwind" : True,
"agg_unwind_separator" : "-"
}
]
},
],
},
"resp_fields" : {
"stats" : { "resp_format" : "dict", "path" : "series" },
# "projects" : { "resp_format" : "dict", "path" : "data" },
# "dimensions" : {
# "quantity" : { "resp_format" : "int", "path" : "data/count", "label" : "" },
# "dimension_A" : { "resp_format" : "str", "path" : "data/_id", "label" : "" },
# "dimension_B" : { "resp_format" : "str", "path" : "data/count", "label" : "" },
# },
# "total" : { "resp_format" : "int", "path" : "/" },
},
"app_version" : version,
"method" : "POST",
"help" : u"define the endpoint to get data for : a stat about the dataset",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### DATA MAP
{ "field" : "tl_data_API_map",
"is_visible" : True,
"is_disabled" : False,
"data_type" : "data",
"endpoint_type" : "map",
"dataset_uri" : "fiches",
"content" : u"apiviz default API endpoint for map results",
"root_url" : "https://solidata-api.co-demos.com/api/dsi/infos/get_one/5e8f4f59328ed74e1eea3ca6", ## V2
"args_options" : [
{ "app_arg" : "dataToken", "arg" : "token", "optional" : True, "in" : ["url","header"], "default" : "", "type": "str" },
{ "app_arg" : "forMap", "arg" : "map_list", "optional" : False, "in" : ["url"], "default" : True, "type": "bool" },
# { "app_arg" : "defaultValue", "arg" : "fields_to_return", "optional" : False, "in" : ["url"], "default" : "INSEEDEP", "type": "str" },
{ "app_arg" : "defaultValue", "arg" : "fields_to_return", "optional" : False, "in" : ["url"], "default" : "result_context,DEPARTEMENT,slug,titre_projet", "type": "str" },
# { "app_arg" : "asLatLng", "arg" : "as_latlng", "optional" : False, "in" : ["url"], "default" : True, "type": "bool" },
# { "app_arg" : "onlyGeocoded", "arg" : "only_geocoded", "optional" : False, "in" : ["url"], "default" : True, "type": "bool" },
# { "app_arg" : "itemId", "arg" : "item_id", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
{ "app_arg" : "query", "arg" : "search_for", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
{ "app_arg" : "filters", "arg" : "search_filters", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
],
"resp_fields" : {
"projects" : { "resp_format" : "list", "path" : "data/data_raw/f_data" },
"total" : { "resp_format" : "int", "path" : "data/data_raw/f_data_count" },
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : map results",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
### DATA EXPORT
{ "field" : "tl_data_API_export",
"is_visible" : True,
"is_disabled" : False,
"data_type" : "data",
"endpoint_type" : "export",
"dataset_uri" : "fiches",
"content" : u"apiviz default API endpoint for export results",
"root_url" : "https://solidata-api.co-demos.com/api/dsi/exports/as_csv/5e8f4f59328ed74e1eea3ca6", ## V2
"args_options" : [
{ "app_arg" : "dataToken", "arg" : "token", "optional" : True, "in" : ["url","header"], "default" : "", "type": "str" },
# { "app_arg" : "page", "arg" : "page_n", "optional" : True, "in" : ["url"], "default" : 1, "type": "int" },
# { "app_arg" : "perPage", "arg" : "per_page", "optional" : True, "in" : ["url"], "default" : 300, "type": "int" },
# { "app_arg" : "query", "arg" : "search_for", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
# { "app_arg" : "filters", "arg" : "search_filters", "optional" : True, "in" : ["url"], "default" : "", "type": "str" },
# { "app_arg" : "shuffleSeed","arg" : "shuffle_seed", "optional" : True, "in" : ["url"], "default" : 205 , "type": "int" },
],
"resp_fields" : {
# "projects" : { "resp_format" : "list", "path" : "data/data_raw/f_data" },
# "total" : { "resp_format" : "int", "path" : "data/data_raw/f_data_count" },
},
"app_version" : version,
"method" : "GET",
"help" : u"define the endpoint to get data for : export dataset as csv",
"apiviz_front_uuid" : uuid_models["uuid_decider_ensemble"],
"is_default" : True
},
]
| 63.747423
| 277
| 0.468855
| 3,696
| 37,101
| 4.537879
| 0.109307
| 0.023611
| 0.031481
| 0.055092
| 0.757572
| 0.737002
| 0.725435
| 0.704329
| 0.697412
| 0.674517
| 0
| 0.007299
| 0.30576
| 37,101
| 581
| 278
| 63.857143
| 0.643864
| 0.150616
| 0
| 0.523404
| 0
| 0.014894
| 0.454076
| 0.027491
| 0
| 0
| 0
| 0.001721
| 0
| 1
| 0
| false
| 0.008511
| 0.002128
| 0
| 0.002128
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
d6099eba2399b5bd164ea1f840b4b2471cc0a763
| 127
|
py
|
Python
|
genoome/disease/exceptions.py
|
jiivan/genoomy
|
e71fdd7ef7440e41efd8e245bbdb61f11b896be5
|
[
"MIT"
] | null | null | null |
genoome/disease/exceptions.py
|
jiivan/genoomy
|
e71fdd7ef7440e41efd8e245bbdb61f11b896be5
|
[
"MIT"
] | 2
|
2016-01-19T13:09:05.000Z
|
2017-03-15T13:49:02.000Z
|
genoome/disease/exceptions.py
|
jiivan/genoomy
|
e71fdd7ef7440e41efd8e245bbdb61f11b896be5
|
[
"MIT"
] | null | null | null |
class DiseaseError(Exception):
"Base class for disease module exceptions."
pass
class ParserError(DiseaseError): pass
| 21.166667
| 47
| 0.76378
| 14
| 127
| 6.928571
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.165354
| 127
| 5
| 48
| 25.4
| 0.915094
| 0.322835
| 0
| 0
| 0
| 0
| 0.322835
| 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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.