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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eccea77ed3a68c101e71d8c442d82954ddf5ff1d | 506 | py | Python | src/Models/type_declaration.py | PqES/ArchPython | 142b02f2c7fff9a3fb375a338af2de2e688f4004 | [
"MIT"
] | 6 | 2020-07-13T23:41:49.000Z | 2022-02-01T21:02:46.000Z | src/Models/type_declaration.py | LimaEduardo/ArchPython | 5a81d0c79d7933f06c26175b1958d604b4c248df | [
"MIT"
] | null | null | null | src/Models/type_declaration.py | LimaEduardo/ArchPython | 5a81d0c79d7933f06c26175b1958d604b4c248df | [
"MIT"
] | 1 | 2020-09-07T13:04:25.000Z | 2020-09-07T13:04:25.000Z | class TypeDeclaration:
def __init__(self, file_path):
self.file_path = file_path
self.types_declared = set()
def add_type_declared(self, new_type):
if type(new_type) == set:
self.types_declared = self.types_declared.union(new_type)
else:
self.types_declared.add(new_type)
def get_json_representation(self):
return {
"file_path" : self.file_path,
"type_declared" : list(self.types_declared)
} | 29.764706 | 69 | 0.614625 | 61 | 506 | 4.721311 | 0.344262 | 0.138889 | 0.295139 | 0.111111 | 0.138889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.29249 | 506 | 17 | 70 | 29.764706 | 0.804469 | 0 | 0 | 0 | 0 | 0 | 0.043393 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0 | 0.071429 | 0.357143 | 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 | 0 | 0 | 0 | 0 | 2 |
ecedefaeda349c0ce2f0f8d89b6f5a68deaab86e | 807 | py | Python | aragwas_server/gwasdb/migrations/0011_auto_20170809_0946.py | 1001genomes/AraGWAS | be02c0480bf18228b07853740e63f249fe31d7e5 | [
"MIT"
] | 11 | 2017-08-03T07:17:56.000Z | 2020-08-26T06:23:45.000Z | aragwas_server/gwasdb/migrations/0011_auto_20170809_0946.py | grimmlab/AraGWAS | 447db9bff377085a65aea05c0f09545e9405cc6c | [
"MIT"
] | 138 | 2017-02-27T18:33:49.000Z | 2022-03-02T04:25:23.000Z | aragwas_server/gwasdb/migrations/0011_auto_20170809_0946.py | grimmlab/AraGWAS | 447db9bff377085a65aea05c0f09545e9405cc6c | [
"MIT"
] | 9 | 2017-10-05T08:45:37.000Z | 2020-11-06T06:48:58.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-08-09 09:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gwasdb', '0010_study_n_hits_fdr'),
]
operations = [
migrations.AddField(
model_name='study',
name='bh_threshold',
field=models.FloatField(blank=True, null=True),
),
migrations.AddField(
model_name='study',
name='bonferroni_threshold',
field=models.FloatField(blank=True, null=True),
),
migrations.AddField(
model_name='study',
name='permutation_threshold',
field=models.FloatField(blank=True, null=True),
),
]
| 26.032258 | 59 | 0.589839 | 82 | 807 | 5.621951 | 0.52439 | 0.117137 | 0.149675 | 0.175705 | 0.54013 | 0.54013 | 0.462039 | 0.462039 | 0.360087 | 0.360087 | 0 | 0.036842 | 0.29368 | 807 | 30 | 60 | 26.9 | 0.77193 | 0.084263 | 0 | 0.521739 | 1 | 0 | 0.129076 | 0.057065 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.086957 | 0 | 0.217391 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
01a01198e4228bd97570d060e85af1489bc81a96 | 8,347 | py | Python | tests/unit/test_str.py | matthewgdv/subtypes | 52caa785f2861c6a9b867ed9b6c3756f8015689b | [
"MIT"
] | 1 | 2019-11-20T00:25:45.000Z | 2019-11-20T00:25:45.000Z | tests/unit/test_str.py | matthewgdv/subtypes | 52caa785f2861c6a9b867ed9b6c3756f8015689b | [
"MIT"
] | null | null | null | tests/unit/test_str.py | matthewgdv/subtypes | 52caa785f2861c6a9b867ed9b6c3756f8015689b | [
"MIT"
] | null | null | null | import pytest
from subtypes import Str
@pytest.fixture
def default_string():
return Str("Hello World!")
@pytest.fixture
def casing_test_string():
return Str("| HiThis_is a CASINGTest-case &")
class TestCase:
pass
class TestReprMixin:
pass
class TestRegexAccessor:
class TestSettings:
def test___int__(self): # synced
assert True
def test___and__(self): # synced
assert True
def test___or__(self): # synced
assert True
def test___rand__(self): # synced
assert True
def test___ror__(self): # synced
assert True
def test_to_flag(self): # synced
assert True
def test___call__(self): # synced
assert True
def test_search(self, default_string): # synced
assert default_string.re.search(r"\bwor[A-Za-z]+\b").group() == "World"
def test_sub(self, default_string): # synced
assert default_string.re.sub(r"world", "Friend") == "Hello Friend!"
def test_findall(self, default_string): # synced
assert [match.group() for match in default_string.re.findall(r"\b[A-Za-z]+\b")] == ["Hello", "World"]
def test_split(self): # synced
assert Str("Hi, how's it going?").re.split(r",?\s+") == ["Hi", "how's", "it", "going?"]
def test_escape(self): # synced
assert True
class TestFuzzyAccessor:
class TestSettings:
pass
def test___call__(self): # synced
assert True
def test_match(self, default_string): # synced
assert default_string.fuzzy.match("Hello Worlds!") > 95
def test_best_n_matches(self, default_string): # synced
assert [
match for match, score in default_string.fuzzy.best_n_matches(
["Hello Worlds!", "Haii, I'm a world!", "Hiya World!", "Hi Friend!"], num=2
).items()
] == ["Hello Worlds!", "Hiya World!"]
def test__determine_matcher(self): # synced
assert True
class TestCasingAccessor:
def test___call__(self): # synced
assert True
def test_snake(self, casing_test_string): # synced
assert casing_test_string.case.snake() == "hi_this_is_a_casing_test_case"
def test_camel(self, casing_test_string): # synced
assert casing_test_string.case.camel() == "hiThisIsACasingTestCase"
def test_pascal(self, casing_test_string): # synced
assert casing_test_string.case.pascal() == "HiThisIsACasingTestCase"
def test_dash(self, casing_test_string): # synced
assert casing_test_string.case.dash() == "hi-this-is-a-casing-test-case"
def test_constant(self, casing_test_string): # synced
assert casing_test_string.case.constant() == "HI_THIS_IS_A_CASING_TEST_CASE"
def test_dot(self, casing_test_string): # synced
assert casing_test_string.case.dot() == "hi.this.is.a.casing.test.case"
def test_slash(self, casing_test_string): # synced
assert casing_test_string.case.slash() == "Hi/This/is/a/CASING/Test/case"
def test_backslash(self, casing_test_string): # synced
assert casing_test_string.case.backslash() == R"Hi\This\is\a\CASING\Test\case"
def test_identifier(self, casing_test_string): # synced
assert Str("123 Hello-world").case.identifier() == "_123_hello_world"
@pytest.mark.parametrize(["value", "expected"], [
("Snake", "Snakes"), ("Hero", "Heroes"), ("Princess", "Princesses"), ("Leaf", "Leaves"),
("Man", "Men"), ("Woman", "Women"), ("Tooth", "Teeth"), ("Mouse", "Mice"), ("Deer", "Deer")
])
def test_plural(self, value, expected): # synced
assert Str(value).case.plural() == expected
def test_from_enum(self): # synced
assert True
class TestSliceAccessor:
class TestSettings:
pass
def test___call__(self): # synced
assert True
def test_before(self, default_string): # synced
assert default_string.slice.before(r"w") == "Hello "
with pytest.raises(ValueError):
default_string.slice.before(r"l")
def test_before_first(self, default_string): # synced
assert default_string.slice.before_first(r"l") == "He"
def test_before_last(self, default_string): # synced
assert default_string.slice.before_last(r"l") == "Hello Wor"
def test_after(self, default_string): # synced
assert default_string.slice.after(r"w") == "orld!"
with pytest.raises(ValueError):
default_string.slice.after(r"l")
def test_after_first(self, default_string): # synced
assert default_string.slice.after_first(r"l") == "lo World!"
def test_after_last(self, default_string): # synced
assert default_string.slice.after_last(r"l") == "d!"
def test_from_(self, default_string): # synced
assert default_string.slice.from_(r"w") == "World!"
with pytest.raises(ValueError):
default_string.slice.from_(r"l")
def test_from_first(self, default_string): # synced
assert default_string.slice.from_first(r"l") == "llo World!"
def test_from_last(self, default_string): # synced
assert default_string.slice.from_last(r"l") == "ld!"
def test_until(self, default_string): # synced
assert default_string.slice.until(r"w") == "Hello W"
with pytest.raises(ValueError):
default_string.slice.until(r"l")
def test_until_first(self, default_string): # synced
assert default_string.slice.until_first(r"l") == "Hel"
def test_until_last(self, default_string): # synced
assert default_string.slice.until_last(r"l") == "Hello Worl"
def test__slice_helper(self): # synced
assert True
class TestTrimAccessor:
def test___call__(self): # synced
assert True
def test_all_whitespace(self): # synced
assert True
def test_whitespace_runs(self): # synced
assert Str("\nHello World!\n\t").trim.whitespace_runs() == "Hello World!"
def test_non_alphanumeric(self, default_string): # synced
assert default_string.trim.non_alphanumeric() == "HelloWorld"
def test_non_ascii(self): # synced
assert Str("★Hi!★").trim.non_ascii() == "Hi!"
class TestBaseStr:
def test___add__(self): # synced
assert True
def test___radd__(self): # synced
assert True
def test___mul__(self): # synced
assert True
def test___rmul__(self): # synced
assert True
def test___mod__(self): # synced
assert True
def test___rmod__(self): # synced
assert True
def test_capitalize(self): # synced
assert True
def test_casefold(self): # synced
assert True
def test_center(self): # synced
assert True
def test_expandtabs(self): # synced
assert True
def test_format(self): # synced
assert True
def test_format_map(self): # synced
assert True
def test_join(self): # synced
assert True
def test_ljust(self): # synced
assert True
def test_lower(self): # synced
assert True
def test_lstrip(self): # synced
assert True
def test_partition(self): # synced
assert True
def test_replace(self): # synced
assert True
def test_rjust(self): # synced
assert True
def test_rpartition(self): # synced
assert True
def test_rstrip(self): # synced
assert True
def test_strip(self): # synced
assert True
def test_swapcase(self): # synced
assert True
def test_title(self): # synced
assert True
def test_translate(self): # synced
assert True
def test_upper(self): # synced
assert True
def test_zfill(self): # synced
assert True
class TestStr:
class TestAccessors:
pass
def test_re(self): # synced
assert True
def test_case(self): # synced
assert True
def test_slice(self): # synced
assert True
def test_trim(self): # synced
assert True
def test_fuzzy(self): # synced
assert True
def test_to_clipboard(self): # synced
assert True
def test_from_clipboard(self): # synced
assert True
| 27.367213 | 109 | 0.63412 | 1,053 | 8,347 | 4.765432 | 0.166192 | 0.112993 | 0.168992 | 0.199283 | 0.640694 | 0.597449 | 0.390594 | 0.314069 | 0.296532 | 0.106417 | 0 | 0.001445 | 0.253864 | 8,347 | 304 | 110 | 27.457237 | 0.80395 | 0.067809 | 0 | 0.338235 | 0 | 0 | 0.095207 | 0.028575 | 0 | 0 | 0 | 0 | 0.397059 | 1 | 0.406863 | false | 0.02451 | 0.009804 | 0.009804 | 0.490196 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
01a0326727c89692ffd2543b096f3891a37e14ea | 50 | py | Python | xtrabackupcloud/__init__.py | kynx/xtrabackupcloud | 3f0c0deffa126499b10f683b1c6cd96bb984d04e | [
"MIT"
] | null | null | null | xtrabackupcloud/__init__.py | kynx/xtrabackupcloud | 3f0c0deffa126499b10f683b1c6cd96bb984d04e | [
"MIT"
] | null | null | null | xtrabackupcloud/__init__.py | kynx/xtrabackupcloud | 3f0c0deffa126499b10f683b1c6cd96bb984d04e | [
"MIT"
] | null | null | null |
__all__ = ["main", "backup", "restore", "shell"]
| 16.666667 | 48 | 0.58 | 5 | 50 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14 | 50 | 2 | 49 | 25 | 0.581395 | 0 | 0 | 0 | 0 | 0 | 0.44898 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
01bffc534f3d43764fdfef6d7a7f4d4d8d92011a | 67 | py | Python | segmentation_models/__version__.py | dmitro-nazarenko/segmentation_models | fed515e33144ec2b65f886a21aa950e07459da8e | [
"MIT"
] | 2 | 2019-10-03T10:23:16.000Z | 2020-03-19T16:23:44.000Z | segmentation_models/__version__.py | dmitro-nazarenko/segmentation_models | fed515e33144ec2b65f886a21aa950e07459da8e | [
"MIT"
] | null | null | null | segmentation_models/__version__.py | dmitro-nazarenko/segmentation_models | fed515e33144ec2b65f886a21aa950e07459da8e | [
"MIT"
] | 1 | 2020-03-18T09:02:44.000Z | 2020-03-18T09:02:44.000Z | VERSION = (1, 0, '0b1')
__version__ = '.'.join(map(str, VERSION))
| 16.75 | 41 | 0.597015 | 9 | 67 | 4 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.070175 | 0.149254 | 67 | 3 | 42 | 22.333333 | 0.561404 | 0 | 0 | 0 | 0 | 0 | 0.059701 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
01e2a8f49fe085e08a473f10595c7f62e24e1ea8 | 355 | py | Python | chat_project/account/admin.py | crisreame/CapstoneProject | caf660bd1f7067822f8778244b56097d1e018f3c | [
"MIT"
] | 1 | 2022-02-10T12:29:22.000Z | 2022-02-10T12:29:22.000Z | chat_project/account/admin.py | crisreame/CapstoneProject | caf660bd1f7067822f8778244b56097d1e018f3c | [
"MIT"
] | null | null | null | chat_project/account/admin.py | crisreame/CapstoneProject | caf660bd1f7067822f8778244b56097d1e018f3c | [
"MIT"
] | 3 | 2021-04-25T01:52:31.000Z | 2021-10-09T04:18:56.000Z | from django.contrib import admin
# Register your models here.
from .models import Profile
from .models import Message
@admin.register(Profile)
class ProfileAdmin(admin.ModelAdmin):
list_display = ['user', 'date_of_birth', 'photo']
@admin.register(Message)
class MessageAdmin(admin.ModelAdmin):
list_display = ['sender', 'receiver', 'message'] | 23.666667 | 53 | 0.752113 | 43 | 355 | 6.116279 | 0.55814 | 0.148289 | 0.121673 | 0.197719 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.126761 | 355 | 15 | 54 | 23.666667 | 0.848387 | 0.073239 | 0 | 0 | 0 | 0 | 0.131098 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
01e6c727e10718c0aa1775b44ff7eba79b8ec5fd | 71,385 | py | Python | TestInterface/sendNW.py | luoyefeiwu/learn_python | e888537c538309d2600a302c0c6e92456dd785c0 | [
"Apache-2.0"
] | null | null | null | TestInterface/sendNW.py | luoyefeiwu/learn_python | e888537c538309d2600a302c0c6e92456dd785c0 | [
"Apache-2.0"
] | null | null | null | TestInterface/sendNW.py | luoyefeiwu/learn_python | e888537c538309d2600a302c0c6e92456dd785c0 | [
"Apache-2.0"
] | null | null | null | # 保存
import requests
import json
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36',
'Content-Type': 'application/json; charset=UTF-8'
}
data = [
{
"projectDeclare": {
"id": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"xmbm": "cd8e93e9-1802-44cf-bd52-76883e9b5a58",
"name": "18888888888",
"type": "A",
"investmentType": "并购",
"constructionType": "",
"projectDebriefing": "意向谋划",
"projectDebriefingDetial": "18888888888.22222",
"bjdsfzc": 2,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 1,
"assessContent": "18888888888",
"assessExplanation": "18888888888",
"standard": 0,
"gbhdz": "AE",
"dz": "Asia",
"province": "AE-AZ*",
"address": "18888888888",
"realm": "A0002",
"industry": "商贸会展中心",
"twoIndustry": "",
"jsnrhmb": "18888888888",
"xmjhztz": 1.888888888822E10,
"xmdwzje": 1.0,
"xmwczje": 1.0,
"xmzqzje": 1.0,
"xmgqzje": 1.0,
"lwyyqk": "无偿援助",
"lwyyqkje": 1.888888888822E10,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqxyw": 0,
"zddbjkqk": 2,
"yhckmfxd": 2,
"qttjdw": 2,
"qttjdwqc": "",
"bsdwqc": "地方发改委",
"mlwt": "政局变动,资金困难",
"mlwtms": "18888888888.22222",
"xybgzkl": "18888888888.22222",
"sjkgsj": "2020-06-09",
"sjwgsj": "2020-06-09",
"pshjq": 2,
"pshjqms": "",
"gfltcgqd": 2,
"gfltcgqdms": "",
"dsfhz": 2,
"dsfhzms": "",
"xcld": 2,
"xcldms": "",
"discountPolicy": "",
"countryDiscountPolicy": "2",
"chinaDiscountPolicy": "1",
"projectSignificance": "18888888888",
"isShareInfo": 2,
"chinaGqzb": "1",
"projectGqzb": "1",
"otherGqzb": "1",
"chinaZqzb": "1",
"projectZqzb": "1",
"otherZqzb": "1",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B933040000000E",
"createName": "北京发改委",
"createDate": "2020-06-24",
"updateId": "BFA831DB0000000072B933040000000E",
"updateName": "北京发改委",
"updateDate": "2020-06-26",
"isSubmit": 1,
"stage": 2,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "7578b042-2a57-4385-bf64-12dac6be47c7",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"tzdwmcName": "18888888888",
"btzdwmcName": "18888888888",
"sort": 1
}
],
"projectConstructions": [
{
"id": "1955a47b-df2d-42e7-92c0-a0da83de8757",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"yzdwName": "",
"jsdwName": "",
"address": "",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "361962ae-cc9e-4664-96ba-7a0bed9e6dca",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"type": 3,
"gdmc": "18888888888.22222",
"sort": 3
},
{
"id": "5d2672dc-9ab8-4446-8f97-addf4306b8e0",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"type": 1,
"gdmc": "18888888888.22222",
"sort": 1
},
{
"id": "5daa72a2-f152-4288-a5ce-2b2b190b9c46",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"type": 2,
"gdmc": "18888888888.22222",
"sort": 2
}
],
"projectXmfxes": [
{
"id": "c7fbaf86-5c10-4e8f-bea5-e1bbd24e2851",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"fxType": "政治风险",
"fxcd": "7",
"description": "18888888888.22222",
"sort": 1
}
],
"projectXmlxrs": [
{
"id": "569b4508-e662-4a3e-b993-ad98100cf1cf",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"name": "18888888888",
"phone": "18888888888",
"type": 4,
"sort": 4
},
{
"id": "91b9b6f6-73c4-411c-8225-ffb8233509af",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"name": "18888888888",
"phone": "18888888888",
"type": 2,
"sort": 2
},
{
"id": "c05c7f49-94f7-49f6-8cf2-395f1e6e40b8",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"name": "18888888888",
"phone": "18888888888",
"type": 1,
"sort": 1
},
{
"id": "e5a15ad6-1131-4c6c-8a7f-c20f78877a0c",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"name": "18888888888",
"phone": "18888888888",
"type": 3,
"sort": 3
}
],
"projectZqgcs": [
{
"id": "6ce1b0d4-a155-4970-b349-ce15fc588ac3",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"type": 3,
"gdmc": "18888888888.22222",
"sort": 3
},
{
"id": "952e03ee-95b6-481f-b25c-a31ae6efc965",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"type": 1,
"gdmc": "18888888888.22222",
"sort": 1
},
{
"id": "c1372c1d-81c3-4925-a6c5-c1e5692238c3",
"projectId": "61be814b-faff-408d-9e46-ec4cc628b5d3",
"type": 2,
"gdmc": "18888888888.22222",
"sort": 2
}
]
},
{
"projectDeclare": {
"id": "ba747bc9-5824-45af-910a-60774d8459fa",
"xmbm": "7e74478c-f308-46a4-9b4d-32e6702258a8",
"name": "测试纵网",
"type": "A,B",
"investmentType": "绿地投资",
"constructionType": "设计施工",
"projectDebriefing": "意向谋划",
"projectDebriefingDetial": "12",
"bjdsfzc": 1,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 3,
"assessContent": "",
"assessExplanation": "",
"standard": 0,
"gbhdz": "C001",
"dz": "A1",
"province": "E001",
"address": "济南",
"realm": "A0006",
"industry": "",
"twoIndustry": "普通",
"jsnrhmb": "12",
"xmjhztz": 123.0,
"cjqshte": 123.0,
"xmdwzje": 123.0,
"xmwczje": 123.0,
"xmzqzje": 12.0,
"xmgqzje": 123.0,
"lwyyqk": ",无偿援助,无息贷款,援外优惠贷款",
"lwyyqkje": 12.0,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqx": 12,
"lwyyqkqxyw": 0,
"lwyyqknhll": 12.0,
"zddbjkqk": 1,
"zddbjkje": 12.0,
"yhckmfxd": 1,
"yhckmfxdje": 12.0,
"yhckmfxdqx": 12,
"yhckmfxdnhll": 12,
"qttjdw": 2,
"qttjdwqc": "",
"bsdwqc": "地方发改委",
"mlwt": "政局变动",
"mlwtms": "12",
"xybgzkl": "12",
"sjkgsj": "2020-06-22",
"sjwgsj": "2020-06-22",
"pshjq": 2,
"pshjqms": "",
"gfltcgqd": 2,
"gfltcgqdms": "",
"dsfhz": 2,
"dsfhzms": "",
"xcld": 2,
"xcldms": "",
"discountPolicy": "",
"countryDiscountPolicy": "1",
"chinaDiscountPolicy": "1",
"projectSignificance": "123",
"isShareInfo": 2,
"chinaGqzb": "1",
"projectGqzb": "1",
"otherGqzb": "1",
"chinaZqzb": "12",
"projectZqzb": "1",
"otherZqzb": "1",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B933040000000E",
"createName": "北京发改委",
"createDate": "2020-06-19",
"updateId": "BFA831DB0000000072B933040000000E",
"updateName": "北京发改委",
"updateDate": "2020-06-23",
"isSubmit": 1,
"stage": 2,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "247977d8-5689-45b3-ab9c-42f0fb0215a9",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"tzdwmcName": "123",
"btzdwmcName": "123",
"sort": 2
},
{
"id": "548019cf-73d6-4e4f-b3fa-1a8cf80b8938",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"tzdwmcName": "12",
"btzdwmcName": "12",
"sort": 1
}
],
"projectConstructions": [
{
"id": "4f5b53b9-e450-4f43-a271-1a3cddf952dd",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"yzdwName": "123",
"jsdwName": "123",
"address": "123",
"sort": 1
},
{
"id": "e763b225-f8d6-492b-8d31-8a255f808514",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"yzdwName": "123",
"jsdwName": "123",
"address": "123",
"sort": 2
}
],
"projectGqgcs": [
{
"id": "3ea2feb9-8c05-4c5a-ae06-5ae168d39174",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"type": 1,
"gdmc": "`12`21",
"sort": 4
},
{
"id": "5ca556e5-65fa-46f4-8cc0-6f1845c03a5d",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"type": 1,
"gdmc": "`12",
"sort": 3
},
{
"id": "99a7f402-93a1-479d-b286-8bd58ca2ce67",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"type": 1,
"gdmc": "`12",
"sort": 2
},
{
"id": "be6c605c-aff9-4a14-bafb-b17fa97f7d92",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"type": 3,
"gdmc": "12",
"sort": 1
}
],
"projectXmfxes": [
{
"id": "5d02fff2-8aaa-4ea3-98b7-ece5b31a9c7d",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"fxType": "政治风险",
"fxcd": "4",
"description": "12",
"sort": 1
},
{
"id": "d8802f3f-5858-49a7-aee5-80047532b1b7",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"fxType": "生态坏境风险",
"fxcd": "7",
"description": "12",
"sort": 2
}
],
"projectXmlxrs": [
{
"id": "06153109-1100-4710-b4ff-f990bcbb20e4",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"name": "123",
"phone": "18500392662",
"type": 3,
"sort": 3
},
{
"id": "226ffa77-7ae0-41d9-8471-023e78775834",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"name": "122",
"phone": "18500392662",
"type": 2,
"sort": 2
},
{
"id": "6040a5de-8e41-4f68-be27-e6ff0a242b44",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"name": "12·",
"phone": "18500392662",
"type": 1,
"sort": 1
},
{
"id": "e0fa64f0-18df-42ba-82fb-133bd319523c",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"name": "124",
"phone": "18500392662",
"type": 4,
"sort": 4
}
],
"projectZqgcs": [
{
"id": "396fc3a3-7ebe-40e0-9787-c60c4ba8ce2b",
"projectId": "ba747bc9-5824-45af-910a-60774d8459fa",
"type": 3,
"gdmc": "12",
"sort": 1
}
]
},
{
"projectDeclare": {
"id": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"xmbm": "dc778c43-6ace-4a5e-8ceb-56207c1bea92",
"name": "我是新建项目",
"type": "",
"investmentType": "并购",
"constructionType": "",
"projectDebriefing": "建前筹备",
"projectDebriefingDetial": "123",
"bjdsfzc": 1,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 1,
"assessContent": "阿斯蒂",
"assessExplanation": " 阿斯蒂",
"standard": 0,
"gbhdz": "C001",
"dz": "A1",
"province": "E001",
"address": "济南hj",
"realm": "A0001",
"industry": "B0001",
"twoIndustry": "普通",
"jsnrhmb": "按市场",
"xmjhztz": 126.0,
"xmdwzje": 123.0,
"xmwczje": 123.0,
"xmzqzje": 45.0,
"xmgqzje": 12.0,
"lwyyqk": "无偿援助",
"lwyyqkje": 12.0,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqxyw": 0,
"zddbjkqk": 2,
"yhckmfxd": 2,
"qttjdw": 2,
"qttjdwqc": "",
"bsdwqc": "地方发改委",
"mlwt": "政局变动",
"mlwtms": "123",
"xybgzkl": "123",
"sjkgsj": "2020-06-18",
"sjwgsj": "2020-06-18",
"pshjq": 2,
"pshjqms": "",
"gfltcgqd": 2,
"gfltcgqdms": "",
"dsfhz": 2,
"dsfhzms": "",
"xcld": 2,
"xcldms": "",
"discountPolicy": "",
"countryDiscountPolicy": "1,2",
"chinaDiscountPolicy": "2",
"projectSignificance": "阿斯蒂",
"isShareInfo": 2,
"chinaGqzb": "12",
"projectGqzb": "12",
"otherGqzb": "12",
"chinaZqzb": "12",
"projectZqzb": "12",
"otherZqzb": "12",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B933040000000E",
"createName": "北京发改委",
"createDate": "2020-06-18",
"updateId": "BFA831DB0000000072B933040000000E",
"updateName": "北京发改委",
"updateDate": "2020-06-23",
"isSubmit": 1,
"stage": 2,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "9232d471-53b7-4002-9002-b80b7e35927a",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"tzdwmcName": "12",
"btzdwmcName": "123",
"sort": 1
}
],
"projectConstructions": [
{
"id": "95d710b7-6b34-4313-8629-bfec87ea614b",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"yzdwName": "",
"jsdwName": "",
"address": "",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "7ffcdafb-320a-45f6-9dc4-1188bef1d8d0",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"type": 1,
"gdmc": "12",
"sort": 1
},
{
"id": "d6e88ed4-e521-4da8-855d-4989f2960e75",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"type": 2,
"gdmc": "12",
"sort": 2
},
{
"id": "e5355612-0add-4255-8f83-8a2d82b17978",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"type": 3,
"gdmc": "123",
"sort": 3
}
],
"projectXmfxes": [
{
"id": "c2965649-b564-48dd-a0b3-8bbf62e3ca3c",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"fxType": "生态坏境风险",
"fxcd": "7",
"description": "123",
"sort": 1
}
],
"projectXmlxrs": [
{
"id": "36f73644-781c-4ea4-980b-6e846b4a58bb",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"name": "阿达",
"phone": "18500392662",
"type": 1,
"sort": 1
},
{
"id": "36f79063-8263-45a4-bd2c-43d46aecdace",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"name": "阿达",
"phone": "18500392662",
"type": 2,
"sort": 2
},
{
"id": "55f8e29f-d9aa-4aa1-ade6-c03b2c8bc51e",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"name": "阿达",
"phone": "18500392662",
"type": 3,
"sort": 3
},
{
"id": "efb58092-9129-44b0-b4ef-83efa38f5eda",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"name": "阿达",
"phone": "18500392662",
"type": 4,
"sort": 4
}
],
"projectZqgcs": [
{
"id": "4889b0bb-4344-4a95-9e20-86917747169f",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"type": 1,
"gdmc": "12",
"sort": 1
},
{
"id": "563a5db4-ac73-4fce-bf77-0593a7b185bb",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"type": 3,
"gdmc": "12",
"sort": 3
},
{
"id": "64cb3089-d1f9-41f4-b8de-bfa0db431f0c",
"projectId": "1f70caad-58dc-4bb4-8bd3-e9421c69def7",
"type": 2,
"gdmc": "12",
"sort": 2
}
]
},
{
"projectDeclare": {
"id": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"xmbm": "2bf83884-4d19-4836-9488-4f479a83c80e",
"name": "我是测试项目报送0615",
"type": "A,B",
"investmentType": "绿地投资",
"constructionType": "施工承包",
"projectDebriefing": "建前筹备",
"projectDebriefingDetial": "314",
"bjdsfzc": 1,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 5,
"assessContent": "123",
"assessExplanation": "123",
"standard": 0,
"gbhdz": "AD",
"dz": "Europe",
"province": "AD-02*",
"address": "济南",
"realm": "A0003",
"industry": "建筑",
"twoIndustry": "",
"jsnrhmb": "阿斯蒂芬",
"xmjhztz": 123.0,
"cjqshte": 123.0,
"xmdwzje": 123.0,
"xmwczje": 123123.0,
"xmzqzje": 123.0,
"xmgqzje": 123.0,
"lwyyqk": "无偿援助,无息贷款,援外优惠贷款",
"lwyyqkje": 12.0,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqx": 123,
"lwyyqkqxyw": 0,
"lwyyqknhll": 123.0,
"zddbjkqk": 1,
"zddbjkje": 123.0,
"yhckmfxd": 1,
"yhckmfxdje": 123.0,
"yhckmfxdqx": 123,
"yhckmfxdnhll": 123,
"qttjdw": 1,
"qttjdwqc": "123",
"bsdwqc": "123123",
"mlwt": "政局变动,资金困难,征地拆迁缓慢",
"mlwtms": "123",
"xybgzkl": "123",
"sjkgsj": "2020-06-15",
"sjwgsj": "2020-06-15",
"pshjq": 1,
"pshjqms": "收到",
"gfltcgqd": 1,
"gfltcgqdms": "请问",
"dsfhz": 1,
"dsfhzms": "收到",
"xcld": 2,
"xcldms": "请问",
"discountPolicy": "",
"countryDiscountPolicy": "1,2,3,4",
"chinaDiscountPolicy": "1,2,3",
"projectSignificance": "请问请问",
"isShareInfo": 2,
"chinaGqzb": "2",
"projectGqzb": "12",
"otherGqzb": "12",
"chinaZqzb": "2",
"projectZqzb": "12",
"otherZqzb": "1",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B97A8A00000010",
"createName": "张三",
"createDate": "2020-06-15",
"updateId": "BFA831DB0000000072B933040000000E",
"updateName": "北京发改委",
"updateDate": "2020-06-26",
"isSubmit": 1,
"stage": 3,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "b6778fca-69d6-4fd2-bd1e-5ea0ad0dcb80",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"tzdwmcName": "投资2",
"btzdwmcName": "被投资2",
"sort": 2
},
{
"id": "f44f86c0-6757-4b2f-8384-e5fc40b9e6d5",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"tzdwmcName": "投资1",
"btzdwmcName": "被投资1",
"sort": 1
}
],
"projectConstructions": [
{
"id": "6cf3546b-1ac9-4220-b263-71f2cc891b5e",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"yzdwName": "业主单位名称2",
"jsdwName": "建设单位名称2",
"address": "北京",
"sort": 2
},
{
"id": "b474ba28-b4a9-4985-a7a3-9b37fc5994cd",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"yzdwName": "业主单位名称1",
"jsdwName": " 建设单位名称1",
"address": "北京",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "6715e1bf-087e-4d28-9510-791c9790af94",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"type": 1,
"gdmc": "123",
"sort": 1
},
{
"id": "77488b37-bd03-42b2-8315-5bf925268434",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"type": 3,
"gdmc": "13",
"sort": 3
},
{
"id": "b4f5130f-7ca6-4441-8762-ec4e67a03725",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"type": 2,
"gdmc": "12",
"sort": 2
}
],
"projectXmfxes": [
{
"id": "1835ce4c-cfa0-437b-aba8-011647f8edf0",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"fxType": "政治风险",
"fxcd": "1",
"description": "123",
"sort": 1
},
{
"id": "5455c114-4674-4aea-b52c-4f32e6d73e42",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"fxType": "安全风险",
"fxcd": "5",
"description": "123",
"sort": 2
},
{
"id": "83f719f4-65da-4d75-b196-c1fa248adeb7",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"fxType": "经济风险",
"fxcd": "9",
"description": "1231",
"sort": 3
}
],
"projectXmlxrs": [
{
"id": "53388e97-d8ab-498e-a926-fd427df880a8",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"name": "的",
"phone": "18500392663",
"type": 3,
"sort": 3
},
{
"id": "77d99f02-deb6-466b-869f-ebbd9faf0bc9",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"name": "123",
"phone": "18500392663",
"type": 2,
"sort": 2
},
{
"id": "c4de02fc-b404-4cd8-bc02-64a7705f67da",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"name": "123",
"phone": "18500392662",
"type": 1,
"sort": 1
}
],
"projectZqgcs": [
{
"id": "2f0fc223-3e89-459b-a68e-833fca29e71e",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"type": 1,
"gdmc": "123",
"sort": 1
},
{
"id": "85aa5924-0cf5-4482-abb5-69ec8b258266",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"type": 3,
"gdmc": "123",
"sort": 3
},
{
"id": "b944574c-7a0b-4362-86db-f6bdd78c5246",
"projectId": "be009293-eaff-4e82-b225-f8cece6ed4dc",
"type": 2,
"gdmc": "123",
"sort": 2
}
]
},
{
"projectDeclare": {
"id": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"xmbm": "62039ed5-7ae4-44fc-a74d-17e7f622a66c",
"name": "项目名称",
"type": "A",
"investmentType": "并购",
"constructionType": "",
"projectDebriefing": "意向谋划",
"projectDebriefingDetial": "测试",
"bjdsfzc": 2,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 5,
"assessContent": "测试",
"assessExplanation": "测试",
"standard": 0,
"gbhdz": "D001",
"dz": "B1",
"province": "G001",
"address": "测试",
"realm": "A0004",
"industry": "光伏发电",
"twoIndustry": "",
"jsnrhmb": "测试",
"xmjhztz": 1.0,
"cjqshte": 1.0,
"xmdwzje": 1.0,
"xmwczje": 1.0,
"xmzqzje": 1.0,
"xmgqzje": 1.0,
"lwyyqk": "无偿援助,无息贷款,优惠援外贷款",
"lwyyqkje": 1.0,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqx": 1,
"lwyyqkqxyw": 0,
"lwyyqknhll": 1.0,
"zddbjkqk": 1,
"zddbjkje": 1.0,
"yhckmfxd": 1,
"yhckmfxdje": 1.0,
"yhckmfxdqx": 1,
"yhckmfxdnhll": 1,
"qttjdw": 1,
"qttjdwqc": "测试",
"bsdwqc": "测试",
"mlwt": "政局变动,资金困难,征地拆迁缓慢",
"mlwtms": "测试测试",
"xybgzkl": "测试",
"sjkgsj": "2020-06-08",
"sjwgsj": "2020-06-17",
"pshjq": 2,
"pshjqms": "测试",
"gfltcgqd": 1,
"gfltcgqdms": "测试测试测试",
"dsfhz": 2,
"dsfhzms": "测试测试测试",
"xcld": 2,
"xcldms": "测试测试",
"discountPolicy": "",
"countryDiscountPolicy": "1,2,3",
"chinaDiscountPolicy": "1,2",
"projectSignificance": "测试",
"isShareInfo": 2,
"chinaGqzb": "1",
"projectGqzb": "1",
"otherGqzb": "1",
"chinaZqzb": "1",
"projectZqzb": "1",
"otherZqzb": "1",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B97A8A00000010",
"createName": "张三",
"createDate": "2020-06-15",
"updateId": "BFA831DB0000000072B933040000000E",
"updateName": "北京发改委",
"updateDate": "2020-06-19",
"isSubmit": 1,
"stage": 3,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "196f0233-fc8d-48e0-9d41-986809f40242",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"tzdwmcName": "测试",
"btzdwmcName": "测试",
"sort": 1
},
{
"id": "5cec322a-9bd3-47f8-be73-deb1a62ba09f",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"tzdwmcName": "测试",
"btzdwmcName": "测试",
"sort": 2
},
{
"id": "e9da9f19-139c-4d85-b275-faa8c2c68ea0",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"tzdwmcName": "测试",
"btzdwmcName": "测试",
"sort": 3
}
],
"projectConstructions": [
{
"id": "decc205d-1a77-434c-80bd-aaa3011fdfbc",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"yzdwName": "",
"jsdwName": "",
"address": "",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "1cea88cb-c959-45ae-a608-bc47b06777f5",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 2,
"gdmc": "测试",
"sort": 2
},
{
"id": "3a5e7126-1b69-49fe-8c36-868446512517",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 2,
"gdmc": "测试",
"sort": 5
},
{
"id": "528e6bd1-1c0c-449b-bb3d-e258576ef997",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 2,
"gdmc": "测试",
"sort": 6
},
{
"id": "70c3482f-b930-41cf-977c-47b1ba1a99cf",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 3,
"gdmc": "测试",
"sort": 7
},
{
"id": "7e508fe3-f384-4572-a6a8-30420f75957c",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 1,
"gdmc": "测试",
"sort": 4
},
{
"id": "9228e4d0-d518-4fd4-b188-b8f815ddf4c4",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 1,
"gdmc": "测试",
"sort": 1
},
{
"id": "f4de1374-188a-46b5-92ba-a37a53697661",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 3,
"gdmc": "测试",
"sort": 3
}
],
"projectXmfxes": [
{
"id": "43c00171-f509-498b-b7f9-4e734f2f49c3",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"fxType": "安全风险",
"fxcd": "6",
"description": "测试",
"sort": 2
},
{
"id": "82b54869-6185-44fa-baba-68448d504818",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"fxType": "政治风险",
"fxcd": "5",
"description": "测试",
"sort": 1
},
{
"id": "9fbf7b23-0355-4a7b-80ee-c52441da12fd",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"fxType": "企业运营风险",
"fxcd": "6",
"description": "测试",
"sort": 4
},
{
"id": "ba4cb21b-9227-4be4-a04e-fc529f540ea5",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"fxType": "经济风险",
"fxcd": "6",
"description": "测试",
"sort": 3
}
],
"projectXmlxrs": [
{
"id": "1661052b-786d-48de-88c7-1bf0f6ef7398",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"name": "测试",
"phone": "18888888888",
"type": 2,
"sort": 2
},
{
"id": "4e30fb68-c86b-43a4-ae69-dc75f13c5042",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"name": "测试",
"phone": "18888888888",
"type": 1,
"sort": 4
},
{
"id": "63b38a85-30eb-48e2-9451-ed1df4fc1457",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"name": "12",
"phone": "18888888888",
"type": 4,
"sort": 7
},
{
"id": "8472e002-76ca-4657-a18e-405a4ddbc82f",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"name": "测试",
"phone": "18888888888",
"type": 2,
"sort": 5
},
{
"id": "c9aeff02-c3e0-4f65-9280-77d3ab1ab9d2",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"name": "测试",
"phone": "18888888888",
"type": 3,
"sort": 3
},
{
"id": "f0f2e182-7e2c-489a-9d51-ff2d0ece2e5b",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"name": "测试",
"phone": "18888888888",
"type": 1,
"sort": 1
},
{
"id": "f35fae8f-06ab-429a-82b6-e167b4aa5ca5",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"name": "测试",
"phone": "18888888888",
"type": 3,
"sort": 6
}
],
"projectZqgcs": [
{
"id": "169a4705-f257-4b34-9b18-bb644f66e048",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 1,
"gdmc": "测试",
"sort": 1
},
{
"id": "1f489846-8f11-4675-a40e-41b9579cc0f9",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 2,
"gdmc": "测试",
"sort": 2
},
{
"id": "2b492c20-0601-43e0-88cd-8d3b7c65ea29",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 3,
"gdmc": "测试",
"sort": 3
},
{
"id": "6eed7533-6e22-4cc7-b065-93a368865fd1",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 1,
"gdmc": "测试",
"sort": 4
},
{
"id": "6f188c65-41cb-4b75-9d25-78d211968fab",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 2,
"gdmc": "测试",
"sort": 5
},
{
"id": "eb567227-0289-4aff-a34c-38222fd08df8",
"projectId": "b32a771f-a534-40ca-9b36-5a0071f56e39",
"type": 3,
"gdmc": "测试",
"sort": 6
}
]
},
{
"projectDeclare": {
"id": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"xmbm": "c0cff192-6b1d-43dc-a8b9-896e6dc9842f",
"name": "1",
"type": "B",
"investmentType": "",
"constructionType": "施工承包",
"projectDebriefing": "建前筹备",
"projectDebriefingDetial": "1",
"bjdsfzc": 2,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 4,
"assessContent": "1",
"assessExplanation": "1",
"standard": 0,
"gbhdz": "D001",
"dz": "B1",
"province": "G002",
"address": "1",
"realm": "A0008",
"industry": "海上搜救",
"twoIndustry": "",
"jsnrhmb": "1",
"xmjhztz": 1.8888888888E10,
"cjqshte": 1.8888888888E10,
"xmdwzje": 1.8888888888E10,
"xmwczje": 1.8888888888E10,
"xmzqzje": 1.0,
"xmgqzje": 1.8888888888E10,
"lwyyqk": "无",
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqxyw": 0,
"zddbjkqk": 2,
"yhckmfxd": 2,
"qttjdw": 2,
"qttjdwqc": "",
"bsdwqc": "1",
"mlwt": "资金困难",
"mlwtms": "1",
"xybgzkl": "1",
"sjkgsj": "2020-06-09",
"sjwgsj": "2020-06-24",
"pshjq": 2,
"pshjqms": "",
"gfltcgqd": 2,
"gfltcgqdms": "",
"dsfhz": 2,
"dsfhzms": "",
"xcld": 2,
"xcldms": "",
"discountPolicy": "",
"countryDiscountPolicy": "1",
"chinaDiscountPolicy": "1",
"projectSignificance": "1",
"isShareInfo": 2,
"chinaGqzb": "1",
"projectGqzb": "1",
"otherGqzb": "1",
"chinaZqzb": "1",
"projectZqzb": "1",
"otherZqzb": "1",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B97A8A00000010",
"createName": "张三",
"createDate": "2020-06-15",
"updateId": "BFA831DB0000000072B97A8A00000010",
"updateName": "张三",
"updateDate": "2020-06-15",
"isSubmit": 1,
"stage": 2,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "015e81e2-ac75-4b2b-b997-fea906f17b32",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"tzdwmcName": "",
"btzdwmcName": "",
"sort": 1
}
],
"projectConstructions": [
{
"id": "646cae8c-7a1e-4ec5-8fb9-f2c23f9e73b2",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"yzdwName": "1",
"jsdwName": "1",
"address": "1",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "6041d460-4ec2-44b2-bd7e-2b45cd172367",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"type": 1,
"gdmc": "1",
"sort": 1
},
{
"id": "e0775cf4-61db-4c3e-bd49-1f5b91bb4a4d",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"type": 2,
"gdmc": "1",
"sort": 2
},
{
"id": "f2ecc357-de85-4abe-985c-dbda78bae5c9",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"type": 3,
"gdmc": "1",
"sort": 3
}
],
"projectXmfxes": [
{
"id": "a302dc12-99de-4ead-8784-6ffaa194510e",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"fxType": "政治风险",
"fxcd": "7",
"description": "1",
"sort": 1
}
],
"projectXmlxrs": [
{
"id": "87c37f03-2bca-4347-b3a2-a0e3eb5a1a22",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"name": "1",
"phone": "18888888888",
"type": 2,
"sort": 2
},
{
"id": "a483bc56-636c-40bb-8a29-65252c06525a",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"name": "1",
"phone": "18888888888",
"type": 1,
"sort": 1
},
{
"id": "d952b1db-05fb-4ac2-a1f9-b1fc335fd608",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"name": "1",
"phone": "18888888888",
"type": 3,
"sort": 3
}
],
"projectZqgcs": [
{
"id": "93824b1b-ea3f-4b6a-a793-52f4352d2b3e",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"type": 3,
"gdmc": "1",
"sort": 3
},
{
"id": "c347d0f5-a6ce-47ff-87a0-cb4d0299f482",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"type": 2,
"gdmc": "1",
"sort": 2
},
{
"id": "d4dd4a8a-0d12-4e33-aa98-04f5bff981ba",
"projectId": "fd9ebb68-7cfe-4478-901b-498e0ef92241",
"type": 1,
"gdmc": "1",
"sort": 1
}
]
},
{
"projectDeclare": {
"id": "675e9449-0f82-46f3-886d-640acc55559d",
"xmbm": "2b5a394d-e538-4057-9d2d-c6d14b430b7f",
"name": "测试001",
"type": "A",
"investmentType": "并购",
"constructionType": "",
"projectDebriefing": "建前筹备",
"projectDebriefingDetial": "项目进展详情",
"bjdsfzc": 1,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 3,
"assessContent": "其他",
"assessExplanation": "严格",
"standard": 0,
"gbhdz": "C001",
"dz": "A1",
"province": "E001",
"address": "济南市",
"realm": "A0002",
"industry": "境外合作区",
"twoIndustry": "",
"jsnrhmb": "目标",
"xmjhztz": 10000.0,
"cjqshte": 10000.0,
"xmdwzje": 10000.0,
"xmwczje": 30000.0,
"xmzqzje": 2000.0,
"xmgqzje": 203120.0,
"lwyyqk": "无偿援助",
"lwyyqkje": 10000.0,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqxyw": 0,
"zddbjkqk": 2,
"yhckmfxd": 2,
"qttjdw": 2,
"qttjdwqc": "",
"bsdwqc": "报送单位",
"mlwt": "征地拆迁缓慢,签证效率低下,资金困难,政局变动",
"mlwtms": "详情",
"xybgzkl": "下一步",
"sjkgsj": "2020-06-13",
"sjwgsj": "2020-06-13",
"pshjq": 1,
"pshjqms": "批示",
"gfltcgqd": 2,
"gfltcgqdms": "",
"dsfhz": 1,
"dsfhzms": "第三方合作",
"xcld": 2,
"xcldms": "",
"discountPolicy": "",
"countryDiscountPolicy": "1,2",
"chinaDiscountPolicy": "1,2",
"projectSignificance": "项目意义",
"isShareInfo": 2,
"chinaGqzb": "30",
"projectGqzb": "10",
"otherGqzb": "10",
"chinaZqzb": "10",
"projectZqzb": "20",
"otherZqzb": "30",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B97A8A00000010",
"createName": "张三",
"createDate": "2020-06-13",
"updateId": "BFA831DB0000000072B933040000000E",
"updateName": "北京发改委",
"updateDate": "2020-06-24",
"isSubmit": 1,
"stage": 3,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "75214fdb-3c56-4497-9947-fa6c701b1024",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"tzdwmcName": "浪潮",
"btzdwmcName": "有生",
"sort": 1
}
],
"projectConstructions": [
{
"id": "5c774879-2b8f-4b49-a9b6-2be8c45b6df8",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"yzdwName": "",
"jsdwName": "",
"address": "",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "a5146062-62a0-445f-862d-829b06342639",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"type": 2,
"gdmc": "所在国股份",
"sort": 2
},
{
"id": "b1c109e1-aa87-47f9-b639-adc9fca5f195",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"type": 1,
"gdmc": "中方股东",
"sort": 1
},
{
"id": "ce67bffe-eaf5-4070-b8d9-0198547ac9ea",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"type": 3,
"gdmc": "第三方股份",
"sort": 3
}
],
"projectXmfxes": [
{
"id": "4c25cf94-7270-4aac-8ccc-424ffb210134",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"fxType": "经济风险",
"fxcd": "5",
"description": "经济风险",
"sort": 2
},
{
"id": "aa0c818c-b164-4618-a905-776390173ad3",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"fxType": "安全风险",
"fxcd": "4",
"description": "安全风险",
"sort": 1
}
],
"projectXmlxrs": [
{
"id": "350f6f65-5cde-4c54-877f-562ba369231a",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"name": "刘惠民",
"phone": "13811111111",
"type": 3,
"sort": 3
},
{
"id": "ee42eae2-18c8-4bcc-9531-b7590655255b",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"name": "成员单位",
"phone": "13621212121",
"type": 2,
"sort": 2
},
{
"id": "f7133b64-c069-4a28-b34f-4865622fbf18",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"name": "孙中壮",
"phone": "18888888888",
"type": 1,
"sort": 1
}
],
"projectZqgcs": [
{
"id": "2f85234a-400c-4af5-8191-dc34d8576992",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"type": 3,
"gdmc": "股东名称",
"sort": 3
},
{
"id": "6a599d5f-d9de-41bb-a8a1-17ad31a2fc0b",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"type": 1,
"gdmc": "中方",
"sort": 1
},
{
"id": "ee8e0373-81ab-4c69-9412-2e2f3d103891",
"projectId": "675e9449-0f82-46f3-886d-640acc55559d",
"type": 2,
"gdmc": "股东名称",
"sort": 2
}
]
},
{
"projectDeclare": {
"id": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"xmbm": "71dce67e-d176-4d9b-834c-e2658004553b",
"name": "我是测试哦",
"type": "A,B",
"investmentType": "并购",
"constructionType": "施工承包",
"projectDebriefing": "意向谋划",
"projectDebriefingDetial": "123",
"bjdsfzc": 1,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 2,
"assessContent": "123",
"assessExplanation": "123",
"standard": 0,
"gbhdz": "D001",
"dz": "B1",
"province": "G001",
"address": "2342",
"realm": "A0001",
"industry": "市政",
"twoIndustry": "",
"jsnrhmb": "123",
"xmjhztz": 123.0,
"cjqshte": 123.0,
"xmdwzje": 123.0,
"xmwczje": 123.0,
"xmzqzje": 123.0,
"xmgqzje": 123.0,
"lwyyqk": "无偿援助,无息贷款,优惠援外贷款",
"lwyyqkje": 123232.0,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqx": 12312,
"lwyyqkqxyw": 0,
"lwyyqknhll": 123123.0,
"zddbjkqk": 2,
"yhckmfxd": 2,
"qttjdw": 2,
"qttjdwqc": "",
"bsdwqc": "1231",
"mlwt": "政局变动,资金困难,征地拆迁缓慢",
"mlwtms": "123",
"xybgzkl": "123",
"sjkgsj": "2020-06-24",
"sjwgsj": "2020-06-25",
"pshjq": 2,
"pshjqms": "",
"gfltcgqd": 2,
"gfltcgqdms": "",
"dsfhz": 2,
"dsfhzms": "",
"xcld": 2,
"xcldms": "",
"discountPolicy": "",
"countryDiscountPolicy": "1,2,3",
"chinaDiscountPolicy": "1",
"projectSignificance": "123123",
"isShareInfo": 2,
"chinaGqzb": "123",
"projectGqzb": "123",
"otherGqzb": "123",
"chinaZqzb": "123",
"projectZqzb": "123",
"otherZqzb": "123",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B97A8A00000010",
"createName": "张三",
"createDate": "2020-06-13",
"updateId": "BFA831DB0000000072B97A8A00000010",
"updateName": "张三",
"updateDate": "2020-06-15",
"isSubmit": 1,
"stage": 2,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "81bcb9e0-c28e-4c19-87ec-580190ab6148",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"tzdwmcName": "投资单位名称",
"btzdwmcName": "123",
"sort": 1
}
],
"projectConstructions": [
{
"id": "6c71bdd4-6e74-4343-9185-99d933b488ea",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"yzdwName": "123",
"jsdwName": "123",
"address": "123",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "0797a9b8-4109-4eb9-bcdd-24c7d48b2d73",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"type": 3,
"gdmc": "12314",
"sort": 3
},
{
"id": "235759fd-bc14-45a5-9d38-ed4df9fb4129",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"type": 2,
"gdmc": "124",
"sort": 2
},
{
"id": "deeed423-96b9-482d-95d9-7bc6786aba91",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"type": 1,
"gdmc": "1212",
"sort": 1
}
],
"projectXmfxes": [
{
"id": "02646100-7dfe-4dbd-a159-fb7ca5b27d59",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"fxType": "经济风险",
"fxcd": "3",
"description": "123",
"sort": 3
},
{
"id": "3db4394c-a7fb-4a22-925b-d5d0f2af220d",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"fxType": "安全风险",
"fxcd": "4",
"description": "123",
"sort": 2
},
{
"id": "ef3ca978-8cff-47e5-b629-5cff3b7495ee",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"fxType": "政治风险",
"fxcd": "3",
"description": "123",
"sort": 1
},
{
"id": "f1dcbc67-361b-4a31-ad73-a7e0e1e364e4",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"fxType": "法律风险",
"fxcd": "3",
"description": "123123",
"sort": 4
}
],
"projectXmlxrs": [
{
"id": "baef4556-c1cd-46ec-bcca-24e2782d2209",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"name": "1231",
"phone": "18500392662",
"type": 1,
"sort": 1
},
{
"id": "eb7c1f57-6a07-4392-92e2-7dc1f061a0b9",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"name": "de",
"phone": "18500392662",
"type": 3,
"sort": 3
},
{
"id": "ebae5d9b-2004-4501-9abe-e765590f421e",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"name": "de",
"phone": "18500392662",
"type": 2,
"sort": 2
}
],
"projectZqgcs": [
{
"id": "0cbd5611-ccde-40a3-82d4-559c5b27bd9b",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"type": 2,
"gdmc": "123",
"sort": 2
},
{
"id": "cf42b6f9-3ee6-4ca9-8cd9-fae57cc608dc",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"type": 3,
"gdmc": "123",
"sort": 3
},
{
"id": "d3e9d074-cd84-43ea-ad18-25815cc95c37",
"projectId": "2d60e422-c67e-4e1f-9d19-64d8ea6f8460",
"type": 1,
"gdmc": "123",
"sort": 1
}
]
},
{
"projectDeclare": {
"id": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"xmbm": "9cdeef55-57ac-421f-850a-a0f3c3dc1147",
"name": "测试后续项目报送",
"type": "A",
"investmentType": "并购",
"constructionType": "",
"projectDebriefing": "意向谋划",
"projectDebriefingDetial": "123",
"bjdsfzc": 1,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 1,
"assessContent": "234",
"assessExplanation": "234",
"standard": 0,
"gbhdz": "C001",
"dz": "A1",
"province": "E001",
"address": "234",
"realm": "A0001",
"industry": "桥梁",
"twoIndustry": "",
"jsnrhmb": "234",
"xmjhztz": 123.0,
"cjqshte": 123.0,
"xmdwzje": 123.0,
"xmwczje": 123.0,
"xmzqzje": 13.0,
"xmgqzje": 123.0,
"lwyyqk": "无偿援助,无息贷款,优惠援外贷款",
"lwyyqkje": 123.0,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqx": 123,
"lwyyqkqxyw": 0,
"lwyyqknhll": 123.0,
"zddbjkqk": 2,
"yhckmfxd": 2,
"qttjdw": 2,
"qttjdwqc": "",
"bsdwqc": "234",
"mlwt": "政局变动,资金困难",
"mlwtms": "123",
"xybgzkl": "123",
"sjkgsj": "2020-06-13",
"sjwgsj": "2020-06-14",
"pshjq": 2,
"pshjqms": "",
"gfltcgqd": 2,
"gfltcgqdms": "",
"dsfhz": 2,
"dsfhzms": "",
"xcld": 2,
"xcldms": "",
"discountPolicy": "",
"countryDiscountPolicy": "1,2,3",
"chinaDiscountPolicy": "3,2,1",
"projectSignificance": "234",
"isShareInfo": 2,
"chinaGqzb": "123",
"projectGqzb": "123",
"otherGqzb": "123",
"chinaZqzb": "123",
"projectZqzb": "123",
"otherZqzb": "123",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B97A8A00000010",
"createName": "张三",
"createDate": "2020-06-13",
"updateId": "BFA831DB0000000072B97A8A00000010",
"updateName": "张三",
"updateDate": "2020-06-15",
"isSubmit": 1,
"stage": 3,
"isNewProject": 0
},
"projcectLnvestments": [
{
"id": "212357ba-7568-43eb-b332-659d8c91f5e5",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"tzdwmcName": "234",
"btzdwmcName": "234",
"sort": 1
}
],
"projectConstructions": [
{
"id": "429b7737-018c-4535-b64a-2027f5f1d071",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"yzdwName": "",
"jsdwName": "",
"address": "",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "7836ad70-2e91-467f-bf53-ad456f682957",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"type": 3,
"gdmc": "123",
"sort": 3
},
{
"id": "a3c30104-6255-4efb-8ebb-f5b3a9095daa",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"type": 1,
"gdmc": "123",
"sort": 1
},
{
"id": "cf431e5f-50bb-4d17-bf80-6fb28208657c",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"type": 2,
"gdmc": "123",
"sort": 2
}
],
"projectXmfxes": [
{
"id": "5af2db01-a46e-4942-9f52-a08e0c611a6e",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"fxType": "政治风险",
"fxcd": "5",
"description": "123",
"sort": 1
},
{
"id": "b87e5ef3-c31d-45ef-a86f-712548d82ba8",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"fxType": "其他风险",
"fxcd": "5",
"description": "123",
"sort": 2
}
],
"projectXmlxrs": [
{
"id": "324b24b9-0aee-43eb-9077-43fbccfe9649",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"name": "234",
"phone": "18500392662",
"type": 1,
"sort": 2
},
{
"id": "714bf727-c7f1-4877-ab97-27b4d4a5c052",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"name": "阿松大",
"phone": "18500392662",
"type": 3,
"sort": 6
},
{
"id": "a107ca6d-c208-4ed5-980a-a84285a61169",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"name": "阿松大",
"phone": "18500392662",
"type": 2,
"sort": 3
},
{
"id": "ac767772-0893-424e-a035-d3707360c438",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"name": "阿松大",
"phone": "18500392662",
"type": 3,
"sort": 5
},
{
"id": "e126476d-a291-4c54-8c86-4a72df32aebe",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"name": "阿松大",
"phone": "18500392662",
"type": 2,
"sort": 4
},
{
"id": "e723126c-113b-49d9-875d-f83fa82fe134",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"name": "234",
"phone": "18500392662",
"type": 1,
"sort": 1
}
],
"projectZqgcs": [
{
"id": "1fa266c0-2144-4349-8b26-50161a7d2da1",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"type": 2,
"gdmc": "123",
"sort": 2
},
{
"id": "34de220f-a86a-4ec7-be35-941ba8985fd5",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"type": 3,
"gdmc": "123",
"sort": 3
},
{
"id": "410ff78b-8587-4c73-a94f-d78b94e11233",
"projectId": "93d7f748-18d5-491f-a479-9c45ecf8e0bd",
"type": 1,
"gdmc": "123",
"sort": 1
}
]
},
{
"projectDeclare": {
"id": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"xmbm": "45e53ea5-7cee-42d4-8bd0-4aa9c816c394",
"name": "新项目报送",
"type": "A,B",
"investmentType": "绿地投资",
"constructionType": "EPC",
"projectDebriefing": "意向谋划",
"projectDebriefingDetial": "123",
"bjdsfzc": 1,
"jfknqk": "",
"kxwjqqk": "",
"yyknqk": "",
"yytcqk": "",
"assess": 1,
"assessContent": "最美好的",
"assessExplanation": "严格说明",
"standard": 0,
"gbhdz": "C001",
"dz": "A1",
"province": "E001",
"address": "济南",
"realm": "A0001",
"industry": "机场",
"twoIndustry": "",
"jsnrhmb": "成为世界第一",
"xmjhztz": 122.0,
"cjqshte": 12.0,
"xmdwzje": 123.0,
"xmwczje": 123.0,
"xmzqzje": 123.0,
"xmgqzje": 123.0,
"lwyyqk": "无偿援助,无息贷款",
"lwyyqkje": 123.0,
"lwyyqkwxje": 0.0,
"lwyyqkywje": 0.0,
"lwyyqkqx": 123,
"lwyyqkqxyw": 0,
"zddbjkqk": 2,
"yhckmfxd": 2,
"qttjdw": 2,
"qttjdwqc": "",
"bsdwqc": "北京百度",
"mlwt": "政局变动,资金困难",
"mlwtms": "1231",
"xybgzkl": "123123",
"sjkgsj": "2020-06-13",
"sjwgsj": "2020-06-14",
"pshjq": 2,
"pshjqms": "",
"gfltcgqd": 2,
"gfltcgqdms": "",
"dsfhz": 2,
"dsfhzms": "",
"xcld": 2,
"xcldms": "",
"discountPolicy": "",
"countryDiscountPolicy": "1,2",
"chinaDiscountPolicy": "2,1",
"projectSignificance": "项目意义",
"isShareInfo": 2,
"chinaGqzb": "123",
"projectGqzb": "123",
"otherGqzb": "123",
"chinaZqzb": "123",
"projectZqzb": "2",
"otherZqzb": "123",
"gardenNum": "",
"gardenAmount": "",
"createJobNum": "",
"taxAmount": "",
"turnover": 0.0,
"profit": 0.0,
"createId": "BFA831DB0000000072B97A8A00000010",
"createName": "张三",
"createDate": "2020-06-13",
"updateId": "BFA831DB0000000072B97A8A00000010",
"updateName": "张三",
"updateDate": "2020-06-13",
"isSubmit": 1,
"stage": 3,
"isNewProject": 1
},
"projcectLnvestments": [
{
"id": "05fd5214-c2da-439f-b362-43e07d645d76",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"tzdwmcName": "投资单位2",
"btzdwmcName": "被投资单位2",
"sort": 2
},
{
"id": "57fce1b6-6152-4c10-ab3c-cd2db5874cca",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"tzdwmcName": "投资单位1",
"btzdwmcName": "被投资单位1",
"sort": 1
}
],
"projectConstructions": [
{
"id": "8e003388-81e9-4677-ae88-af2dfd6e7f82",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"yzdwName": "业主1",
"jsdwName": "1",
"address": "北京",
"sort": 1
}
],
"projectGqgcs": [
{
"id": "14620211-a37b-499d-874f-3dc028125c83",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"type": 3,
"gdmc": "123",
"sort": 3
},
{
"id": "4bef8ff0-f567-48e3-96d5-f56dda791f6e",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"type": 2,
"gdmc": "123",
"sort": 2
},
{
"id": "50f15a2d-d660-4a33-80ac-ef84d56da30f",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"type": 1,
"gdmc": "123",
"sort": 1
}
],
"projectXmfxes": [
{
"id": "1e0e32f0-003d-4f4f-89a6-e796fc6aa4df",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"fxType": "政治风险",
"fxcd": "1",
"description": "123",
"sort": 1
},
{
"id": "b08c142c-4a63-42f3-881a-40af44cce948",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"fxType": "安全风险",
"fxcd": "7",
"description": "123123",
"sort": 2
}
],
"projectXmlxrs": [
{
"id": "1e59df44-328b-4d47-9434-af1ba1ce1d4a",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"name": "张三2",
"phone": "18500392662",
"type": 2,
"sort": 2
},
{
"id": "7693d42f-97a6-4a14-b9cf-7680d839f29c",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"name": "张三3",
"phone": "18500392662",
"type": 3,
"sort": 3
},
{
"id": "b6eb431f-0f13-4b48-a229-ef6af56290d5",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"name": "张三1",
"phone": "18500392662",
"type": 1,
"sort": 1
}
],
"projectZqgcs": [
{
"id": "007218d4-2db5-46ff-bbe7-0d28ae3f2df8",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"type": 1,
"gdmc": "123",
"sort": 1
},
{
"id": "13cf44c4-dfe5-4702-9ea8-4f7c7c92b178",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"type": 2,
"gdmc": "23",
"sort": 2
},
{
"id": "22cafff2-d6db-4112-a10d-60ce97dba771",
"projectId": "6cd57474-c5d0-49f3-beac-866f8a9f98f8",
"type": 3,
"gdmc": "11",
"sort": 3
}
]
}
]
cookies = {}
with open("cookies.txt", 'r') as file:
for line in file.read().split(';'):
name, value = line.strip().split('=', 1)
cookies[name] = value
requests = requests.post('http://192.168.50.116:8080/ydylnw/transport/saveData', data=json.dumps(data),
headers=headers,
cookies=cookies);
print(requests.text);
| 33.033318 | 142 | 0.388317 | 4,910 | 71,385 | 5.645418 | 0.247251 | 0.010823 | 0.007576 | 0.020924 | 0.64389 | 0.605072 | 0.560879 | 0.455572 | 0.423356 | 0.359537 | 0 | 0.249654 | 0.453359 | 71,385 | 2,160 | 143 | 33.048611 | 0.460663 | 0.000028 | 0 | 0.628479 | 0 | 0.000464 | 0.394307 | 0.181883 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.000928 | 0 | 0.000928 | 0.000464 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
01f2e390ab68abdfe2ce3704a931b7d3f13cac4c | 3,417 | py | Python | ryu/app/load_tt_schedule_tb.py | TT-openvswitch/ryu | 7b2fd3cb7ae116cadae25ddea7ac227bd63c1c66 | [
"Apache-2.0"
] | 1 | 2019-01-16T09:59:01.000Z | 2019-01-16T09:59:01.000Z | ryu/app/load_tt_schedule_tb.py | thurtsdn/ryu | 7b2fd3cb7ae116cadae25ddea7ac227bd63c1c66 | [
"Apache-2.0"
] | null | null | null | ryu/app/load_tt_schedule_tb.py | thurtsdn/ryu | 7b2fd3cb7ae116cadae25ddea7ac227bd63c1c66 | [
"Apache-2.0"
] | null | null | null | # Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
def load_tt_flowtable(dirpath):
schedule_path = os.path.join(dirpath, "tables")
# adapter_path = os.path.join(dirpath, "adapter")
all_tables = {}
for _, subdir, _ in os.walk(schedule_path):
for switch in subdir:
flow_tb = []
switch_path = os.path.join(schedule_path, switch)
for _, _, filenames in os.walk(switch_path):
for tbfile in filenames:
port_str, etype_str = os.path.splitext(tbfile)[0].split('_')
port_num = int(port_str[4:]) + 1
etype_num = 0 if etype_str == "send" else 1
tb_path = os.path.join(switch_path, tbfile)
with open(tb_path, 'r') as tb:
flow_num = int(tb.readline())
for i in range(flow_num):
entry = tb.readline()
schd_time, period, flow_id, buffer_id, \
flow_size = entry.split()
flow_tb.append([port_num,
etype_num, int(flow_id),
int(schd_time), int(period),
int(buffer_id), int(flow_size)])
all_tables[int(switch[-1])+1] = flow_tb
return all_tables
def tt_table_generator(dirpath):
schedule_path = os.path.join(dirpath, "tables")
for _, subdir, _ in os.walk(schedule_path):
for switch in subdir:
flow_tb = []
switch_path = os.path.join(schedule_path, switch)
for _, _, filenames in os.walk(switch_path):
for tbfile in filenames:
port_str, etype_str = os.path.splitext(tbfile)[0].split('_')
port_num = int(port_str[4:]) + 1
etype_num = 0 if etype_str == "send" else 1
tb_path = os.path.join(switch_path, tbfile)
with open(tb_path, 'r') as tb:
flow_num = int(tb.readline())
for i in range(flow_num):
entry = tb.readline()
schd_time, period, flow_id, buffer_id, \
flow_size = entry.split()
flow_tb.append([port_num, etype_num, int(flow_id),
int(schd_time), int(period),
int(buffer_id), int(flow_size)])
yield flow_tb
if __name__ == '__main__':
table_path = "/home/chenwh/Workspace/data/linear"
all_tables = load_tt_flowtable(table_path)
# all_tables = tt_table_generator(table_path)
print all_tables
| 44.960526 | 80 | 0.534972 | 408 | 3,417 | 4.25 | 0.301471 | 0.031142 | 0.040369 | 0.056517 | 0.589965 | 0.577855 | 0.577855 | 0.577855 | 0.532872 | 0.532872 | 0 | 0.009355 | 0.374305 | 3,417 | 75 | 81 | 45.56 | 0.801684 | 0.197542 | 0 | 0.730769 | 0 | 0 | 0.024229 | 0.012482 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.019231 | null | null | 0.019231 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
01ff5688a61c85d321773098fb0342781ca02f74 | 10,950 | py | Python | homePage/cached_templates/templates/hotspots.html.py | bmackley/history | cddf1405f23c98702f2c5b4c02571b5cc20a449a | [
"Apache-2.0"
] | null | null | null | homePage/cached_templates/templates/hotspots.html.py | bmackley/history | cddf1405f23c98702f2c5b4c02571b5cc20a449a | [
"Apache-2.0"
] | null | null | null | homePage/cached_templates/templates/hotspots.html.py | bmackley/history | cddf1405f23c98702f2c5b4c02571b5cc20a449a | [
"Apache-2.0"
] | null | null | null | # -*- coding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
STOP_RENDERING = runtime.STOP_RENDERING
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1455063597.584958
_enable_loop = True
_template_filename = '/Users/benmackley/Projects/history/homePage/templates/hotspots.html'
_template_uri = 'hotspots.html'
_source_encoding = 'ascii'
import os, os.path, re
_exports = ['content']
def _mako_get_namespace(context, name):
try:
return context.namespaces[(__name__, name)]
except KeyError:
_mako_generate_namespaces(context)
return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
pass
def _mako_inherit(template, context):
_mako_generate_namespaces(context)
return runtime._inherit_from(context, 'base.htm', _template_uri)
def render_body(context,**pageargs):
__M_caller = context.caller_stack._push_frame()
try:
__M_locals = __M_dict_builtin(pageargs=pageargs)
characters = context.get('characters', UNDEFINED)
identifiedChars = context.get('identifiedChars', UNDEFINED)
request = context.get('request', UNDEFINED)
form = context.get('form', UNDEFINED)
def content():
return render_content(context._locals(__M_locals))
__M_writer = context.writer()
__M_writer(' ')
__M_writer('\n\n\n<!DOCTYPE html>\n <html lang="en" class="no-js">\n <meta charset="UTF-8" />\n\n <title>Hotspot</title>\n\n <meta name="description" content="" />\n <meta name="keywords" value="" />\n\n <link rel="stylesheet" href="/static/homePage/css/layout.css" type="text/css" />\n <link rel="stylesheet" href="/static/homePage/css/hotspot-map-editor.css" type="text/css" />\n <!--Minify file above for production\n <link rel="stylesheet" href="/static/homePage/css/hotspot-map.min.css" type="text/css" /> \n -->\n <link rel="stylesheet" href="/static/homePage/css/lib/colorpicker.css" type="text/css" />\n <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">\n\n <script src="/static/homePage/js/lib/modernizr-2.min.js"> </script>\n\n</head>\n<body>\n')
if 'parent' not in context._data or not hasattr(context._data['parent'], 'content'):
context['self'].content(**pageargs)
return ''
finally:
context.caller_stack._pop_frame()
def render_content(context,**pageargs):
__M_caller = context.caller_stack._push_frame()
try:
characters = context.get('characters', UNDEFINED)
identifiedChars = context.get('identifiedChars', UNDEFINED)
request = context.get('request', UNDEFINED)
form = context.get('form', UNDEFINED)
def content():
return render_content(context)
__M_writer = context.writer()
__M_writer('\n')
if identifiedChars == 'no characters':
__M_writer(' <hr>\n')
else:
for i in identifiedChars:
__M_writer(' <a class = "hotspotInfo" id = ')
__M_writer(str(i.id))
__M_writer('\n data-id = ')
__M_writer(str(i.id))
__M_writer('\n data-x = ')
__M_writer(str(i.hotspot_x))
__M_writer('\n data-y = ')
__M_writer(str(i.hotspot_y))
__M_writer('\n data-width = ')
__M_writer(str(i.hotspot_width))
__M_writer('\n data-height = ')
__M_writer(str(i.hotspot_height))
__M_writer('\n')
if i.sign is None:
__M_writer(" data-sign = 'None'\n")
else:
__M_writer(' data-sign = ')
__M_writer(str(i.sign.filepath))
__M_writer('\n')
__M_writer(' > </a>\n')
__M_writer('</div>\n')
if request.user.is_authenticated():
__M_writer(' <center><h3>Tag characters and match the correct sign to the character. </h3></center>\n<!--\n<div class="row">\n <div class="col col s2 offset-s10"><i class="fa fa-angle-right fa-5x"></i>\n-->\n</div>\n</div>\n<div id="shell" data-username=')
__M_writer(str(request.user))
__M_writer('>\n <div id="hb-shell">\n <!--\n <div id="hb-top-wrap" class="hb-main-wrap">\n <div id="hb-global-settings-wrap">\n <h1>Global Settings</h1>\n <table>\n <tr>\n <td width="100">Show tooltips on: </td>\n <td>\n <select id="show-select" autocomplete="off">\n <option value="mouseover" selected>Mouseover</option>\n <option value="click">Click</option>\n <option value="always">Always Visible</option>\n </select>\n <div class="form-help">This option determines how the user will trigger the tooltips - when he clicks on the spot, when he hovers the mouse over it, or the tooltips will be visible all the time. This is not active in the content builder.</div>\n </td>\n </tr>\n <tr>\n <td width="100">Responsive: </td>\n <td>\n <input type="checkbox" id="checkbox-responsive">\n <div class="form-help">If this is checked, the widget will be as wide as it\'s parent, while still preserving the image ratio. If not checked, the widget\'s size will be as the size of the image.</div>\n </td>\n </tr>\n </table>\n </div>\n </div>\n <div id="hb-main-wrap" class="hb-main-wrap">\n <div id="hb-settings-wrap">\n <h2>Selected Spot Settings</h2>\n <table>\n <tr>\n <td width="100">Spot visibility: </td>\n <td>\n <select id="visible-select">\n <option value="visible">Visible</option>\n <option value="invisible" selected>Invisible</option>\n </select>\n <div class="form-help">Determines the visibility of the spot. If set to "invisible", the user will not know that there is a spot, unless he triggers it. <br />The spot will not look the same in the final product as it looks in the content builder.</div>\n </td>\n </tr>\n <tr>\n <td width="100">Tint Color: </td>\n <td>\n <input type="text" id="input-tint-color">\n </td>\n </tr>\n <tr>\n <td width="100">Tooltip width: </td>\n <td>\n <input type="text" id="tooltip-width">\n <input type="checkbox" id="tooltip-auto-width" checked value="Auto"><label for="tooltip-auto-width">Auto</label>\n <div class="form-help">If you need a fixed value for the tooltip set a number in pixels (without "px") in the text field. If you don't, then check "Auto".</div>\n </td>\n </tr>\n <tr>\n <td>Popup position: </td>\n <td>\n <select id="position-select">\n <option value="left" selected>Left</option>\n <option value="right">Right</option>\n <option value="top">Top</option>\n <option value="bottom">Bottom</option>\n </select>\n <div class="form-help">Choose where you want the popup to appear, relative to the spot that it belongs to.</div>\n </td>\n </tr>\n <tr>\n <td>Content: </td>\n <td>\n <textarea id="content" autocomplete="off"></textarea>\n </td>\n </tr>\n <tr><td> </td><td> </td></tr>\n <tr>\n <td>Delete?</td>\n <td><input type="button" id="delete" value="Delete Spot"></td>\n </tr>\n </table>\n </div>\n -->\n <div id="hb-map-wrap">\n <img id =\'Tablet\' src ="/static/homePage/images/Tablets/KUG03-obv-01.jpg">\n </div>\n <div class="clear"></div>\n </div>\n \n\t<!--\n <div id="hb-bottom-wrap" class="hb-main-wrap">\n <h1>Live Preview</h1>\n <div id="hb-live-preview"></div>\n </div>\n <div id="hb-bottom-wrap" class="hb-main-wrap">\n <div class="left">\n <h1>HTML Code</h1>\n <textarea id="hb-html-code" autocomplete="off"></textarea>\n </div>\n\n <div class="right">\n <h1>JavaScript Code</h1>\n <textarea id="hb-javascript-code" autocomplete="off"></textarea>\n </div>\n <div class="clear"></div>\n </div>\n -->\n </div>\n <div>\n <p class = \'success\'></p>\n <div>\n')
else:
__M_writer(' <div>\n <form method="POST">\n ')
__M_writer(str( form ))
__M_writer('\n <div class="row">\n <br>\n <div class="col-md-7">\n <input type="submit" value="Sign In" class="btn btn-cta-secondary pull-right push-bottom" data-loading-text="Loading...">\n </div>\n </div>\n </form>\n </div>\n')
__M_writer('</div>\n<div id = "Assyrian_sign" class = "inline" style = " bottom: 0px; background-color: black; position: fixed; width: 100%; z-index: 10000">\n <ul class="social-icons list-inline draggable-char col-md-12 col-sm-12 col-xs-12">\n')
for object in characters:
__M_writer(' <li><img id = "Sign')
__M_writer(str(object.Sign.id))
__M_writer('" data-id = ')
__M_writer(str(object.Sign.id))
__M_writer(' class = "Individual_signs" src="')
__M_writer(str(object.Sign))
__M_writer('"></li>\n')
__M_writer(' </ul>\n</div>\n <script src="/static/homePage/js/lib/jquery.min.js"></script>\n<script src="/static/homePage/js/lib/colorpicker.js"></script>\n <script src="/static/homePage/js/hotspot-map-editor.js"></script>\n <script src="/static/homePage/js/hotspot-map.min.js"></script>\n <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>\n</body>\n\n')
return ''
finally:
context.caller_stack._pop_frame()
"""
__M_BEGIN_METADATA
{"source_encoding": "ascii", "line_map": {"28": 0, "39": 1, "40": 1, "50": 25, "60": 25, "61": 26, "62": 27, "63": 28, "64": 29, "65": 30, "66": 30, "67": 30, "68": 31, "69": 31, "70": 32, "71": 32, "72": 33, "73": 33, "74": 34, "75": 34, "76": 35, "77": 35, "78": 36, "79": 37, "80": 38, "81": 39, "82": 39, "83": 39, "84": 41, "85": 44, "86": 45, "87": 46, "88": 53, "89": 53, "90": 163, "91": 164, "92": 166, "93": 166, "94": 176, "95": 179, "96": 180, "97": 180, "98": 180, "99": 180, "100": 180, "101": 180, "102": 180, "103": 182, "109": 103}, "filename": "/Users/benmackley/Projects/history/homePage/templates/hotspots.html", "uri": "hotspots.html"}
__M_END_METADATA
"""
| 96.052632 | 4,397 | 0.569406 | 1,520 | 10,950 | 3.956579 | 0.261184 | 0.027935 | 0.014965 | 0.011972 | 0.416196 | 0.354506 | 0.315763 | 0.27702 | 0.227802 | 0.169937 | 0 | 0.035924 | 0.252603 | 10,950 | 113 | 4,398 | 96.902655 | 0.698925 | 0.001826 | 0 | 0.373737 | 0 | 0.080808 | 0.659855 | 0.163277 | 0 | 0 | 0 | 0 | 0 | 1 | 0.070707 | false | 0.010101 | 0.020202 | 0.020202 | 0.161616 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bf11b1cf9b95eba254cc89adaa3c829d00533ea1 | 14,056 | py | Python | apps/test/test_role.py | Cyberia-ecode/summer-of-code-meg | 02fb6a0e12d29be00b99d64bf91ab4b008fa756d | [
"MIT"
] | null | null | null | apps/test/test_role.py | Cyberia-ecode/summer-of-code-meg | 02fb6a0e12d29be00b99d64bf91ab4b008fa756d | [
"MIT"
] | null | null | null | apps/test/test_role.py | Cyberia-ecode/summer-of-code-meg | 02fb6a0e12d29be00b99d64bf91ab4b008fa756d | [
"MIT"
] | null | null | null | from apps.a_common.constants import UserIdentity
from apps.a_common.scheme import PageInfo
from apps.crud.role import get_users_by_role_id
from apps.model.user import UserDB
from apps.model.user2role import User2RoleDB
from apps.model.role import RoleDB
from apps.test import assert_response_fail, assert_response_success, clean_all, generate_user, generate_user2role, generate_role, get_client, get_session_local, override_get_user
from apps.view.role import role_prefix
from config import API_PREFIX
from utils.encode import uuid
api_prefix = f"{API_PREFIX}/{role_prefix}"
def setup_module():
""" 这个文件下的测试开始之前,会执行这个函数 """
def teardown_module():
""" 这个文件下的测试结束之后,会执行这个函数 """
def setup_function():
""" 这个文件下的每个测试运行之前,都会执行这个函数 """
clean_all()
def teardown_function():
""" 这个文件下的每个测试运行之后,都会执行这个函数 """
def test_get_users_by_role_id_query():
with get_session_local() as session:
user1 = generate_user()
user2 = generate_user()
user3 = generate_user()
role1 = generate_role()
session.add_all((user1, user2, user3, role1))
session.flush()
session.add(User2RoleDB(user_id=user1.id, role_id=role1.id))
session.add(User2RoleDB(user_id=user2.id, role_id=role1.id))
session.commit()
paginate = get_users_by_role_id(session, role1.id, PageInfo(page_id=1, page_size=10))
assert len(paginate.items) == 2
for user in paginate.items:
assert user.id != user3.id
def test_role_list_by_superuser():
with get_session_local() as session:
for i in range(20):
session.add(generate_role())
session.commit()
with override_get_user(is_superuser=True):
client = get_client()
response = client.get(api_prefix)
print(api_prefix)
assert_response_success(response)
assert len(response.json()['data']) == 20
response = client.get(api_prefix, params=dict(page_size=10))
assert_response_success(response)
assert len(response.json()['data']) == 10
response = client.get(api_prefix, params=dict(page_id=2, page_size=10))
assert_response_success(response)
assert len(response.json()['data']) == 10
def test_role_list_by_user_group():
with override_get_user(is_superuser=True):
client = get_client()
response = client.post(api_prefix, json=dict(name=uuid()))
g1 = assert_response_success(response)
response = client.post(api_prefix, json=dict(name=uuid()))
g2 = assert_response_success(response)
response = client.post(api_prefix, json=dict(name=uuid(), parent_id=g1['id']))
g3 = assert_response_success(response)
response = client.post(api_prefix, json=dict(name=uuid(), parent_id=g3['id']))
g4 = assert_response_success(response)
with override_get_user() as user:
user.role_id_set.add(g2['id'])
user.role_set.add(g2['name'])
client = get_client()
response = client.get(api_prefix)
data = assert_response_success(response)
assert len(data) == 1
with override_get_user() as user:
user.role_id_set.add(g3['id'])
user.role_set.add(g3['name'])
client = get_client()
response = client.get(api_prefix)
data = assert_response_success(response)
assert len(data) == 2
with override_get_user() as user:
user.role_id_set.add(g1['id'])
user.role_set.add(g1['name'])
client = get_client()
response = client.get(api_prefix)
data = assert_response_success(response)
assert len(data) == 3
def test_add_role():
with override_get_user(is_superuser=True):
client = get_client()
response = client.post(api_prefix, json=dict(name=uuid()))
g1 = assert_response_success(response)
assert g1['grand_id'] == ''
assert g1['parent_id'] == 0
response = client.post(api_prefix, json=dict(name=uuid()))
g2 = assert_response_success(response)
response = client.post(api_prefix, json=dict(name=uuid(), parent_id=g1['id']))
g3 = assert_response_success(response)
assert g3['grand_id'] == f'|{g1["id"]}|'
assert g3['parent_id'] == g1['id']
response = client.post(api_prefix, json=dict(name=uuid(), parent_id=g3['id']))
g4 = assert_response_success(response)
assert g4['grand_id'] == f'|{g1["id"]}|{g3["id"]}|'
assert g4['parent_id'] == g3['id']
with get_session_local() as session:
assert session.query(RoleDB).count() == 4
def test_role_user_list():
with override_get_user(is_superuser=True):
client = get_client()
response = client.post(api_prefix, json=dict(name=uuid()))
g1 = assert_response_success(response)
response = client.post(api_prefix, json=dict(name=uuid(), parent_id=g1['id']))
g2 = assert_response_success(response)
with get_session_local() as session:
user11 = generate_user()
user12 = generate_user()
user2 = generate_user()
user3 = generate_user()
session.add_all((user11, user12, user2, user3))
session.flush()
session.add_all((generate_user2role(user11.id, g1['id']),
generate_user2role(user12.id, g1['id']),
generate_user2role(user2.id, g2['id']),
generate_user2role(user2.id, g2['id'])
))
session.commit()
with override_get_user() as user:
user.role_id_set.add(g1['id'])
user.role_set.add(g1['name'])
client = get_client()
response = client.get(f'{api_prefix}/{g1["id"]}/users')
data = assert_response_success(response)
assert len(data) == 2
response = client.get(f'{api_prefix}/{g2["id"]}/users')
data = assert_response_success(response)
print(data)
assert len(data) == 1
assert data[0]['id'] == user2.id
def test_update_role_():
with get_session_local() as session:
role1 = generate_role()
role2 = generate_role()
session.add_all((role1, role2))
session.commit()
with override_get_user(is_superuser=True):
client = get_client()
response = client.put(f'{api_prefix}/{role1.id}', json=dict(name='123'))
data = assert_response_success(response)
assert data['name'] == '123'
session.refresh(role1)
assert role1.name == '123'
response = client.put(f'{api_prefix}/{role2.id}', json=dict(name='123'))
assert_response_fail(response)
def test_del_role():
with get_session_local() as session:
user11 = generate_user()
user12 = generate_user()
user2 = generate_user()
user3 = generate_user()
role1 = generate_role()
role2 = generate_role()
session.add_all((user11, user12, user2, user3, role1, role2))
session.flush()
session.add_all((generate_user2role(user11.id, role1.id),
generate_user2role(user12.id, role1.id),
generate_user2role(user2.id, role2.id)
))
session.commit()
with override_get_user(is_superuser=True):
client = get_client()
response = client.delete(f'{api_prefix}/{role1.id}')
assert_response_success(response)
r: User2RoleDB = session.query(User2RoleDB).one()
assert r.user_id == user2.id
assert r.role_id == role2.id
def test_add_user_to_role_by_superuser():
with get_session_local() as session:
user1 = generate_user()
user2 = generate_user()
user3 = generate_user()
role1 = generate_role()
role2 = generate_role()
session.add_all((user1, user2, user3, role1, role2))
session.commit()
with override_get_user(is_superuser=True):
client = get_client()
response = client.post(f'{api_prefix}/{role1.id}/users:add', json=[user1.id, user2.id])
assert_response_success(response)
response = client.get(f'{api_prefix}/{role1.id}/users')
data = assert_response_success(response)
assert len(data) == 2
response = client.post(f'{api_prefix}/{role1.id}/users:add', json=[user2.id, user3.id])
assert_response_success(response)
response = client.get(f'{api_prefix}/{role1.id}/users')
data = assert_response_success(response)
assert len(data) == 3
def test_del_user_to_role():
with get_session_local() as session:
user1 = generate_user()
user2 = generate_user()
user3 = generate_user()
role1 = generate_role()
role2 = generate_role()
session.add_all((user1, user2, user3, role1, role2))
session.flush()
session.add_all((generate_user2role(user1.id, role1.id),
generate_user2role(user1.id, role1.id),
generate_user2role(user2.id, role1.id),
generate_user2role(user2.id, role2.id),
generate_user2role(user3.id, role2.id)
))
session.commit()
with override_get_user(is_superuser=True):
client = get_client()
response = client.post(f'{api_prefix}/{role1.id}/users:delete', json=[user1.id])
assert_response_success(response)
response = client.get(f'{api_prefix}/{role1.id}/users')
data = assert_response_success(response)
assert len(data) == 1
response = client.post(f'{api_prefix}/{role1.id}/users:delete', json=[user2.id, user3.id])
assert_response_success(response)
response = client.get(f'{api_prefix}/{role1.id}/users')
data = assert_response_success(response)
assert len(data) == 0
response = client.get(f'{api_prefix}/{role2.id}/users')
data = assert_response_success(response)
assert len(data) == 2
def test_update_delete_not_find():
not_exist_id = -1
with override_get_user(is_superuser=True):
client = get_client()
response = client.post(f'{api_prefix}/{not_exist_id}/users:delete', json=[1, 2])
assert_response_fail(response)
assert response.json()['code'] == 404
response = client.post(f'{api_prefix}/{not_exist_id}/users:add', json=[1, 2])
assert_response_fail(response)
assert response.json()['code'] == 404
response = client.delete(f'{api_prefix}/{not_exist_id}')
assert_response_fail(response)
assert response.json()['code'] == 404
response = client.put(f'{api_prefix}/{not_exist_id}', json=dict(name=uuid()))
assert_response_fail(response)
assert response.json()['code'] == 404
def test_update_user_as_secretary_and_cancel_user_as_secretary_if_no_user_group():
with get_session_local() as session:
u1 = generate_user()
u2 = generate_user()
u3 = generate_user()
u1.user_identity = UserIdentity.ADMIN
u3.user_identity = UserIdentity.ADMIN
g1 = generate_role()
g2 = generate_role()
session.add_all((u1, u2, u3, g1, g2))
session.commit()
def assert_user_identity(u1_id, u2_id, u3_id, i1, i2, i3):
with get_session_local() as session:
u1 = session.query(UserDB).get(u1_id)
u2 = session.query(UserDB).get(u2_id)
u3 = session.query(UserDB).get(u3_id)
assert u1.user_identity == i1
assert u2.user_identity == i2
assert u3.user_identity == i3
client = get_client()
with override_get_user(is_superuser=True):
# test add
response = client.post(f'{api_prefix}/{g1.id}/users:add', json=[u1.id, u2.id, u3.id])
assert_response_success(response)
assert_user_identity(u1.id, u2.id, u3.id, UserIdentity.COMMON_USER + UserIdentity.ADMIN, UserIdentity.COMMON_USER + UserIdentity.ADMIN, UserIdentity.COMMON_USER + UserIdentity.ADMIN)
# test add more
response = client.post(f'{api_prefix}/{g2.id}/users:add', json=[u2.id, u3.id])
assert_response_success(response)
assert_user_identity(u1.id, u2.id, u3.id, UserIdentity.COMMON_USER + UserIdentity.ADMIN, UserIdentity.COMMON_USER + UserIdentity.ADMIN, UserIdentity.COMMON_USER + UserIdentity.ADMIN)
# test delete
response = client.post(f'{api_prefix}/{g1.id}/users:delete', json=[u1.id, u2.id])
assert_response_success(response)
assert_user_identity(u1.id, u2.id, u3.id, UserIdentity.COMMON_USER, UserIdentity.ADMIN, UserIdentity.ADMIN)
# test delete more
response = client.post(f'{api_prefix}/{g2.id}/users:delete', json=[u2.id, u3.id])
assert_response_success(response)
assert_user_identity(u1.id, u2.id, u3.id, UserIdentity.COMMON_USER, UserIdentity.COMMON_USER, UserIdentity.ADMIN)
# test delete all
response = client.post(f'{api_prefix}/{g1.id}/users:delete', json=[u2.id, u3.id])
assert_response_success(response)
assert_user_identity(u1.id, u2.id, u3.id, UserIdentity.COMMON_USER, UserIdentity.COMMON_USER, UserIdentity.COMMON_USER)
| 39.931818 | 191 | 0.603586 | 1,693 | 14,056 | 4.77023 | 0.076196 | 0.078009 | 0.09101 | 0.12209 | 0.787395 | 0.736132 | 0.700966 | 0.66159 | 0.636825 | 0.589277 | 0 | 0.028861 | 0.277746 | 14,056 | 351 | 192 | 40.045584 | 0.766647 | 0.011525 | 0 | 0.584559 | 0 | 0 | 0.066894 | 0.055424 | 0 | 0 | 0 | 0 | 0.294118 | 1 | 0.058824 | false | 0 | 0.036765 | 0 | 0.095588 | 0.007353 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bf29c3f5ba5c73fc299457cc46f2f1e8a6daed88 | 940 | py | Python | DEFCON_Core.py | tlear/DEFCON | 6f24c1585a877e8668157a93a8153502b3ddc246 | [
"MIT"
] | null | null | null | DEFCON_Core.py | tlear/DEFCON | 6f24c1585a877e8668157a93a8153502b3ddc246 | [
"MIT"
] | null | null | null | DEFCON_Core.py | tlear/DEFCON | 6f24c1585a877e8668157a93a8153502b3ddc246 | [
"MIT"
] | null | null | null | ################################################################
# DEFCON_GM_Server
# (C) Tom Moore 2017
################################################################
################################################################
# IMPORTS
################################################################
# Python
#import json
# DEFCON
from DEFCON_Client import DEFCON_Client
from DEFCON_Network import DEFCON_Network
import DEFCON_UserSystem
################################################################
# Global variables
################################################################
network = None
client = None
################################################################
# Main loop
################################################################
def main():
DEFCON_UserSystem.PopulateUserDatabase()
network = DEFCON_Network()
network.start()
client = DEFCON_Client(1)
client.start()
main() | 25.405405 | 64 | 0.330851 | 52 | 940 | 5.788462 | 0.461538 | 0.119601 | 0.126246 | 0.166113 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005848 | 0.090426 | 940 | 37 | 65 | 25.405405 | 0.346199 | 0.101064 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.25 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
171a22768ef061beb981c1a4dd1dc1031d412a14 | 142 | py | Python | hackerrank/DesignerPDFViewer.py | 0x8b/HackerRank | 45e1a0e2be68950505c0a75218715bd3132a428b | [
"MIT"
] | 3 | 2019-12-04T01:22:34.000Z | 2020-12-10T15:31:00.000Z | hackerrank/DesignerPDFViewer.py | 0x8b/HackerRank | 45e1a0e2be68950505c0a75218715bd3132a428b | [
"MIT"
] | null | null | null | hackerrank/DesignerPDFViewer.py | 0x8b/HackerRank | 45e1a0e2be68950505c0a75218715bd3132a428b | [
"MIT"
] | 1 | 2019-12-04T01:24:01.000Z | 2019-12-04T01:24:01.000Z | h = list(map(int, input().rstrip().split()))
word = input()
h = [h[ord(l) - ord("a")] for l in set(word)]
print(max(h) * len(word))
| 17.75 | 46 | 0.528169 | 25 | 142 | 3 | 0.68 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204225 | 142 | 7 | 47 | 20.285714 | 0.663717 | 0 | 0 | 0 | 0 | 0 | 0.007407 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
171bfe21947e3dcf4f6354858029db2684a66ae6 | 2,994 | py | Python | base_python/tests/test_flatten.py | cogment/cogment-verse | b7e3eddac57021ec77912a5d38e09f8202dc352f | [
"Apache-2.0"
] | 23 | 2021-10-01T01:33:15.000Z | 2022-03-10T18:18:50.000Z | base_python/tests/test_flatten.py | cogment/cogment-verse | b7e3eddac57021ec77912a5d38e09f8202dc352f | [
"Apache-2.0"
] | 35 | 2021-11-06T04:37:07.000Z | 2022-03-18T18:05:28.000Z | base_python/tests/test_flatten.py | cogment/cogment-verse | b7e3eddac57021ec77912a5d38e09f8202dc352f | [
"Apache-2.0"
] | 4 | 2021-12-14T15:24:50.000Z | 2022-01-17T11:06:34.000Z | # Copyright 2021 AI Redefined Inc. <dev+cogment@ai-r.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from data_pb2 import Space
from cogment_verse.spaces import flattened_dimensions
def test_flattened_dimensions_discrete():
assert flattened_dimensions(Space(properties=[Space.Property(discrete=Space.Discrete(num=2))])) == 2
assert (
flattened_dimensions(
Space(
properties=[
Space.Property(
discrete=Space.Discrete(
labels=["brake", "accelerate", "do nothing"],
num=2, # Will be ignored as there are more labels
)
)
]
)
)
== 3
)
assert (
flattened_dimensions(
Space(
properties=[
Space.Property(discrete=Space.Discrete(labels=["brake", "accelerate", "do nothing"], num=12))
]
)
)
== 12
)
assert (
flattened_dimensions(
Space(
properties=[
Space.Property(key="a", discrete=Space.Discrete(labels=["brake", "accelerate", "do nothing"])),
Space.Property(key="b", discrete=Space.Discrete(num=5)),
]
)
)
== 8
)
def test_flattened_dimensions_box():
assert flattened_dimensions(Space(properties=[Space.Property(box=Space.Box(shape=[2]))])) == 2
assert flattened_dimensions(Space(properties=[Space.Property(box=Space.Box(shape=[4]))])) == 4
assert flattened_dimensions(Space(properties=[Space.Property(box=Space.Box(shape=[2, 3, 4]))])) == 24
assert (
flattened_dimensions(
Space(
properties=[
Space.Property(key="a", box=Space.Box(shape=[10])),
Space.Property(key="b", box=Space.Box(shape=[2, 3, 4])),
]
)
)
== 34
)
def test_flattened_dimensions_mixed():
assert (
flattened_dimensions(
Space(
properties=[
Space.Property(key="a", box=Space.Box(shape=[10])),
Space.Property(key="b", discrete=Space.Discrete(labels=["brake", "accelerate", "do nothing"])),
Space.Property(key="c", box=Space.Box(shape=[2, 3, 4])),
]
)
)
== 37
)
| 31.515789 | 115 | 0.546426 | 312 | 2,994 | 5.176282 | 0.352564 | 0.152941 | 0.139319 | 0.167183 | 0.580186 | 0.580186 | 0.580186 | 0.541796 | 0.541796 | 0.504644 | 0 | 0.021148 | 0.336673 | 2,994 | 94 | 116 | 31.851064 | 0.792044 | 0.206079 | 0 | 0.323529 | 0 | 0 | 0.045301 | 0 | 0 | 0 | 0 | 0 | 0.132353 | 1 | 0.044118 | true | 0 | 0.029412 | 0 | 0.073529 | 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 | 0 | 0 | 0 | 0 | 2 |
173abe40d39e6ead9d3fd95272b7aed18b7d3975 | 1,005 | py | Python | pidmin.py | salman1410/pidmin | 2a5b231d16b5381c7f0018bedf087e888fd068b8 | [
"Apache-2.0"
] | null | null | null | pidmin.py | salman1410/pidmin | 2a5b231d16b5381c7f0018bedf087e888fd068b8 | [
"Apache-2.0"
] | null | null | null | pidmin.py | salman1410/pidmin | 2a5b231d16b5381c7f0018bedf087e888fd068b8 | [
"Apache-2.0"
] | null | null | null | import requests
r = "\033[1;31m"
g = "\033[1;32m"
y = "\033[1;33m"
b = "\033[1;34m"
x = "\033[0;0m"
banner="""
_______________________________________
| .__ .___ .__ |
| ______ |__| __| _/_____ |__| ____ |
| \____ \| |/ __ |/ \| |/ \ |
| | |_> > / /_/ | Y Y \ | | \ |
| | __/|__\____ |__|_| /__|___| / |
| |__| \/ \/ \/ |
| |
| developed by: Salman Asad | egg sec |
| http://github.com/salman1410/ |
|_____________________________________|
"""
def main():
o = open("panels.txt","r");
url = raw_input("enter url:~# ")
print y+"\n[!]searching, please wait..."+x
while True:
panel = o.readline()
if not panel:
break
x_url = "http://"+url+"/"+panel
search = requests.head(x_url)
if search.status_code < 400:
print g+"\n[+]Found:"+x, x_url
print y+"\n[!]Done"+x
try:
print(b+banner+x)
main()
except (KeyboardInterrupt, SystemExit):
print r+"\n[x]Aborted"+x
| 23.928571 | 43 | 0.507463 | 105 | 1,005 | 3.561905 | 0.571429 | 0.042781 | 0.048128 | 0.053476 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049931 | 0.282587 | 1,005 | 41 | 44 | 24.512195 | 0.468793 | 0 | 0 | 0 | 0 | 0 | 0.581095 | 0.077612 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.027027 | null | null | 0.135135 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1745fb56c91e0dfff83f18721a91b6de5da4c33c | 746 | py | Python | CloudJudge/info.py | zhuxiyulu/CloudJudge | 62ef8d75b0ddd194ea9813ec9df1f7baaa768f69 | [
"Apache-2.0"
] | 1 | 2018-02-07T05:14:28.000Z | 2018-02-07T05:14:28.000Z | CloudJudge/info.py | zhuxiyulu/CloudJudge | 62ef8d75b0ddd194ea9813ec9df1f7baaa768f69 | [
"Apache-2.0"
] | null | null | null | CloudJudge/info.py | zhuxiyulu/CloudJudge | 62ef8d75b0ddd194ea9813ec9df1f7baaa768f69 | [
"Apache-2.0"
] | null | null | null |
# 前台信息编码表
FrontMessageCode = {}
# 后台信息编码表
BackMessageCode = {}
# 编码、语言
FrontMessageCode['1'] = {"Help": "Username_Empty", "Zh": "用户不能为空"}
FrontMessageCode['2'] = {"Help": "Password_Empty", "Zh": "密码不能为空"}
FrontMessageCode['3'] = {"Help": "Username_NotEqual_Password", "Zh": "用户名和密码不匹配"}
FrontMessageCode['4'] = {"Help": "LogoutFailed", "Zh": "登出失败"}
FrontMessageCode['5'] = {"Help": "Captcha_Empty", "Zh": "验证码不能为空"}
FrontMessageCode['6'] = {"Help": "Captcha_Wrong", "Zh": "验证码错误"}
FrontMessageCode['7'] = {"Help": "User_Exists", "Zh": "该用户名已存在"}
for key in FrontMessageCode.keys():
BackMessageCode[FrontMessageCode[key]['Help']] = key
def getFrontMessage():
return FrontMessageCode
def getBackMessage():
return BackMessageCode | 29.84 | 81 | 0.675603 | 73 | 746 | 6.808219 | 0.534247 | 0.042254 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010622 | 0.116622 | 746 | 25 | 82 | 29.84 | 0.743551 | 0.02815 | 0 | 0 | 0 | 0 | 0.277393 | 0.036061 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0.133333 | 0 | 0.133333 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 |
174a2f83755fe2447a56675e6c03a8f0c156ee18 | 354 | py | Python | month04/Django/django5/mysite3/mtm/models.py | chaofan-zheng/python_learning_code | 5d05848911d55aa49eaee4afd7ffd80536fad7aa | [
"Apache-2.0"
] | 4 | 2021-01-07T14:25:10.000Z | 2021-02-01T10:36:01.000Z | month04/Django/django5/mysite3/mtm/models.py | chaofan-zheng/python_learning_code | 5d05848911d55aa49eaee4afd7ffd80536fad7aa | [
"Apache-2.0"
] | null | null | null | month04/Django/django5/mysite3/mtm/models.py | chaofan-zheng/python_learning_code | 5d05848911d55aa49eaee4afd7ffd80536fad7aa | [
"Apache-2.0"
] | null | null | null | from django.db import models
# Create your models here.
class Book(models.Model):
title = models.CharField('书名', max_length=50)
def __str__(self):
return self.title
class Author(models.Model):
name = models.CharField('作者', max_length=50)
books = models.ManyToManyField(Book)
def __str__(self):
return self.name
| 18.631579 | 49 | 0.677966 | 47 | 354 | 4.893617 | 0.553191 | 0.095652 | 0.095652 | 0.13913 | 0.173913 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014337 | 0.211864 | 354 | 18 | 50 | 19.666667 | 0.810036 | 0.067797 | 0 | 0.2 | 0 | 0 | 0.012195 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.1 | 0.2 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
175741c38e8bd4c02e4b20b753229bc910942acc | 2,927 | py | Python | itdtool/tasks.py | nikoskal/itd_tool | 9c378a8949b6b8c45764a06a33f0f534ed70d58a | [
"Apache-2.0"
] | null | null | null | itdtool/tasks.py | nikoskal/itd_tool | 9c378a8949b6b8c45764a06a33f0f534ed70d58a | [
"Apache-2.0"
] | null | null | null | itdtool/tasks.py | nikoskal/itd_tool | 9c378a8949b6b8c45764a06a33f0f534ed70d58a | [
"Apache-2.0"
] | null | null | null | # from __future__ import absolute_import
#
# from itdtool.celeryapp import app
# # from lxml import etree
# # import xmltodict
# import sys
# # from passlib.hash import md5_crypt
# from django.conf import settings
#
#
#
# # @app.task
# def get_query_params_id(id):
#
# from itdtool.models import QueryParameters
# query_parameters = QueryParameters.objects.filter(id=id)
# # print "get_query_params_id "+ str(id)
# # print "result " + str(query_parameters)
# for query_parameter in query_parameters:
# result = {
# "id": query_parameter.id,
# "description": query_parameter.description,
# "sources": query_parameter.sources,
# "location": query_parameter.location,
# "start_date": query_parameter.start_date,
# "end_date": query_parameter.end_date,
# "inference": query_parameter.inference,
# "questions": query_parameter.questions
# }
#
#
# # print("retrieve query_parameter by id" + str(result))
#
# return result
#
#
# # @app.task
# def delete_query_params_id(id):
#
# query_deleted = QueryParameters.objects.filter(id=id)[0]
# res = query_deleted.delete()
#
# return res
#
#
# # @app.task
# def add_query_params(description, sources, location, start_date, end_date, inference, questions):
#
# # description = models.TextField()
# # sources = models.CharField(max_length=30) #["Twitter", "Google", "Youtube"]
# # location = models.CharField(max_length=30) # ["Athens", "Rome", "Madrid"]
# # start_date = models.DateTimeField() # starting time period to search
# # end_date = models.DateTimeField() # ending time period to search
# # inference = models.BooleanField()
# # questions = models.BooleanField()
#
# query_parameters = QueryParameters(description=description, sources=sources,location=location,
# start_date=start_date, end_date=end_date, inference=inference,
# questions=questions)
# query_parameters.save()
# print "saved:" + str(query_parameters)
#
# return query_parameters
#
#
# # @app.task
# def get_all_query_params():
#
# query_parameters_all = QueryParameters.objects.all()
# print query_parameters_all
# results = []
#
# for query_parameter in query_parameters_all:
# print("retrieve all query_parameter " + str(query_parameter))
# d = {"id": query_parameter.id,
# "description": query_parameter.description,
# "sources": query_parameter.sources,
# "location": query_parameter.location,
# "start_date": query_parameter.start_date,
# "end_date": query_parameter.end_date,
# "inference": query_parameter.inference,
# "questions": query_parameter.questions}
# results.append(d)
# return results
#
| 34.034884 | 103 | 0.639563 | 303 | 2,927 | 5.933993 | 0.250825 | 0.163515 | 0.03059 | 0.035595 | 0.36485 | 0.300334 | 0.262514 | 0.262514 | 0.262514 | 0.262514 | 0 | 0.0027 | 0.240861 | 2,927 | 85 | 104 | 34.435294 | 0.806481 | 0.934404 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
17620ff1224dfef0583aa6c9e851f0b278762fb4 | 158 | py | Python | PIP/Minor Assignment 6/A6Q5.py | ankitrajbiswal/SEM_5 | db716e242e77149a4091e0e564356ddc724aeff0 | [
"Apache-2.0"
] | 10 | 2021-04-24T11:46:48.000Z | 2022-01-17T05:14:37.000Z | PIP/Minor Assignment 6/A6Q5.py | ankitrajbiswal/SEM_5 | db716e242e77149a4091e0e564356ddc724aeff0 | [
"Apache-2.0"
] | 2 | 2021-06-28T11:51:50.000Z | 2021-11-01T08:21:53.000Z | PIP/Minor Assignment 6/A6Q5.py | ankitrajbiswal/SEM_5 | db716e242e77149a4091e0e564356ddc724aeff0 | [
"Apache-2.0"
] | 16 | 2021-04-24T11:46:58.000Z | 2022-03-02T05:08:19.000Z | def countWords(s):
count=1
for i in s:
if i==" ":
count+=1
return count
print(countWords("Hello World This is Rituraj")) | 22.571429 | 48 | 0.537975 | 22 | 158 | 3.863636 | 0.727273 | 0.141176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019417 | 0.348101 | 158 | 7 | 48 | 22.571429 | 0.805825 | 0 | 0 | 0 | 0 | 0 | 0.183007 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0 | 0 | 0.285714 | 0.142857 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
176cff588620ff8799d97d9ef7a9f606b83791b6 | 300 | py | Python | face/serializers.py | huachao2017/goodsdl | 3616d53b90696a97a5d56a064e2a14d484b821d7 | [
"Apache-2.0"
] | 3 | 2018-10-16T09:36:12.000Z | 2019-04-15T03:12:49.000Z | face/serializers.py | huachao2017/goodsdl | 3616d53b90696a97a5d56a064e2a14d484b821d7 | [
"Apache-2.0"
] | null | null | null | face/serializers.py | huachao2017/goodsdl | 3616d53b90696a97a5d56a064e2a14d484b821d7 | [
"Apache-2.0"
] | null | null | null | from rest_framework import serializers
from face.models import Image
class ImageSerializer(serializers.ModelSerializer):
class Meta:
model = Image
fields = ('pk', 'picurl', 'image_path', 'index', 'create_time')
read_only_fields = ('image_path', 'index', 'create_time',)
| 30 | 71 | 0.69 | 34 | 300 | 5.882353 | 0.647059 | 0.09 | 0.14 | 0.2 | 0.24 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.19 | 300 | 9 | 72 | 33.333333 | 0.823045 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
1790b6dc23ebaf34d4be18ffcca5ff633a98577d | 554 | py | Python | json_to_models/dynamic_typing/__init__.py | bogdandm/attrs-api-client | ebf9d0a72795f8a5f4667e4c41bca031a5ee798c | [
"MIT"
] | 111 | 2019-04-24T16:05:43.000Z | 2022-03-21T19:06:43.000Z | json_to_models/dynamic_typing/__init__.py | bogdandm/attrs-api-client | ebf9d0a72795f8a5f4667e4c41bca031a5ee798c | [
"MIT"
] | 31 | 2018-11-18T12:39:09.000Z | 2022-03-12T19:30:19.000Z | json_to_models/dynamic_typing/__init__.py | bogdandm/attrs-api-client | ebf9d0a72795f8a5f4667e4c41bca031a5ee798c | [
"MIT"
] | 5 | 2020-09-22T16:06:29.000Z | 2021-06-27T10:13:25.000Z | from .base import (
BaseType, ImportPathList, MetaData, Null, Unknown, get_hash_string
)
from .complex import ComplexType, DDict, DList, DOptional, DTuple, DUnion, SingleType, StringLiteral
from .models_meta import AbsoluteModelRef, ModelMeta, ModelPtr
from .string_datetime import IsoDateString, IsoDatetimeString, IsoTimeString, register_datetime_classes
from .string_serializable import (
BooleanString, FloatString, IntString, StringSerializable, StringSerializableRegistry, registry
)
from .typing import compile_imports, metadata_to_typing
| 50.363636 | 103 | 0.833935 | 57 | 554 | 7.929825 | 0.736842 | 0.044248 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106498 | 554 | 10 | 104 | 55.4 | 0.913131 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.7 | 0 | 0.7 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
bd56918f3a9e7c2a91d29f2786cbe090b4e81956 | 120 | py | Python | kili/mutations/user/fragments.py | ASonay/kili-playground | 9624073703b5e6151cf496f44f17f531576875b7 | [
"Apache-2.0"
] | 214 | 2019-08-05T14:55:01.000Z | 2022-03-28T21:02:22.000Z | kili/mutations/user/fragments.py | x213212/kili-playground | dfb94c2d54bedfd7fec452b91f811587a2156c13 | [
"Apache-2.0"
] | 10 | 2020-05-14T10:44:16.000Z | 2022-03-08T09:39:24.000Z | kili/mutations/user/fragments.py | x213212/kili-playground | dfb94c2d54bedfd7fec452b91f811587a2156c13 | [
"Apache-2.0"
] | 19 | 2019-11-26T22:41:09.000Z | 2022-01-16T19:17:38.000Z | """
Fragments of user mutations
"""
AUTH_PAYLOAD_FRAGMENT = '''
id
token
user {
id
}
'''
USER_FRAGMENT = '''
id
'''
| 7.5 | 27 | 0.608333 | 14 | 120 | 5 | 0.642857 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.208333 | 120 | 15 | 28 | 8 | 0.736842 | 0.225 | 0 | 0.5 | 0 | 0 | 0.329412 | 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 | 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 | 2 |
bd6282402107d187e9dd75aadd183c20555e845b | 414 | py | Python | misc/vulnpwn/lib/core/payload.py | all3g/pieces | bc378fd22ddc700891fe7f34ab0d5b341141e434 | [
"CNRI-Python"
] | 34 | 2016-10-31T02:05:24.000Z | 2018-11-08T14:33:13.000Z | misc/vulnpwn/lib/core/payload.py | join-us/python-programming | bc378fd22ddc700891fe7f34ab0d5b341141e434 | [
"CNRI-Python"
] | 2 | 2017-05-11T03:00:31.000Z | 2017-11-01T23:37:37.000Z | misc/vulnpwn/lib/core/payload.py | join-us/python-programming | bc378fd22ddc700891fe7f34ab0d5b341141e434 | [
"CNRI-Python"
] | 21 | 2016-08-19T09:05:45.000Z | 2018-11-08T14:33:16.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
##
# Current source: https://github.com/open-security/vulnpwn/
##
from lib.base import module
class Payload(module.Module):
def __init__(self):
module.Module.__init__(self)
self.shellcode = ''
def generate_shellcode(self):
pass
def do_run(self, line):
'''generate a payload shellcode'''
self.generate_shellcode()
| 18.818182 | 59 | 0.628019 | 49 | 414 | 5.081633 | 0.632653 | 0.096386 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003125 | 0.227053 | 414 | 21 | 60 | 19.714286 | 0.775 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.111111 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
bd6a7753c9f07a2da9b97fc9e065a239f0ef1e99 | 4,357 | py | Python | zoo/services/migrations/0001_initial.py | uliana291/the-zoo | a15a4162c39553abe91224f4feff5d3b66f9413e | [
"MIT"
] | null | null | null | zoo/services/migrations/0001_initial.py | uliana291/the-zoo | a15a4162c39553abe91224f4feff5d3b66f9413e | [
"MIT"
] | null | null | null | zoo/services/migrations/0001_initial.py | uliana291/the-zoo | a15a4162c39553abe91224f4feff5d3b66f9413e | [
"MIT"
] | null | null | null | # Generated by Django 2.0b1 on 2017-10-30 13:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="DataCenter",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("provider", models.CharField(max_length=100)),
("region", models.CharField(blank=True, max_length=100, null=True)),
],
),
migrations.CreateModel(
name="Repository",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("owner", models.CharField(max_length=100)),
("name", models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name="Service",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("owner", models.CharField(max_length=100)),
("name", models.CharField(max_length=100)),
(
"status",
models.CharField(
blank=True,
choices=[
("beta", "beta"),
("production", "production"),
("deprecated", "deprecated"),
("discontinued", "discontinued"),
],
max_length=100,
null=True,
),
),
(
"impact",
models.CharField(
blank=True,
choices=[
("profit", "profit"),
("customers", "customers"),
("employees", "employees"),
],
max_length=100,
null=True,
),
),
(
"slack_channel",
models.CharField(blank=True, max_length=22, null=True),
),
(
"pagerduty_url",
models.CharField(blank=True, max_length=500, null=True),
),
(
"dashboard_url",
models.CharField(blank=True, max_length=500, null=True),
),
("docs_url", models.CharField(blank=True, max_length=500, null=True)),
(
"datacenter",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="services.DataCenter",
),
),
(
"repository",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="services.Repository",
),
),
],
),
migrations.AlterUniqueTogether(
name="repository", unique_together={("owner", "name")}
),
migrations.AlterUniqueTogether(
name="datacenter", unique_together={("provider", "region")}
),
migrations.AlterUniqueTogether(
name="service", unique_together={("owner", "name")}
),
]
| 33.515385 | 86 | 0.366078 | 265 | 4,357 | 5.90566 | 0.275472 | 0.115016 | 0.061342 | 0.107348 | 0.555911 | 0.466454 | 0.424281 | 0.424281 | 0.424281 | 0.424281 | 0 | 0.02457 | 0.532936 | 4,357 | 129 | 87 | 33.775194 | 0.744472 | 0.010328 | 0 | 0.647541 | 1 | 0 | 0.085151 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.016393 | 0 | 0.04918 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 2 |
bd724601922549d0baea907dc39942717e169eb7 | 477 | py | Python | blog/views.py | jinjf553/mysite | e6c936ba6cd3e89d13434ff3f42a858e96231cae | [
"MIT"
] | 1 | 2020-01-20T14:49:44.000Z | 2020-01-20T14:49:44.000Z | blog/views.py | jinjf553/mysite | e6c936ba6cd3e89d13434ff3f42a858e96231cae | [
"MIT"
] | null | null | null | blog/views.py | jinjf553/mysite | e6c936ba6cd3e89d13434ff3f42a858e96231cae | [
"MIT"
] | null | null | null | from django.shortcuts import render, get_object_or_404
# Create your views here.
from blog.models import BlogArticles
def blog_title(request):
blogs = BlogArticles.objects.all()
return render(request, "blog/title.html", {"blogs": blogs})
def blog_article(request, article_id):
# article = BlogArticles.objects.get(id=article_id)
article = get_object_or_404(BlogArticles, id=article_id)
return render(request, "blog/content.html", {"article": article})
| 29.8125 | 69 | 0.748428 | 64 | 477 | 5.40625 | 0.421875 | 0.104046 | 0.063584 | 0.080925 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014563 | 0.136268 | 477 | 15 | 70 | 31.8 | 0.825243 | 0.15304 | 0 | 0 | 0 | 0 | 0.109726 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 2 |
bd7e651de7d462dd4c7cfb1fac01abd31441480c | 231 | py | Python | setup.py | jdoepfert/PyRM | 5def07e937ebc475dc925dbb9ad3820f853e4986 | [
"MIT"
] | null | null | null | setup.py | jdoepfert/PyRM | 5def07e937ebc475dc925dbb9ad3820f853e4986 | [
"MIT"
] | null | null | null | setup.py | jdoepfert/PyRM | 5def07e937ebc475dc925dbb9ad3820f853e4986 | [
"MIT"
] | null | null | null | from setuptools import setup
import pyrm
setup(
name='PyRM2',
version=pyrm.__version__,
packages=['pyrm'],
long_description=open('README.md').read(),
test_suite='nose.collector',
tests_require=['nose'],
)
| 17.769231 | 46 | 0.670996 | 27 | 231 | 5.481481 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005236 | 0.17316 | 231 | 12 | 47 | 19.25 | 0.769634 | 0 | 0 | 0 | 0 | 0 | 0.155844 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
bd8183375c5213bf89f6f2ed3cd5e529442dba4a | 776 | py | Python | tests/test_memory.py | antfu/two-way-configs.py | 8dcf00abf2920d7619da36bbfba33b473656f2a6 | [
"MIT"
] | 2 | 2016-09-28T10:50:25.000Z | 2022-03-24T18:41:18.000Z | tests/test_memory.py | antfu/two-way-configs.py | 8dcf00abf2920d7619da36bbfba33b473656f2a6 | [
"MIT"
] | 1 | 2016-09-30T20:24:16.000Z | 2019-04-20T12:58:25.000Z | tests/test_memory.py | antfu/biconfigs | 8dcf00abf2920d7619da36bbfba33b473656f2a6 | [
"MIT"
] | null | null | null | import biconfigs
import json
class TestMemoryStorage(object):
def setup_class(self):
self.change_count = 0
def onchanged(config):
self.change_count += 1
self.config = biconfigs.Biconfigs(
default_value={'default':'value'},
onchanged=onchanged
)
assert self.config._Biconfigs__storage == 'memory'
assert self.change_count == 0
assert json.dumps(self.config) == '{"default": "value"}'
def test_basic_update(self):
self.config.clear()
assert json.dumps(self.config) == '{}'
self.config['item1'] = 'value'
assert json.dumps(self.config) == '{"item1": "value"}'
del(self.config['item1'])
assert json.dumps(self.config) == '{}'
| 27.714286 | 64 | 0.588918 | 83 | 776 | 5.385542 | 0.325301 | 0.201342 | 0.134228 | 0.170022 | 0.223714 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010582 | 0.26933 | 776 | 27 | 65 | 28.740741 | 0.777778 | 0 | 0 | 0.095238 | 0 | 0 | 0.096649 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 1 | 0.142857 | false | 0 | 0.095238 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bd941779a5af0ec81b3f47a6dc7950caaaa59f65 | 96 | py | Python | cropmask/__init__.py | ecohydro/CropMask_RCNN | 4657ed1d103acb37dc974aa6af2f0d3a3398e987 | [
"MIT"
] | 13 | 2019-03-01T23:41:27.000Z | 2021-07-12T06:28:31.000Z | cropmask/__init__.py | ecohydro/CropMask_RCNN | 4657ed1d103acb37dc974aa6af2f0d3a3398e987 | [
"MIT"
] | 32 | 2019-02-21T21:14:18.000Z | 2020-12-31T19:48:41.000Z | cropmask/__init__.py | ecohydro/CropMask_RCNN | 4657ed1d103acb37dc974aa6af2f0d3a3398e987 | [
"MIT"
] | 3 | 2018-11-19T23:02:01.000Z | 2021-12-01T15:52:06.000Z | """AI for Earth project to map center pivots and monitor crop water use."""
__version__ = '0.1' | 32 | 75 | 0.71875 | 16 | 96 | 4.0625 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025 | 0.166667 | 96 | 3 | 76 | 32 | 0.7875 | 0.71875 | 0 | 0 | 0 | 0 | 0.136364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bd9a9648386371b2fe0f9f03731e1c012964056f | 614 | py | Python | run_all.py | LiuTianen/AppiumTestDemo | 8bd4a64a8e2fec28cfcedb52d9a3a05ab279b1ff | [
"MIT"
] | null | null | null | run_all.py | LiuTianen/AppiumTestDemo | 8bd4a64a8e2fec28cfcedb52d9a3a05ab279b1ff | [
"MIT"
] | null | null | null | run_all.py | LiuTianen/AppiumTestDemo | 8bd4a64a8e2fec28cfcedb52d9a3a05ab279b1ff | [
"MIT"
] | null | null | null | # import time
# from common.HTMLTestRunner import HTMLTestRunner
# from unittest import defaultTestLoader
#
# test_dir = './TestCase'
# suit = defaultTestLoader.discover(test_dir,
# pattern='test_*.py')
#
# if __name__ == '__main__':
#
# now_time = time.strftime("%Y-%m-%d %h_%M_%S")
# filename = './TestReport/' + now_time + '_result.html'
# fp = open(filename, 'wb')
# runner = HTMLTestRunner(stream=fp,
# title="TestDemo",
# description="运行环境:AVD模拟器")
# runner.run(suit, rerun=0, save_last_run=False)
| 32.315789 | 60 | 0.576547 | 63 | 614 | 5.333333 | 0.698413 | 0.041667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002257 | 0.278502 | 614 | 18 | 61 | 34.111111 | 0.756208 | 0.941368 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bdb0dc844a3d316fdf138ed1702c4fe6fc9e35db | 909 | py | Python | bokeh/sampledata/degrees.py | pyjsdev/googlemap_flask | 9d0dd899a9cbf756b3d83c33e3d8a47e7db40cc5 | [
"BSD-3-Clause"
] | 6 | 2018-02-13T11:06:40.000Z | 2020-10-23T09:30:46.000Z | bokeh/sampledata/degrees.py | pyjsdev/googlemap_flask | 9d0dd899a9cbf756b3d83c33e3d8a47e7db40cc5 | [
"BSD-3-Clause"
] | 6 | 2018-11-29T15:40:20.000Z | 2021-05-07T14:59:30.000Z | bokeh/sampledata/degrees.py | pyjsdev/googlemap_flask | 9d0dd899a9cbf756b3d83c33e3d8a47e7db40cc5 | [
"BSD-3-Clause"
] | 3 | 2018-06-20T11:43:40.000Z | 2021-12-21T06:51:56.000Z | '''
This module provides a table of data regarding bachelors degrees earned by
women, broken down by field for any given year. It exposes an attribute
'data' which is a pandas dataframe with the following fields:
Year
Agriculture
Architecture
Art and Performance
Biology
Business
Communications and Journalism
Computer Science,Education
Engineering
English
Foreign Languages
Health Professions
Math and Statistics
Physical Sciences
Psychology
Public Administration
Social Sciences and History
'''
from __future__ import absolute_import
from bokeh.util.dependencies import import_required
pd = import_required('pandas',
'degrees sample data requires Pandas (http://pandas.pydata.org) to be installed')
from os.path import dirname, join
data = pd.read_csv(join(dirname(__file__), "percent-bachelors-degrees-women-usa.csv"))
| 26.735294 | 95 | 0.745875 | 114 | 909 | 5.842105 | 0.745614 | 0.048048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20242 | 909 | 33 | 96 | 27.545455 | 0.918621 | 0.612761 | 0 | 0 | 0 | 0 | 0.358601 | 0.113703 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 2 |
bdb425d07d16f8aa23948e1bc372f43d28ec7b53 | 743 | py | Python | api/migrations/0001_initial.py | maravger/central-controller | fa3b7bb20dd1ebd81538b6732c3748f825925a48 | [
"MIT"
] | 1 | 2021-01-10T22:16:08.000Z | 2021-01-10T22:16:08.000Z | api/migrations/0001_initial.py | maravger/central-controller | fa3b7bb20dd1ebd81538b6732c3748f825925a48 | [
"MIT"
] | 4 | 2018-09-05T15:14:49.000Z | 2021-06-10T20:33:41.000Z | api/migrations/0001_initial.py | maravger/central-controller | fa3b7bb20dd1ebd81538b6732c3748f825925a48 | [
"MIT"
] | 1 | 2019-05-13T18:03:06.000Z | 2019-05-13T18:03:06.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-07-06 10:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='App',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('app_id', models.IntegerField(default=0)),
('prev_subm', models.IntegerField(default=0)),
('prev_rej', models.IntegerField(default=0)),
('next_predicted_rr', models.FloatField(default=0)),
],
),
]
| 27.518519 | 114 | 0.584118 | 78 | 743 | 5.397436 | 0.666667 | 0.07601 | 0.178147 | 0.185273 | 0.142518 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041353 | 0.283984 | 743 | 26 | 115 | 28.576923 | 0.75 | 0.092867 | 0 | 0 | 1 | 0 | 0.070045 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bdbaa2b4f38384b7d15c1080fedc09e57e4d90fe | 701 | py | Python | tests/integration_tests/boolean_tests/sweep_line_keys_tests/test_pickle.py | skrat/martinez | 86db48324cb50ecb52be8ab2e4278a6d5cdd562b | [
"MIT"
] | 7 | 2020-05-07T08:13:44.000Z | 2021-12-17T07:33:51.000Z | tests/integration_tests/boolean_tests/sweep_line_keys_tests/test_pickle.py | skrat/martinez | 86db48324cb50ecb52be8ab2e4278a6d5cdd562b | [
"MIT"
] | 17 | 2019-11-29T23:17:26.000Z | 2020-12-20T15:47:17.000Z | tests/integration_tests/boolean_tests/sweep_line_keys_tests/test_pickle.py | skrat/martinez | 86db48324cb50ecb52be8ab2e4278a6d5cdd562b | [
"MIT"
] | 1 | 2020-12-17T22:44:21.000Z | 2020-12-17T22:44:21.000Z | from typing import Tuple
from hypothesis import given
from tests.bind_tests.hints import BoundSweepLineKey
from tests.integration_tests.utils import (
are_bound_ported_sweep_line_keys_equal)
from tests.port_tests.hints import PortedSweepLineKey
from tests.utils import pickle_round_trip
from . import strategies
@given(strategies.sweep_line_keys_pairs)
def test_round_trip(sweep_line_keys_pair: Tuple[BoundSweepLineKey,
PortedSweepLineKey]) -> None:
bound, ported = sweep_line_keys_pair
assert are_bound_ported_sweep_line_keys_equal(pickle_round_trip(bound),
pickle_round_trip(ported))
| 35.05 | 77 | 0.728959 | 85 | 701 | 5.635294 | 0.364706 | 0.093946 | 0.135699 | 0.125261 | 0.183716 | 0.133612 | 0.133612 | 0 | 0 | 0 | 0 | 0 | 0.225392 | 701 | 19 | 78 | 36.894737 | 0.882136 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | 1 | 0.071429 | false | 0 | 0.5 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
bdc099d9866d6aac54bd6f342f3871be49429125 | 576 | py | Python | src/sipe/config/models/clients.py | whardier/sipe | 2abd7894d12aeeb94e49dd691c90231cd0c01021 | [
"MIT"
] | null | null | null | src/sipe/config/models/clients.py | whardier/sipe | 2abd7894d12aeeb94e49dd691c90231cd0c01021 | [
"MIT"
] | null | null | null | src/sipe/config/models/clients.py | whardier/sipe | 2abd7894d12aeeb94e49dd691c90231cd0c01021 | [
"MIT"
] | null | null | null | # ┏━┓╻┏━┓┏━╸ ┏━╸┏━┓┏┓╻┏━╸╻┏━╸ ┏┳┓┏━┓╺┳┓┏━╸╻ ┏━┓ ┏━╸╻ ╻┏━╸┏┓╻╺┳╸┏━┓
# ┗━┓┃┣━┛┣╸ ┃ ┃ ┃┃┗┫┣╸ ┃┃╺┓ ┃┃┃┃ ┃ ┃┃┣╸ ┃ ┗━┓ ┃ ┃ ┃┣╸ ┃┗┫ ┃ ┗━┓
# ┗━┛╹╹ ┗━╸╹┗━╸┗━┛╹ ╹╹ ╹┗━┛╹╹ ╹┗━┛╺┻┛┗━╸┗━╸┗━┛╹┗━╸┗━╸╹┗━╸╹ ╹ ╹ ┗━┛
# SPDX-License-Identifier: MIT
# Author: Shane R. Spencer <spencersr@gmail.com>
# Standard Library
from typing import List
# Pydantic: https://github.com/samuelcolvin/pydantic/
from pydantic import BaseModel
# Sipe Project: Absolute
from sipe.config.models.identifiers import IdentifierModel
class ClientModel(BaseModel):
identifiers: List[IdentifierModel]
| 26.181818 | 68 | 0.503472 | 73 | 576 | 6.191781 | 0.726027 | 0.00885 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.154514 | 576 | 21 | 69 | 27.428571 | 0.595483 | 0.638889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.6 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
bdcc1b8f600ad6af23e5e088ecd489d70b9930d8 | 876 | py | Python | data/lcx/convert.py | MrZixi/SentiPrompt | e213c39350cd996bc795b6612cdb4b9a5baec983 | [
"MIT"
] | 13 | 2021-11-14T07:41:47.000Z | 2022-03-18T06:17:42.000Z | data/lcx/convert.py | MrZixi/SentiPrompt | e213c39350cd996bc795b6612cdb4b9a5baec983 | [
"MIT"
] | 3 | 2021-12-27T05:04:12.000Z | 2022-03-01T03:22:49.000Z | data/lcx/convert.py | MrZixi/SentiPrompt | e213c39350cd996bc795b6612cdb4b9a5baec983 | [
"MIT"
] | 4 | 2021-11-01T02:00:22.000Z | 2022-03-15T05:42:43.000Z | import json
def convert(path:str):
with open(path, 'r') as f:
data = json.load(f)
output_path = path.replace('convert', 'triplets').replace('json', 'txt')
with open(output_path, 'w') as f:
for ins in data:
temp_ins = []
for a, o in zip(ins['aspects'], ins['opinions']):
temp_ins.append(([x for x in range(a['from'], a['to'])], [x for x in range(o['from'], o['to'])], a['polarity']))
f.write(ins['raw_words'] + '####' + str(temp_ins) + '\n')
return
if __name__ == '__main__':
convert('14lap/train_convert.json')
convert('14lap/test_convert.json')
convert('14res/train_convert.json')
convert('14res/test_convert.json')
convert('15res/train_convert.json')
convert('15res/test_convert.json')
convert('16res/train_convert.json')
convert('16res/test_convert.json') | 38.086957 | 128 | 0.600457 | 123 | 876 | 4.097561 | 0.382114 | 0.174603 | 0.25 | 0.18254 | 0.047619 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023155 | 0.211187 | 876 | 23 | 129 | 38.086957 | 0.706223 | 0 | 0 | 0 | 0 | 0 | 0.307868 | 0.214367 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0 | 0.047619 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
bde89d84d6608fc9a28457500ae75683b873d730 | 5,140 | py | Python | geometry/point.py | ldacosta/geometry2D | 9be0df6544777d29740991234bc92a7004ef775e | [
"MIT"
] | null | null | null | geometry/point.py | ldacosta/geometry2D | 9be0df6544777d29740991234bc92a7004ef775e | [
"MIT"
] | null | null | null | geometry/point.py | ldacosta/geometry2D | 9be0df6544777d29740991234bc92a7004ef775e | [
"MIT"
] | null | null | null | """Point and Rectangle classes.
This code is in the public domain.
Point -- point with (x,y) coordinates
Rect -- two points, forming a rectangle
Taken from https://wiki.python.org/moin/PointsAndRectangles
"""
import math
from typing import Tuple
class Point:
"""A point identified by (x,y) coordinates.
supports: +, -, *, /, str, repr
length -- calculate length of vector to point from origin
distance_to -- calculate distance between two points
as_tuple -- construct tuple (x,y)
clone -- construct a duplicate
integerize -- convert x & y to integers
floatize -- convert x & y to floats
move_to -- reset x & y
slide -- move (in place) +dx, +dy, as spec'd by point
slide_xy -- move (in place) +dx, +dy
rotate -- rotate around the origin
rotate_about -- rotate around another point
"""
def __init__(self, x:float=0.0, y:float=0.0):
self.x = x
self.y = y
@classmethod
def from_tuple(cls, pt_as_tuple:Tuple[float,float]):
return cls(x=pt_as_tuple[0],y=pt_as_tuple[1])
def __iter__(self):
return iter((self.x, self.y))
def __getitem__(self, item):
if item == 0:
return self.x
elif item == 1:
return self.y
else:
raise RuntimeError("Index %d does not make sense in a point" % (item))
def __attrs(self):
"""
All attributes in a single representation.
Returns:
A tuple with all attributes.
"""
return (self.x, self.y)
def __eq__(self, other):
return isinstance(other, Point) and self.__attrs() == other.__attrs()
def __hash__(self):
return hash(self.__attrs())
def __add__(self, another_pt):
"""Point(x1+x2, y1+y2)"""
return Point(self.x + another_pt.x, self.y + another_pt.y)
def __sub__(self, another_point):
"""Point(x1-x2, y1-y2)"""
return Point(self.x - another_point.x, self.y - another_point.y)
def __isub__(self, another_point):
self.x += another_point.x
self.y += another_point.y
return self
def __mul__(self, scalar):
"""Point(x1*x2, y1*y2)"""
return Point(self.x * scalar, self.y * scalar)
def __div__(self, scalar):
"""Point(x1/x2, y1/y2)"""
return Point(self.x / scalar, self.y / scalar)
def __str__(self):
return "(%.2f, %.2f)" % (self.x, self.y)
def __repr__(self):
return "%s(%r, %r)" % (self.__class__.__name__, self.x, self.y)
def length(self) -> float:
"""norm of vector (0,0) to this point"""
return math.sqrt(self.x ** 2 + self.y ** 2)
def distance_to(self, another_point) -> float:
"""Calculate the distance between two points."""
return (self - another_point).length()
def as_tuple(self):
"""(x, y)"""
return (self.x, self.y)
def clone(self):
"""Return a full copy of this point."""
return Point(self.x, self.y)
def integerize(self):
"""Convert co-ordinate values to integers."""
self.x = int(round(self.x))
self.y = int(round(self.y))
return self
def floatize(self):
"""Convert co-ordinate values to floats."""
self.x = float(self.x)
self.y = float(self.y)
def move_to(self, x, y):
"""Reset x & y coordinates."""
self.x = x
self.y = y
def translate_following(self, a_vector):
"""
Move to new (x+dx,y+dy).
:param a_vector: Vector 2D I have to follow.
:return: Unit.
"""
self.x = self.x + a_vector.x
self.y = self.y + a_vector.y
return self
def slide_xy(self, dx, dy):
'''Move to new (x+dx,y+dy).
Can anyone think up a better name for this function?
slide? shift? delta? move_by?
'''
self.x = self.x + dx
self.y = self.y + dy
def rotate(self, rad):
"""Rotate counter-clockwise by rad radians.
Positive y goes *up,* as in traditional mathematics.
Interestingly, you can use this in y-down computer graphics, if
you just remember that it turns clockwise, rather than
counter-clockwise.
The new position is returned as a new Point.
"""
a_sinus, a_cosinus = [f(rad) for f in (math.sin, math.cos)]
x, y = (a_cosinus * self.x - a_sinus * self.y, a_sinus * self.x + a_cosinus * self.y)
return Point(x, y)
def rotate_about(self, a_point, theta):
"""Rotate counter-clockwise around a point, by theta degrees.
Positive y goes *up,* as in traditional mathematics.
The new position is returned as a new Point.
"""
result = self.clone()
result.slide_xy(-a_point.x, -a_point.y)
result.rotate(theta)
result.slide_xy(a_point.x, a_point.y)
return result
POINT_ZEROZERO = Point(x=0.0, y=0.0)
def average_between(pt1: Point, pt2: Point) -> Point:
"""Returns the point in the 'middle' of the two."""
return Point((pt1.x + pt2.x)/2, (pt1.y + pt2.y)/2)
| 28.876404 | 93 | 0.58249 | 741 | 5,140 | 3.887989 | 0.241565 | 0.048594 | 0.029157 | 0.027768 | 0.240541 | 0.212079 | 0.170427 | 0.160014 | 0.131552 | 0.088511 | 0 | 0.011761 | 0.288716 | 5,140 | 177 | 94 | 29.039548 | 0.776258 | 0.350778 | 0 | 0.115385 | 0 | 0 | 0.020205 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.025641 | 0.076923 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
bdfade1b34bb0238d1bf2368604d973f617872df | 4,850 | py | Python | praeteritum/settings.py | NoMariusz/Praeteritum | c32fa017e23de7255224fcf72cd04abdfc3ebff4 | [
"MIT"
] | 3 | 2021-03-07T21:43:55.000Z | 2021-09-21T08:24:26.000Z | praeteritum/settings.py | NoMariusz/Praeteritum | c32fa017e23de7255224fcf72cd04abdfc3ebff4 | [
"MIT"
] | null | null | null | praeteritum/settings.py | NoMariusz/Praeteritum | c32fa017e23de7255224fcf72cd04abdfc3ebff4 | [
"MIT"
] | null | null | null | """
Django settings for praeteritum project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from pathlib import Path
from dotenv import load_dotenv
# Load environment variables
dotenv_path = os.path.join(os.path.dirname(__file__), "../", '.env')
load_dotenv(dotenv_path)
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ['SECRET_KEY']
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ["*", "127.0.0.1"]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'frontend.apps.FrontendConfig',
'authentication.apps.AuthenticationConfig',
'cards.apps.CardsConfig',
'playerdata.apps.PlayerdataConfig',
'match.apps.MatchConfig',
'rest_framework',
'channels'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
]
ROOT_URLCONF = 'praeteritum.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
ASGI_APPLICATION = 'praeteritum.asgi.application'
CHANNEL_LAYERS = {
'dev': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [('127.0.0.1', 6379)],
},
},
'main': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [os.environ['MAIN_REDIS_CONNECT_STRING']],
},
},
}
DEFAULT_CHANNEL_LAYER = os.environ.get('DJANGO_CHANNEL_LAYER', 'dev')
CHANNEL_LAYERS['default'] = CHANNEL_LAYERS[DEFAULT_CHANNEL_LAYER]
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'dev': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
},
'main': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ['MAIN_DB_NAME'],
'USER': os.environ['MAIN_DB_USER'],
'PASSWORD': os.environ['MAIN_DB_PASSWORD'],
'HOST': os.environ['MAIN_DB_HOST'],
'PORT': os.environ['MAIN_DB_PORT'],
}
}
DEFAULT_DATABASE = os.environ.get('DJANGO_DATABASE', 'dev')
DATABASES['default'] = DATABASES[DEFAULT_DATABASE]
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.' +
'UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.' +
'MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.' +
'CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.' +
'NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'frontend/static'),
)
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# Custom project configurations
LOGIN_URL = '/login/'
| 26.502732 | 79 | 0.67567 | 519 | 4,850 | 6.169557 | 0.373796 | 0.060899 | 0.048095 | 0.054653 | 0.180512 | 0.164585 | 0.115865 | 0.083385 | 0.037477 | 0 | 0 | 0.010377 | 0.185361 | 4,850 | 182 | 80 | 26.648352 | 0.800051 | 0.225567 | 0 | 0.105263 | 1 | 0 | 0.486059 | 0.367828 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.070175 | 0.026316 | 0 | 0.026316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
da01a6c996b016c13ea505174a703f53e3807493 | 392 | py | Python | corehq/apps/userreports/ui/widgets.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 471 | 2015-01-10T02:55:01.000Z | 2022-03-29T18:07:18.000Z | corehq/apps/userreports/ui/widgets.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 14,354 | 2015-01-01T07:38:23.000Z | 2022-03-31T20:55:14.000Z | corehq/apps/userreports/ui/widgets.py | dimagilg/commcare-hq | ea1786238eae556bb7f1cbd8d2460171af1b619c | [
"BSD-3-Clause"
] | 175 | 2015-01-06T07:16:47.000Z | 2022-03-29T13:27:01.000Z | import json
from django import forms
class JsonWidget(forms.Textarea):
def render(self, name, value, attrs=None, renderer=None):
if isinstance(value, str):
# It's probably invalid JSON
return super(JsonWidget, self).render(name, value, attrs, renderer)
return super(JsonWidget, self).render(name, json.dumps(value, indent=2), attrs, renderer)
| 28 | 97 | 0.678571 | 50 | 392 | 5.32 | 0.56 | 0.067669 | 0.105263 | 0.18797 | 0.263158 | 0.263158 | 0 | 0 | 0 | 0 | 0 | 0.003247 | 0.214286 | 392 | 13 | 98 | 30.153846 | 0.86039 | 0.066327 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
da0460b75bef099045c7b6c1e7778ac8768acf81 | 97 | py | Python | Python Class ---- Manipulando Strings/Exercicio 5.py | DouglasCarvalhoPereira/Python-Class---Versionado | 03b8f5a8a69553f733056586988f9840040959d7 | [
"MIT"
] | 1 | 2021-08-22T13:40:20.000Z | 2021-08-22T13:40:20.000Z | Python Class ---- Manipulando Strings/Exercicio 5.py | DouglasCarvalhoPereira/Python-Class---Versionado | 03b8f5a8a69553f733056586988f9840040959d7 | [
"MIT"
] | null | null | null | Python Class ---- Manipulando Strings/Exercicio 5.py | DouglasCarvalhoPereira/Python-Class---Versionado | 03b8f5a8a69553f733056586988f9840040959d7 | [
"MIT"
] | null | null | null | name = str(input('Digite seu nome: ')).upper()
for i in range(0, len(name)):
print(name[i:]) | 24.25 | 46 | 0.608247 | 17 | 97 | 3.470588 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012346 | 0.164948 | 97 | 4 | 47 | 24.25 | 0.716049 | 0 | 0 | 0 | 0 | 0 | 0.173469 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
da0c4b71b187ab49cfa6bfd7c409b4036ec1e875 | 1,861 | py | Python | macvendorupdate/modules/database_settings.py | MikelSan/macvendorupdate | b8a820467e81d102a38d5fd4aa420d7c0890f18d | [
"MIT"
] | null | null | null | macvendorupdate/modules/database_settings.py | MikelSan/macvendorupdate | b8a820467e81d102a38d5fd4aa420d7c0890f18d | [
"MIT"
] | 105 | 2020-04-03T15:49:24.000Z | 2022-03-28T09:19:58.000Z | macvendorupdate/modules/database_settings.py | MikelSan/macvendorupdate | b8a820467e81d102a38d5fd4aa420d7c0890f18d | [
"MIT"
] | 1 | 2020-03-02T11:11:56.000Z | 2020-03-02T11:11:56.000Z | """
Module for the database settings
"""
import sys
from getpass import getpass
import mysql.connector
MYSQL_ERROR_MESSAGES = {
1036: "I don't know how to write in here, I can only read this table",
1037: "Server is about to explode, no memory left, restart it",
1045: "I did not get access with, do I have the correct ID? Check user and pass",
1049: "For real? That database is not in here. Stop giving me bad directions",
1051: "There is no such table. Please don't make fun of me",
2003: "Where is it? I cant find the database on that host",
}
class DatabaseSettings:
def __init__(self):
self.db_host = None
self.db_name = None
self.db_user = None
self.db_pass = None
def ask_for_setup(self):
"""
Ask for the following DataBase information:
- Host of the database
- Database name
- User
- Password
"""
print("Insert the database info")
self.db_host = input("Host: ")
self.db_name = input("Database name: ")
self.db_user = input("User: ")
self.db_pass = getpass()
def check_db_connection(self):
"""
Check if the connection is OK to continue.
If not shows message and quits.
TODO: Make it a loop. If connection fails, ask for new
credentials.
Returns:
MySQLConnection: Object with the MySQL connection object.
"""
try:
conn = mysql.connector.connect(
host=self.db_host,
database=self.db_name,
user=self.db_user,
password=self.db_pass,
)
except mysql.connector.Error as err:
sys.exit(MYSQL_ERROR_MESSAGES[err.errno])
return conn
| 30.016129 | 85 | 0.576034 | 240 | 1,861 | 4.366667 | 0.479167 | 0.068702 | 0.028626 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019721 | 0.346051 | 1,861 | 61 | 86 | 30.508197 | 0.841413 | 0.196131 | 0 | 0 | 0 | 0 | 0.310893 | 0 | 0 | 0 | 0 | 0.016393 | 0 | 1 | 0.088235 | false | 0.147059 | 0.088235 | 0 | 0.235294 | 0.029412 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
da1108f21cd47fd0f2472323c3e240c9306d4ade | 386 | py | Python | ex029.py | vinisantos7/PythonExercicios | bc8f38e03a606d6b0216632a93affeab0792e534 | [
"MIT"
] | 2 | 2021-11-04T21:09:11.000Z | 2021-11-08T09:42:10.000Z | ex029.py | vinisantos7/PythonExercicios | bc8f38e03a606d6b0216632a93affeab0792e534 | [
"MIT"
] | null | null | null | ex029.py | vinisantos7/PythonExercicios | bc8f38e03a606d6b0216632a93affeab0792e534 | [
"MIT"
] | null | null | null | print("======================")
print("RADAR ELETRÔNICO!")
print("======================")
limite = 80.0
multa = 7
velocidade = float(input("Qual a sua velocidade: "))
if velocidade <= limite:
print("Boa Tarde, cuidado na estrada, siga viagem!")
else:
valor = (velocidade - limite) * 7
print(f"Você ultrapassou o limite de velocidade e foi multado em {valor:.2f} reais!") | 27.571429 | 89 | 0.598446 | 48 | 386 | 4.8125 | 0.729167 | 0.138528 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018519 | 0.160622 | 386 | 14 | 89 | 27.571429 | 0.694444 | 0 | 0 | 0.181818 | 0 | 0 | 0.521964 | 0.113695 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.090909 | 0 | 0 | 0 | 0.454545 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 2 |
da2d7d86f48f55c5c7038a26a44c9387f2965c12 | 1,196 | py | Python | conduit/domain/user/module.py | utilmeta/utilmeta-py-realworld-example-app- | cf6d9e83e72323a830b2fcdb5c5eae3ebd800103 | [
"MIT"
] | null | null | null | conduit/domain/user/module.py | utilmeta/utilmeta-py-realworld-example-app- | cf6d9e83e72323a830b2fcdb5c5eae3ebd800103 | [
"MIT"
] | null | null | null | conduit/domain/user/module.py | utilmeta/utilmeta-py-realworld-example-app- | cf6d9e83e72323a830b2fcdb5c5eae3ebd800103 | [
"MIT"
] | null | null | null | from utilmeta.utils import *
from .models import User
from .schema import UserSchema, ProfileSchema
class UserCurrent(Module):
model = User
schema = UserSchema
option = Option(
filters={
'id': Filter(auto_user_id=True)
}
)
method = Method(
get=Auth(relate='self'),
put=Auth(relate='self'),
)
@api.after(method.PUT)
def add_user_result(self) -> schema:
return self.object
@api.after('*')
def add_response(self) -> Response(result_data_key='user'): pass
class UserProfile(Module):
model = User
schema = ProfileSchema
option = Option(
path_param_field=model.username,
path_param_rule=str # mark as required
)
method = Method(get=Auth())
@api.post(request=Request(login=True))
def follow(self, target: model) -> schema:
target.followers.add(self.user)
return self.object
@api.delete(follow, request=Request(login=True))
def unfollow(self, target: model) -> schema:
target.followers.remove(self.user)
return self.object
@api.after('*')
def add_response(self) -> Response(result_data_key='profile'): pass
| 24.916667 | 71 | 0.632943 | 142 | 1,196 | 5.232394 | 0.394366 | 0.032301 | 0.064603 | 0.076716 | 0.38358 | 0.313594 | 0.169583 | 0.169583 | 0.169583 | 0.169583 | 0 | 0 | 0.244983 | 1,196 | 47 | 72 | 25.446809 | 0.822813 | 0.013378 | 0 | 0.236842 | 0 | 0 | 0.019525 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.131579 | false | 0.052632 | 0.078947 | 0.026316 | 0.552632 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
da2fc2d45ddd9158811a14029d018a6b4fb81246 | 1,663 | py | Python | raleigh/algebra/dense_matrix.py | evgueni-ovtchinnikov/raleigh | 620cff4a848cb98034671edc1ebdc6b108fe88b4 | [
"BSD-3-Clause"
] | 5 | 2019-09-25T13:45:36.000Z | 2021-05-28T15:16:51.000Z | raleigh/algebra/dense_matrix.py | evgueni-ovtchinnikov/raleigh | 620cff4a848cb98034671edc1ebdc6b108fe88b4 | [
"BSD-3-Clause"
] | null | null | null | raleigh/algebra/dense_matrix.py | evgueni-ovtchinnikov/raleigh | 620cff4a848cb98034671edc1ebdc6b108fe88b4 | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2019 United Kingdom Research and Innovation
# Author: Evgueni Ovtchinnikov (evgueni.ovtchinnikov@stfc.ac.uk)
"""Architecture-aware wrap for a dense matrix.
"""
import numpy
class AMatrix:
def __init__(self, a, arch='cpu', copy_data=False):
self.__arch = arch
self.__gpu = None
if arch[:3] == 'gpu':
try:
from . import cuda_wrap as cuda
from .dense_cublas import Matrix, Vectors
self.__op = Matrix(a)
self.__gpu = cuda
except:
if len(arch) > 3 and arch[3] == '!':
raise RuntimeError('cannot use GPU')
if self.__gpu is None:
from .dense_cpu import Matrix, Vectors
if copy_data:
self.__op = Matrix(a.copy())
else:
self.__op = Matrix(a)
self.__gpu = None
self.__Vectors = Vectors
self.__vectors = None
vmin = numpy.amin(a)
vmax = numpy.amax(a)
self.__scale = max(abs(vmin), abs(vmax))
def as_operator(self):
return self.__op
def as_vectors(self):
if self.__vectors is None:
self.__vectors = self.__Vectors(self.__op, shallow=True)
return self.__vectors
def arch(self):
return self.__arch
def gpu(self):
return self.__gpu
def dots(self):
return self.__op.dots()
def data_type(self):
return self.__op.data_type()
def shape(self):
return self.__op.shape()
def order(self):
return self.__op.order()
def scale(self):
return self.__scale
| 25.584615 | 68 | 0.556224 | 201 | 1,663 | 4.298507 | 0.328358 | 0.0625 | 0.12963 | 0.092593 | 0.046296 | 0.046296 | 0 | 0 | 0 | 0 | 0 | 0.006428 | 0.345159 | 1,663 | 64 | 69 | 25.984375 | 0.786961 | 0.097414 | 0 | 0.086957 | 0 | 0 | 0.014066 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.086957 | 0.173913 | 0.521739 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
da2ff7ee87bb56c52ebbbb617bf8e08d03951ab9 | 337 | py | Python | homeauto.py | genethurston5/zodacare1 | 44409509c7bc5b49f8e2c5e39ca5a08b216b9d68 | [
"MIT"
] | 8 | 2020-05-25T13:56:26.000Z | 2022-01-27T04:46:32.000Z | homeauto.py | genethurston5/zodacare1 | 44409509c7bc5b49f8e2c5e39ca5a08b216b9d68 | [
"MIT"
] | null | null | null | homeauto.py | genethurston5/zodacare1 | 44409509c7bc5b49f8e2c5e39ca5a08b216b9d68 | [
"MIT"
] | 3 | 2020-05-25T07:12:24.000Z | 2021-04-15T12:20:46.000Z | import time
import RPi.GPIO as GPIO ## Import GPIO library
GPIO.setmode(GPIO.BOARD) ## Use board pin numbering
GPIO.setup(3, GPIO.OUT)
GPIO.setup(5, GPIO.OUT)
def fanl():
GPIO.output(5,GPIO.LOW)
def fanh():
GPIO.output(5,GPIO.HIGH)
def lightl():
GPIO.output(3,GPIO.LOW)
def lighth():
GPIO.output(3,GPIO.HIGH)
| 22.466667 | 56 | 0.670623 | 56 | 337 | 4.035714 | 0.410714 | 0.176991 | 0.097345 | 0.132743 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021661 | 0.178042 | 337 | 14 | 57 | 24.071429 | 0.794224 | 0.127596 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | true | 0 | 0.153846 | 0 | 0.461538 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
da5a544e86cb3f3b15646fd7f1c5b194b8b55afc | 4,853 | py | Python | hio-yocto-bsp/sources/poky/scripts/lib/mic/3rdparty/pykickstart/commands/iscsi.py | qiangzai00001/hio-prj | 060ff97fe21093b1369db78109d5b730b2b181c8 | [
"MIT"
] | null | null | null | hio-yocto-bsp/sources/poky/scripts/lib/mic/3rdparty/pykickstart/commands/iscsi.py | qiangzai00001/hio-prj | 060ff97fe21093b1369db78109d5b730b2b181c8 | [
"MIT"
] | null | null | null | hio-yocto-bsp/sources/poky/scripts/lib/mic/3rdparty/pykickstart/commands/iscsi.py | qiangzai00001/hio-prj | 060ff97fe21093b1369db78109d5b730b2b181c8 | [
"MIT"
] | null | null | null | #
# Chris Lumens <clumens@redhat.com>
# Peter Jones <pjones@redhat.com>
#
# Copyright 2005, 2006, 2007 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat
# trademarks that are incorporated in the source code or documentation are not
# subject to the GNU General Public License and may only be used or replicated
# with the express permission of Red Hat, Inc.
#
from pykickstart.base import *
from pykickstart.errors import *
from pykickstart.options import *
import gettext
_ = lambda x: gettext.ldgettext("pykickstart", x)
class FC6_IscsiData(BaseData):
removedKeywords = BaseData.removedKeywords
removedAttrs = BaseData.removedAttrs
def __init__(self, *args, **kwargs):
BaseData.__init__(self, *args, **kwargs)
self.ipaddr = kwargs.get("ipaddr", "")
self.port = kwargs.get("port", "3260")
self.target = kwargs.get("target", "")
self.user = kwargs.get("user", None)
self.password = kwargs.get("password", None)
def _getArgsAsStr(self):
retval = ""
if self.target != "":
retval += " --target=%s" % self.target
if self.ipaddr != "":
retval += " --ipaddr=%s" % self.ipaddr
if self.port != "3260":
retval += " --port=%s" % self.port
if self.user is not None:
retval += " --user=%s" % self.user
if self.password is not None:
retval += " --password=%s" % self.password
return retval
def __str__(self):
retval = BaseData.__str__(self)
retval += "iscsi%s\n" % self._getArgsAsStr()
return retval
class F10_IscsiData(FC6_IscsiData):
removedKeywords = FC6_IscsiData.removedKeywords
removedAttrs = FC6_IscsiData.removedAttrs
def __init__(self, *args, **kwargs):
FC6_IscsiData.__init__(self, *args, **kwargs)
self.user_in = kwargs.get("user_in", None)
self.password_in = kwargs.get("password_in", None)
def _getArgsAsStr(self):
retval = FC6_IscsiData._getArgsAsStr(self)
if self.user_in is not None:
retval += " --reverse-user=%s" % self.user_in
if self.password_in is not None:
retval += " --reverse-password=%s" % self.password_in
return retval
class FC6_Iscsi(KickstartCommand):
removedKeywords = KickstartCommand.removedKeywords
removedAttrs = KickstartCommand.removedAttrs
def __init__(self, writePriority=71, *args, **kwargs):
KickstartCommand.__init__(self, writePriority, *args, **kwargs)
self.op = self._getParser()
self.iscsi = kwargs.get("iscsi", [])
def __str__(self):
retval = ""
for iscsi in self.iscsi:
retval += iscsi.__str__()
return retval
def _getParser(self):
op = KSOptionParser()
op.add_option("--target", dest="target", action="store", type="string")
op.add_option("--ipaddr", dest="ipaddr", action="store", type="string",
required=1)
op.add_option("--port", dest="port", action="store", type="string")
op.add_option("--user", dest="user", action="store", type="string")
op.add_option("--password", dest="password", action="store",
type="string")
return op
def parse(self, args):
(opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
if len(extra) != 0:
mapping = {"command": "iscsi", "options": extra}
raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(command)s command: %(options)s") % mapping)
dd = self.handler.IscsiData()
self._setToObj(self.op, opts, dd)
dd.lineno = self.lineno
return dd
def dataList(self):
return self.iscsi
class F10_Iscsi(FC6_Iscsi):
removedKeywords = FC6_Iscsi.removedKeywords
removedAttrs = FC6_Iscsi.removedAttrs
def _getParser(self):
op = FC6_Iscsi._getParser(self)
op.add_option("--reverse-user", dest="user_in", action="store",
type="string")
op.add_option("--reverse-password", dest="password_in", action="store",
type="string")
return op
| 36.216418 | 143 | 0.638574 | 586 | 4,853 | 5.148464 | 0.293515 | 0.023865 | 0.025522 | 0.048724 | 0.170368 | 0.117998 | 0.042426 | 0 | 0 | 0 | 0 | 0.013847 | 0.241088 | 4,853 | 133 | 144 | 36.488722 | 0.805322 | 0.196785 | 0 | 0.213483 | 0 | 0 | 0.114779 | 0.005417 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.089888 | 0.044944 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
da62bb9e146a12f437c65e6b086f2fc50a2fd5bb | 877 | py | Python | src-py2/money/tests/test_money.py | cool-RR/money | 7209d4c3bd3ee0d0a8ea5e8a900c51fa81f0526e | [
"MIT"
] | 1 | 2019-09-04T06:04:33.000Z | 2019-09-04T06:04:33.000Z | src-py2/money/tests/test_money.py | cool-RR/money | 7209d4c3bd3ee0d0a8ea5e8a900c51fa81f0526e | [
"MIT"
] | null | null | null | src-py2/money/tests/test_money.py | cool-RR/money | 7209d4c3bd3ee0d0a8ea5e8a900c51fa81f0526e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Money class unittests
"""
import unittest
from money import Money
from money.money import BABEL_AVAILABLE
from .mixins import *
class TestMoneyClass(ClassMixin, unittest.TestCase):
MoneyClass = Money
class TestMoneyRepresentations(RepresentationsMixin, unittest.TestCase):
MoneyClass = Money
@unittest.skipUnless(BABEL_AVAILABLE, "requires Babel")
class TestMoneyFormatting(FormattingMixin, unittest.TestCase):
MoneyClass = Money
class TestMoneyParser(ParserMixin, unittest.TestCase):
MoneyClass = Money
class TestMoneyNumericOperations(NumericOperationsMixin, unittest.TestCase):
MoneyClass = Money
class TestMoneyUnaryOperationsReturnNew(UnaryOperationsReturnNewMixin, unittest.TestCase):
MoneyClass = Money
class TestMoneyLeftmostTypePrevails(LeftmostTypePrevailsMixin, unittest.TestCase):
MoneyClass = Money
| 26.575758 | 90 | 0.802737 | 76 | 877 | 9.236842 | 0.394737 | 0.159544 | 0.259259 | 0.309117 | 0.25641 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001297 | 0.120867 | 877 | 32 | 91 | 27.40625 | 0.909209 | 0.050171 | 0 | 0.368421 | 0 | 0 | 0.01697 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.210526 | 0 | 0.947368 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
da667b8388278995c38fa889ce132432391d7b75 | 268 | py | Python | files/exercises/conditionals-processing-small-files.py | mforneris/introduction_to_python_course | 8075973ee89a921a5e2693f649adbf1fc0e0b2cb | [
"CC-BY-4.0"
] | null | null | null | files/exercises/conditionals-processing-small-files.py | mforneris/introduction_to_python_course | 8075973ee89a921a5e2693f649adbf1fc0e0b2cb | [
"CC-BY-4.0"
] | null | null | null | files/exercises/conditionals-processing-small-files.py | mforneris/introduction_to_python_course | 8075973ee89a921a5e2693f649adbf1fc0e0b2cb | [
"CC-BY-4.0"
] | 1 | 2020-01-09T10:58:56.000Z | 2020-01-09T10:58:56.000Z | # Processing Small Files
# Modify this program so that it only processes files with fewer than 50 records.
import glob
import pandas as pd
for filename in glob.glob('data/*.csv'):
contents = pd.read_csv(filename)
____:
print(filename, len(contents))
| 24.363636 | 81 | 0.720149 | 39 | 268 | 4.820513 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009302 | 0.197761 | 268 | 10 | 82 | 26.8 | 0.865116 | 0.380597 | 0 | 0 | 0 | 0 | 0.06135 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
da705b487d6b1f733865eb4edd7f8234e37e0688 | 446 | py | Python | exercises/ex33.py | ramachandrajr/lpthw | 6ed8066a1a98f858416605877860e39c8413145a | [
"MIT"
] | null | null | null | exercises/ex33.py | ramachandrajr/lpthw | 6ed8066a1a98f858416605877860e39c8413145a | [
"MIT"
] | null | null | null | exercises/ex33.py | ramachandrajr/lpthw | 6ed8066a1a98f858416605877860e39c8413145a | [
"MIT"
] | null | null | null | numbers = []
def loop_through(x, inc):
for i in range(x):
print "At the top i is %d" % i
numbers.append(i)
# We do not need this iterator anymore and
# even if we use it the i value will be over
# written by for loop.
# i = i + inc
print "Numbers now: ", numbers
print "At the bottom i is %d" % i
loop_through(10, 2)
print "The numbers: "
for num in numbers:
print num
| 21.238095 | 52 | 0.565022 | 73 | 446 | 3.424658 | 0.547945 | 0.088 | 0.08 | 0.04 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010309 | 0.347534 | 446 | 20 | 53 | 22.3 | 0.848797 | 0.26009 | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.454545 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
da92dbf80b22089dbac826c34bd69d20d93980b2 | 2,926 | py | Python | notebooks/util.py | NCAR-ASP-2021/ml_tutorial | 15a9f26db399b0731e723688c2ec05be563f3872 | [
"MIT"
] | 2 | 2021-07-08T07:17:40.000Z | 2021-09-14T05:16:48.000Z | notebooks/util.py | NCAR-ASP-2021/ml_tutorial | 15a9f26db399b0731e723688c2ec05be563f3872 | [
"MIT"
] | null | null | null | notebooks/util.py | NCAR-ASP-2021/ml_tutorial | 15a9f26db399b0731e723688c2ec05be563f3872 | [
"MIT"
] | 4 | 2021-07-04T02:08:58.000Z | 2022-02-27T08:11:28.000Z | """This is a general purpose module containing routines
(a) that are used in multiple notebooks; or
(b) that are complicated and would thus otherwise clutter notebook design.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import socket
####################################################################################
### Import Packages ### run in tfp environment:
####################################################################################
from pprint import pprint
import matplotlib.pyplot as plt
import numpy as np
import numpy.matlib
import tensorflow.compat.v2 as tf
tf.enable_v2_behavior()
import tensorflow_probability as tfp
from tensorflow.python.keras.optimizer_v2.adam import Adam
tfd = tfp.distributions
import tensorflow.keras.backend as K
from tensorflow import math as tfm
import os
import glob
import sys
from scipy.stats import rankdata
import pandas as pd
import importlib
import copy
from netCDF4 import Dataset, num2date
from scipy.interpolate import interpn
from matplotlib.colors import Normalize
from matplotlib import cm
import matplotlib as mpl
from math import erf
import matplotlib
#mapping
from cartopy import config
import cartopy.crs as ccrs
import cartopy.feature as cf
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
import xarray as xr
####################################################################################
####################################################################################
def is_ncar_host():
"""Determine if host is an NCAR machine."""
hostname = socket.getfqdn()
return any([re.compile(ncar_host).search(hostname)
for ncar_host in ['cheyenne', 'casper', 'hobart']])
def build_nn_model(n_features, n_outputs, hidden_nodes, emb_size, optimizer='adam', lr=0.0001,
loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
activation='relu', reg=None):
"""
Args:
n_features: Number of features
n_outputs: Number of outputs
hidden_nodes: int or list of hidden nodes
emb_size: Embedding size
max_id: Max embedding ID
compile: If true, compile model
optimizer: Name of optimizer
lr: learning rate
loss: loss function
activation: Activation function for hidden layer
Returns:
model: Keras model
"""
if type(hidden_nodes) is not list:
hidden_nodes = [hidden_nodes]
features_in = tf.keras.layers.Input(shape=(n_features,))
x = features_in
for h in hidden_nodes:
x = tf.keras.layers.Dense(h, activation=activation, kernel_regularizer=reg)(x)
x = tf.keras.layers.Dense(n_outputs, activation='linear', kernel_regularizer=reg)(x)
model = tf.keras.models.Model(inputs=[features_in], outputs=x)
return model | 31.462366 | 94 | 0.6473 | 358 | 2,926 | 5.159218 | 0.446927 | 0.041689 | 0.025988 | 0.019491 | 0.020574 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004149 | 0.17635 | 2,926 | 93 | 95 | 31.462366 | 0.762241 | 0.218045 | 0 | 0 | 0 | 0 | 0.018162 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.039216 | false | 0 | 0.647059 | 0 | 0.72549 | 0.039216 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e50a851e67bcd39da21b61c5db504ad995992a52 | 951 | py | Python | plugins/passivetotal/komand_passivetotal/actions/search_whois/action.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 46 | 2019-06-05T20:47:58.000Z | 2022-03-29T10:18:01.000Z | plugins/passivetotal/komand_passivetotal/actions/search_whois/action.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 386 | 2019-06-07T20:20:39.000Z | 2022-03-30T17:35:01.000Z | plugins/passivetotal/komand_passivetotal/actions/search_whois/action.py | lukaszlaszuk/insightconnect-plugins | 8c6ce323bfbb12c55f8b5a9c08975d25eb9f8892 | [
"MIT"
] | 43 | 2019-07-09T14:13:58.000Z | 2022-03-28T12:04:46.000Z | import komand
from .schema import SearchWhoisInput, SearchWhoisOutput
# Custom imports below
from komand_passivetotal.util import util
class SearchWhois(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="search_whois",
description="Search WHOIS [https://api.passivetotal.org/api/docs/#api-WHOIS-GetV2WhoisSearchQueryField]",
input=SearchWhoisInput(),
output=SearchWhoisOutput(),
)
def run(self, params={}):
field = params.get("field")
query = params["query"]
self.logger.info("Query and field: %s %s", query, field)
results = self.connection.whois.search_whois_by_field(query=query, field=field)
if results:
results = util.clean_dict_recursive(results)
return {"found": not not results, "record": results}
def test(self):
# TODO: Implement test function
return {}
| 31.7 | 117 | 0.649842 | 103 | 951 | 5.815534 | 0.514563 | 0.055092 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001381 | 0.238696 | 951 | 29 | 118 | 32.793103 | 0.825967 | 0.052576 | 0 | 0 | 0 | 0.047619 | 0.16147 | 0 | 0 | 0 | 0 | 0.034483 | 0 | 1 | 0.142857 | false | 0.095238 | 0.142857 | 0.047619 | 0.428571 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
e50fa2ef1c295a4de3a68218fce9eeec945f766c | 1,353 | py | Python | TCPServer.py | liquidlx/tcp-socket-python | 60998ab4aa3831dd7d246b60cb3136b515019cc4 | [
"MIT"
] | null | null | null | TCPServer.py | liquidlx/tcp-socket-python | 60998ab4aa3831dd7d246b60cb3136b515019cc4 | [
"MIT"
] | null | null | null | TCPServer.py | liquidlx/tcp-socket-python | 60998ab4aa3831dd7d246b60cb3136b515019cc4 | [
"MIT"
] | null | null | null | #importa o modulo de socket nativo do python
import socket
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv.bind(('0.0.0.0', 8080))
#Deixa o servidor escutando por novas conexoes no socket.
#O parametro define a quantidade de conexoes que podem estar na fila.
serv.listen(5)
while True:
#accept() - aceita uma nova conexao e guarda as informacoes de conexao na variavel conn e do cliente na variavel addr
conn, client = serv.accept()
#Imprime o endereco IP do cliente
print "Cliente IP", client
#conn.send() - Envia uma mensagem para o cliente
conn.send("Eu sou o servidor.")
#Imprimindo no console
print "\nMensagem: 'Eu sou o servidor' enviada.\n"
#Imprimindo no console
print "Aguardando resposta\n"
#Entra em loop para enviar/receber mensagens
while True:
#Variavel que guarda a mensagem vinda do cliente atraves do metodo conn.recv()
#O primeiro parametro da funcao conn.recv() restringe o tamanho permitido, em bytes, da mensagem.
data = conn.recv(4096)
#Verifica se o cliente nao enviou mensagem.
if not data:
break
else:
#Imprime no console a mensagem
print "Mensagem: '"+data+"' recebida.\n"
#Fecha conexao com cliente
conn.close()
print 'Cliente desconectado\n'
| 37.583333 | 121 | 0.673319 | 191 | 1,353 | 4.759162 | 0.52356 | 0.006601 | 0.006601 | 0.030803 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012795 | 0.249076 | 1,353 | 35 | 122 | 38.657143 | 0.88189 | 0.529194 | 0 | 0.111111 | 0 | 0 | 0.23114 | 0 | 0 | 0 | 0 | 0.028571 | 0 | 0 | null | null | 0 | 0.055556 | null | null | 0.277778 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e523b7ec14d6752f89117f02f33858cf69e19ce4 | 942 | py | Python | pyvieslib/pyvieslib.py | KG5321/pyvieslib | 5530f06b41414e034af3202964d4a203840d2b8e | [
"MIT"
] | 1 | 2020-10-21T01:30:00.000Z | 2020-10-21T01:30:00.000Z | pyvieslib/pyvieslib.py | KG5321/pyvieslib | 5530f06b41414e034af3202964d4a203840d2b8e | [
"MIT"
] | null | null | null | pyvieslib/pyvieslib.py | KG5321/pyvieslib | 5530f06b41414e034af3202964d4a203840d2b8e | [
"MIT"
] | null | null | null | from .vies_validator import ViesValidator
class PyViesLib:
def __init__(self):
self.vvld = ViesValidator()
def check_vies(self, vies: str) -> bool:
"""Function checks validity of given VIES number
:param vies: VIES number
:type vies: str
:return: Returns True when VIES is valid
:rtype: bool
"""
vies = "".join(vies.split()).upper()
country_code = self._get_cuntry_code(vies)
vies_number = vies[0:3].replace(country_code, '') + vies[3:]
result = self.vvld.validate(country_code, vies_number)
return result
def _get_cuntry_code(self, vies: str) -> str:
"""Functions extracts country code from VIES number
:param vies: VIES number
:type vies: str
:return: VIES number country code
:rtype: str
"""
if vies[0:3] == "CHE":
return vies[0:3]
return vies[0:2]
| 28.545455 | 68 | 0.590234 | 117 | 942 | 4.606838 | 0.393162 | 0.12987 | 0.077922 | 0.070501 | 0.170686 | 0.170686 | 0.170686 | 0.170686 | 0.170686 | 0.170686 | 0 | 0.013699 | 0.302548 | 942 | 32 | 69 | 29.4375 | 0.806697 | 0.295117 | 0 | 0 | 0 | 0 | 0.005254 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.071429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e55d7483a2d5e887ef1f4fc60b5e3729724dde12 | 7,534 | py | Python | tests/test_basics.py | brokensandals/spot_check_files | 6ea477e51f48dcd0aa2932ff48ac430dbbc7f26b | [
"MIT"
] | 3 | 2020-04-23T10:47:12.000Z | 2020-05-01T08:12:20.000Z | tests/test_basics.py | brokensandals/spot_check_files | 6ea477e51f48dcd0aa2932ff48ac430dbbc7f26b | [
"MIT"
] | null | null | null | tests/test_basics.py | brokensandals/spot_check_files | 6ea477e51f48dcd0aa2932ff48ac430dbbc7f26b | [
"MIT"
] | null | null | null | import json
from pathlib import Path
from PIL import Image, UnidentifiedImageError
from tempfile import TemporaryDirectory
from spot_check_files.basics import CSVChecker, ImageChecker,\
JSONChecker, PlaintextChecker, XMLChecker
from spot_check_files.checker import CheckRequest
_TEST_CSV = """x,x^2,x cubed in words,x^3
1,1,one,1
2,4,eight,8
3,9,twenty-seven,27
4,16,sixteen,64
5,25,one hundred and twenty-five,125
"""
_TEST_JSON = """{"hello": {
"nicely_formatted": false, "valid": true,
"array": [1, 2, 3, 4, 5, 6, 7, 8, 9,
"This is a multiline string.\\nHuzzah."]
}
}"""
_TEST_XML = """<root><one>Hello there
</one><one>How are you?</one><two>I am
not dead (at time of writing).</two></root>"""
_IMGDIR = Path('tmp')
def setup_module(module):
_IMGDIR.mkdir(exist_ok=True)
def test_csv_valid():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.csv'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_text(_TEST_CSV)
res = CSVChecker().check(req)
assert isinstance(res.recognizer, CSVChecker)
assert res.errors == []
assert res.thumb is None
req.thumb = True
res = CSVChecker().check(req)
assert res.errors == []
res.thumb.save(str(Path(_IMGDIR).joinpath('csv.png')))
with Image.open(str(Path('tests').joinpath('csv.png'))) as img:
assert res.thumb.tobytes() == img.tobytes()
def test_csv_missing_cols():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.csv'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_text('a,b,c\n1,2')
res = CSVChecker().check(req)
assert res.recognizer is None
assert len(res.errors) == 1
assert str(res.errors[0]) == 'Could not determine delimiter'
def test_tsv():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.tsv'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.thumb = True
req.realpath.write_text(_TEST_CSV.replace(',', '\t'))
res = CSVChecker().check(req)
assert isinstance(res.recognizer, CSVChecker)
assert res.errors == []
res.thumb.save(str(Path(_IMGDIR).joinpath('tsv.png')))
with Image.open(str(Path('tests').joinpath('csv.png'))) as img:
assert res.thumb.tobytes() == img.tobytes()
def test_image_valid():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=Path('tests').joinpath('testimage.jpg'),
tmpdir=td,
virtpath=Path('irrelevant'))
res = ImageChecker().check(req)
assert isinstance(res.recognizer, ImageChecker)
assert res.errors == []
assert res.thumb is None
req.thumb = True
res = ImageChecker().check(req)
assert res.errors == []
res.thumb.save(str(Path(_IMGDIR).joinpath('image.png')))
with Image.open(Path('tests').joinpath('image.png')) as img:
assert res.thumb.tobytes() == img.tobytes()
def test_image_invalid():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.jpg'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_text('garbage')
res = ImageChecker().check(req)
assert res.recognizer is None
assert len(res.errors) == 1
assert isinstance(res.errors[0], UnidentifiedImageError)
assert res.thumb is None
def test_json_valid():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.json'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_text(_TEST_JSON)
res = JSONChecker().check(req)
assert isinstance(res.recognizer, JSONChecker)
assert res.errors == []
assert res.thumb is None
req.thumb = True
res = JSONChecker().check(req)
assert res.errors == []
res.thumb.save(str(Path(_IMGDIR).joinpath('json.png')))
with Image.open(Path('tests').joinpath('json.png')) as img:
assert res.thumb.tobytes() == img.tobytes()
def test_json_invalid():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.json'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_text('{"garbage": true')
res = JSONChecker().check(req)
assert res.recognizer is None
assert len(res.errors) == 1
assert isinstance(res.errors[0], json.JSONDecodeError)
def test_plaintext_valid():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.txt'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_text('Hello, world!😀\nNo problems here!\n')
res = PlaintextChecker().check(req)
assert isinstance(res.recognizer, PlaintextChecker)
assert res.errors == []
assert res.thumb is None
req.thumb = True
res = PlaintextChecker().check(req)
assert res.errors == []
res.thumb.save(str(Path(_IMGDIR).joinpath('plaintext.png')))
# The font I'm currently using doesn't handle emoji but I don't
# really care right now
with Image.open(str(Path('tests').joinpath('plaintext.png'))) as img:
assert res.thumb.tobytes() == img.tobytes()
def test_plaintext_encoding_error():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.txt'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_bytes(
bytes('Hello, world!', 'utf-8')
+ bytes([0xfe]) + bytes('oops', 'utf-8'))
res = PlaintextChecker().check(req)
assert isinstance(res.recognizer, PlaintextChecker)
assert len(res.errors) == 1
assert isinstance(res.errors[0], UnicodeDecodeError)
assert res.thumb is None
def test_xml_valid():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.xml'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_text(_TEST_XML)
res = XMLChecker().check(req)
assert isinstance(res.recognizer, XMLChecker)
assert res.errors == []
assert res.thumb is None
req.thumb = True
res = XMLChecker().check(req)
assert res.errors == []
res.thumb.save(str(Path(_IMGDIR).joinpath('xml.png')))
with Image.open(Path('tests').joinpath('xml.png')) as img:
assert res.thumb.tobytes() == img.tobytes()
def test_xml_invalid():
with TemporaryDirectory() as td:
td = Path(td)
req = CheckRequest(
realpath=td.joinpath('test.xml'),
tmpdir=td,
virtpath=Path('irrelevant'))
req.realpath.write_text('<root>garbage')
res = XMLChecker().check(req)
assert res.recognizer is None
assert len(res.errors) == 1
assert 'no element found' in str(res.errors[0])
| 32.196581 | 77 | 0.598354 | 899 | 7,534 | 4.946607 | 0.177976 | 0.056667 | 0.050371 | 0.064313 | 0.762312 | 0.749269 | 0.685631 | 0.637284 | 0.637284 | 0.636384 | 0 | 0.008505 | 0.266525 | 7,534 | 233 | 78 | 32.334764 | 0.796055 | 0.011017 | 0 | 0.639175 | 0 | 0.005155 | 0.116944 | 0.002954 | 0 | 0 | 0.000537 | 0 | 0.231959 | 1 | 0.061856 | false | 0 | 0.030928 | 0 | 0.092784 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e5610307c7003a41db9e713638fb3fff38c64834 | 405 | py | Python | brainpywer/tinyutils.py | BrainPywer/BrainPywer | 6e2571f43e158b419e4cac10b7b5a39f19c874c2 | [
"MIT"
] | 3 | 2016-10-09T23:48:24.000Z | 2016-11-07T09:08:34.000Z | brainpywer/tinyutils.py | BrainPywer/BrainPywer | 6e2571f43e158b419e4cac10b7b5a39f19c874c2 | [
"MIT"
] | null | null | null | brainpywer/tinyutils.py | BrainPywer/BrainPywer | 6e2571f43e158b419e4cac10b7b5a39f19c874c2 | [
"MIT"
] | null | null | null | """
Home of all the miscellaneous BrainPywer utilities that don't deserve their own files
"""
def thaw(snowflake):
"""
Tiny function to return the unix timestamp of a snowflake
:param snowflake: a discord snowflake (It's unique, just like you! ha.)
:type snowflake: int
:return: unix timestamp of the message
:rtype: int
"""
return ((snowflake >> 22)+1420070400000)/1000 | 27 | 85 | 0.68642 | 55 | 405 | 5.054545 | 0.727273 | 0.093525 | 0.107914 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.060127 | 0.219753 | 405 | 15 | 86 | 27 | 0.81962 | 0.711111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e569de32b26549cde5c68a54897b3d82183cdbf9 | 96 | py | Python | hello.py | lukestarchief/cs3240-labdemo | f97ad82ec946bb7a75d9ce616692ec701f82efc4 | [
"MIT"
] | null | null | null | hello.py | lukestarchief/cs3240-labdemo | f97ad82ec946bb7a75d9ce616692ec701f82efc4 | [
"MIT"
] | null | null | null | hello.py | lukestarchief/cs3240-labdemo | f97ad82ec946bb7a75d9ce616692ec701f82efc4 | [
"MIT"
] | null | null | null | __author__ = 'las3wh'
import helper
print("hello")
helper.greeting('hello')
#another comment | 10.666667 | 24 | 0.739583 | 11 | 96 | 6.090909 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011905 | 0.125 | 96 | 9 | 25 | 10.666667 | 0.785714 | 0.15625 | 0 | 0 | 0 | 0 | 0.197531 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e57aec12f0f17e1076b0692c46a4538175de6675 | 4,785 | py | Python | src/tools/repair_tables.py | f304646673/scheduler_frame | 0a9ba45a6523cbf9bd50e9fa8e08c8bfd2a9204a | [
"Apache-2.0"
] | 9 | 2017-05-14T05:12:32.000Z | 2022-01-13T08:11:07.000Z | src/tools/repair_tables.py | f304646673/scheduler_frame | 0a9ba45a6523cbf9bd50e9fa8e08c8bfd2a9204a | [
"Apache-2.0"
] | null | null | null | src/tools/repair_tables.py | f304646673/scheduler_frame | 0a9ba45a6523cbf9bd50e9fa8e08c8bfd2a9204a | [
"Apache-2.0"
] | 7 | 2017-08-28T08:31:43.000Z | 2020-03-03T07:18:37.000Z | #coding=utf-8
#-*- coding: utf-8 -*-
import os
import re
import sys
import time
import MySQLdb
import urllib2
sys.path.append("../frame/")
from loggingex import LOG_INFO
from loggingex import LOG_ERROR
from loggingex import LOG_WARNING
from mysql_conf_parser import mysql_conf_parser
from scheduler_frame_conf_inst import scheduler_frame_conf_inst
def repair_all_tables(table_name, sql_tpl):
section_name = "mysql_manager"
option_name = "conf_path"
frame_conf_inst = scheduler_frame_conf_inst()
frame_conf_inst.load("./conf/frame.conf")
if False == frame_conf_inst.has_option(section_name, option_name):
LOG_WARNING("no %s %s" % (section_name, option_name))
return
conf_path = frame_conf_inst.get(section_name, option_name)
mysql_conf_parser_obj = mysql_conf_parser()
mysql_conf_info = mysql_conf_parser_obj.parse(conf_path)
for conn_name, conn_info in mysql_conf_info.items():
repair_table(conn_info["host"],int(conn_info["port"]),conn_info["user"],conn_info["passwd"],conn_info["db"], table_name, sql_tpl)
def repair_table(host_name, port_num, user_name, password, db_name, table_name ,sql_tpl):
conn = None
cursor = None
try:
conn = MySQLdb.connect(host=host_name, port=port_num, user=user_name, passwd=password, db = db_name)
cursor = conn.cursor()
sql = """show tables"""
cursor.execute(sql)
tables_name = cursor.fetchall()
for table_name_item in tables_name:
table_name_in_db = table_name_item[0]
if table_name not in table_name_in_db:
continue
new_sql = sql_tpl % table_name_in_db
print new_sql
data = cursor.execute(new_sql)
conn.commit()
print data
except MySQLdb.Error, e :
LOG_WARNING("%s execute error %s" % (sql, str(e)))
finally:
try:
if cursor:
cursor.close()
if conn:
conn.close()
except:
pass
if __name__ == "__main__":
import os
os.chdir("../../")
sys.path.append("./src/frame/")
import sys
reload(sys)
sys.setdefaultencoding("utf8")
#repair_all_tables("daily_info_" , "delete from %s where volume = 0")
#repair_all_tables("daily_info_" , "DROP TABLE IF EXISTS %s")
# modify = """
# ALTER TABLE `%s`
# ADD COLUMN `close_ma5` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价5日均值' AFTER `turnover`,
# ADD COLUMN `close_ma10` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价10日均值' AFTER `close_ma5`,
# ADD COLUMN `close_ma20` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价20日均值' AFTER `close_ma10`,
# ADD COLUMN `close_ma30` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价30日均值' AFTER `close_ma20`,
# ADD COLUMN `close_ma60` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价60日均值' AFTER `close_ma30`,
# ADD COLUMN `close_ma90` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价90日均值' AFTER `close_ma60`,
# ADD COLUMN `close_ma180` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价180日均值' AFTER `close_ma90`,
# ADD COLUMN `volume_ma5` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量5日均值' AFTER `close_ma180`,
# ADD COLUMN `volume_ma10` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量10日均值' AFTER `volume_ma5`,
# ADD COLUMN `volume_ma20` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量20日均值' AFTER `volume_ma10`,
# ADD COLUMN `volume_ma30` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量30日均值' AFTER `volume_ma20`,
# ADD COLUMN `volume_ma60` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量60日均值' AFTER `volume_ma30`,
# ADD COLUMN `volume_ma90` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量90日均值' AFTER `volume_ma60`,
# ADD COLUMN `volume_ma180` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量180日均值' AFTER `volume_ma90`;
# """
# modify = """
# ALTER TABLE `%s`
# ADD COLUMN `close_ma120` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价120日均值' AFTER `close_ma90`,
# ADD COLUMN `close_ma150` float(16,2) NOT NULL DEFAULT 0 COMMENT '收盘价150日均值' AFTER `close_ma120`,
# ADD COLUMN `volume_ma120` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量120日均值' AFTER `volume_ma90`,
# ADD COLUMN `volume_ma150` float(16,2) NOT NULL DEFAULT 0 COMMENT '成交量150日均值' AFTER `volume_ma120`;
# """
# modify = """
# ALTER TABLE `%s`
# CHANGE COLUMN `yesteday_close` `yesterday_close` float(16,2) NOT NULL DEFAULT 0.00 COMMENT '×ÌÊÅ' AFTER `today_open`;
# """
modify = """
ALTER TABLE `%s`
MODIFY COLUMN `today_open` float(16,2) NOT NULL DEFAULT 0 COMMENT '今日开盘价' AFTER `today_low`;
"""
repair_all_tables("daily_info_" , modify)
#repair_all_tables("trade_info_" , modify)
| 42.723214 | 137 | 0.662069 | 677 | 4,785 | 4.444609 | 0.206795 | 0.046527 | 0.053174 | 0.073114 | 0.296112 | 0.242938 | 0.242938 | 0.214689 | 0.204719 | 0 | 0 | 0.054954 | 0.228004 | 4,785 | 111 | 138 | 43.108108 | 0.759339 | 0.486729 | 0 | 0.092308 | 0 | 0.015385 | 0.115242 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.061538 | 0.2 | null | null | 0.030769 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e58b342babf33cf3ef9acca02d7f81c84db7952c | 8,618 | py | Python | tests/test_parallel_workflow.py | fransking/flink-statefun-tasks | 20c26896a3448a06e4af0742a3d885194e46c727 | [
"Apache-2.0"
] | 16 | 2020-10-19T11:55:36.000Z | 2022-02-22T12:13:57.000Z | tests/test_parallel_workflow.py | fransking/flink-statefun-tasks | 20c26896a3448a06e4af0742a3d885194e46c727 | [
"Apache-2.0"
] | 20 | 2020-09-29T17:14:49.000Z | 2022-02-25T20:34:31.000Z | tests/test_parallel_workflow.py | fransking/flink-statefun-tasks | 20c26896a3448a06e4af0742a3d885194e46c727 | [
"Apache-2.0"
] | 3 | 2020-10-30T10:05:37.000Z | 2021-08-11T21:51:09.000Z | from statefun_tasks.messages_pb2 import Pipeline
import unittest
from statefun_tasks import in_parallel
from tests.utils import TestHarness, tasks, TaskErrorException
join_results_called = False
join_results2_called = False
join_results3_called = False
say_goodbye_called = False
@tasks.bind()
def _say_hello(first_name, last_name):
return f'Hello {first_name} {last_name}'
@tasks.bind()
def _say_goodbye(greeting, goodbye_message):
global say_goodbye_called
say_goodbye_called = True
return f'{greeting}. So now I will say {goodbye_message}'
@tasks.bind()
def _fail(*args):
raise Exception('I am supposed to fail')
@tasks.bind()
def _join_results(results):
global join_results_called
join_results_called = True
return '; '.join(results)
@tasks.bind()
def _join_results2(results):
global join_results2_called
join_results2_called = True
return '; '.join(results)
@tasks.bind()
def _join_results3(results):
global join_results3_called
join_results3_called = True
return '; '.join(results)
@tasks.bind()
def _print_results(results):
return str(results)
@tasks.bind(with_state=True)
def _say_hello_with_state(initial_state, first_name, last_name):
state = len(first_name) + len(last_name)
return state, f'Hello {first_name} {last_name}'
@tasks.bind()
def _say_goodbye_with_state(greeting, goodbye_message):
return f'{greeting}. So now I will say {goodbye_message}'
@tasks.bind(with_state=True)
def _join_results_with_state(state, results):
return state, '; '.join(results) + f' {state}'
class ParallelWorkflowTests(unittest.TestCase):
def setUp(self) -> None:
self.test_harness = TestHarness()
def test_parallel_workflow(self):
pipeline = in_parallel([
_say_hello.send("John", "Smith"),
_say_hello.send("Jane", "Doe").continue_with(_say_goodbye, goodbye_message="see you later!"),
]).continue_with(_join_results)
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, 'Hello John Smith; Hello Jane Doe. So now I will say see you later!')
def test_parallel_workflow_with_state(self):
pipeline = in_parallel([
_say_hello_with_state.send("John", "Smith"),
_say_hello_with_state.send("Jane", "Doe").continue_with(_say_goodbye, goodbye_message="see you later!"),
]).continue_with(_join_results_with_state)
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, 'Hello John Smith; Hello Jane Doe. So now I will say see you later! 9')
def test_nested_parallel_workflow(self):
pipeline = in_parallel([
in_parallel([
in_parallel([
_say_hello.send("John", "Smith"),
_say_hello.send("Jane", "Doe").continue_with(_say_goodbye, goodbye_message="see you later!")
]).continue_with(_join_results)
])
])
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, [['Hello John Smith; Hello Jane Doe. So now I will say see you later!']])
def test_nested_parallel_workflow_continuations(self):
pipeline = in_parallel([
in_parallel([
in_parallel([
_say_hello.send("John", "Smith"),
_say_hello.send("Jane", "Doe").continue_with(_say_goodbye, goodbye_message="see you later!")
]).continue_with(_join_results)
]).continue_with(_join_results2)
]).continue_with(_join_results3)
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, 'Hello John Smith; Hello Jane Doe. So now I will say see you later!')
self.assertEqual(join_results_called, True)
self.assertEqual(join_results2_called, True)
self.assertEqual(join_results3_called, True)
def test_continuation_into_parallel_workflow(self):
pipeline = _say_hello.send("John", "Smith").continue_with(in_parallel([
_say_goodbye.send(goodbye_message="see you later!"),
_say_goodbye.send(goodbye_message="see you later!")
]))
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, ['Hello John Smith. So now I will say see you later!', 'Hello John Smith. So now I will say see you later!'])
def test_continuation_into_parallel_workflow_with_contination(self):
pipeline = _say_hello.send("John", "Smith").continue_with(in_parallel([
_say_goodbye.send(goodbye_message="see you later!"),
_say_goodbye.send(goodbye_message="see you later!")
]).continue_with(_join_results))
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, 'Hello John Smith. So now I will say see you later!; Hello John Smith. So now I will say see you later!')
def test_continuation_into_parallel_workflow_with_two_continations(self):
pipeline = _say_hello.send("John", "Smith").continue_with(in_parallel([
_say_goodbye.send(goodbye_message="see you later!"),
_say_goodbye.send(goodbye_message="see you later!"),
])).continue_with(_join_results).continue_with(_print_results)
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, 'Hello John Smith. So now I will say see you later!; Hello John Smith. So now I will say see you later!')
def test_continuation_into_nested_parallel_workflow(self):
pipeline = _say_hello.send("John", "Smith").continue_with(in_parallel([in_parallel([
_say_goodbye.send(goodbye_message="see you later!"),
_say_goodbye.send(goodbye_message="see you later!")
])]))
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, [['Hello John Smith. So now I will say see you later!', 'Hello John Smith. So now I will say see you later!']])
def test_parallel_workflow_with_error(self):
global join_results_called
join_results_called = False
pipeline = in_parallel([
_say_hello.send("John", "Smith"),
_fail.send(),
_say_goodbye.send("John", "Bye")
]).continue_with(_join_results)
self.assertRaises(TaskErrorException, self.test_harness.run_pipeline, pipeline)
self.assertEqual(join_results_called, False)
self.assertEqual(say_goodbye_called, True)
def test_parallel_workflow_with_error_and_continuations(self):
global join_results_called
join_results_called = False
pipeline = in_parallel([
_fail.send().continue_with(in_parallel([_say_hello.send("John", "Smith").continue_with(_join_results)])), # this chain will fail at first step
_say_goodbye.send("John", "Bye") # this chain will proceed
])
# overall we will get an exception
self.assertRaises(TaskErrorException, self.test_harness.run_pipeline, pipeline)
self.assertEqual(join_results_called, False)
self.assertEqual(say_goodbye_called, True)
def test_empty_parallel_workflow(self):
pipeline = in_parallel([])
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, ())
def test_parallel_workflow_with_last_task_in_group_being_a_group(self):
pipeline = in_parallel([
_say_hello.send("John", "Smith"),
_say_hello.send("Jane", "Doe").continue_with(_say_goodbye, goodbye_message="see you later!"),
in_parallel([
_say_hello.send("Bob", "Smith"),
_say_hello.send("Tom", "Smith"),
]),
]).continue_with(_print_results)
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, "['Hello John Smith', 'Hello Jane Doe. So now I will say see you later!', ['Hello Bob Smith', 'Hello Tom Smith']]")
def test_parallel_workflow_with_max_parallelism(self):
pipeline = in_parallel([
_say_hello.send("Jane", "Doe"),
in_parallel([
_say_hello.send("Bob", "Smith").continue_with(_say_goodbye, goodbye_message="see you later!"),
_say_hello.send("Tom", "Smith"),
], max_parallelism=1),
]).continue_with(_print_results)
result = self.test_harness.run_pipeline(pipeline)
self.assertEqual(result, "['Hello Jane Doe', ['Hello Bob Smith. So now I will say see you later!', 'Hello Tom Smith']]")
if __name__ == '__main__':
unittest.main()
| 36.058577 | 155 | 0.675563 | 1,088 | 8,618 | 5.022059 | 0.096507 | 0.030747 | 0.056369 | 0.029283 | 0.784773 | 0.722914 | 0.686859 | 0.655564 | 0.644583 | 0.619327 | 0 | 0.00222 | 0.215943 | 8,618 | 238 | 156 | 36.210084 | 0.806423 | 0.010559 | 0 | 0.539394 | 0 | 0.024242 | 0.170832 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 1 | 0.145455 | false | 0 | 0.024242 | 0.024242 | 0.230303 | 0.024242 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e58be54d69a7f89f2676872cda7393c87ab5f03c | 490 | py | Python | Easy/TheySeeMePalindroming.py | revanthsenthil/dCoder_select | 20662123f1d3e1f9c7e8225eea7732be3a19ae57 | [
"MIT"
] | 1 | 2021-08-03T21:23:08.000Z | 2021-08-03T21:23:08.000Z | Easy/TheySeeMePalindroming.py | revanthsenthil/dCoder-Solved | 20662123f1d3e1f9c7e8225eea7732be3a19ae57 | [
"MIT"
] | null | null | null | Easy/TheySeeMePalindroming.py | revanthsenthil/dCoder-Solved | 20662123f1d3e1f9c7e8225eea7732be3a19ae57 | [
"MIT"
] | 1 | 2021-04-22T09:20:12.000Z | 2021-04-22T09:20:12.000Z | """
Problem Description:
In india there is a puzzle"5 characters my name, reverse- forward is the same." You will be presented with a 5 character String, you have to tell whether it satisfy above puzzle, if yes output "Yes" else "No"
Input:
Input is String S of 5 characters.
Output:
Print "Yes" if the String S satisfies above constraints, else "No".
Constraints:
String length = 5
Sample Input:
level
Sample Output:
Yes
"""
a = input()
print("Yes") if a == a[::-1] else print("No")
| 21.304348 | 208 | 0.718367 | 82 | 490 | 4.292683 | 0.54878 | 0.0625 | 0.056818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012469 | 0.181633 | 490 | 22 | 209 | 22.272727 | 0.865337 | 0.861224 | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
e59db128d3aea47146f87f9be29821705ab5e310 | 318 | py | Python | web/core/migrations/0132_auto_20210428_1439.py | MTES-MCT/biocarburants | ff084916e18cdbdc41400f36fa6cc76a5e05900e | [
"MIT"
] | 4 | 2020-03-22T18:13:12.000Z | 2021-01-25T10:33:31.000Z | web/core/migrations/0132_auto_20210428_1439.py | MTES-MCT/carbure | 2876756b760ab4866fa783bb40e61a046eebb1ab | [
"MIT"
] | 20 | 2020-07-06T14:33:14.000Z | 2022-03-15T16:54:17.000Z | web/core/migrations/0132_auto_20210428_1439.py | MTES-MCT/biocarburants | ff084916e18cdbdc41400f36fa6cc76a5e05900e | [
"MIT"
] | 4 | 2020-04-03T12:19:12.000Z | 2021-06-15T12:20:57.000Z | # Generated by Django 3.2 on 2021-04-28 12:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('certificates', '0007_auto_20210428_1439'),
('core', '0131_lotv2_remaining_volume'),
]
operations = [
]
| 19.875 | 52 | 0.679245 | 38 | 318 | 5.526316 | 0.815789 | 0.07619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138889 | 0.207547 | 318 | 15 | 53 | 21.2 | 0.694444 | 0.13522 | 0 | 0 | 1 | 0 | 0.241758 | 0.18315 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e5a45a521877b035e330718c33f26690d8f763a4 | 4,218 | py | Python | dlkit/json_/repository/record_templates.py | UOC/dlkit | a9d265db67e81b9e0f405457464e762e2c03f769 | [
"MIT"
] | 2 | 2018-02-23T12:16:11.000Z | 2020-10-08T17:54:24.000Z | dlkit/json_/repository/record_templates.py | UOC/dlkit | a9d265db67e81b9e0f405457464e762e2c03f769 | [
"MIT"
] | 87 | 2017-04-21T18:57:15.000Z | 2021-12-13T19:43:57.000Z | dlkit/json_/repository/record_templates.py | UOC/dlkit | a9d265db67e81b9e0f405457464e762e2c03f769 | [
"MIT"
] | 1 | 2018-03-01T16:44:25.000Z | 2018-03-01T16:44:25.000Z | """JSON implementations of repository records."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods,too-few-public-methods
# Number of methods are defined in specification
# pylint: disable=protected-access
# Access to protected methods allowed in package json package scope
# pylint: disable=too-many-ancestors
# Inheritance defined in specification
from .. import utilities
from ..osid import records as osid_records
from dlkit.abstract_osid.repository import records as abc_repository_records
class AssetRecord(abc_repository_records.AssetRecord, osid_records.OsidRecord):
"""A record for an ``Asset``.
The methods specified by the record type are available through the
underlying object.
"""
class AssetQueryRecord(abc_repository_records.AssetQueryRecord, osid_records.OsidRecord):
"""A record for an ``AssetQuery``.
The methods specified by the record type are available through the
underlying object.
"""
class AssetFormRecord(abc_repository_records.AssetFormRecord, osid_records.OsidRecord):
"""A record for an ``AssetForm``.
The methods specified by the record type are available through the
underlying object.
"""
class AssetSearchRecord(abc_repository_records.AssetSearchRecord, osid_records.OsidRecord):
"""A record for an ``AssetSearch``.
The methods specified by the record type are available through the
underlying object.
"""
class AssetContentRecord(abc_repository_records.AssetContentRecord, osid_records.OsidRecord):
"""A record for an ``AssetContent``.
The methods specified by the record type are available through the
underlying object.
"""
class AssetContentQueryRecord(abc_repository_records.AssetContentQueryRecord, osid_records.OsidRecord):
"""A record for an ``AssetContentQuery``.
The methods specified by the record type are available through the
underlying object.
"""
class AssetContentFormRecord(abc_repository_records.AssetContentFormRecord, osid_records.OsidRecord):
"""A record for an ``AssetForm``.
The methods specified by the record type are available through the
underlying object.
"""
class CompositionRecord(abc_repository_records.CompositionRecord, osid_records.OsidRecord):
"""A record for a ``Composition``.
The methods specified by the record type are available through the
underlying object.
"""
class CompositionQueryRecord(abc_repository_records.CompositionQueryRecord, osid_records.OsidRecord):
"""A record for a ``CompositionQuery``.
The methods specified by the record type are available through the
underlying object.
"""
class CompositionFormRecord(abc_repository_records.CompositionFormRecord, osid_records.OsidRecord):
"""A record for a ``CompositionForm``.
The methods specified by the record type are available through the
underlying object.
"""
class CompositionSearchRecord(abc_repository_records.CompositionSearchRecord, osid_records.OsidRecord):
"""A record for a ``CompositionSearch``.
The methods specified by the record type are available through the
underlying object.
"""
class RepositoryRecord(abc_repository_records.RepositoryRecord, osid_records.OsidRecord):
"""A record for a ``Repository``.
The methods specified by the record type are available through the
underlying object.
"""
class RepositoryQueryRecord(abc_repository_records.RepositoryQueryRecord, osid_records.OsidRecord):
"""A record for a ``RepositoryQuery``.
The methods specified by the record type are available through the
underlying object.
"""
class RepositoryFormRecord(abc_repository_records.RepositoryFormRecord, osid_records.OsidRecord):
"""A record for a ``RepositoryForm``.
The methods specified by the record type are available through the
underlying object.
"""
class RepositorySearchRecord(abc_repository_records.RepositorySearchRecord, osid_records.OsidRecord):
"""A record for a ``RepositorySearch``.
The methods specified by the record type are available through the
underlying object.
"""
| 27.933775 | 103 | 0.757231 | 481 | 4,218 | 6.530146 | 0.170478 | 0.092009 | 0.101878 | 0.105062 | 0.526902 | 0.526902 | 0.526902 | 0.392869 | 0.392869 | 0.392869 | 0 | 0 | 0.1688 | 4,218 | 150 | 104 | 28.12 | 0.895893 | 0.526316 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.166667 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e5b1c72435d2abb46fbf6d62714ddf05151ab6bd | 723 | py | Python | tests/test_Script.py | anthonybuckle/Reciprocity-Core | 3254073f44e8fe2222aed9879885a2e609d4044a | [
"MIT"
] | null | null | null | tests/test_Script.py | anthonybuckle/Reciprocity-Core | 3254073f44e8fe2222aed9879885a2e609d4044a | [
"MIT"
] | null | null | null | tests/test_Script.py | anthonybuckle/Reciprocity-Core | 3254073f44e8fe2222aed9879885a2e609d4044a | [
"MIT"
] | null | null | null | from unittest import TestCase, main
from recip import recipcli
class test_Script(TestCase):
def test_DeployScript(self):
command = 'DeployScript'
parameters = []
recipcli.handleCommand(command, parameters)
def test_DeployLocalScript(self):
command = 'DeployLocalScript'
parameters = []
recipcli.handleCommand(command, parameters)
def test_CallTxScript(self):
command = 'CallTxScript'
parameters = []
recipcli.handleCommand(command, parameters)
def test_CallLocalScript(self):
command = 'CallLocalScript'
parameters = []
recipcli.handleCommand(command, parameters)
if __name__ == '__main__':
main() | 23.322581 | 51 | 0.662517 | 61 | 723 | 7.639344 | 0.344262 | 0.060086 | 0.266094 | 0.32618 | 0.457082 | 0.354077 | 0.354077 | 0 | 0 | 0 | 0 | 0 | 0.250346 | 723 | 31 | 52 | 23.322581 | 0.859779 | 0 | 0 | 0.380952 | 0 | 0 | 0.088398 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.190476 | false | 0 | 0.095238 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e5b238896ff3c26321d63756729cf81eecf9b535 | 294 | py | Python | dj_first/users/views.py | amourbrus/DjangoFirst | cf9ce450b24226eafcf650340ca5a6ba3df20704 | [
"MIT"
] | null | null | null | dj_first/users/views.py | amourbrus/DjangoFirst | cf9ce450b24226eafcf650340ca5a6ba3df20704 | [
"MIT"
] | null | null | null | dj_first/users/views.py | amourbrus/DjangoFirst | cf9ce450b24226eafcf650340ca5a6ba3df20704 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from .models import BookInfo
from django.http import HttpResponse
# Create your views here.
def index(request):
# return HttpResponse("hello world")
data = {
"message":"hello world 哈哈哈哈哈"
}
return render(request, 'index.html',data)
| 22.615385 | 45 | 0.704082 | 36 | 294 | 5.75 | 0.638889 | 0.096618 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.20068 | 294 | 12 | 46 | 24.5 | 0.880851 | 0.197279 | 0 | 0 | 0 | 0 | 0.146552 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e5bb598386e45073ddbffea9bcc75a4fb37eae1d | 2,901 | py | Python | src/envs/smart_man_sim/core_traffic.py | jh3ex/cirp | 9484de6f7b31e2d81da5efc999649f60a5f97bfe | [
"Apache-1.1"
] | null | null | null | src/envs/smart_man_sim/core_traffic.py | jh3ex/cirp | 9484de6f7b31e2d81da5efc999649f60a5f97bfe | [
"Apache-1.1"
] | null | null | null | src/envs/smart_man_sim/core_traffic.py | jh3ex/cirp | 9484de6f7b31e2d81da5efc999649f60a5f97bfe | [
"Apache-1.1"
] | null | null | null | import time
import numpy as np
import random
import math
from absl import logging
from .scenes import get_map_params
from functools import partial
import math
class Vehicle():
def __init__(self, id, x_init, y_init, x_goal, y_goal, **mid_xys):
self.id = id
self.x_init = x_init
self.y_init = y_init
self.mid_points_dict = mid_xys
def gas(self):
assert self.x_mid == self.x_mid or self.y_mid
def brake(self):
# do nothing here
return
class TrafficJunction:
def __init__(self, difficulty='easy'):
self._init_board(difficulty)
def _init_board(self, difficulty):
if difficulty == "easy":
#N, W
self.init_pos_dict = {'W': (0, 3), 'N': (3, 0)}
self.goal_pos_dict = {'E': (6, 3), 'S': (3, 6)}
self.mid_point_dict = {'WE': [], 'NS': []}
else:
#NW, NE, WN, WS, EN, ES, SW, SE
self.init_pos_dict = {'NW': (0, 4), 'NE':(0, 12),
'WN': (5, 0), 'WS': (13, 0),
'EN': (4, 17), 'ES': (12, 17),
'SW': (17, 5), 'SE': (17, 13)}
self.goal_pos_dict = {'NW': (0, 5), 'NE':(0, 13),
'WN': (4, 0), 'WS': (12, 0),
'EN': (5, 17), 'ES': (13, 17),
'SW': (17, 4), 'SE': (17, 12)}
self.mid_point_dict = {'NWNE': [(5, 4), (5, 13)], 'NWWN': [(4, 4)], 'NWWS': [(12, 4)], 'NWEN': [(5, 4)], 'NWES': [(13, 4)], 'NWSW': [], 'NWSE':[(13, 4), (13, 12)],
'NENW': [(4, 12), (4, 5)], 'NEWN': [(4, 12)], 'NEWS': [(12, 12)], 'NEEN': [(5, 12)], 'NEES': [(13, 12)], 'NESW': [(12, 12), (12, 4)], 'NESE':[],
'WNNW': [(5, 5)], 'WNWE': [(5, 13)], 'WNWS': [(5, 4), (12, 4)], 'WNEN': [], 'WNES': [(5, 12), (13, 12)], 'WNSW': [(5, 4)], 'WNSE':[(5, 12)],
'WSNW': [(13, 5)], 'WSNE': [(13, 13)], 'WSWN': [(13, 5), (4, 5)], 'WSEN': [(13, 13), (5, 13)], 'WSES': [], 'WSSW': [(13, 4)], 'WSSE':[(13, 12)],
'ENNW': [(4, 5)], 'ENNE': [(4, 13)], 'ENWN': [], 'ENWS': [(4, 4), (12, 4)], 'ENES': [(4, 12), (13, 12)], 'ENSW': [(4, 4)], 'ENSE':[(4, 12)],
'ESNW': [(12, 5)], 'ESNE': [(12, 13)], 'ESWS': [], 'ESWN': [(12, 5), (4, 5)], 'ESEN': [(12, 13), (5, 13)], 'ESSW': [(12, 4)], 'NESE':[(12, 12)],
'SWNW': [], 'SWNE': [(5, 5), (5, 13)], 'SWWS': [(12, 5)], 'SWWN': [(4, 5)], 'SWEN': [(5, 5)], 'SWES': [(13, 5)], 'SWSE':[(13, 5), (13, 12)],
'SENW': [(4, 13), (4, 5)], 'SENE': [], 'SEWS': [(12, 13)], 'SEWN': [(4, 13)], 'SEEN': [(5, 13)], 'SEES': [(13, 13)], 'SESW':[(12, 13),(12, 4)]}
def _add_vehicle(self):
| 47.557377 | 180 | 0.382971 | 386 | 2,901 | 2.766839 | 0.318653 | 0.013109 | 0.008427 | 0.02809 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13094 | 0.347122 | 2,901 | 60 | 181 | 48.35 | 0.432946 | 0.016891 | 0 | 0.045455 | 0 | 0 | 0.095506 | 0 | 0 | 0 | 0 | 0 | 0.022727 | 0 | null | null | 0 | 0.181818 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e5cac5aa6b41ea33d0a0a367793cd9d5728e804d | 1,009 | py | Python | backend/common/routes.py | Yandjatg/ragproject | 36acdd5a8d2f9593ca5b7da272346bddba8fa9bd | [
"MIT"
] | null | null | null | backend/common/routes.py | Yandjatg/ragproject | 36acdd5a8d2f9593ca5b7da272346bddba8fa9bd | [
"MIT"
] | null | null | null | backend/common/routes.py | Yandjatg/ragproject | 36acdd5a8d2f9593ca5b7da272346bddba8fa9bd | [
"MIT"
] | null | null | null | from users.userViews import UserviewSet
from actualites.views import ActualiteviewSet
from diasporas.views import DiasporaviewSet
from innovations.views import InnovationviewSet
from interviews.views import InterviewviewSet
from politiques.views import PolitiqueviewSet
from portrait.views import PortraitviewSet
from startups.views import StartupviewSet
routes = [
{'regex': r'rag/users', 'viewset': UserviewSet, 'basename': 'Rag'},
{'regex': r'rag/diasporas', 'viewset': DiasporaviewSet, 'basename': 'Rag'},
{'regex': r'rag/innovations', 'viewset': InnovationviewSet, 'basename': 'Rag'},
{'regex': r'rag/interviews', 'viewset': InterviewviewSet, 'basename': 'Rag'},
{'regex': r'rag/politiques', 'viewset': PolitiqueviewSet, 'basename': 'Rag'},
{'regex': r'rag/portraits', 'viewset': PortraitviewSet, 'basename': 'Rag'},
{'regex': r'rag/startups', 'viewset': StartupviewSet, 'basename': 'Rag'},
{'regex': r'rag/actualites', 'viewset': ActualiteviewSet, 'basename': 'Rag'},
]
| 50.45 | 83 | 0.722498 | 105 | 1,009 | 6.942857 | 0.257143 | 0.065844 | 0.098765 | 0.163237 | 0.192044 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115956 | 1,009 | 19 | 84 | 53.105263 | 0.817265 | 0 | 0 | 0 | 0 | 0 | 0.285431 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
e5d080a7be35d30cc80b969211ae72fc0d60f6f2 | 787 | py | Python | pyopenvpn/common.py | sdwannfv/pyopenvpn | b7e4a9494abaf11bc4404b9c225683e7f55c7600 | [
"MIT"
] | null | null | null | pyopenvpn/common.py | sdwannfv/pyopenvpn | b7e4a9494abaf11bc4404b9c225683e7f55c7600 | [
"MIT"
] | null | null | null | pyopenvpn/common.py | sdwannfv/pyopenvpn | b7e4a9494abaf11bc4404b9c225683e7f55c7600 | [
"MIT"
] | null | null | null |
class ClientError(Exception):
pass
class ProtocolError(ClientError):
""" Error communicating with the OpenVPN server """
pass
class InvalidPacketError(ProtocolError):
""" Packet that doesn't make any sense and cannot be read correctly. """
pass
class InvalidHMACError(InvalidPacketError):
pass
class ProtocolLogicError(ProtocolError):
""" Unsupported stuff, unexpected packets, ...
Things that are readable but not supported by this implementation.
"""
pass
class AuthFailed(ClientError):
pass
class ConfigError(ClientError):
pass
class Channel:
def __init__(self):
self.queue = []
def push_packet(self, packet):
self.queue.append(packet)
def _send(self, packet):
self.c._send(packet)
| 17.488889 | 76 | 0.68615 | 84 | 787 | 6.345238 | 0.595238 | 0.118199 | 0.075047 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.223634 | 787 | 44 | 77 | 17.886364 | 0.87234 | 0.279543 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.333333 | 0 | 0 | 0.52381 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
e5e1edb35d6ac691183f3656c79e342ddb19e8f8 | 475 | py | Python | helios/store/decorators.py | panosl/helios | 22ceb736709aaa336def81d801797d72321a737e | [
"BSD-3-Clause"
] | 2 | 2021-01-26T02:37:19.000Z | 2021-12-02T14:15:22.000Z | helios/store/decorators.py | panosl/helios | 22ceb736709aaa336def81d801797d72321a737e | [
"BSD-3-Clause"
] | null | null | null | helios/store/decorators.py | panosl/helios | 22ceb736709aaa336def81d801797d72321a737e | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
import pickle
from django.http import HttpResponseRedirect
from django.urls import reverse
def cart_required(view_func):
def wrapped(*args, **kwargs):
try:
session_cart = pickle.loads(args[0].session.get('cart'))
except:
pass
if len(session_cart) == 0:
return HttpResponseRedirect(reverse('store_cart'))
else:
return view_func(*args, **kwargs)
return wrapped
| 23.75 | 68 | 0.614737 | 54 | 475 | 5.296296 | 0.574074 | 0.06993 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008696 | 0.273684 | 475 | 19 | 69 | 25 | 0.82029 | 0.044211 | 0 | 0 | 0 | 0 | 0.030973 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0.071429 | 0.214286 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
e5e800aa69a4d0225e1f3a8d40a05e4b1701e0a5 | 1,102 | py | Python | credentials.py | Steve-design/Password-Locker | 91a2450b9e9bca52bdb8ef7fd6a09816df13fa7c | [
"MIT"
] | null | null | null | credentials.py | Steve-design/Password-Locker | 91a2450b9e9bca52bdb8ef7fd6a09816df13fa7c | [
"MIT"
] | null | null | null | credentials.py | Steve-design/Password-Locker | 91a2450b9e9bca52bdb8ef7fd6a09816df13fa7c | [
"MIT"
] | null | null | null | import pyperclip
class Credentials:
credentials_list = []
def __init__(self, account_name, login_detail , Password):
self.account_name = account_name
self.login_detail = login_detail
self.Password = Password
'''
save our accounts passwords here.
'''
def save_credentials(self):
'''
function that saves credentials once defined
'''
Credentials.credentials_list.append(self)
# @classmethod
# def create_credentials(account_name, login_detail , Password):
# new_credentials = Credentials(account_name, login_detail , Password)
# return new_credentials
def delete_credentials(self):
'''
used to delete credentials
'''
Credentials.credentials_list.remove(self)
@classmethod
def find_account(cls, account_name):
'''
search for accounts
'''
for credentials in cls.credentials_list:
if credentials.account_name == account_name:
return credentials | 28.25641 | 78 | 0.6098 | 104 | 1,102 | 6.201923 | 0.365385 | 0.136434 | 0.12093 | 0.102326 | 0.173643 | 0.127132 | 0 | 0 | 0 | 0 | 0 | 0 | 0.316697 | 1,102 | 39 | 79 | 28.25641 | 0.856574 | 0.245917 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.125 | 0.0625 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e5ee35c22a43a56fa0d287cbc244c9bce2edf393 | 6,116 | py | Python | venv/lib/python3.7/site-packages/serial/abc/model.py | FilipKatulski/Data_logger | ba2671c310cd0529e30ef73c99963564953beb64 | [
"MIT"
] | 16 | 2020-09-20T22:32:54.000Z | 2021-04-02T17:14:25.000Z | Venv-IDE/Lib/site-packages/serial/abc/model.py | myhumankit/Blind_IDE | 5262a5dd106f3f52a374a6c1ef68ff53d8847001 | [
"MIT"
] | 9 | 2022-02-21T11:44:01.000Z | 2022-03-14T15:36:08.000Z | Venv-IDE/Lib/site-packages/serial/abc/model.py | myhumankit/Blind_IDE | 5262a5dd106f3f52a374a6c1ef68ff53d8847001 | [
"MIT"
] | 1 | 2022-02-21T03:09:29.000Z | 2022-02-21T03:09:29.000Z | # Tell the linters what's up:
# pylint:disable=wrong-import-position,consider-using-enumerate,useless-object-inheritance
# mccabe:options:max-complexity=999
from __future__ import nested_scopes, generators, division, absolute_import, with_statement, \
print_function, unicode_literals
from serial.utilities.compatibility import backport
backport()
from abc import ABCMeta, abstractmethod
# We need ABCs to inherit from `ABC` in python 3x, but in python 2x ABC is absent and we need classes to inherit from
# `object` in order to be new-style classes
try:
from abc import ABC
except ImportError:
ABC = object
from ..utilities import collections
class Model(ABC):
__metaclass__ = ABCMeta
_format = None # type: Optional[str]
_meta = None # type: Optional[meta.Object]
_hooks = None # type: Optional[hooks.Object]
@abstractmethod
def __init__(self):
self._format = None # type: Optional[str]
self._meta = None # type: Optional[meta.Meta]
self._hooks = None # type: Optional[hooks.Hooks]
self._url = None # type: Optional[str]
self._xpath = None # type: Optional[str]
self._pointer = None # type: Optional[str]
@classmethod
def __subclasscheck__(cls, subclass):
# type: (object) -> bool
"""
Check a subclass to ensure it has required properties
"""
if cls is subclass or type.__subclasscheck__(cls, subclass):
return True
for attribute in (
'_format',
'_meta',
'_hooks'
):
if not hasattr(subclass, attribute):
return False
return True
def __instancecheck__(self, instance):
# type: (object) -> bool
"""
Check an instance of a subclass to ensure it has required properties
"""
for attribute in (
'_format',
'_meta',
'_hooks',
'_url',
'_xpath',
'_pointer'
):
if not hasattr(self, attribute):
return False
# Perform any instance checks needed for our superclass(es)
try:
return super().__instancecheck__(instance)
except AttributeError: # There is no further instance-checking to perform
return True
@abstractmethod
def _marshal(self):
# type: (...) -> Union[collections.OrderedDict, list]
pass
@abstractmethod
def _validate(self, raise_errors=True):
# type: (bool) -> None
pass
@abstractmethod
def __str__(self):
# type: (...) -> str
pass
@abstractmethod
def __repr__(self):
# type: (...) -> str
pass
@abstractmethod
def __copy__(self):
# type: (...) -> Object
pass
@abstractmethod
def __deepcopy__(self, memo):
# type: (Optional[dict]) -> Object
pass
@abstractmethod
def __eq__(self, other):
# type: (Any) -> bool
pass
@abstractmethod
def __ne__(self, other):
# type: (Any) -> bool
pass
class Object(Model):
@abstractmethod
def _marshal(self):
# type: (...) -> collections.OrderedDict
pass
@abstractmethod
def __setitem__(self, key, value):
# type: (str, Any) -> None
pass
@abstractmethod
def __getitem__(self, key):
# type: (str, Any) -> None
pass
@abstractmethod
def __setattr__(self, property_name, value):
# type: (Object, str, Any) -> None
pass
@abstractmethod
def __getattr__(self, key):
# type: (str) -> Any
pass
@abstractmethod
def __delattr__(self, key):
# type: (str) -> None
pass
class Dictionary(Model):
@classmethod
def __subclasscheck__(cls, subclass):
# type: (object) -> bool
"""
Verify inheritance
"""
if cls is subclass or type.__subclasscheck__(cls, subclass):
return True
if not issubclass(subclass, collections.OrderedDict):
return False
# Perform any subclass checks needed for our superclass(es)
return super().__subclasscheck__(subclass)
def __instancecheck__(self, instance):
# type: (object) -> bool
"""
Check an instance of a subclass to ensure it has required properties
"""
if not isinstance(self, collections.OrderedDict):
return False
# Perform any instance checks needed for our superclass(es)
return super().__instancecheck__(instance)
@abstractmethod
def _marshal(self):
# type: (...) -> collections.OrderedDict
pass
@abstractmethod
def __setitem__(self, key, value):
# type: (str, Any) -> None
pass
def keys(self):
# type: (...) -> Iterable[str]
pass
def values(self):
# type: (...) -> Iterable[Any]
pass
class Array(Model):
@classmethod
def __subclasscheck__(cls, subclass):
# type: (object) -> bool
"""
Verify inheritance
"""
if cls is subclass or type.__subclasscheck__(cls, subclass):
return True
if not issubclass(subclass, list):
return False
# Perform any subclass checks needed for our superclass(es)
return super().__subclasscheck__(subclass)
def __instancecheck__(self, instance):
# type: (object) -> bool
"""
Check an instance of a subclass to ensure it has required properties
"""
if not isinstance(self, list):
return False
# Perform any instance checks needed for our superclass(es)
return super().__instancecheck__(instance)
@abstractmethod
def _marshal(self):
# type: (...) -> list
pass
@abstractmethod
def __setitem__(self, key, value):
# type: (str, Any) -> None
pass
@abstractmethod
def append(self, value):
# type: (Any) -> None
pass
| 24.366534 | 117 | 0.58257 | 623 | 6,116 | 5.478331 | 0.243981 | 0.099619 | 0.092294 | 0.027835 | 0.615587 | 0.538236 | 0.466452 | 0.456197 | 0.440961 | 0.429241 | 0 | 0.001201 | 0.319163 | 6,116 | 250 | 118 | 24.464 | 0.818444 | 0.302485 | 0 | 0.632353 | 0 | 0 | 0.013239 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.205882 | false | 0.154412 | 0.044118 | 0 | 0.426471 | 0.007353 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e5f539368a2eb5b83773d57c8670e7ecf1a4bf60 | 611 | py | Python | backend/appengine/routes/updown/upload.py | MarcosVn/turinginformatica | 21eba5f105ad052aa7505b6e77ca5871167a9dc2 | [
"MIT"
] | null | null | null | backend/appengine/routes/updown/upload.py | MarcosVn/turinginformatica | 21eba5f105ad052aa7505b6e77ca5871167a9dc2 | [
"MIT"
] | null | null | null | backend/appengine/routes/updown/upload.py | MarcosVn/turinginformatica | 21eba5f105ad052aa7505b6e77ca5871167a9dc2 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from blob_app import blob_facade
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_required
from tekton import router
from routes import updown
from tekton.gae.middleware.redirect import RedirectResponse
__author__ = 'marcos'
@no_csrf
@login_required
def index(_handler, _logged_user, files):
blob_infos = _handler.get_uploads("files[]")
cmd = blob_facade.save_blob_files_cmd(blob_infos, _logged_user)
cmd.execute()
path = router.to_path(updown)
return RedirectResponse(path)
| 30.55 | 67 | 0.795417 | 82 | 611 | 5.560976 | 0.536585 | 0.04386 | 0.052632 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001876 | 0.12766 | 611 | 19 | 68 | 32.157895 | 0.853659 | 0.03437 | 0 | 0 | 0 | 0 | 0.022109 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.4375 | 0 | 0.5625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e5fb6f27883fad56fd2fa4043a92756426811fe4 | 764 | py | Python | zeeguu/model/unique_code.py | alinbalutoiu/Zeeguu-Core | 348f0aa05603fb9d2b06e1f38dbf6bb9fdcaac6d | [
"MIT"
] | null | null | null | zeeguu/model/unique_code.py | alinbalutoiu/Zeeguu-Core | 348f0aa05603fb9d2b06e1f38dbf6bb9fdcaac6d | [
"MIT"
] | null | null | null | zeeguu/model/unique_code.py | alinbalutoiu/Zeeguu-Core | 348f0aa05603fb9d2b06e1f38dbf6bb9fdcaac6d | [
"MIT"
] | null | null | null | from datetime import datetime
from random import randint
import zeeguu
db = zeeguu.db
class UniqueCode(db.Model):
__table_args__ = {'mysql_collate': 'utf8_bin'}
id = db.Column(db.Integer, primary_key=True)
code = db.Column(db.String(4))
email = db.Column(db.String(255))
time = db.Column(db.DateTime)
def __init__(self, email):
self.code = randint(100,999)
self.email = email
self.time = datetime.now()
def __str__(self):
return str(self.code)
@classmethod
def last_code(cls, email):
return (cls.query.filter(cls.email == email).order_by(cls.time.desc()).first()).code
@classmethod
def all_codes_for(cls, email):
return (cls.query.filter(cls.email == email)).all() | 25.466667 | 92 | 0.650524 | 106 | 764 | 4.5 | 0.45283 | 0.067086 | 0.083857 | 0.067086 | 0.171908 | 0.171908 | 0.171908 | 0.171908 | 0.171908 | 0 | 0 | 0.018303 | 0.213351 | 764 | 30 | 93 | 25.466667 | 0.775374 | 0 | 0 | 0.090909 | 0 | 0 | 0.027451 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.136364 | 0.136364 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
f90c55edd65c59d2e637a8df070419412264400b | 396 | py | Python | check_constraints/models.py | theju/django-check-constraints | 00d14a8730d81b5c185f0fb8726aed737b2d09e3 | [
"BSD-3-Clause"
] | 4 | 2015-05-24T11:03:39.000Z | 2018-05-29T14:59:38.000Z | check_constraints/models.py | theju/django-check-constraints | 00d14a8730d81b5c185f0fb8726aed737b2d09e3 | [
"BSD-3-Clause"
] | null | null | null | check_constraints/models.py | theju/django-check-constraints | 00d14a8730d81b5c185f0fb8726aed737b2d09e3 | [
"BSD-3-Clause"
] | null | null | null | # Dummy models.py file to allow for tests to run
from django.db import models
class CCTestModel(models.Model):
name = models.CharField(max_length=10)
age = models.IntegerField()
gender = models.CharField(max_length=10)
price = models.PositiveIntegerField()
discount = models.PositiveIntegerField()
mfg_date = models.DateField()
class Meta:
constraints = ()
| 28.285714 | 48 | 0.709596 | 47 | 396 | 5.914894 | 0.680851 | 0.107914 | 0.129496 | 0.172662 | 0.18705 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012579 | 0.19697 | 396 | 13 | 49 | 30.461538 | 0.861635 | 0.116162 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.1 | 0 | 0.9 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f90e70fd998d893d634423a38b52bc2672fbfe72 | 2,673 | py | Python | pysnmp/CISCO-DOT11-HT-PHY-CAPABILITY.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/CISCO-DOT11-HT-PHY-CAPABILITY.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/CISCO-DOT11-HT-PHY-CAPABILITY.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module CISCO-DOT11-HT-PHY-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-HT-PHY-CAPABILITY
# Produced by pysmi-0.3.4 at Mon Apr 29 17:38:23 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint")
ciscoAgentCapability, = mibBuilder.importSymbols("CISCO-SMI", "ciscoAgentCapability")
NotificationGroup, AgentCapabilities, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "AgentCapabilities", "ModuleCompliance")
MibScalar, MibTable, MibTableRow, MibTableColumn, iso, TimeTicks, Counter32, Unsigned32, MibIdentifier, Integer32, IpAddress, Counter64, Bits, NotificationType, ModuleIdentity, ObjectIdentity, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "TimeTicks", "Counter32", "Unsigned32", "MibIdentifier", "Integer32", "IpAddress", "Counter64", "Bits", "NotificationType", "ModuleIdentity", "ObjectIdentity", "Gauge32")
DisplayString, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "TruthValue")
cDot11HtPhyCapability = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 7, 551))
cDot11HtPhyCapability.setRevisions(('2007-08-22 00:00',))
if mibBuilder.loadTexts: cDot11HtPhyCapability.setLastUpdated('200708220000Z')
if mibBuilder.loadTexts: cDot11HtPhyCapability.setOrganization('Cisco Systems, Inc.')
cDot11HtPhyCapabilityV12R0410BJA = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 551, 1))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cDot11HtPhyCapabilityV12R0410BJA = cDot11HtPhyCapabilityV12R0410BJA.setProductRelease('Cisco IOS 12.4(10b)JA for the AP1250 802.11 \n Access Points')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cDot11HtPhyCapabilityV12R0410BJA = cDot11HtPhyCapabilityV12R0410BJA.setStatus('current')
mibBuilder.exportSymbols("CISCO-DOT11-HT-PHY-CAPABILITY", cDot11HtPhyCapabilityV12R0410BJA=cDot11HtPhyCapabilityV12R0410BJA, PYSNMP_MODULE_ID=cDot11HtPhyCapability, cDot11HtPhyCapability=cDot11HtPhyCapability)
| 106.92 | 477 | 0.786008 | 262 | 2,673 | 8.01145 | 0.48855 | 0.076703 | 0.017151 | 0.021439 | 0.392091 | 0.26203 | 0.26203 | 0.26203 | 0.26203 | 0.251548 | 0 | 0.089162 | 0.085297 | 2,673 | 24 | 478 | 111.375 | 0.769325 | 0.131687 | 0 | 0.117647 | 0 | 0 | 0.293253 | 0.031574 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.411765 | 0 | 0.411765 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
f9166ae3ab242b4578d13196560ebd0e119e6810 | 292 | py | Python | config/urls.py | Gabospa/MelodyRest | 16ccfc40ecd218bc4d7bc6d71542ad6af0951c25 | [
"MIT"
] | null | null | null | config/urls.py | Gabospa/MelodyRest | 16ccfc40ecd218bc4d7bc6d71542ad6af0951c25 | [
"MIT"
] | null | null | null | config/urls.py | Gabospa/MelodyRest | 16ccfc40ecd218bc4d7bc6d71542ad6af0951c25 | [
"MIT"
] | null | null | null | from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
urlpatterns = [
# Django Admin
path(settings.ADMIN_URL, admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
| 26.545455 | 65 | 0.773973 | 41 | 292 | 5.414634 | 0.390244 | 0.18018 | 0.126126 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143836 | 292 | 10 | 66 | 29.2 | 0.888 | 0.041096 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.571429 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f9299d570ebf1103970f4bef7454568557c9e8e7 | 4,742 | py | Python | test/test_fields_similarity.py | deeplook/xyz-qgis-plugin | 37b7d84992155fe35d9578b58c9d74a198eccb40 | [
"MIT"
] | 1 | 2021-01-18T18:03:04.000Z | 2021-01-18T18:03:04.000Z | test/test_fields_similarity.py | deeplook/xyz-qgis-plugin | 37b7d84992155fe35d9578b58c9d74a198eccb40 | [
"MIT"
] | null | null | null | test/test_fields_similarity.py | deeplook/xyz-qgis-plugin | 37b7d84992155fe35d9578b58c9d74a198eccb40 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (c) 2019 HERE Europe B.V.
#
# SPDX-License-Identifier: MIT
#
###############################################################################
import json
import random
import numpy as np
from test.utils import (BaseTestAsync, format_long_args)
from qgis.core import QgsFields
from qgis.testing import unittest
from XYZHubConnector.xyz_qgis.layer import parser
# import unittest
# class TestParser(BaseTestAsync, unittest.TestCase):
class TestFieldsSimilarity(BaseTestAsync):
def _similarity_of_fields_names_and_props_keys(self, fields_names, props_keys):
props = dict((v, k) for k, v in enumerate(props_keys))
# from parser.prepare_fields
orig_props_names = [k for k, v in props.items()
if v is not None]
parser.rename_special_props(props) # rename fid in props
props_names = [k for k, v in props.items()
if v is not None]
return parser.fields_similarity(fields_names, orig_props_names, props_names)
def subtest_similarity_score(self, fields_names, props_keys, expected):
with self.subTest(fields_names=fields_names,props_keys=props_keys):
score = self._similarity_of_fields_names_and_props_keys(fields_names, props_keys)
self._log_debug("score", score)
self.assertEqual(score, expected)
return score
def test_simple(self):
fid = parser.QGS_ID
xid = parser.QGS_XYZ_ID
xyz_special_key = "@ns:com:here:xyz"
score = self.subtest_similarity_score([fid, "a", "b"], ["a", "b"], 1)
score = self.subtest_similarity_score([fid,"a"], ["a","b"], 1)
score = self.subtest_similarity_score([fid,"a"], ["b"], 0)
score = self.subtest_similarity_score([fid,"a","c"], ["a","b"], 0.5)
score = self.subtest_similarity_score([fid, xyz_special_key,"a","b","c"],
[xyz_special_key,"a"], 1)
def test_empty(self):
fid = parser.QGS_ID
xid = parser.QGS_XYZ_ID
xyz_special_key = "@ns:com:here:xyz"
# empty fields, shall returns merge fields (score 1)
score = self.subtest_similarity_score([fid], [], 1)
score = self.subtest_similarity_score([], [], 1)
score = self.subtest_similarity_score([xyz_special_key], [], 1)
score = self.subtest_similarity_score([xyz_special_key], [xyz_special_key], 1)
score = self.subtest_similarity_score([fid, xyz_special_key], [], 1)
score = self.subtest_similarity_score([fid, xyz_special_key], [xyz_special_key], 1)
score = self.subtest_similarity_score([fid], [], 1)
score = self.subtest_similarity_score([fid], [xyz_special_key], 1)
def test_empty_variant_1(self):
fid = parser.QGS_ID
xid = parser.QGS_XYZ_ID
xyz_special_key = "@ns:com:here:xyz"
# variant 1: empty props will be merged to any fields
# empty fields will be merged with any props
score = self.subtest_similarity_score([fid], ["a"], 1)
score = self.subtest_similarity_score([fid,"a"], [], 1)
score = self.subtest_similarity_score([fid,xyz_special_key], ["a",xyz_special_key], 1)
score = self.subtest_similarity_score([fid], [fid], 1)
score = self.subtest_similarity_score([fid, xyz_special_key], [fid], 1)
def test_empty_variant_2(self):
fid = parser.QGS_ID
xid = parser.QGS_XYZ_ID
xyz_special_key = "@ns:com:here:xyz"
# variant 2: empty props will be merged to empty fields only
# empty fields is reserved for empty props only
# non-empty, shall returns new fields (score 0)
score = self.subtest_similarity_score([fid], ["a"], 0)
score = self.subtest_similarity_score([fid,"a"], [], 0)
score = self.subtest_similarity_score([fid,xyz_special_key], ["a",xyz_special_key], 0)
score = self.subtest_similarity_score([fid], [fid], 0)
score = self.subtest_similarity_score([fid, xyz_special_key], [fid], 0)
def test_complex(self):
feat_json = dict(properties=dict(a=1,b=2))
lst_fields = list()
# prepare_fields
if __name__ == "__main__":
# unittest.main()
tests = [
"TestFieldsSimilarity.test_simple",
"TestFieldsSimilarity.test_empty",
# "TestFieldsSimilarity.test_empty_variant_1",
"TestFieldsSimilarity.test_empty_variant_2",
]
# unittest.main(defaultTest = tests, failfast=True) # will not run all subtest
unittest.main(defaultTest = tests)
| 43.907407 | 96 | 0.621046 | 602 | 4,742 | 4.614618 | 0.184385 | 0.084233 | 0.190065 | 0.215263 | 0.571274 | 0.526278 | 0.508999 | 0.468323 | 0.442045 | 0.414327 | 0 | 0.01072 | 0.232813 | 4,742 | 107 | 97 | 44.317757 | 0.752886 | 0.137073 | 0 | 0.222222 | 0 | 0 | 0.053614 | 0.027332 | 0 | 0 | 0 | 0 | 0.013889 | 1 | 0.097222 | false | 0 | 0.097222 | 0 | 0.236111 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
006c0ec55039732f9903611910928b9edfe681b6 | 1,231 | py | Python | python-backend/app/api/permits/namespace/permits.py | MaxWardle/mds | 15d8405e6e95af98da9588f353c5d6692d1aa3d6 | [
"Apache-2.0"
] | null | null | null | python-backend/app/api/permits/namespace/permits.py | MaxWardle/mds | 15d8405e6e95af98da9588f353c5d6692d1aa3d6 | [
"Apache-2.0"
] | null | null | null | python-backend/app/api/permits/namespace/permits.py | MaxWardle/mds | 15d8405e6e95af98da9588f353c5d6692d1aa3d6 | [
"Apache-2.0"
] | null | null | null | from flask_restplus import Namespace
from ..permit.resources.permit import PermitResource
from ..permit.resources.permit_status_code import PermitStatusCodeResource
from ..permit_amendment.resources.permit_amendment import PermitAmendmentResource
from ..permit_amendment.resources.permit_amendment_document import PermitAmendmentDocumentResource
api = Namespace('permits', description='Permit related operations')
api.add_resource(PermitResource, '', '/<string:permit_guid>')
api.add_resource(PermitStatusCodeResource, '/status-codes')
api.add_resource(PermitAmendmentResource, '/<string:permit_guid>/amendments',
'/amendments/<string:permit_amendment_guid>',
'/<string:permit_guid>/amendments/<string:permit_amendment_guid>')
api.add_resource(
PermitAmendmentDocumentResource,
'/amendments/documents',
'/amendments/documents/<string:document_guid>',
'/amendments/<string:permit_amendment_guid>/documents',
'/amendments/<string:permit_amendment_guid>/documents/<string:document_guid>',
'/<string:permit_guid>/amendments/<string:permit_amendment_guid>/documents/<string:document_guid>',
'/<string:permit_guid>/amendments/<string:permit_amendment_guid>/documents',
)
| 49.24 | 103 | 0.791227 | 124 | 1,231 | 7.596774 | 0.217742 | 0.140127 | 0.140127 | 0.197452 | 0.44586 | 0.412951 | 0.321656 | 0.270701 | 0.270701 | 0.212314 | 0 | 0 | 0.089358 | 1,231 | 24 | 104 | 51.291667 | 0.840321 | 0 | 0 | 0 | 0 | 0 | 0.458164 | 0.421608 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
006f1456b747e27404c20f0ca8de6c6d837721e0 | 988 | py | Python | tests/test_general_log_parser.py | minhhh/general-log-parser | a1a977ce8928d3b482bb26c86ccc0bd1b7a3b029 | [
"MIT"
] | 4 | 2016-07-19T09:55:43.000Z | 2019-06-17T08:50:49.000Z | tests/test_general_log_parser.py | minhhh/general-log-parser | a1a977ce8928d3b482bb26c86ccc0bd1b7a3b029 | [
"MIT"
] | null | null | null | tests/test_general_log_parser.py | minhhh/general-log-parser | a1a977ce8928d3b482bb26c86ccc0bd1b7a3b029 | [
"MIT"
] | 3 | 2017-11-07T21:56:08.000Z | 2022-01-02T07:19:23.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_general_log_parser
----------------------------------
Tests for `general_log_parser` module.
"""
import sys, os, re
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import unittest
from general_log_parser import parser
class TestGeneralLogParser(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_is_valid_date(self):
log = "a.{}.log"
file_regex = re.compile(log.replace("{}", "(\d*)"))
assert parser.is_valid_date(file_regex, "20150505", "20150510", "a.20150505.log") == True
assert parser.is_valid_date(file_regex, "20150505", "20150510", "a.20150504.log") == False
assert parser.is_valid_date(file_regex, "20150505", "20150510", "a.20140505.log") == False
def test_has_piped_input(self):
assert parser.has_piped_input() == True
if __name__ == '__main__':
unittest.main()
| 22.976744 | 98 | 0.635628 | 127 | 988 | 4.653543 | 0.440945 | 0.047377 | 0.07445 | 0.096447 | 0.248731 | 0.248731 | 0.248731 | 0.248731 | 0.248731 | 0.248731 | 0 | 0.091245 | 0.17915 | 988 | 42 | 99 | 23.52381 | 0.637485 | 0.142713 | 0 | 0.105263 | 0 | 0 | 0.137232 | 0 | 0 | 0 | 0 | 0 | 0.210526 | 1 | 0.210526 | false | 0.105263 | 0.157895 | 0 | 0.421053 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
0075427fd53576d8341ab5920f1969e2ba8b4267 | 767 | py | Python | finmodelprep/api/advanced_data.py | ignasrum/finmodelprep | 5751cb0caac2a7c866111ee6231255e523133cc9 | [
"MIT"
] | null | null | null | finmodelprep/api/advanced_data.py | ignasrum/finmodelprep | 5751cb0caac2a7c866111ee6231255e523133cc9 | [
"MIT"
] | null | null | null | finmodelprep/api/advanced_data.py | ignasrum/finmodelprep | 5751cb0caac2a7c866111ee6231255e523133cc9 | [
"MIT"
] | null | null | null | from finmodelprep.api.api import BASE_URL, download
### FINANCIAL REPORTS DATES
### ANNUAL FINANCIAL REPORTS
### QUARTERLY FINANCIAL REPORTS
def stock_peers(ticker, api_key):
URL = f"{BASE_URL}/v4/stock_peers?symbol={ticker}&apikey={api_key}"
return download(URL)
def sectors_pe_ratio(exchange, date, api_key):
URL = f"{BASE_URL}/v4/sector_price_earning_ratio?date={date}&exchange={exchange}&apikey={api_key}"
return download(URL)
def industries_pe_ratio(exchange, date, api_key):
URL = f"{BASE_URL}/v4/industry_price_earning_ratio?date={date}&exchange={exchange}&apikey={api_key}"
return download(URL)
def share_float(ticker, api_key):
URL = f"{BASE_URL}/v4/shares_float?symbol={ticker}&apikey={api_key}"
return download(URL)
| 30.68 | 104 | 0.743155 | 113 | 767 | 4.80531 | 0.309735 | 0.088398 | 0.066298 | 0.073665 | 0.657459 | 0.657459 | 0.657459 | 0.651934 | 0.40884 | 0.40884 | 0 | 0.005917 | 0.118644 | 767 | 24 | 105 | 31.958333 | 0.797337 | 0.099087 | 0 | 0.307692 | 0 | 0 | 0.436123 | 0.436123 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.076923 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
008d4da3c077c1fa4f9a7c58ffc311c3553d3f4b | 874 | py | Python | Arrays and Linked Lists/011_Pascal's-Triangle.py | parikshitsaikia1619/DSA_Mastery | bfeab4780d4de372e305c7a517abd04186af0b87 | [
"MIT"
] | null | null | null | Arrays and Linked Lists/011_Pascal's-Triangle.py | parikshitsaikia1619/DSA_Mastery | bfeab4780d4de372e305c7a517abd04186af0b87 | [
"MIT"
] | null | null | null | Arrays and Linked Lists/011_Pascal's-Triangle.py | parikshitsaikia1619/DSA_Mastery | bfeab4780d4de372e305c7a517abd04186af0b87 | [
"MIT"
] | null | null | null | #%% Imports and functions declarations
from math import factorial
def combinations(total_num: int, choosen_num: int) -> int:
"""
Returns the number of available combinations given a number of elements and the subspace selected
:param total_num: number of total elements
:param choosen_num: number of elements of the subspace
:return: number of total combinations
"""
return int(factorial(total_num)/(factorial(choosen_num)*factorial(total_num-choosen_num)))
def nth_row_pascal(num_row: int) -> list:
"""
Given the number of the row, generates the specifiy values present in this pascal triangle
:param num_row: number of row to represent
:return: pascal's triangle row
"""
row_result = []
for i in range(num_row+1):
row_result.append(combinations(num_row, i))
return row_result
#%%
nth_row_pascal(5)
| 30.137931 | 101 | 0.718535 | 125 | 874 | 4.872 | 0.376 | 0.091954 | 0.036125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002857 | 0.199085 | 874 | 28 | 102 | 31.214286 | 0.867143 | 0.501144 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
00923eccd841aa1210e5f85a21a88b04d36a5ebe | 241 | py | Python | stories/urls.py | HamdaniFatima/WorkShop | cd3f682a4d8b1abf3b03f80e96aa50ce5b48062e | [
"bzip2-1.0.6"
] | null | null | null | stories/urls.py | HamdaniFatima/WorkShop | cd3f682a4d8b1abf3b03f80e96aa50ce5b48062e | [
"bzip2-1.0.6"
] | null | null | null | stories/urls.py | HamdaniFatima/WorkShop | cd3f682a4d8b1abf3b03f80e96aa50ce5b48062e | [
"bzip2-1.0.6"
] | null | null | null | from django.urls import include, path
from .views import classroom
urlpatterns = [
path('', classroom.home, name='home'),
path('post/new/', classroom.post_new, name='post_new'),
#<int:pk>/
]
| 12.684211 | 59 | 0.564315 | 27 | 241 | 4.962963 | 0.555556 | 0.156716 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.290456 | 241 | 18 | 60 | 13.388889 | 0.783626 | 0.037344 | 0 | 0 | 0 | 0 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
00cf204de093af00e307e77319e9be66f6d8237e | 268 | py | Python | alternativa.py | FernandoCamousseigt/diagrama | 0bed2b7c43701a7da72df91a52574a4db8a0ce71 | [
"MIT"
] | null | null | null | alternativa.py | FernandoCamousseigt/diagrama | 0bed2b7c43701a7da72df91a52574a4db8a0ce71 | [
"MIT"
] | null | null | null | alternativa.py | FernandoCamousseigt/diagrama | 0bed2b7c43701a7da72df91a52574a4db8a0ce71 | [
"MIT"
] | null | null | null | class Alternativa():
def __init__(self, contenido: str, ayuda: str):
self.contenido = contenido
self.ayuda= ayuda
def mostrar_alternativa(self) -> None:
print(self.contenido)
if self.ayuda:
print(f"({self.ayuda})") | 26.8 | 51 | 0.600746 | 30 | 268 | 5.2 | 0.433333 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.276119 | 268 | 10 | 52 | 26.8 | 0.804124 | 0 | 0 | 0 | 0 | 0 | 0.052045 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.375 | 0.25 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
00cf5b12e419ea344829ed823285cf5a87468f8c | 15,125 | py | Python | protocol/dataframe_protocol.py | rgommers/dataframe-api | 52abf7adc4747524a8668422d35e40783686e40c | [
"MIT"
] | null | null | null | protocol/dataframe_protocol.py | rgommers/dataframe-api | 52abf7adc4747524a8668422d35e40783686e40c | [
"MIT"
] | null | null | null | protocol/dataframe_protocol.py | rgommers/dataframe-api | 52abf7adc4747524a8668422d35e40783686e40c | [
"MIT"
] | null | null | null | """
Specification for objects to be accessed, for the purpose of dataframe
interchange between libraries, via the ``__dataframe__`` method on a libraries'
data frame object.
For guiding requirements, see https://github.com/data-apis/dataframe-api/pull/35
Concepts in this design
-----------------------
1. A `Buffer` class. A *buffer* is a contiguous block of memory - this is the
only thing that actually maps to a 1-D array in a sense that it could be
converted to NumPy, CuPy, et al.
2. A `Column` class. A *column* has a single dtype. It can consist
of multiple *chunks*. A single chunk of a column (which may be the whole
column if ``num_chunks == 1``) is modeled as again a `Column` instance, and
contains 1 data *buffer* and (optionally) one *mask* for missing data.
3. A `DataFrame` class. A *data frame* is an ordered collection of *columns*,
which are identified with names that are unique strings. All the data
frame's rows are the same length. It can consist of multiple *chunks*. A
single chunk of a data frame is modeled as again a `DataFrame` instance.
4. A *mask* concept. A *mask* of a single-chunk column is a *buffer*.
5. A *chunk* concept. A *chunk* is a sub-dividing element that can be applied
to a *data frame* or a *column*.
Note that the only way to access these objects is through a call to
``__dataframe__`` on a data frame object. This is NOT meant as public API;
only think of instances of the different classes here to describe the API of
what is returned by a call to ``__dataframe__``. They are the concepts needed
to capture the memory layout and data access of a data frame.
Design decisions
----------------
**1. Use a separate column abstraction in addition to a dataframe interface.**
Rationales:
- This is how it works in R, Julia and Apache Arrow.
- Semantically most existing applications and users treat a column similar to a 1-D array
- We should be able to connect a column to the array data interchange mechanism(s)
Note that this does not imply a library must have such a public user-facing
abstraction (ex. ``pandas.Series``) - it can only be accessed via ``__dataframe__``.
**2. Use methods and properties on an opaque object rather than returning
hierarchical dictionaries describing memory**
This is better for implementations that may rely on, for example, lazy
computation.
**3. No row names. If a library uses row names, use a regular column for them.**
See discussion at https://github.com/wesm/dataframe-protocol/pull/1/files#r394316241
Optional row names are not a good idea, because people will assume they're present
(see cuDF experience, forced to add because pandas has them).
Requiring row names seems worse than leaving them out.
Note that row labels could be added in the future - right now there's no clear
requirements for more complex row labels that cannot be represented by a single
column. These do exist, for example Modin has has table and tree-based row
labels.
"""
class Buffer:
"""
Data in the buffer is guaranteed to be contiguous in memory.
Note that there is no dtype attribute present, a buffer can be thought of
as simply a block of memory. However, if the column that the buffer is
attached to has a dtype that's supported by DLPack and ``__dlpack__`` is
implemented, then that dtype information will be contained in the return
value from ``__dlpack__``.
This distinction is useful to support both data exchange via DLPack on a
buffer and (b) dtypes like variable-length strings which do not have a
fixed number of bytes per element.
"""
@property
def bufsize(self) -> int:
"""
Buffer size in bytes
"""
pass
@property
def ptr(self) -> int:
"""
Pointer to start of the buffer as an integer
"""
pass
def __dlpack__(self):
"""
Produce DLPack capsule (see array API standard).
Raises:
- TypeError : if the buffer contains unsupported dtypes.
- NotImplementedError : if DLPack support is not implemented
Useful to have to connect to array libraries. Support optional because
it's not completely trivial to implement for a Python-only library.
"""
raise NotImplementedError("__dlpack__")
def __dlpack_device__(self) -> Tuple[enum.IntEnum, int]:
"""
Device type and device ID for where the data in the buffer resides.
Uses device type codes matching DLPack. Enum members are::
- CPU = 1
- CUDA = 2
- CPU_PINNED = 3
- OPENCL = 4
- VULKAN = 7
- METAL = 8
- VPI = 9
- ROCM = 10
Note: must be implemented even if ``__dlpack__`` is not.
"""
pass
class Column:
"""
A column object, with only the methods and properties required by the
interchange protocol defined.
A column can contain one or more chunks. Each chunk can contain either one
or two buffers - one data buffer and (depending on null representation) it
may have a mask buffer.
TBD: Arrow has a separate "null" dtype, and has no separate mask concept.
Instead, it seems to use "children" for both columns with a bit mask,
and for nested dtypes. Unclear whether this is elegant or confusing.
This design requires checking the null representation explicitly.
The Arrow design requires checking:
1. the ARROW_FLAG_NULLABLE (for sentinel values)
2. if a column has two children, combined with one of those children
having a null dtype.
Making the mask concept explicit seems useful. One null dtype would
not be enough to cover both bit and byte masks, so that would mean
even more checking if we did it the Arrow way.
TBD: there's also the "chunk" concept here, which is implicit in Arrow as
multiple buffers per array (= column here). Semantically it may make
sense to have both: chunks were meant for example for lazy evaluation
of data which doesn't fit in memory, while multiple buffers per column
could also come from doing a selection operation on a single
contiguous buffer.
Given these concepts, one would expect chunks to be all of the same
size (say a 10,000 row dataframe could have 10 chunks of 1,000 rows),
while multiple buffers could have data-dependent lengths. Not an issue
in pandas if one column is backed by a single NumPy array, but in
Arrow it seems possible.
Are multiple chunks *and* multiple buffers per column necessary for
the purposes of this interchange protocol, or must producers either
reuse the chunk concept for this or copy the data?
Note: this Column object can only be produced by ``__dataframe__``, so
doesn't need its own version or ``__column__`` protocol.
"""
@property
def size(self) -> Optional[int]:
"""
Size of the column, in elements.
Corresponds to DataFrame.num_rows() if column is a single chunk;
equal to size of this current chunk otherwise.
"""
pass
@property
def offset(self) -> int:
"""
Offset of first element
May be > 0 if using chunks; for example for a column with N chunks of
equal size M (only the last chunk may be shorter),
``offset = n * M``, ``n = 0 .. N-1``.
"""
pass
@property
def dtype(self) -> Tuple[enum.IntEnum, int, str, str]:
"""
Dtype description as a tuple ``(kind, bit-width, format string, endianness)``
Kind :
- INT = 0
- UINT = 1
- FLOAT = 2
- BOOL = 20
- STRING = 21 # UTF-8
- DATETIME = 22
- CATEGORICAL = 23
Bit-width : the number of bits as an integer
Format string : data type description format string in Apache Arrow C
Data Interface format.
Endianness : current only native endianness (``=``) is supported
Notes:
- Kind specifiers are aligned with DLPack where possible (hence the
jump to 20, leave enough room for future extension)
- Masks must be specified as boolean with either bit width 1 (for bit
masks) or 8 (for byte masks).
- Dtype width in bits was preferred over bytes
- Endianness isn't too useful, but included now in case in the future
we need to support non-native endianness
- Went with Apache Arrow format strings over NumPy format strings
because they're more complete from a dataframe perspective
- Format strings are mostly useful for datetime specification, and
for categoricals.
- For categoricals, the format string describes the type of the
categorical in the data buffer. In case of a separate encoding of
the categorical (e.g. an integer to string mapping), this can
be derived from ``self.describe_categorical``.
- Data types not included: complex, Arrow-style null, binary, decimal,
and nested (list, struct, map, union) dtypes.
"""
pass
@property
def describe_categorical(self) -> dict[bool, bool, Optional[dict]]:
"""
If the dtype is categorical, there are two options:
- There are only values in the data buffer.
- There is a separate dictionary-style encoding for categorical values.
Raises RuntimeError if the dtype is not categorical
Content of returned dict:
- "is_ordered" : bool, whether the ordering of dictionary indices is
semantically meaningful.
- "is_dictionary" : bool, whether a dictionary-style mapping of
categorical values to other objects exists
- "mapping" : dict, Python-level only (e.g. ``{int: str}``).
None if not a dictionary-style categorical.
TBD: are there any other in-memory representations that are needed?
"""
pass
@property
def describe_null(self) -> Tuple[int, Any]:
"""
Return the missing value (or "null") representation the column dtype
uses, as a tuple ``(kind, value)``.
Kind:
- 0 : non-nullable
- 1 : NaN/NaT
- 2 : sentinel value
- 3 : bit mask
- 4 : byte mask
Value : if kind is "sentinel value", the actual value. None otherwise.
"""
pass
@property
def null_count(self) -> Optional[int]:
"""
Number of null elements, if known.
Note: Arrow uses -1 to indicate "unknown", but None seems cleaner.
"""
pass
def num_chunks(self) -> int:
"""
Return the number of chunks the column consists of.
"""
pass
def get_chunks(self, n_chunks : Optional[int] = None) -> Iterable[Column]:
"""
Return an iterator yielding the chunks.
See `DataFrame.get_chunks` for details on ``n_chunks``.
"""
pass
def get_data_buffer(self) -> Buffer:
"""
Return the buffer containing the data.
"""
pass
def get_mask(self) -> Buffer:
"""
Return the buffer containing the mask values indicating missing data.
Raises RuntimeError if null representation is not a bit or byte mask.
"""
pass
# def get_children(self) -> Iterable[Column]:
# """
# Children columns underneath the column, each object in this iterator
# must adhere to the column specification
# """
# pass
class DataFrame:
"""
A data frame class, with only the methods required by the interchange
protocol defined.
A "data frame" represents an ordered collection of named columns.
A column's "name" must be a unique string.
Columns may be accessed by name or by position.
This could be a public data frame class, or an object with the methods and
attributes defined on this DataFrame class could be returned from the
``__dataframe__`` method of a public data frame class in a library adhering
to the dataframe interchange protocol specification.
"""
def __dataframe__(self, nan_as_null : bool = False) -> dict:
"""
Produces a dictionary object following the dataframe protocol spec
``nan_as_null`` is a keyword intended for the consumer to tell the
producer to overwrite null values in the data with ``NaN`` (or ``NaT``).
It is intended for cases where the consumer does not support the bit
mask or byte mask that is the producer's native representation.
"""
self._nan_as_null = nan_as_null
return {
"dataframe": self, # DataFrame object adhering to the protocol
"version": 0 # Version number of the protocol
}
def num_columns(self) -> int:
"""
Return the number of columns in the DataFrame
"""
pass
def num_rows(self) -> Optional[int]:
# TODO: not happy with Optional, but need to flag it may be expensive
# why include it if it may be None - what do we expect consumers
# to do here?
"""
Return the number of rows in the DataFrame, if available
"""
pass
def num_chunks(self) -> int:
"""
Return the number of chunks the DataFrame consists of
"""
pass
def column_names(self) -> Iterable[str]:
"""
Return an iterator yielding the column names.
"""
pass
def get_column(self, i: int) -> Column:
"""
Return the column at the indicated position.
"""
pass
def get_column_by_name(self, name: str) -> Column:
"""
Return the column whose name is the indicated name.
"""
pass
def get_columns(self) -> Iterable[Column]:
"""
Return an iterator yielding the columns.
"""
pass
def select_columns(self, indices: Sequence[int]) -> DataFrame:
"""
Create a new DataFrame by selecting a subset of columns by index
"""
pass
def select_columns_by_name(self, names: Sequence[str]) -> DataFrame:
"""
Create a new DataFrame by selecting a subset of columns by name.
"""
pass
def get_chunks(self, n_chunks : Optional[int] = None) -> Iterable[DataFrame]:
"""
Return an iterator yielding the chunks.
By default (None), yields the chunks that the data is stored as by the
producer. If given, ``n_chunks`` must be a multiple of
``self.num_chunks()``, meaning the producer must subdivide each chunk
before yielding it.
"""
pass
| 35.926366 | 89 | 0.633851 | 2,058 | 15,125 | 4.608358 | 0.249271 | 0.011071 | 0.008435 | 0.00717 | 0.090679 | 0.07286 | 0.066217 | 0.041965 | 0.041965 | 0.041965 | 0 | 0.006785 | 0.298446 | 15,125 | 420 | 90 | 36.011905 | 0.887004 | 0.760992 | 0 | 0.507692 | 0 | 0 | 0.012116 | 0 | 0 | 0 | 0 | 0.002381 | 0 | 1 | 0.384615 | false | 0.353846 | 0 | 0 | 0.446154 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
00d618caa72b2106fba1cbd1c1143ab9426859bc | 252 | py | Python | Job.py | Wally869/SimEconomica_Python | 2aa049b63ce7eb8c0e1d3054fbf1eeffca0cbf20 | [
"MIT"
] | null | null | null | Job.py | Wally869/SimEconomica_Python | 2aa049b63ce7eb8c0e1d3054fbf1eeffca0cbf20 | [
"MIT"
] | null | null | null | Job.py | Wally869/SimEconomica_Python | 2aa049b63ce7eb8c0e1d3054fbf1eeffca0cbf20 | [
"MIT"
] | null | null | null |
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from Data import JOBS_RAW
@dataclass_json
@dataclass
class Job(object):
Name: str
JOBS = [Job.from_dict(JOBS_RAW[idElement]) for idElement in range(len(JOBS_RAW))]
| 16.8 | 81 | 0.789683 | 37 | 252 | 5.189189 | 0.513514 | 0.109375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138889 | 252 | 14 | 82 | 18 | 0.884793 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
00dd0309a6d0db4193e3e91c0a42254ed9590326 | 1,270 | py | Python | Projects/Online Workouts/w3resource/Basic - Part-I/program-28.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | 1 | 2019-09-23T15:51:45.000Z | 2019-09-23T15:51:45.000Z | Projects/Online Workouts/w3resource/Basic - Part-I/program-28.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | 5 | 2021-02-08T20:47:19.000Z | 2022-03-12T00:35:44.000Z | Projects/Online Workouts/w3resource/Basic - Part-I/program-28.py | ivenpoker/Python-Projects | 2975e1bd687ec8dbcc7a4842c13466cb86292679 | [
"MIT"
] | null | null | null | # !/usr/bin/env python3
#############################################################################
# #
# Program purpose: Prints even numbers in list before an exception. #
# The exception being inclusive. #
# Program Author : Happi Yvan <ivensteinpoker@gmail.com> #
# Creation Date : July 17, 2019 #
# #
#############################################################################
# URL: https://www.w3resource.com/python-exercises/python-basic-exercises.php
def print_even(num, exc):
for x in num:
if int(x) % 2 == 0 and x != exc:
print(f"{x} ")
elif x == exc:
print(f"{x} ")
break
if __name__ == "__main__":
numbers = [
386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345,
399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217,
815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717,
958, 743, 527]
print_even(numbers, 237)
| 43.793103 | 88 | 0.385827 | 128 | 1,270 | 3.75 | 0.804688 | 0.045833 | 0.0375 | 0.041667 | 0.045833 | 0 | 0 | 0 | 0 | 0 | 0 | 0.211886 | 0.390551 | 1,270 | 28 | 89 | 45.357143 | 0.408269 | 0.431496 | 0 | 0.142857 | 0 | 0 | 0.028933 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0 | 0 | 0.071429 | 0.285714 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
00e41e228fd825b9691f4055b2f51d4b4fd62eb2 | 3,478 | py | Python | services/http.py | funkypenguin/docker.mqttwarn | 10e23b44ccacb57e38bdb304c8b6cc257c312488 | [
"MIT"
] | null | null | null | services/http.py | funkypenguin/docker.mqttwarn | 10e23b44ccacb57e38bdb304c8b6cc257c312488 | [
"MIT"
] | null | null | null | services/http.py | funkypenguin/docker.mqttwarn | 10e23b44ccacb57e38bdb304c8b6cc257c312488 | [
"MIT"
] | 1 | 2018-09-22T22:29:46.000Z | 2018-09-22T22:29:46.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jan-Piet Mens <jpmens()gmail.com>'
__copyright__ = 'Copyright 2014 Ben Jones'
__license__ = """Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)"""
import urllib
import urllib2
import base64
try:
import json
except ImportError:
import simplejson as json
def plugin(srv, item):
''' addrs: (method, url, dict(params), list(username, password), json) '''
srv.logging.debug("*** MODULE=%s: service=%s, target=%s", __file__, item.service, item.target)
method = item.addrs[0]
url = item.addrs[1]
params = item.addrs[2]
timeout = item.config.get('timeout', 60)
auth = None
try:
username, password = item.addrs[3]
auth = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
except:
pass
tojson = None
try:
tojson = item.addrs[4]
except:
pass
# Try and transform the URL. Use original URL if it's not possible
try:
url = url.format(**item.data)
except:
pass
if params is not None:
for key in params.keys():
# { 'q' : '@message' }
# Quoted field, starts with '@'. Do not use .format, instead grab
# the item's [message] and inject as parameter value.
if params[key].startswith('@'): # "@message"
params[key] = item.get(params[key][1:], "NOP")
else:
try:
params[key] = params[key].format(**item.data).encode('utf-8')
except Exception, e:
srv.logging.debug("Parameter %s cannot be formatted: %s" % (key, str(e)))
return False
message = item.message
if method.upper() == 'GET':
try:
if params is not None:
resource = url
if not resource.endswith('?'):
resource = resource + '?'
resource = resource + urllib.urlencode(params)
else:
resource = url
request = urllib2.Request(resource)
request.add_header('User-agent', srv.SCRIPTNAME)
if auth is not None:
request.add_header("Authorization", "Basic %s" % auth)
resp = urllib2.urlopen(request, timeout=timeout)
data = resp.read()
except Exception, e:
srv.logging.warn("Cannot GET %s: %s" % (resource, str(e)))
return False
return True
if method.upper() == 'POST':
try:
request = urllib2.Request(url)
if params is not None:
if tojson is not None:
encoded_params = json.dumps(params)
else:
encoded_params = urllib.urlencode(params)
else:
encoded_params = message
request.add_data(encoded_params)
request.add_header('User-agent', srv.SCRIPTNAME)
if auth is not None:
request.add_header("Authorization", "Basic %s" % auth)
resp = urllib2.urlopen(request, timeout=timeout)
data = resp.read()
# print "POST returns ", data
except Exception, e:
srv.logging.warn("Cannot POST %s: %s" % (url, str(e)))
return False
return True
srv.logging.warn("Unsupported HTTP method: %s" % (method))
return False
| 30.778761 | 98 | 0.538528 | 392 | 3,478 | 4.714286 | 0.34949 | 0.029221 | 0.029221 | 0.021104 | 0.262446 | 0.220779 | 0.193723 | 0.154762 | 0.154762 | 0.154762 | 0 | 0.01176 | 0.33985 | 3,478 | 112 | 99 | 31.053571 | 0.793118 | 0.081369 | 0 | 0.493976 | 0 | 0.012048 | 0.115323 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.060241 | 0.072289 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
00e51eb021fecec80bd86b82e0271f8a18ec82a1 | 357 | py | Python | module07-exceptions.and.files/read-employees.py | deepcloudlabs/dcl160-2021-jul-05 | 0162afb24a5b89633531dbb1c195898d5066077a | [
"MIT"
] | null | null | null | module07-exceptions.and.files/read-employees.py | deepcloudlabs/dcl160-2021-jul-05 | 0162afb24a5b89633531dbb1c195898d5066077a | [
"MIT"
] | null | null | null | module07-exceptions.and.files/read-employees.py | deepcloudlabs/dcl160-2021-jul-05 | 0162afb24a5b89633531dbb1c195898d5066077a | [
"MIT"
] | null | null | null | employees = []
with open("employees.txt", mode="r") as myfile:
for line in myfile:
employee = line.strip().split(",")
full_name, salary, birth_year, department, full_time = employee
employees.append((full_name, float(salary), int(birth_year),
department, full_time == "FULL_TIME"))
print(employees)
| 39.666667 | 71 | 0.619048 | 42 | 357 | 5.095238 | 0.595238 | 0.11215 | 0.17757 | 0.214953 | 0.252336 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.246499 | 357 | 8 | 72 | 44.625 | 0.795539 | 0 | 0 | 0 | 0 | 0 | 0.067227 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
00f051bd124f85c580e08382c9f2d3c1c342293d | 488 | py | Python | src/util/request.py | kristianhuang/finance-watcher | fc4467bcf4fa81fda69e1605329b1771e7433744 | [
"MIT"
] | null | null | null | src/util/request.py | kristianhuang/finance-watcher | fc4467bcf4fa81fda69e1605329b1771e7433744 | [
"MIT"
] | null | null | null | src/util/request.py | kristianhuang/finance-watcher | fc4467bcf4fa81fda69e1605329b1771e7433744 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File: request.py
@Desc: None
"""
import requests
def __genericHeader():
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36"
}
return headers
def fetchData(url: str):
"""send request.
:param url: request url
:return: reps body
"""
return requests.get(url=url, headers=__genericHeader()).text
| 18.769231 | 144 | 0.637295 | 67 | 488 | 4.552239 | 0.761194 | 0.032787 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069588 | 0.204918 | 488 | 25 | 145 | 19.52 | 0.716495 | 0.270492 | 0 | 0 | 0 | 0.125 | 0.395137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
00f16f43dee3884b5c0199a4ccc83997143f50ea | 160 | py | Python | main.py | dotmodusgeorge/file_splitter | 3f4b5b99cc179c2bd1e263664edea1b4b94ba584 | [
"Apache-2.0"
] | null | null | null | main.py | dotmodusgeorge/file_splitter | 3f4b5b99cc179c2bd1e263664edea1b4b94ba584 | [
"Apache-2.0"
] | null | null | null | main.py | dotmodusgeorge/file_splitter | 3f4b5b99cc179c2bd1e263664edea1b4b94ba584 | [
"Apache-2.0"
] | null | null | null | import sys
from splitter import file_generator
def main():
files = sys.argv
files.pop(0)
for file in files:
file_generator(file)
main()
| 12.307692 | 35 | 0.65625 | 23 | 160 | 4.478261 | 0.608696 | 0.252427 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008475 | 0.2625 | 160 | 12 | 36 | 13.333333 | 0.864407 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
da96db3fd2589846f9105e066ce61aadee370d02 | 1,592 | py | Python | inqbus/rpi/widgets/interfaces/widgets.py | Inqbus/rpi_widgets | 19df6c2fdc91be8c86e9f4bd4519771a4240a8a5 | [
"MIT"
] | null | null | null | inqbus/rpi/widgets/interfaces/widgets.py | Inqbus/rpi_widgets | 19df6c2fdc91be8c86e9f4bd4519771a4240a8a5 | [
"MIT"
] | null | null | null | inqbus/rpi/widgets/interfaces/widgets.py | Inqbus/rpi_widgets | 19df6c2fdc91be8c86e9f4bd4519771a4240a8a5 | [
"MIT"
] | null | null | null | from zope.interface import Interface, Attribute
class IWidget(Interface):
content = Attribute('Content of widget')
pos_x = Attribute('X position of widget')
pos_y = Attribute('Y position of widget')
width = Attribute('Width of widget')
height = Attribute('Height of widget')
parent = Attribute('Parent widget')
content_length = Attribute(
'Length of the content e.g. number of select item')
prev_widget = Attribute('Previous sibling widget')
next_widget = Attribute('Next sibling widget')
controller = Attribute('Controller for the widget')
has_focus = Attribute('is the widget focussed')
def get_prev_sibling(self, widget):
"""Get from the parent widget the previous sibling"""
def get_next_sibling(self, widget):
"""Get from the parent widget the following sibling"""
def render(self, pos_x=None, pos_y=None):
"""Render the widget"""
def handle_new_content(self, value):
"""Handle the addition of new content"""
def init(self):
"""Initialize"""
pass
def aquire_focus(self):
"""We got the focus"""
def release_focus(self):
"""We lost the focus"""
class ILineWidget(IWidget):
pass
class ITextWidget(IWidget):
pass
class IButtonWidget(ILineWidget):
pass
class ICheckboxWidget(IButtonWidget):
pass
class IGaugeWidget(ILineWidget):
pass
class IGaugeTargetWidget(ILineWidget):
pass
class ILinesWidget(IWidget):
pass
class ISelectWidget(IWidget):
pass
class IPageWidget(IWidget):
pass
| 20.947368 | 63 | 0.670854 | 189 | 1,592 | 5.566138 | 0.322751 | 0.068441 | 0.060837 | 0.038023 | 0.079848 | 0.079848 | 0.079848 | 0.079848 | 0.079848 | 0 | 0 | 0 | 0.229271 | 1,592 | 75 | 64 | 21.226667 | 0.857376 | 0.122487 | 0 | 0.25 | 0 | 0 | 0.174871 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.175 | false | 0.25 | 0.025 | 0 | 0.725 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
da981fbf4a75866cf8e7a063a8deb37da3cc347c | 955 | py | Python | tests/test_latest_release.py | nurupo/ci-release-publisher | cd719730b1064f249f3c3af1c8b9cf3954754845 | [
"MIT"
] | 7 | 2019-05-25T20:51:01.000Z | 2021-12-19T16:16:10.000Z | tests/test_latest_release.py | nurupo/ci-release-publisher | cd719730b1064f249f3c3af1c8b9cf3954754845 | [
"MIT"
] | 2 | 2019-06-21T07:58:11.000Z | 2020-04-08T06:23:26.000Z | tests/test_latest_release.py | nurupo/ci-release-publisher | cd719730b1064f249f3c3af1c8b9cf3954754845 | [
"MIT"
] | 1 | 2021-01-14T11:14:58.000Z | 2021-01-14T11:14:58.000Z | # -*- coding: utf-8 -*-
import pytest
from ci_release_publisher import config, latest_release
tag_name_tests = [
('branch', ['{}-branch-{}', '{}{}-branch-{}']),
('-branch-_name-', ['{}--branch-_name--{}', '{}{}--branch-_name--{}']),
]
def test_tag_name():
for branch, expected in tag_name_tests:
expect = expected[0].format(config.tag_prefix, latest_release._tag_suffix)
assert latest_release._tag_name(branch) == expect
assert latest_release._break_tag_name(expect)
assert latest_release._break_tag_name(expect)['branch'] == branch
def test_tag_name_tmp():
for branch, expected in tag_name_tests:
expect = expected[1].format(config.tag_prefix_tmp, config.tag_prefix, latest_release._tag_suffix)
assert latest_release._tag_name_tmp(branch) == expect
assert latest_release._break_tag_name_tmp(expect)
assert latest_release._break_tag_name_tmp(expect)['branch'] == branch
| 38.2 | 105 | 0.696335 | 123 | 955 | 4.98374 | 0.235772 | 0.125612 | 0.185971 | 0.163132 | 0.642741 | 0.642741 | 0.642741 | 0.642741 | 0.492659 | 0.205546 | 0 | 0.003727 | 0.157068 | 955 | 24 | 106 | 39.791667 | 0.757764 | 0.02199 | 0 | 0.111111 | 0 | 0 | 0.107296 | 0.023605 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.111111 | false | 0 | 0.111111 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
daa37bb11d554844d5cdd034db0251ea21a77e94 | 375 | py | Python | weekday.py | dm0860777682/52167-Prog-Scripting | 11170d2159d4d7b36c4b354c50eb0ae209d57b35 | [
"MIT"
] | null | null | null | weekday.py | dm0860777682/52167-Prog-Scripting | 11170d2159d4d7b36c4b354c50eb0ae209d57b35 | [
"MIT"
] | null | null | null | weekday.py | dm0860777682/52167-Prog-Scripting | 11170d2159d4d7b36c4b354c50eb0ae209d57b35 | [
"MIT"
] | null | null | null | """
Weekly task 5
Write a program that outputs whether or not today is a weekday. An example of running this program on a Thursday is given below.
$ python weekday.py
Yes, unfortunately today is a weekday.
An example of running it on a Saturday is as follows.
$ python weekday.py
It is the weekend, yay!
"""
from datetime import datetime
now = datetime.now()
print(now) | 20.833333 | 128 | 0.752 | 64 | 375 | 4.40625 | 0.609375 | 0.049645 | 0.056738 | 0.106383 | 0.234043 | 0.234043 | 0.234043 | 0.234043 | 0 | 0 | 0 | 0.003279 | 0.186667 | 375 | 18 | 129 | 20.833333 | 0.921311 | 0.808 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
daaeed9eca13002e541a080243c7573e1a1bcd53 | 334 | py | Python | startServer.py | GCETTB-HYLAND-Hackathon2012-22/Miracurol-Rebuild | a6748e93b45872efdbaca013388dd6277824a9a5 | [
"Apache-2.0"
] | null | null | null | startServer.py | GCETTB-HYLAND-Hackathon2012-22/Miracurol-Rebuild | a6748e93b45872efdbaca013388dd6277824a9a5 | [
"Apache-2.0"
] | null | null | null | startServer.py | GCETTB-HYLAND-Hackathon2012-22/Miracurol-Rebuild | a6748e93b45872efdbaca013388dd6277824a9a5 | [
"Apache-2.0"
] | null | null | null | from backend.core.config_loader import init_configs
from backend.database.migration import run_migrations
from backend.server.server import start_server
if __name__ == '__main__':
# Initialize all configurations
init_configs()
# Run Database Migration Scripts
run_migrations()
# Start Server
start_server()
| 23.857143 | 53 | 0.766467 | 40 | 334 | 6.025 | 0.525 | 0.136929 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173653 | 334 | 13 | 54 | 25.692308 | 0.873188 | 0.218563 | 0 | 0 | 0 | 0 | 0.031128 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.428571 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
dacd8dce0db3b48ffabfcf8befa1faa7f0e85d0b | 490 | py | Python | mundo3-EstruturasCompostas/107-exercitandoModulos/107.py | jonasht/CursoEmVideo-CursoDePython3 | a1bbf1fe4226b1828213742ee5a440278d903fd1 | [
"MIT"
] | null | null | null | mundo3-EstruturasCompostas/107-exercitandoModulos/107.py | jonasht/CursoEmVideo-CursoDePython3 | a1bbf1fe4226b1828213742ee5a440278d903fd1 | [
"MIT"
] | null | null | null | mundo3-EstruturasCompostas/107-exercitandoModulos/107.py | jonasht/CursoEmVideo-CursoDePython3 | a1bbf1fe4226b1828213742ee5a440278d903fd1 | [
"MIT"
] | null | null | null | # Exercício Python 107:
# Crie um módulo chamado moeda.py que
# tenha as funções incorporadas aumentar(), diminuir(), dobro() e metade().
# Faça também um programa que importe esse módulo e use algumas dessas funções.
import moeda as m
preco = float(input('digite preco: '))
print(f'a metade de R${preco} eh {m.metade(preco)}')
print(f'o dobre de R${preco} eh {m.dobro(preco)}')
print(f'aumentando 10%, eh {m.aumentar(preco, 10)}')
print(f'diminuindo 10% eh {m.diminuir(preco, 10)}')
| 28.823529 | 79 | 0.704082 | 81 | 490 | 4.259259 | 0.54321 | 0.069565 | 0.095652 | 0.057971 | 0.063768 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026316 | 0.146939 | 490 | 16 | 80 | 30.625 | 0.799043 | 0.426531 | 0 | 0 | 0 | 0 | 0.650909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.666667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
dad1a3470aa5a0e3afdfd4c98ed79490d2f27af8 | 822 | py | Python | tests/agents/turtleagent/finish.py | LaudateCorpus1/holodeck | 521c1c828f47abe7fc24b027fb907eaf26495aed | [
"MIT"
] | 518 | 2018-10-05T00:14:50.000Z | 2022-03-06T22:24:47.000Z | tests/agents/turtleagent/finish.py | LaudateCorpus1/holodeck | 521c1c828f47abe7fc24b027fb907eaf26495aed | [
"MIT"
] | 240 | 2018-10-05T04:53:18.000Z | 2021-04-29T22:21:30.000Z | tests/agents/turtleagent/finish.py | LaudateCorpus1/holodeck | 521c1c828f47abe7fc24b027fb907eaf26495aed | [
"MIT"
] | 36 | 2018-10-05T07:09:58.000Z | 2022-03-09T12:32:44.000Z | """
Script that will navigate the "maze" in testworld
"""
def navigate(env, callback):
for _ in range(100):
callback(env.step([0, 0]))
for _ in range(11):
callback(env.step([0, -30]))
for _ in range(10):
callback(env.step([0, 0]))
for _ in range(123):
callback(env.step([80, 0]))
for _ in range(26):
callback(env.step([0, 0]))
for _ in range(10):
callback(env.step([0, 30]))
for _ in range(100):
callback(env.step([150, 0]))
for _ in range(100):
callback(env.step([0, 0]))
for _ in range(10):
callback(env.step([0, 30]))
for _ in range(7):
callback(env.step([0, 0]))
for _ in range(100):
callback(env.step([100, 0]))
for _ in range(30):
callback(env.step([0, 0]))
| 19.116279 | 49 | 0.527981 | 120 | 822 | 3.516667 | 0.2 | 0.14218 | 0.28436 | 0.341232 | 0.722749 | 0.682464 | 0.682464 | 0.63981 | 0.395735 | 0.395735 | 0 | 0.103627 | 0.29562 | 822 | 42 | 50 | 19.571429 | 0.625216 | 0.059611 | 0 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.04 | false | 0 | 0 | 0 | 0.04 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
dad2a0676316421e98c1fe9a827ffb578d3d01bc | 406 | py | Python | pytest-webdriver/tests/unit/test_webdriver.py | RaiVaibhav/pytest-plugins | b21eef7fb2d876b3910f4a476875f9f157275b49 | [
"MIT"
] | 167 | 2019-11-11T01:24:50.000Z | 2022-03-31T18:36:19.000Z | pytest-webdriver/tests/unit/test_webdriver.py | RaiVaibhav/pytest-plugins | b21eef7fb2d876b3910f4a476875f9f157275b49 | [
"MIT"
] | 58 | 2019-11-19T09:42:44.000Z | 2022-03-30T17:30:34.000Z | pytest-webdriver/tests/unit/test_webdriver.py | RaiVaibhav/pytest-plugins | b21eef7fb2d876b3910f4a476875f9f157275b49 | [
"MIT"
] | 25 | 2019-12-01T22:00:56.000Z | 2022-03-08T18:53:36.000Z | from mock import Mock, sentinel, patch
import pytest
import selenium
import pytest_webdriver
def test_browser_to_use():
caps = Mock(CHROME=sentinel.chrome, UNKNOWN=None)
wd = Mock(DesiredCapabilities = Mock(return_value = caps))
assert pytest_webdriver.browser_to_use(wd, 'chrome') == sentinel.chrome
with pytest.raises(ValueError):
pytest_webdriver.browser_to_use(wd, 'unknown') | 31.230769 | 75 | 0.758621 | 53 | 406 | 5.603774 | 0.471698 | 0.151515 | 0.121212 | 0.161616 | 0.195286 | 0.195286 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147783 | 406 | 13 | 76 | 31.230769 | 0.858382 | 0 | 0 | 0 | 0 | 0 | 0.031941 | 0 | 0 | 0 | 0 | 0 | 0.1 | 1 | 0.1 | false | 0 | 0.4 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
daece39d9273fd358dbca304476c966da56c685c | 15,374 | py | Python | openaerostruct/common/atmos_comp.py | lamkina/OpenAeroStruct | d30e2626fc1272e7fe3a27386c4c663157e958ec | [
"Apache-2.0"
] | 114 | 2017-04-06T15:24:19.000Z | 2022-03-21T09:57:43.000Z | openaerostruct/common/atmos_comp.py | lamkina/OpenAeroStruct | d30e2626fc1272e7fe3a27386c4c663157e958ec | [
"Apache-2.0"
] | 322 | 2017-04-07T01:40:03.000Z | 2022-03-17T21:50:52.000Z | openaerostruct/common/atmos_comp.py | lamkina/OpenAeroStruct | d30e2626fc1272e7fe3a27386c4c663157e958ec | [
"Apache-2.0"
] | 83 | 2017-04-06T16:53:26.000Z | 2022-03-19T19:34:05.000Z | from collections import namedtuple
import numpy as np
from scipy.interpolate import Akima1DInterpolator as Akima
import openmdao.api as om
"""United States standard atmosphere 1976 tables, data obtained from http://www.digitaldutch.com/atmoscalc/index.htm"""
USatm1976Data = namedtuple("USatm1976Data", ["alt", "T", "P", "rho", "speed_of_sound", "viscosity"])
USatm1976Data.alt = np.array(
[
-1000,
0,
1000,
2000,
3000,
4000,
5000,
6000,
7000,
8000,
9000,
10000,
11000,
12000,
13000,
14000,
15000,
16000,
17000,
18000,
19000,
20000,
21000,
22000,
23000,
24000,
25000,
26000,
27000,
28000,
29000,
30000,
31000,
32000,
33000,
34000,
35000,
36000,
37000,
38000,
39000,
40000,
41000,
42000,
43000,
44000,
45000,
46000,
47000,
48000,
49000,
50000,
51000,
52000,
53000,
54000,
55000,
56000,
57000,
58000,
59000,
60000,
61000,
62000,
63000,
64000,
65000,
66000,
67000,
68000,
69000,
70000,
71000,
72000,
73000,
74000,
75000,
76000,
77000,
78000,
79000,
80000,
81000,
82000,
83000,
84000,
85000,
86000,
87000,
88000,
89000,
90000,
91000,
92000,
93000,
94000,
95000,
96000,
97000,
98000,
99000,
100000,
105000,
110000,
115000,
120000,
125000,
130000,
135000,
140000,
145000,
150000,
]
) # units='ft'
USatm1976Data.T = np.array(
[
522.236,
518.67,
515.104,
511.538,
507.972,
504.405,
500.839,
497.273,
493.707,
490.141,
486.575,
483.008,
479.442,
475.876,
472.31,
468.744,
465.178,
461.611,
458.045,
454.479,
450.913,
447.347,
443.781,
440.214,
436.648,
433.082,
429.516,
425.95,
422.384,
418.818,
415.251,
411.685,
408.119,
404.553,
400.987,
397.421,
393.854,
390.288,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
389.97,
390.18,
390.729,
391.278,
391.826,
392.375,
392.923,
393.472,
394.021,
394.569,
395.118,
395.667,
396.215,
396.764,
397.313,
397.861,
398.41,
398.958,
399.507,
400.056,
400.604,
401.153,
401.702,
402.25,
402.799,
403.348,
403.896,
404.445,
404.994,
405.542,
406.091,
406.639,
407.188,
407.737,
408.285,
408.834,
411.59,
419.271,
426.952,
434.633,
442.314,
449.995,
457.676,
465.357,
473.038,
480.719,
]
) # units='degR'
USatm1976Data.P = np.array(
[
15.2348,
14.6959,
14.1726,
13.6644,
13.1711,
12.6923,
12.2277,
11.777,
11.3398,
10.9159,
10.5049,
10.1065,
9.7204,
9.34636,
8.98405,
8.63321,
8.29354,
7.96478,
7.64665,
7.33889,
7.4123,
6.75343,
6.47523,
6.20638,
5.94664,
5.69578,
5.45355,
5.21974,
4.9941,
4.77644,
4.56651,
4.36413,
4.16906,
3.98112,
3.8001,
3.6258,
3.45803,
3.29661,
3.14191,
2.99447,
2.85395,
2.72003,
2.59239,
2.47073,
2.35479,
2.24429,
2.13897,
2.0386,
1.94293,
1.85176,
1.76486,
1.68204,
1.60311,
1.52788,
1.45618,
1.38785,
1.32272,
1.26065,
1.20149,
1.14511,
1.09137,
1.04016,
0.991347,
0.944827,
0.900489,
0.858232,
0.817958,
0.779578,
0.743039,
0.708261,
0.675156,
0.643641,
0.613638,
0.585073,
0.557875,
0.531976,
0.507313,
0.483825,
0.461455,
0.440148,
0.419853,
0.400519,
0.382101,
0.364553,
0.347833,
0.331902,
0.31672,
0.302253,
0.288464,
0.275323,
0.262796,
0.250856,
0.239473,
0.228621,
0.218275,
0.20841,
0.199003,
0.190032,
0.181478,
0.173319,
0.165537,
0.158114,
0.12582,
0.10041,
0.08046,
0.064729,
0.0522725,
0.0423688,
0.0344637,
0.0281301,
0.0230369,
0.0189267,
]
) # units='psi'
USatm1976Data.rho = np.array(
[
0.00244752,
0.00237717,
0.00230839,
0.00224114,
0.00217539,
0.00211114,
0.00204834,
0.00198698,
0.00192704,
0.0018685,
0.00181132,
0.00175549,
0.00170099,
0.00164779,
0.00159588,
0.00154522,
0.00149581,
0.00144761,
0.00140061,
0.00135479,
0.00131012,
0.00126659,
0.00122417,
0.00118285,
0.0011426,
0.00110341,
0.00106526,
0.00102812,
0.000991984,
0.000956827,
0.000922631,
0.000889378,
0.00085705,
0.000825628,
0.000795096,
0.000765434,
0.000736627,
0.000708657,
0.000675954,
0.000644234,
0.000614002,
0.000585189,
0.000557728,
0.000531556,
0.000506612,
0.000482838,
0.00046018,
0.000438586,
0.000418004,
0.000398389,
0.000379694,
0.000361876,
0.000344894,
0.000328709,
0.000313284,
0.000298583,
0.000284571,
0.000271217,
0.00025849,
0.00024636,
0.000234799,
0.000223781,
0.000213279,
0.000203271,
0.000193732,
0.000184641,
0.000175976,
0.000167629,
0.000159548,
0.000151867,
0.000144566,
0.000137625,
0.000131026,
0.000124753,
0.000118788,
0.000113116,
0.000107722,
0.000102592,
9.77131e-05,
9.30725e-05,
8.86582e-05,
0.000084459,
8.04641e-05,
7.66632e-05,
7.30467e-05,
6.96054e-05,
6.63307e-05,
6.32142e-05,
6.02481e-05,
5.74249e-05,
5.47376e-05,
5.21794e-05,
4.97441e-05,
4.74254e-05,
4.52178e-05,
4.31158e-05,
0.000041114,
3.92078e-05,
3.73923e-05,
3.56632e-05,
3.40162e-05,
3.24473e-05,
2.56472e-05,
2.00926e-05,
1.58108e-05,
1.24948e-05,
9.9151e-06,
7.89937e-06,
6.3177e-06,
5.07154e-06,
4.08586e-06,
3.30323e-06,
]
) # units='slug/ft**3'
USatm1976Data.a = np.array(
[
1120.28,
1116.45,
1112.61,
1108.75,
1104.88,
1100.99,
1097.09,
1093.18,
1089.25,
1085.31,
1081.36,
1077.39,
1073.4,
1069.4,
1065.39,
1061.36,
1057.31,
1053.25,
1049.18,
1045.08,
1040.97,
1036.85,
1032.71,
1028.55,
1024.38,
1020.19,
1015.98,
1011.75,
1007.51,
1003.24,
998.963,
994.664,
990.347,
986.01,
981.655,
977.28,
972.885,
968.471,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.076,
968.337,
969.017,
969.698,
970.377,
971.056,
971.735,
972.413,
973.091,
973.768,
974.445,
975.121,
975.797,
976.472,
977.147,
977.822,
978.496,
979.169,
979.842,
980.515,
981.187,
981.858,
982.53,
983.2,
983.871,
984.541,
985.21,
985.879,
986.547,
987.215,
987.883,
988.55,
989.217,
989.883,
990.549,
991.214,
994.549,
1003.79,
1012.94,
1022.01,
1031,
1039.91,
1048.75,
1057.52,
1066.21,
1074.83,
]
) # units='ft/s'
USatm1976Data.viscosity = np.array(
[
3.81e-07,
3.78e-07,
3.76e-07,
3.74e-07,
3.72e-07,
3.70e-07,
3.68e-07,
3.66e-07,
3.64e-07,
3.62e-07,
3.60e-07,
3.57e-07,
3.55e-07,
3.53e-07,
3.51e-07,
3.49e-07,
3.47e-07,
3.45e-07,
3.42e-07,
3.40e-07,
3.38e-07,
3.36e-07,
3.34e-07,
3.31e-07,
3.29e-07,
3.27e-07,
3.25e-07,
3.22e-07,
3.20e-07,
3.18e-07,
3.16e-07,
3.13e-07,
3.11e-07,
3.09e-07,
3.06e-07,
3.04e-07,
3.02e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
2.99e-07,
3.00e-07,
3.00e-07,
3.00e-07,
3.01e-07,
3.01e-07,
3.01e-07,
3.02e-07,
3.02e-07,
3.03e-07,
3.03e-07,
3.03e-07,
3.04e-07,
3.04e-07,
3.04e-07,
3.05e-07,
3.05e-07,
3.05e-07,
3.06e-07,
3.06e-07,
3.06e-07,
3.07e-07,
3.07e-07,
3.08e-07,
3.08e-07,
3.08e-07,
3.09e-07,
3.09e-07,
3.09e-07,
3.10e-07,
3.10e-07,
3.10e-07,
3.11e-07,
3.11e-07,
3.11e-07,
3.13e-07,
3.18e-07,
3.23e-07,
3.28e-07,
3.33e-07,
3.37e-07,
3.42e-07,
3.47e-07,
3.51e-07,
3.56e-07,
]
) # units='lbf*s/ft**2'
T_interp = Akima(USatm1976Data.alt, USatm1976Data.T)
P_interp = Akima(USatm1976Data.alt, USatm1976Data.P)
rho_interp = Akima(USatm1976Data.alt, USatm1976Data.rho)
a_interp = Akima(USatm1976Data.alt, USatm1976Data.a)
viscosity_interp = Akima(USatm1976Data.alt, USatm1976Data.viscosity)
T_interp_deriv = T_interp.derivative(1)
P_interp_deriv = P_interp.derivative(1)
rho_interp_deriv = rho_interp.derivative(1)
a_interp_deriv = a_interp.derivative(1)
viscosity_interp_deriv = viscosity_interp.derivative(1)
class AtmosComp(om.ExplicitComponent):
def setup(self):
self.add_input("altitude", val=1.0, units="ft")
self.add_input("Mach_number", val=1.0)
self.add_output("T", val=1.0, units="degR")
self.add_output("P", val=1.0, units="psi")
self.add_output("rho", val=1.0, units="slug/ft**3")
self.add_output("speed_of_sound", val=1.0, units="ft/s")
self.add_output("mu", val=1.0, units="lbf*s/ft**2")
self.add_output("v", val=1.0, units="ft/s")
self.declare_partials(["T", "P", "rho", "speed_of_sound", "mu", "v"], "altitude")
self.declare_partials("v", "Mach_number")
def compute(self, inputs, outputs):
outputs["T"] = T_interp(inputs["altitude"])
outputs["P"] = P_interp(inputs["altitude"])
outputs["rho"] = rho_interp(inputs["altitude"])
outputs["speed_of_sound"] = a_interp(inputs["altitude"])
outputs["mu"] = viscosity_interp(inputs["altitude"])
outputs["v"] = outputs["speed_of_sound"] * inputs["Mach_number"]
def compute_partials(self, inputs, partials):
partials["T", "altitude"] = T_interp_deriv(inputs["altitude"])
partials["P", "altitude"] = P_interp_deriv(inputs["altitude"])
partials["rho", "altitude"] = rho_interp_deriv(inputs["altitude"])
partials["speed_of_sound", "altitude"] = a_interp_deriv(inputs["altitude"])
partials["mu", "altitude"] = viscosity_interp_deriv(inputs["altitude"])
partials["v", "altitude"] = a_interp_deriv(inputs["altitude"]) * inputs["Mach_number"]
partials["v", "Mach_number"] = a_interp(inputs["altitude"])
| 20.14941 | 120 | 0.404059 | 1,752 | 15,374 | 3.507991 | 0.414384 | 0.03905 | 0.030264 | 0.040351 | 0.216238 | 0.135535 | 0.118939 | 0.113407 | 0.082981 | 0.082981 | 0 | 0.526433 | 0.474633 | 15,374 | 762 | 121 | 20.175853 | 0.234493 | 0.005659 | 0 | 0.186992 | 0 | 0 | 0.027849 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.004065 | false | 0 | 0.00542 | 0 | 0.01084 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
dafc3195f965e9416fdd9f214987ea11136852c7 | 138 | py | Python | OnFlyLocalizer/OnFlyLocalizer/FilesListReader.py | dariusz-intent/OnFlyLocalizer | 97db2a1a6a8662f8e066daa70ae4502729b95627 | [
"Apache-2.0"
] | null | null | null | OnFlyLocalizer/OnFlyLocalizer/FilesListReader.py | dariusz-intent/OnFlyLocalizer | 97db2a1a6a8662f8e066daa70ae4502729b95627 | [
"Apache-2.0"
] | null | null | null | OnFlyLocalizer/OnFlyLocalizer/FilesListReader.py | dariusz-intent/OnFlyLocalizer | 97db2a1a6a8662f8e066daa70ae4502729b95627 | [
"Apache-2.0"
] | null | null | null | def read_file(path):
f = open(path, 'a+')
f.seek(0)
files = [line for line in f.readlines()]
f.close()
return files | 15.333333 | 44 | 0.557971 | 22 | 138 | 3.454545 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010101 | 0.282609 | 138 | 9 | 45 | 15.333333 | 0.757576 | 0 | 0 | 0 | 0 | 0 | 0.014388 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9700154bc4d5083a6a13aa13e07101972d79dd62 | 17,101 | py | Python | pysnmp/ELTEX-MES-BRIDGE-ERPS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/ELTEX-MES-BRIDGE-ERPS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/ELTEX-MES-BRIDGE-ERPS-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module ELTEX-MES-BRIDGE-ERPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-BRIDGE-ERPS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:46:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection")
eltMesBridgeExtMIBObjects, = mibBuilder.importSymbols("ELTEX-MES-BRIDGE-EXT-MIB", "eltMesBridgeExtMIBObjects")
VlanIdOrNone, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanIdOrNone")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
iso, NotificationType, Integer32, Counter64, MibIdentifier, TimeTicks, Counter32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, ModuleIdentity, Gauge32, Bits, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "NotificationType", "Integer32", "Counter64", "MibIdentifier", "TimeTicks", "Counter32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "ModuleIdentity", "Gauge32", "Bits", "IpAddress")
TruthValue, RowStatus, MacAddress, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "MacAddress", "TextualConvention", "DisplayString")
eltMesErpsMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1))
eltMesErpsMIB.setRevisions(('2015-11-19 00:00',))
if mibBuilder.loadTexts: eltMesErpsMIB.setLastUpdated('201511190000Z')
if mibBuilder.loadTexts: eltMesErpsMIB.setOrganization('Eltex Ltd.')
eltMesErpsCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 1))
eltMesErpsInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 2))
eltMesErpsMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3))
eltMesErpsNotify = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 4))
class EltErpsEnabledState(TextualConvention, Integer32):
reference = 'ITU-T G.8032'
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("enabled", 1), ("disabled", 2))
class EltErpsMgmtRAPSPortState(TextualConvention, Integer32):
reference = 'ITU-T G.8032'
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("fowarding", 1), ("blocking", 2), ("signal-fail", 3), ("manual-switch", 4), ("forced-switch", 5))
class EltErpsMgmtRAPSPortId(TextualConvention, Integer32):
reference = 'ITU-T G.8032'
status = 'deprecated'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("none", 1), ("west", 2), ("east", 3))
eltErpsAdminState = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 1, 1), EltErpsEnabledState().clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsAdminState.setStatus('deprecated')
eltErpsLogState = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 1, 2), EltErpsEnabledState().clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsLogState.setStatus('deprecated')
eltErpsTrapState = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 1, 3), EltErpsEnabledState().clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsTrapState.setStatus('deprecated')
eltErpsPendingAction = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("copyPendingActive", 1), ("copyActivePending", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsPendingAction.setStatus('deprecated')
eltErpsPendingActionVlan = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 1, 6), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsPendingActionVlan.setStatus('deprecated')
eltErpsGetConfigId = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("pending", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsGetConfigId.setStatus('deprecated')
eltErpsMgmtRAPSVlanTable = MibTable((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1), )
if mibBuilder.loadTexts: eltErpsMgmtRAPSVlanTable.setStatus('deprecated')
eltErpsMgmtRAPSVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1), ).setIndexNames((0, "ELTEX-MES-BRIDGE-ERPS-MIB", "eltErpsMgmtRAPSVlanId"))
if mibBuilder.loadTexts: eltErpsMgmtRAPSVlanEntry.setStatus('deprecated')
eltErpsMgmtRAPSVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltErpsMgmtRAPSVlanId.setStatus('deprecated')
eltErpsMgmtRAPSWestPort = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 65535), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSWestPort.setStatus('deprecated')
eltErpsMgmtRAPSWestPortState = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 3), EltErpsMgmtRAPSPortState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltErpsMgmtRAPSWestPortState.setStatus('deprecated')
eltErpsMgmtRAPSEastPort = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 65535), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSEastPort.setStatus('deprecated')
eltErpsMgmtRAPSEastPortState = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 5), EltErpsMgmtRAPSPortState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltErpsMgmtRAPSEastPortState.setStatus('deprecated')
eltErpsMgmtRAPSRPLPort = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 6), EltErpsMgmtRAPSPortId().clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSRPLPort.setStatus('deprecated')
eltErpsMgmtRAPSRPLOwnerAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 7), EltErpsEnabledState().clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSRPLOwnerAdminState.setStatus('deprecated')
eltErpsMgmtRAPSRingMEL = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSRingMEL.setStatus('deprecated')
eltErpsMgmtRAPSHoldOffTime = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 10000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSHoldOffTime.setStatus('deprecated')
eltErpsMgmtRAPSGuardTime = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 2000)).clone(500)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSGuardTime.setStatus('deprecated')
eltErpsMgmtRAPSWTRTime = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 12)).clone(5)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSWTRTime.setStatus('deprecated')
eltErpsMgmtRAPSRingState = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("init", 1), ("idle", 2), ("protection", 3), ("manual-switch", 4), ("forced-switch", 5), ("pending", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltErpsMgmtRAPSRingState.setStatus('deprecated')
eltErpsMgmtRAPSRingAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 13), EltErpsEnabledState().clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSRingAdminState.setStatus('deprecated')
eltErpsMgmtRAPSRPLOwnerOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2), ("disabled", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltErpsMgmtRAPSRPLOwnerOperStatus.setStatus('deprecated')
eltErpsMgmtRAPSProtectionVlanRangeList1to1024 = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 15), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSProtectionVlanRangeList1to1024.setStatus('deprecated')
eltErpsMgmtRAPSProtectionVlanRangeList1025to2048 = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 16), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSProtectionVlanRangeList1025to2048.setStatus('deprecated')
eltErpsMgmtRAPSProtectionVlanRangeList2049to3072 = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 17), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSProtectionVlanRangeList2049to3072.setStatus('deprecated')
eltErpsMgmtRAPSProtectionVlanRangeList3073to4094 = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 18), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSProtectionVlanRangeList3073to4094.setStatus('deprecated')
eltErpsMgmtRAPSRevertive = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 19), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSRevertive.setStatus('deprecated')
eltErpsMgmtRAPSProtocolVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(1, 1), ValueRangeConstraint(2, 2), )).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSProtocolVersion.setStatus('deprecated')
eltErpsMgmtRAPSPortForcedSwitch = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 21), EltErpsMgmtRAPSPortId().clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSPortForcedSwitch.setStatus('deprecated')
eltErpsMgmtRAPSPortManualSwitch = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 22), EltErpsMgmtRAPSPortId().clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtRAPSPortManualSwitch.setStatus('deprecated')
eltErpsMgmtRAPSRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 1, 1, 23), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: eltErpsMgmtRAPSRowStatus.setStatus('deprecated')
eltErpsMgmtSubRingCtrlTable = MibTable((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 2), )
if mibBuilder.loadTexts: eltErpsMgmtSubRingCtrlTable.setStatus('deprecated')
eltErpsMgmtSubRingCtrlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 2, 1), ).setIndexNames((0, "ELTEX-MES-BRIDGE-ERPS-MIB", "eltErpsMgmtSubRingCtrlRAPSVlanId"), (0, "ELTEX-MES-BRIDGE-ERPS-MIB", "eltErpsMgmtSubRingCtrlSubRingRAPSVlanId"))
if mibBuilder.loadTexts: eltErpsMgmtSubRingCtrlEntry.setStatus('deprecated')
eltErpsMgmtSubRingCtrlRAPSVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 2, 1, 1), Integer32())
if mibBuilder.loadTexts: eltErpsMgmtSubRingCtrlRAPSVlanId.setStatus('deprecated')
eltErpsMgmtSubRingCtrlSubRingRAPSVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 2, 1, 2), Integer32())
if mibBuilder.loadTexts: eltErpsMgmtSubRingCtrlSubRingRAPSVlanId.setStatus('deprecated')
eltErpsMgmtSubRingCtrlTCPropagationState = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 2, 1, 3), EltErpsEnabledState().clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltErpsMgmtSubRingCtrlTCPropagationState.setStatus('deprecated')
eltErpsMgmtSubRingCtrlRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 3, 2, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: eltErpsMgmtSubRingCtrlRowStatus.setStatus('deprecated')
eltMesErpsNotifyPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 4, 0))
eltErpsSFDetectedTrap = NotificationType((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 4, 0, 1)).setObjects(("ELTEX-MES-BRIDGE-ERPS-MIB", "eltErpsNodeId"))
if mibBuilder.loadTexts: eltErpsSFDetectedTrap.setStatus('deprecated')
eltErpsSFClearedTrap = NotificationType((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 4, 0, 2)).setObjects(("ELTEX-MES-BRIDGE-ERPS-MIB", "eltErpsNodeId"))
if mibBuilder.loadTexts: eltErpsSFClearedTrap.setStatus('deprecated')
eltErpsRPLOwnerConflictTrap = NotificationType((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 4, 0, 3)).setObjects(("ELTEX-MES-BRIDGE-ERPS-MIB", "eltErpsNodeId"))
if mibBuilder.loadTexts: eltErpsRPLOwnerConflictTrap.setStatus('deprecated')
eltMesErpsNotificationBindings = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 4, 2))
eltErpsNodeId = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 1, 401, 0, 1, 4, 2, 1), MacAddress()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: eltErpsNodeId.setStatus('deprecated')
mibBuilder.exportSymbols("ELTEX-MES-BRIDGE-ERPS-MIB", EltErpsMgmtRAPSPortState=EltErpsMgmtRAPSPortState, eltErpsMgmtSubRingCtrlRAPSVlanId=eltErpsMgmtSubRingCtrlRAPSVlanId, EltErpsEnabledState=EltErpsEnabledState, eltErpsMgmtRAPSEastPort=eltErpsMgmtRAPSEastPort, eltErpsMgmtRAPSPortForcedSwitch=eltErpsMgmtRAPSPortForcedSwitch, eltErpsMgmtRAPSRingAdminState=eltErpsMgmtRAPSRingAdminState, eltErpsSFDetectedTrap=eltErpsSFDetectedTrap, eltErpsMgmtRAPSRowStatus=eltErpsMgmtRAPSRowStatus, EltErpsMgmtRAPSPortId=EltErpsMgmtRAPSPortId, eltErpsMgmtRAPSVlanEntry=eltErpsMgmtRAPSVlanEntry, eltErpsMgmtSubRingCtrlRowStatus=eltErpsMgmtSubRingCtrlRowStatus, eltMesErpsMgmt=eltMesErpsMgmt, eltErpsMgmtRAPSRPLOwnerOperStatus=eltErpsMgmtRAPSRPLOwnerOperStatus, eltErpsMgmtRAPSEastPortState=eltErpsMgmtRAPSEastPortState, eltErpsMgmtRAPSWestPortState=eltErpsMgmtRAPSWestPortState, eltMesErpsNotificationBindings=eltMesErpsNotificationBindings, eltErpsNodeId=eltErpsNodeId, eltErpsMgmtRAPSVlanTable=eltErpsMgmtRAPSVlanTable, eltMesErpsMIB=eltMesErpsMIB, eltErpsAdminState=eltErpsAdminState, eltErpsTrapState=eltErpsTrapState, eltErpsMgmtRAPSRPLPort=eltErpsMgmtRAPSRPLPort, eltMesErpsNotifyPrefix=eltMesErpsNotifyPrefix, eltErpsMgmtRAPSProtectionVlanRangeList3073to4094=eltErpsMgmtRAPSProtectionVlanRangeList3073to4094, eltErpsMgmtRAPSRPLOwnerAdminState=eltErpsMgmtRAPSRPLOwnerAdminState, eltErpsMgmtRAPSVlanId=eltErpsMgmtRAPSVlanId, eltErpsMgmtRAPSProtocolVersion=eltErpsMgmtRAPSProtocolVersion, eltMesErpsInfo=eltMesErpsInfo, eltErpsMgmtRAPSWTRTime=eltErpsMgmtRAPSWTRTime, eltErpsMgmtSubRingCtrlEntry=eltErpsMgmtSubRingCtrlEntry, eltMesErpsCtrl=eltMesErpsCtrl, eltErpsMgmtSubRingCtrlTable=eltErpsMgmtSubRingCtrlTable, eltErpsSFClearedTrap=eltErpsSFClearedTrap, eltErpsMgmtSubRingCtrlSubRingRAPSVlanId=eltErpsMgmtSubRingCtrlSubRingRAPSVlanId, eltErpsMgmtRAPSProtectionVlanRangeList1to1024=eltErpsMgmtRAPSProtectionVlanRangeList1to1024, eltErpsMgmtRAPSProtectionVlanRangeList1025to2048=eltErpsMgmtRAPSProtectionVlanRangeList1025to2048, eltErpsMgmtSubRingCtrlTCPropagationState=eltErpsMgmtSubRingCtrlTCPropagationState, eltErpsRPLOwnerConflictTrap=eltErpsRPLOwnerConflictTrap, eltErpsPendingAction=eltErpsPendingAction, eltErpsMgmtRAPSRingState=eltErpsMgmtRAPSRingState, eltErpsMgmtRAPSRevertive=eltErpsMgmtRAPSRevertive, eltErpsPendingActionVlan=eltErpsPendingActionVlan, eltErpsMgmtRAPSHoldOffTime=eltErpsMgmtRAPSHoldOffTime, eltErpsMgmtRAPSGuardTime=eltErpsMgmtRAPSGuardTime, PYSNMP_MODULE_ID=eltMesErpsMIB, eltErpsMgmtRAPSProtectionVlanRangeList2049to3072=eltErpsMgmtRAPSProtectionVlanRangeList2049to3072, eltErpsGetConfigId=eltErpsGetConfigId, eltErpsMgmtRAPSWestPort=eltErpsMgmtRAPSWestPort, eltErpsLogState=eltErpsLogState, eltMesErpsNotify=eltMesErpsNotify, eltErpsMgmtRAPSPortManualSwitch=eltErpsMgmtRAPSPortManualSwitch, eltErpsMgmtRAPSRingMEL=eltErpsMgmtRAPSRingMEL)
| 134.653543 | 2,856 | 0.775744 | 1,816 | 17,101 | 7.303965 | 0.120595 | 0.012515 | 0.010856 | 0.014475 | 0.428755 | 0.356831 | 0.327805 | 0.323733 | 0.258444 | 0.258444 | 0 | 0.095296 | 0.082627 | 17,101 | 126 | 2,857 | 135.722222 | 0.750191 | 0.020116 | 0 | 0.051724 | 0 | 0 | 0.1147 | 0.021495 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.068966 | 0 | 0.198276 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
970f8c8ab04013d9451fc7033e34e37a4c24e96d | 910 | py | Python | survey/views_start.py | shagun30/djambala-2 | 06f14e3dd237d7ebf535c62172cfe238c3934f4d | [
"BSD-3-Clause"
] | null | null | null | survey/views_start.py | shagun30/djambala-2 | 06f14e3dd237d7ebf535c62172cfe238c3934f4d | [
"BSD-3-Clause"
] | null | null | null | survey/views_start.py | shagun30/djambala-2 | 06f14e3dd237d7ebf535c62172cfe238c3934f4d | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""
/dms/survey/views_start.py
.. enthaelt den View zum Starten der Dateneingabe des Fragebogens
Django content Management System
Hans Rauch
hans.rauch@gmx.net
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 21.01.2008 Beginn der Arbeit
"""
from django.http import HttpResponseRedirect
from dms.roles import require_permission
from dms.queries import get_site_url
from dms_ext.extension import * # dms-Funktionen ueberschreiben
# -----------------------------------------------------
@require_permission('perm_manage_folderish')
def survey_start(request, item_container):
""" Eingaben in den Fragebogens unterbinden """
item_container.item.integer_2 = 1
item_container.item.save()
return HttpResponseRedirect(get_site_url(item_container, 'index.html'))
| 29.354839 | 73 | 0.712088 | 111 | 910 | 5.693694 | 0.675676 | 0.082278 | 0.031646 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018229 | 0.156044 | 910 | 30 | 74 | 30.333333 | 0.804688 | 0.515385 | 0 | 0 | 0 | 0 | 0.072941 | 0.049412 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.444444 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
97164f4fb92f4e82b2d27a916480386d11db3af1 | 796 | py | Python | liberaction/users/tests/test_user_custom_information.py | Computeiros-Estonia/liberaction-api | c14ace4b91eb881eff55032964cd186ce1fe6847 | [
"MIT"
] | null | null | null | liberaction/users/tests/test_user_custom_information.py | Computeiros-Estonia/liberaction-api | c14ace4b91eb881eff55032964cd186ce1fe6847 | [
"MIT"
] | 3 | 2021-12-03T18:58:03.000Z | 2022-03-31T23:03:42.000Z | liberaction/users/tests/test_user_custom_information.py | Computeiros-Estonia/liberaction-api | c14ace4b91eb881eff55032964cd186ce1fe6847 | [
"MIT"
] | null | null | null | import pytest
from liberaction.users.models import User, PhoneNumber, Address
@pytest.fixture
def user(db):
return User.objects.create(email='root@liberaction.com.br', password='toor')
def test_user_exists(user):
assert User.objects.exists()
@pytest.fixture
def phone_number(user):
return PhoneNumber.objects.create(
user=user, ddi=55, ddd=11,
number=999999999, is_main=True
)
def test_phone_number_exists(phone_number):
assert PhoneNumber.objects.exists()
@pytest.fixture
def address(user):
return Address.objects.create(
user=user, country='Brasil',
state='SP', city='Sao Paulo',
address1='Av. Do Lado De La',
cep='04613-030', is_main=True
)
def test_address_exists(address):
assert Address.objects.exists()
| 24.875 | 80 | 0.702261 | 106 | 796 | 5.169811 | 0.471698 | 0.071168 | 0.087591 | 0.094891 | 0.167883 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033588 | 0.177136 | 796 | 31 | 81 | 25.677419 | 0.803053 | 0 | 0 | 0.12 | 0 | 0 | 0.08794 | 0.028894 | 0 | 0 | 0 | 0 | 0.12 | 1 | 0.24 | false | 0.04 | 0.08 | 0.12 | 0.44 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
9716fd8f3f9cf12506ccc5b428c2c8a33f45284b | 249 | py | Python | battered/test_server.py | yuuzi41/battered | a4e417ce1081f972b65180b7100041ec51359751 | [
"Apache-2.0"
] | null | null | null | battered/test_server.py | yuuzi41/battered | a4e417ce1081f972b65180b7100041ec51359751 | [
"Apache-2.0"
] | null | null | null | battered/test_server.py | yuuzi41/battered | a4e417ce1081f972b65180b7100041ec51359751 | [
"Apache-2.0"
] | null | null | null | from battered import BatteredMiddleware
from wsgiref.simple_server import make_server, demo_app
battered = BatteredMiddleware(demo_app, {})
with make_server('', 8000, battered) as httpd:
print("start port 8000 ...")
httpd.serve_forever()
| 24.9 | 55 | 0.759036 | 31 | 249 | 5.903226 | 0.612903 | 0.10929 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037383 | 0.140562 | 249 | 9 | 56 | 27.666667 | 0.817757 | 0 | 0 | 0 | 0 | 0 | 0.076613 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
971c06eafb4b6ea5f707f4fba3037f4adb7c38f6 | 3,150 | py | Python | dataiter/util.py | otsaloma/dataiter | 50f47463d00a4d26aa44267d48e78c2d544a0d4c | [
"MIT"
] | 23 | 2020-03-15T18:06:50.000Z | 2022-02-09T20:47:58.000Z | dataiter/util.py | otsaloma/dataiter | 50f47463d00a4d26aa44267d48e78c2d544a0d4c | [
"MIT"
] | 16 | 2020-05-03T13:28:53.000Z | 2022-03-12T15:27:52.000Z | dataiter/util.py | otsaloma/dataiter | 50f47463d00a4d26aa44267d48e78c2d544a0d4c | [
"MIT"
] | 1 | 2021-09-30T07:14:41.000Z | 2021-09-30T07:14:41.000Z | # -*- coding: utf-8 -*-
# Copyright (c) 2020 Osmo Salomaa
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import dataiter
import itertools
import math
import numpy as np
import shutil
import string
from dataiter import deco
from pathlib import Path
def count_digits(value):
if np.isnan(value): return 0, 0
if math.isinf(value): return 0, 0
parts = str(float(value)).split(".")
n = len(parts[0].lstrip("0"))
m = len(parts[1].rstrip("0"))
return n, m
def format_floats(seq):
precision = dataiter.PRINT_FLOAT_PRECISION
if any(0 < x < 1/10**precision or x > 10**16 - 1 for x in seq):
# Format tiny and huge numbers in scientific notation.
f = np.format_float_scientific
return [f(x, precision=precision, trim="-") for x in seq]
# Format like largest by significant digits.
digits = [count_digits(x) for x in seq]
n = max(x[0] for x in digits)
m = max(x[1] for x in digits)
precision = min(m, max(0, precision - n))
return [f"{{:.{precision}f}}".format(x) for x in seq]
def generate_colnames(n):
return list(itertools.islice(yield_colnames(), n))
def get_print_width():
return shutil.get_terminal_size((dataiter.PRINT_MAX_WIDTH, 24))[0] - 1
def length(value):
return 1 if np.isscalar(value) else len(value)
def makedirs_for_file(fname):
return Path(fname).parent.mkdir(parents=True, exist_ok=True)
@deco.listify
def pad(strings, align="right"):
width = max(len(x) for x in strings)
for value in strings:
padding = " " * (width - len(value))
yield (padding + value
if align == "right"
else value + padding)
def quote(value):
return '"{}"'.format(str(value).replace('"', r'\"'))
def unique_keys(keys):
return list(dict.fromkeys(keys))
def unique_types(seq):
return set(x.__class__ for x in seq if
x is not None and
not (isinstance(x, float) and np.isnan(x)))
def yield_colnames():
# Like Excel: a, b, c, ..., aa, bb, cc, ...
for batch in range(1, 1000):
for letter in string.ascii_lowercase:
yield letter * batch
| 34.23913 | 79 | 0.68381 | 482 | 3,150 | 4.414938 | 0.414938 | 0.041353 | 0.022556 | 0.021147 | 0.023496 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014102 | 0.212063 | 3,150 | 91 | 80 | 34.615385 | 0.843272 | 0.384762 | 0 | 0 | 0 | 0 | 0.020899 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.207547 | false | 0 | 0.150943 | 0.132075 | 0.54717 | 0.018868 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
971fcf607287d1c55c91dc1e5df8a516b08b5bb0 | 4,662 | py | Python | koku/api/migrations/0039_create_hive_db.py | rubik-ai/koku | 3255d1c217b7b6685cb2e130bf4e025946e76fac | [
"Apache-2.0"
] | 157 | 2018-04-30T16:27:53.000Z | 2022-03-31T08:17:21.000Z | koku/api/migrations/0039_create_hive_db.py | rubik-ai/koku | 3255d1c217b7b6685cb2e130bf4e025946e76fac | [
"Apache-2.0"
] | 3,250 | 2018-04-26T14:14:25.000Z | 2022-03-31T23:49:15.000Z | koku/api/migrations/0039_create_hive_db.py | rubik-ai/koku | 3255d1c217b7b6685cb2e130bf4e025946e76fac | [
"Apache-2.0"
] | 65 | 2018-05-10T14:11:50.000Z | 2022-03-18T19:22:58.000Z | # Generated by Django 3.1.7 on 2021-03-03 19:26
import logging
import os
from django.conf import settings
from django.db import migrations
from django.db.utils import ProgrammingError
from psycopg2.errors import DuplicateDatabase
from psycopg2.errors import DuplicateObject
from psycopg2.errors import InsufficientPrivilege
LOG = logging.getLogger(__name__)
def create_hive_db(apps, schema_editor):
rolname = settings.HIVE_DATABASE_USER
datname = settings.HIVE_DATABASE_NAME
kokudb = settings.DATABASES.get("default").get("NAME")
kokudbuser = settings.DATABASES.get("default").get("USER")
db_password = settings.DATABASES.get("default").get("PASSWORD")
hive_db_password = settings.HIVE_DATABASE_PASSWORD
role_create_sql = f"""
create role "{rolname}" with login encrypted password '{{hivepw}}';
"""
role_public_revoke_sql = """
revoke connect on database "{}" from "public";
"""
role_revoke_sql = f"""
revoke connect on database "{kokudb}" from "{rolname}";
"""
role_grant_sql = f"""
grant connect on database "{datname}" to "{kokudbuser}";
"""
db_create_sql = f"""
create database "{datname}" owner "{rolname}";
"""
db_access_check_sql = """
select has_database_privilege(%s, %s, 'connect');
"""
try:
conn = schema_editor.connection.connection.__class__(
"postgresql://{user}:{password}@{host}:{port}/{dbname}".format(
password=db_password, **schema_editor.connection.connection.get_dsn_parameters()
)
)
conn.autocommit = True
with conn.cursor() as cur:
LOG.info(f"Creating role {rolname}.")
try:
cur.execute(role_create_sql.format(hivepw=hive_db_password))
except (ProgrammingError, InsufficientPrivilege, DuplicateObject) as e:
LOG.info(e)
LOG.info(f"Role {rolname} exists.")
try:
LOG.info(f"""Granting role "{rolname}" membership to "{kokudbuser}".""")
cur.execute(f"""grant "{rolname}" to "{kokudbuser}"; """)
except (ProgrammingError, InsufficientPrivilege) as e:
LOG.info(e)
try:
LOG.info(f"Creating database {rolname}.")
cur.execute(db_create_sql)
except (ProgrammingError, InsufficientPrivilege, DuplicateDatabase) as e:
LOG.info(e)
LOG.info(f"Database {rolname} exists.")
# Revoke access to koku db from public
try:
cur.execute(db_access_check_sql, ("public", kokudb))
if cur.fetchone()[0]:
LOG.info(f"Revoking public access to {kokudb}.")
cur.execute(role_public_revoke_sql.format(kokudb))
except (ProgrammingError, InsufficientPrivilege) as e:
LOG.info(e)
# Revoke access to hive db from public
try:
cur.execute(db_access_check_sql, ("public", datname))
if cur.fetchone()[0]:
LOG.info(f"Revoking public access to {datname}.")
cur.execute(role_public_revoke_sql.format(datname))
except (ProgrammingError, InsufficientPrivilege) as e:
LOG.info(e)
# Revoke access to koku db from hive user
try:
cur.execute(db_access_check_sql, (rolname, kokudb))
if cur.fetchone()[0]:
LOG.info(f"Revoking {rolname} access to {kokudb}.")
cur.execute(role_revoke_sql)
except (ProgrammingError, InsufficientPrivilege) as e:
LOG.info(e)
# Grant access to hive db from koku user
try:
cur.execute(db_access_check_sql, (kokudbuser, datname))
if not cur.fetchone()[0]:
LOG.info(f"Granting {kokudbuser} access to {datname}.")
cur.execute(role_grant_sql)
except (ProgrammingError, InsufficientPrivilege) as e:
LOG.info(e)
try:
LOG.info(f"""Revoking role "{rolname}" membership from "{kokudbuser}".""")
cur.execute(f"""revoke "{rolname}" from "{kokudbuser}"; """)
except (ProgrammingError, InsufficientPrivilege) as e:
LOG.info(e)
finally:
if conn:
conn.close()
class Migration(migrations.Migration):
dependencies = [("api", "0038_drop_app_needs_migrations_func")]
operations = [migrations.RunPython(create_hive_db)]
| 36.708661 | 96 | 0.590519 | 498 | 4,662 | 5.375502 | 0.212851 | 0.047068 | 0.029884 | 0.029884 | 0.384012 | 0.342174 | 0.298095 | 0.271946 | 0.233097 | 0.167352 | 0 | 0.007939 | 0.297512 | 4,662 | 126 | 97 | 37 | 0.809466 | 0.042471 | 0 | 0.326531 | 1 | 0 | 0.220502 | 0.025572 | 0 | 0 | 0 | 0 | 0 | 1 | 0.010204 | false | 0.061224 | 0.081633 | 0 | 0.122449 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.