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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c372b684bbfd0f42f8ea8e01aa6fca7740c0259d | 85 | py | Python | hackernews/__init__.py | niksite/hackernews-api-client | 728a6543d282e5455201ea2fbcfeb258e6b075f7 | [
"MIT"
] | null | null | null | hackernews/__init__.py | niksite/hackernews-api-client | 728a6543d282e5455201ea2fbcfeb258e6b075f7 | [
"MIT"
] | null | null | null | hackernews/__init__.py | niksite/hackernews-api-client | 728a6543d282e5455201ea2fbcfeb258e6b075f7 | [
"MIT"
] | null | null | null | """HackerNews API client."""
from .client import get_user_items
__version__ = '0.1'
| 17 | 34 | 0.729412 | 12 | 85 | 4.666667 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027027 | 0.129412 | 85 | 4 | 35 | 21.25 | 0.72973 | 0.258824 | 0 | 0 | 0 | 0 | 0.052632 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
c37370e73d524c767bae011358a76e55f81a1beb | 371 | py | Python | app/_settings/__init__.py | valeriansaliou/waaave-web | 8a0cde773563865a905af38f5a0b723a43b17341 | [
"RSA-MD"
] | 1 | 2020-04-06T10:04:43.000Z | 2020-04-06T10:04:43.000Z | app/_settings/__init__.py | valeriansaliou/waaave-web | 8a0cde773563865a905af38f5a0b723a43b17341 | [
"RSA-MD"
] | null | null | null | app/_settings/__init__.py | valeriansaliou/waaave-web | 8a0cde773563865a905af38f5a0b723a43b17341 | [
"RSA-MD"
] | null | null | null | import os
from .common import *
try:
import environment
except ImportError:
pass
ENVIRONMENT = os.getenv("DJANGO_ENVIRONMENT") or "development"
if ENVIRONMENT == "production":
from .production import *
elif ENVIRONMENT == "testing":
from .testing import *
else:
from .development import *
try:
from .local import *
except ImportError:
pass | 17.666667 | 62 | 0.703504 | 41 | 371 | 6.341463 | 0.463415 | 0.069231 | 0.161538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207547 | 371 | 21 | 63 | 17.666667 | 0.884354 | 0 | 0 | 0.352941 | 0 | 0 | 0.123656 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.117647 | 0.529412 | 0 | 0.529412 | 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 | 1 | 0 | 1 | 0 | 0 | 3 |
c379fed199a38c03e54147ed54487d643a12397e | 668 | py | Python | lib/tags.py | Mozzo1000/tagz | 4a35bc25c1727a4eba2830af890368c3afba0813 | [
"Apache-2.0"
] | null | null | null | lib/tags.py | Mozzo1000/tagz | 4a35bc25c1727a4eba2830af890368c3afba0813 | [
"Apache-2.0"
] | 2 | 2021-12-07T11:59:08.000Z | 2021-12-07T12:01:23.000Z | lib/tags.py | Mozzo1000/tagz | 4a35bc25c1727a4eba2830af890368c3afba0813 | [
"Apache-2.0"
] | null | null | null | from backend.database import init_db, Files, session
from backend.utils import flatten
class Tags:
def __init__(self):
db = init_db()
self.session = session(db)
def get(self, tag):
tag = self.session.query(Files).filter(Files.tags.like("%" + tag + "%")).all()
return tag
def get_all_untagged(self):
tags = self.session.query(Files).filter(Files.tags == '').all()
return tags
def get_all(self):
tags = self.session.query(Files.tags).all()
out = [item.split(',') for t in tags for item in t]
comma_separated = ", ".join(set(flatten(out)))
return comma_separated
| 30.363636 | 86 | 0.60479 | 89 | 668 | 4.41573 | 0.359551 | 0.111959 | 0.122137 | 0.160305 | 0.277354 | 0.277354 | 0.183206 | 0 | 0 | 0 | 0 | 0 | 0.255988 | 668 | 21 | 87 | 31.809524 | 0.790744 | 0 | 0 | 0 | 0 | 0 | 0.007485 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.117647 | 0 | 0.588235 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
5ef02a4c7e0f8322184f82409ad8178e9c4d591a | 120 | py | Python | lib/global_vars.py | sumedhpb/TAF | fc6f4cb8dc0b8234393f2e52a7b4a1aa723d9449 | [
"Apache-2.0"
] | null | null | null | lib/global_vars.py | sumedhpb/TAF | fc6f4cb8dc0b8234393f2e52a7b4a1aa723d9449 | [
"Apache-2.0"
] | null | null | null | lib/global_vars.py | sumedhpb/TAF | fc6f4cb8dc0b8234393f2e52a7b4a1aa723d9449 | [
"Apache-2.0"
] | null | null | null | import logging
logger = dict()
logger["infra"] = logging.getLogger("infra")
logger["test"] = logging.getLogger("test")
| 20 | 44 | 0.708333 | 14 | 120 | 6.071429 | 0.5 | 0.376471 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 120 | 5 | 45 | 24 | 0.787037 | 0 | 0 | 0 | 0 | 0 | 0.15 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5ef2191efad3ea19c97841e6a8568caa99028a49 | 111 | py | Python | main_module/submodule2/__init__.py | JohanNicander/python-test-architecture | 2418f861cb46c3fccaa21be94ee92c5862985a15 | [
"Apache-2.0"
] | null | null | null | main_module/submodule2/__init__.py | JohanNicander/python-test-architecture | 2418f861cb46c3fccaa21be94ee92c5862985a15 | [
"Apache-2.0"
] | null | null | null | main_module/submodule2/__init__.py | JohanNicander/python-test-architecture | 2418f861cb46c3fccaa21be94ee92c5862985a15 | [
"Apache-2.0"
] | null | null | null | from .two import two
from main_module._unittester import UnitTester
test = UnitTester(__name__)
del UnitTester | 22.2 | 46 | 0.837838 | 15 | 111 | 5.8 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117117 | 111 | 5 | 47 | 22.2 | 0.887755 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6f176fadd4741132216606597655bb6be93b8dc1 | 264 | py | Python | testapps/PY/teacher.py | EyelynSu/pinpoint-c-agent | 35cab594fe69c8de3ddb13625590d76a75bf8381 | [
"Apache-2.0"
] | 44 | 2020-10-27T07:15:50.000Z | 2022-03-26T13:37:23.000Z | testapps/PY/teacher.py | EyelynSu/pinpoint-c-agent | 35cab594fe69c8de3ddb13625590d76a75bf8381 | [
"Apache-2.0"
] | 120 | 2020-10-19T17:33:24.000Z | 2022-03-23T06:31:14.000Z | testapps/PY/teacher.py | EyelynSu/pinpoint-c-agent | 35cab594fe69c8de3ddb13625590d76a75bf8381 | [
"Apache-2.0"
] | 23 | 2020-10-22T06:47:40.000Z | 2022-03-17T08:15:09.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from person import Person
from pinpoint.common import PinpointCommonPlugin
class Teacher(Person):
@PinpointCommonPlugin("Teacher"+__name__)
def eat(self):
return super().eat()+"Teacher eating too!"
| 20.307692 | 50 | 0.69697 | 31 | 264 | 5.806452 | 0.741935 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004545 | 0.166667 | 264 | 12 | 51 | 22 | 0.813636 | 0.159091 | 0 | 0 | 0 | 0 | 0.118182 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 0.833333 | 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 | 1 | 1 | 0 | 0 | 3 |
6f45a3bf0ae3f5c18ff48a032a9b6e966df47c41 | 415 | py | Python | integration_tests/models.py | aiqa/geo-docker-django | 87dbb841ce79d43222b7a03f708b142dc4de36de | [
"MIT"
] | 1 | 2020-08-26T17:59:26.000Z | 2020-08-26T17:59:26.000Z | integration_tests/models.py | aiqa/geo-docker-django | 87dbb841ce79d43222b7a03f708b142dc4de36de | [
"MIT"
] | 12 | 2020-06-06T00:56:38.000Z | 2022-02-19T00:17:10.000Z | integration_tests/models.py | aiqa/geo-docker-django | 87dbb841ce79d43222b7a03f708b142dc4de36de | [
"MIT"
] | 1 | 2022-03-16T14:00:24.000Z | 2022-03-16T14:00:24.000Z | from random import randint
from faker import Faker
fake = Faker()
def random_city_body():
return {
'name': fake.city(),
'population': randint(300, 5_000_000)
}
def random_mountain_body():
return {
'name': fake.word(),
'height': randint(300, 5000)
}
def random_river_body():
return {
'name': fake.word(),
'length': randint(300, 5000)
}
| 15.37037 | 45 | 0.571084 | 48 | 415 | 4.770833 | 0.4375 | 0.117904 | 0.183406 | 0.235808 | 0.19214 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081633 | 0.291566 | 415 | 26 | 46 | 15.961538 | 0.697279 | 0 | 0 | 0.277778 | 0 | 0 | 0.081928 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.111111 | 0.166667 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
6f492802adf2e29a21cedfdda97c922aea02a214 | 632 | py | Python | pincer/objects/overwrite.py | ashu96902/Pincer | 102ac4ff998cbb3c57a86b252439f69895650cf3 | [
"MIT"
] | null | null | null | pincer/objects/overwrite.py | ashu96902/Pincer | 102ac4ff998cbb3c57a86b252439f69895650cf3 | [
"MIT"
] | null | null | null | pincer/objects/overwrite.py | ashu96902/Pincer | 102ac4ff998cbb3c57a86b252439f69895650cf3 | [
"MIT"
] | null | null | null | # Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING
from ..utils import APIObject
if TYPE_CHECKING:
from ..utils import Snowflake
@dataclass
class Overwrite(APIObject):
"""
Represents a Discord Overwrite object
:param id:
role or user id
:param type:
either 0 (role) or 1 (member)
:param allow:
permission bit set
:param deny:
permission bit set
"""
id: Snowflake
type: int
allow: str
deny: str
| 18.057143 | 65 | 0.672468 | 81 | 632 | 5.17284 | 0.617284 | 0.057279 | 0.076372 | 0.100239 | 0.128878 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012987 | 0.268987 | 632 | 34 | 66 | 18.588235 | 0.893939 | 0.454114 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.416667 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
48932e32ca310d5a0fb608a372bb60e1b4fc18ab | 1,180 | py | Python | tests/1_basics.py | zauddelig/pytest-workshop | 06f2f35188df94d6c6f5b9ac52ac1ea78da587f8 | [
"Apache-2.0"
] | null | null | null | tests/1_basics.py | zauddelig/pytest-workshop | 06f2f35188df94d6c6f5b9ac52ac1ea78da587f8 | [
"Apache-2.0"
] | null | null | null | tests/1_basics.py | zauddelig/pytest-workshop | 06f2f35188df94d6c6f5b9ac52ac1ea78da587f8 | [
"Apache-2.0"
] | null | null | null | """
A python file must contain a prefix to be detected by pytest as a test file.
You can run the test using:
pytest tests/must_have_a_prefx.py
To allow pytest to find this file add the test_ prefix, e.g.:
test_basics.py
once done you can run it using:
pytest test.py
"""
def test_assertions():
"""
Most of the times we will use assertions to run our tests.
An assert accepts a boolean value, either True or False.
Most of the times we have a single assert, but we can use more than one.
If the value:
- is True the test is considered passed
- is False the test is considered failing
Make this test pass,
"""
assert False, "Fix me"
def test_one_is_two():
"""
This will raise an assertion error:
E AssertionError: One is not two!
E assert 1 == 2
When the test passes the message will not contribute to the noise.
As exercise try to fix this test.
"""
assert 1 == 2, 'One is not two!'
def this_will_not_run():
"""
To run this function needs to have the test_ prefix, e.g.:
As exercise try to rename this test.
"""
assert False, "This will not fail"
| 20.344828 | 76 | 0.657627 | 198 | 1,180 | 3.853535 | 0.419192 | 0.055046 | 0.023591 | 0.036697 | 0.081258 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004689 | 0.277119 | 1,180 | 57 | 77 | 20.701754 | 0.889801 | 0.750847 | 0 | 0 | 0 | 0 | 0.19898 | 0 | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0.5 | true | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4895f41d4680ea2d4c2191214672738d62b156ce | 145 | py | Python | main.py | benfrankel/set-game | 3018ef359e541d045ba1cc674f252ecabc5d3374 | [
"Apache-2.0"
] | null | null | null | main.py | benfrankel/set-game | 3018ef359e541d045ba1cc674f252ecabc5d3374 | [
"Apache-2.0"
] | null | null | null | main.py | benfrankel/set-game | 3018ef359e541d045ba1cc674f252ecabc5d3374 | [
"Apache-2.0"
] | null | null | null | import pygame
from setgame import launcher
pygame.init()
pygame.mixer.quit()
launcher.load()
launcher.spawn_app().launch(fps=60, debug=True)
| 13.181818 | 47 | 0.765517 | 21 | 145 | 5.238095 | 0.761905 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015385 | 0.103448 | 145 | 10 | 48 | 14.5 | 0.830769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
48a02cccd1f2fd142b79ebe9a6fe18ef605203bf | 1,585 | py | Python | app/api/v2/__init__.py | Mati607/caldera | 895c3ff84715aa7333ea02545ba8d022cbc9e053 | [
"Apache-2.0"
] | 3,385 | 2017-11-29T02:08:31.000Z | 2022-03-31T13:38:11.000Z | app/api/v2/__init__.py | Mati607/caldera | 895c3ff84715aa7333ea02545ba8d022cbc9e053 | [
"Apache-2.0"
] | 1,283 | 2017-11-29T16:45:31.000Z | 2022-03-31T20:10:04.000Z | app/api/v2/__init__.py | Mati607/caldera | 895c3ff84715aa7333ea02545ba8d022cbc9e053 | [
"Apache-2.0"
] | 800 | 2017-11-29T17:48:43.000Z | 2022-03-30T22:39:40.000Z | from aiohttp import web
def make_app(services):
from .responses import json_request_validation_middleware
from .security import authentication_required_middleware_factory
app = web.Application(
middlewares=[
authentication_required_middleware_factory(services['auth_svc']),
json_request_validation_middleware
]
)
from .handlers.health_api import HealthApi
HealthApi(services).add_routes(app)
from .handlers.config_api import ConfigApi
ConfigApi(services).add_routes(app)
from .handlers.planner_api import PlannerApi
PlannerApi(services).add_routes(app)
from .handlers.ability_api import AbilityApi
AbilityApi(services).add_routes(app)
from .handlers.plugins_api import PluginApi
PluginApi(services).add_routes(app)
from .handlers.fact_source_api import FactSourceApi
FactSourceApi(services).add_routes(app)
from .handlers.objective_api import ObjectiveApi
ObjectiveApi(services).add_routes(app)
from .handlers.adversary_api import AdversaryApi
AdversaryApi(services).add_routes(app)
from .handlers.agent_api import AgentApi
AgentApi(services).add_routes(app)
from .handlers.operation_api import OperationApi
OperationApi(services).add_routes(app)
from .handlers.obfuscator_api import ObfuscatorApi
ObfuscatorApi(services).add_routes(app)
from .handlers.fact_api import FactApi
FactApi(services).add_routes(app)
from .handlers.contact_api import ContactApi
ContactApi(services).add_routes(app)
return app
| 28.818182 | 77 | 0.760252 | 183 | 1,585 | 6.360656 | 0.284153 | 0.134021 | 0.189863 | 0.223368 | 0.396907 | 0.33677 | 0.061856 | 0 | 0 | 0 | 0 | 0 | 0.170347 | 1,585 | 54 | 78 | 29.351852 | 0.885171 | 0 | 0 | 0 | 0 | 0 | 0.005047 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.027027 | false | 0 | 0.432432 | 0 | 0.486486 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
48a2a86fa0b4f02ffd3d48d5b5f1d6a3c6f5186f | 409 | py | Python | onnx_tf/handlers/frontend/relu.py | jsigee87/onnx-tensorflow | 90a58bed24a18f5260ebe9f22bf4997f9d591f62 | [
"Apache-2.0"
] | 18 | 2020-02-03T07:14:40.000Z | 2021-12-20T18:45:43.000Z | onnx_tf/handlers/frontend/relu.py | jsigee87/onnx-tensorflow | 90a58bed24a18f5260ebe9f22bf4997f9d591f62 | [
"Apache-2.0"
] | 11 | 2020-01-28T23:16:25.000Z | 2022-02-10T01:04:56.000Z | onnx_tf/handlers/frontend/relu.py | jsigee87/onnx-tensorflow | 90a58bed24a18f5260ebe9f22bf4997f9d591f62 | [
"Apache-2.0"
] | 2 | 2020-08-20T08:15:09.000Z | 2021-02-23T07:30:40.000Z | from onnx_tf.handlers.frontend_handler import FrontendHandler
from onnx_tf.handlers.handler import onnx_op
from onnx_tf.handlers.handler import tf_op
@onnx_op("Relu")
@tf_op("Relu")
class Relu(FrontendHandler):
@classmethod
def version_1(cls, node, **kwargs):
return cls.make_node_from_tf_node(node)
@classmethod
def version_6(cls, node, **kwargs):
return cls.make_node_from_tf_node(node)
| 24.058824 | 61 | 0.777506 | 63 | 409 | 4.761905 | 0.333333 | 0.08 | 0.1 | 0.18 | 0.5 | 0.5 | 0.293333 | 0.293333 | 0.293333 | 0.293333 | 0 | 0.005571 | 0.122249 | 409 | 16 | 62 | 25.5625 | 0.830084 | 0 | 0 | 0.333333 | 0 | 0 | 0.01956 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.25 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
48a8621492c86b993ab9c82cc593d7e8d39dd159 | 509 | py | Python | App/Actualiza/api/forms.py | stroomed/tesis2020 | 78ce1da41e91e324625aa78a4c9afa7552639e41 | [
"MIT"
] | null | null | null | App/Actualiza/api/forms.py | stroomed/tesis2020 | 78ce1da41e91e324625aa78a4c9afa7552639e41 | [
"MIT"
] | 26 | 2020-04-07T18:00:08.000Z | 2020-07-20T00:28:41.000Z | App/Actualiza/api/forms.py | stroomed/tesis2020 | 78ce1da41e91e324625aa78a4c9afa7552639e41 | [
"MIT"
] | null | null | null | from django.forms import ModelForm
from users.models import Usuario
from .models import experimento, imagen, video
class UsuarioForm(ModelForm):
class Meta:
model = Usuario
fields = '__all__'
class ExperimentoForm(ModelForm):
class Meta:
model = experimento
fields = '__all__'
class ImagenForm(ModelForm):
class Meta:
model = imagen
fields = '__all__'
class VideoForm(ModelForm):
class Meta:
model = video
fields = '__all__' | 21.208333 | 46 | 0.656189 | 52 | 509 | 6.115385 | 0.384615 | 0.176101 | 0.226415 | 0.289308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.27112 | 509 | 24 | 47 | 21.208333 | 0.857143 | 0 | 0 | 0.421053 | 0 | 0 | 0.054902 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.157895 | 0 | 0.578947 | 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 | 1 | 0 | 0 | 3 |
48ca66e1e1e0e910f0bfe48e7f3d8b5ee61e6185 | 626 | py | Python | src/394. Decode String.py | xiaonanln/myleetcode-python | 95d282f21a257f937cd22ef20c3590a69919e307 | [
"Apache-2.0"
] | null | null | null | src/394. Decode String.py | xiaonanln/myleetcode-python | 95d282f21a257f937cd22ef20c3590a69919e307 | [
"Apache-2.0"
] | null | null | null | src/394. Decode String.py | xiaonanln/myleetcode-python | 95d282f21a257f937cd22ef20c3590a69919e307 | [
"Apache-2.0"
] | null | null | null | class Solution(object):
def decodeString(self, s):
"""
:type s: str
:rtype: str
"""
stack = [
["", None, ]
]
cur = stack[-1]
for c in s:
if c == '[':
cur = ["", None]
stack.append( cur )
elif c == ']':
# print 'closing', cur
s = cur[0]
stack.pop()
cur = stack[-1]
cur[0] += s * cur[1]
cur[1] = None
elif '0' <= c <= '9':
cur[1] = int(c) if cur[1] is None else cur[1] * 10 + int(c)
else:
cur[0] += c
return cur[0]
print Solution().decodeString("3[a]2[bc]")
# print Solution().decodeString("3[a2[c]]")
# print Solution().decodeString("2[abc]3[cd]ef") | 18.969697 | 63 | 0.504792 | 96 | 626 | 3.291667 | 0.395833 | 0.063291 | 0.237342 | 0.164557 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046053 | 0.271566 | 626 | 33 | 64 | 18.969697 | 0.64693 | 0.174121 | 0 | 0.090909 | 0 | 0 | 0.027311 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.045455 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
48d0f75ec86c95b6b4e84b0119aa660bd1611eaf | 222 | py | Python | Research/tools/api_socket.py | RomanMichaelPaolucci/Automatic_Portfolio_Optimization | 6a7925d5f30f02cffef19d7347a979a38e282805 | [
"MIT"
] | 9 | 2020-02-12T13:26:30.000Z | 2021-11-22T16:06:26.000Z | Research/tools/api_socket.py | RomanMichaelPaolucci/Automatic_Portfolio_Optimization | 6a7925d5f30f02cffef19d7347a979a38e282805 | [
"MIT"
] | null | null | null | Research/tools/api_socket.py | RomanMichaelPaolucci/Automatic_Portfolio_Optimization | 6a7925d5f30f02cffef19d7347a979a38e282805 | [
"MIT"
] | 9 | 2020-02-22T22:26:48.000Z | 2021-01-05T10:01:48.000Z | import pandas as pd
import quandl
import requests
class QuandlSocket:
"""
Socket for cached historical market data requests
"""
def __init__(self):
quandl.ApiConfig.api_key = 'YOUR_API_KEY'
| 15.857143 | 57 | 0.68018 | 27 | 222 | 5.333333 | 0.777778 | 0.083333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.252252 | 222 | 13 | 58 | 17.076923 | 0.86747 | 0.220721 | 0 | 0 | 0 | 0 | 0.078431 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.5 | 0 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
48e95b7acd98b0486ed50bff61ec9b704459058b | 195 | py | Python | dev.py | Nearata/speedtest-servers | 21f835be724afffc47b7f3eb1c5bda909063aa15 | [
"MIT"
] | null | null | null | dev.py | Nearata/speedtest-servers | 21f835be724afffc47b7f3eb1c5bda909063aa15 | [
"MIT"
] | null | null | null | dev.py | Nearata/speedtest-servers | 21f835be724afffc47b7f3eb1c5bda909063aa15 | [
"MIT"
] | null | null | null | from speedtest_servers import create_app
from config import Config
app = create_app(Config)
app.config["ENV"] = "development"
if __name__ == "__main__":
app.run(threaded=True, debug=True)
| 19.5 | 40 | 0.748718 | 27 | 195 | 5 | 0.592593 | 0.133333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138462 | 195 | 9 | 41 | 21.666667 | 0.803571 | 0 | 0 | 0 | 0 | 0 | 0.112821 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
48e97d99b57b8066f423de347c4020b58ecadbfa | 3,764 | py | Python | examples/example_script.py | nokia/napalm-srlinux | a29c93bbd5947747173c629a3afffdfa2e24747d | [
"Apache-2.0"
] | 2 | 2021-07-29T23:56:49.000Z | 2021-09-26T08:59:29.000Z | examples/example_script.py | nokia/napalm-srlinux | a29c93bbd5947747173c629a3afffdfa2e24747d | [
"Apache-2.0"
] | null | null | null | examples/example_script.py | nokia/napalm-srlinux | a29c93bbd5947747173c629a3afffdfa2e24747d | [
"Apache-2.0"
] | 2 | 2021-06-29T10:05:26.000Z | 2021-09-14T18:40:10.000Z | # Copyright 2020 Nokia
# Licensed under the Apache License 2.0.
# SPDX-License-Identifier: Apache-2.0
from napalm import get_network_driver
import json
driver = get_network_driver("srl")
optional_args = {
"gnmi_port": 57400,
"jsonrpc_port": 80,
"target_name": "172.20.20.2",
"tls_cert":"/root/gnmic_certs/srl_certs/clientCert.crt",
"tls_ca": "/root/gnmic_certs/srl_certs/RootCA.crt",
"tls_key": "/root/gnmic_certs/srl_certs/clientKey.pem",
#"skip_verify": True,
#"insecure": False
"encoding": "JSON_IETF"
}
device = driver("172.20.20.2", "admin", "admin", 60, optional_args)
device.open()
#Below diff is a private function.
#print(device._diff("/home/nuage/json_compare/srl2_2000_Ori_WithBGP.json","/home/nuage/json_compare/srl2_2000_Ori_WithBGP_v2.json"))
#print(json.dumps(device.get_bgp_config(neighbor="", group=""))) #Done
#print(json.dumps(device.get_bgp_config(neighbor="", group="ebgp"))) #Done
#print(json.dumps(device.get_bgp_config(neighbor="10.1.1.2", group=""))) #Done
#print(json.dumps(device.get_config(retrieve="all", full=False, sanitized=False)))
#print(json.dumps(device.get_config(retrieve="running", full=False, sanitized=False)))
#print(json.dumps(device.get_config(retrieve="candidate", full=False, sanitized=False)))
#print(json.dumps(device.get_config(retrieve="state", full=False, sanitized=False)))
#print(json.dumps(device.get_ntp_stats()))
#print(json.dumps(device.get_optics()))
#print(json.dumps(device.get_route_to()))
#print(json.dumps(device.get_route_to("1.0.4.0/24")))
#print(json.dumps(device.get_route_to("100.100.100.100")))
#print(json.dumps(device.get_route_to(destination="172.20.20.0/24")))
#print(json.dumps(device.get_route_to(protocol="bgp")))
#print(json.dumps(device.get_route_to(protocol="host")))
#print(json.dumps(device.get_mac_address_table())) #Done
#print(json.dumps(device.get_snmp_information()))
#print(device.is_alive())
#print(json.dumps(device.cli(["date","info system information","show network-instance default protocols bgp neighbor"])))
#print(device.load_merge_candidate(filename="/root/syed/backup/napalm-srl-dev/demo_merge.json"))
#print(device.load_replace_candidate(filename="/home/nuage/json_compare/srl2_2000_Ori_WithBGP.json"))
#print(json.dumps(device.commit_config("test commit")))
#print(json.dumps(device.compare_config()))
#print(json.dumps(device.discard_config()))
#print(json.dumps(device.rollback()))
#print(json.dumps(device.ping(destination="11.1.1.2")))
#print(json.dumps(device.ping(destination="11.1.1.2",source="10.1.1.1",ttl=2, timeout=2, size=64, count=2, vrf="default")))
#print(json.dumps(device.traceroute(destination="11.1.1.2",vrf = "")))
##print(json.dumps(device.traceroute(destination="21.1.1.2",ttl=5, vrf = "ip_vrf1")))
######################################
#print(json.dumps(device.get_arp_table()))
#print(json.dumps(device.get_arp_table("ip_vrf1")))
#print(json.dumps(device.get_bgp_neighbors()))
#print(json.dumps(device.get_bgp_neighbors_detail()))
#print(json.dumps(device.get_bgp_neighbors_detail("10.1.1.2")))
#print(json.dumps(device.get_environment()))
#print(json.dumps(device.get_facts()))
#print(json.dumps(device.get_interfaces()))
#print(json.dumps(device.get_interfaces_counters()))
#print(json.dumps(device.get_interfaces_ip()))
#print(json.dumps(device.get_ipv6_neighbors_table()))#----------TBD
#print(json.dumps(device.get_lldp_neighbors()))
#print(json.dumps(device.get_lldp_neighbors_detail()))
#print(json.dumps(device.get_lldp_neighbors_detail("ethernet-1/3")))
#print(json.dumps(device.get_network_instances()))
#print(json.dumps(device.get_network_instances()))# -------name not coming taken from input
#print(json.dumps(device.get_users()))
#print(json.dumps(device.test()))
device.close()
| 50.864865 | 132 | 0.743092 | 571 | 3,764 | 4.705779 | 0.271454 | 0.147376 | 0.229252 | 0.327503 | 0.632304 | 0.533681 | 0.456271 | 0.314105 | 0.221064 | 0.096762 | 0 | 0.034434 | 0.05101 | 3,764 | 73 | 133 | 51.561644 | 0.717805 | 0.82492 | 0 | 0 | 0 | 0 | 0.405018 | 0.216846 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.133333 | 0 | 0.133333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5b00e482294a654f202caff65f4ad1f6f450b2ce | 930 | py | Python | release/stubs.min/System/Runtime/InteropServices/__init___parts/TypeLibFuncAttribute.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 182 | 2017-06-27T02:26:15.000Z | 2022-03-30T18:53:43.000Z | release/stubs.min/System/Runtime/InteropServices/__init___parts/TypeLibFuncAttribute.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 28 | 2017-06-27T13:38:23.000Z | 2022-03-15T11:19:44.000Z | release/stubs.min/System/Runtime/InteropServices/__init___parts/TypeLibFuncAttribute.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 67 | 2017-06-28T09:43:59.000Z | 2022-03-20T21:17:10.000Z | class TypeLibFuncAttribute(Attribute,_Attribute):
"""
Contains the System.Runtime.InteropServices.FUNCFLAGS that were originally imported for this method from the COM type library.
TypeLibFuncAttribute(flags: TypeLibFuncFlags)
TypeLibFuncAttribute(flags: Int16)
"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,flags):
"""
__new__(cls: type,flags: TypeLibFuncFlags)
__new__(cls: type,flags: Int16)
"""
pass
Value=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the System.Runtime.InteropServices.TypeLibFuncFlags value for this method.
Get: Value(self: TypeLibFuncAttribute) -> TypeLibFuncFlags
"""
| 27.352941 | 215 | 0.724731 | 104 | 930 | 5.971154 | 0.432692 | 0.072464 | 0.077295 | 0.091787 | 0.181965 | 0.181965 | 0.181965 | 0.181965 | 0.181965 | 0.181965 | 0 | 0.005128 | 0.16129 | 930 | 33 | 216 | 28.181818 | 0.791026 | 0.530108 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.285714 | 0 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
5b0edb9b01a42fc851cc1a8db6a300175e11cdf5 | 588 | py | Python | experiments/nginx/collect.py | tudinfse/intel_mpx_explained | 9a3d7b060742d8fe89c1b56898f2b2e3617b670b | [
"MIT"
] | 15 | 2018-07-31T07:24:36.000Z | 2020-05-31T03:18:25.000Z | experiments/nginx/collect.py | OleksiiOleksenko/intel_mpx_explained | dd6da57e0fcf22df358d1a742079b414620a7c88 | [
"MIT"
] | 1 | 2020-02-01T00:29:32.000Z | 2020-02-04T14:25:57.000Z | experiments/nginx/collect.py | OleksiiOleksenko/intel_mpx_explained | dd6da57e0fcf22df358d1a742079b414620a7c88 | [
"MIT"
] | 3 | 2017-02-08T04:02:51.000Z | 2018-03-30T07:58:45.000Z | #!/usr/bin/env python
from __future__ import absolute_import
from core import collect
def main():
collect.collect("nginx", user_parameters={
"num_clients": ["Concurrency Level", lambda l: collect.get_int_from_string(l)],
"tput": ["Requests per second", lambda l: collect.get_float_from_string(l)],
"lat": ["[ms] (mean)", lambda l: collect.get_float_from_string(l)],
"complete_requests": ["Complete requests", lambda l: collect.get_int_from_string(l)],
"failed_requests": ["Failed requests", lambda l: collect.get_int_from_string(l)],
})
| 39.2 | 93 | 0.688776 | 79 | 588 | 4.822785 | 0.43038 | 0.091864 | 0.183727 | 0.223097 | 0.459318 | 0.459318 | 0.459318 | 0.459318 | 0.204724 | 0 | 0 | 0 | 0.164966 | 588 | 14 | 94 | 42 | 0.775967 | 0.034014 | 0 | 0 | 0 | 0 | 0.236332 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | true | 0 | 0.2 | 0 | 0.3 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d2873c368d020d10bb16d6ad54fd67d36d519c27 | 162 | py | Python | Python Pattern Programs/Symbol Patterns/Pattern 32.py | trial1user/Printing-Pattern-Programs | dde29e056b8e067fb3a824edb7ecb7dd9c9a776a | [
"MIT"
] | 61 | 2021-01-07T03:56:25.000Z | 2022-02-26T14:39:52.000Z | PythonPatternPrograms/SymbolPatterns/Pattern 32.py | Ankur-586/Printing-Pattern-Programs | 33e534ed66a02705e6cd6bc1992d4818a44d1b6b | [
"MIT"
] | 51 | 2020-12-25T17:06:26.000Z | 2021-05-07T12:52:56.000Z | PythonPatternPrograms/SymbolPatterns/Pattern 32.py | Ankur-586/Printing-Pattern-Programs | 33e534ed66a02705e6cd6bc1992d4818a44d1b6b | [
"MIT"
] | 13 | 2021-01-07T09:50:21.000Z | 2021-12-17T11:03:57.000Z | for x in range(6, 0, -1):
if (x % 2 != 0):
ctrl = x + 1
else:
ctrl = x
for y in range(0, ctrl):
print("*", end="")
print() | 20.25 | 28 | 0.388889 | 26 | 162 | 2.423077 | 0.538462 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074468 | 0.419753 | 162 | 8 | 29 | 20.25 | 0.595745 | 0 | 0 | 0 | 0 | 0 | 0.006135 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d2a14e9f700f25021aee8ed4632015a1cfdf4eb8 | 4,321 | py | Python | micrometals.py | dword1511/powdercore-q | ddf24c50e8178033a30cfbbf94642a5199764da6 | [
"Apache-2.0"
] | null | null | null | micrometals.py | dword1511/powdercore-q | ddf24c50e8178033a30cfbbf94642a5199764da6 | [
"Apache-2.0"
] | null | null | null | micrometals.py | dword1511/powdercore-q | ddf24c50e8178033a30cfbbf94642a5199764da6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import material
class _Micrometals(material.Material):
def __init__(self, ur, a, b, c, d, exp_a = 3, exp_b = 2.3, exp_c = 1.65):
self._a = a
self._b = b
self._c = c
self._d = d
self._exp_a = exp_a
self._exp_b = exp_b
self._exp_c = exp_c
super().__init__(ur)
def get_pv(self, freq, bpk, f_unit = 'Hz', b_unit = 'T', p_unit = 'W', l_unit = 'm'):
freq = self._f_to_unit(freq, f_unit, 'Hz')
bpk = self._b_to_unit(bpk , b_unit, 'G')
t_a = self._a / (bpk ** self._exp_a)
t_b = self._b / (bpk ** self._exp_b)
t_c = self._c / (bpk ** self._exp_c)
t_1 = freq / (t_a + t_b + t_c)
t_2 = self._d * (bpk ** 2) * (freq ** 2)
pv = t_1 + t_2
return self._pv_to_unit(pv, 'cm', l_unit, 'mW', p_unit)
class _TypeI(_Micrometals):
def __init__(self, ur, d):
super().__init__(ur = ur, a = 1.9e9, b = 2e8, c = 9e5, d = d)
class _TypeII(_Micrometals):
def __init__(self, ur, d):
super().__init__(ur = ur, a = 4e9, b = 3e8, c = 2.7e6, d = d)
# Carbonyl Iron, Type I
class Mix_1(_TypeI):
def __init__(self):
super().__init__(ur = 20, d = 4.3e-15)
class Mix_3(_TypeI):
def __init__(self):
super().__init__(ur = 35, d = 4.3e-15)
class Mix_8(_TypeI):
def __init__(self):
super().__init__(ur = 35, d = 5e-15)
class Mix_15(_TypeI):
def __init__(self):
super().__init__(ur = 25, d = 5e-15)
# Carbonyl Iron, Type II
class Mix_2(_TypeII):
def __init__(self):
super().__init__(ur = 10, d = 9.6e-16)
class Mix_4(_TypeII):
def __init__(self):
super().__init__(ur = 9, d = 8e-15)
class Mix_6(_TypeII):
def __init__(self):
super().__init__(ur = 8.5, d = 8.9e-16)
class Mix_7(_TypeII):
def __init__(self):
super().__init__(ur = 9, d = 9.6e-16)
class Mix_10(_TypeII):
def __init__(self):
super().__init__(ur = 6, d = 8e-16)
class Mix_17(_TypeII):
def __init__(self):
super().__init__(ur = 4, d = 4.4e-16)
# Iron, Type II
class Mix_14(_TypeII):
def __init__(self):
super().__init__(ur = 14, d = 1.92e-15)
# Iron, Others
class Mix_18(_Micrometals):
def __init__(self):
super().__init__(ur = 55, a = 8e8, b = 1.7e8, c = 9e5, d = 3.1e-14)
class Mix_19(_Micrometals):
def __init__(self):
super().__init__(ur = 55, a = 1.9e9, b = 8.4e7, c = 2.1e6, d = 5e-14)
class Mix_26(_Micrometals):
def __init__(self):
super().__init__(ur = 75, a = 1e9, b = 1.1e8, c = 1.9e6, d = 1.9e-13)
class Mix_30(_Micrometals):
def __init__(self):
super().__init__(ur = 22, a = 3.3e8, b = 2e7, c = 2e6, d = 1.1e-13)
class Mix_34(_Micrometals):
def __init__(self):
super().__init__(ur = 33, a = 1.1e9, b = 3.3e7, c = 2.5e6, d = 7.7e-14)
class Mix_35(_Micrometals):
def __init__(self):
super().__init__(ur = 33, a = 3.7e8, b = 2.2e7, c = 2.2e6, d = 1.1e-13)
class Mix_38(_Micrometals):
def __init__(self):
super().__init__(ur = 85, a = 1.2e9, b = 1.3e8, c = 1.9e6, d = 3.2e-13)
class Mix_40(_Micrometals):
def __init__(self):
super().__init__(ur = 60, a = 1.1e9, b = 3.3e7, c = 2.5e6, d = 3.1e-13)
class Mix_45(_Micrometals):
def __init__(self):
super().__init__(ur = 100, a = 1.2e9, b = 1.3e8, c = 2.4e6, d = 1.2e-13)
class Mix_52(_Micrometals):
def __init__(self):
super().__init__(ur = 75, a = 1e9, b = 1.1e8, c = 2.1e6, d = 6.9e-14)
# Ferrosilicon (Fe-Si)
class Mix_60(_Micrometals):
def __init__(self):
super().__init__(ur = 55, a = 5.3e8, b = 1.4e8, c = 1.2e6, d = 2.7e-14)
class Mix_61(_Micrometals):
def __init__(self):
super().__init__(ur = 38, a = 4e8, b = 1.1e8, c = 5.1e5, d = 2.4e-14)
class Mix_63(_Micrometals):
def __init__(self):
super().__init__(ur = 35, a = 9.94e8, b = 2.56e8, c = 1e4, d = 3.34e-15)
class Mix_65(_Micrometals):
def __init__(self):
super().__init__(ur = 42, a = 6.9e9, b = 6e7, c = 1.1e6, d = 2.5e-14)
class Mix_66(_Micrometals):
def __init__(self):
super().__init__(ur = 66, a = 1.72e10, b = 4.96e7, c = 1.23e6, d = 1.73e-14)
# High Flux (Ni-Fe)
class Mix_70(_Micrometals):
def __init__(self):
super().__init__(ur = 100, a = 1e10, b = 1.3e9, c = 7.9e6, d = 4.2e-14)
# MPP (Ni-Fe-Mo)
class Mix_M125(_Micrometals):
def __init__(self):
super().__init__(ur = 125, a = 3.1e10, b = 2.7e9, c = 3.3e6, d = 5.3e-14)
| 26.03012 | 87 | 0.596853 | 778 | 4,321 | 2.848329 | 0.177378 | 0.097924 | 0.153881 | 0.202166 | 0.531588 | 0.515343 | 0.490975 | 0.258574 | 0.258574 | 0.090253 | 0 | 0.116652 | 0.220319 | 4,321 | 165 | 88 | 26.187879 | 0.54111 | 0.03402 | 0 | 0.27027 | 0 | 0 | 0.00288 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.288288 | false | 0 | 0.009009 | 0 | 0.585586 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d2cc5852acd5b0c5ffe642dea2dc756bf59bc3ff | 2,649 | py | Python | xcube/core/store/__init__.py | bcdev/xcube | 9d275ef3baef8fbcea5c1fbbfb84c3d0164aecd3 | [
"MIT"
] | null | null | null | xcube/core/store/__init__.py | bcdev/xcube | 9d275ef3baef8fbcea5c1fbbfb84c3d0164aecd3 | [
"MIT"
] | null | null | null | xcube/core/store/__init__.py | bcdev/xcube | 9d275ef3baef8fbcea5c1fbbfb84c3d0164aecd3 | [
"MIT"
] | null | null | null | # The MIT License (MIT)
# Copyright (c) 2021 by the xcube development team and contributors
#
# 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.
from .accessor import DataDeleter
from .accessor import DataOpener
from .accessor import DataTimeSliceUpdater
from .accessor import DataWriter
from .accessor import find_data_opener_extensions
from .accessor import find_data_writer_extensions
from .accessor import get_data_accessor_predicate
from .accessor import new_data_opener
from .accessor import new_data_writer
from .assertions import assert_valid_config
from .assertions import assert_valid_params
from .datatype import ANY_TYPE
from .datatype import DATASET_TYPE
from .datatype import DataType
from .datatype import DataTypeLike
from .datatype import GEO_DATA_FRAME_TYPE
from .datatype import MULTI_LEVEL_DATASET_TYPE
from .descriptor import DataDescriptor
from .descriptor import DatasetDescriptor
from .descriptor import GeoDataFrameDescriptor
from .descriptor import MultiLevelDatasetDescriptor
from .descriptor import VariableDescriptor
from .descriptor import new_data_descriptor
from .error import DataStoreError
from .fs.registry import new_fs_data_store
from .search import DefaultSearchMixin
from .store import DataStore
from .store import MutableDataStore
from .store import find_data_store_extensions
from .store import get_data_store_class
from .store import get_data_store_params_schema
from .store import new_data_store
from .storepool import DataStoreConfig
from .storepool import DataStoreInstance
from .storepool import DataStorePool
from .storepool import DataStorePoolLike
from .storepool import get_data_store_instance
| 44.898305 | 81 | 0.8339 | 371 | 2,649 | 5.832884 | 0.404313 | 0.049908 | 0.074861 | 0.030499 | 0.100739 | 0.024954 | 0 | 0 | 0 | 0 | 0 | 0.001736 | 0.130238 | 2,649 | 58 | 82 | 45.672414 | 0.9375 | 0.418271 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054054 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d2d716a108dc9efd12cbacfbd258eb5f34c5c818 | 380 | py | Python | dongtai_agent_python/middlewares/django_wsgi_middleware.py | luzhongyang/DongTai-agent-python-1 | f4e14afb136946809c5e84b7b163a8c32267a27a | [
"Apache-2.0"
] | 17 | 2021-11-13T11:57:10.000Z | 2022-03-26T12:45:30.000Z | dongtai_agent_python/middlewares/django_wsgi_middleware.py | luzhongyang/DongTai-agent-python-1 | f4e14afb136946809c5e84b7b163a8c32267a27a | [
"Apache-2.0"
] | 2 | 2021-11-08T07:43:38.000Z | 2021-12-09T02:23:46.000Z | dongtai_agent_python/middlewares/django_wsgi_middleware.py | luzhongyang/DongTai-agent-python-1 | f4e14afb136946809c5e84b7b163a8c32267a27a | [
"Apache-2.0"
] | 17 | 2021-11-02T08:21:57.000Z | 2022-02-19T13:24:36.000Z | import django
from dongtai_agent_python.middlewares.wsgi_middleware import WSGIMiddleware
from dongtai_agent_python.setting import const
class DjangoWSGIMiddleware(WSGIMiddleware):
def __init__(self, wsgi_app):
super(DjangoWSGIMiddleware, self).__init__(wsgi_app, {
"name": const.CONTAINER_DJANGO,
"version": django.get_version()
})
| 29.230769 | 75 | 0.736842 | 40 | 380 | 6.575 | 0.575 | 0.08365 | 0.121673 | 0.1673 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.184211 | 380 | 12 | 76 | 31.666667 | 0.848387 | 0 | 0 | 0 | 0 | 0 | 0.028947 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
d2eaa7c73076a8eb2dc0137c66dc5095e6618961 | 2,150 | py | Python | simulation.py | jwmueller/OptimalIntervention | 7f52f0f645d119974f655da3c6d13f55032dade6 | [
"MIT"
] | 1 | 2020-10-09T06:42:13.000Z | 2020-10-09T06:42:13.000Z | simulation.py | jwmueller/OptimalIntervention | 7f52f0f645d119974f655da3c6d13f55032dade6 | [
"MIT"
] | null | null | null | simulation.py | jwmueller/OptimalIntervention | 7f52f0f645d119974f655da3c6d13f55032dade6 | [
"MIT"
] | null | null | null | import numpy as np
from scipy.stats import invwishart
"""
Code to simulate data from some simple outcome-covariate relationships.
"""
def make_func(a):
def func(sample_size, D, noise):
r, fx = a()
x = (r[1] - r[0]) * np.random.rand(sample_size, D) + r[0]
y = np.apply_along_axis(lambda x: [fx(x) + noise * np.random.standard_normal()], 1, x)
return x, y
return func
def make_wishart(fx):
def func(sample_size, D, noise, df):
cov = invwishart.rvs(df, np.identity(D))
x = np.random.multivariate_normal(np.zeros(D), cov, sample_size)
y = np.apply_along_axis(lambda x: [fx(x) + noise * np.random.standard_normal()], 1, x)
return x, y
return func
@make_func
def _paraboloid():
return (-1, 1), lambda x: 1 - (x[-1] ** 2) - (x[-2] ** 2)
paraboloid = (_paraboloid, lambda x: 1 - x[-2] ** 2 - x[-1] ** 2, lambda x: 1, np.array([-2, -1]))
@make_wishart
def _wishart_paraboloid(x):
return 1 - (x[-1] ** 2) - (x[-2] ** 2)
wishart_paraboloid = (_wishart_paraboloid, lambda x: 1 - x[-2] ** 2 - x[-1] ** 2, lambda x: 1, np.array([-2, -1]))
@make_func
def _line():
return (-1, 1), lambda x: x[0]
line = (_line, lambda x: x[0], lambda x: x[0] + 1, np.array([0]))
@make_func
def _plane():
return (-1, 1), lambda x: 0.3 * x[0] + 0.7 * x[1]
plane = (_plane, lambda x: 0.3 * x[0] + 0.7 * x[1], lambda x: 0.3 * x[0] + 0.7 * x[1] + 1, np.array([0, 1]))
@make_func
def _hyperbolic():
return (-1, 1), lambda x: x[0] * x[1]
hyperbolic = (_hyperbolic, lambda x: x[0] * x[1], lambda x: x[0] * x[1] + max(abs(x[0]), abs(x[1])) * 1, np.array([0, 1]))
# Deprecated
#@make_func
#def _sine():
# return (-0.5, 3), lambda x: np.sin(x[-1] * np.pi) - 0.5 * x[-1]
#sine = (_sine, lambda x: (np.sin(x[-1] * np.pi) - 0.5 * x[-1]), lambda x: 0.7627, np.array([-1]))
#@make_func
#def _corrugated_curve():
# return (-7, 7), lambda x: 8 * np.sin(np.pi * x[-2]/2) + 4 * x[-2] - (x[-1] ** 2)
#corrugated_curve = (_corrugated_curve,
# lambda x: np.abs(28.41 - (8 * np.sin(np.pi * x[-2]/2) + 4 * x[-2] - (x[-1] ** 2))),
# np.array([-2, -1]))
| 34.677419 | 122 | 0.551628 | 386 | 2,150 | 2.968912 | 0.178756 | 0.038394 | 0.048866 | 0.04712 | 0.467714 | 0.441536 | 0.39267 | 0.319372 | 0.319372 | 0.319372 | 0 | 0.068986 | 0.224651 | 2,150 | 61 | 123 | 35.245902 | 0.618476 | 0.229767 | 0 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.055556 | 0.138889 | 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 | 1 | 1 | 0 | 0 | 3 |
d2f0f9f0661fd9302fcdfe86be26c4face971b62 | 444 | py | Python | lost_ds/vis/api.py | l3p-cv/lost_ds | 4a2f3ef027128b759d28e67cb1fdaa0a557e343c | [
"MIT"
] | 1 | 2022-03-30T11:29:57.000Z | 2022-03-30T11:29:57.000Z | lost_ds/vis/api.py | l3p-cv/lost_ds | 4a2f3ef027128b759d28e67cb1fdaa0a557e343c | [
"MIT"
] | null | null | null | lost_ds/vis/api.py | l3p-cv/lost_ds | 4a2f3ef027128b759d28e67cb1fdaa0a557e343c | [
"MIT"
] | null | null | null | from lost_ds.vis.vis import (vis_and_store,
vis_sample,
vis_semantic_segmentation,
)
from lost_ds.vis.geometries import (draw_boxes,
draw_lines,
draw_points,
draw_polygons,
draw_text) | 44.4 | 55 | 0.346847 | 30 | 444 | 4.733333 | 0.566667 | 0.112676 | 0.140845 | 0.183099 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.619369 | 444 | 10 | 56 | 44.4 | 0.840237 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.222222 | 0 | 0.222222 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d2ff3099bb32420c8fcee3b51d19de67c55606bc | 167 | py | Python | melissa/actions/repeat.py | blacksparrow6/Melissa-Core | ea08ae5e3088360d3bddc40db72160697522b8f7 | [
"MIT"
] | 554 | 2015-12-10T12:08:50.000Z | 2022-02-24T02:56:11.000Z | melissa/actions/repeat.py | blacksparrow6/Melissa-Core | ea08ae5e3088360d3bddc40db72160697522b8f7 | [
"MIT"
] | 178 | 2016-01-07T06:26:17.000Z | 2020-04-23T20:41:07.000Z | melissa/actions/repeat.py | blacksparrow6/Melissa-Core | ea08ae5e3088360d3bddc40db72160697522b8f7 | [
"MIT"
] | 300 | 2015-12-16T13:23:29.000Z | 2022-03-20T04:21:07.000Z | # Melissa
from melissa.tts import tts
WORDS = {'repeat_text': {'groups': ['repeat', 'say']}}
def repeat_text(text):
text = text.split(' ', 1)[1]
tts(text)
| 15.181818 | 54 | 0.60479 | 23 | 167 | 4.304348 | 0.521739 | 0.242424 | 0.242424 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014815 | 0.191617 | 167 | 10 | 55 | 16.7 | 0.718519 | 0.041916 | 0 | 0 | 0 | 0 | 0.170886 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
960108b6cf554360f4c0d07afc45c57d4a7cf7e8 | 944 | py | Python | users/admin.py | namanmalikk/UpCare | 43af1a3d291d4580cdf9348e9c38da4a7e41db73 | [
"Apache-2.0"
] | null | null | null | users/admin.py | namanmalikk/UpCare | 43af1a3d291d4580cdf9348e9c38da4a7e41db73 | [
"Apache-2.0"
] | null | null | null | users/admin.py | namanmalikk/UpCare | 43af1a3d291d4580cdf9348e9c38da4a7e41db73 | [
"Apache-2.0"
] | null | null | null | from django.contrib import admin
from .models import *
admin.site.register(Doctor)
admin.site.register(Patient)
admin.site.register(Pharmacist)
admin.site.register(Pathologist)
admin.site.register(Appointment)
admin.site.register(Medecine)
# ----------------------------------------------------
# pharmacy registrations
admin.site.register(specificproducts)
admin.site.register(allproducts)
# admin.site.register(Pharmacist)
admin.site.register(Order)
admin.site.register(Cart)
admin.site.register(WalkinOrder)
admin.site.register(WalkinCart)
# pharmacy Registration over
# ----------------------------------------------------
#----------------------------------------------------
#pathology registrations
admin.site.register(labtest)
admin.site.register(BookTest)
admin.site.register(Tests)
admin.site.register(AnonyTests)
admin.site.register(AddTests)
#pathology Registration over
#---------------------------------------------------- | 26.222222 | 54 | 0.635593 | 90 | 944 | 6.666667 | 0.333333 | 0.27 | 0.51 | 0.09 | 0.146667 | 0.146667 | 0.146667 | 0 | 0 | 0 | 0 | 0 | 0.055085 | 944 | 36 | 55 | 26.222222 | 0.672646 | 0.361229 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.105263 | 0 | 0.105263 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9606e4086bfae214a27a8ffbb99d9f5d55ade593 | 11,159 | py | Python | compiler/fo_ast.py | k-ye/Fo | 0d320ea7d0074803dffb7bf2199566db117867bc | [
"MIT"
] | null | null | null | compiler/fo_ast.py | k-ye/Fo | 0d320ea7d0074803dffb7bf2199566db117867bc | [
"MIT"
] | null | null | null | compiler/fo_ast.py | k-ye/Fo | 0d320ea7d0074803dffb7bf2199566db117867bc | [
"MIT"
] | null | null | null | from contextlib import contextmanager
from fo_symbols import *
from fo_types import *
from source_code_builder import *
class AstNode(object):
def __init__(self, symbol_chain=None):
self._symbol_chain = symbol_chain
@property
def lang(self):
return 'Fo'
@property
def symbol(self):
return self._symbol_chain.symbol
def is_symbol(self, symbol):
return self._symbol_chain.is_symbol(symbol)
def visit(self, visitor):
raise NotImplementedError()
class ProgramNode(AstNode):
def __init__(self, var_decls, type_decls, function_decls):
self._var_decls = var_decls
self._type_decls = type_decls
self._function_decls = function_decls
@property
def var_decls(self):
return self._var_decls
@property
def type_decls(self):
return self._type_decls
@property
def function_decls(self):
return self._function_decls
def visit(self, visitor):
return visitor.visit_program(self)
class ScopeVarsetError(Exception):
pass
class ScopeVarset(object):
def __init__(self):
self._declared_vars = []
self._captured_vars = []
self._free_vars = []
def _add_var(self, var_name, vars):
if var_name in vars:
raise ScopeVarsetError('Cannot re-add {}'.format(var_name))
vars.append(var_name)
@property
def declared_vars(self):
return self._declared_vars
def add_declared_var(self, var_name):
self._add_var(var_name, self._declared_vars)
@property
def captured_vars(self):
return self._captured_vars
def add_captured_var(self, var_name):
self._add_var(var_name, self._captured_vars)
@property
def free_vars(self):
return self._free_vars
def add_free_var(self, var_name):
self._add_var(var_name, self._free_vars)
class BlockNode(AstNode):
def __init__(self, stmts):
iter(stmts)
self._stmts = stmts
self._scope_varset = ScopeVarset()
@property
def stmts(self):
return self._stmts
def set_stmts(self, stmts):
iter(stmts)
self._stmts = stmts
@property
def scope_varset(self):
return self._scope_varset
def visit(self, visitor):
return visitor.visit_block(self)
class VarSpecNode(AstNode):
def __init__(self, var, type, init_expr=None):
assert isinstance(var, IdentifierNode)
assert isinstance(type, NodeType)
assert init_expr is None or isinstance(init_expr, AstNode)
self._var = var
self._var._type = type
# self._type = type
self._init_expr = init_expr
@property
def var(self):
return self._var
@property
def var_spec_type(self):
return self._var.type
@property
def init_expr(self):
return self._init_expr
def visit(self, visitor):
return visitor.visit_var_spec(self)
class AssignmentNode(AstNode):
def __init__(self, var, expr):
self._var = var
self._expr = expr
@property
def var(self):
return self._var
@property
def expr(self):
return self._expr
def visit(self, visitor):
visitor.visit_assignment(self)
class ReturnNode(AstNode):
def __init__(self, expr):
super(ReturnNode, self).__init__()
self._expr = expr
@property
def expr(self):
return self._expr
def visit(self, visitor):
return visitor.visit_return(self)
class ExpressionStmtNode(AstNode):
def __init__(self, expr):
self._expr = expr
@property
def expr(self):
return self._expr
def visit(self, visitor):
return visitor.visit_expression_stmt(self)
class UnaryExprWithOpNode(AstNode):
def __init__(self, op, expr):
self._op = op
self._expr = expr
@property
def expr(self):
return self._expr
@property
def op(self):
return self._op
@property
def type(self):
return self._expr.type
def set_type(self, t):
self._type = t
def visit(self, visitor):
return visitor.visit_unary_expr_with_op(self)
class BinaryExprNode(AstNode):
def __init__(self, lhs, op, rhs):
self._lhs = lhs
self._rhs = rhs
self._op = op
self._type = None
@property
def lhs(self):
return self._lhs
@property
def rhs(self):
return self._rhs
@property
def op(self):
return self._op
@property
def type(self):
return self._type
def set_type(self, t):
self._type = t
def visit(self, visitor):
return visitor.visit_binary_expr(self)
class IntLitNode(AstNode):
def __init__(self, val):
self._val = val
@property
def val(self):
return self._val
@property
def type(self):
return make_int_type()
def visit(self, visitor):
return visitor.visit_int_lit(self)
class FloatLitNode(AstNode):
def __init__(self, val):
self._val = val
@property
def val(self):
return self._val
@property
def type(self):
return make_float_type()
def visit(self, visitor):
return visitor.visit_float_lit(self)
class IdentifierNode(AstNode):
def __init__(self, name, type=None):
assert isinstance(name, str)
self._name = name
self._type = type
@property
def name(self):
return self._name
def set_name(self, name):
self._name = name
@property
def type(self):
return self._type
def set_type(self, t):
self._type = t
def visit(self, visitor):
return visitor.visit_identifier(self)
class FunctionCallNode(AstNode):
def __init__(self, func_expr, args):
iter(args)
self._func_expr = func_expr
self._args = args
@property
def func_expr(self):
return self._func_expr
def set_func_expr(self, func_expr):
self._func_expr = func_expr
@property
def args(self):
return self._args
def set_args(self, args):
iter(args)
self._args = args
@property
def type(self):
# return self._type
try:
return get_func_ret_type(self._func_expr.type)
except TypeMismatchError:
return make_placeholder_type()
# raise
def visit(self, visitor):
visitor.visit_function_call(self)
class FunctionDeclNode(AstNode):
def __init__(self, name, signature, body):
assert isinstance(name, str)
# signature is a 2-tuple of (params, return_type)
assert len(signature) == 2
iter(body)
self._name = name
self._signature = signature
self._body = body
param_types = [t for _, t in self.parameters]
self._type = make_func_type(param_types, self.return_type)
self._scope_varset = ScopeVarset()
@property
def name(self):
return self._name
@property
def signature(self):
return self._signature
@property
def parameters(self):
return self._signature[0]
@property
def parameter_names(self):
return [p.name for p, _ in self.parameters]
@property
def type(self):
return self._type
@property
def return_type(self):
return self._signature[1]
@property
def body(self):
return self._body
def set_body(self, body):
iter(body)
self._body = body
@property
def scope_varset(self):
return self._scope_varset
def visit(self, visitor):
return visitor.visit_function_decl(self)
# closure
class FunctionLitNode(AstNode):
def __init__(self, signature, body):
# signature is a 2-tuple of (params, return_type)
assert len(signature) == 2
iter(body)
self._name = None
self._signature = signature
self._body = body
param_types = [t for _, t in self.parameters]
self._type = make_func_type(param_types, self.return_type)
self._scope_varset = ScopeVarset()
@property
def name(self):
return self._name
def set_name(self, name):
assert isinstance(name, str)
self._name = name
@property
def signature(self):
return self._signature
@property
def parameters(self):
return self._signature[0]
@property
def parameter_names(self):
return [p.name for p, _ in self.parameters]
@property
def type(self):
return self._type
@property
def return_type(self):
return self._signature[1]
@property
def body(self):
return self._body
def set_body(self, body):
iter(body)
self._body = body
@property
def scope_varset(self):
return self._scope_varset
def visit(self, visitor):
return visitor.visit_function_lit(self)
class _SourceCodeVisitor(object):
def __init__(self):
self._builder = SourceCodeBuilder()
def build(self):
return self._builder.build()
def visit_program(self, node):
for func in node.function_decls:
self._builder.new_line()
func.visit(self)
self._builder.new_line()
def visit_var_spec(self, node):
self._builder.append('var')
node.var.visit(self)
self._builder.append(node.type)
if node.init_expr is not None:
self._builder.append('=')
node.init_expr.visit(self)
def visit_block(self, node):
self._builder.append('{')
with self._builder.indent():
for stmt in node.stmts:
self._builder.new_line()
stmt.visit(self)
self._builder.new_line()
self._builder.append('}')
def visit_assignment(self, node):
node.var.visit(self)
self._builder.append('=')
node.expr.visit(self)
def visit_assign_function(self, node):
return self.visit_assignment(node)
def visit_return(self, node):
self._builder.append('return')
if node.expr is not None:
node.expr.visit(self)
def visit_expression_stmt(self, node):
node.expr.visit(self)
def visit_unary_expr_with_op(self, node):
self._builder.append('({}'.format(node.op))
node.expr.visit(self)
self._builder.append(')')
def visit_binary_expr(self, node):
self._builder.append('(')
node.lhs.visit(self)
self._builder.append(node.op)
node.rhs.visit(self)
self._builder.append(')')
def visit_int_lit(self, node):
self._builder.append('{}'.format(node.val))
def visit_float_lit(self, node):
self._builder.append('{}'.format(node.val))
def visit_identifier(self, node):
self._builder.append(node.name)
def _visit_function_common(self, node):
self._builder.append('(')
parameters, ret = node.signature
first = True
for p, t in parameters:
if first:
first = False
else:
self._builder.append(',')
p.visit(self)
self._builder.append(t)
self._builder.append(') {} {{'.format(ret))
with self._builder.indent():
for stmt in node.body:
self._builder.new_line()
stmt.visit(self)
self._builder.new_line()
self._builder.append('}')
def visit_function_decl(self, node):
self._builder.append('func {}'.format(node.name))
self._visit_function_common(node)
def visit_function_lit(self, node):
name = node.name or '<unknown>'
self._builder.append('func_lit {}'.format(name))
self._visit_function_common(node)
def visit_function_call(self, node):
self._builder.append('/*call*/')
node.func_expr.visit(self)
self._builder.append('(')
first = True
for a in node.args:
if first:
first = False
else:
self._builder.append(',')
a.visit(self)
self._builder.append(')')
def gen_source_code(ast):
visitor = _SourceCodeVisitor()
ast.visit(visitor)
return visitor.build()
| 19.646127 | 65 | 0.679631 | 1,502 | 11,159 | 4.774301 | 0.090546 | 0.072514 | 0.087854 | 0.039743 | 0.595454 | 0.520011 | 0.469391 | 0.427137 | 0.379584 | 0.366476 | 0 | 0.000908 | 0.210592 | 11,159 | 567 | 66 | 19.680776 | 0.813146 | 0.012994 | 0 | 0.573566 | 0 | 0 | 0.008086 | 0 | 0 | 0 | 0 | 0 | 0.01995 | 1 | 0.284289 | false | 0.002494 | 0.009975 | 0.157107 | 0.503741 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
9606f792ebc1c2adfc053a7a2645405b21d0a779 | 297 | py | Python | boids/test/test_betterboids.py | cpmck/boids | 9547281d31ec806752ad7616fc6c6676cbc644d8 | [
"MIT"
] | null | null | null | boids/test/test_betterboids.py | cpmck/boids | 9547281d31ec806752ad7616fc6c6676cbc644d8 | [
"MIT"
] | null | null | null | boids/test/test_betterboids.py | cpmck/boids | 9547281d31ec806752ad7616fc6c6676cbc644d8 | [
"MIT"
] | null | null | null | from matplotlib import pyplot as plt
from matplotlib import animation
import random
import numpy as np
from boids.flock import Flock
from boids.flight import Flight
from argparse import ArgumentParser
import yaml
import os
from nose.tools import assert_equal
from nose.tools import assert_raises
| 24.75 | 37 | 0.848485 | 46 | 297 | 5.434783 | 0.478261 | 0.112 | 0.16 | 0.152 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138047 | 297 | 11 | 38 | 27 | 0.976563 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
961051abffeab8beda618c1dc17575e0930609a9 | 504 | py | Python | benchmarks/benchmark_timefn.py | samtx/pass-predictor | 6577f75cd7d64bd3c12a9512880d4b29c2682b4c | [
"MIT"
] | null | null | null | benchmarks/benchmark_timefn.py | samtx/pass-predictor | 6577f75cd7d64bd3c12a9512880d4b29c2682b4c | [
"MIT"
] | null | null | null | benchmarks/benchmark_timefn.py | samtx/pass-predictor | 6577f75cd7d64bd3c12a9512880d4b29c2682b4c | [
"MIT"
] | null | null | null | # Write the benchmarking functions here.
# See "Writing benchmarks" in the asv docs for more information.
from datetime import datetime, timedelta, timezone
import numpy as np
from passpredict import time as pptime
from passpredict import _time
class Jday2Datetime:
params = [2450383.09722222, 2453101.828154745, 2453101.8274067827]
param_names = ['jd']
def setup(self, jd):
self.jd = 2453101.828154745
def time_jday2datetime(self, jd):
_time.jday2datetime(self.jd)
| 26.526316 | 71 | 0.738095 | 64 | 504 | 5.75 | 0.609375 | 0.065217 | 0.11413 | 0.13587 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.163814 | 0.188492 | 504 | 18 | 72 | 28 | 0.735941 | 0.200397 | 0 | 0 | 0 | 0 | 0.005 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.181818 | 0.363636 | 0 | 0.818182 | 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 | 1 | 0 | 1 | 0 | 0 | 3 |
961c8c9a1b257c07452e04aa593acf62a7c05055 | 3,141 | py | Python | projects/20131811/api/models.py | sisobus/WebStudio2019 | 2f659a84647110bcf975525905722931fa7055b3 | [
"MIT"
] | 14 | 2019-03-06T10:32:40.000Z | 2021-11-18T01:44:28.000Z | projects/20131811/api/models.py | sisobus/WebStudio2019 | 2f659a84647110bcf975525905722931fa7055b3 | [
"MIT"
] | 35 | 2019-03-13T07:04:02.000Z | 2019-10-08T06:26:45.000Z | projects/20131811/api/models.py | sisobus/WebStudio2019 | 2f659a84647110bcf975525905722931fa7055b3 | [
"MIT"
] | 22 | 2019-03-11T11:00:24.000Z | 2019-09-14T06:53:30.000Z | from flask_sqlalchemy import SQLAlchemy
from werkzeug import generate_password_hash, check_password_hash
from sqlalchemy.orm import relationship, backref
from datetime import datetime
import json
db = SQLAlchemy()
def myconverter(o):
if isinstance(o, datetime):
return o.__str__()
class User(db.Model):
__tablename__ = 'user'
__table_args__ = {'mysql_collate': 'utf8_general_ci'}
id = db.Column(db.Integer, primary_key=True)
account = db.Column(db.String(300))
password = db.Column(db.String(300))
def __init__(self, account, password):
self.account = account
self.set_password(password)
def set_password(self, password):
self.password = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.password, password)
def serialize(self):
return json.dumps({
'id': self.id,
'account': self.account,
'password': self.password
})
class Movie(db.Model):
__tablename__ = 'movie'
__table_args__ = {'mysql_collate': 'utf8_general_ci'}
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(300))
photo = db.Column(db.String) #사진 url
total_star = db.Column(db.Integer) #이거
people_num = db.Column(db.Integer)
last_update = db.Column(db.DateTime) #이거
def __init__(self, name, photo):
self.name = name
self.photo = photo
self.last_update = datetime.now() #현재시간
self.total_star = 0
self.people_num = 0
def serialize(self):
return json.dumps({
'id' : self.id,
'name' : self.name,
'photo' : self.photo,
'total_star' : self.total_star,
'people_num' : self.people_num,
'last_update' : self.last_update
},default=myconverter)
class Review(db.Model):
__tablename__ = 'review'
__table_args__ = {'mysql_collate': 'utf8_general_ci'}
id = db.Column(db.Integer, primary_key=True)
movie_id = db.Column(db.Integer, db.ForeignKey('movie.id'))
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
content = db.Column(db.Text)
star = db.Column(db.Integer)
movie = relationship('Movie', backref=backref('movies', order_by=id))
user = relationship('User', backref=backref('users', order_by=id))
def __init__(self, movie_id, user_id, content, star):
self.movie_id = movie_id
self.user_id = user_id
self.content = content
self.star = star
def serialize(self):
return json.dumps({
'id' : self.id,
'movie_id' : self.movie_id,
'user_id' : self.user_id,
'content' : self.content,
'star' : self.star
})
class LoginSession(db.Model):
__tablename__ = 'login_session'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
jti = db.Column(db.Text)
user = relationship('User')
def __init__(self, user_id, jti):
self.user_id = user_id
self.jti = jti | 29.632075 | 73 | 0.629417 | 398 | 3,141 | 4.698492 | 0.188442 | 0.072727 | 0.090909 | 0.090909 | 0.340642 | 0.269519 | 0.248128 | 0.231551 | 0.213904 | 0.151337 | 0 | 0.00593 | 0.248329 | 3,141 | 106 | 74 | 29.632075 | 0.786108 | 0.005731 | 0 | 0.261905 | 1 | 0 | 0.078526 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.119048 | false | 0.107143 | 0.059524 | 0.047619 | 0.607143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
824983050787e70b350b3215e0fb8717322ae942 | 265 | py | Python | py2/Problem006.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | py2/Problem006.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | py2/Problem006.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | import EulerRunner
def sum_squares(top):
return sum(x ** 2 for x in range(1, top+1))
def square_sum(top):
return (top * (top + 1) / 2) ** 2
def problem6_func():
return square_sum(100) - sum_squares(100)
EulerRunner.solve_problem(problem6_func)
| 18.928571 | 47 | 0.671698 | 42 | 265 | 4.071429 | 0.452381 | 0.116959 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.066038 | 0.2 | 265 | 13 | 48 | 20.384615 | 0.740566 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0 | 0.125 | 0.375 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
825c6e13a75e96d762f474e026ff300a9de5d306 | 130 | py | Python | control/decoder.py | shimomura314/Arithmetic-Logic-Unit | a547d2fe4ac3cbc2e38a64d654e26141f4c9c81a | [
"MIT"
] | null | null | null | control/decoder.py | shimomura314/Arithmetic-Logic-Unit | a547d2fe4ac3cbc2e38a64d654e26141f4c9c81a | [
"MIT"
] | null | null | null | control/decoder.py | shimomura314/Arithmetic-Logic-Unit | a547d2fe4ac3cbc2e38a64d654e26141f4c9c81a | [
"MIT"
] | null | null | null | __all__ = ["decoder"]
def decoder(x: list) -> int:
x = int(str("0b" + "".join(reversed(list(map(str, x))))), 2)
return x | 21.666667 | 64 | 0.553846 | 20 | 130 | 3.4 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0.2 | 130 | 6 | 65 | 21.666667 | 0.634615 | 0 | 0 | 0 | 0 | 0 | 0.068702 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8264c19e26f5f39e2f5a1ae195a6d6c3fa970d9d | 204 | py | Python | openiPrototype/openiPrototype/APIS/Activity/Measurement/admin.py | OPENi-ict/ntua_demo | 104118fbe1f54db35386ca96286317ceb64cb658 | [
"Apache-2.0"
] | null | null | null | openiPrototype/openiPrototype/APIS/Activity/Measurement/admin.py | OPENi-ict/ntua_demo | 104118fbe1f54db35386ca96286317ceb64cb658 | [
"Apache-2.0"
] | null | null | null | openiPrototype/openiPrototype/APIS/Activity/Measurement/admin.py | OPENi-ict/ntua_demo | 104118fbe1f54db35386ca96286317ceb64cb658 | [
"Apache-2.0"
] | null | null | null | __author__ = 'mpetyx'
from django.contrib import admin
from .models import OpeniMeasurement
class MeasurementAdmin(admin.ModelAdmin):
pass
admin.site.register(OpeniMeasurement, MeasurementAdmin)
| 17 | 55 | 0.808824 | 21 | 204 | 7.666667 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.122549 | 204 | 11 | 56 | 18.545455 | 0.899441 | 0 | 0 | 0 | 0 | 0 | 0.029412 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.166667 | 0.333333 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
826de322cc35f124ad6d96c5daf3f5d90a3b2fd3 | 212 | py | Python | pmfp/entrypoint/project/__init__.py | Python-Tools/pmfp | 832273890eec08e84f9c68d03f3316b2c8139133 | [
"MIT"
] | 4 | 2017-09-15T03:38:56.000Z | 2019-12-16T02:03:14.000Z | pmfp/entrypoint/project/__init__.py | Python-Tools/pmfp | 832273890eec08e84f9c68d03f3316b2c8139133 | [
"MIT"
] | 1 | 2021-04-27T10:51:42.000Z | 2021-04-27T10:51:42.000Z | pmfp/entrypoint/project/__init__.py | Python-Tools/pmfp | 832273890eec08e84f9c68d03f3316b2c8139133 | [
"MIT"
] | null | null | null | from .info import project_info
from .add import add_component
from .new import new_project
from .as_template import project_as_temp
__all__ = ["project_info", "add_component", "new_project", "project_as_temp"]
| 26.5 | 77 | 0.801887 | 32 | 212 | 4.84375 | 0.34375 | 0.167742 | 0.167742 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113208 | 212 | 7 | 78 | 30.285714 | 0.824468 | 0 | 0 | 0 | 0 | 0 | 0.240566 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
828aaf5df2b7622c91023d443de9752070021c59 | 1,284 | py | Python | ardana_configurationprocessor/cp/model/DependencyElement.py | eapodaca/ardana-configuration-processor | 70ea25a138cf65d9fb6baf75b48d82f12bbc6d8b | [
"Apache-2.0"
] | 2 | 2018-01-24T20:21:23.000Z | 2019-07-29T07:55:21.000Z | ardana_configurationprocessor/cp/model/DependencyElement.py | eapodaca/ardana-configuration-processor | 70ea25a138cf65d9fb6baf75b48d82f12bbc6d8b | [
"Apache-2.0"
] | null | null | null | ardana_configurationprocessor/cp/model/DependencyElement.py | eapodaca/ardana-configuration-processor | 70ea25a138cf65d9fb6baf75b48d82f12bbc6d8b | [
"Apache-2.0"
] | 3 | 2018-03-09T19:51:06.000Z | 2019-02-26T19:58:11.000Z | #
# (c) Copyright 2015 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017-2018 SUSE LLC
#
# 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.
#
class DependencyElement(object):
def __init__(self, plugin):
self._plugin = plugin
self._dependencies = plugin.get_dependencies()
@property
def slug(self):
return self._plugin.slug
@property
def plugin(self):
return self._plugin
@property
def dependencies(self):
return self._dependencies
def remove_dependency(self, slug):
if slug in self._dependencies:
self._dependencies.remove(slug)
def has_dependencies(self):
return len(self._dependencies) > 0
def has_dependency(self, slug):
return slug in self._dependencies
| 28.533333 | 75 | 0.707944 | 170 | 1,284 | 5.247059 | 0.517647 | 0.067265 | 0.047085 | 0.035874 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016899 | 0.216511 | 1,284 | 44 | 76 | 29.181818 | 0.869781 | 0.475857 | 0 | 0.15 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.35 | false | 0 | 0 | 0.25 | 0.65 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
828efa69856be2a04ea3b0f2e4adc29263207edc | 4,737 | py | Python | Tools/SeeDot/seedot/compiler/antlr/seedotVisitor.py | shas19/EdgeML | 3c03b128761018fb39e447589aa72d5b6b0649a2 | [
"MIT"
] | null | null | null | Tools/SeeDot/seedot/compiler/antlr/seedotVisitor.py | shas19/EdgeML | 3c03b128761018fb39e447589aa72d5b6b0649a2 | [
"MIT"
] | null | null | null | Tools/SeeDot/seedot/compiler/antlr/seedotVisitor.py | shas19/EdgeML | 3c03b128761018fb39e447589aa72d5b6b0649a2 | [
"MIT"
] | 1 | 2020-07-05T15:12:20.000Z | 2020-07-05T15:12:20.000Z | # Generated from .\seedot.g4 by ANTLR 4.8
from antlr4 import *
if __name__ is not None and "." in __name__:
from .seedotParser import seedotParser
else:
from seedotParser import seedotParser
# This class defines a complete generic visitor for a parse tree produced by seedotParser.
class seedotVisitor(ParseTreeVisitor):
# Visit a parse tree produced by seedotParser#bop1.
def visitBop1(self, ctx:seedotParser.Bop1Context):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#init.
def visitInit(self, ctx:seedotParser.InitContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#bop2.
def visitBop2(self, ctx:seedotParser.Bop2Context):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#decl.
def visitDecl(self, ctx:seedotParser.DeclContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#splice.
def visitSplice(self, ctx:seedotParser.SpliceContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#index.
def visitIndex(self, ctx:seedotParser.IndexContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#sum.
def visitSum(self, ctx:seedotParser.SumContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#reshape.
def visitReshape(self, ctx:seedotParser.ReshapeContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#float.
def visitFloat(self, ctx:seedotParser.FloatContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#reverse.
def visitReverse(self, ctx:seedotParser.ReverseContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#cond.
def visitCond(self, ctx:seedotParser.CondContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#int.
def visitInt(self, ctx:seedotParser.IntContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#transp.
def visitTransp(self, ctx:seedotParser.TranspContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#paren.
def visitParen(self, ctx:seedotParser.ParenContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#func.
def visitFunc(self, ctx:seedotParser.FuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#loop.
def visitLoop(self, ctx:seedotParser.LoopContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#uop.
def visitUop(self, ctx:seedotParser.UopContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#convolution.
def visitConvolution(self, ctx:seedotParser.ConvolutionContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#let.
def visitLet(self, ctx:seedotParser.LetContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#id.
def visitId(self, ctx:seedotParser.IdContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#funcCall.
def visitFuncCall(self, ctx:seedotParser.FuncCallContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#maxpool.
def visitMaxpool(self, ctx:seedotParser.MaxpoolContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#name.
def visitName(self, ctx:seedotParser.NameContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#leftSplice.
def visitLeftSplice(self, ctx:seedotParser.LeftSpliceContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#addOp.
def visitAddOp(self, ctx:seedotParser.AddOpContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#binOp.
def visitBinOp(self, ctx:seedotParser.BinOpContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#specialFunc.
def visitSpecialFunc(self, ctx:seedotParser.SpecialFuncContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by seedotParser#intConstList.
def visitIntConstList(self, ctx:seedotParser.IntConstListContext):
return self.visitChildren(ctx)
del seedotParser | 30.960784 | 90 | 0.729787 | 551 | 4,737 | 6.259528 | 0.221416 | 0.050449 | 0.084082 | 0.151348 | 0.513192 | 0.513192 | 0.503914 | 0.493186 | 0.493186 | 0.493186 | 0 | 0.002625 | 0.195693 | 4,737 | 153 | 91 | 30.960784 | 0.902625 | 0.325945 | 0 | 0.444444 | 1 | 0 | 0.000319 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.444444 | false | 0 | 0.047619 | 0.444444 | 0.952381 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
82bc85561958032d6e1b248a119ff4c12096b2d3 | 575 | py | Python | courses/python/cursoemvideo/aulas/aula11_cor_no_terminal.py | bdpcampos/public | dda57c265718f3e1cc0d6bce73f149051f5647ef | [
"MIT"
] | 3 | 2020-04-28T01:42:09.000Z | 2020-05-03T12:05:23.000Z | courses/python/cursoemvideo/aulas/aula11_cor_no_terminal.py | bdpcampos/public | dda57c265718f3e1cc0d6bce73f149051f5647ef | [
"MIT"
] | null | null | null | courses/python/cursoemvideo/aulas/aula11_cor_no_terminal.py | bdpcampos/public | dda57c265718f3e1cc0d6bce73f149051f5647ef | [
"MIT"
] | null | null | null |
print('\033[1;30mTeste\033[m')
print('\033[4;33mTeste\033[m')
print('\033[1;34;40mTeste\033[m')
print('\033[30mTeste\033[m')
print('\033[mTeste\033[m')
print('\033[7;30mTeste\033[m')
a = 3
b = 5
print('Os valores são \33[1;32m{}\033[m e \033[1;31m{}\033[m !!!'.format(a,b))
nome = 'Bruno'
print('Olá {}{}{} !!'.format('\033[4;34m',nome,'\033[m'))
cores = {'limpa':'\033[m',
'azul':'\033[34m',
'amarelo':'\033[33m',
'pretoebranco':'\033[7;30m'}
print('Olá {}{}{} !!'.format(cores['amarelo'], nome, cores['limpa']))
#pesquisar Colorize do python | 26.136364 | 78 | 0.58087 | 94 | 575 | 3.553191 | 0.404255 | 0.11976 | 0.134731 | 0.179641 | 0.11976 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196429 | 0.123478 | 575 | 22 | 79 | 26.136364 | 0.46627 | 0.048696 | 0 | 0 | 0 | 0.0625 | 0.547619 | 0.159341 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5625 | 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 | 1 | 0 | 3 |
82d8d61f727265c3b704abd4482c4064302ffe63 | 171 | py | Python | ast/example_ast_parse_cpy.py | MaxTurchin/pycopy-lib | d7a69fc2a28031e2ca475c29239f715c1809d8cc | [
"PSF-2.0"
] | 126 | 2019-07-19T14:42:41.000Z | 2022-03-21T22:22:19.000Z | ast/example_ast_parse_cpy.py | MaxTurchin/pycopy-lib | d7a69fc2a28031e2ca475c29239f715c1809d8cc | [
"PSF-2.0"
] | 38 | 2019-08-28T01:46:31.000Z | 2022-03-17T05:46:51.000Z | ast/example_ast_parse_cpy.py | MaxTurchin/pycopy-lib | d7a69fc2a28031e2ca475c29239f715c1809d8cc | [
"PSF-2.0"
] | 55 | 2019-08-02T09:32:33.000Z | 2021-12-22T11:25:51.000Z | import sys
sys.path.pop(0)
import ast
sys.path.insert(0, ".")
import _tool_ast_pprint as ast_pprint
t = ast.parse(open(sys.argv[1]).read())
ast_pprint.dump_to_stdout(t)
| 17.1 | 39 | 0.74269 | 33 | 171 | 3.636364 | 0.575758 | 0.225 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019481 | 0.099415 | 171 | 9 | 40 | 19 | 0.75974 | 0 | 0 | 0 | 0 | 0 | 0.005848 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.428571 | 0 | 0.428571 | 0.285714 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
82e90b2c3822ae607a93907a9db72e2d36e03e83 | 609 | py | Python | echo/s3.py | aaronlelevier/githook-echo-server | 7ce19ab90e8324f4889e04255ff7376f24a7e42f | [
"Apache-2.0"
] | null | null | null | echo/s3.py | aaronlelevier/githook-echo-server | 7ce19ab90e8324f4889e04255ff7376f24a7e42f | [
"Apache-2.0"
] | null | null | null | echo/s3.py | aaronlelevier/githook-echo-server | 7ce19ab90e8324f4889e04255ff7376f24a7e42f | [
"Apache-2.0"
] | null | null | null | import os
import io
import base64
import boto3
from echo import git
from echo.const import BUCKET_NAME
def get_boto_client(aws_service, **kwargs):
return boto3.client(aws_service, **kwargs)
def sync_files(files):
"""
Syncs files to S3
"""
ret = []
client = get_boto_client("s3")
for f in files:
# TODO(aaronlelevier): log or check response
client.put_object(
Bucket=os.environ[BUCKET_NAME],
Key=f["filename"],
Body=git.fetch_file_contents(f["contents_url"]),
)
ret.append(f["filename"])
return ret
| 17.4 | 60 | 0.622332 | 80 | 609 | 4.575 | 0.5625 | 0.043716 | 0.071038 | 0.120219 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013514 | 0.270936 | 609 | 34 | 61 | 17.911765 | 0.810811 | 0.100164 | 0 | 0 | 0 | 0 | 0.056391 | 0 | 0 | 0 | 0 | 0.029412 | 0 | 1 | 0.105263 | false | 0 | 0.315789 | 0.052632 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
7d5669c95848ea90b453e59d8c54729fb9eb6204 | 168,790 | py | Python | tencentcloud/iotvideo/v20201215/models.py | HS-Gray/tencentcloud-sdk-python | b28b19c4beebc9f361aa3221afa36ad1ee047ccc | [
"Apache-2.0"
] | 37 | 2017-10-12T01:50:42.000Z | 2022-02-24T02:44:45.000Z | tencentcloud/iotvideo/v20201215/models.py | HS-Gray/tencentcloud-sdk-python | b28b19c4beebc9f361aa3221afa36ad1ee047ccc | [
"Apache-2.0"
] | null | null | null | tencentcloud/iotvideo/v20201215/models.py | HS-Gray/tencentcloud-sdk-python | b28b19c4beebc9f361aa3221afa36ad1ee047ccc | [
"Apache-2.0"
] | 12 | 2018-07-31T10:04:56.000Z | 2022-02-07T00:08:06.000Z | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import warnings
from tencentcloud.common.abstract_model import AbstractModel
class AIModelApplication(AbstractModel):
"""AI模型申请信息
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param ProductName: 产品名称
:type ProductName: str
:param Status: 申请状态:1-已申请;2-已取消;3-已拒绝;4-已通过
:type Status: int
"""
self.ProductId = None
self.ProductName = None
self.Status = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ProductName = params.get("ProductName")
self.Status = params.get("Status")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class AIModelInfo(AbstractModel):
"""AI模型信息
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param ProductName: 产品名称
:type ProductName: str
:param Status: 申请状态:1-已申请;2-已取消;3-已拒绝;4-已通过
:type Status: int
:param Total: 可调用数量
:type Total: int
:param Used: 已调用数量
:type Used: int
:param ApplyTime: 申请时间
:type ApplyTime: int
:param ApprovalTime: 审批通过时间
:type ApprovalTime: int
"""
self.ProductId = None
self.ProductName = None
self.Status = None
self.Total = None
self.Used = None
self.ApplyTime = None
self.ApprovalTime = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ProductName = params.get("ProductName")
self.Status = params.get("Status")
self.Total = params.get("Total")
self.Used = params.get("Used")
self.ApplyTime = params.get("ApplyTime")
self.ApprovalTime = params.get("ApprovalTime")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class AIModelUsageInfo(AbstractModel):
"""AI模型资源使用信息
"""
def __init__(self):
r"""
:param CreateTime: 开通时间
:type CreateTime: int
:param Total: 资源总量
:type Total: int
:param Used: 已使用资源数量
:type Used: int
"""
self.CreateTime = None
self.Total = None
self.Used = None
def _deserialize(self, params):
self.CreateTime = params.get("CreateTime")
self.Total = params.get("Total")
self.Used = params.get("Used")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ActionHistory(AbstractModel):
"""查询设备历史
"""
def __init__(self):
r"""
:param DeviceName: 设备名称
:type DeviceName: str
:param ActionId: 动作Id
:type ActionId: str
:param ActionName: 动作名称
:type ActionName: str
:param ReqTime: 请求时间
:type ReqTime: int
:param RspTime: 响应时间
:type RspTime: int
:param InputParams: 输入参数
注意:此字段可能返回 null,表示取不到有效值。
:type InputParams: str
:param OutputParams: 输出参数
注意:此字段可能返回 null,表示取不到有效值。
:type OutputParams: str
:param Calling: 调用方式
:type Calling: str
:param ClientToken: 调用Id
:type ClientToken: str
:param Status: 调用状态
:type Status: str
"""
self.DeviceName = None
self.ActionId = None
self.ActionName = None
self.ReqTime = None
self.RspTime = None
self.InputParams = None
self.OutputParams = None
self.Calling = None
self.ClientToken = None
self.Status = None
def _deserialize(self, params):
self.DeviceName = params.get("DeviceName")
self.ActionId = params.get("ActionId")
self.ActionName = params.get("ActionName")
self.ReqTime = params.get("ReqTime")
self.RspTime = params.get("RspTime")
self.InputParams = params.get("InputParams")
self.OutputParams = params.get("OutputParams")
self.Calling = params.get("Calling")
self.ClientToken = params.get("ClientToken")
self.Status = params.get("Status")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ApplyAIModelRequest(AbstractModel):
"""ApplyAIModel请求参数结构体
"""
def __init__(self):
r"""
:param ModelId: AI模型ID
:type ModelId: str
:param ProductId: 产品ID
:type ProductId: str
"""
self.ModelId = None
self.ProductId = None
def _deserialize(self, params):
self.ModelId = params.get("ModelId")
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ApplyAIModelResponse(AbstractModel):
"""ApplyAIModel返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class BalanceTransaction(AbstractModel):
"""账户流水
"""
def __init__(self):
r"""
:param AccountType: 账户类型:1-设备接入 2-云存。
:type AccountType: int
:param Operation: 账户变更类型:Rechareg-充值;CreateOrder-新购。
:type Operation: str
:param DealId: 流水ID。
:type DealId: str
:param Amount: 变更金额,单位:分(人民币)。
:type Amount: int
:param Balance: 变更后账户余额,单位:分(人民币)。
:type Balance: int
:param OperationTime: 变更时间。
:type OperationTime: int
"""
self.AccountType = None
self.Operation = None
self.DealId = None
self.Amount = None
self.Balance = None
self.OperationTime = None
def _deserialize(self, params):
self.AccountType = params.get("AccountType")
self.Operation = params.get("Operation")
self.DealId = params.get("DealId")
self.Amount = params.get("Amount")
self.Balance = params.get("Balance")
self.OperationTime = params.get("OperationTime")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class BatchUpdateFirmwareRequest(AbstractModel):
"""BatchUpdateFirmware请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件新版本号
:type FirmwareVersion: str
:param FirmwareOriVersion: 固件原版本号,根据文件列表升级固件不需要填写此参数
:type FirmwareOriVersion: str
:param UpgradeMethod: 升级方式,0 静默升级 1 用户确认升级。 不填默认为静默升级方式
:type UpgradeMethod: int
:param FileName: 设备列表文件名称,根据文件列表升级固件需要填写此参数
:type FileName: str
:param FileMd5: 设备列表的文件md5值
:type FileMd5: str
:param FileSize: 设备列表的文件大小值
:type FileSize: int
:param DeviceNames: 需要升级的设备名称列表
:type DeviceNames: list of str
"""
self.ProductID = None
self.FirmwareVersion = None
self.FirmwareOriVersion = None
self.UpgradeMethod = None
self.FileName = None
self.FileMd5 = None
self.FileSize = None
self.DeviceNames = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
self.FirmwareOriVersion = params.get("FirmwareOriVersion")
self.UpgradeMethod = params.get("UpgradeMethod")
self.FileName = params.get("FileName")
self.FileMd5 = params.get("FileMd5")
self.FileSize = params.get("FileSize")
self.DeviceNames = params.get("DeviceNames")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class BatchUpdateFirmwareResponse(AbstractModel):
"""BatchUpdateFirmware返回参数结构体
"""
def __init__(self):
r"""
:param TaskId: 任务ID
:type TaskId: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TaskId = None
self.RequestId = None
def _deserialize(self, params):
self.TaskId = params.get("TaskId")
self.RequestId = params.get("RequestId")
class BindCloudStorageUserRequest(AbstractModel):
"""BindCloudStorageUser请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param UserId: 用户ID
:type UserId: str
"""
self.ProductId = None
self.DeviceName = None
self.UserId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.UserId = params.get("UserId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class BindCloudStorageUserResponse(AbstractModel):
"""BindCloudStorageUser返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class CancelAIModelApplicationRequest(AbstractModel):
"""CancelAIModelApplication请求参数结构体
"""
def __init__(self):
r"""
:param ModelId: AI模型ID
:type ModelId: str
:param ProductId: 产品ID
:type ProductId: str
"""
self.ModelId = None
self.ProductId = None
def _deserialize(self, params):
self.ModelId = params.get("ModelId")
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CancelAIModelApplicationResponse(AbstractModel):
"""CancelAIModelApplication返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class CancelDeviceFirmwareTaskRequest(AbstractModel):
"""CancelDeviceFirmwareTask请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param DeviceName: 设备名称
:type DeviceName: str
:param FirmwareVersion: 固件版本号
:type FirmwareVersion: str
:param TaskId: 固件升级任务ID
:type TaskId: int
"""
self.ProductID = None
self.DeviceName = None
self.FirmwareVersion = None
self.TaskId = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.DeviceName = params.get("DeviceName")
self.FirmwareVersion = params.get("FirmwareVersion")
self.TaskId = params.get("TaskId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CancelDeviceFirmwareTaskResponse(AbstractModel):
"""CancelDeviceFirmwareTask返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class CheckForwardAuthRequest(AbstractModel):
"""CheckForwardAuth请求参数结构体
"""
def __init__(self):
r"""
:param Skey: 控制台Skey
:type Skey: str
:param QueueType: 队列类型 0.CMQ 1.Ckafka
:type QueueType: int
"""
self.Skey = None
self.QueueType = None
def _deserialize(self, params):
self.Skey = params.get("Skey")
self.QueueType = params.get("QueueType")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CheckForwardAuthResponse(AbstractModel):
"""CheckForwardAuth返回参数结构体
"""
def __init__(self):
r"""
:param Endpoint: 腾讯云账号
:type Endpoint: str
:param Result: 结果
:type Result: int
:param Productid: 产品ID
:type Productid: str
:param ErrMsg: 错误消息
:type ErrMsg: str
:param QueueType: 队列类型 0.CMQ 1.Ckafka
:type QueueType: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Endpoint = None
self.Result = None
self.Productid = None
self.ErrMsg = None
self.QueueType = None
self.RequestId = None
def _deserialize(self, params):
self.Endpoint = params.get("Endpoint")
self.Result = params.get("Result")
self.Productid = params.get("Productid")
self.ErrMsg = params.get("ErrMsg")
self.QueueType = params.get("QueueType")
self.RequestId = params.get("RequestId")
class CloudStorageEvent(AbstractModel):
"""云存事件
"""
def __init__(self):
r"""
:param StartTime: 事件起始时间(Unix 时间戳,秒级
:type StartTime: int
:param EndTime: 事件结束时间(Unix 时间戳,秒级
:type EndTime: int
:param Thumbnail: 事件缩略图
:type Thumbnail: str
:param EventId: 事件ID
:type EventId: str
"""
self.StartTime = None
self.EndTime = None
self.Thumbnail = None
self.EventId = None
def _deserialize(self, params):
self.StartTime = params.get("StartTime")
self.EndTime = params.get("EndTime")
self.Thumbnail = params.get("Thumbnail")
self.EventId = params.get("EventId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CloudStorageTimeData(AbstractModel):
"""云存时间轴接口返回数据
"""
def __init__(self):
r"""
:param TimeList: 云存时间轴信息列表
:type TimeList: list of CloudStorageTimeInfo
:param VideoURL: 播放地址
:type VideoURL: str
"""
self.TimeList = None
self.VideoURL = None
def _deserialize(self, params):
if params.get("TimeList") is not None:
self.TimeList = []
for item in params.get("TimeList"):
obj = CloudStorageTimeInfo()
obj._deserialize(item)
self.TimeList.append(obj)
self.VideoURL = params.get("VideoURL")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CloudStorageTimeInfo(AbstractModel):
"""云存时间轴信息
"""
def __init__(self):
r"""
:param StartTime: 开始时间
:type StartTime: int
:param EndTime: 结束时间
:type EndTime: int
"""
self.StartTime = None
self.EndTime = None
def _deserialize(self, params):
self.StartTime = params.get("StartTime")
self.EndTime = params.get("EndTime")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CloudStorageUserInfo(AbstractModel):
"""云存用户信息
"""
def __init__(self):
r"""
:param UserId: 用户ID
:type UserId: str
"""
self.UserId = None
def _deserialize(self, params):
self.UserId = params.get("UserId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ControlDeviceDataRequest(AbstractModel):
"""ControlDeviceData请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Data: 属性数据, JSON格式字符串, 注意字段需要在物模型属性里定义
:type Data: str
:param Method: 请求类型 , 不填该参数或者 desired 表示下发属性给设备, reported 表示模拟设备上报属性
:type Method: str
:param DataTimestamp: 上报数据UNIX时间戳(毫秒), 仅对Method:reported有效
:type DataTimestamp: int
"""
self.ProductId = None
self.DeviceName = None
self.Data = None
self.Method = None
self.DataTimestamp = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.Data = params.get("Data")
self.Method = params.get("Method")
self.DataTimestamp = params.get("DataTimestamp")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ControlDeviceDataResponse(AbstractModel):
"""ControlDeviceData返回参数结构体
"""
def __init__(self):
r"""
:param Data: 返回信息
:type Data: str
:param Result: JSON字符串, 返回下发控制的结果信息,
Sent = 1 表示设备已经在线并且订阅了控制下发的mqtt topic
注意:此字段可能返回 null,表示取不到有效值。
:type Result: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.Result = None
self.RequestId = None
def _deserialize(self, params):
self.Data = params.get("Data")
self.Result = params.get("Result")
self.RequestId = params.get("RequestId")
class CreateAIDetectionRequest(AbstractModel):
"""CreateAIDetection请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param ModelId: AI模型ID
:type ModelId: str
:param StartTime: 图片上传的开始时间
:type StartTime: int
:param EndTime: 图片上传的结束时间
:type EndTime: int
"""
self.ProductId = None
self.DeviceName = None
self.ModelId = None
self.StartTime = None
self.EndTime = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.ModelId = params.get("ModelId")
self.StartTime = params.get("StartTime")
self.EndTime = params.get("EndTime")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateAIDetectionResponse(AbstractModel):
"""CreateAIDetection返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class CreateBatchRequest(AbstractModel):
"""CreateBatch请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DevNum: 批次创建的设备数量
:type DevNum: int
:param DevPre: 批次创建的设备前缀。不超过24个字符
:type DevPre: str
"""
self.ProductId = None
self.DevNum = None
self.DevPre = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DevNum = params.get("DevNum")
self.DevPre = params.get("DevPre")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateBatchResponse(AbstractModel):
"""CreateBatch返回参数结构体
"""
def __init__(self):
r"""
:param BatchId: 批次ID
:type BatchId: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.BatchId = None
self.RequestId = None
def _deserialize(self, params):
self.BatchId = params.get("BatchId")
self.RequestId = params.get("RequestId")
class CreateCOSCredentialsRequest(AbstractModel):
"""CreateCOSCredentials请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
"""
self.ProductId = None
self.DeviceName = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateCOSCredentialsResponse(AbstractModel):
"""CreateCOSCredentials返回参数结构体
"""
def __init__(self):
r"""
:param StorageBucket: COS存储桶名称
:type StorageBucket: str
:param StorageRegion: COS存储桶区域
:type StorageRegion: str
:param StoragePath: COS存储桶路径
:type StoragePath: str
:param SecretID: COS上传用的SecretID
:type SecretID: str
:param SecretKey: COS上传用的SecretKey
:type SecretKey: str
:param Token: COS上传用的Token
:type Token: str
:param ExpiredTime: 密钥信息过期时间
:type ExpiredTime: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.StorageBucket = None
self.StorageRegion = None
self.StoragePath = None
self.SecretID = None
self.SecretKey = None
self.Token = None
self.ExpiredTime = None
self.RequestId = None
def _deserialize(self, params):
self.StorageBucket = params.get("StorageBucket")
self.StorageRegion = params.get("StorageRegion")
self.StoragePath = params.get("StoragePath")
self.SecretID = params.get("SecretID")
self.SecretKey = params.get("SecretKey")
self.Token = params.get("Token")
self.ExpiredTime = params.get("ExpiredTime")
self.RequestId = params.get("RequestId")
class CreateCloudStorageRequest(AbstractModel):
"""CreateCloudStorage请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param PackageId: 云存套餐ID:
yc1m3d : 全时3天存储月套餐。
yc1m7d : 全时7天存储月套餐。
yc1m30d :全时30天存储月套餐。
yc1y3d :全时3天存储年套餐。
yc1y7d :全时7天存储年套餐。
yc1y30d :全时30天存储年套餐。
ye1m3d :事件3天存储月套餐。
ye1m7d :事件7天存储月套餐。
ye1m30d :事件30天存储月套餐 。
ye1y3d :事件3天存储年套餐。
ye1y7d :事件7天存储年套餐。
ye1y30d :事件30天存储年套餐。
yc1w7d : 全时7天存储周套餐。
ye1w7d : 事件7天存储周套餐。
:type PackageId: str
:param Override: 如果当前设备已开启云存套餐,Override=1会使用新套餐覆盖原有套餐。不传此参数则默认为0。
:type Override: int
"""
self.ProductId = None
self.DeviceName = None
self.PackageId = None
self.Override = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.PackageId = params.get("PackageId")
self.Override = params.get("Override")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateCloudStorageResponse(AbstractModel):
"""CreateCloudStorage返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class CreateDataForwardRequest(AbstractModel):
"""CreateDataForward请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID。
:type ProductId: str
:param ForwardAddr: 转发地址。如果有鉴权Token,则需要自行传入,例如 [{\"forward\":{\"api\":\"http://123.207.117.108:1080/sub.php\",\"token\":\"testtoken\"}}]
:type ForwardAddr: str
:param DataChose: 1-数据信息转发 2-设备上下线状态转发 3-数据信息转发&设备上下线状态转发
:type DataChose: int
"""
self.ProductId = None
self.ForwardAddr = None
self.DataChose = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ForwardAddr = params.get("ForwardAddr")
self.DataChose = params.get("DataChose")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateDataForwardResponse(AbstractModel):
"""CreateDataForward返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class CreateForwardRuleRequest(AbstractModel):
"""CreateForwardRule请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param MsgType: 消息类型
:type MsgType: int
:param Skey: 控制台Skey
:type Skey: str
:param QueueRegion: 队列区域
:type QueueRegion: str
:param QueueType: 队列类型 0.CMQ 1.Ckafka
:type QueueType: int
:param Consecretid: 临时密钥
:type Consecretid: str
:param InstanceId: 实例ID
:type InstanceId: str
:param InstanceName: 实例名称
:type InstanceName: str
:param QueueID: 队列或主题ID
:type QueueID: str
:param QueueName: 队列或主题名称
:type QueueName: str
"""
self.ProductID = None
self.MsgType = None
self.Skey = None
self.QueueRegion = None
self.QueueType = None
self.Consecretid = None
self.InstanceId = None
self.InstanceName = None
self.QueueID = None
self.QueueName = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.MsgType = params.get("MsgType")
self.Skey = params.get("Skey")
self.QueueRegion = params.get("QueueRegion")
self.QueueType = params.get("QueueType")
self.Consecretid = params.get("Consecretid")
self.InstanceId = params.get("InstanceId")
self.InstanceName = params.get("InstanceName")
self.QueueID = params.get("QueueID")
self.QueueName = params.get("QueueName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateForwardRuleResponse(AbstractModel):
"""CreateForwardRule返回参数结构体
"""
def __init__(self):
r"""
:param Endpoint: 腾讯云账号
:type Endpoint: str
:param QueueName: 队列名
:type QueueName: str
:param ProductID: 产品ID
:type ProductID: str
:param MsgType: 消息类型
:type MsgType: int
:param Result: 结果
:type Result: int
:param RoleName: 角色名称
:type RoleName: str
:param RoleID: 角色ID
:type RoleID: int
:param QueueRegion: 队列区
:type QueueRegion: str
:param QueueType: 消息队列的类型。 0:CMQ,1:CKafaka
:type QueueType: int
:param InstanceId: 实例id, 目前只有Ckafaka会用到
:type InstanceId: str
:param InstanceName: 实例名称,目前只有Ckafaka会用到
:type InstanceName: str
:param ErrMsg: 错误消息
:type ErrMsg: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Endpoint = None
self.QueueName = None
self.ProductID = None
self.MsgType = None
self.Result = None
self.RoleName = None
self.RoleID = None
self.QueueRegion = None
self.QueueType = None
self.InstanceId = None
self.InstanceName = None
self.ErrMsg = None
self.RequestId = None
def _deserialize(self, params):
self.Endpoint = params.get("Endpoint")
self.QueueName = params.get("QueueName")
self.ProductID = params.get("ProductID")
self.MsgType = params.get("MsgType")
self.Result = params.get("Result")
self.RoleName = params.get("RoleName")
self.RoleID = params.get("RoleID")
self.QueueRegion = params.get("QueueRegion")
self.QueueType = params.get("QueueType")
self.InstanceId = params.get("InstanceId")
self.InstanceName = params.get("InstanceName")
self.ErrMsg = params.get("ErrMsg")
self.RequestId = params.get("RequestId")
class CreateProductRequest(AbstractModel):
"""CreateProduct请求参数结构体
"""
def __init__(self):
r"""
:param ProductName: 产品名称
:type ProductName: str
:param DeviceType: 产品设备类型 1.普通设备 2.NVR设备
:type DeviceType: int
:param ProductVaildYears: 产品有效期
:type ProductVaildYears: int
:param Features: 设备功能码 ypsxth音频双向通话 spdxth视频单向通话
:type Features: list of str
:param ChipOs: 设备操作系统,通用设备填default
:type ChipOs: str
:param ChipManufactureId: 芯片厂商id,通用设备填default
:type ChipManufactureId: str
:param ChipId: 芯片id,通用设备填default
:type ChipId: str
:param ProductDescription: 产品描述信息
:type ProductDescription: str
:param EncryptionType: 认证方式 只支持取值为2 psk认证
:type EncryptionType: int
:param NetType: 连接类型,wifi表示WIFI连接,cellular表示4G连接
:type NetType: str
"""
self.ProductName = None
self.DeviceType = None
self.ProductVaildYears = None
self.Features = None
self.ChipOs = None
self.ChipManufactureId = None
self.ChipId = None
self.ProductDescription = None
self.EncryptionType = None
self.NetType = None
def _deserialize(self, params):
self.ProductName = params.get("ProductName")
self.DeviceType = params.get("DeviceType")
self.ProductVaildYears = params.get("ProductVaildYears")
self.Features = params.get("Features")
self.ChipOs = params.get("ChipOs")
self.ChipManufactureId = params.get("ChipManufactureId")
self.ChipId = params.get("ChipId")
self.ProductDescription = params.get("ProductDescription")
self.EncryptionType = params.get("EncryptionType")
self.NetType = params.get("NetType")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateProductResponse(AbstractModel):
"""CreateProduct返回参数结构体
"""
def __init__(self):
r"""
:param Data: 产品详情
:type Data: :class:`tencentcloud.iotvideo.v20201215.models.VideoProduct`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.RequestId = None
def _deserialize(self, params):
if params.get("Data") is not None:
self.Data = VideoProduct()
self.Data._deserialize(params.get("Data"))
self.RequestId = params.get("RequestId")
class CreateTaskFileUrlRequest(AbstractModel):
"""CreateTaskFileUrl请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
"""
self.ProductId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class CreateTaskFileUrlResponse(AbstractModel):
"""CreateTaskFileUrl返回参数结构体
"""
def __init__(self):
r"""
:param Url: 任务文件上传链接
:type Url: str
:param FileName: 任务文件名
:type FileName: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Url = None
self.FileName = None
self.RequestId = None
def _deserialize(self, params):
self.Url = params.get("Url")
self.FileName = params.get("FileName")
self.RequestId = params.get("RequestId")
class DataForward(AbstractModel):
"""数据转发描述
"""
def __init__(self):
r"""
:param ProductId: 产品ID。
:type ProductId: str
:param ForwardAddr: 转发地址。
:type ForwardAddr: str
:param Status: 转发状态。
:type Status: int
:param CreateTime: 创建时间。
:type CreateTime: int
:param UpdateTime: 更新时间。
:type UpdateTime: int
:param DataChose: 1-数据信息转发 2-设备上下线状态转发 3-数据信息转发&设备上下线状态转发
注意:此字段可能返回 null,表示取不到有效值。
:type DataChose: int
"""
self.ProductId = None
self.ForwardAddr = None
self.Status = None
self.CreateTime = None
self.UpdateTime = None
self.DataChose = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ForwardAddr = params.get("ForwardAddr")
self.Status = params.get("Status")
self.CreateTime = params.get("CreateTime")
self.UpdateTime = params.get("UpdateTime")
self.DataChose = params.get("DataChose")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeleteDeviceRequest(AbstractModel):
"""DeleteDevice请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID。
:type ProductId: str
:param DeviceName: 设备名称。
:type DeviceName: str
"""
self.ProductId = None
self.DeviceName = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeleteDeviceResponse(AbstractModel):
"""DeleteDevice返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class DeleteFirmwareRequest(AbstractModel):
"""DeleteFirmware请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本
:type FirmwareVersion: str
"""
self.ProductID = None
self.FirmwareVersion = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeleteFirmwareResponse(AbstractModel):
"""DeleteFirmware返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class DeleteForwardRuleRequest(AbstractModel):
"""DeleteForwardRule请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param Skey: 控制台Skey
:type Skey: str
:param QueueType: 队列类型
:type QueueType: int
:param QueueName: 队列名称
:type QueueName: str
"""
self.ProductID = None
self.Skey = None
self.QueueType = None
self.QueueName = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.Skey = params.get("Skey")
self.QueueType = params.get("QueueType")
self.QueueName = params.get("QueueName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeleteForwardRuleResponse(AbstractModel):
"""DeleteForwardRule返回参数结构体
"""
def __init__(self):
r"""
:param Endpoint: 腾讯云账号
:type Endpoint: str
:param QueueName: 队列名称
:type QueueName: str
:param ProductID: 产品ID
:type ProductID: str
:param Result: 删除结果 0成功 其他不成功
:type Result: int
:param ErrMsg: 错误消息
:type ErrMsg: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Endpoint = None
self.QueueName = None
self.ProductID = None
self.Result = None
self.ErrMsg = None
self.RequestId = None
def _deserialize(self, params):
self.Endpoint = params.get("Endpoint")
self.QueueName = params.get("QueueName")
self.ProductID = params.get("ProductID")
self.Result = params.get("Result")
self.ErrMsg = params.get("ErrMsg")
self.RequestId = params.get("RequestId")
class DeleteProductRequest(AbstractModel):
"""DeleteProduct请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
"""
self.ProductId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeleteProductResponse(AbstractModel):
"""DeleteProduct返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class DescribeAIModelApplicationsRequest(AbstractModel):
"""DescribeAIModelApplications请求参数结构体
"""
def __init__(self):
r"""
:param ModelId: 模型ID
:type ModelId: str
:param Limit: 分页的大小,最大100
:type Limit: int
:param Offset: 偏移量,Offset从0开始
:type Offset: int
:param ProductId: 产品ID
:type ProductId: str
"""
self.ModelId = None
self.Limit = None
self.Offset = None
self.ProductId = None
def _deserialize(self, params):
self.ModelId = params.get("ModelId")
self.Limit = params.get("Limit")
self.Offset = params.get("Offset")
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeAIModelApplicationsResponse(AbstractModel):
"""DescribeAIModelApplications返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: 申请记录数量
:type TotalCount: int
:param Applications: 申请记录数组
:type Applications: list of AIModelApplication
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.Applications = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("Applications") is not None:
self.Applications = []
for item in params.get("Applications"):
obj = AIModelApplication()
obj._deserialize(item)
self.Applications.append(obj)
self.RequestId = params.get("RequestId")
class DescribeAIModelChannelRequest(AbstractModel):
"""DescribeAIModelChannel请求参数结构体
"""
def __init__(self):
r"""
:param ModelId: 模型ID
:type ModelId: str
:param ProductId: 产品ID
:type ProductId: str
"""
self.ModelId = None
self.ProductId = None
def _deserialize(self, params):
self.ModelId = params.get("ModelId")
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeAIModelChannelResponse(AbstractModel):
"""DescribeAIModelChannel返回参数结构体
"""
def __init__(self):
r"""
:param Type: 推送类型。ckafka:消息队列;forward:http/https推送
:type Type: str
:param ForwardAddress: 第三方推送地址
注意:此字段可能返回 null,表示取不到有效值。
:type ForwardAddress: str
:param ForwardKey: 第三方推送密钥
注意:此字段可能返回 null,表示取不到有效值。
:type ForwardKey: str
:param CKafkaRegion: ckafka地域
注意:此字段可能返回 null,表示取不到有效值。
:type CKafkaRegion: str
:param CKafkaInstance: ckafka实例
注意:此字段可能返回 null,表示取不到有效值。
:type CKafkaInstance: str
:param CKafkaTopic: ckafka订阅主题
注意:此字段可能返回 null,表示取不到有效值。
:type CKafkaTopic: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Type = None
self.ForwardAddress = None
self.ForwardKey = None
self.CKafkaRegion = None
self.CKafkaInstance = None
self.CKafkaTopic = None
self.RequestId = None
def _deserialize(self, params):
self.Type = params.get("Type")
self.ForwardAddress = params.get("ForwardAddress")
self.ForwardKey = params.get("ForwardKey")
self.CKafkaRegion = params.get("CKafkaRegion")
self.CKafkaInstance = params.get("CKafkaInstance")
self.CKafkaTopic = params.get("CKafkaTopic")
self.RequestId = params.get("RequestId")
class DescribeAIModelUsageRequest(AbstractModel):
"""DescribeAIModelUsage请求参数结构体
"""
def __init__(self):
r"""
:param ModelId: 模型ID
:type ModelId: str
:param ProductId: 产品ID
:type ProductId: str
:param Offset: 偏移量,从0开始
:type Offset: int
:param Limit: 分页的大小,最大100
:type Limit: int
"""
self.ModelId = None
self.ProductId = None
self.Offset = None
self.Limit = None
def _deserialize(self, params):
self.ModelId = params.get("ModelId")
self.ProductId = params.get("ProductId")
self.Offset = params.get("Offset")
self.Limit = params.get("Limit")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeAIModelUsageResponse(AbstractModel):
"""DescribeAIModelUsage返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: AI模型资源包总量
:type TotalCount: int
:param UsageInfo: AI模型资源包信息数组
:type UsageInfo: list of AIModelUsageInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.UsageInfo = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("UsageInfo") is not None:
self.UsageInfo = []
for item in params.get("UsageInfo"):
obj = AIModelUsageInfo()
obj._deserialize(item)
self.UsageInfo.append(obj)
self.RequestId = params.get("RequestId")
class DescribeAIModelsRequest(AbstractModel):
"""DescribeAIModels请求参数结构体
"""
def __init__(self):
r"""
:param ModelId: 模型ID
:type ModelId: str
:param Status: 申请状态:1-已申请;2-已取消;3-已拒绝;4-已通过
:type Status: int
:param Offset: 偏移量,Offset从0开始
:type Offset: int
:param Limit: 分页的大小,最大100
:type Limit: int
"""
self.ModelId = None
self.Status = None
self.Offset = None
self.Limit = None
def _deserialize(self, params):
self.ModelId = params.get("ModelId")
self.Status = params.get("Status")
self.Offset = params.get("Offset")
self.Limit = params.get("Limit")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeAIModelsResponse(AbstractModel):
"""DescribeAIModels返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: AI模型数量
:type TotalCount: int
:param Models: AI模型信息数组
:type Models: list of AIModelInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.Models = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("Models") is not None:
self.Models = []
for item in params.get("Models"):
obj = AIModelInfo()
obj._deserialize(item)
self.Models.append(obj)
self.RequestId = params.get("RequestId")
class DescribeBalanceRequest(AbstractModel):
"""DescribeBalance请求参数结构体
"""
def __init__(self):
r"""
:param AccountType: 账户类型:1-设备接入;2-云存。
:type AccountType: int
"""
self.AccountType = None
def _deserialize(self, params):
self.AccountType = params.get("AccountType")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeBalanceResponse(AbstractModel):
"""DescribeBalance返回参数结构体
"""
def __init__(self):
r"""
:param Balance: 账户余额,单位:分(人民币)。
:type Balance: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Balance = None
self.RequestId = None
def _deserialize(self, params):
self.Balance = params.get("Balance")
self.RequestId = params.get("RequestId")
class DescribeBalanceTransactionsRequest(AbstractModel):
"""DescribeBalanceTransactions请求参数结构体
"""
def __init__(self):
r"""
:param AccountType: 账户类型:1-设备接入;2-云存。
:type AccountType: int
:param Offset: 分页游标开始,默认为0开始拉取第一条。
:type Offset: int
:param Limit: 分页每页数量。
:type Limit: int
:param Operation: 流水类型:All-全部类型;Recharge-充值;CreateOrder-新购。默认为All
:type Operation: str
"""
self.AccountType = None
self.Offset = None
self.Limit = None
self.Operation = None
def _deserialize(self, params):
self.AccountType = params.get("AccountType")
self.Offset = params.get("Offset")
self.Limit = params.get("Limit")
self.Operation = params.get("Operation")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeBalanceTransactionsResponse(AbstractModel):
"""DescribeBalanceTransactions返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: 账户流水总数。
:type TotalCount: int
:param Transactions: 账户流水详情数组。
:type Transactions: list of BalanceTransaction
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.Transactions = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("Transactions") is not None:
self.Transactions = []
for item in params.get("Transactions"):
obj = BalanceTransaction()
obj._deserialize(item)
self.Transactions.append(obj)
self.RequestId = params.get("RequestId")
class DescribeBatchRequest(AbstractModel):
"""DescribeBatch请求参数结构体
"""
def __init__(self):
r"""
:param BatchId: 批次ID
:type BatchId: int
"""
self.BatchId = None
def _deserialize(self, params):
self.BatchId = params.get("BatchId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeBatchResponse(AbstractModel):
"""DescribeBatch返回参数结构体
"""
def __init__(self):
r"""
:param Data: 批次详情
:type Data: :class:`tencentcloud.iotvideo.v20201215.models.VideoBatch`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.RequestId = None
def _deserialize(self, params):
if params.get("Data") is not None:
self.Data = VideoBatch()
self.Data._deserialize(params.get("Data"))
self.RequestId = params.get("RequestId")
class DescribeBatchsRequest(AbstractModel):
"""DescribeBatchs请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param Limit: 分页的大小,最大100
:type Limit: int
:param Offset: 偏移量,Offset从0开始
:type Offset: int
"""
self.ProductId = None
self.Limit = None
self.Offset = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.Limit = params.get("Limit")
self.Offset = params.get("Offset")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeBatchsResponse(AbstractModel):
"""DescribeBatchs返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: 批次数量
:type TotalCount: int
:param Data: 批次列表详情
:type Data: list of VideoBatch
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.Data = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("Data") is not None:
self.Data = []
for item in params.get("Data"):
obj = VideoBatch()
obj._deserialize(item)
self.Data.append(obj)
self.RequestId = params.get("RequestId")
class DescribeCategoryRequest(AbstractModel):
"""DescribeCategory请求参数结构体
"""
def __init__(self):
r"""
:param Id: Category ID。
:type Id: int
"""
self.Id = None
def _deserialize(self, params):
self.Id = params.get("Id")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeCategoryResponse(AbstractModel):
"""DescribeCategory返回参数结构体
"""
def __init__(self):
r"""
:param Data: Category详情
:type Data: :class:`tencentcloud.iotvideo.v20201215.models.ProductTemplate`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.RequestId = None
def _deserialize(self, params):
if params.get("Data") is not None:
self.Data = ProductTemplate()
self.Data._deserialize(params.get("Data"))
self.RequestId = params.get("RequestId")
class DescribeCloudStorageDateRequest(AbstractModel):
"""DescribeCloudStorageDate请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param UserId: 用户ID
:type UserId: str
"""
self.ProductId = None
self.DeviceName = None
self.UserId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.UserId = params.get("UserId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeCloudStorageDateResponse(AbstractModel):
"""DescribeCloudStorageDate返回参数结构体
"""
def __init__(self):
r"""
:param Data: 云存日期数组,["2021-01-05","2021-01-06"]
:type Data: list of str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.RequestId = None
def _deserialize(self, params):
self.Data = params.get("Data")
self.RequestId = params.get("RequestId")
class DescribeCloudStorageEventsRequest(AbstractModel):
"""DescribeCloudStorageEvents请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param StartTime: 起始时间(Unix 时间戳,秒级), 为0 表示 当前时间 - 24h
:type StartTime: int
:param EndTime: 结束时间(Unix 时间戳,秒级), 为0 表示当前时间
:type EndTime: int
:param Context: 请求上下文, 用作查询游标
:type Context: str
:param Size: 单次获取的历史数据项目的最大数量, 缺省10
:type Size: int
:param EventId: 事件标识符,可以用来指定查询特定的事件,如果不指定,则查询所有事件。
:type EventId: str
:param UserId: 用户ID
:type UserId: str
:param ChannelId: 通道ID 非NVR设备则不填 NVR设备则必填 默认为无
:type ChannelId: int
"""
self.ProductId = None
self.DeviceName = None
self.StartTime = None
self.EndTime = None
self.Context = None
self.Size = None
self.EventId = None
self.UserId = None
self.ChannelId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.StartTime = params.get("StartTime")
self.EndTime = params.get("EndTime")
self.Context = params.get("Context")
self.Size = params.get("Size")
self.EventId = params.get("EventId")
self.UserId = params.get("UserId")
self.ChannelId = params.get("ChannelId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeCloudStorageEventsResponse(AbstractModel):
"""DescribeCloudStorageEvents返回参数结构体
"""
def __init__(self):
r"""
:param Events: 云存事件列表
:type Events: list of CloudStorageEvent
:param Context: 请求上下文, 用作查询游标
:type Context: str
:param Listover: 拉取结果是否已经结束
:type Listover: bool
:param Total: 内部结果数量,并不等同于事件总数。
:type Total: int
:param VideoURL: 视频播放URL
:type VideoURL: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Events = None
self.Context = None
self.Listover = None
self.Total = None
self.VideoURL = None
self.RequestId = None
def _deserialize(self, params):
if params.get("Events") is not None:
self.Events = []
for item in params.get("Events"):
obj = CloudStorageEvent()
obj._deserialize(item)
self.Events.append(obj)
self.Context = params.get("Context")
self.Listover = params.get("Listover")
self.Total = params.get("Total")
self.VideoURL = params.get("VideoURL")
self.RequestId = params.get("RequestId")
class DescribeCloudStorageRequest(AbstractModel):
"""DescribeCloudStorage请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param UserId: 云存用户ID
:type UserId: str
"""
self.ProductId = None
self.DeviceName = None
self.UserId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.UserId = params.get("UserId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeCloudStorageResponse(AbstractModel):
"""DescribeCloudStorage返回参数结构体
"""
def __init__(self):
r"""
:param Status: 云存开启状态,1为开启,0为未开启或已过期
:type Status: int
:param Type: 云存类型,1为全时云存,2为事件云存
:type Type: int
:param ExpireTime: 云存套餐过期时间
:type ExpireTime: int
:param ShiftDuration: 云存回看时长
:type ShiftDuration: int
:param UserId: 云存用户ID
注意:此字段可能返回 null,表示取不到有效值。
:type UserId: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Status = None
self.Type = None
self.ExpireTime = None
self.ShiftDuration = None
self.UserId = None
self.RequestId = None
def _deserialize(self, params):
self.Status = params.get("Status")
self.Type = params.get("Type")
self.ExpireTime = params.get("ExpireTime")
self.ShiftDuration = params.get("ShiftDuration")
self.UserId = params.get("UserId")
self.RequestId = params.get("RequestId")
class DescribeCloudStorageThumbnailRequest(AbstractModel):
"""DescribeCloudStorageThumbnail请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Thumbnail: 缩略图文件名
:type Thumbnail: str
"""
self.ProductId = None
self.DeviceName = None
self.Thumbnail = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.Thumbnail = params.get("Thumbnail")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeCloudStorageThumbnailResponse(AbstractModel):
"""DescribeCloudStorageThumbnail返回参数结构体
"""
def __init__(self):
r"""
:param ThumbnailURL: 缩略图访问地址
:type ThumbnailURL: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.ThumbnailURL = None
self.RequestId = None
def _deserialize(self, params):
self.ThumbnailURL = params.get("ThumbnailURL")
self.RequestId = params.get("RequestId")
class DescribeCloudStorageTimeRequest(AbstractModel):
"""DescribeCloudStorageTime请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Date: 云存日期,例如"2020-01-05"
:type Date: str
:param StartTime: 开始时间,unix时间
:type StartTime: int
:param EndTime: 结束时间,unix时间
:type EndTime: int
:param UserId: 用户ID
:type UserId: str
"""
self.ProductId = None
self.DeviceName = None
self.Date = None
self.StartTime = None
self.EndTime = None
self.UserId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.Date = params.get("Date")
self.StartTime = params.get("StartTime")
self.EndTime = params.get("EndTime")
self.UserId = params.get("UserId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeCloudStorageTimeResponse(AbstractModel):
"""DescribeCloudStorageTime返回参数结构体
"""
def __init__(self):
r"""
:param Data: 接口返回数据
:type Data: :class:`tencentcloud.iotvideo.v20201215.models.CloudStorageTimeData`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.RequestId = None
def _deserialize(self, params):
if params.get("Data") is not None:
self.Data = CloudStorageTimeData()
self.Data._deserialize(params.get("Data"))
self.RequestId = params.get("RequestId")
class DescribeCloudStorageUsersRequest(AbstractModel):
"""DescribeCloudStorageUsers请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Limit: 分页拉取数量
:type Limit: int
:param Offset: 分页拉取偏移
:type Offset: int
"""
self.ProductId = None
self.DeviceName = None
self.Limit = None
self.Offset = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.Limit = params.get("Limit")
self.Offset = params.get("Offset")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeCloudStorageUsersResponse(AbstractModel):
"""DescribeCloudStorageUsers返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: 用户总数
:type TotalCount: int
:param Users: 用户信息
:type Users: list of CloudStorageUserInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.Users = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("Users") is not None:
self.Users = []
for item in params.get("Users"):
obj = CloudStorageUserInfo()
obj._deserialize(item)
self.Users.append(obj)
self.RequestId = params.get("RequestId")
class DescribeDataForwardListRequest(AbstractModel):
"""DescribeDataForwardList请求参数结构体
"""
def __init__(self):
r"""
:param ProductIds: 产品ID列表
:type ProductIds: str
"""
self.ProductIds = None
def _deserialize(self, params):
self.ProductIds = params.get("ProductIds")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDataForwardListResponse(AbstractModel):
"""DescribeDataForwardList返回参数结构体
"""
def __init__(self):
r"""
:param DataForwardList: 数据转发列表。
注意:此字段可能返回 null,表示取不到有效值。
:type DataForwardList: list of DataForward
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.DataForwardList = None
self.RequestId = None
def _deserialize(self, params):
if params.get("DataForwardList") is not None:
self.DataForwardList = []
for item in params.get("DataForwardList"):
obj = DataForward()
obj._deserialize(item)
self.DataForwardList.append(obj)
self.RequestId = params.get("RequestId")
class DescribeDeviceActionHistoryRequest(AbstractModel):
"""DescribeDeviceActionHistory请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品Id
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param MinTime: 开始范围的 unix 毫秒时间戳
:type MinTime: int
:param MaxTime: 结束范围的 unix 毫秒时间戳
:type MaxTime: int
:param ActionId: 动作Id
:type ActionId: str
:param Limit: 查询条数 默认为0 最大不超过500
:type Limit: int
:param Context: 游标,标识查询位置。
:type Context: str
"""
self.ProductId = None
self.DeviceName = None
self.MinTime = None
self.MaxTime = None
self.ActionId = None
self.Limit = None
self.Context = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.MinTime = params.get("MinTime")
self.MaxTime = params.get("MaxTime")
self.ActionId = params.get("ActionId")
self.Limit = params.get("Limit")
self.Context = params.get("Context")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDeviceActionHistoryResponse(AbstractModel):
"""DescribeDeviceActionHistory返回参数结构体
"""
def __init__(self):
r"""
:param TotalCounts: 总条数
:type TotalCounts: int
:param ActionHistories: 动作历史
注意:此字段可能返回 null,表示取不到有效值。
:type ActionHistories: list of ActionHistory
:param Context: 用于标识查询结果的上下文,翻页用。
注意:此字段可能返回 null,表示取不到有效值。
:type Context: str
:param Listover: 搜索结果是否已经结束。
注意:此字段可能返回 null,表示取不到有效值。
:type Listover: bool
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCounts = None
self.ActionHistories = None
self.Context = None
self.Listover = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCounts = params.get("TotalCounts")
if params.get("ActionHistories") is not None:
self.ActionHistories = []
for item in params.get("ActionHistories"):
obj = ActionHistory()
obj._deserialize(item)
self.ActionHistories.append(obj)
self.Context = params.get("Context")
self.Listover = params.get("Listover")
self.RequestId = params.get("RequestId")
class DescribeDeviceCommLogRequest(AbstractModel):
"""DescribeDeviceCommLog请求参数结构体
"""
def __init__(self):
r"""
:param MinTime: 开始时间 13位时间戳 单位毫秒
:type MinTime: int
:param MaxTime: 结束时间 13位时间戳 单位毫秒
:type MaxTime: int
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Limit: 返回条数 默认为50
:type Limit: int
:param Context: 检索上下文
:type Context: str
:param Type: 类型:shadow 下行,device 上行 默认为空则全部查询
:type Type: str
"""
self.MinTime = None
self.MaxTime = None
self.ProductId = None
self.DeviceName = None
self.Limit = None
self.Context = None
self.Type = None
def _deserialize(self, params):
self.MinTime = params.get("MinTime")
self.MaxTime = params.get("MaxTime")
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.Limit = params.get("Limit")
self.Context = params.get("Context")
self.Type = params.get("Type")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDeviceCommLogResponse(AbstractModel):
"""DescribeDeviceCommLog返回参数结构体
"""
def __init__(self):
r"""
:param Listover: 数据是否已全部返回,true 表示数据全部返回,false 表示还有数据待返回,可将 Context 作为入参,继续查询返回结果。
:type Listover: bool
:param Context: 检索上下文,当 ListOver 为false时,可以用此上下文,继续读取后续数据
:type Context: str
:param Results: 日志数据结果数组,返回对应时间点及取值。
:type Results: list of DeviceCommLogItem
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Listover = None
self.Context = None
self.Results = None
self.RequestId = None
def _deserialize(self, params):
self.Listover = params.get("Listover")
self.Context = params.get("Context")
if params.get("Results") is not None:
self.Results = []
for item in params.get("Results"):
obj = DeviceCommLogItem()
obj._deserialize(item)
self.Results.append(obj)
self.RequestId = params.get("RequestId")
class DescribeDeviceDataHistoryRequest(AbstractModel):
"""DescribeDeviceDataHistory请求参数结构体
"""
def __init__(self):
r"""
:param MinTime: 区间开始时间(Unix 时间戳,毫秒级)
:type MinTime: int
:param MaxTime: 区间结束时间(Unix 时间戳,毫秒级)
:type MaxTime: int
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param FieldName: 属性字段名称,对应数据模板中功能属性的标识符
:type FieldName: str
:param Limit: 返回条数
:type Limit: list of int non-negative
:param Context: 检索上下文
:type Context: str
"""
self.MinTime = None
self.MaxTime = None
self.ProductId = None
self.DeviceName = None
self.FieldName = None
self.Limit = None
self.Context = None
def _deserialize(self, params):
self.MinTime = params.get("MinTime")
self.MaxTime = params.get("MaxTime")
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.FieldName = params.get("FieldName")
self.Limit = params.get("Limit")
self.Context = params.get("Context")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDeviceDataHistoryResponse(AbstractModel):
"""DescribeDeviceDataHistory返回参数结构体
"""
def __init__(self):
r"""
:param FieldName: 属性字段名称,对应数据模板中功能属性的标识符
注意:此字段可能返回 null,表示取不到有效值。
:type FieldName: str
:param Listover: 数据是否已全部返回,true 表示数据全部返回,false 表示还有数据待返回,可将 Context 作为入参,继续查询返回结果。
注意:此字段可能返回 null,表示取不到有效值。
:type Listover: bool
:param Context: 检索上下文,当 ListOver 为false时,可以用此上下文,继续读取后续数据
注意:此字段可能返回 null,表示取不到有效值。
:type Context: str
:param Results: 历史数据结果数组,返回对应时间点及取值。
注意:此字段可能返回 null,表示取不到有效值。
:type Results: list of DeviceDataHistoryItem
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.FieldName = None
self.Listover = None
self.Context = None
self.Results = None
self.RequestId = None
def _deserialize(self, params):
self.FieldName = params.get("FieldName")
self.Listover = params.get("Listover")
self.Context = params.get("Context")
if params.get("Results") is not None:
self.Results = []
for item in params.get("Results"):
obj = DeviceDataHistoryItem()
obj._deserialize(item)
self.Results.append(obj)
self.RequestId = params.get("RequestId")
class DescribeDeviceDataRequest(AbstractModel):
"""DescribeDeviceData请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
"""
self.ProductId = None
self.DeviceName = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDeviceDataResponse(AbstractModel):
"""DescribeDeviceData返回参数结构体
"""
def __init__(self):
r"""
:param Data: 设备数据
:type Data: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.RequestId = None
def _deserialize(self, params):
self.Data = params.get("Data")
self.RequestId = params.get("RequestId")
class DescribeDeviceEventHistoryRequest(AbstractModel):
"""DescribeDeviceEventHistory请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Type: 搜索的事件类型:alert 表示告警,fault 表示故障,info 表示信息,为空则表示查询上述所有类型事件
:type Type: str
:param StartTime: 起始时间(Unix 时间戳,秒级), 为0 表示 当前时间 - 24h
:type StartTime: int
:param EndTime: 结束时间(Unix 时间戳,秒级), 为0 表示当前时间
:type EndTime: int
:param Context: 搜索上下文, 用作查询游标
:type Context: str
:param Size: 单次获取的历史数据项目的最大数量, 缺省10
:type Size: int
:param EventId: 事件标识符,可以用来指定查询特定的事件,如果不指定,则查询所有事件。
:type EventId: str
"""
self.ProductId = None
self.DeviceName = None
self.Type = None
self.StartTime = None
self.EndTime = None
self.Context = None
self.Size = None
self.EventId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.Type = params.get("Type")
self.StartTime = params.get("StartTime")
self.EndTime = params.get("EndTime")
self.Context = params.get("Context")
self.Size = params.get("Size")
self.EventId = params.get("EventId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDeviceEventHistoryResponse(AbstractModel):
"""DescribeDeviceEventHistory返回参数结构体
"""
def __init__(self):
r"""
:param Context: 搜索上下文, 用作查询游标
注意:此字段可能返回 null,表示取不到有效值。
:type Context: str
:param Total: 搜索结果数量
注意:此字段可能返回 null,表示取不到有效值。
:type Total: int
:param Listover: 搜索结果是否已经结束
注意:此字段可能返回 null,表示取不到有效值。
:type Listover: bool
:param EventHistory: 搜集结果集
注意:此字段可能返回 null,表示取不到有效值。
:type EventHistory: list of EventHistoryItem
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Context = None
self.Total = None
self.Listover = None
self.EventHistory = None
self.RequestId = None
def _deserialize(self, params):
self.Context = params.get("Context")
self.Total = params.get("Total")
self.Listover = params.get("Listover")
if params.get("EventHistory") is not None:
self.EventHistory = []
for item in params.get("EventHistory"):
obj = EventHistoryItem()
obj._deserialize(item)
self.EventHistory.append(obj)
self.RequestId = params.get("RequestId")
class DescribeDeviceRequest(AbstractModel):
"""DescribeDevice请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名
:type DeviceName: str
"""
self.ProductId = None
self.DeviceName = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDeviceResponse(AbstractModel):
"""DescribeDevice返回参数结构体
"""
def __init__(self):
r"""
:param DeviceName: 设备名
:type DeviceName: str
:param Online: 设备是否在线,0不在线,1在线,2获取失败,3未激活
:type Online: int
:param LoginTime: 设备最后上线时间
:type LoginTime: int
:param DevicePsk: 设备密钥
:type DevicePsk: str
:param EnableState: 设备启用状态
:type EnableState: int
:param ExpireTime: 设备过期时间
:type ExpireTime: int
:param LogLevel: 设备的sdk日志等级,0:关闭,1:错误,2:告警,3:信息,4:调试
注意:此字段可能返回 null,表示取不到有效值。
:type LogLevel: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.DeviceName = None
self.Online = None
self.LoginTime = None
self.DevicePsk = None
self.EnableState = None
self.ExpireTime = None
self.LogLevel = None
self.RequestId = None
def _deserialize(self, params):
self.DeviceName = params.get("DeviceName")
self.Online = params.get("Online")
self.LoginTime = params.get("LoginTime")
self.DevicePsk = params.get("DevicePsk")
self.EnableState = params.get("EnableState")
self.ExpireTime = params.get("ExpireTime")
self.LogLevel = params.get("LogLevel")
self.RequestId = params.get("RequestId")
class DescribeDeviceStatusLogRequest(AbstractModel):
"""DescribeDeviceStatusLog请求参数结构体
"""
def __init__(self):
r"""
:param MinTime: 开始时间(毫秒)
:type MinTime: int
:param MaxTime: 结束时间(毫秒)
:type MaxTime: int
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Limit: 返回条数
:type Limit: int
:param Context: 检索上下文
:type Context: str
"""
self.MinTime = None
self.MaxTime = None
self.ProductId = None
self.DeviceName = None
self.Limit = None
self.Context = None
def _deserialize(self, params):
self.MinTime = params.get("MinTime")
self.MaxTime = params.get("MaxTime")
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.Limit = params.get("Limit")
self.Context = params.get("Context")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDeviceStatusLogResponse(AbstractModel):
"""DescribeDeviceStatusLog返回参数结构体
"""
def __init__(self):
r"""
:param Listover: 数据是否已全部返回,true 表示数据全部返回,false 表示还有数据待返回,可将 Context 作为入参,继续查询返回结果。
注意:此字段可能返回 null,表示取不到有效值。
:type Listover: bool
:param Context: 检索上下文,当 ListOver 为false时,可以用此上下文,继续读取后续数据
注意:此字段可能返回 null,表示取不到有效值。
:type Context: str
:param Results: 日志数据结果数组,返回对应时间点及取值。
注意:此字段可能返回 null,表示取不到有效值。
:type Results: list of DeviceStatusLogItem
:param TotalCount: 日志数据结果总条数
注意:此字段可能返回 null,表示取不到有效值。
:type TotalCount: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Listover = None
self.Context = None
self.Results = None
self.TotalCount = None
self.RequestId = None
def _deserialize(self, params):
self.Listover = params.get("Listover")
self.Context = params.get("Context")
if params.get("Results") is not None:
self.Results = []
for item in params.get("Results"):
obj = DeviceStatusLogItem()
obj._deserialize(item)
self.Results.append(obj)
self.TotalCount = params.get("TotalCount")
self.RequestId = params.get("RequestId")
class DescribeDevicesRequest(AbstractModel):
"""DescribeDevices请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 需要查看设备列表的产品 ID
:type ProductId: str
:param Offset: 偏移量,Offset从0开始
:type Offset: int
:param Limit: 分页的大小,最大100
:type Limit: int
:param DeviceName: 需要过滤的设备名称
:type DeviceName: str
"""
self.ProductId = None
self.Offset = None
self.Limit = None
self.DeviceName = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.Offset = params.get("Offset")
self.Limit = params.get("Limit")
self.DeviceName = params.get("DeviceName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeDevicesResponse(AbstractModel):
"""DescribeDevices返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: 设备总数
:type TotalCount: int
:param Devices: 设备详细信息列表
:type Devices: list of DeviceInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.Devices = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("Devices") is not None:
self.Devices = []
for item in params.get("Devices"):
obj = DeviceInfo()
obj._deserialize(item)
self.Devices.append(obj)
self.RequestId = params.get("RequestId")
class DescribeFirmwareRequest(AbstractModel):
"""DescribeFirmware请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本号
:type FirmwareVersion: str
"""
self.ProductID = None
self.FirmwareVersion = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeFirmwareResponse(AbstractModel):
"""DescribeFirmware返回参数结构体
"""
def __init__(self):
r"""
:param Version: 固件版本号
:type Version: str
:param ProductId: 产品ID
:type ProductId: str
:param Name: 固件名称
注意:此字段可能返回 null,表示取不到有效值。
:type Name: str
:param Description: 固件描述
注意:此字段可能返回 null,表示取不到有效值。
:type Description: str
:param Md5sum: 固件Md5值
注意:此字段可能返回 null,表示取不到有效值。
:type Md5sum: str
:param Createtime: 固件上传的秒级时间戳
注意:此字段可能返回 null,表示取不到有效值。
:type Createtime: int
:param ProductName: 产品名称
:type ProductName: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Version = None
self.ProductId = None
self.Name = None
self.Description = None
self.Md5sum = None
self.Createtime = None
self.ProductName = None
self.RequestId = None
def _deserialize(self, params):
self.Version = params.get("Version")
self.ProductId = params.get("ProductId")
self.Name = params.get("Name")
self.Description = params.get("Description")
self.Md5sum = params.get("Md5sum")
self.Createtime = params.get("Createtime")
self.ProductName = params.get("ProductName")
self.RequestId = params.get("RequestId")
class DescribeFirmwareTaskDevicesRequest(AbstractModel):
"""DescribeFirmwareTaskDevices请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本
:type FirmwareVersion: str
:param Filters: 筛选条件
:type Filters: list of SearchKeyword
:param Offset: 查询偏移量 默认为0
:type Offset: int
:param Limit: 查询的数量 默认为50
:type Limit: int
"""
self.ProductID = None
self.FirmwareVersion = None
self.Filters = None
self.Offset = None
self.Limit = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
if params.get("Filters") is not None:
self.Filters = []
for item in params.get("Filters"):
obj = SearchKeyword()
obj._deserialize(item)
self.Filters.append(obj)
self.Offset = params.get("Offset")
self.Limit = params.get("Limit")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeFirmwareTaskDevicesResponse(AbstractModel):
"""DescribeFirmwareTaskDevices返回参数结构体
"""
def __init__(self):
r"""
:param Total: 固件升级任务的设备总数
注意:此字段可能返回 null,表示取不到有效值。
:type Total: int
:param Devices: 固件升级任务的设备列表
:type Devices: list of DeviceUpdateStatus
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Total = None
self.Devices = None
self.RequestId = None
def _deserialize(self, params):
self.Total = params.get("Total")
if params.get("Devices") is not None:
self.Devices = []
for item in params.get("Devices"):
obj = DeviceUpdateStatus()
obj._deserialize(item)
self.Devices.append(obj)
self.RequestId = params.get("RequestId")
class DescribeFirmwareTaskDistributionRequest(AbstractModel):
"""DescribeFirmwareTaskDistribution请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本号
:type FirmwareVersion: str
:param TaskId: 固件升级任务ID
:type TaskId: int
"""
self.ProductID = None
self.FirmwareVersion = None
self.TaskId = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
self.TaskId = params.get("TaskId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeFirmwareTaskDistributionResponse(AbstractModel):
"""DescribeFirmwareTaskDistribution返回参数结构体
"""
def __init__(self):
r"""
:param StatusInfos: 固件升级任务状态分布信息
:type StatusInfos: list of StatusStatistic
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.StatusInfos = None
self.RequestId = None
def _deserialize(self, params):
if params.get("StatusInfos") is not None:
self.StatusInfos = []
for item in params.get("StatusInfos"):
obj = StatusStatistic()
obj._deserialize(item)
self.StatusInfos.append(obj)
self.RequestId = params.get("RequestId")
class DescribeFirmwareTaskRequest(AbstractModel):
"""DescribeFirmwareTask请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本号
:type FirmwareVersion: str
:param TaskId: 固件任务ID
:type TaskId: int
"""
self.ProductID = None
self.FirmwareVersion = None
self.TaskId = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
self.TaskId = params.get("TaskId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeFirmwareTaskResponse(AbstractModel):
"""DescribeFirmwareTask返回参数结构体
"""
def __init__(self):
r"""
:param TaskId: 固件任务ID
注意:此字段可能返回 null,表示取不到有效值。
:type TaskId: int
:param Status: 固件任务状态
注意:此字段可能返回 null,表示取不到有效值。
:type Status: int
:param CreateTime: 固件任务创建时间,单位:秒
注意:此字段可能返回 null,表示取不到有效值。
:type CreateTime: int
:param Type: 固件任务升级类型
注意:此字段可能返回 null,表示取不到有效值。
:type Type: int
:param ProductName: 产品名称
注意:此字段可能返回 null,表示取不到有效值。
:type ProductName: str
:param UpgradeMode: 固件任务升级模式。originalVersion(按版本号升级)、filename(提交文件升级)、devicenames(按设备名称升级)
注意:此字段可能返回 null,表示取不到有效值。
:type UpgradeMode: str
:param ProductId: 产品ID
注意:此字段可能返回 null,表示取不到有效值。
:type ProductId: str
:param OriginalVersion: 原始固件版本号,在UpgradeMode是originalVersion升级模式下会返回
注意:此字段可能返回 null,表示取不到有效值。
:type OriginalVersion: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TaskId = None
self.Status = None
self.CreateTime = None
self.Type = None
self.ProductName = None
self.UpgradeMode = None
self.ProductId = None
self.OriginalVersion = None
self.RequestId = None
def _deserialize(self, params):
self.TaskId = params.get("TaskId")
self.Status = params.get("Status")
self.CreateTime = params.get("CreateTime")
self.Type = params.get("Type")
self.ProductName = params.get("ProductName")
self.UpgradeMode = params.get("UpgradeMode")
self.ProductId = params.get("ProductId")
self.OriginalVersion = params.get("OriginalVersion")
self.RequestId = params.get("RequestId")
class DescribeFirmwareTaskStatisticsRequest(AbstractModel):
"""DescribeFirmwareTaskStatistics请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本号
:type FirmwareVersion: str
"""
self.ProductID = None
self.FirmwareVersion = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeFirmwareTaskStatisticsResponse(AbstractModel):
"""DescribeFirmwareTaskStatistics返回参数结构体
"""
def __init__(self):
r"""
:param SuccessTotal: 升级成功的设备总数
注意:此字段可能返回 null,表示取不到有效值。
:type SuccessTotal: int
:param FailureTotal: 升级失败的设备总数
注意:此字段可能返回 null,表示取不到有效值。
:type FailureTotal: int
:param UpgradingTotal: 正在升级的设备总数
注意:此字段可能返回 null,表示取不到有效值。
:type UpgradingTotal: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.SuccessTotal = None
self.FailureTotal = None
self.UpgradingTotal = None
self.RequestId = None
def _deserialize(self, params):
self.SuccessTotal = params.get("SuccessTotal")
self.FailureTotal = params.get("FailureTotal")
self.UpgradingTotal = params.get("UpgradingTotal")
self.RequestId = params.get("RequestId")
class DescribeFirmwareTasksRequest(AbstractModel):
"""DescribeFirmwareTasks请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本号
:type FirmwareVersion: str
:param Offset: 查询偏移量
:type Offset: int
:param Limit: 返回查询结果条数
:type Limit: int
:param Filters: 搜索过滤条件
:type Filters: list of SearchKeyword
"""
self.ProductID = None
self.FirmwareVersion = None
self.Offset = None
self.Limit = None
self.Filters = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
self.Offset = params.get("Offset")
self.Limit = params.get("Limit")
if params.get("Filters") is not None:
self.Filters = []
for item in params.get("Filters"):
obj = SearchKeyword()
obj._deserialize(item)
self.Filters.append(obj)
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeFirmwareTasksResponse(AbstractModel):
"""DescribeFirmwareTasks返回参数结构体
"""
def __init__(self):
r"""
:param TaskInfos: 固件升级任务列表
注意:此字段可能返回 null,表示取不到有效值。
:type TaskInfos: list of FirmwareTaskInfo
:param Total: 固件升级任务总数
注意:此字段可能返回 null,表示取不到有效值。
:type Total: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TaskInfos = None
self.Total = None
self.RequestId = None
def _deserialize(self, params):
if params.get("TaskInfos") is not None:
self.TaskInfos = []
for item in params.get("TaskInfos"):
obj = FirmwareTaskInfo()
obj._deserialize(item)
self.TaskInfos.append(obj)
self.Total = params.get("Total")
self.RequestId = params.get("RequestId")
class DescribeForwardRuleRequest(AbstractModel):
"""DescribeForwardRule请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param Skey: 控制台Skey
:type Skey: str
:param QueueType: 队列类型,0:CMQ,1:Ckafka
:type QueueType: int
:param Consecretid: 临时密钥
:type Consecretid: str
"""
self.ProductID = None
self.Skey = None
self.QueueType = None
self.Consecretid = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.Skey = params.get("Skey")
self.QueueType = params.get("QueueType")
self.Consecretid = params.get("Consecretid")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeForwardRuleResponse(AbstractModel):
"""DescribeForwardRule返回参数结构体
"""
def __init__(self):
r"""
:param Endpoint: 腾讯云账号
:type Endpoint: str
:param QueueName: 队列名称
:type QueueName: str
:param ProductID: 产品ID
:type ProductID: str
:param MsgType: 消息类型 1设备上报信息 2设备状态变化通知 3为全选
:type MsgType: int
:param Result: 结果 2表示禁用 其他为成功
:type Result: int
:param RoleName: 角色名
:type RoleName: str
:param RoleID: 角色ID
:type RoleID: int
:param QueueRegion: 队列区域
:type QueueRegion: str
:param QueueType: 队列类型,0:CMQ,1:Ckafka
:type QueueType: int
:param InstanceId: 实例id, 目前只有Ckafaka会用到
:type InstanceId: str
:param InstanceName: 实例名称,目前只有Ckafaka会用到
:type InstanceName: str
:param ErrMsg: 错误消息
:type ErrMsg: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Endpoint = None
self.QueueName = None
self.ProductID = None
self.MsgType = None
self.Result = None
self.RoleName = None
self.RoleID = None
self.QueueRegion = None
self.QueueType = None
self.InstanceId = None
self.InstanceName = None
self.ErrMsg = None
self.RequestId = None
def _deserialize(self, params):
self.Endpoint = params.get("Endpoint")
self.QueueName = params.get("QueueName")
self.ProductID = params.get("ProductID")
self.MsgType = params.get("MsgType")
self.Result = params.get("Result")
self.RoleName = params.get("RoleName")
self.RoleID = params.get("RoleID")
self.QueueRegion = params.get("QueueRegion")
self.QueueType = params.get("QueueType")
self.InstanceId = params.get("InstanceId")
self.InstanceName = params.get("InstanceName")
self.ErrMsg = params.get("ErrMsg")
self.RequestId = params.get("RequestId")
class DescribeModelDefinitionRequest(AbstractModel):
"""DescribeModelDefinition请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
"""
self.ProductId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeModelDefinitionResponse(AbstractModel):
"""DescribeModelDefinition返回参数结构体
"""
def __init__(self):
r"""
:param Model: 产品数据模板
:type Model: :class:`tencentcloud.iotvideo.v20201215.models.ProductModelDefinition`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Model = None
self.RequestId = None
def _deserialize(self, params):
if params.get("Model") is not None:
self.Model = ProductModelDefinition()
self.Model._deserialize(params.get("Model"))
self.RequestId = params.get("RequestId")
class DescribeProductDynamicRegisterRequest(AbstractModel):
"""DescribeProductDynamicRegister请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
"""
self.ProductId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeProductDynamicRegisterResponse(AbstractModel):
"""DescribeProductDynamicRegister返回参数结构体
"""
def __init__(self):
r"""
:param RegisterType: 动态注册类型,0-关闭 1-预创建设备 2-自动创建设备
:type RegisterType: int
:param ProductSecret: 动态注册产品密钥
:type ProductSecret: str
:param RegisterLimit: 动态注册设备上限
:type RegisterLimit: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RegisterType = None
self.ProductSecret = None
self.RegisterLimit = None
self.RequestId = None
def _deserialize(self, params):
self.RegisterType = params.get("RegisterType")
self.ProductSecret = params.get("ProductSecret")
self.RegisterLimit = params.get("RegisterLimit")
self.RequestId = params.get("RequestId")
class DescribeProductRequest(AbstractModel):
"""DescribeProduct请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品id
:type ProductId: str
"""
self.ProductId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeProductResponse(AbstractModel):
"""DescribeProduct返回参数结构体
"""
def __init__(self):
r"""
:param Data: 产品详情
:type Data: :class:`tencentcloud.iotvideo.v20201215.models.VideoProduct`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.RequestId = None
def _deserialize(self, params):
if params.get("Data") is not None:
self.Data = VideoProduct()
self.Data._deserialize(params.get("Data"))
self.RequestId = params.get("RequestId")
class DescribeProductsRequest(AbstractModel):
"""DescribeProducts请求参数结构体
"""
def __init__(self):
r"""
:param Limit: 分页的大小,最大100
:type Limit: int
:param Offset: 偏移量,Offset从0开始
:type Offset: int
"""
self.Limit = None
self.Offset = None
def _deserialize(self, params):
self.Limit = params.get("Limit")
self.Offset = params.get("Offset")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeProductsResponse(AbstractModel):
"""DescribeProducts返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: 总数
:type TotalCount: int
:param Data: 产品详情列表
:type Data: list of VideoProduct
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.Data = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("Data") is not None:
self.Data = []
for item in params.get("Data"):
obj = VideoProduct()
obj._deserialize(item)
self.Data.append(obj)
self.RequestId = params.get("RequestId")
class DescribeSDKLogRequest(AbstractModel):
"""DescribeSDKLog请求参数结构体
"""
def __init__(self):
r"""
:param MinTime: 日志开始时间
:type MinTime: int
:param MaxTime: 日志结束时间
:type MaxTime: int
:param Keywords: 查询关键字,可以同时支持键值查询和文本查询,
例如,查询某key的值为value,并且包含某word的日志,该参数为:key:value word。
键值或文本可以包含多个,以空格隔开。
其中可以索引的key包括:productid、devicename、loglevel
一个典型的查询示例:productid:7JK1G72JNE devicename:name publish loglevel:WARN一个典型的查询示例:productid:ABCDE12345 devicename:test scene:SHADOW publish
:type Keywords: str
:param Context: 日志检索上下文
:type Context: str
:param MaxNum: 查询条数
:type MaxNum: int
"""
self.MinTime = None
self.MaxTime = None
self.Keywords = None
self.Context = None
self.MaxNum = None
def _deserialize(self, params):
self.MinTime = params.get("MinTime")
self.MaxTime = params.get("MaxTime")
self.Keywords = params.get("Keywords")
self.Context = params.get("Context")
self.MaxNum = params.get("MaxNum")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeSDKLogResponse(AbstractModel):
"""DescribeSDKLog返回参数结构体
"""
def __init__(self):
r"""
:param Context: 日志检索上下文
:type Context: str
:param Listover: 是否还有日志,如有仍有日志,下次查询的请求带上当前请求返回的Context
:type Listover: bool
:param Results: 日志列表
:type Results: list of SDKLogItem
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Context = None
self.Listover = None
self.Results = None
self.RequestId = None
def _deserialize(self, params):
self.Context = params.get("Context")
self.Listover = params.get("Listover")
if params.get("Results") is not None:
self.Results = []
for item in params.get("Results"):
obj = SDKLogItem()
obj._deserialize(item)
self.Results.append(obj)
self.RequestId = params.get("RequestId")
class DeviceCommLogItem(AbstractModel):
"""设备通讯日志查询返回条目
"""
def __init__(self):
r"""
:param Time: 时间
:type Time: str
:param Type: 日志类型,device 设备上行,shadow 服务端下行。
:type Type: str
:param Data: 通讯数据。
:type Data: str
"""
self.Time = None
self.Type = None
self.Data = None
def _deserialize(self, params):
self.Time = params.get("Time")
self.Type = params.get("Type")
self.Data = params.get("Data")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeviceDataHistoryItem(AbstractModel):
"""设备历史数据结构
"""
def __init__(self):
r"""
:param Time: 时间点,毫秒时间戳
:type Time: str
:param Value: 字段取值
:type Value: str
"""
self.Time = None
self.Value = None
def _deserialize(self, params):
self.Time = params.get("Time")
self.Value = params.get("Value")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeviceInfo(AbstractModel):
"""设备详细信息
"""
def __init__(self):
r"""
:param DeviceName: 设备名
:type DeviceName: str
:param Online: 设备是否在线,0不在线,1在线,2获取失败,3未激活
:type Online: int
:param LoginTime: 设备最后上线时间
:type LoginTime: int
:param DevicePsk: 设备密钥
:type DevicePsk: str
:param EnableState: 设备启用状态 0为停用 1为可用
:type EnableState: int
:param ExpireTime: 设备过期时间
:type ExpireTime: int
"""
self.DeviceName = None
self.Online = None
self.LoginTime = None
self.DevicePsk = None
self.EnableState = None
self.ExpireTime = None
def _deserialize(self, params):
self.DeviceName = params.get("DeviceName")
self.Online = params.get("Online")
self.LoginTime = params.get("LoginTime")
self.DevicePsk = params.get("DevicePsk")
self.EnableState = params.get("EnableState")
self.ExpireTime = params.get("ExpireTime")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeviceStatusLogItem(AbstractModel):
"""设备上下线日志记录
"""
def __init__(self):
r"""
:param Time: 时间
:type Time: str
:param Type: 状态类型: Online 上线,Offline 下线
:type Type: str
:param Data: 日志信息
:type Data: str
"""
self.Time = None
self.Type = None
self.Data = None
def _deserialize(self, params):
self.Time = params.get("Time")
self.Type = params.get("Type")
self.Data = params.get("Data")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DeviceUpdateStatus(AbstractModel):
"""设备固件更新状态
"""
def __init__(self):
r"""
:param DeviceName: 设备名
:type DeviceName: str
:param LastProcessTime: 最后处理时间
:type LastProcessTime: int
:param Status: 状态
:type Status: int
:param ErrMsg: 错误消息
:type ErrMsg: str
:param Retcode: 返回码
:type Retcode: int
:param DstVersion: 目标更新版本
:type DstVersion: str
:param Percent: 下载中状态时的下载进度
注意:此字段可能返回 null,表示取不到有效值。
:type Percent: int
:param OriVersion: 原版本号
注意:此字段可能返回 null,表示取不到有效值。
:type OriVersion: str
:param TaskId: 任务ID
注意:此字段可能返回 null,表示取不到有效值。
:type TaskId: int
"""
self.DeviceName = None
self.LastProcessTime = None
self.Status = None
self.ErrMsg = None
self.Retcode = None
self.DstVersion = None
self.Percent = None
self.OriVersion = None
self.TaskId = None
def _deserialize(self, params):
self.DeviceName = params.get("DeviceName")
self.LastProcessTime = params.get("LastProcessTime")
self.Status = params.get("Status")
self.ErrMsg = params.get("ErrMsg")
self.Retcode = params.get("Retcode")
self.DstVersion = params.get("DstVersion")
self.Percent = params.get("Percent")
self.OriVersion = params.get("OriVersion")
self.TaskId = params.get("TaskId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class EditFirmwareRequest(AbstractModel):
"""EditFirmware请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID。
:type ProductID: str
:param FirmwareVersion: 固件版本号。
:type FirmwareVersion: str
:param FirmwareName: 固件名称。
:type FirmwareName: str
:param FirmwareDescription: 固件描述。
:type FirmwareDescription: str
"""
self.ProductID = None
self.FirmwareVersion = None
self.FirmwareName = None
self.FirmwareDescription = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
self.FirmwareName = params.get("FirmwareName")
self.FirmwareDescription = params.get("FirmwareDescription")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class EditFirmwareResponse(AbstractModel):
"""EditFirmware返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class EventHistoryItem(AbstractModel):
"""设备事件的搜索结果项
"""
def __init__(self):
r"""
:param TimeStamp: 事件的时间戳
注意:此字段可能返回 null,表示取不到有效值。
:type TimeStamp: int
:param ProductId: 事件的产品ID
注意:此字段可能返回 null,表示取不到有效值。
:type ProductId: str
:param DeviceName: 事件的设备名称
注意:此字段可能返回 null,表示取不到有效值。
:type DeviceName: str
:param EventId: 事件的标识符ID
注意:此字段可能返回 null,表示取不到有效值。
:type EventId: str
:param Type: 事件的类型
注意:此字段可能返回 null,表示取不到有效值。
:type Type: str
:param Data: 事件的数据
注意:此字段可能返回 null,表示取不到有效值。
:type Data: str
"""
self.TimeStamp = None
self.ProductId = None
self.DeviceName = None
self.EventId = None
self.Type = None
self.Data = None
def _deserialize(self, params):
self.TimeStamp = params.get("TimeStamp")
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.EventId = params.get("EventId")
self.Type = params.get("Type")
self.Data = params.get("Data")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class FirmwareInfo(AbstractModel):
"""设备固件详细信息
"""
def __init__(self):
r"""
:param Version: 固件版本
:type Version: str
:param Md5sum: 固件MD5值
:type Md5sum: str
:param CreateTime: 固件创建时间
:type CreateTime: int
:param ProductName: 产品名称
:type ProductName: str
:param Name: 固件名称
:type Name: str
:param Description: 固件描述
:type Description: str
:param ProductId: 产品ID
:type ProductId: str
"""
self.Version = None
self.Md5sum = None
self.CreateTime = None
self.ProductName = None
self.Name = None
self.Description = None
self.ProductId = None
def _deserialize(self, params):
self.Version = params.get("Version")
self.Md5sum = params.get("Md5sum")
self.CreateTime = params.get("CreateTime")
self.ProductName = params.get("ProductName")
self.Name = params.get("Name")
self.Description = params.get("Description")
self.ProductId = params.get("ProductId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class FirmwareTaskInfo(AbstractModel):
"""固件升级任务信息
"""
def __init__(self):
r"""
:param TaskId: 任务ID
注意:此字段可能返回 null,表示取不到有效值。
:type TaskId: int
:param Status: 任务状态
注意:此字段可能返回 null,表示取不到有效值。
:type Status: int
:param Type: 任务类型
注意:此字段可能返回 null,表示取不到有效值。
:type Type: int
:param CreateTime: 任务创建时间
注意:此字段可能返回 null,表示取不到有效值。
:type CreateTime: int
"""
self.TaskId = None
self.Status = None
self.Type = None
self.CreateTime = None
def _deserialize(self, params):
self.TaskId = params.get("TaskId")
self.Status = params.get("Status")
self.Type = params.get("Type")
self.CreateTime = params.get("CreateTime")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class GenerateSignedVideoURLRequest(AbstractModel):
"""GenerateSignedVideoURL请求参数结构体
"""
def __init__(self):
r"""
:param VideoURL: 视频播放原始URL地址
:type VideoURL: str
:param ExpireTime: 播放链接过期时间
:type ExpireTime: int
"""
self.VideoURL = None
self.ExpireTime = None
def _deserialize(self, params):
self.VideoURL = params.get("VideoURL")
self.ExpireTime = params.get("ExpireTime")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class GenerateSignedVideoURLResponse(AbstractModel):
"""GenerateSignedVideoURL返回参数结构体
"""
def __init__(self):
r"""
:param SignedVideoURL: 视频防盗链播放URL
:type SignedVideoURL: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.SignedVideoURL = None
self.RequestId = None
def _deserialize(self, params):
self.SignedVideoURL = params.get("SignedVideoURL")
self.RequestId = params.get("RequestId")
class GetAllFirmwareVersionRequest(AbstractModel):
"""GetAllFirmwareVersion请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
"""
self.ProductID = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class GetAllFirmwareVersionResponse(AbstractModel):
"""GetAllFirmwareVersion返回参数结构体
"""
def __init__(self):
r"""
:param Version: 固件可用版本列表
:type Version: list of str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Version = None
self.RequestId = None
def _deserialize(self, params):
self.Version = params.get("Version")
self.RequestId = params.get("RequestId")
class GetFirmwareURLRequest(AbstractModel):
"""GetFirmwareURL请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本
:type FirmwareVersion: str
"""
self.ProductID = None
self.FirmwareVersion = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class GetFirmwareURLResponse(AbstractModel):
"""GetFirmwareURL返回参数结构体
"""
def __init__(self):
r"""
:param Url: 固件URL
:type Url: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Url = None
self.RequestId = None
def _deserialize(self, params):
self.Url = params.get("Url")
self.RequestId = params.get("RequestId")
class ImportModelDefinitionRequest(AbstractModel):
"""ImportModelDefinition请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param ModelSchema: 数据模板定义
:type ModelSchema: str
"""
self.ProductId = None
self.ModelSchema = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ModelSchema = params.get("ModelSchema")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ImportModelDefinitionResponse(AbstractModel):
"""ImportModelDefinition返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class InheritCloudStorageUserRequest(AbstractModel):
"""InheritCloudStorageUser请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param UserId: 原始用户ID
:type UserId: str
:param ToUserId: 目标用户ID
:type ToUserId: str
"""
self.ProductId = None
self.DeviceName = None
self.UserId = None
self.ToUserId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.UserId = params.get("UserId")
self.ToUserId = params.get("ToUserId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class InheritCloudStorageUserResponse(AbstractModel):
"""InheritCloudStorageUser返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ListFirmwaresRequest(AbstractModel):
"""ListFirmwares请求参数结构体
"""
def __init__(self):
r"""
:param PageNum: 获取的页数
:type PageNum: int
:param PageSize: 分页的大小
:type PageSize: int
:param ProductID: 产品ID
:type ProductID: str
:param Filters: 搜索过滤条件
:type Filters: list of SearchKeyword
"""
self.PageNum = None
self.PageSize = None
self.ProductID = None
self.Filters = None
def _deserialize(self, params):
self.PageNum = params.get("PageNum")
self.PageSize = params.get("PageSize")
self.ProductID = params.get("ProductID")
if params.get("Filters") is not None:
self.Filters = []
for item in params.get("Filters"):
obj = SearchKeyword()
obj._deserialize(item)
self.Filters.append(obj)
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ListFirmwaresResponse(AbstractModel):
"""ListFirmwares返回参数结构体
"""
def __init__(self):
r"""
:param TotalCount: 固件总数
:type TotalCount: int
:param Firmwares: 固件列表
:type Firmwares: list of FirmwareInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.TotalCount = None
self.Firmwares = None
self.RequestId = None
def _deserialize(self, params):
self.TotalCount = params.get("TotalCount")
if params.get("Firmwares") is not None:
self.Firmwares = []
for item in params.get("Firmwares"):
obj = FirmwareInfo()
obj._deserialize(item)
self.Firmwares.append(obj)
self.RequestId = params.get("RequestId")
class ModifyDataForwardRequest(AbstractModel):
"""ModifyDataForward请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID。
:type ProductId: str
:param ForwardAddr: 转发地址。如果有鉴权Token,则需要自行传入,例如 [{\"forward\":{\"api\":\"http://123.207.117.108:1080/sub.php\",\"token\":\"testtoken\"}}]
:type ForwardAddr: str
:param DataChose: 1-数据信息转发 2-设备上下线状态转发 3-数据信息转发&设备上下线状态转发
:type DataChose: int
"""
self.ProductId = None
self.ForwardAddr = None
self.DataChose = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ForwardAddr = params.get("ForwardAddr")
self.DataChose = params.get("DataChose")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ModifyDataForwardResponse(AbstractModel):
"""ModifyDataForward返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ModifyDataForwardStatusRequest(AbstractModel):
"""ModifyDataForwardStatus请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID。
:type ProductId: str
:param Status: 转发状态,1启用,0禁用。
:type Status: int
"""
self.ProductId = None
self.Status = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.Status = params.get("Status")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ModifyDataForwardStatusResponse(AbstractModel):
"""ModifyDataForwardStatus返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ModifyDeviceLogLevelRequest(AbstractModel):
"""ModifyDeviceLogLevel请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param LogLevel: 日志级别,0:关闭,1:错误,2:告警,3:信息,4:调试
:type LogLevel: int
"""
self.ProductId = None
self.DeviceName = None
self.LogLevel = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.LogLevel = params.get("LogLevel")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ModifyDeviceLogLevelResponse(AbstractModel):
"""ModifyDeviceLogLevel返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ModifyDeviceRequest(AbstractModel):
"""ModifyDevice请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 设备所属产品id
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param EnableState: 要设置的设备状态,1为启用,0为禁用
:type EnableState: int
"""
self.ProductId = None
self.DeviceName = None
self.EnableState = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.EnableState = params.get("EnableState")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ModifyDeviceResponse(AbstractModel):
"""ModifyDevice返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ModifyForwardRuleRequest(AbstractModel):
"""ModifyForwardRule请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param MsgType: 消息类型
:type MsgType: int
:param Skey: 控制台Skey
:type Skey: str
:param QueueRegion: 队列区域
:type QueueRegion: str
:param QueueType: 队列类型 0.CMQ 1.CKafka
:type QueueType: int
:param Consecretid: 临时密钥
:type Consecretid: str
:param InstanceId: 实例ID
:type InstanceId: str
:param InstanceName: 实例名称
:type InstanceName: str
:param QueueID: 队列或主题ID
:type QueueID: str
:param QueueName: 队列或主题名称
:type QueueName: str
"""
self.ProductID = None
self.MsgType = None
self.Skey = None
self.QueueRegion = None
self.QueueType = None
self.Consecretid = None
self.InstanceId = None
self.InstanceName = None
self.QueueID = None
self.QueueName = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.MsgType = params.get("MsgType")
self.Skey = params.get("Skey")
self.QueueRegion = params.get("QueueRegion")
self.QueueType = params.get("QueueType")
self.Consecretid = params.get("Consecretid")
self.InstanceId = params.get("InstanceId")
self.InstanceName = params.get("InstanceName")
self.QueueID = params.get("QueueID")
self.QueueName = params.get("QueueName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ModifyForwardRuleResponse(AbstractModel):
"""ModifyForwardRule返回参数结构体
"""
def __init__(self):
r"""
:param Endpoint: 腾讯云账号
:type Endpoint: str
:param ProductID: 产品ID
:type ProductID: str
:param Result: 结果
:type Result: int
:param ErrMsg: 错误信息
:type ErrMsg: str
:param QueueType: 队列类型 0.CMQ 1.CKafka
:type QueueType: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Endpoint = None
self.ProductID = None
self.Result = None
self.ErrMsg = None
self.QueueType = None
self.RequestId = None
def _deserialize(self, params):
self.Endpoint = params.get("Endpoint")
self.ProductID = params.get("ProductID")
self.Result = params.get("Result")
self.ErrMsg = params.get("ErrMsg")
self.QueueType = params.get("QueueType")
self.RequestId = params.get("RequestId")
class ModifyModelDefinitionRequest(AbstractModel):
"""ModifyModelDefinition请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param ModelSchema: 数据模板定义
:type ModelSchema: str
"""
self.ProductId = None
self.ModelSchema = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ModelSchema = params.get("ModelSchema")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ModifyModelDefinitionResponse(AbstractModel):
"""ModifyModelDefinition返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ModifyProductDynamicRegisterRequest(AbstractModel):
"""ModifyProductDynamicRegister请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param RegisterType: 动态注册类型,0-关闭 1-预创建设备 2-自动创建设备
:type RegisterType: int
:param RegisterLimit: 动态注册设备上限
:type RegisterLimit: int
"""
self.ProductId = None
self.RegisterType = None
self.RegisterLimit = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.RegisterType = params.get("RegisterType")
self.RegisterLimit = params.get("RegisterLimit")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ModifyProductDynamicRegisterResponse(AbstractModel):
"""ModifyProductDynamicRegister返回参数结构体
"""
def __init__(self):
r"""
:param RegisterType: 动态注册类型,0-关闭 1-预创建设备 2-自动创建设备
:type RegisterType: int
:param ProductSecret: 动态注册产品密钥
:type ProductSecret: str
:param RegisterLimit: 动态注册设备上限
:type RegisterLimit: int
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RegisterType = None
self.ProductSecret = None
self.RegisterLimit = None
self.RequestId = None
def _deserialize(self, params):
self.RegisterType = params.get("RegisterType")
self.ProductSecret = params.get("ProductSecret")
self.RegisterLimit = params.get("RegisterLimit")
self.RequestId = params.get("RequestId")
class ModifyProductRequest(AbstractModel):
"""ModifyProduct请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品id
:type ProductId: str
:param ProductName: 修改的产品名称 (支持中文、英文、数字、下划线组合,最多不超过20个字符)
:type ProductName: str
:param ProductDescription: 修改的产品描述 (最多不超过128个字符)
:type ProductDescription: str
"""
self.ProductId = None
self.ProductName = None
self.ProductDescription = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ProductName = params.get("ProductName")
self.ProductDescription = params.get("ProductDescription")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ModifyProductResponse(AbstractModel):
"""ModifyProduct返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ProductModelDefinition(AbstractModel):
"""产品模型定义
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param ModelDefine: 模型定义
:type ModelDefine: str
:param UpdateTime: 更新时间,秒级时间戳
:type UpdateTime: int
:param CreateTime: 创建时间,秒级时间戳
:type CreateTime: int
:param CategoryModel: 产品所属分类的模型快照(产品创建时刻的)
注意:此字段可能返回 null,表示取不到有效值。
:type CategoryModel: str
:param NetTypeModel: 产品的连接类型的模型
注意:此字段可能返回 null,表示取不到有效值。
:type NetTypeModel: str
"""
self.ProductId = None
self.ModelDefine = None
self.UpdateTime = None
self.CreateTime = None
self.CategoryModel = None
self.NetTypeModel = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ModelDefine = params.get("ModelDefine")
self.UpdateTime = params.get("UpdateTime")
self.CreateTime = params.get("CreateTime")
self.CategoryModel = params.get("CategoryModel")
self.NetTypeModel = params.get("NetTypeModel")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ProductTemplate(AbstractModel):
"""产品分类实体
"""
def __init__(self):
r"""
:param Id: 实体ID
:type Id: int
:param CategoryKey: 分类字段
:type CategoryKey: str
:param CategoryName: 分类名称
:type CategoryName: str
:param ParentId: 上层实体ID
:type ParentId: int
:param ModelTemplate: 物模型
:type ModelTemplate: str
:param ListOrder: 排列顺序
注意:此字段可能返回 null,表示取不到有效值。
:type ListOrder: int
:param IconUrl: 分类图标地址
注意:此字段可能返回 null,表示取不到有效值。
:type IconUrl: str
:param IconUrlGrid: 九宫格图片地址
注意:此字段可能返回 null,表示取不到有效值。
:type IconUrlGrid: str
"""
self.Id = None
self.CategoryKey = None
self.CategoryName = None
self.ParentId = None
self.ModelTemplate = None
self.ListOrder = None
self.IconUrl = None
self.IconUrlGrid = None
def _deserialize(self, params):
self.Id = params.get("Id")
self.CategoryKey = params.get("CategoryKey")
self.CategoryName = params.get("CategoryName")
self.ParentId = params.get("ParentId")
self.ModelTemplate = params.get("ModelTemplate")
self.ListOrder = params.get("ListOrder")
self.IconUrl = params.get("IconUrl")
self.IconUrlGrid = params.get("IconUrlGrid")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class PublishMessageRequest(AbstractModel):
"""PublishMessage请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Topic: 消息发往的主题
:type Topic: str
:param Payload: 云端下发到设备的控制报文
:type Payload: str
:param Qos: 消息服务质量等级,取值为0或1
:type Qos: int
:param PayloadEncoding: Payload的内容编码格式,取值为base64或空。base64表示云端将接收到的base64编码后的报文再转换成二进制报文下发至设备,为空表示不作转换,透传下发至设备
:type PayloadEncoding: str
"""
self.ProductId = None
self.DeviceName = None
self.Topic = None
self.Payload = None
self.Qos = None
self.PayloadEncoding = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.Topic = params.get("Topic")
self.Payload = params.get("Payload")
self.Qos = params.get("Qos")
self.PayloadEncoding = params.get("PayloadEncoding")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class PublishMessageResponse(AbstractModel):
"""PublishMessage返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ReportAliveDeviceRequest(AbstractModel):
"""ReportAliveDevice请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
"""
self.ProductId = None
self.DeviceName = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ReportAliveDeviceResponse(AbstractModel):
"""ReportAliveDevice返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class ResetCloudStorageRequest(AbstractModel):
"""ResetCloudStorage请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
:param ChannelId: 通道ID 非NVR设备则不填 NVR设备则必填 默认为无
:type ChannelId: int
:param UserId: 云存用户Id,为空则为默认云存空间。
:type UserId: str
"""
self.ProductId = None
self.DeviceName = None
self.ChannelId = None
self.UserId = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.ChannelId = params.get("ChannelId")
self.UserId = params.get("UserId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ResetCloudStorageResponse(AbstractModel):
"""ResetCloudStorage返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class RetryDeviceFirmwareTaskRequest(AbstractModel):
"""RetryDeviceFirmwareTask请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param DeviceName: 设备名称
:type DeviceName: str
:param FirmwareVersion: 固件版本号
:type FirmwareVersion: str
:param TaskId: 固件升级任务ID
:type TaskId: int
"""
self.ProductID = None
self.DeviceName = None
self.FirmwareVersion = None
self.TaskId = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.DeviceName = params.get("DeviceName")
self.FirmwareVersion = params.get("FirmwareVersion")
self.TaskId = params.get("TaskId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class RetryDeviceFirmwareTaskResponse(AbstractModel):
"""RetryDeviceFirmwareTask返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class SDKLogItem(AbstractModel):
"""SDK日志项
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param DeviceName: 设备名称
:type DeviceName: str
:param Level: 日志等级
:type Level: str
:param DateTime: 日志时间
:type DateTime: str
:param Content: 日志内容
:type Content: str
"""
self.ProductID = None
self.DeviceName = None
self.Level = None
self.DateTime = None
self.Content = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.DeviceName = params.get("DeviceName")
self.Level = params.get("Level")
self.DateTime = params.get("DateTime")
self.Content = params.get("Content")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class SearchKeyword(AbstractModel):
"""搜索关键词
"""
def __init__(self):
r"""
:param Key: 搜索条件的Key
:type Key: str
:param Value: 搜索条件的值
:type Value: str
"""
self.Key = None
self.Value = None
def _deserialize(self, params):
self.Key = params.get("Key")
self.Value = params.get("Value")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class SetForwardAuthRequest(AbstractModel):
"""SetForwardAuth请求参数结构体
"""
def __init__(self):
r"""
:param Skey: 控制台Skey
:type Skey: str
:param QueueType: 消息队列类型 0.CMQ 1.CKafka
:type QueueType: int
"""
self.Skey = None
self.QueueType = None
def _deserialize(self, params):
self.Skey = params.get("Skey")
self.QueueType = params.get("QueueType")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class SetForwardAuthResponse(AbstractModel):
"""SetForwardAuth返回参数结构体
"""
def __init__(self):
r"""
:param Endpoint: 腾讯云账号
:type Endpoint: str
:param Result: 结果
:type Result: int
:param RoleName: 角色名
:type RoleName: str
:param RoleID: 角色ID
:type RoleID: int
:param QueueType: 消息队列类型 0.CMQ 1.CKafka
:type QueueType: int
:param ErrMsg: 错误消息
:type ErrMsg: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Endpoint = None
self.Result = None
self.RoleName = None
self.RoleID = None
self.QueueType = None
self.ErrMsg = None
self.RequestId = None
def _deserialize(self, params):
self.Endpoint = params.get("Endpoint")
self.Result = params.get("Result")
self.RoleName = params.get("RoleName")
self.RoleID = params.get("RoleID")
self.QueueType = params.get("QueueType")
self.ErrMsg = params.get("ErrMsg")
self.RequestId = params.get("RequestId")
class StatusStatistic(AbstractModel):
"""状态统计信息
"""
def __init__(self):
r"""
:param Status: 任务状态
注意:此字段可能返回 null,表示取不到有效值。
:type Status: int
:param Total: 统计总数
注意:此字段可能返回 null,表示取不到有效值。
:type Total: int
"""
self.Status = None
self.Total = None
def _deserialize(self, params):
self.Status = params.get("Status")
self.Total = params.get("Total")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class TransferCloudStorageRequest(AbstractModel):
"""TransferCloudStorage请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 已开通云存的设备名称
:type DeviceName: str
:param ToDeviceName: 未开通云存的设备名称
:type ToDeviceName: str
"""
self.ProductId = None
self.DeviceName = None
self.ToDeviceName = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
self.ToDeviceName = params.get("ToDeviceName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class TransferCloudStorageResponse(AbstractModel):
"""TransferCloudStorage返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class UpdateAIModelChannelRequest(AbstractModel):
"""UpdateAIModelChannel请求参数结构体
"""
def __init__(self):
r"""
:param ModelId: 模型ID
:type ModelId: str
:param ProductId: 产品ID
:type ProductId: str
:param Type: 推送类型。ckafka:消息队列;forward:http/https推送
:type Type: str
:param ForwardAddress: 第三方推送地址
:type ForwardAddress: str
:param ForwardKey: 第三方推送密钥,不填写则腾讯云自动生成。
:type ForwardKey: str
:param CKafkaRegion: ckafka地域
:type CKafkaRegion: str
:param CKafkaInstance: ckafka实例
:type CKafkaInstance: str
:param CKafkaTopic: ckafka订阅主题
:type CKafkaTopic: str
"""
self.ModelId = None
self.ProductId = None
self.Type = None
self.ForwardAddress = None
self.ForwardKey = None
self.CKafkaRegion = None
self.CKafkaInstance = None
self.CKafkaTopic = None
def _deserialize(self, params):
self.ModelId = params.get("ModelId")
self.ProductId = params.get("ProductId")
self.Type = params.get("Type")
self.ForwardAddress = params.get("ForwardAddress")
self.ForwardKey = params.get("ForwardKey")
self.CKafkaRegion = params.get("CKafkaRegion")
self.CKafkaInstance = params.get("CKafkaInstance")
self.CKafkaTopic = params.get("CKafkaTopic")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class UpdateAIModelChannelResponse(AbstractModel):
"""UpdateAIModelChannel返回参数结构体
"""
def __init__(self):
r"""
:param ForwardKey: 第三方推送密钥,如果选择自动生成则会返回此字段
注意:此字段可能返回 null,表示取不到有效值。
:type ForwardKey: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.ForwardKey = None
self.RequestId = None
def _deserialize(self, params):
self.ForwardKey = params.get("ForwardKey")
self.RequestId = params.get("RequestId")
class UploadFirmwareRequest(AbstractModel):
"""UploadFirmware请求参数结构体
"""
def __init__(self):
r"""
:param ProductID: 产品ID
:type ProductID: str
:param FirmwareVersion: 固件版本号
:type FirmwareVersion: str
:param Md5sum: 固件的MD5值
:type Md5sum: str
:param FileSize: 固件的大小
:type FileSize: int
:param FirmwareName: 固件名称
:type FirmwareName: str
:param FirmwareDescription: 固件描述
:type FirmwareDescription: str
"""
self.ProductID = None
self.FirmwareVersion = None
self.Md5sum = None
self.FileSize = None
self.FirmwareName = None
self.FirmwareDescription = None
def _deserialize(self, params):
self.ProductID = params.get("ProductID")
self.FirmwareVersion = params.get("FirmwareVersion")
self.Md5sum = params.get("Md5sum")
self.FileSize = params.get("FileSize")
self.FirmwareName = params.get("FirmwareName")
self.FirmwareDescription = params.get("FirmwareDescription")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class UploadFirmwareResponse(AbstractModel):
"""UploadFirmware返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId")
class VideoBatch(AbstractModel):
"""批次元数据
"""
def __init__(self):
r"""
:param Id: 批次ID
:type Id: int
:param UserId: 用户ID
:type UserId: str
:param ProductId: 产品ID
:type ProductId: str
:param Status: 状态:1:待创建设备 2:创建中 3:已完成
:type Status: int
:param DevPre: 设备前缀
:type DevPre: str
:param DevNum: 设备数量
:type DevNum: int
:param DevNumCreated: 已创建设备数量
:type DevNumCreated: int
:param BatchURL: 批次下载地址
:type BatchURL: str
:param CreateTime: 创建时间。unix时间戳
:type CreateTime: int
:param UpdateTime: 修改时间。unix时间戳
:type UpdateTime: int
"""
self.Id = None
self.UserId = None
self.ProductId = None
self.Status = None
self.DevPre = None
self.DevNum = None
self.DevNumCreated = None
self.BatchURL = None
self.CreateTime = None
self.UpdateTime = None
def _deserialize(self, params):
self.Id = params.get("Id")
self.UserId = params.get("UserId")
self.ProductId = params.get("ProductId")
self.Status = params.get("Status")
self.DevPre = params.get("DevPre")
self.DevNum = params.get("DevNum")
self.DevNumCreated = params.get("DevNumCreated")
self.BatchURL = params.get("BatchURL")
self.CreateTime = params.get("CreateTime")
self.UpdateTime = params.get("UpdateTime")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class VideoProduct(AbstractModel):
"""video产品元数据
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param ProductName: 产品名称
:type ProductName: str
:param DeviceType: 产品设备类型(普通设备) 1.普通设备
:type DeviceType: int
:param EncryptionType: 认证方式:2:PSK
:type EncryptionType: int
:param Features: 设备功能码
:type Features: list of str
:param ChipOs: 操作系统
:type ChipOs: str
:param ChipManufactureId: 芯片厂商id
:type ChipManufactureId: str
:param ChipId: 芯片id
:type ChipId: str
:param ProductDescription: 产品描述信息
:type ProductDescription: str
:param CreateTime: 创建时间unix时间戳
:type CreateTime: int
:param UpdateTime: 修改时间unix时间戳
:type UpdateTime: int
:param NetType: 连接类型,wifi表示WIFI连接,cellular表示4G连接
注意:此字段可能返回 null,表示取不到有效值。
:type NetType: str
"""
self.ProductId = None
self.ProductName = None
self.DeviceType = None
self.EncryptionType = None
self.Features = None
self.ChipOs = None
self.ChipManufactureId = None
self.ChipId = None
self.ProductDescription = None
self.CreateTime = None
self.UpdateTime = None
self.NetType = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.ProductName = params.get("ProductName")
self.DeviceType = params.get("DeviceType")
self.EncryptionType = params.get("EncryptionType")
self.Features = params.get("Features")
self.ChipOs = params.get("ChipOs")
self.ChipManufactureId = params.get("ChipManufactureId")
self.ChipId = params.get("ChipId")
self.ProductDescription = params.get("ProductDescription")
self.CreateTime = params.get("CreateTime")
self.UpdateTime = params.get("UpdateTime")
self.NetType = params.get("NetType")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class WakeUpDeviceRequest(AbstractModel):
"""WakeUpDevice请求参数结构体
"""
def __init__(self):
r"""
:param ProductId: 产品ID
:type ProductId: str
:param DeviceName: 设备名称
:type DeviceName: str
"""
self.ProductId = None
self.DeviceName = None
def _deserialize(self, params):
self.ProductId = params.get("ProductId")
self.DeviceName = params.get("DeviceName")
memeber_set = set(params.keys())
for name, value in vars(self).items():
if name in memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class WakeUpDeviceResponse(AbstractModel):
"""WakeUpDevice返回参数结构体
"""
def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None
def _deserialize(self, params):
self.RequestId = params.get("RequestId") | 28.192751 | 144 | 0.592357 | 16,922 | 168,790 | 5.821889 | 0.0705 | 0.063126 | 0.020433 | 0.02229 | 0.743509 | 0.707921 | 0.668741 | 0.655819 | 0.630697 | 0.616974 | 0 | 0.004031 | 0.30186 | 168,790 | 5,987 | 145 | 28.192751 | 0.832008 | 0.280218 | 0 | 0.784139 | 0 | 0 | 0.075563 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.130156 | false | 0 | 0.001422 | 0 | 0.196657 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7d5901bcdafac97d067642690f800448810c51f9 | 207 | py | Python | dataherb/parse/csv.py | DataHerb/dataherb-python | 91f2787eabb450d653b0b9dbc9bb78980d13460f | [
"MIT"
] | 4 | 2021-08-08T21:31:40.000Z | 2022-02-11T03:13:47.000Z | dataherb/parse/csv.py | DataHerb/dataherb-python | 91f2787eabb450d653b0b9dbc9bb78980d13460f | [
"MIT"
] | 9 | 2020-03-15T15:38:46.000Z | 2021-11-04T08:23:43.000Z | dataherb/parse/csv.py | DataHerb/dataherb-python | 91f2787eabb450d653b0b9dbc9bb78980d13460f | [
"MIT"
] | 2 | 2020-03-23T17:00:23.000Z | 2021-08-06T00:03:18.000Z | from loguru import logger
from dataherb.parse.model import MetaData
import sys
logger.remove()
logger.add(sys.stderr, level="INFO", enqueue=True)
if __name__ == "__main__":
logger.debug("End of Game")
| 20.7 | 50 | 0.748792 | 30 | 207 | 4.9 | 0.766667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 207 | 9 | 51 | 23 | 0.816667 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
7d742235a2ad2107abe0e8412df64efdae822f5d | 44,929 | py | Python | Neural Network HW2/berkan_ozdamar_21602353_hw2.py | ozdamarberkan/Neural_Networks | d46fac2f6d0c089906ebc335d3a0a1dfd3a3b22a | [
"MIT"
] | null | null | null | Neural Network HW2/berkan_ozdamar_21602353_hw2.py | ozdamarberkan/Neural_Networks | d46fac2f6d0c089906ebc335d3a0a1dfd3a3b22a | [
"MIT"
] | null | null | null | Neural Network HW2/berkan_ozdamar_21602353_hw2.py | ozdamarberkan/Neural_Networks | d46fac2f6d0c089906ebc335d3a0a1dfd3a3b22a | [
"MIT"
] | null | null | null |
import sys
import numpy as np
import h5py
import matplotlib.pyplot as plt
question = sys.argv[1]
def berkan_ozdamar_21602353_hw2(question):
if question == '1':
import numpy as np
import h5py
import matplotlib.pyplot as plt
# Part A
f = h5py.File('assign2_data1.h5', 'r')
dataKeys = list(f.keys())
print('The data keys are:' + str(dataKeys))
# Gathering the train images, test images, train labels and test labels.
testims = f['testims']
testlbls = f['testlbls']
trainims = f['trainims']
trainlbls = f['trainlbls']
print('The size of testims is: ' + str(np.shape(testims)))
print('The size of testlbls is: ' + str(np.shape(testlbls)))
print('The size of trainims is: ' + str(np.shape(trainims)))
print('The size of trainlbls is: ' + str(np.shape(trainlbls)))
figureNum = 0
plt.figure(figureNum)
plt.title('Example of a Cat Image')
plt.imshow(trainims[0].T, cmap='gray')
plt.show()
figureNum = 0
plt.figure(figureNum)
plt.title('Example of a Car Image')
plt.imshow(trainims[1500].T, cmap='gray')
plt.show()
class HiddenLayer:
def __init__(self, neuronNum, neuronSize, mean, std):
'''
This class creates a hidden laer for neural network.
Weights and bias are initially random Gaussian distribution.
INPUTS:
neuronNum : neuronNum is the features a neuron holds.
neuronSize : neuronSize is the number of neurons in a hidden layer.
mean : mean for Gaussian distribution.
std : Standard deviation for Gaussian distribution.
RETURNS:
'''
np.random.seed(15)
self.weights = np.random.normal(loc=mean, scale=std, size=(neuronNum, neuronSize))
self.bias = np.random.normal(loc=mean, scale=std, size=(1, neuronSize))
self.Z = None
self.A = None
self.grad = None
self.dB = None
self.dW = None
self.error = None
self.momentum_dw = 0
self.momentum_db = 0
class MLP:
def __init__(self, momentum=False, momentumCoef=0):
'''
This class creates a multilayer perceptron network.
INPUTS:
momentum : momentum is the boolean for the network which indicates
whether the momentum learning will be done or not
momentumCoef : Coefficient of momentum learning
RETURNS:
'''
self.momentum = momentum
self.momentumCoef = momentumCoef
self.layers = list()
self.batchSize = 0
def addLayer(self, layer):
'''
This function adds a HiddenLayer class to the network.
INPUTS:
layer : layer is an instance of HiddenLayer class
RETURNS:
'''
self.layers.append(layer)
def tanh(self, x):
'''
This function is the hyperbolic tangent for the activation functions of each neuron.
INPUTS:
x : x is the weighted sum which will be pushed to activation function.
RETURNS:
result : result is the hyperbolic tangent of the input x.
'''
result = 2 / (1 + np.exp(-2 * x)) - 1
return result
def der_tanh(self, x):
'''
This function is the derivative hyperbolic tangent. This function will be used in backpropagation.
INPUTS:
x : x is the input.
RETURNS:
result : result is the derivative of hyperbolic tangent of the input x.
'''
result = 1 - self.tanh(x) ** 2
return result
def MSE(self, y, y_pred):
'''
MSE is the loss function for the network.
INPUTS:
y : y is the labels for our data.
y_pred : y_pred is the network's prediction.
RETURNS:
loss : loss is the mean squared error between y and y_pred.
'''
error = y - y_pred
loss = np.mean(error ** 2)
return loss
def der_MSE(self, y, y_pred):
'''
der_MSE is the derivative of loss function for the network.
This function will be used for backpropagation.
INPUTS:
y : y is the labels for our data.
y_pred : y_pred is the network's prediction.
RETURNS:
result : result is the derivative of the MSE between y and y_pred.
'''
result = y_pred - y
return result
def MCE(self, y, y_pred):
'''
MCE is the accuracy of our network. Mean classification error will be calculated to find accuracy.
INPUTS:
y : y is the labels for our data.
y_pred : y_pred is the network's prediction.
RETURNS:
: returns the accuracy between y and y_pred.
'''
count = 0
for i in range(len(y)):
if (y[i] == y_pred[i]):
count += 1
return 100 * (count / len(y))
def forward(self, data):
'''
forward function is the forward propagation.
INPUTS:
data : data is the input which will pushed to forward propagation.
RETURNS:
: returns the prediction of the network.
'''
layerSize = np.shape(self.layers)[0]
for i in range(layerSize):
# 1st Hidden Layer
if (i == 0):
self.layers[i].A = data.dot(self.layers[i].weights) + self.layers[i].bias
self.layers[i].Z = self.tanh(self.layers[i].A)
# Other Hidden Layers and Output Layer
else:
self.layers[i].A = (self.layers[i - 1].Z).dot(self.layers[i].weights) + self.layers[i].bias
self.layers[i].Z = self.tanh(self.layers[i].A)
return self.layers[-1].Z
def back_propagation(self, data, label):
'''
back_propagation function is the back propagation algorithm for weight and bias updates.
back_propagation function first calls forward function to predict the output of network which us y_pred.
INPUTS:
data : data is the input.
label : label is the labels of the data.
RETURNS:
'''
layerSize = np.shape(self.layers)[0]
y_pred = self.forward(data)
for i in range(layerSize)[::-1]:
# Output Layer
if (i == layerSize - 1):
self.layers[i].error = self.der_MSE(label, y_pred)
self.layers[i].error = np.array(self.layers[i].error).reshape(-1, 1)
self.layers[i].grad = (self.layers[i].error) * (self.der_tanh(self.layers[i].A))
self.layers[i].dW = (self.layers[i - 1].Z).T.dot(self.layers[i].grad)
self.layers[i].dB = np.sum(self.layers[i].grad, axis=0, keepdims=True)
# 1st Hidden Layer
elif (i == 0):
self.layers[i].error = (self.layers[i + 1].grad).dot(self.layers[i + 1].weights.T)
self.layers[i].grad = (self.layers[i].error) * self.der_tanh(self.layers[i].A)
self.layers[i].dW = data.T.dot(self.layers[i].grad)
self.layers[i].dB = np.sum(self.layers[i].grad, axis=0, keepdims=True)
# Other Hidden Layers
else:
self.layers[i].error = (self.layers[i + 1].grad).dot(self.layers[i + 1].weights.T)
self.layers[i].grad = (self.layers[i].error) * self.der_tanh(self.layers[i].A)
self.layers[i].dW = (self.layers[i - 1].Z).T.dot(self.layers[i].grad)
self.layers[i].dB = np.sum(self.layers[i].grad, axis=0, keepdims=True)
def update_weights(self, data, label, learningRate):
'''
update_weights function updates the weights with the gradients found with back_propagation.
INPUTS:
data : data is the input.
label : label is the labels of the data.
learnigRate : learningRate is the coefficient for the weight update.
RETURNS:
'''
layerSize = np.shape(self.layers)[0]
self.back_propagation(data, label)
# If momentum is used.
if (self.momentum == True):
for i in range(layerSize):
self.layers[i].momentum_dw = self.layers[i].dW + (
self.momentumCoef * self.layers[i].momentum_dw)
self.layers[i].momentum_db = self.layers[i].dB + (
self.momentumCoef * self.layers[i].momentum_db)
self.layers[i].weights -= (learningRate * self.layers[i].momentum_dw) / self.batchSize
self.layers[i].bias -= (learningRate * self.layers[i].momentum_db) / self.batchSize
# If momentum is not used.
else:
for i in range(layerSize):
self.layers[i].weights -= (learningRate * self.layers[i].dW) / self.batchSize
self.layers[i].bias -= (learningRate * self.layers[i].dB) / self.batchSize
def predict(self, y_pred):
'''
predict function predicts and output from the network's output y_pred.
INPUTS:
y_pred : MLP's output.
RETURNS:
: returns the label for prediction of the network.
'''
return np.where(y_pred >= 0, 1, -1)
def trainNetwork(self, data, label, testData, testLabel, learningRate, batchNum, epoch):
'''
trainNetwork function calls the update_weights function to train the network over mini-batches
for fiven number of epochs.
INPUTS:
data : data is the training data.
label : label is the labels of the data.
testData : testData is the test data.
testLabel : testLabel is the labels of the testData.
learnigRate : learningRate is the coefficient for the weight update.
batchNum : batchNum is the number of mini-batches.
epoch : Number of times the network train the whole data.
RETURNS:
MSE_loss : MSE loss of the training data.
MCE_loss : MCE loss of the training data.
test_MSE : MSE loss of the test data.
test_MCE : MCE loss of the test data.
'''
MSE_loss = list()
MCE_loss = list()
test_MSE = list()
test_MCE = list()
np.random.seed(7)
for i in range(epoch):
randomIndexes = np.random.permutation(len(label))
data = data[randomIndexes]
label = label[randomIndexes]
batchLength = len(label) / batchNum
self.batchSize = batchLength
for j in range(batchNum):
start = int(batchLength * j)
end = int(batchLength * (j + 1))
self.update_weights(data[start:end], label[start:end], learningRate)
y_pred = self.forward(data)
loss = self.MSE(label, y_pred)
MSE_loss.append(loss)
loss_MCE = self.MCE(label, self.predict(y_pred))
MCE_loss.append(loss_MCE)
y_pred_test = self.forward(testData)
test_loss = self.MSE(testLabel, y_pred_test)
test_MSE.append(test_loss)
test_loss_MCE = self.MCE(testLabel, self.predict(y_pred_test))
test_MCE.append(test_loss_MCE)
return MSE_loss, MCE_loss, test_MSE, test_MCE
trainimages = np.asarray(trainims)
testimages = np.asarray(testims)
trainlabels = np.asarray(trainlbls)
testlabels = np.asarray(testlbls)
trainlabels = np.where(trainlabels == 0, -1, 1)
testlabels = np.where(testlabels == 0, -1, 1)
trainlabels = trainlabels.reshape(-1, 1)
testlabels = testlabels.reshape(-1, 1)
train_img_flat = trainimages.reshape(1900, 32 ** 2)
test_img_flat = testimages.reshape(1000, 32 ** 2)
# learningRate = np.arange(0.1, 0.5, 0.05)
# N_layer = np.arange(10,20,2)
# best_lr = 0
# best_n = 0
# mse_best = np.inf
# for n in N_layer:
# print(n)
# neuralNet = MLP()
# neuralNet.addLayer(HiddenLayer(32**2, n, 0, 0.02))
# neuralNet.addLayer(HiddenLayer(n, 1, 0, 0.02))
# for lr in learningRate:
# mse_loss, mce_loss, test_mse, test_mce = neuralNet.trainNetwork(train_img_flat/255, trainlabels, test_img_flat/255, testlabels, lr, 50, 300)
# if(mse_loss[-1] < mse_best):
# best_lr = lr
# best_n = n
# mse_best = mse_loss[-1]
# print("Best Learning Rate: " +str(best_lr))
# print("Best Number of Hidden Neuron: " +str(best_n))
best_lr = 0.35
best_n = 20
neuralNet = MLP()
neuralNet.addLayer(HiddenLayer(32 ** 2, best_n, 0, 0.02))
neuralNet.addLayer(HiddenLayer(best_n, 1, 0, 0.02))
mse_loss, mce_loss, test_mse, test_mce = neuralNet.trainNetwork(train_img_flat / 255, trainlabels,
test_img_flat / 255, testlabels, best_lr, 50,
250)
figureNum = 0
plt.figure(figureNum)
plt.plot(mse_loss)
plt.title('MSE Over Training Data')
plt.xlabel('Epoch')
plt.ylabel('MSE')
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(mce_loss)
plt.title('MCE Over Training Data')
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(test_mse)
plt.title('MSE Over Test Data')
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(test_mce)
plt.title('MCE Over Test Data')
plt.show()
print(np.argmax(test_mce))
# Part C
best_lr = 0.35
high_n = 200
neuralNet = MLP()
neuralNet.addLayer(HiddenLayer(32 ** 2, high_n, 0, 0.02))
neuralNet.addLayer(HiddenLayer(high_n, 1, 0, 0.02))
mse_loss_highN, mce_loss_highN, test_mse_highN, test_mce_highN = neuralNet.trainNetwork(train_img_flat / 255,
trainlabels,
test_img_flat / 255,
testlabels, best_lr, 50,
250)
best_lr = 0.35
low_n = 4
neuralNet = MLP()
neuralNet.addLayer(HiddenLayer(32 ** 2, low_n, 0, 0.02))
neuralNet.addLayer(HiddenLayer(low_n, 1, 0, 0.02))
mse_loss_lowN, mce_loss_lowN, test_mse_lowN, test_mce_lowN = neuralNet.trainNetwork(train_img_flat / 255,
trainlabels,
test_img_flat / 255,
testlabels, best_lr, 50,
250)
figureNum += 1
plt.figure(figureNum)
plt.plot(mse_loss)
plt.plot(mse_loss_highN)
plt.plot(mse_loss_lowN)
plt.title('MSE Over Training Data')
plt.xlabel('Epoch')
plt.ylabel('MSE')
plt.legend(
["Hidden Neuron = " + str(best_n), "Hidden Neuron = " + str(high_n), "Hidden Neuron = " + str(low_n)])
plt.grid()
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(mce_loss)
plt.plot(mce_loss_highN)
plt.plot(mce_loss_lowN)
plt.title('MCE Over Training Data')
plt.xlabel('Epoch')
plt.ylabel('MCE')
plt.legend(
["Hidden Neuron = " + str(best_n), "Hidden Neuron = " + str(high_n), "Hidden Neuron = " + str(low_n)])
plt.grid()
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(test_mse)
plt.plot(test_mse_highN)
plt.plot(test_mse_lowN)
plt.title('MSE Over Test Data')
plt.xlabel('Epoch')
plt.ylabel('MSE')
plt.legend(
["Hidden Neuron = " + str(best_n), "Hidden Neuron = " + str(high_n), "Hidden Neuron = " + str(low_n)])
plt.grid()
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(test_mce)
plt.plot(test_mce_highN)
plt.plot(test_mce_lowN)
plt.title('MCE Over Test Data')
plt.xlabel('Epoch')
plt.ylabel('MCE')
plt.legend(
["Hidden Neuron = " + str(best_n), "Hidden Neuron = " + str(high_n), "Hidden Neuron = " + str(low_n)])
plt.grid()
plt.show()
# Part D
neuralNet_2L = MLP()
neuralNet_2L.addLayer(HiddenLayer(32 ** 2, 512, 0, 0.02))
neuralNet_2L.addLayer(HiddenLayer(512, 64, 0, 0.02))
neuralNet_2L.addLayer(HiddenLayer(64, 1, 0, 0.02))
mse_loss_2l, mce_loss_2l, test_mse_2l, test_mce_2l = neuralNet_2L.trainNetwork(train_img_flat / 255,
trainlabels, test_img_flat / 255,
testlabels, 0.35, 50, 200)
figureNum += 1
plt.figure(figureNum)
plt.title('MSE Over Training Data (2 Hidden Layer)')
plt.xlabel('Epoch')
plt.ylabel('MSE')
plt.plot(mse_loss_2l)
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.title('MCE Over Training Data (2 Hidden Layer)')
plt.xlabel('Epoch')
plt.ylabel('MCE')
plt.plot(mce_loss_2l)
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.title('MSE Over Test Data (2 Hidden Layer)')
plt.xlabel('Epoch')
plt.ylabel('MSE')
plt.plot(test_mse_2l)
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.title('MCE Over Test Data (2 Hidden Layer)')
plt.xlabel('Epoch')
plt.ylabel('MCE')
plt.plot(test_mce_2l)
plt.show()
# Part E
neuralNet_2L = MLP(momentum=True, momentumCoef=0.2)
neuralNet_2L.addLayer(HiddenLayer(32 ** 2, 512, 0, 0.02))
neuralNet_2L.addLayer(HiddenLayer(512, 64, 0, 0.02))
neuralNet_2L.addLayer(HiddenLayer(64, 1, 0, 0.02))
mse_loss_2l_m, mce_loss_2l_m, test_mse_2l_m, test_mce_2l_m = neuralNet_2L.trainNetwork(train_img_flat / 255,
trainlabels,
test_img_flat / 255,
testlabels, 0.35, 50,
200)
figureNum += 1
plt.figure(figureNum)
plt.plot(mse_loss_2l)
plt.plot(mse_loss_2l_m)
plt.title('MSE Over Training Data (2 Hidden Layer)')
plt.xlabel('Epoch')
plt.ylabel('MSE')
plt.legend(["w/o Momentum", "with Momentum"])
plt.grid()
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(mce_loss_2l)
plt.plot(mce_loss_2l_m)
plt.title('MCE Over Training Data (2 Hidden Layer)')
plt.xlabel('Epoch')
plt.ylabel('MCE')
plt.legend(["w/o Momentum", "with Momentum"])
plt.grid()
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(test_mse_2l)
plt.plot(test_mse_2l_m)
plt.title('MSE Over Test Data (2 Hidden Layer)')
plt.xlabel('Epoch')
plt.ylabel('MSE')
plt.legend(["w/o Momentum", "with Momentum"])
plt.grid()
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.plot(test_mce_2l)
plt.plot(test_mce_2l_m)
plt.title('MCE Over Test Data (2 Hidden Layer)')
plt.xlabel('Epoch')
plt.ylabel('MCE')
plt.legend(["w/o Momentum", "with Momentum"])
plt.grid()
plt.show()
elif question == '2' :
import numpy as np
import h5py
import matplotlib.pyplot as plt
# Part A
f = h5py.File('assign2_data2.h5', 'r')
dataKeys = list(f.keys())
print('The data keys are:' + str(dataKeys))
# Gathering the train images, test images, train labels and test labels.
testdata = np.asarray(f['testx'])
testlbls = np.asarray(f['testd'])
traindata = np.asarray(f['trainx'])
trainlbls = np.asarray(f['traind'])
validdata = np.asarray(f['valx'])
validlbls = np.asarray(f['vald'])
words = np.asarray(f['words'])
print('The size of testdata is: ' + str(np.shape(testdata)))
print('The size of testlbls is: ' + str(np.shape(testlbls)))
print('The size of traindata is: ' + str(np.shape(traindata)))
print('The size of trainlbls is: ' + str(np.shape(trainlbls)))
print('The size of validdata is: ' + str(np.shape(validdata)))
print('The size of validlbls is: ' + str(np.shape(validlbls)))
print('The size of words is: ' + str(np.shape(words)))
# One Hot Encode Transform
def one_hot_encoder(x):
samplesize = np.shape(x)[0]
x = x.reshape(samplesize, -1)
featuresize = np.shape(x)[1]
result = np.zeros((samplesize, featuresize, 250))
for i in range(samplesize):
for j in range(featuresize):
a = x[i, j]
result[i, j, a - 1] = 1
if (featuresize == 1):
result = result.reshape(-1, 250)
else:
result = result.reshape(samplesize, 250, featuresize)
return result
train_data = one_hot_encoder(traindata)
train_labels = one_hot_encoder(trainlbls)
test_data = one_hot_encoder(testdata)
test_labels = one_hot_encoder(testlbls)
val_data = one_hot_encoder(validdata)
val_labels = one_hot_encoder(validlbls)
print('The size of test_data is: ' + str(np.shape(test_data)))
print('The size of test_labels is: ' + str(np.shape(test_labels)))
print('The size of train_data is: ' + str(np.shape(train_data)))
print('The size of train_labels is: ' + str(np.shape(train_labels)))
print('The size of val_data is: ' + str(np.shape(val_data)))
print('The size of val_labels is: ' + str(np.shape(val_labels)))
class HiddenLayer:
def __init__(self, neuronNum, neuronSize, mean, std):
'''
This class creates a hidden laer for neural network.
Weights and bias are initially random Gaussian distribution.
INPUTS:
neuronNum : neuronNum is the features a neuron holds.
neuronSize : neuronSize is the number of neurons in a hidden layer.
mean : mean for Gaussian distribution.
std : Standard deviation for Gaussian distribution.
RETURNS:
'''
np.random.seed(8)
self.weights = np.random.normal(loc=mean, scale=std, size=(neuronNum, neuronSize))
self.bias = np.random.normal(loc=mean, scale=std, size=(1, neuronSize))
self.Z = None
self.A = None
self.grad = None
self.dB = None
self.dW = None
self.error = None
self.momentum_dw = 0
self.momentum_db = 0
class MLP:
def __init__(self, momentum=False, momentumCoef=0):
'''
This class creates a multilayer perceptron network.
INPUTS:
momentum : momentum is the boolean for the network which indicates
whether the momentum learning will be done or not
momentumCoef : Coefficient of momentum learning
RETURNS:
'''
self.momentum = momentum
self.momentumCoef = momentumCoef
self.layers = list()
self.batchSize = 0
def addLayer(self, layer):
'''
This function adds a HiddenLayer class to the network.
INPUTS:
layer : layer is an instance of HiddenLayer class
RETURNS:
'''
self.layers.append(layer)
def sigmoid(self, x):
'''
This function is the sigmoid for the activation function.
INPUTS:
x : x is the weighted sum which will be pushed to activation function.
RETURNS:
result : result is the sigmoid of the input x.
'''
result = 1 / (1 + np.exp(-x))
return result
def der_sigmoid(self, x):
'''
This function is the derivative of sigmoid function.
INPUTS:
x : x is the input.
RETURNS:
result : result is the derivative of sigmoid of the input x.
'''
result = self.sigmoid(x) * (1 - self.sigmoid(x))
return result
def softmax(self, x):
'''
This function is the softmax for the activation function of output layer.
INPUTS:
x : x is the weighted sum which will be pushed to activation function.
RETURNS:
result : result is the softmax of the input x.
'''
e_x = np.exp(x - np.max(x, axis=-1, keepdims=True))
result = e_x / np.sum(e_x, axis=-1, keepdims=True)
return result
def der_softmax(self, x):
'''
This function is the derivative of softmax.
INPUTS:
x : x is the input.
RETURNS:
result : result is the derivative of softmax of the input x.
'''
p = self.softmax(x)
result = p * (1 - p)
return result
def we(self, x):
'''
This function is the word embedding layer's activation function.
INPUTS:
x : x is the weighted sum which will be pushed to activation function.
RETURNS:
result : result is the x itself.
'''
return x
def der_we(self, x):
'''
This function is the derivative of word embedding layer's activation function.
INPUTS:
x : x is input.
RETURNS:
result : result is an array of ones with x's shape..
'''
return np.ones(x.shape)
def cross_entropy(self, y, y_pred):
'''
cross_entropy is the loss function for the network.
INPUTS:
y : y is the labels for our data.
y_pred : y_pred is the network's prediction.
RETURNS:
cost : cost is the cross entropy error between y and y_pred.
'''
# To avoid 0
y_pred = np.clip(y_pred, 1e-15, 1 - 1e-15)
cost = -np.mean(y * np.log(y_pred) + (1 - y) * np.log(1 - y_pred))
return cost
def der_cross_entropy(self, y, y_pred):
'''
der_cross_entropy is the derivative of loss function for the network.
INPUTS:
y : y is the labels for our data.
y_pred : y_pred is the network's prediction.
RETURNS:
: returns the derivative of cross entropy error between y and y_pred.
'''
# To avoid division by 0.
y_pred = np.clip(y_pred, 1e-15, 1 - 1e-15)
return - (y / y_pred) + (1 - y) / (1 - y_pred)
def forward(self, data):
'''
forward function is the forward propagation.
INPUTS:
data : data is the input which will pushed to forward propagation.
RETURNS:
: returns the prediction of the network.
'''
layerSize = np.shape(self.layers)[0]
for i in range(layerSize):
# Output Layer
if (i == layerSize - 1):
self.layers[i].A = (self.layers[i - 1].Z).dot(self.layers[i].weights) + self.layers[i].bias
self.layers[i].Z = self.softmax(self.layers[i].A)
# 1st Hidden Layer
if (i == 0):
self.layers[i].A = data.dot(self.layers[i].weights) + self.layers[i].bias
self.layers[i].Z = self.we(self.layers[i].A)
# Other Hidden Layers
else:
self.layers[i].A = (self.layers[i - 1].Z).dot(self.layers[i].weights) + self.layers[i].bias
self.layers[i].Z = self.sigmoid(self.layers[i].A)
return self.layers[-1].Z
def back_propagation(self, data, label):
'''
back_propagation function is the back propagation algorithm for weight and bias updates.
back_propagation function first calls forward function to predict the output of network which us y_pred.
INPUTS:
data : data is the input.
label : label is the labels of the data.
RETURNS:
'''
layerSize = np.shape(self.layers)[0]
y_pred = self.forward(data)
for i in range(layerSize)[::-1]:
# Output Layer
if (i == layerSize - 1):
self.layers[i].error = self.der_cross_entropy(label, y_pred)
self.layers[i].grad = (self.layers[i].error) * (self.der_softmax(self.layers[i].A))
self.layers[i].dW = (self.layers[i - 1].Z).T.dot(self.layers[i].grad)
self.layers[i].dB = np.sum(self.layers[i].grad, axis=0, keepdims=True)
# 1st Hidden Layer
elif (i == 0):
self.layers[i].error = (self.layers[i + 1].grad).dot(self.layers[i + 1].weights.T)
self.layers[i].grad = (self.layers[i].error) * self.der_we(self.layers[i].A)
self.layers[i].dW = data.T.dot(self.layers[i].grad)
self.layers[i].dB = np.sum(self.layers[i].grad, axis=0, keepdims=True)
# Other Layers
else:
self.layers[i].error = (self.layers[i + 1].grad).dot(self.layers[i + 1].weights.T)
self.layers[i].grad = (self.layers[i].error) * self.der_sigmoid(self.layers[i].A)
self.layers[i].dW = (self.layers[i - 1].Z).T.dot(self.layers[i].grad)
self.layers[i].dB = np.sum(self.layers[i].grad, axis=0, keepdims=True)
def update_weights(self, data, label, learningRate):
'''
update_weights function updates the weights with the gradients found with back_propagation.
INPUTS:
data : data is the input.
label : label is the labels of the data.
learnigRate : learningRate is the coefficient for the weight update.
RETURNS:
'''
layerSize = np.shape(self.layers)[0]
self.back_propagation(data, label)
# If momentum is used.
if (self.momentum == True):
for i in range(layerSize):
self.layers[i].momentum_dw = self.layers[i].dW + (
self.momentumCoef * self.layers[i].momentum_dw)
self.layers[i].momentum_db = self.layers[i].dB + (
self.momentumCoef * self.layers[i].momentum_db)
self.layers[i].weights -= (learningRate * self.layers[i].momentum_dw) / self.batchSize
self.layers[i].bias -= (learningRate * self.layers[i].momentum_db) / self.batchSize
# If momentum is not used.
else:
for i in range(layerSize):
self.layers[i].weights -= (learningRate * self.layers[i].dW) / self.batchSize
self.layers[i].bias -= (learningRate * self.layers[i].dB) / self.batchSize
def predict(self, y_pred):
'''
predict function predicts and output from the network's output y_pred.
INPUTS:
y_pred : MLP's output.
RETURNS:
: returns the label for prediction of the network.
'''
word = np.argmax(y_pred, axis=-1)
return word
def accuracy(self, y, y_pred):
'''
accuracy function is the accuracy of our network.
INPUTS:
y : y is the labels for our data.
y_pred : y_pred is the network's prediction.
RETURNS:
: returns the accuracy between y and y_pred.
'''
count = 0
y_words = np.argmax(y, axis=-1)
y_pred_words = self.predict(y_pred)
for i in range(len(y_words)):
if (y_words[i] == y_pred_words[i]):
count += 1
return 100 * (count / len(y_words))
def predict_10(self, y, y_pred, k, seed):
'''
predict_10 function lists the top 10 candidates for the selected triagram.
INPUTS:
y : y is the labels for our data.
y_pred : y_pred is the network's prediction.
k : K is the number of predictions.
seed : For the random initialization.
RETURNS:
indeces : indeces is the indeces of the selected 5 samples.
indeces_test : indeces_test is the labels of the selected 5 sampled from test data.
indeces_test_pred : indeces_test_pred is the prediction of the network for the selected 5 samples
from the test data.
'''
np.random.seed(seed)
indeces = np.random.randint(250, size=5)
y_new = y[indeces]
y_pred_new = y_pred[indeces]
indeces_test_pred = list()
indeces_test = list()
for i in range(np.shape(y_pred_new)[0]):
indeces_test.append(np.argmax(y[i], axis=-1))
indeces_test_pred.append(np.argpartition(y_pred_new[i], -k, axis=-1)[-k:])
return indeces, indeces_test, indeces_test_pred
def trainNetwork(self, data, label, validData, validLabel, learningRate, batchNum, epoch):
'''
trainNetwork function calls the update_weights function to train the network over mini-batches
for fiven number of epochs.
INPUTS:
data : data is the training data.
label : label is the labels of the data.
validData : validData is the valid data.
validLabel : validLabel is the labels of the validData.
learningRate : learningRate is the coefficient for the weight update.
batchNum : batchNum is the number of mini-batches.
epoch : Number of times the network train the whole data.
RETURNS:
cost : Cross entropy error over epochs on test data.
accuracies : Accuracies over epochs on test data.
'''
cost = list()
accuracies = list()
np.random.seed(7)
for i in range(epoch):
randomIndexes = np.random.permutation(len(label))
data = data[randomIndexes]
label = label[randomIndexes]
batchLength = len(label) / batchNum
self.batchSize = batchLength
for j in range(batchNum):
start = int(batchLength * j)
end = int(batchLength * (j + 1))
self.update_weights(data[start:end], label[start:end], learningRate)
y_pred = self.forward(validData)
cross_entropy_cost = self.cross_entropy(validLabel, y_pred)
cost.append(cross_entropy_cost)
accuracy = self.accuracy(validLabel, y_pred)
accuracies.append(accuracy)
return cost, accuracies
D = 8
P = 64
neuralNet0 = MLP(momentum=True, momentumCoef=0.85)
neuralNet0.addLayer(HiddenLayer(250, D, 0, 0.01))
neuralNet0.addLayer(HiddenLayer(D, P, 0, 0.01))
neuralNet0.addLayer(HiddenLayer(P, 250, 0, 0.01))
train_data_1H = np.sum(train_data, axis=-1)
val_data_1H = np.sum(val_data, axis=-1)
cost0, accuracy0 = neuralNet0.trainNetwork(train_data_1H, train_labels, val_data_1H, val_labels, 0.15, 1490, 50)
figureNum = 0
plt.figure(figureNum)
plt.title('Cross Entropy Over Validation Data (D = 8, P = 64)')
plt.xlabel('Epoch')
plt.ylabel('Cross Entropy')
plt.plot(cost0)
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.title('Accuracy Over Validation Data (D = 8, P = 64)')
plt.xlabel('Epoch')
plt.ylabel('Accuracy')
plt.plot(accuracy0)
plt.show()
D = 16
P = 128
neuralNet1 = MLP(momentum=True, momentumCoef=0.85)
neuralNet1.addLayer(HiddenLayer(250, D, 0, 0.01))
neuralNet1.addLayer(HiddenLayer(D, P, 0, 0.01))
neuralNet1.addLayer(HiddenLayer(P, 250, 0, 0.01))
train_data_1H = np.sum(train_data, axis=-1)
val_data_1H = np.sum(val_data, axis=-1)
cost1, accuracy1 = neuralNet1.trainNetwork(train_data_1H, train_labels, val_data_1H, val_labels, 0.15, 1490, 50)
figureNum += 1
plt.figure(figureNum)
plt.title('Cross Entropy Over Validation Data (D = 16, P = 128)')
plt.xlabel('Epoch')
plt.ylabel('Cross Entropy')
plt.plot(cost1)
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.title('Accuracy Over Validation Data (D = 16, P = 128)')
plt.xlabel('Epoch')
plt.ylabel('Accuracy')
plt.plot(accuracy1)
plt.show()
D = 32
P = 256
neuralNet2 = MLP(momentum=True, momentumCoef=0.85)
neuralNet2.addLayer(HiddenLayer(250, D, 0, 0.01))
neuralNet2.addLayer(HiddenLayer(D, P, 0, 0.01))
neuralNet2.addLayer(HiddenLayer(P, 250, 0, 0.01))
train_data_1H = np.sum(train_data, axis=-1)
val_data_1H = np.sum(val_data, axis=-1)
cost2, accuracy2 = neuralNet2.trainNetwork(train_data_1H, train_labels, val_data_1H, val_labels, 0.15, 1490, 50)
figureNum += 1
plt.figure(figureNum)
plt.title('Cross Entropy Over Validation Data (D = 32, P = 256)')
plt.xlabel('Epoch')
plt.ylabel('Cross Entropy')
plt.plot(cost2)
plt.show()
figureNum += 1
plt.figure(figureNum)
plt.title('Accuracy Over Validation Data (D = 32, P = 256)')
plt.xlabel('Epoch')
plt.ylabel('Accuracy')
plt.plot(accuracy2)
plt.show()
# Part B
test_data_1H = np.sum(test_data, axis=-1)
random_indeces, indeces_test, indeces_test_pred = neuralNet2.predict_10(test_labels,
neuralNet2.forward(test_data_1H), 10, 6)
indeces_test_pred = np.asarray(indeces_test_pred)
three_words = testdata[random_indeces]
the_label = testlbls[random_indeces]
three_words[:] -= 1
the_label[:] -= 1
words_test_pred = list()
for i in range(np.shape(indeces_test_pred)[0]):
words_test_pred.append(words[indeces_test_pred[i]])
for i in range(np.shape(words_test_pred)[0]):
ws = [w.decode('UTF-8') for w in words[three_words[i]]]
print('\033[0m' + "Words are: \033[1m {}".format(ws))
print('\033[0m' + 'The 4th word is : ' + '\033[1m' + str(words[the_label[i]].decode('utf-8')))
print('\033[0m' + 'The predicted top 10 words are: ')
pred_ws = [words_test_pred[i][j].decode('UTF-8') for j in range(np.shape(words_test_pred)[1])]
print('\033[1m' + str(pred_ws))
print('\n')
berkan_ozdamar_21602353_hw2(question) | 36.85726 | 158 | 0.489305 | 5,011 | 44,929 | 4.289164 | 0.071044 | 0.060485 | 0.060392 | 0.02345 | 0.775183 | 0.725864 | 0.702368 | 0.656214 | 0.642814 | 0.633741 | 0 | 0.026256 | 0.416769 | 44,929 | 1,219 | 159 | 36.85726 | 0.793963 | 0.223931 | 0 | 0.607553 | 0 | 0 | 0.064268 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.054187 | false | 0 | 0.01642 | 0 | 0.1133 | 0.041051 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7dbdb92137d4ef31e896c07139759fd8eae9d022 | 2,931 | py | Python | keras/losses.py | cc13ny/keras | 172fa11ecce5aff8f359c8eec32b3cf1f76d1312 | [
"MIT"
] | 1 | 2020-04-08T20:41:37.000Z | 2020-04-08T20:41:37.000Z | keras/losses.py | cc13ny/keras | 172fa11ecce5aff8f359c8eec32b3cf1f76d1312 | [
"MIT"
] | null | null | null | keras/losses.py | cc13ny/keras | 172fa11ecce5aff8f359c8eec32b3cf1f76d1312 | [
"MIT"
] | 3 | 2020-02-24T15:16:05.000Z | 2020-05-09T05:29:53.000Z | from __future__ import absolute_import
import six
from . import backend as K
from .utils.generic_utils import deserialize_keras_object
def mean_squared_error(y_true, y_pred):
return K.mean(K.square(y_pred - y_true), axis=-1)
def mean_absolute_error(y_true, y_pred):
return K.mean(K.abs(y_pred - y_true), axis=-1)
def mean_absolute_percentage_error(y_true, y_pred):
diff = K.abs((y_true - y_pred) / K.clip(K.abs(y_true),
K.epsilon(),
None))
return 100. * K.mean(diff, axis=-1)
def mean_squared_logarithmic_error(y_true, y_pred):
first_log = K.log(K.clip(y_pred, K.epsilon(), None) + 1.)
second_log = K.log(K.clip(y_true, K.epsilon(), None) + 1.)
return K.mean(K.square(first_log - second_log), axis=-1)
def squared_hinge(y_true, y_pred):
return K.mean(K.square(K.maximum(1. - y_true * y_pred, 0.)), axis=-1)
def hinge(y_true, y_pred):
return K.mean(K.maximum(1. - y_true * y_pred, 0.), axis=-1)
def logcosh(y_true, y_pred):
def cosh(x):
return (K.exp(x) + K.exp(-x)) / 2
return K.mean(K.log(cosh(y_pred - y_true)), axis=-1)
def categorical_crossentropy(y_true, y_pred):
return K.categorical_crossentropy(y_pred, y_true)
def sparse_categorical_crossentropy(y_true, y_pred):
return K.sparse_categorical_crossentropy(y_pred, y_true)
def binary_crossentropy(y_true, y_pred):
return K.mean(K.binary_crossentropy(y_pred, y_true), axis=-1)
def kullback_leibler_divergence(y_true, y_pred):
y_true = K.clip(y_true, K.epsilon(), 1)
y_pred = K.clip(y_pred, K.epsilon(), 1)
return K.sum(y_true * K.log(y_true / y_pred), axis=-1)
def poisson(y_true, y_pred):
return K.mean(y_pred - y_true * K.log(y_pred + K.epsilon()), axis=-1)
def cosine_proximity(y_true, y_pred):
y_true = K.l2_normalize(y_true, axis=-1)
y_pred = K.l2_normalize(y_pred, axis=-1)
return -K.mean(y_true * y_pred, axis=-1)
# Aliases.
mse = MSE = mean_squared_error
mae = MAE = mean_absolute_error
mape = MAPE = mean_absolute_percentage_error
msle = MSLE = mean_squared_logarithmic_error
kld = KLD = kullback_leibler_divergence
cosine = cosine_proximity
def serialize(loss):
return loss.__name__
def deserialize(name, custom_objects=None):
return deserialize_keras_object(name,
module_objects=globals(),
custom_objects=custom_objects,
printable_module_name='loss function')
def get(identifier):
if identifier is None:
return None
if isinstance(identifier, six.string_types):
identifier = str(identifier)
return deserialize(identifier)
elif callable(identifier):
return identifier
else:
raise ValueError('Could not interpret '
'loss function identifier:', identifier)
| 28.735294 | 74 | 0.658137 | 445 | 2,931 | 4.053933 | 0.195506 | 0.088692 | 0.059867 | 0.099778 | 0.404656 | 0.346452 | 0.282705 | 0.186807 | 0.130266 | 0.031042 | 0 | 0.011894 | 0.22552 | 2,931 | 101 | 75 | 29.019802 | 0.782819 | 0.002729 | 0 | 0 | 0 | 0 | 0.019856 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.261538 | false | 0 | 0.061538 | 0.169231 | 0.615385 | 0.015385 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
7dc08fb24cf6b3e06b71dba3f3f9700daf06593e | 329 | py | Python | jobq/__init__.py | wenbobuaa/pykit | 43e38fe40297a1e7a9329bcf3db3554c7ca48ead | [
"MIT"
] | 13 | 2016-12-16T09:23:09.000Z | 2018-03-10T08:04:00.000Z | jobq/__init__.py | wenbobuaa/pykit | 43e38fe40297a1e7a9329bcf3db3554c7ca48ead | [
"MIT"
] | 74 | 2017-03-23T11:36:22.000Z | 2018-04-02T06:19:09.000Z | jobq/__init__.py | drmingdrmer/pykit | e25a71146e81aaf79625cf8d4f4c439ccd515b82 | [
"MIT"
] | 5 | 2016-12-27T07:30:47.000Z | 2018-03-10T07:06:21.000Z | from .jobq import (
EmptyRst,
Finish,
run,
stat,
JobManager,
JobWorkerError,
JobWorkerNotFound,
)
from .works import (
limit_job_speed,
)
__all__ = [
'EmptyRst',
'Finish',
'run',
'stat',
'JobManager',
'JobWorkerError',
'JobWorkerNotFound',
'limit_job_speed',
]
| 12.185185 | 24 | 0.577508 | 27 | 329 | 6.740741 | 0.555556 | 0.153846 | 0.186813 | 0.230769 | 0.681319 | 0.681319 | 0.681319 | 0 | 0 | 0 | 0 | 0 | 0.297872 | 329 | 26 | 25 | 12.653846 | 0.787879 | 0 | 0 | 0 | 0 | 0 | 0.234043 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.090909 | 0 | 0.090909 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
7dde77370b150e87baa4a48385a501fe27bb3e00 | 3,289 | py | Python | invenio_mail/__init__.py | zzacharo/invenio-mail | 9dc7e1dad9355fab5654bb501bf4462d6f12869a | [
"MIT"
] | 1 | 2017-10-22T00:15:55.000Z | 2017-10-22T00:15:55.000Z | invenio_mail/__init__.py | zzacharo/invenio-mail | 9dc7e1dad9355fab5654bb501bf4462d6f12869a | [
"MIT"
] | 27 | 2015-10-23T09:34:45.000Z | 2021-09-27T06:15:38.000Z | invenio_mail/__init__.py | zzacharo/invenio-mail | 9dc7e1dad9355fab5654bb501bf4462d6f12869a | [
"MIT"
] | 27 | 2015-10-18T11:14:59.000Z | 2021-11-25T09:15:15.000Z | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio mail module.
The Invenio-Mail module is a tiny wrapper around Flask-Mail that provides
printing of emails to standard output when the configuration variable
``MAIL_SUPPRESS_SEND`` is ``True``.
Invenio-Mail also takes care of initializing Flask-Mail if not already
initialized.
First, initialize the extension:
>>> from flask import Flask
>>> from invenio_mail import InvenioMail
>>> app = Flask('myapp')
>>> app.config.update(MAIL_SUPPRESS_SEND=True)
>>> InvenioMail(app)
<invenio_mail.ext.InvenioMail ...>
Next, let's send an email:
>>> from flask_mail import Message
>>> msg = Message('Hello', sender='from@example.org',
... recipients=['to@example.com'], body='Hello, World!')
>>> with app.app_context():
... app.extensions['mail'].send(msg)
Content-Type: text/plain; charset="utf-8"...
Template based messages
-----------------------
A simple API lets you create a message from a template, so you just have to
give the right arguments to get the full message. Moreover, it can create
a complete e-mail with both HTML and text content.
First, you need to instantiate the :class:`~invenio_mail.api.TemplatedMessage`
class, just like you would do with a standard :class:`flask_mail.Message`:
>>> from invenio_mail.api import TemplatedMessage
>>> with app.app_context():
... msg = TemplatedMessage(
... template_html='', # path to your template
... template_body='', # path to your template
... subject='Hello',
... sender='from@example.org',
... recipients=['to@example.com'],
... ctx={
... 'content': 'Hello, World!',
... 'logo': 'logo.png',
... 'sender': 'Sender',
... 'user': 'User',
... })
You just need to add the templates to use and a ``ctx`` dictionary,
containing the values useful to fill the templates. If you ommit these three
arguments, you will have the same result as you would with the standard
:class:`flask_mail.Message` class.
Note that you must be in the application context in order to be able to render
the templates. Once you have created a message, you can send it the standard
way:
>>> with app.app_context():
... app.extensions['mail'].send(msg)
Content-Type: text/plain; charset="utf-8"...
Writing extensions
------------------
By default you should just depend on Flask-Mail if you are writing an
extension which needs email sending functionality:
.. code-block:: python
from flask import current_app
from flask_mail import Message
def mystuff():
msg = Message('Hello', sender='from@example.org',
recipients=['to@example.com'], body='Hello, World!')
current_app.extensions['mail'].send(msg)
Remember to add Flask-Mail to your ``setup.py`` file as well:
.. code-block:: python
setup(
# ...
install_requires = ['Flask-Mail>=0.9.1',]
#...
)
"""
from __future__ import absolute_import, print_function
from .ext import InvenioMail
from .version import __version__
__all__ = ('__version__', 'InvenioMail')
| 30.738318 | 78 | 0.675585 | 453 | 3,289 | 4.821192 | 0.410596 | 0.037088 | 0.020604 | 0.03022 | 0.213828 | 0.152473 | 0.152473 | 0.152473 | 0.152473 | 0.130952 | 0 | 0.005243 | 0.188203 | 3,289 | 106 | 79 | 31.028302 | 0.812734 | 0.94436 | 0 | 0 | 0 | 0 | 0.129412 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0.25 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
816c9d68a02e67dd95f3a64e6f848756f8369723 | 683 | py | Python | ForeignKey_tutorial/models.py | twtrubiks/django-field-tutorial | e48a0c047abf07b1d9de195a30a5b2772d231fbb | [
"MIT"
] | 24 | 2017-08-20T03:48:38.000Z | 2022-01-23T17:03:52.000Z | ForeignKey_tutorial/models.py | jr008489900/django-field-tutorial | e48a0c047abf07b1d9de195a30a5b2772d231fbb | [
"MIT"
] | null | null | null | ForeignKey_tutorial/models.py | jr008489900/django-field-tutorial | e48a0c047abf07b1d9de195a30a5b2772d231fbb | [
"MIT"
] | 11 | 2017-08-20T03:48:39.000Z | 2021-07-20T11:46:30.000Z | from django.db import models
# ForeignKey_tutorial
class Reporter(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
email = models.EmailField()
def __str__(self):
return '{} {}'.format(self.first_name, self.last_name)
class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateField()
reporter = models.ForeignKey(
Reporter,
related_name='articles',
on_delete=models.CASCADE
)
# reporter = models.ForeignKey(
# Reporter,
# on_delete=models.CASCADE)
def __str__(self):
return self.headline
| 22.766667 | 62 | 0.667643 | 78 | 683 | 5.589744 | 0.448718 | 0.110092 | 0.123853 | 0.165138 | 0.137615 | 0.137615 | 0 | 0 | 0 | 0 | 0 | 0.013233 | 0.225476 | 683 | 29 | 63 | 23.551724 | 0.810964 | 0.136164 | 0 | 0.117647 | 0 | 0 | 0.022222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.117647 | false | 0 | 0.058824 | 0.117647 | 0.764706 | 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 | 1 | 1 | 0 | 0 | 3 |
81aa058b75639324b3987ca9daf0ea2ca21761c3 | 202 | py | Python | pyopteryx/utils/scheduling_enum.py | DanielZim/PyOpteryx | dd8fcdb23cc4ca52167820455a6d54c140f3cb00 | [
"MIT"
] | null | null | null | pyopteryx/utils/scheduling_enum.py | DanielZim/PyOpteryx | dd8fcdb23cc4ca52167820455a6d54c140f3cb00 | [
"MIT"
] | 2 | 2021-03-31T19:09:54.000Z | 2021-12-13T19:59:46.000Z | pyopteryx/utils/scheduling_enum.py | DanielZim/PyOpteryx | dd8fcdb23cc4ca52167820455a6d54c140f3cb00 | [
"MIT"
] | null | null | null | from enum import auto
class Scheduling(auto):
FCFS = "fcfs"
PS = "ps"
PP = "pp"
INF = "inf"
RAND = "rand"
HOL = "hol"
PS_HOL = "ps_hol"
PS_PP = "ps_pp"
CFS = "cfs"
| 14.428571 | 23 | 0.5 | 29 | 202 | 3.344828 | 0.448276 | 0.123711 | 0.164948 | 0.206186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.351485 | 202 | 13 | 24 | 15.538462 | 0.740458 | 0 | 0 | 0 | 0 | 0 | 0.158416 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.090909 | 0 | 1 | 0 | 1 | 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 | 3 |
81bf71101158aefef25a92eb67d9e44d95ef0362 | 1,626 | py | Python | apps/app_stores/management/commands/initialize_token.py | Mohitkaushal97/File | 0bc5cca9a557e242861a289af74dfe8b905bc3bd | [
"MIT"
] | null | null | null | apps/app_stores/management/commands/initialize_token.py | Mohitkaushal97/File | 0bc5cca9a557e242861a289af74dfe8b905bc3bd | [
"MIT"
] | null | null | null | apps/app_stores/management/commands/initialize_token.py | Mohitkaushal97/File | 0bc5cca9a557e242861a289af74dfe8b905bc3bd | [
"MIT"
] | null | null | null | # import os
# from django.core.management.base import BaseCommand
# import logging
# from apps.job.models import UserToken
#
# # from apps.job.operations.importer import ImporterClass
#
#
# PROJECT_PATH = os.path.abspath("../../../django_job/static")
#
# logger = logging.getLogger(__name__)
#
# import environ
# env = environ.Env()
#
#
# class Command(BaseCommand):
# def add_arguments(self, parser):
# # parser.add_argument('file_path', nargs='+', type=str)
# pass
#
# def handle(self, *args, **options):
# # server_with_port = 'http://jobs-api-dev-21.herokuapp.com:80'
# server_with_port = env('API__SERVER_WITH_PORT')
#
# token = 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UTkRRekl4TXpJNU1qRXdOalpETXpGRlJEazFSamhGTTBGQ01qSTFSamhHTUVVeE1qZENOQSJ9.eyJpc3MiOiJodHRwczovL2Rldi1sNmhnaHFwMy5hdXRoMC5jb20vIiwic3ViIjoiNU5wYzZEckF3TFhoWHh6OU4zOUpWVGUwWTE2OGxYdnFAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vZGV2LWw2aGdocXAzLmF1dGgwLmNvbS9hcGkvdjIvIiwiaWF0IjoxNTc5NjEyNzQyLCJleHAiOjE1Nzk2OTkxNDIsImF6cCI6IjVOcGM2RHJBd0xYaFh4ejlOMzlKVlRlMFkxNjhsWHZxIiwic2NvcGUiOiJjcmVhdGU6bG9nX3N0cmVhbXMiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMifQ.cNE_Q1STnwySBVtuhSAFMAD6wzkRQwdbeWZ8IwGBE2Bb_5Y04_3p5XtbHBFlC_Yb6clfGVRq0K_w5a7Tt6XDb0pqyJxfKif3WLOa1d7vafAIk5fGDyQZj4e6O370duGxBTjcB7V8KmBrdMfQG0vNBORLwTrScGW5iXiSfhWip1kTm2fViZYuVr7uOv3m1PsHmI4J8TwA_CDQ_XDMrIlt1l6-EFVDYm3j81DoM_p0dR4O-S8kUQKSmf_NbbVqZZyvbL9xaW8BXcmsaM7WB3e5p5tN_OAmE4TJ2S5BWNc6e0sIEfAIvSMlXLqvwlPaY4CN4UK73Q2CAXXUns-fEoOWEg'
# UserToken.create_or_update(token=token, server_with_port=server_with_port)
| 58.071429 | 850 | 0.824108 | 112 | 1,626 | 11.669643 | 0.651786 | 0.038256 | 0.053558 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.077344 | 0.101476 | 1,626 | 27 | 851 | 60.222222 | 0.817248 | 0.947724 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 1 | 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 | 3 |
81c51dd4e73bc580b801a1b0274cf6ec14dcc6b7 | 247 | py | Python | server/api/resources/Quotations.py | surbina/devaluometro | 2632fcd352a062dd700abdd70d3837d8b3cfbed6 | [
"MIT"
] | null | null | null | server/api/resources/Quotations.py | surbina/devaluometro | 2632fcd352a062dd700abdd70d3837d8b3cfbed6 | [
"MIT"
] | null | null | null | server/api/resources/Quotations.py | surbina/devaluometro | 2632fcd352a062dd700abdd70d3837d8b3cfbed6 | [
"MIT"
] | null | null | null | import requests
from flask_restful import Resource
class Quotations(Resource):
PATH = '/quotations'
def get(self):
return requests.get('https://www.bloomberg.com/markets/api/bulk-time-series/price/USDARS%3ACUR?timeFrame=5_YEAR').json(), 200
| 27.444444 | 127 | 0.773279 | 35 | 247 | 5.4 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022222 | 0.089069 | 247 | 8 | 128 | 30.875 | 0.817778 | 0 | 0 | 0 | 0 | 0.166667 | 0.408907 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 3 |
81c707bbde6abd7a6bac02cc06f5e87bb3c55e51 | 655 | py | Python | src/models/metrics.py | imad24/pc_clustering | b76cb5a0e6429610802594cc1ca5218dfcdb3605 | [
"MIT"
] | null | null | null | src/models/metrics.py | imad24/pc_clustering | b76cb5a0e6429610802594cc1ca5218dfcdb3605 | [
"MIT"
] | null | null | null | src/models/metrics.py | imad24/pc_clustering | b76cb5a0e6429610802594cc1ca5218dfcdb3605 | [
"MIT"
] | 1 | 2019-05-27T21:34:35.000Z | 2019-05-27T21:34:35.000Z | import numpy as np
def getMSE(true,pred):
return (( (true - pred) ** 2)).mean()
def getMAE(true,pred):
return (np.abs((true - pred))).mean()
def getMAPE(true,pred):
return np.abs((true - pred)/true).mean()
def getsMAPE(true,pred):
return ( (200*np.abs(true - pred)) / true+pred).mean()
def getMASE(training_series, testing_series, prediction_series,m=1):
T = training_series.shape[0]
diff=[]
for i in range(m, T):
value = training_series[i] - training_series[i - m]
diff.append(value)
d = np.abs(diff).sum()/(T-m)
errors = np.abs(testing_series - prediction_series )
return errors.mean()/d | 25.192308 | 68 | 0.630534 | 98 | 655 | 4.132653 | 0.367347 | 0.177778 | 0.138272 | 0.096296 | 0.185185 | 0.133333 | 0.133333 | 0 | 0 | 0 | 0 | 0.01145 | 0.2 | 655 | 26 | 69 | 25.192308 | 0.76145 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0 | 0.055556 | 0.222222 | 0.611111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
81cac47daadfdb624267d0e11cb8b4f85f079018 | 676 | py | Python | fiber/rest_api/fields.py | leukeleu/django-fiber-multilingual | 4574fffb953c442ff7981c16ea1d460784e38eab | [
"Apache-2.0"
] | 1 | 2019-01-27T05:52:43.000Z | 2019-01-27T05:52:43.000Z | fiber/rest_api/fields.py | check4anjil/django-fiber | 48d1af8867e19b9e27332d2b98ca07a47927de15 | [
"Apache-2.0"
] | 6 | 2021-03-19T16:08:19.000Z | 2022-03-12T00:54:38.000Z | fiber/rest_api/fields.py | check4anjil/django-fiber | 48d1af8867e19b9e27332d2b98ca07a47927de15 | [
"Apache-2.0"
] | 1 | 2019-01-27T05:52:33.000Z | 2019-01-27T05:52:33.000Z | from rest_framework import serializers
from fiber.app_settings import PERMISSION_CLASS
from fiber.utils import class_loader
from fiber.utils.date import friendly_datetime
PERMISSIONS = class_loader.load_class(PERMISSION_CLASS)
class CanEditField(serializers.Field):
"""
A custom field that returns True if request.user has
permission to edit obj.
"""
def field_to_native(self, obj, field_name):
return PERMISSIONS.can_edit(self.context['request'].user, obj)
class UpdatedField(serializers.Field):
"""
Return a friendly timestamp.
"""
def field_to_native(self, obj, field_name):
return friendly_datetime(obj.updated)
| 26 | 70 | 0.747041 | 88 | 676 | 5.556818 | 0.465909 | 0.055215 | 0.05726 | 0.06544 | 0.155419 | 0.155419 | 0.155419 | 0.155419 | 0.155419 | 0 | 0 | 0 | 0.173077 | 676 | 25 | 71 | 27.04 | 0.874776 | 0.156805 | 0 | 0.181818 | 0 | 0 | 0.013084 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0 | 0.363636 | 0.181818 | 0.909091 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
81e5b7ddf7a4f903500dd6c5eb3f027906947e1b | 28 | py | Python | sahyun_bot/irc_bot_settings.py | TheGoodlike13/sahyun-bot | 8ebc3d4e58a0acf9bde3c9ea8339145abcc53fcb | [
"MIT"
] | 1 | 2022-02-21T18:55:34.000Z | 2022-02-21T18:55:34.000Z | sahyun_bot/irc_bot_settings.py | TheGoodlike13/sahyun-bot | 8ebc3d4e58a0acf9bde3c9ea8339145abcc53fcb | [
"MIT"
] | null | null | null | sahyun_bot/irc_bot_settings.py | TheGoodlike13/sahyun-bot | 8ebc3d4e58a0acf9bde3c9ea8339145abcc53fcb | [
"MIT"
] | null | null | null | MAX_CONCURRENT_COMMANDS = 8
| 14 | 27 | 0.857143 | 4 | 28 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0.107143 | 28 | 1 | 28 | 28 | 0.84 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c491ff78841fe4187438b6522544a2e4353efdfe | 582 | py | Python | internals/utils/labeling.py | schutzekatze/allsky-cloudiness-estimator | 4df443836a35fbd2c0aed938110dde9f8883a49d | [
"Apache-2.0"
] | 2 | 2018-10-30T21:36:55.000Z | 2020-11-13T22:03:21.000Z | internals/utils/labeling.py | schutzekatze/allsky-cloud-detector | 4df443836a35fbd2c0aed938110dde9f8883a49d | [
"Apache-2.0"
] | null | null | null | internals/utils/labeling.py | schutzekatze/allsky-cloud-detector | 4df443836a35fbd2c0aed938110dde9f8883a49d | [
"Apache-2.0"
] | 2 | 2017-10-03T15:49:07.000Z | 2017-10-21T21:35:05.000Z | from os.path import splitext
import numpy as np
def is_label(path):
root, _ = splitext(path)
return root[-1:] == 'l'
def remove_label(path):
root, ext = splitext(path)
return root[:-1] + ext
def add_label(path):
root, ext = splitext(path)
return root + 'l' + ext
UNSURE_LOWER_LIMIT = 0.1
UNSURE_UPPER_LIMIT = 0.9
def normalize(label):
label[label < 255 * UNSURE_LOWER_LIMIT] = 0
label[np.logical_and(label >= 255 * UNSURE_LOWER_LIMIT, label < 255 * UNSURE_UPPER_LIMIT)] = 127
label[label >= 255 * UNSURE_UPPER_LIMIT] = 255
return label
| 23.28 | 100 | 0.671821 | 88 | 582 | 4.25 | 0.329545 | 0.085562 | 0.149733 | 0.176471 | 0.524064 | 0.203209 | 0.203209 | 0.203209 | 0 | 0 | 0 | 0.054348 | 0.209622 | 582 | 24 | 101 | 24.25 | 0.758696 | 0 | 0 | 0.111111 | 0 | 0 | 0.003436 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c4a1244aea7d8b6fb80f71a88d819fd1414149e8 | 215 | py | Python | rallf/sdk/Task.py | nombrekeff/rallf-python-sdk | 38b507d467c7a5ee4edba763fbfa20f3437b478a | [
"MIT"
] | 2 | 2018-12-11T20:40:09.000Z | 2019-01-25T09:48:49.000Z | rallf/sdk/Task.py | nombrekeff/rallf-python-sdk | 38b507d467c7a5ee4edba763fbfa20f3437b478a | [
"MIT"
] | null | null | null | rallf/sdk/Task.py | nombrekeff/rallf-python-sdk | 38b507d467c7a5ee4edba763fbfa20f3437b478a | [
"MIT"
] | null | null | null |
class Task:
def __init__(self, robot):
self.robot = robot
def warmup(self):
pass
def run(self, input):
pass
def cooldown(self):
pass
def mock(self, input):
return "this is a test"
| 12.647059 | 28 | 0.609302 | 31 | 215 | 4.096774 | 0.548387 | 0.165354 | 0.173228 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.283721 | 215 | 16 | 29 | 13.4375 | 0.824675 | 0 | 0 | 0.272727 | 0 | 0 | 0.065421 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.454545 | false | 0.272727 | 0 | 0.090909 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
c4a63df03b11203ac8689bbecb4a3baac18c3b27 | 746 | py | Python | rooms/E23_R2.py | stfbnc/TrovaEscapeBackEnd | ca32523c14f44e65ddac475f44ed0467eb8c3552 | [
"MIT"
] | 1 | 2020-12-09T21:01:07.000Z | 2020-12-09T21:01:07.000Z | rooms/E23_R2.py | stfbnc/TrovaEscapeBackEnd | ca32523c14f44e65ddac475f44ed0467eb8c3552 | [
"MIT"
] | null | null | null | rooms/E23_R2.py | stfbnc/TrovaEscapeBackEnd | ca32523c14f44e65ddac475f44ed0467eb8c3552 | [
"MIT"
] | null | null | null | import Room
import Constants as c
class E23_R2(Room.Room):
def __init__(self):
super().__init__('La Bambola Assassina', 'http://d.supersaas.it/schedule/La_Casa_Degli_Enigmi/RM_La_Bambola_Assassina', 'E23_R2')
def get_prices(self):
p = ['2 GIOCATORI – € 25,00 (lun-gio) / € 30,00 (ven-dom) a persona',
'3 GIOCATORI – € 20,00 (lun-gio) / € 22,00 (ven-dom) a persona',
'4 GIOCATORI – € 16,00 (lun-gio) / € 18,00 (ven-dom) a persona',
'5 GIOCATORI – € 15,00 (lun-gio) / € 16,00 (ven-dom) a persona',
'6-7 GIOCATORI – € 14,00 (lun-gio) / € 15,00 (ven-dom) a persona']
return c.SEPARATOR.join(p)
def get_availabilities(self):
return c.NO_RETR_AVAILS
| 35.52381 | 137 | 0.592493 | 129 | 746 | 3.387597 | 0.449612 | 0.114416 | 0.125858 | 0.102975 | 0.183066 | 0 | 0 | 0 | 0 | 0 | 0 | 0.093023 | 0.25067 | 746 | 20 | 138 | 37.3 | 0.661896 | 0 | 0 | 0 | 0 | 0.357143 | 0.546917 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.142857 | 0.071429 | 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 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c4aeb378cfeccc55f3655eb5e26081ed41dadb3f | 192 | py | Python | setup.py | MafikengZ/Distributions | 7ad12efa3930d214a2fc5454b34c9fdd6dafe317 | [
"MIT"
] | null | null | null | setup.py | MafikengZ/Distributions | 7ad12efa3930d214a2fc5454b34c9fdd6dafe317 | [
"MIT"
] | null | null | null | setup.py | MafikengZ/Distributions | 7ad12efa3930d214a2fc5454b34c9fdd6dafe317 | [
"MIT"
] | null | null | null | from setuptools import setup
setup(name = 'distribution',
version - 0.1,
description = 'Gaussian distribution',
package = ['distribution'],
zip_safe = False)
| 21.333333 | 46 | 0.614583 | 18 | 192 | 6.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.28125 | 192 | 8 | 47 | 24 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0.234375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.166667 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c4bd5c2075c871cc3abc44abd9bd4b466161e282 | 636 | py | Python | problems/50/problem_50.py | r1cc4rdo/daily_coding_problem | 6ac85309fad2f64231ac7ab94aa4158e18bdec40 | [
"Unlicense"
] | 158 | 2018-01-25T06:33:30.000Z | 2022-03-14T23:18:05.000Z | problems/50/problem_50.py | r1cc4rdo/daily_coding_problem | 6ac85309fad2f64231ac7ab94aa4158e18bdec40 | [
"Unlicense"
] | 9 | 2018-07-04T00:31:57.000Z | 2020-05-16T21:02:30.000Z | problems/50/problem_50.py | r1cc4rdo/daily_coding_problem | 6ac85309fad2f64231ac7ab94aa4158e18bdec40 | [
"Unlicense"
] | 50 | 2018-06-22T16:48:44.000Z | 2022-01-11T16:45:48.000Z | def coding_problem_50(tree):
"""
Suppose an arithmetic expression is given as a binary tree. Each leaf is an integer and each internal node
is one of '+', '-', '*' or '/'. Given the root to such a tree, write a function to evaluate it.
For example, given the following tree:
*
/ \
+ +
/ \ / \
3 2 4 5
you should return 45, as it is (3 + 2) * (4 + 5).
Examples:
>>> coding_problem_50(('*', ('+', 3, 2), ('+', 4, 5))) # (3 + 2) * (4 + 5) == 45
45
>>> coding_problem_50(('/', ('+', ('+', 1, 2), 3), 12)) # (1 + 2 + 3) / 12 == 0.5
0.5
"""
pass
| 28.909091 | 110 | 0.476415 | 92 | 636 | 3.228261 | 0.51087 | 0.026936 | 0.040404 | 0.053872 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099291 | 0.334906 | 636 | 21 | 111 | 30.285714 | 0.602837 | 0.831761 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c4cc3c34dcf45481971975fcf4ae9fb010ca0c39 | 523 | py | Python | c2cwsgiutils/pretty_json.py | camptocamp/c2cwsgiutils | 7f99937ccebc31c8e97c58de3819458eb9d6435e | [
"BSD-2-Clause-FreeBSD"
] | 5 | 2017-06-25T07:50:57.000Z | 2019-01-25T16:49:57.000Z | c2cwsgiutils/pretty_json.py | camptocamp/c2cwsgiutils | 7f99937ccebc31c8e97c58de3819458eb9d6435e | [
"BSD-2-Clause-FreeBSD"
] | 200 | 2017-02-01T15:13:38.000Z | 2022-03-31T21:29:54.000Z | c2cwsgiutils/pretty_json.py | camptocamp/c2cwsgiutils | 7f99937ccebc31c8e97c58de3819458eb9d6435e | [
"BSD-2-Clause-FreeBSD"
] | 4 | 2019-07-08T12:28:19.000Z | 2020-06-10T02:44:35.000Z | from typing import Any
import pyramid.config
import ujson
from pyramid.renderers import JSON
def fast_dumps(v: Any, **_kargv: Any) -> str:
"""Dump the json fast using ujson."""
return ujson.dumps(v, ensure_ascii=False, indent=2, sort_keys=True, escape_forward_slashes=False)
def init(config: pyramid.config.Configurator) -> None:
"""Initialize json and fast_json renderer."""
config.add_renderer("json", JSON(indent=2, sort_keys=True))
config.add_renderer("fast_json", JSON(serializer=fast_dumps))
| 30.764706 | 101 | 0.739962 | 76 | 523 | 4.934211 | 0.5 | 0.069333 | 0.058667 | 0.08 | 0.101333 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004425 | 0.135755 | 523 | 16 | 102 | 32.6875 | 0.825221 | 0.135755 | 0 | 0 | 0 | 0 | 0.029478 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.444444 | 0 | 0.777778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
c4dfcb054bc0c78193811a702731954b1f8895df | 1,204 | py | Python | uiza/exceptions.py | uizaio/api-wrapper-python | e67c162e711857341f7ef5752178219e94f604d3 | [
"MIT"
] | 2 | 2019-04-22T11:39:36.000Z | 2020-05-26T04:01:43.000Z | uiza/exceptions.py | uizaio/api-wrapper-python | e67c162e711857341f7ef5752178219e94f604d3 | [
"MIT"
] | null | null | null | uiza/exceptions.py | uizaio/api-wrapper-python | e67c162e711857341f7ef5752178219e94f604d3 | [
"MIT"
] | 2 | 2019-02-11T09:34:03.000Z | 2019-02-12T10:31:41.000Z | class ClientException(Exception):
pass
class ServerException(Exception):
pass
class BadRequestError(ServerException):
pass
class UnauthorizedError(ServerException):
pass
class NotFoundError(ServerException):
pass
class UnprocessableError(ServerException):
pass
class InternalServerError(ServerException):
pass
class ServiceUnavailableError(ServerException):
pass
class ClientError(ServerException):
pass
class ServerError(ServerException):
pass
class ServerBaseErrors(object):
ERR_UIZA_BAD_REQUEST = 'The request was unacceptable, often due to missing a required parameter.'
ERR_UIZA_UNAUTHORIZED = 'No valid API key provided.'
ERR_UIZA_NOT_FOUND = 'The requested resource doesn\'t exist.'
ERR_UIZA_UNPROCESSABLE = 'The syntax of the request is correct (often cause of wrong parameter)'
ERR_UIZA_INTERNAL_SERVER_ERROR = 'We had a problem with our server. Try again later.'
ERR_UIZA_SERVICE_UNAVAILABLE = 'The server is overloaded or down for maintenance.'
ERR_UIZA_CLIENT_ERROR = 'The error seems to have been caused by the client'
ERR_UIZA_SERVER_ERROR = ' the server is aware that it has encountered an error'
| 24.08 | 101 | 0.767442 | 146 | 1,204 | 6.171233 | 0.541096 | 0.099889 | 0.213097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.17608 | 1,204 | 49 | 102 | 24.571429 | 0.908266 | 0 | 0 | 0.344828 | 0 | 0 | 0.329734 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.344828 | 0 | 0 | 0.655172 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
c4e4e4a4b1e6060b485a390dfcaa87e5e5967b2a | 135 | py | Python | settings.py | kashtan404/zbx_telegram_bot | b1a8031b19bcf5eb384382d52b0c3c8833c97250 | [
"MIT"
] | null | null | null | settings.py | kashtan404/zbx_telegram_bot | b1a8031b19bcf5eb384382d52b0c3c8833c97250 | [
"MIT"
] | null | null | null | settings.py | kashtan404/zbx_telegram_bot | b1a8031b19bcf5eb384382d52b0c3c8833c97250 | [
"MIT"
] | null | null | null | [Zabbix]
url = http://zabbix.org/zabbix/api_jsonrpc.php
user = guest
password =
auth =
[Telegram]
telegram_token =
botan_token =
| 12.272727 | 46 | 0.711111 | 18 | 135 | 5.166667 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162963 | 135 | 10 | 47 | 13.5 | 0.823009 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.125 | 0 | null | null | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c4ee3301ccda4ae063371d3b19122890c6a1a704 | 1,184 | py | Python | plugins/Tester/freezeVertex.py | wmoten/medic | bc2e9ec09e33ce2d0cedd8dc0c17f567208503ed | [
"MIT"
] | null | null | null | plugins/Tester/freezeVertex.py | wmoten/medic | bc2e9ec09e33ce2d0cedd8dc0c17f567208503ed | [
"MIT"
] | null | null | null | plugins/Tester/freezeVertex.py | wmoten/medic | bc2e9ec09e33ce2d0cedd8dc0c17f567208503ed | [
"MIT"
] | null | null | null | import medic
from maya import OpenMaya
from maya import cmds
import sys
class FreezeVertex(medic.PyTester):
def __init__(self):
super(FreezeVertex, self).__init__()
def Name(self):
return "FreezeVertex"
def Description(self):
return "Not Frozen Verticies"
def Match(self, node):
return node.object().hasFn(OpenMaya.MFn.kMesh)
def test(self, node, geom = None):
plug = node.dg().findPlug("pnts", True)
tweaked = False
for i in range(plug.numElements()):
elm = plug.elementByPhysicalIndex(i)
for j in range(3):
if abs(elm.child(j).asDouble()) > sys.float_info.epsilon:
tweaked = True
break
if tweaked:
break
if tweaked:
return medic.PyReport(node)
else:
return None
def IsFixable(self):
return True
def fix(self, report, params):
obj_name = report.node().name()
cmds.polyMoveVertex(obj_name, ch=1)
return True
def Create():
return FreezeVertex()
| 24.163265 | 74 | 0.541385 | 127 | 1,184 | 4.96063 | 0.503937 | 0.047619 | 0.044444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002667 | 0.366554 | 1,184 | 48 | 75 | 24.666667 | 0.837333 | 0 | 0 | 0.166667 | 0 | 0 | 0.03169 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0.138889 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
4801c52bbeb058b5eab98960cbb55793984e5af0 | 4,641 | py | Python | ibis/expr/schema.py | andrewseidl/ibis | 1468b8c4f96d9d58f6fa147a2579b0d9e5796186 | [
"Apache-2.0"
] | null | null | null | ibis/expr/schema.py | andrewseidl/ibis | 1468b8c4f96d9d58f6fa147a2579b0d9e5796186 | [
"Apache-2.0"
] | null | null | null | ibis/expr/schema.py | andrewseidl/ibis | 1468b8c4f96d9d58f6fa147a2579b0d9e5796186 | [
"Apache-2.0"
] | null | null | null | import collections
from multipledispatch import Dispatcher
import ibis.common as com
import ibis.util as util
import ibis.expr.datatypes as dt
class Schema:
"""An object for holding table schema information, i.e., column names and
types.
Parameters
----------
names : Sequence[str]
A sequence of ``str`` indicating the name of each column.
types : Sequence[DataType]
A sequence of :class:`ibis.expr.datatypes.DataType` objects
representing type of each column.
"""
__slots__ = 'names', 'types', '_name_locs'
def __init__(self, names, types):
if not isinstance(names, list):
names = list(names)
self.names = names
self.types = list(map(dt.dtype, types))
self._name_locs = dict((v, i) for i, v in enumerate(self.names))
if len(self._name_locs) < len(self.names):
raise com.IntegrityError('Duplicate column names')
def __repr__(self):
space = 2 + max(map(len, self.names))
return "ibis.Schema {{{}\n}}".format(
util.indent(
''.join(
'\n{}{}'.format(name.ljust(space), str(type))
for name, type in zip(self.names, self.types)
),
2
)
)
def __hash__(self):
return hash((type(self), tuple(self.names), tuple(self.types)))
def __len__(self):
return len(self.names)
def __iter__(self):
return iter(self.names)
def __contains__(self, name):
return name in self._name_locs
def __getitem__(self, name):
return self.types[self._name_locs[name]]
def __getstate__(self):
return {
slot: getattr(self, slot) for slot in self.__class__.__slots__
}
def __setstate__(self, instance_dict):
for key, value in instance_dict.items():
setattr(self, key, value)
def delete(self, names_to_delete):
for name in names_to_delete:
if name not in self:
raise KeyError(name)
new_names, new_types = [], []
for name, type_ in zip(self.names, self.types):
if name in names_to_delete:
continue
new_names.append(name)
new_types.append(type_)
return Schema(new_names, new_types)
@classmethod
def from_tuples(cls, values):
if not isinstance(values, (list, tuple)):
values = list(values)
names, types = zip(*values) if values else ([], [])
return Schema(names, types)
@classmethod
def from_dict(cls, dictionary):
return Schema(*zip(*dictionary.items()))
def equals(self, other, cache=None):
return self.names == other.names and self.types == other.types
def __eq__(self, other):
return self.equals(other)
def __gt__(self, other):
return set(self.items()) > set(other.items())
def __ge__(self, other):
return set(self.items()) >= set(other.items())
def append(self, schema):
return Schema(self.names + schema.names, self.types + schema.types)
def items(self):
return zip(self.names, self.types)
def name_at_position(self, i):
"""
"""
upper = len(self.names) - 1
if not 0 <= i <= upper:
raise ValueError(
'Column index must be between 0 and {:d}, inclusive'.format(
upper
)
)
return self.names[i]
class HasSchema:
"""
Base class representing a structured dataset with a well-defined
schema.
Base implementation is for tables that do not reference a particular
concrete dataset or database table.
"""
def __repr__(self):
return '{}({})'.format(type(self).__name__, repr(self.schema))
def has_schema(self):
return True
def equals(self, other, cache=None):
return type(self) == type(other) and self.schema.equals(
other.schema, cache=cache
)
def root_tables(self):
return [self]
@property
def schema(self):
raise NotImplementedError
schema = Dispatcher('schema')
infer = Dispatcher('infer')
@schema.register(Schema)
def identity(s):
return s
@schema.register(collections.Mapping)
def schema_from_mapping(d):
return Schema.from_dict(d)
@schema.register(collections.Iterable)
def schema_from_pairs(lst):
return Schema.from_tuples(lst)
@schema.register(collections.Iterable, collections.Iterable)
def schema_from_names_types(names, types):
return Schema(names, types)
| 25.640884 | 77 | 0.600948 | 565 | 4,641 | 4.743363 | 0.258407 | 0.053731 | 0.026119 | 0.01791 | 0.127985 | 0.08209 | 0.08209 | 0.057463 | 0.057463 | 0.03209 | 0 | 0.001511 | 0.286792 | 4,641 | 180 | 78 | 25.783333 | 0.808157 | 0.106012 | 0 | 0.071429 | 0 | 0 | 0.033219 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.044643 | 0.1875 | 0.544643 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
48164c6e47c8a472ba475ec4620dbcbb56ac2f7f | 16,936 | py | Python | nova/objects/keypair.py | bopopescu/nova-token | ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2 | [
"Apache-2.0"
] | null | null | null | nova/objects/keypair.py | bopopescu/nova-token | ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2 | [
"Apache-2.0"
] | null | null | null | nova/objects/keypair.py | bopopescu/nova-token | ec98f69dea7b3e2b9013b27fd55a2c1a1ac6bfb2 | [
"Apache-2.0"
] | 2 | 2017-07-20T17:31:34.000Z | 2020-07-24T02:42:19.000Z | begin_unit
comment|'# Copyright 2013 IBM Corp.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# http://www.apache.org/licenses/LICENSE-2.0'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Unless required by applicable law or agreed to in writing, software'
nl|'\n'
comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
nl|'\n'
comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
nl|'\n'
comment|'# License for the specific language governing permissions and limitations'
nl|'\n'
comment|'# under the License.'
nl|'\n'
nl|'\n'
name|'from'
name|'oslo_db'
name|'import'
name|'exception'
name|'as'
name|'db_exc'
newline|'\n'
name|'from'
name|'oslo_utils'
name|'import'
name|'versionutils'
newline|'\n'
nl|'\n'
name|'from'
name|'nova'
name|'import'
name|'db'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'db'
op|'.'
name|'sqlalchemy'
name|'import'
name|'api'
name|'as'
name|'db_api'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'db'
op|'.'
name|'sqlalchemy'
name|'import'
name|'api_models'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'exception'
newline|'\n'
name|'from'
name|'nova'
name|'import'
name|'objects'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'objects'
name|'import'
name|'base'
newline|'\n'
name|'from'
name|'nova'
op|'.'
name|'objects'
name|'import'
name|'fields'
newline|'\n'
nl|'\n'
DECL|variable|KEYPAIR_TYPE_SSH
name|'KEYPAIR_TYPE_SSH'
op|'='
string|"'ssh'"
newline|'\n'
DECL|variable|KEYPAIR_TYPE_X509
name|'KEYPAIR_TYPE_X509'
op|'='
string|"'x509'"
newline|'\n'
nl|'\n'
nl|'\n'
op|'@'
name|'db_api'
op|'.'
name|'api_context_manager'
op|'.'
name|'reader'
newline|'\n'
DECL|function|_get_from_db
name|'def'
name|'_get_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|'='
name|'None'
op|')'
op|':'
newline|'\n'
indent|' '
name|'query'
op|'='
name|'context'
op|'.'
name|'session'
op|'.'
name|'query'
op|'('
name|'api_models'
op|'.'
name|'KeyPair'
op|')'
op|'.'
name|'filter'
op|'('
name|'api_models'
op|'.'
name|'KeyPair'
op|'.'
name|'user_id'
op|'=='
name|'user_id'
op|')'
newline|'\n'
name|'if'
name|'name'
name|'is'
name|'not'
name|'None'
op|':'
newline|'\n'
indent|' '
name|'db_keypair'
op|'='
name|'query'
op|'.'
name|'filter'
op|'('
name|'api_models'
op|'.'
name|'KeyPair'
op|'.'
name|'name'
op|'=='
name|'name'
op|')'
op|'.'
name|'first'
op|'('
op|')'
newline|'\n'
name|'if'
name|'not'
name|'db_keypair'
op|':'
newline|'\n'
indent|' '
name|'raise'
name|'exception'
op|'.'
name|'KeypairNotFound'
op|'('
name|'user_id'
op|'='
name|'user_id'
op|','
name|'name'
op|'='
name|'name'
op|')'
newline|'\n'
dedent|''
name|'return'
name|'db_keypair'
newline|'\n'
dedent|''
name|'else'
op|':'
newline|'\n'
indent|' '
name|'return'
name|'query'
op|'.'
name|'all'
op|'('
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
dedent|''
dedent|''
op|'@'
name|'db_api'
op|'.'
name|'api_context_manager'
op|'.'
name|'reader'
newline|'\n'
DECL|function|_get_count_from_db
name|'def'
name|'_get_count_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
op|':'
newline|'\n'
indent|' '
name|'return'
name|'context'
op|'.'
name|'session'
op|'.'
name|'query'
op|'('
name|'api_models'
op|'.'
name|'KeyPair'
op|')'
op|'.'
name|'filter'
op|'('
name|'api_models'
op|'.'
name|'KeyPair'
op|'.'
name|'user_id'
op|'=='
name|'user_id'
op|')'
op|'.'
name|'count'
op|'('
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
dedent|''
op|'@'
name|'db_api'
op|'.'
name|'api_context_manager'
op|'.'
name|'writer'
newline|'\n'
DECL|function|_create_in_db
name|'def'
name|'_create_in_db'
op|'('
name|'context'
op|','
name|'values'
op|')'
op|':'
newline|'\n'
indent|' '
name|'kp'
op|'='
name|'api_models'
op|'.'
name|'KeyPair'
op|'('
op|')'
newline|'\n'
name|'kp'
op|'.'
name|'update'
op|'('
name|'values'
op|')'
newline|'\n'
name|'try'
op|':'
newline|'\n'
indent|' '
name|'kp'
op|'.'
name|'save'
op|'('
name|'context'
op|'.'
name|'session'
op|')'
newline|'\n'
dedent|''
name|'except'
name|'db_exc'
op|'.'
name|'DBDuplicateEntry'
op|':'
newline|'\n'
indent|' '
name|'raise'
name|'exception'
op|'.'
name|'KeyPairExists'
op|'('
name|'key_name'
op|'='
name|'values'
op|'['
string|"'name'"
op|']'
op|')'
newline|'\n'
dedent|''
name|'return'
name|'kp'
newline|'\n'
nl|'\n'
nl|'\n'
dedent|''
op|'@'
name|'db_api'
op|'.'
name|'api_context_manager'
op|'.'
name|'writer'
newline|'\n'
DECL|function|_destroy_in_db
name|'def'
name|'_destroy_in_db'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
op|':'
newline|'\n'
indent|' '
name|'result'
op|'='
name|'context'
op|'.'
name|'session'
op|'.'
name|'query'
op|'('
name|'api_models'
op|'.'
name|'KeyPair'
op|')'
op|'.'
name|'filter_by'
op|'('
name|'user_id'
op|'='
name|'user_id'
op|')'
op|'.'
name|'filter_by'
op|'('
name|'name'
op|'='
name|'name'
op|')'
op|'.'
name|'delete'
op|'('
op|')'
newline|'\n'
name|'if'
name|'not'
name|'result'
op|':'
newline|'\n'
indent|' '
name|'raise'
name|'exception'
op|'.'
name|'KeypairNotFound'
op|'('
name|'user_id'
op|'='
name|'user_id'
op|','
name|'name'
op|'='
name|'name'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
comment|'# TODO(berrange): Remove NovaObjectDictCompat'
nl|'\n'
dedent|''
dedent|''
op|'@'
name|'base'
op|'.'
name|'NovaObjectRegistry'
op|'.'
name|'register'
newline|'\n'
name|'class'
name|'KeyPair'
op|'('
name|'base'
op|'.'
name|'NovaPersistentObject'
op|','
name|'base'
op|'.'
name|'NovaObject'
op|','
nl|'\n'
DECL|class|KeyPair
name|'base'
op|'.'
name|'NovaObjectDictCompat'
op|')'
op|':'
newline|'\n'
comment|'# Version 1.0: Initial version'
nl|'\n'
comment|'# Version 1.1: String attributes updated to support unicode'
nl|'\n'
comment|'# Version 1.2: Added keypair type'
nl|'\n'
comment|'# Version 1.3: Name field is non-null'
nl|'\n'
comment|'# Version 1.4: Add localonly flag to get_by_name()'
nl|'\n'
DECL|variable|VERSION
indent|' '
name|'VERSION'
op|'='
string|"'1.4'"
newline|'\n'
nl|'\n'
DECL|variable|fields
name|'fields'
op|'='
op|'{'
nl|'\n'
string|"'id'"
op|':'
name|'fields'
op|'.'
name|'IntegerField'
op|'('
op|')'
op|','
nl|'\n'
string|"'name'"
op|':'
name|'fields'
op|'.'
name|'StringField'
op|'('
name|'nullable'
op|'='
name|'False'
op|')'
op|','
nl|'\n'
string|"'user_id'"
op|':'
name|'fields'
op|'.'
name|'StringField'
op|'('
name|'nullable'
op|'='
name|'True'
op|')'
op|','
nl|'\n'
string|"'fingerprint'"
op|':'
name|'fields'
op|'.'
name|'StringField'
op|'('
name|'nullable'
op|'='
name|'True'
op|')'
op|','
nl|'\n'
string|"'public_key'"
op|':'
name|'fields'
op|'.'
name|'StringField'
op|'('
name|'nullable'
op|'='
name|'True'
op|')'
op|','
nl|'\n'
string|"'type'"
op|':'
name|'fields'
op|'.'
name|'StringField'
op|'('
name|'nullable'
op|'='
name|'False'
op|')'
op|','
nl|'\n'
op|'}'
newline|'\n'
nl|'\n'
DECL|member|obj_make_compatible
name|'def'
name|'obj_make_compatible'
op|'('
name|'self'
op|','
name|'primitive'
op|','
name|'target_version'
op|')'
op|':'
newline|'\n'
indent|' '
name|'super'
op|'('
name|'KeyPair'
op|','
name|'self'
op|')'
op|'.'
name|'obj_make_compatible'
op|'('
name|'primitive'
op|','
name|'target_version'
op|')'
newline|'\n'
name|'target_version'
op|'='
name|'versionutils'
op|'.'
name|'convert_version_to_tuple'
op|'('
name|'target_version'
op|')'
newline|'\n'
name|'if'
name|'target_version'
op|'<'
op|'('
number|'1'
op|','
number|'2'
op|')'
name|'and'
string|"'type'"
name|'in'
name|'primitive'
op|':'
newline|'\n'
indent|' '
name|'del'
name|'primitive'
op|'['
string|"'type'"
op|']'
newline|'\n'
nl|'\n'
dedent|''
dedent|''
op|'@'
name|'staticmethod'
newline|'\n'
DECL|member|_from_db_object
name|'def'
name|'_from_db_object'
op|'('
name|'context'
op|','
name|'keypair'
op|','
name|'db_keypair'
op|')'
op|':'
newline|'\n'
indent|' '
name|'ignore'
op|'='
op|'{'
string|"'deleted'"
op|':'
name|'False'
op|','
nl|'\n'
string|"'deleted_at'"
op|':'
name|'None'
op|'}'
newline|'\n'
name|'for'
name|'key'
name|'in'
name|'keypair'
op|'.'
name|'fields'
op|':'
newline|'\n'
indent|' '
name|'if'
name|'key'
name|'in'
name|'ignore'
name|'and'
name|'not'
name|'hasattr'
op|'('
name|'db_keypair'
op|','
name|'key'
op|')'
op|':'
newline|'\n'
indent|' '
name|'keypair'
op|'['
name|'key'
op|']'
op|'='
name|'ignore'
op|'['
name|'key'
op|']'
newline|'\n'
dedent|''
name|'else'
op|':'
newline|'\n'
indent|' '
name|'keypair'
op|'['
name|'key'
op|']'
op|'='
name|'db_keypair'
op|'['
name|'key'
op|']'
newline|'\n'
dedent|''
dedent|''
name|'keypair'
op|'.'
name|'_context'
op|'='
name|'context'
newline|'\n'
name|'keypair'
op|'.'
name|'obj_reset_changes'
op|'('
op|')'
newline|'\n'
name|'return'
name|'keypair'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'staticmethod'
newline|'\n'
DECL|member|_get_from_db
name|'def'
name|'_get_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
op|':'
newline|'\n'
indent|' '
name|'return'
name|'_get_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|'='
name|'name'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'staticmethod'
newline|'\n'
DECL|member|_destroy_in_db
name|'def'
name|'_destroy_in_db'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
op|':'
newline|'\n'
indent|' '
name|'return'
name|'_destroy_in_db'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'staticmethod'
newline|'\n'
DECL|member|_create_in_db
name|'def'
name|'_create_in_db'
op|'('
name|'context'
op|','
name|'values'
op|')'
op|':'
newline|'\n'
indent|' '
name|'return'
name|'_create_in_db'
op|'('
name|'context'
op|','
name|'values'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'base'
op|'.'
name|'remotable_classmethod'
newline|'\n'
DECL|member|get_by_name
name|'def'
name|'get_by_name'
op|'('
name|'cls'
op|','
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|','
nl|'\n'
name|'localonly'
op|'='
name|'False'
op|')'
op|':'
newline|'\n'
indent|' '
name|'db_keypair'
op|'='
name|'None'
newline|'\n'
name|'if'
name|'not'
name|'localonly'
op|':'
newline|'\n'
indent|' '
name|'try'
op|':'
newline|'\n'
indent|' '
name|'db_keypair'
op|'='
name|'cls'
op|'.'
name|'_get_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
newline|'\n'
dedent|''
name|'except'
name|'exception'
op|'.'
name|'KeypairNotFound'
op|':'
newline|'\n'
indent|' '
name|'pass'
newline|'\n'
dedent|''
dedent|''
name|'if'
name|'db_keypair'
name|'is'
name|'None'
op|':'
newline|'\n'
indent|' '
name|'db_keypair'
op|'='
name|'db'
op|'.'
name|'key_pair_get'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
newline|'\n'
dedent|''
name|'return'
name|'cls'
op|'.'
name|'_from_db_object'
op|'('
name|'context'
op|','
name|'cls'
op|'('
op|')'
op|','
name|'db_keypair'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'base'
op|'.'
name|'remotable_classmethod'
newline|'\n'
DECL|member|destroy_by_name
name|'def'
name|'destroy_by_name'
op|'('
name|'cls'
op|','
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
op|':'
newline|'\n'
indent|' '
name|'try'
op|':'
newline|'\n'
indent|' '
name|'cls'
op|'.'
name|'_destroy_in_db'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
newline|'\n'
dedent|''
name|'except'
name|'exception'
op|'.'
name|'KeypairNotFound'
op|':'
newline|'\n'
indent|' '
name|'db'
op|'.'
name|'key_pair_destroy'
op|'('
name|'context'
op|','
name|'user_id'
op|','
name|'name'
op|')'
newline|'\n'
nl|'\n'
dedent|''
dedent|''
op|'@'
name|'base'
op|'.'
name|'remotable'
newline|'\n'
DECL|member|create
name|'def'
name|'create'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'if'
name|'self'
op|'.'
name|'obj_attr_is_set'
op|'('
string|"'id'"
op|')'
op|':'
newline|'\n'
indent|' '
name|'raise'
name|'exception'
op|'.'
name|'ObjectActionError'
op|'('
name|'action'
op|'='
string|"'create'"
op|','
nl|'\n'
name|'reason'
op|'='
string|"'already created'"
op|')'
newline|'\n'
nl|'\n'
comment|'# NOTE(danms): Check to see if it exists in the old DB before'
nl|'\n'
comment|"# letting them create in the API DB, since we won't get protection"
nl|'\n'
comment|'# from the UC.'
nl|'\n'
dedent|''
name|'try'
op|':'
newline|'\n'
indent|' '
name|'db'
op|'.'
name|'key_pair_get'
op|'('
name|'self'
op|'.'
name|'_context'
op|','
name|'self'
op|'.'
name|'user_id'
op|','
name|'self'
op|'.'
name|'name'
op|')'
newline|'\n'
name|'raise'
name|'exception'
op|'.'
name|'KeyPairExists'
op|'('
name|'key_name'
op|'='
name|'self'
op|'.'
name|'name'
op|')'
newline|'\n'
dedent|''
name|'except'
name|'exception'
op|'.'
name|'KeypairNotFound'
op|':'
newline|'\n'
indent|' '
name|'pass'
newline|'\n'
nl|'\n'
dedent|''
name|'updates'
op|'='
name|'self'
op|'.'
name|'obj_get_changes'
op|'('
op|')'
newline|'\n'
name|'db_keypair'
op|'='
name|'self'
op|'.'
name|'_create_in_db'
op|'('
name|'self'
op|'.'
name|'_context'
op|','
name|'updates'
op|')'
newline|'\n'
name|'self'
op|'.'
name|'_from_db_object'
op|'('
name|'self'
op|'.'
name|'_context'
op|','
name|'self'
op|','
name|'db_keypair'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'base'
op|'.'
name|'remotable'
newline|'\n'
DECL|member|destroy
name|'def'
name|'destroy'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|' '
name|'try'
op|':'
newline|'\n'
indent|' '
name|'self'
op|'.'
name|'_destroy_in_db'
op|'('
name|'self'
op|'.'
name|'_context'
op|','
name|'self'
op|'.'
name|'user_id'
op|','
name|'self'
op|'.'
name|'name'
op|')'
newline|'\n'
dedent|''
name|'except'
name|'exception'
op|'.'
name|'KeypairNotFound'
op|':'
newline|'\n'
indent|' '
name|'db'
op|'.'
name|'key_pair_destroy'
op|'('
name|'self'
op|'.'
name|'_context'
op|','
name|'self'
op|'.'
name|'user_id'
op|','
name|'self'
op|'.'
name|'name'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
dedent|''
dedent|''
dedent|''
op|'@'
name|'base'
op|'.'
name|'NovaObjectRegistry'
op|'.'
name|'register'
newline|'\n'
DECL|class|KeyPairList
name|'class'
name|'KeyPairList'
op|'('
name|'base'
op|'.'
name|'ObjectListBase'
op|','
name|'base'
op|'.'
name|'NovaObject'
op|')'
op|':'
newline|'\n'
comment|'# Version 1.0: Initial version'
nl|'\n'
comment|'# KeyPair <= version 1.1'
nl|'\n'
comment|'# Version 1.1: KeyPair <= version 1.2'
nl|'\n'
comment|'# Version 1.2: KeyPair <= version 1.3'
nl|'\n'
DECL|variable|VERSION
indent|' '
name|'VERSION'
op|'='
string|"'1.2'"
newline|'\n'
nl|'\n'
DECL|variable|fields
name|'fields'
op|'='
op|'{'
nl|'\n'
string|"'objects'"
op|':'
name|'fields'
op|'.'
name|'ListOfObjectsField'
op|'('
string|"'KeyPair'"
op|')'
op|','
nl|'\n'
op|'}'
newline|'\n'
nl|'\n'
op|'@'
name|'staticmethod'
newline|'\n'
DECL|member|_get_from_db
name|'def'
name|'_get_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
op|':'
newline|'\n'
indent|' '
name|'return'
name|'_get_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'staticmethod'
newline|'\n'
DECL|member|_get_count_from_db
name|'def'
name|'_get_count_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
op|':'
newline|'\n'
indent|' '
name|'return'
name|'_get_count_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'base'
op|'.'
name|'remotable_classmethod'
newline|'\n'
DECL|member|get_by_user
name|'def'
name|'get_by_user'
op|'('
name|'cls'
op|','
name|'context'
op|','
name|'user_id'
op|')'
op|':'
newline|'\n'
indent|' '
name|'api_db_keypairs'
op|'='
name|'cls'
op|'.'
name|'_get_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
newline|'\n'
name|'main_db_keypairs'
op|'='
name|'db'
op|'.'
name|'key_pair_get_all_by_user'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
newline|'\n'
name|'return'
name|'base'
op|'.'
name|'obj_make_list'
op|'('
name|'context'
op|','
name|'cls'
op|'('
name|'context'
op|')'
op|','
name|'objects'
op|'.'
name|'KeyPair'
op|','
nl|'\n'
name|'api_db_keypairs'
op|'+'
name|'main_db_keypairs'
op|')'
newline|'\n'
nl|'\n'
dedent|''
op|'@'
name|'base'
op|'.'
name|'remotable_classmethod'
newline|'\n'
DECL|member|get_count_by_user
name|'def'
name|'get_count_by_user'
op|'('
name|'cls'
op|','
name|'context'
op|','
name|'user_id'
op|')'
op|':'
newline|'\n'
indent|' '
name|'return'
op|'('
name|'cls'
op|'.'
name|'_get_count_from_db'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
op|'+'
nl|'\n'
name|'db'
op|'.'
name|'key_pair_count_by_user'
op|'('
name|'context'
op|','
name|'user_id'
op|')'
op|')'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit
| 12.676647 | 88 | 0.604688 | 2,533 | 16,936 | 3.93486 | 0.084485 | 0.18481 | 0.082272 | 0.058694 | 0.789305 | 0.731514 | 0.676533 | 0.643423 | 0.613023 | 0.563459 | 0 | 0.002997 | 0.113486 | 16,936 | 1,335 | 89 | 12.686142 | 0.66085 | 0 | 0 | 0.927341 | 0 | 0 | 0.369036 | 0.009093 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.001498 | 0.006742 | null | null | 0.000749 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 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 | 3 |
481e72c4f325c259e94e00c5d0f8608a11d7c89a | 1,211 | py | Python | jigu/query/txinfo.py | bongtrop/jigu | 448bce8ce693f3f7c530bea0f2f268e22100937a | [
"MIT"
] | 14 | 2020-03-03T06:46:39.000Z | 2021-05-01T15:29:35.000Z | jigu/query/txinfo.py | bongtrop/jigu | 448bce8ce693f3f7c530bea0f2f268e22100937a | [
"MIT"
] | 9 | 2020-03-09T06:36:30.000Z | 2021-02-15T14:40:48.000Z | jigu/query/txinfo.py | bongtrop/jigu | 448bce8ce693f3f7c530bea0f2f268e22100937a | [
"MIT"
] | 5 | 2020-05-30T22:38:34.000Z | 2021-02-11T00:56:20.000Z | from __future__ import annotations
from typing import Iterable, Union
from jigu.core.auth.transaction import TxInfo
from jigu.query.msginfo import MsgInfosQuery
from jigu.util.pretty import PrettyPrintable, pretty_repr
__all__ = ["TxInfosQuery"]
class TxInfosQuery(PrettyPrintable):
def __init__(self, txinfos: Iterable[TxInfo]):
self.txinfos = list(txinfos)
def __repr__(self) -> str:
return f"<TxInfosQuery {len(self.txinfos)} txs, {len(self.msgs)} msgs>"
def __getitem__(self, key) -> Union[TxInfo, TxInfosQuery]:
if isinstance(key, int):
return self.txinfos[key]
elif isinstance(key, slice):
return TxInfosQuery(self.txinfos[key])
else:
raise KeyError(
f"unusuable key {key} for TxInfosQuery (use 'int' or 'slice')"
)
def __len__(self) -> int:
return len(self.txinfos)
@property
def msgs(self) -> MsgInfosQuery:
return MsgInfosQuery([msg for t in self.txinfos for msg in t.msgs])
@property
def pretty_iterable(self) -> bool:
return True
def _pretty_repr_(self, path: str = "") -> str:
return pretty_repr(self.txinfos, path)
| 28.833333 | 79 | 0.652353 | 144 | 1,211 | 5.277778 | 0.375 | 0.115789 | 0.036842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2436 | 1,211 | 41 | 80 | 29.536585 | 0.829694 | 0 | 0 | 0.066667 | 0 | 0 | 0.109001 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.233333 | false | 0 | 0.166667 | 0.166667 | 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 | 1 | 1 | 0 | 0 | 3 |
484ab27d37aa93bd10b554b13558fc01d9cc4417 | 385 | py | Python | 05 ListTuple/ListDemo.py | codewithsandy/Python-Basic-Exp | 4c70ada4a042923a94301453c7bd76e704cd2989 | [
"MIT"
] | 3 | 2021-05-08T13:11:41.000Z | 2021-05-14T02:43:20.000Z | 05 ListTuple/ListDemo.py | codewithsandy/Python-Basic-Exp | 4c70ada4a042923a94301453c7bd76e704cd2989 | [
"MIT"
] | null | null | null | 05 ListTuple/ListDemo.py | codewithsandy/Python-Basic-Exp | 4c70ada4a042923a94301453c7bd76e704cd2989 | [
"MIT"
] | null | null | null | grocery = ["Sugar", "Pizza", "Ice-Cream", 100]
print(grocery)
print(grocery[1])
numbers = [2, 5, 6, 9, 4]
print(numbers)
print(numbers[3])
print(numbers[0:4])
print(numbers[1:3])
print(numbers[::1])
print("\n")
numbers.sort()
print(numbers)
numbers.reverse()
print(numbers)
numbers.append(99)
print("\t", numbers)
numbers.insert(1, 1996)
print(numbers)
numbers.pop()
print(numbers) | 16.041667 | 46 | 0.690909 | 59 | 385 | 4.508475 | 0.423729 | 0.406015 | 0.214286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063037 | 0.093506 | 385 | 24 | 47 | 16.041667 | 0.69914 | 0 | 0 | 0.25 | 0 | 0 | 0.059585 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.65 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
4879556c96330be5e472a3d7384b640ec916e32b | 232 | py | Python | ocs_ci/deployment/azure.py | phlogistonjohn/ocs-ci | 38223e18ca2e1db7a24cc9bdb76e38d2ba4e6f12 | [
"MIT"
] | null | null | null | ocs_ci/deployment/azure.py | phlogistonjohn/ocs-ci | 38223e18ca2e1db7a24cc9bdb76e38d2ba4e6f12 | [
"MIT"
] | null | null | null | ocs_ci/deployment/azure.py | phlogistonjohn/ocs-ci | 38223e18ca2e1db7a24cc9bdb76e38d2ba4e6f12 | [
"MIT"
] | 1 | 2020-07-28T07:32:09.000Z | 2020-07-28T07:32:09.000Z | import logging
logger = logging.getLogger(__name__)
class AZUREIPI:
"""
A class to handle AZURE IPI specific deployment
"""
def __init__(self):
logger.info("AZURE IPI")
# TODO: OCP,OCS deployment
| 16.571429 | 51 | 0.642241 | 27 | 232 | 5.222222 | 0.777778 | 0.113475 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.262931 | 232 | 13 | 52 | 17.846154 | 0.824561 | 0.314655 | 0 | 0 | 0 | 0 | 0.062937 | 0 | 0 | 0 | 0 | 0.076923 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
48896c135312f70966a7041285269e16dbd223a1 | 100 | py | Python | about/models.py | deepaktiwari88/Gladys | 9fc33393e228ba6f8f50e26201fd47bb907b6add | [
"MIT"
] | 7 | 2018-05-21T07:47:50.000Z | 2019-11-15T12:06:47.000Z | about/models.py | deepaktiwari88/Gladys | 9fc33393e228ba6f8f50e26201fd47bb907b6add | [
"MIT"
] | null | null | null | about/models.py | deepaktiwari88/Gladys | 9fc33393e228ba6f8f50e26201fd47bb907b6add | [
"MIT"
] | 8 | 2018-03-28T04:57:41.000Z | 2022-03-26T09:03:06.000Z | from django.db import models
class User(models.Model):
name = models.CharField(max_length=25)
| 16.666667 | 42 | 0.75 | 15 | 100 | 4.933333 | 0.866667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023529 | 0.15 | 100 | 5 | 43 | 20 | 0.847059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6f9a258bb381f2a5e9c13bb6aec1028c35178c6b | 7,141 | py | Python | tests/components/plugwise/test_climate.py | wstewart15/core | 854d7d49367d560406d6099a5ba56a0be6c0b9c7 | [
"Apache-2.0"
] | null | null | null | tests/components/plugwise/test_climate.py | wstewart15/core | 854d7d49367d560406d6099a5ba56a0be6c0b9c7 | [
"Apache-2.0"
] | 7 | 2020-08-05T07:22:37.000Z | 2020-10-12T10:43:30.000Z | tests/components/plugwise/test_climate.py | wstewart15/core | 854d7d49367d560406d6099a5ba56a0be6c0b9c7 | [
"Apache-2.0"
] | 3 | 2021-11-14T13:29:33.000Z | 2021-12-27T17:05:22.000Z | """Tests for the Plugwise Climate integration."""
from unittest.mock import MagicMock
from plugwise.exceptions import PlugwiseException
import pytest
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_COOL,
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from tests.common import MockConfigEntry
async def test_adam_climate_entity_attributes(
hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry
) -> None:
"""Test creation of adam climate device environment."""
state = hass.states.get("climate.zone_lisa_wk")
assert state
assert state.attributes["hvac_modes"] == [
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
HVAC_MODE_AUTO,
]
assert "preset_modes" in state.attributes
assert "no_frost" in state.attributes["preset_modes"]
assert "home" in state.attributes["preset_modes"]
assert state.attributes["current_temperature"] == 20.9
assert state.attributes["preset_mode"] == "home"
assert state.attributes["supported_features"] == 17
assert state.attributes["temperature"] == 21.5
state = hass.states.get("climate.zone_thermostat_jessie")
assert state
assert state.attributes["hvac_modes"] == [
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
HVAC_MODE_AUTO,
]
assert "preset_modes" in state.attributes
assert "no_frost" in state.attributes["preset_modes"]
assert "home" in state.attributes["preset_modes"]
assert state.attributes["current_temperature"] == 17.2
assert state.attributes["preset_mode"] == "asleep"
assert state.attributes["temperature"] == 15.0
async def test_adam_climate_adjust_negative_testing(
hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry
) -> None:
"""Test exceptions of climate entities."""
mock_smile_adam.set_preset.side_effect = PlugwiseException
mock_smile_adam.set_schedule_state.side_effect = PlugwiseException
mock_smile_adam.set_temperature.side_effect = PlugwiseException
with pytest.raises(HomeAssistantError):
await hass.services.async_call(
"climate",
"set_temperature",
{"entity_id": "climate.zone_lisa_wk", "temperature": 25},
blocking=True,
)
with pytest.raises(HomeAssistantError):
await hass.services.async_call(
"climate",
"set_preset_mode",
{"entity_id": "climate.zone_thermostat_jessie", "preset_mode": "home"},
blocking=True,
)
with pytest.raises(HomeAssistantError):
await hass.services.async_call(
"climate",
"set_hvac_mode",
{
"entity_id": "climate.zone_thermostat_jessie",
"hvac_mode": HVAC_MODE_AUTO,
},
blocking=True,
)
async def test_adam_climate_entity_climate_changes(
hass: HomeAssistant, mock_smile_adam: MagicMock, init_integration: MockConfigEntry
) -> None:
"""Test handling of user requests in adam climate device environment."""
await hass.services.async_call(
"climate",
"set_temperature",
{"entity_id": "climate.zone_lisa_wk", "temperature": 25},
blocking=True,
)
assert mock_smile_adam.set_temperature.call_count == 1
mock_smile_adam.set_temperature.assert_called_with(
"c50f167537524366a5af7aa3942feb1e", 25.0
)
await hass.services.async_call(
"climate",
"set_preset_mode",
{"entity_id": "climate.zone_lisa_wk", "preset_mode": "away"},
blocking=True,
)
assert mock_smile_adam.set_preset.call_count == 1
mock_smile_adam.set_preset.assert_called_with(
"c50f167537524366a5af7aa3942feb1e", "away"
)
await hass.services.async_call(
"climate",
"set_temperature",
{"entity_id": "climate.zone_thermostat_jessie", "temperature": 25},
blocking=True,
)
assert mock_smile_adam.set_temperature.call_count == 2
mock_smile_adam.set_temperature.assert_called_with(
"82fa13f017d240daa0d0ea1775420f24", 25.0
)
await hass.services.async_call(
"climate",
"set_preset_mode",
{"entity_id": "climate.zone_thermostat_jessie", "preset_mode": "home"},
blocking=True,
)
assert mock_smile_adam.set_preset.call_count == 2
mock_smile_adam.set_preset.assert_called_with(
"82fa13f017d240daa0d0ea1775420f24", "home"
)
async def test_anna_climate_entity_attributes(
hass: HomeAssistant, mock_smile_anna: MagicMock, init_integration: MockConfigEntry
) -> None:
"""Test creation of anna climate device environment."""
state = hass.states.get("climate.anna")
assert state
assert state.state == HVAC_MODE_HEAT
assert state.attributes["hvac_modes"] == [
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
HVAC_MODE_COOL,
]
assert "no_frost" in state.attributes["preset_modes"]
assert "home" in state.attributes["preset_modes"]
assert state.attributes["current_temperature"] == 19.3
assert state.attributes["hvac_action"] == "heating"
assert state.attributes["preset_mode"] == "home"
assert state.attributes["supported_features"] == 17
assert state.attributes["temperature"] == 21.0
async def test_anna_climate_entity_climate_changes(
hass: HomeAssistant, mock_smile_anna: MagicMock, init_integration: MockConfigEntry
) -> None:
"""Test handling of user requests in anna climate device environment."""
await hass.services.async_call(
"climate",
"set_temperature",
{"entity_id": "climate.anna", "temperature": 25},
blocking=True,
)
assert mock_smile_anna.set_temperature.call_count == 1
mock_smile_anna.set_temperature.assert_called_with(
"c784ee9fdab44e1395b8dee7d7a497d5", 25.0
)
await hass.services.async_call(
"climate",
"set_preset_mode",
{"entity_id": "climate.anna", "preset_mode": "away"},
blocking=True,
)
assert mock_smile_anna.set_preset.call_count == 1
mock_smile_anna.set_preset.assert_called_with(
"c784ee9fdab44e1395b8dee7d7a497d5", "away"
)
await hass.services.async_call(
"climate",
"set_hvac_mode",
{"entity_id": "climate.anna", "hvac_mode": "heat_cool"},
blocking=True,
)
assert mock_smile_anna.set_temperature.call_count == 1
assert mock_smile_anna.set_schedule_state.call_count == 1
mock_smile_anna.set_schedule_state.assert_called_with(
"c784ee9fdab44e1395b8dee7d7a497d5", None, "false"
)
# Auto mode is not available, no schedules
with pytest.raises(ValueError):
await hass.services.async_call(
"climate",
"set_hvac_mode",
{"entity_id": "climate.anna", "hvac_mode": "auto"},
blocking=True,
)
assert mock_smile_anna.set_temperature.call_count == 1
assert mock_smile_anna.set_schedule_state.call_count == 1
| 32.022422 | 86 | 0.683658 | 808 | 7,141 | 5.735149 | 0.133663 | 0.048554 | 0.067976 | 0.03798 | 0.802331 | 0.766077 | 0.732628 | 0.680837 | 0.595166 | 0.595166 | 0 | 0.032781 | 0.213976 | 7,141 | 222 | 87 | 32.166667 | 0.792802 | 0.011903 | 0 | 0.573864 | 0 | 0 | 0.201806 | 0.055375 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | false | 0 | 0.039773 | 0 | 0.039773 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6fa68ba4cb2178a5e9bc8e6fd011251212930702 | 162 | py | Python | 520A.py | cocomo29/CodeForces | be3bb4c2a90ca3f707fb2536a1ee8ee2eecd6e24 | [
"MIT"
] | 1 | 2022-01-16T13:06:14.000Z | 2022-01-16T13:06:14.000Z | 520A.py | cocomo29/CodeForces | be3bb4c2a90ca3f707fb2536a1ee8ee2eecd6e24 | [
"MIT"
] | null | null | null | 520A.py | cocomo29/CodeForces | be3bb4c2a90ca3f707fb2536a1ee8ee2eecd6e24 | [
"MIT"
] | 2 | 2022-01-19T15:44:13.000Z | 2022-01-21T16:25:42.000Z | n=input()
words=input()
words=words.lower()
lst=[]
for i in words:
if i not in lst:
lst.append(i)
print("YES") if len(lst)==26 else print("NO") | 20.25 | 45 | 0.58642 | 29 | 162 | 3.275862 | 0.586207 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016 | 0.228395 | 162 | 8 | 45 | 20.25 | 0.744 | 0 | 0 | 0 | 0 | 0 | 0.032051 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.125 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6fb42dcb3772d90cd8f949d5e520306e0cec600c | 134 | py | Python | operations/employees/apps.py | kaizer88/emps | 2669b32c46befcf1a19390fb25013817e6b00980 | [
"MIT"
] | null | null | null | operations/employees/apps.py | kaizer88/emps | 2669b32c46befcf1a19390fb25013817e6b00980 | [
"MIT"
] | 25 | 2018-03-23T16:39:51.000Z | 2018-05-19T17:28:42.000Z | employees/apps.py | belatrix/BelatrixEventsBackend | eb38574bba0ca0269b17d0be938cc46787c21895 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from django.apps import AppConfig
class EmployeesConfig(AppConfig):
name = 'employees'
| 16.75 | 39 | 0.798507 | 15 | 134 | 6.8 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.149254 | 134 | 7 | 40 | 19.142857 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0.067164 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6fc3fe6fa8ed60fd30d51867ab074d218cc2483c | 16,801 | py | Python | spydrnet/callback/callback_listener.py | ganeshgore/spydrnet | 22672b8fc7d63461a71077bd20f29df6d38e96f4 | [
"BSD-3-Clause"
] | 34 | 2020-03-12T15:40:49.000Z | 2022-02-28T07:13:47.000Z | spydrnet/callback/callback_listener.py | ganeshgore/spydrnet | 22672b8fc7d63461a71077bd20f29df6d38e96f4 | [
"BSD-3-Clause"
] | 104 | 2020-01-06T20:32:19.000Z | 2022-01-02T00:20:14.000Z | spydrnet/callback/callback_listener.py | ganeshgore/spydrnet | 22672b8fc7d63461a71077bd20f29df6d38e96f4 | [
"BSD-3-Clause"
] | 10 | 2020-09-02T20:24:00.000Z | 2022-02-24T16:10:07.000Z | from spydrnet.global_state import global_callback
class CallbackListener:
"""
extend this class to create a listener that can be used to make a plugin to spydrnet.
In this class are all of the functions that are used as callbacks. There are also
register methods whos function is to register the callback functions that are present.
callbacks are netlist dependent. If a callback is registered to one netlist it is not automatically registered to all netlists.
"""
def __init__(self):
self.register_all_listeners()
def create_netlist(self, netlist):
raise NotImplementedError
def create_library(self, library):
raise NotImplementedError
def create_definition(self, definition):
raise NotImplementedError
def create_port(self, port):
raise NotImplementedError
def create_cable(self, cable):
raise NotImplementedError
def create_instance(self, instance):
raise NotImplementedError
def cable_add_wire(self, cable, wire):
raise NotImplementedError
def cable_remove_wire(self, cable, wire):
raise NotImplementedError
def definition_add_port(self, definition, port):
raise NotImplementedError
def definition_remove_port(self, definition, port):
raise NotImplementedError
def definition_add_child(self, definition, child):
raise NotImplementedError
def definition_remove_child(self, definition, child):
raise NotImplementedError
def definition_add_cable(self, definition, cable):
raise NotImplementedError
def definition_remove_cable(self, definition, cable):
raise NotImplementedError
def instance_reference(self, instance, reference):
raise NotImplementedError
def library_add_definition(self, library, definition):
raise NotImplementedError
def library_remove_definition(self, library, definition):
raise NotImplementedError
def netlist_top_instance(self, netlist, instance):
raise NotImplementedError
def netlist_add_library(self, netlist, library):
raise NotImplementedError
def netlist_remove_library(self, netlist, library):
raise NotImplementedError
def port_add_pin(self, port, pin):
raise NotImplementedError
def port_remove_pin(self, port, pin):
raise NotImplementedError
def wire_connect_pin(self, wire, pin):
raise NotImplementedError
def wire_disconnect_pin(self, wire, pin):
raise NotImplementedError
def dictionary_set(self, element, key, value):
raise NotImplementedError
def dictionary_delete(self, element, key):
raise NotImplementedError
def dictionary_pop(self, element, key):
raise NotImplementedError
def register_all_listeners(self):
if self.create_netlist.__func__ is not CallbackListener.create_netlist:
self.register_create_netlist()
if self.create_library.__func__ is not CallbackListener.create_library:
self.register_create_library()
if self.create_definition.__func__ is not CallbackListener.create_definition:
self.register_create_definition()
if self.create_port.__func__ is not CallbackListener.create_port:
self.register_create_port()
if self.create_cable.__func__ is not CallbackListener.create_cable:
self.register_create_cable()
if self.create_instance.__func__ is not CallbackListener.create_instance:
self.register_create_instance()
if self.cable_add_wire.__func__ is not CallbackListener.cable_add_wire:
self.register_cable_add_wire()
if self.cable_remove_wire.__func__ is not CallbackListener.cable_remove_wire:
self.register_cable_remove_wire()
if self.definition_add_port.__func__ is not CallbackListener.definition_add_port:
self.register_definition_add_port()
if self.definition_remove_port.__func__ is not CallbackListener.definition_remove_port:
self.register_definition_remove_port()
if self.definition_add_child.__func__ is not CallbackListener.definition_add_child:
self.register_definition_add_child()
if self.definition_remove_child.__func__ is not CallbackListener.definition_remove_child:
self.register_definition_remove_child()
if self.definition_add_cable.__func__ is not CallbackListener.definition_add_cable:
self.register_definition_add_cable()
if self.definition_remove_cable.__func__ is not CallbackListener.definition_remove_cable:
self.register_definition_remove_cable()
if self.instance_reference.__func__ is not CallbackListener.instance_reference:
self.register_instance_reference()
if self.library_add_definition.__func__ is not CallbackListener.library_add_definition:
self.register_library_add_definition()
if self.library_remove_definition.__func__ is not CallbackListener.library_remove_definition:
self.register_library_remove_definition()
if self.netlist_top_instance.__func__ is not CallbackListener.netlist_top_instance:
self.register_netlist_top_instance()
if self.netlist_add_library.__func__ is not CallbackListener.netlist_add_library:
self.register_netlist_add_library()
if self.netlist_remove_library.__func__ is not CallbackListener.netlist_remove_library:
self.register_netlist_remove_library()
if self.port_add_pin.__func__ is not CallbackListener.port_add_pin:
self.register_port_add_pin()
if self.port_remove_pin.__func__ is not CallbackListener.port_remove_pin:
self.register_port_remove_pin()
if self.wire_connect_pin.__func__ is not CallbackListener.wire_connect_pin:
self.register_wire_connect_pin()
if self.wire_disconnect_pin.__func__ is not CallbackListener.wire_disconnect_pin:
self.register_wire_disconnect_pin()
if self.dictionary_set.__func__ is not CallbackListener.dictionary_set:
self.register_dictionary_set()
if self.dictionary_delete.__func__ is not CallbackListener.dictionary_delete:
self.register_dictionary_delete()
if self.dictionary_pop.__func__ is not CallbackListener.dictionary_pop:
self.register_dictionary_pop()
def register_create_netlist(self):
global_callback.register_create_netlist(self.create_netlist)
def register_create_library(self):
global_callback.register_create_library(self.create_library)
def register_create_definition(self):
global_callback.register_create_definition(self.create_definition)
def register_create_port(self):
global_callback.register_create_port(self.create_port)
def register_create_cable(self):
global_callback.register_create_cable(self.create_cable)
def register_create_instance(self):
global_callback.register_create_instance(self.create_instance)
def register_cable_add_wire(self):
global_callback.register_cable_add_wire(self.cable_add_wire)
def register_cable_remove_wire(self):
global_callback.register_cable_remove_wire(self.cable_remove_wire)
def register_definition_add_port(self):
global_callback.register_definition_add_port(self.definition_add_port)
def register_definition_remove_port(self):
global_callback.register_definition_remove_port(self.definition_remove_port)
def register_definition_add_child(self):
global_callback.register_definition_add_child(self.definition_add_child)
def register_definition_remove_child(self):
global_callback.register_definition_remove_child(self.definition_remove_child)
def register_definition_add_cable(self):
global_callback.register_definition_add_cable(self.definition_add_cable)
def register_definition_remove_cable(self):
global_callback.register_definition_remove_cable(self.definition_remove_cable)
def register_instance_reference(self):
global_callback.register_instance_reference(self.instance_reference)
def register_library_add_definition(self):
global_callback.register_library_add_definition(self.library_add_definition)
def register_library_remove_definition(self):
global_callback.register_library_remove_definition(self.library_remove_definition)
def register_netlist_top_instance(self):
global_callback.register_netlist_top_instance(self.netlist_top_instance)
def register_netlist_add_library(self):
global_callback.register_netlist_add_library(self.netlist_add_library)
def register_netlist_remove_library(self):
global_callback.register_netlist_remove_library(self.netlist_remove_library)
def register_port_add_pin(self):
global_callback.register_port_add_pin(self.port_add_pin)
def register_port_remove_pin(self):
global_callback.register_port_remove_pin(self.port_remove_pin)
def register_wire_connect_pin(self):
global_callback.register_wire_connect_pin(self.wire_connect_pin)
def register_wire_disconnect_pin(self):
global_callback.register_wire_disconnect_pin(self.wire_disconnect_pin)
def register_dictionary_set(self):
global_callback.register_dictionary_set(self.dictionary_set)
def register_dictionary_delete(self):
global_callback.register_dictionary_delete(self.dictionary_delete)
def register_dictionary_pop(self):
global_callback.register_dictionary_pop(self.dictionary_pop)
def deregister_all_listeners(self):
if self.create_netlist.__func__ is not CallbackListener.create_netlist:
self.deregister_create_netlist()
if self.create_library.__func__ is not CallbackListener.create_library:
self.deregister_create_library()
if self.create_definition.__func__ is not CallbackListener.create_definition:
self.deregister_create_definition()
if self.create_port.__func__ is not CallbackListener.create_port:
self.deregister_create_port()
if self.create_cable.__func__ is not CallbackListener.create_cable:
self.deregister_create_cable()
if self.create_instance.__func__ is not CallbackListener.create_instance:
self.deregister_create_instance()
if self.cable_add_wire.__func__ is not CallbackListener.cable_add_wire:
self.deregister_cable_add_wire()
if self.cable_remove_wire.__func__ is not CallbackListener.cable_remove_wire:
self.deregister_cable_remove_wire()
if self.definition_add_port.__func__ is not CallbackListener.definition_add_port:
self.deregister_definition_add_port()
if self.definition_remove_port.__func__ is not CallbackListener.definition_remove_port:
self.deregister_definition_remove_port()
if self.definition_add_child.__func__ is not CallbackListener.definition_add_child:
self.deregister_definition_add_child()
if self.definition_remove_child.__func__ is not CallbackListener.definition_remove_child:
self.deregister_definition_remove_child()
if self.definition_add_cable.__func__ is not CallbackListener.definition_add_cable:
self.deregister_definition_add_cable()
if self.definition_remove_cable.__func__ is not CallbackListener.definition_remove_cable:
self.deregister_definition_remove_cable()
if self.instance_reference.__func__ is not CallbackListener.instance_reference:
self.deregister_instance_reference()
if self.library_add_definition.__func__ is not CallbackListener.library_add_definition:
self.deregister_library_add_definition()
if self.library_remove_definition.__func__ is not CallbackListener.library_remove_definition:
self.deregister_library_remove_definition()
if self.netlist_top_instance.__func__ is not CallbackListener.netlist_top_instance:
self.deregister_netlist_top_instance()
if self.netlist_add_library.__func__ is not CallbackListener.netlist_add_library:
self.deregister_netlist_add_library()
if self.netlist_remove_library.__func__ is not CallbackListener.netlist_remove_library:
self.deregister_netlist_remove_library()
if self.port_add_pin.__func__ is not CallbackListener.port_add_pin:
self.deregister_port_add_pin()
if self.port_remove_pin.__func__ is not CallbackListener.port_remove_pin:
self.deregister_port_remove_pin()
if self.wire_connect_pin.__func__ is not CallbackListener.wire_connect_pin:
self.deregister_wire_connect_pin()
if self.wire_disconnect_pin.__func__ is not CallbackListener.wire_disconnect_pin:
self.deregister_wire_disconnect_pin()
if self.dictionary_set.__func__ is not CallbackListener.dictionary_set:
self.deregister_dictionary_set()
if self.dictionary_delete.__func__ is not CallbackListener.dictionary_delete:
self.deregister_dictionary_delete()
if self.dictionary_pop.__func__ is not CallbackListener.dictionary_pop:
self.deregister_dictionary_pop()
def deregister_create_netlist(self):
global_callback.deregister_create_netlist(self.create_netlist)
def deregister_create_library(self):
global_callback.deregister_create_library(self.create_library)
def deregister_create_definition(self):
global_callback.deregister_create_definition(self.create_definition)
def deregister_create_port(self):
global_callback.deregister_create_port(self.create_port)
def deregister_create_cable(self):
global_callback.deregister_create_cable(self.create_cable)
def deregister_create_instance(self):
global_callback.deregister_create_instance(self.create_instance)
def deregister_cable_add_wire(self):
global_callback.deregister_cable_add_wire(self.cable_add_wire)
def deregister_cable_remove_wire(self):
global_callback.deregister_cable_remove_wire(self.cable_remove_wire)
def deregister_definition_add_port(self):
global_callback.deregister_definition_add_port(self.definition_add_port)
def deregister_definition_remove_port(self):
global_callback.deregister_definition_remove_port(self.definition_remove_port)
def deregister_definition_add_child(self):
global_callback.deregister_definition_add_child(self.definition_add_child)
def deregister_definition_remove_child(self):
global_callback.deregister_definition_remove_child(self.definition_remove_child)
def deregister_definition_add_cable(self):
global_callback.deregister_definition_add_cable(self.definition_add_cable)
def deregister_definition_remove_cable(self):
global_callback.deregister_definition_remove_cable(self.definition_remove_cable)
def deregister_instance_reference(self):
global_callback.deregister_instance_reference(self.instance_reference)
def deregister_library_add_definition(self):
global_callback.deregister_library_add_definition(self.library_add_definition)
def deregister_library_remove_definition(self):
global_callback.deregister_library_remove_definition(self.library_remove_definition)
def deregister_netlist_top_instance(self):
global_callback.deregister_netlist_top_instance(self.netlist_top_instance)
def deregister_netlist_add_library(self):
global_callback.deregister_netlist_add_library(self.netlist_add_library)
def deregister_netlist_remove_library(self):
global_callback.deregister_netlist_remove_library(self.netlist_remove_library)
def deregister_port_add_pin(self):
global_callback.deregister_port_add_pin(self.port_add_pin)
def deregister_port_remove_pin(self):
global_callback.deregister_port_remove_pin(self.port_remove_pin)
def deregister_wire_connect_pin(self):
global_callback.deregister_wire_connect_pin(self.wire_connect_pin)
def deregister_wire_disconnect_pin(self):
global_callback.deregister_wire_disconnect_pin(self.wire_disconnect_pin)
def deregister_dictionary_set(self):
global_callback.deregister_dictionary_set(self.dictionary_set)
def deregister_dictionary_delete(self):
global_callback.deregister_dictionary_delete(self.dictionary_delete)
def deregister_dictionary_pop(self):
global_callback.deregister_dictionary_pop(self.dictionary_pop) | 39.907363 | 131 | 0.768526 | 1,982 | 16,801 | 6.002018 | 0.037336 | 0.064728 | 0.040854 | 0.113484 | 0.865081 | 0.747478 | 0.563551 | 0.515299 | 0.376261 | 0.376261 | 0 | 0 | 0.177251 | 16,801 | 421 | 132 | 39.907363 | 0.860595 | 0.022796 | 0 | 0.293478 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.304348 | false | 0 | 0.003623 | 0 | 0.311594 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6fc6b91f83737a0fa3d26227cec645a96fff6f56 | 20,836 | py | Python | triagelib/triagelib.py | jblackb1/triagelib | 9eb7d4fe275032dc349dcadaa632468fbae4d54c | [
"MIT"
] | 7 | 2018-06-26T17:07:32.000Z | 2020-06-28T22:49:28.000Z | triagelib/triagelib.py | jblackb1/triagelib | 9eb7d4fe275032dc349dcadaa632468fbae4d54c | [
"MIT"
] | null | null | null | triagelib/triagelib.py | jblackb1/triagelib | 9eb7d4fe275032dc349dcadaa632468fbae4d54c | [
"MIT"
] | 2 | 2019-02-04T11:12:53.000Z | 2021-05-26T14:05:50.000Z | #!/usr/bin/env python
import json
import logging
import requests
from requests import Request, Session
global triagelog
class TriageError(Exception):
"""Base exception class for all Triage related errors
Exception is explicitly raised when an unknown Triage error"""
class TriageStateError(TriageError):
"""Exception is raised when the session is not in a valid state for the method"""
pass
class TriageClientError(TriageError):
"""Exception is raised when Triage box or an intermediate proxy responds with HTTP 4xx status code"""
pass
class TriageAuthError(TriageClientError):
"""Exception is raised when Triage box or a transparent proxy responds with HTTP 401 code"""
pass
class TriageServerError(TriageError):
"""Exception is raised when Triage box or an intermediate proxy responds with 5xx status code"""
pass
class TriageFailureError(TriageError):
"""Exception is raised when Triage box returns failure result to last request"""
pass
class TriageSession:
"""Class maintaining Triage connectivity through API."""
apiver = '1.0.0' # API version implemented/required
debug = False
def __init__(self, host, email, apikey, ssl=True, uag='Python CoFense Triage Client'):
"""
Set ssl to False if you like to connect using plain HTTP (Triage must not redirect to HTTPS),
Set uag to a desired User-Agent header value.
"""
if not isinstance(ssl, bool): raise TypeError(__name__ + u': ssl parameter must be True or False')
if not isinstance(uag, str): raise TypeError(__name__ + u': uag parameter must be a string')
# ------- Private class instance attributes -------
self._triagehost = host # Hostname of an Triage box to connect to
self._usessl = ssl # Use SSL encryption for Triage communication
self._userag = uag # User-Agent string to use in HTTP headers
self._email = email # Email address of user with API key
self._apikey = apikey # API key of user accessing Triage
self._headers = {'Accept': 'application/vnd.ve.v1.0+json',
'VE-API-Version': TriageSession.apiver,
'user-agent': self._userag,
'Authorization': 'Token token={0}:{1}'.format(self._email, self._apikey)}
def _reqsend(self, prep, host=''):
"""Sends prepared request.
Used by all other methods.
Returns raw response.
"""
triagelog.info(u'------- Sending {0} request to host {1} -------'.format(prep.method,
host))
s = Session()
resp = s.send(prep, verify=False)
triagelog.debug(u'server response: {0}'.format(resp.text))
if resp.status_code == 401:
triagelog.error(u'Could not authenticate to Triage box {0}.'.format(host))
raise TriageAuthError(__name__ + u': Could not authenticate to Triage box {0}.'.format(host))
if resp.status_code != 200:
desc = __name__ + u': Triage box {0} returned HTTP error {1}.'.format(self._triagehost,
resp.status_code)
triagelog.error(desc)
if 400 <= resp.status_code < 500:
raise TriageClientError(desc)
elif 500 <= resp.status_code < 600:
raise TriageServerError(desc)
else:
raise TriageError(desc)
return resp
def _parse(self, src):
"""Parses source text as json entity.
Returns result of parser(src).
Raises TriageError if resp is not json, or json does not contain the values expected by parser.
"""
triagelog.info(u'------- Parsing {0}-byte server response -------'.format(len(src)))
triagelog.debug(u'text to parse = "{0}"'.format(src))
try:
res = json.loads(src)
except ValueError as e:
triagelog.error(u'Triage box {0} did not return a valid json output.'.format(self._triagehost))
raise TriageError(
__name__ + u': Triage box {0} did not return a valid json output.'.format(self._triagehost))
triagelog.debug(u'json data = "{0}"'.format(res))
return res
# ===== Public class methods =====
def reports(self, match_priority=None, category_id=None, start_date=None,
tags=None, end_date=None, page=None, per_page=None, report_id=None):
"""Searches all Triage reports.
tags (list) - One or more tags of processed reports to filter on.
page (int) - The page number for the results.
per_page (int) - The number of results rendered per page. The maximum value is 50 results per page.
start_date (str) - The start date and time of the query. The default is six days ago.
end_date (str) - The end date and time of the query. The default is the current time.
report_id (int) - The Numeric ID of a Triage report.
category_id (int) - The category ID (1-5) for processed reports.
match_priority (int) - The highest match priority based on rule hits for the report.
"""
triagelog.info(u'------- Opening new session to server {0} with user {1} -------'.format(self._triagehost,
self._email))
if not isinstance(self._email, str):
raise TypeError(__name__ + u': email parameter must be a string')
if not isinstance(self._apikey, str):
raise TypeError(__name__ + u': apikey parameter must be a string')
if tags and not isinstance(tags, list):
raise TypeError(__name__ + u': tags parameter must be a list of strings')
if page and not isinstance(page, int):
raise TypeError(__name__ + u': page parameter must be an integer')
if per_page and not isinstance(per_page, int):
raise TypeError(__name__ + u': per_page parameter must be an integer')
if start_date and not isinstance(start_date, str):
raise TypeError(__name__ + u': start_date parameter must be a string')
if end_date and not isinstance(end_date, str):
raise TypeError(__name__ + u': end_date parameter must be a string')
if report_id and not isinstance(report_id, int):
raise TypeError(__name__ + u': report_id parameter must be an integer')
if category_id and not isinstance(category_id, int):
raise TypeError(__name__ + u': caterory_id parameter must be an integer')
if match_priority and not isinstance(match_priority, int):
raise TypeError(__name__ + u': match_priority parameter must be an integer')
params = {}
if tags: params["tags"] = tags
if page: params["page"] = page
if per_page: params["per_page"] = per_page
if start_date: params["start_date"] = start_date
if end_date: params["end_date"] = end_date
if match_priority: params["match_priority"] = match_priority
if category_id: params["category_id"] = category_id
if report_id:
url = 'http{0}://{1}/api/public/v1/reports/{2}'.format(('s' if self._usessl else ''),
self._triagehost,
report_id)
else:
url = 'http{0}://{1}/api/public/v1/reports'.format(('s' if self._usessl else ''),
self._triagehost)
headers = self._headers.copy()
headers.update({'Content-Type': 'application/json'})
triagelog.debug(u'url = "{0}", headers = "{1}", params = "{2}"'.format(url, headers, params))
req = Request('GET', url, headers=headers, params=params)
prep = req.prepare()
resp = self._reqsend(prep, self._triagehost)
return self._parse(resp.text)
def processed_reports(self, match_priority=None, category_id=None, start_date=None,
tags=None, end_date=None, page=None, per_page=None):
"""Searches all Triage reports.
tags (list) - One or more tags of processed reports to filter on.
page (int) - The page number for the results.
per_page (int) - The number of results rendered per page. The maximum value is 50 results per page.
start_date (str) - The start date and time of the query. The default is six days ago.
end_date (str) - The end date and time of the query. The default is the current time.
category_id (int) - The category ID (1-5) for processed reports.
match_priority (int) - The highest match priority based on rule hits for the report.
"""
triagelog.info(u'------- Opening new session to server {0} with user {1} -------'.format(self._triagehost,
self._email))
if not isinstance(self._email, str):
raise TypeError(__name__ + u': email parameter must be a string')
if not isinstance(self._apikey, str):
raise TypeError(__name__ + u': apikey parameter must be a string')
if tags and not isinstance(tags, list):
raise TypeError(__name__ + u': tags parameter must be a list of strings')
if page and not isinstance(page, int):
raise TypeError(__name__ + u': page parameter must be an integer')
if per_page and not isinstance(per_page, int):
raise TypeError(__name__ + u': per_page parameter must be an integer')
if start_date and not isinstance(start_date, str):
raise TypeError(__name__ + u': start_date parameter must be a string')
if end_date and not isinstance(end_date, str):
raise TypeError(__name__ + u': end_date parameter must be a string')
if category_id and not isinstance(category_id, int):
raise TypeError(__name__ + u': caterory_id parameter must be an integer')
if match_priority and not isinstance(match_priority, int):
raise TypeError(__name__ + u': match_priority parameter must be an integer')
params = {}
if tags: params["tags"] = tags
if page: params["page"] = page
if per_page: params["per_page"] = per_page
if start_date: params["start_date"] = start_date
if end_date: params["end_date"] = end_date
if category_id: params["category_id"] = category_id
if match_priority: params["match_priority"] = match_priority
url = 'http{0}://{1}/api/public/v1/processed_reports'.format(('s' if self._usessl else ''),
self._triagehost)
headers = self._headers.copy()
headers.update({'Content-Type': 'application/json'})
triagelog.debug(u'url = "{0}", headers = "{1}", params = "{2}"'.format(url, headers, params))
req = Request('GET', url, headers=headers, params=params)
prep = req.prepare()
resp = self._reqsend(prep, self._triagehost)
return self._parse(resp.text)
def inbox_reports(self, match_priority=None, start_date=None,
end_date=None, page=None, per_page=None):
"""Searches current Triage inbox for new email reports.
page (int) - The page number for the results.
per_page (int) - The number of results rendered per page. The maximum value is 50 results per page.
start_date (str) - The start date and time of the query. The default is six days ago.
end_date (str) - The end date and time of the query. The default is the current time.
match_priority (int) - The highest match priority based on rule hits for the report.
"""
triagelog.info(u'------- Opening new session to server {0} with user {1} -------'.format(self._triagehost,
self._email))
if not isinstance(self._email, str):
raise TypeError(__name__ + u': email parameter must be a string')
if not isinstance(self._apikey, str):
raise TypeError(__name__ + u': apikey parameter must be a string')
if page and not isinstance(page, int):
raise TypeError(__name__ + u': page parameter must be an integer')
if per_page and not isinstance(per_page, int):
raise TypeError(__name__ + u': per_page parameter must be an integer')
if start_date and not isinstance(start_date, str):
raise TypeError(__name__ + u': start_date parameter must be a string')
if end_date and not isinstance(end_date, str):
raise TypeError(__name__ + u': end_date parameter must be a string')
if match_priority and not isinstance(match_priority, int):
raise TypeError(__name__ + u': match_priority parameter must be an integer')
params = {}
if page: params["page"] = page
if per_page: params["per_page"] = per_page
if start_date: params["start_date"] = start_date
if end_date: params["end_date"] = end_date
if match_priority: params["match_priority"] = match_priority
url = 'http{0}://{1}/api/public/v1/inbox_reports'.format(('s' if self._usessl else ''),
self._triagehost)
headers = self._headers.copy()
headers.update({'Content-Type': 'application/json'})
triagelog.debug(u'url = "{0}", headers = "{1}", params = "{2}"'.format(url, headers, params))
req = Request('GET', url, headers=headers, params=params)
prep = req.prepare()
resp = self._reqsend(prep, self._triagehost)
return self._parse(resp.text)
def attachment(self, attachment_id, mime_type):
"""Downloads attachment from a phishing email based on attachment ID.
attachment_id (int) - The numeric ID associated with the attachment.
mime_type (str) - mime type of the attachment.
"""
triagelog.info(u'------- Opening new session to server {0} with user {1} -------'.format(self._triagehost,
self._email))
if not isinstance(self._email, str):
raise TypeError(__name__ + u': email parameter must be a string')
if not isinstance(self._apikey, str):
raise TypeError(__name__ + u': apikey parameter must be a string')
if not isinstance(mime_type, str):
raise TypeError(__name__ + u': mime_type parameter must be a string')
if not isinstance(attachment_id, int):
raise TypeError(__name__ + u': attachment_id parameter must be an integer')
url = 'http{0}://{1}/api/public/v1/attachment/{2}'.format(('s' if self._usessl else ''),
self._triagehost,
str(attachment_id))
headers = self._headers.copy()
headers.update({'Content-Type': mime_type})
triagelog.debug(u'url = "{0}", headers = "{1}"'.format(url, headers))
req = Request('GET', url, headers=headers)
prep = req.prepare()
resp = self._reqsend(prep, self._triagehost)
return resp.content
def integration_search(self, sha256=None, md5=None, searchurl=None):
"""Fetches integration results based on hash (MD5/SHA256) or URL.
md5 (str) - md5 hash of the file being searched.
url (str) - url being searched. DO NOT SUBMIT IF PII IN THE URL!!!
sha256 (str) - sha256 hash of the file being searched.
"""
params = {}
if md5: params["md5"] = md5
if sha256: params["sha256"] = sha256
if searchurl: params["searchurl"] = searchurl
triagelog.info(u'------- User {0} searching integrations for {1} -------'.format(self._email,
params))
if not isinstance(self._email, str):
raise TypeError(__name__ + u': email parameter must be a string')
if not isinstance(self._apikey, str):
raise TypeError(__name__ + u': apikey parameter must be a string')
if md5 and not isinstance(md5, str):
raise TypeError(__name__ + u': md5 parameter must be a string')
if searchurl and not isinstance(searchurl, str):
raise TypeError(__name__ + u': searchurl parameter must be a string')
if md5 and not isinstance(md5, str):
raise TypeError(__name__ + u': sha256 parameter must be a string')
if not params:
raise ValueError(__name__ + u'Triage.integration_search requires exactly 1 argument. You gave none.')
url = 'http{0}://{1}/api/public/v1/integration_search'.format(('s' if self._usessl else ''),
self._triagehost)
headers = self._headers.copy()
headers.update({'Content-Type': 'application/json'})
triagelog.debug(u'url = "{0}", headers = "{1}", params = "{2}"'.format(url, headers, params))
req = Request('GET', url, headers=headers, params=params)
prep = req.prepare()
resp = self._reqsend(prep, self._triagehost)
return self._parse(resp.text)
def clusters(self, match_priority=None, start_date=None,
end_date=None, page=None, per_page=None, tags=None):
"""Searches current Triage inbox for unique report clusters.
tags (list) - One or more tags of processed reports to filter on.
page (int) - The page number for the results.
per_page (integer) - The number of results rendered per page. The maximum value is 50 results per page.
start_date (str) - The start date and time of the query. The default is six days ago.
end_date (str) - The end date and time of the query. The default is the current time.
match_priority (int) - The highest match priority based on rule hits for the report.
"""
triagelog.info(u'------- Opening new session to server {0} with user {1} -------'.format(self._triagehost,
self._email))
if not isinstance(self._email, str):
raise TypeError(__name__ + u': email parameter must be a string')
if not isinstance(self._apikey, str):
raise TypeError(__name__ + u': apikey parameter must be a string')
if tags and not isinstance(tags, str):
raise TypeError(__name__ + u': tags parameter must be a string')
if page and not isinstance(page, int):
raise TypeError(__name__ + u': page parameter must be an integer')
if per_page and not isinstance(per_page, int):
raise TypeError(__name__ + u': per_page parameter must be an integer')
if start_date and not isinstance(start_date, str):
raise TypeError(__name__ + u': start_date parameter must be a string')
if end_date and not isinstance(end_date, str):
raise TypeError(__name__ + u': end_date parameter must be a string')
if match_priority and not isinstance(match_priority, int):
raise TypeError(__name__ + u': match_priority parameter must be an integer')
params = {}
if tags: params["tags"] = tags
if page: params["page"] = page
if per_page: params["per_page"] = per_page
if start_date: params["start_date"] = start_date
if end_date: params["end_date"] = end_date
if match_priority: params["match_priority"] = match_priority
url = 'http{0}://{1}/api/public/v1/clusters'.format(('s' if self._usessl else ''),
self._triagehost)
headers = self._headers.copy()
headers.update({'Content-Type': 'application/json'})
triagelog.debug(u'url = "{0}", headers = "{1}", params = "{2}"'.format(url, headers, params))
req = Request('GET', url, headers=headers, params=params)
prep = req.prepare()
resp = self._reqsend(prep, self._triagehost)
return self._parse(resp.text)
# Disable SSL security warning
try:
requests.packages.urllib3.disable_warnings()
except AttributeError:
pass
# Define logger
triagelog = logging.getLogger(__name__)
| 47.354545 | 114 | 0.598243 | 2,593 | 20,836 | 4.632858 | 0.107212 | 0.020395 | 0.067427 | 0.071173 | 0.735703 | 0.720469 | 0.700991 | 0.684925 | 0.673021 | 0.658453 | 0 | 0.009877 | 0.300298 | 20,836 | 439 | 115 | 47.462415 | 0.814116 | 0.18828 | 0 | 0.625926 | 0 | 0 | 0.217153 | 0.020499 | 0 | 0 | 0 | 0 | 0 | 1 | 0.033333 | false | 0.022222 | 0.014815 | 0 | 0.111111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6fe3915b35e615306ae129b0c289b0363f9ac7aa | 99 | py | Python | stack/items.py | manojpandey/crawl-so | c3f68a085b73c06813341acfaac1147e2ce8185a | [
"MIT"
] | 2 | 2015-07-01T06:04:07.000Z | 2021-09-03T01:00:31.000Z | stack/items.py | manojpandey/crawl-so | c3f68a085b73c06813341acfaac1147e2ce8185a | [
"MIT"
] | 1 | 2015-06-28T05:02:22.000Z | 2015-06-28T05:02:22.000Z | stack/items.py | manojpandey/crawl-so | c3f68a085b73c06813341acfaac1147e2ce8185a | [
"MIT"
] | null | null | null | from scrapy.item import Item, Field
class StackItem(Item):
title = Field()
url = Field()
| 14.142857 | 35 | 0.656566 | 13 | 99 | 5 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.232323 | 99 | 6 | 36 | 16.5 | 0.855263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
6fe896bf6b8212604557b2dabe8318c428f8f05f | 1,402 | py | Python | sqlflow/rows.py | lhw362950217/pysqlflow | 7617b0f776d0d3bb96b05e54abae2de94a2eea4a | [
"Apache-2.0"
] | 29 | 2019-04-18T02:37:31.000Z | 2021-07-15T14:32:05.000Z | sqlflow/rows.py | lhw362950217/pysqlflow | 7617b0f776d0d3bb96b05e54abae2de94a2eea4a | [
"Apache-2.0"
] | 27 | 2019-04-17T05:29:43.000Z | 2020-07-01T11:26:22.000Z | sqlflow/rows.py | lhw362950217/pysqlflow | 7617b0f776d0d3bb96b05e54abae2de94a2eea4a | [
"Apache-2.0"
] | 15 | 2019-04-20T00:35:27.000Z | 2021-08-15T13:48:36.000Z | class Rows:
def __init__(self, column_names, rows_gen):
"""Query result of sqlflow.client.Client.execute
:param column_names: column names
:type column_names: list[str].
:param rows_gen: rows generator
:type rows_gen: generator
"""
self._column_names = column_names
self._rows_gen = rows_gen
self._rows = None
def column_names(self):
"""Column names
:return: list[str]
"""
return self._column_names
def rows(self):
"""Rows
Example:
>>> [r for r in rows.rows()]
:return: list generator
"""
if self._rows is None:
self._rows = []
for row in self._rows_gen():
self._rows.append(row)
yield row
else:
for row in self._rows:
yield row
def __str__(self):
return self.__repr__()
def __repr__(self):
return self.to_dataframe().__repr__()
def _repr_html_(self):
return self.to_dataframe()._repr_html_()
def to_dataframe(self):
"""Convert Rows to pandas.Dataframe
:return: pandas.Dataframe
"""
# Fetch all the rows to self._rows
for r in self.rows():
pass
import pandas as pd
return pd.DataFrame(self._rows, columns=self._column_names)
| 23.762712 | 67 | 0.552068 | 164 | 1,402 | 4.384146 | 0.27439 | 0.122392 | 0.104312 | 0.061196 | 0.125174 | 0.080668 | 0 | 0 | 0 | 0 | 0 | 0 | 0.353067 | 1,402 | 58 | 68 | 24.172414 | 0.792723 | 0.261056 | 0 | 0.074074 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.259259 | false | 0.037037 | 0.037037 | 0.111111 | 0.518519 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
6ff074f1694ca85f5c5eae0b457fa560bc1834c3 | 146 | py | Python | youtube.py | TechDudie/Portal | b89779fdbc1aeb5a260a60b770ab4b3c381c96f6 | [
"MIT"
] | 1 | 2021-04-17T03:22:42.000Z | 2021-04-17T03:22:42.000Z | youtube.py | TechDudie/Portal | b89779fdbc1aeb5a260a60b770ab4b3c381c96f6 | [
"MIT"
] | null | null | null | youtube.py | TechDudie/Portal | b89779fdbc1aeb5a260a60b770ab4b3c381c96f6 | [
"MIT"
] | null | null | null | import requests
import re
html = requests.get("https://www.wolframalpha.com/input/?i=HelloWorld").content
print(html.decode().split("</head>")[1]) | 36.5 | 79 | 0.739726 | 21 | 146 | 5.142857 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007194 | 0.047945 | 146 | 4 | 80 | 36.5 | 0.769784 | 0 | 0 | 0 | 0 | 0 | 0.37415 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
6ff5e59a28e6ee757f67a08ac2d4e59fd8a05d8c | 457 | py | Python | output/models/nist_data/atomic/non_negative_integer/schema_instance/nistschema_sv_iv_atomic_non_negative_integer_enumeration_4_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/nist_data/atomic/non_negative_integer/schema_instance/nistschema_sv_iv_atomic_non_negative_integer_enumeration_4_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/nist_data/atomic/non_negative_integer/schema_instance/nistschema_sv_iv_atomic_non_negative_integer_enumeration_4_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.nist_data.atomic.non_negative_integer.schema_instance.nistschema_sv_iv_atomic_non_negative_integer_enumeration_4_xsd.nistschema_sv_iv_atomic_non_negative_integer_enumeration_4 import (
NistschemaSvIvAtomicNonNegativeIntegerEnumeration4,
NistschemaSvIvAtomicNonNegativeIntegerEnumeration4Type,
)
__all__ = [
"NistschemaSvIvAtomicNonNegativeIntegerEnumeration4",
"NistschemaSvIvAtomicNonNegativeIntegerEnumeration4Type",
]
| 45.7 | 203 | 0.890591 | 36 | 457 | 10.611111 | 0.583333 | 0.070681 | 0.133508 | 0.188482 | 0.26178 | 0.26178 | 0.26178 | 0.26178 | 0.26178 | 0 | 0 | 0.014052 | 0.065646 | 457 | 9 | 204 | 50.777778 | 0.880562 | 0 | 0 | 0 | 0 | 0 | 0.227571 | 0.227571 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0 | 0 | 0 | 1 | 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 | 3 |
b516380461c6d7c47c83a3238f506135ee4dc7a7 | 1,023 | py | Python | server/logline_server/util.py | messa/logline | eb1ba824784c09ea691cb7e25400ccf105c7c006 | [
"MIT"
] | 1 | 2021-02-24T01:04:57.000Z | 2021-02-24T01:04:57.000Z | server/logline_server/util.py | messa/logline | eb1ba824784c09ea691cb7e25400ccf105c7c006 | [
"MIT"
] | 3 | 2021-02-24T01:04:46.000Z | 2021-02-27T14:59:38.000Z | server/logline_server/util.py | messa/logline | eb1ba824784c09ea691cb7e25400ccf105c7c006 | [
"MIT"
] | null | null | null | import asyncio
from functools import partial
try:
from asyncio import to_thread
except ImportError:
# asyncio.to_thread is available only in Python 3.9+
# so for older Python version here is our polyfill:
async def to_thread(func, *args, **kwargs):
loop = asyncio.get_running_loop()
return await loop.run_in_executor(None, partial(func, *args, **kwargs))
async def decompress_zst(compressed_data):
assert isinstance(compressed_data, bytes)
try:
# https://python-zstandard.readthedocs.io/
import zstandard
return await to_thread(zstandard.decompress, compressed_data)
except ImportError:
pass
try:
# https://github.com/sergey-dryabzhinsky/python-zstd
# https://packages.debian.org/bullseye/python3-zstd
import zstd
return await to_thread(zstd.decompress, compressed_data)
except ImportError:
pass
raise Exception('Zstandard decompression is not available - please install zstandard or zstd')
| 33 | 98 | 0.705767 | 126 | 1,023 | 5.619048 | 0.52381 | 0.056497 | 0.039548 | 0.053672 | 0.127119 | 0.127119 | 0 | 0 | 0 | 0 | 0 | 0.003741 | 0.216031 | 1,023 | 30 | 99 | 34.1 | 0.879052 | 0.236559 | 0 | 0.380952 | 0 | 0 | 0.096774 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 1 | 0 | false | 0.095238 | 0.380952 | 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 | 1 | 0 | 1 | 0 | 0 | 3 |
b5163e7a2eb190c69555f3bff1310ed580a6752a | 319 | py | Python | properties/config.py | utkarsh-tiwari/blockchain | e1f4b3fc252a65b64228376f201ac69d317f1ee1 | [
"Unlicense"
] | null | null | null | properties/config.py | utkarsh-tiwari/blockchain | e1f4b3fc252a65b64228376f201ac69d317f1ee1 | [
"Unlicense"
] | null | null | null | properties/config.py | utkarsh-tiwari/blockchain | e1f4b3fc252a65b64228376f201ac69d317f1ee1 | [
"Unlicense"
] | null | null | null | import os
process_folder_name = 'blockchain'
properties_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)))
processing_folder = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), process_folder_name, 'processing')
log_config = os.path.join(properties_folder, 'logging_config.yml')
| 45.571429 | 128 | 0.799373 | 47 | 319 | 5.06383 | 0.361702 | 0.201681 | 0.12605 | 0.189076 | 0.441176 | 0.441176 | 0.441176 | 0.294118 | 0.294118 | 0 | 0 | 0 | 0.056426 | 319 | 6 | 129 | 53.166667 | 0.790698 | 0 | 0 | 0 | 0 | 0 | 0.119122 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 1 | 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 | 3 |
82f94abd64779f6efb7a815bf6189562f8264466 | 152 | py | Python | src/genie/libs/parser/iosxe/tests/ShowCefPathSetIdDetailReplicateOce/cli/equal/golden_output_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | null | null | null | src/genie/libs/parser/iosxe/tests/ShowCefPathSetIdDetailReplicateOce/cli/equal/golden_output_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | null | null | null | src/genie/libs/parser/iosxe/tests/ShowCefPathSetIdDetailReplicateOce/cli/equal/golden_output_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | null | null | null | expected_output={
"replicate_oce": {
"0x7F9E40C590C8": {
"uid": 6889
},
"0x7F9E40C59340": {
"uid": 6888
}
}
}
| 13.818182 | 24 | 0.460526 | 10 | 152 | 6.8 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.284211 | 0.375 | 152 | 10 | 25 | 15.2 | 0.431579 | 0 | 0 | 0 | 0 | 0 | 0.330986 | 0 | 0 | 0 | 0.197183 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 3 |
82ff129d5d8ebf806d749138377bf8d9be5bf91b | 129 | py | Python | fileio.py | mhwdvs/MITSBot | a0b3899b24df61976b0a6c98c61a75b9e8fa32a0 | [
"MIT"
] | null | null | null | fileio.py | mhwdvs/MITSBot | a0b3899b24df61976b0a6c98c61a75b9e8fa32a0 | [
"MIT"
] | null | null | null | fileio.py | mhwdvs/MITSBot | a0b3899b24df61976b0a6c98c61a75b9e8fa32a0 | [
"MIT"
] | null | null | null | # Return lines from a file
def getFileLines(file):
f = open(file, "r")
lines = f.readlines()
f.close
return lines | 21.5 | 26 | 0.627907 | 19 | 129 | 4.263158 | 0.631579 | 0.271605 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.255814 | 129 | 6 | 27 | 21.5 | 0.84375 | 0.186047 | 0 | 0 | 0 | 0 | 0.009615 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d20f8ea241ce4397cbea76d6820ec381c9a274b1 | 171 | py | Python | P2/P2_2_UDP_Server.py | Newport1990/Black_Hat_Python | 33b93314167bdfef7869cf0a00fb2e8b62b3dd67 | [
"Apache-2.0"
] | null | null | null | P2/P2_2_UDP_Server.py | Newport1990/Black_Hat_Python | 33b93314167bdfef7869cf0a00fb2e8b62b3dd67 | [
"Apache-2.0"
] | null | null | null | P2/P2_2_UDP_Server.py | Newport1990/Black_Hat_Python | 33b93314167bdfef7869cf0a00fb2e8b62b3dd67 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
# @Time : 2020/9/30 11:22
# @Author : Newport
# @Site :
# @File : P2_2_UDP_Server.py
# @Software: PyCharm
import socket
target | 15.545455 | 28 | 0.631579 | 26 | 171 | 4.038462 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.099291 | 0.175439 | 171 | 11 | 29 | 15.545455 | 0.64539 | 0.789474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d20f9a92399e1fa7ef40e6478771a4c6b48be3de | 219 | py | Python | tests/wasp1/AllAnswerSets/choice_41.test.py | bernardocuteri/wasp | 05c8f961776dbdbf7afbf905ee00fc262eba51ad | [
"Apache-2.0"
] | 19 | 2015-12-03T08:53:45.000Z | 2022-03-31T02:09:43.000Z | tests/wasp1/AllAnswerSets/choice_41.test.py | bernardocuteri/wasp | 05c8f961776dbdbf7afbf905ee00fc262eba51ad | [
"Apache-2.0"
] | 80 | 2017-11-25T07:57:32.000Z | 2018-06-10T19:03:30.000Z | tests/wasp1/AllAnswerSets/choice_41.test.py | bernardocuteri/wasp | 05c8f961776dbdbf7afbf905ee00fc262eba51ad | [
"Apache-2.0"
] | 6 | 2015-01-15T07:51:48.000Z | 2020-06-18T14:47:48.000Z | input = """
a1:- not b1.
b1:- not a1.
a2:- not b2.
b2:- not a2.
a3:- not b3.
b3:- not a3.
"""
output = """
{a1, a2, a3}
{a1, a2, b3}
{a1, a3, b2}
{a1, b2, b3}
{a2, a3, b1}
{a2, b1, b3}
{a3, b1, b2}
{b1, b2, b3}
"""
| 9.521739 | 12 | 0.461187 | 44 | 219 | 2.295455 | 0.204545 | 0.118812 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.218182 | 0.246575 | 219 | 22 | 13 | 9.954545 | 0.393939 | 0 | 0 | 0.111111 | 0 | 0 | 0.853881 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d21046dd6ac8c90e53ac79fef62b3d35dc3e5b83 | 285 | py | Python | a2ml/cmdl/commands/cmd_review.py | gitter-badger/a2ml | 1d9ef6657645b61c64090284ed8fadb1a68b932c | [
"Apache-2.0"
] | 2 | 2020-04-09T16:59:22.000Z | 2020-04-09T17:01:10.000Z | a2ml/cmdl/commands/cmd_review.py | arita37/a2ml | 3e92bede2c2ef6e63be74560cc6b904d3ec9d931 | [
"Apache-2.0"
] | null | null | null | a2ml/cmdl/commands/cmd_review.py | arita37/a2ml | 3e92bede2c2ef6e63be74560cc6b904d3ec9d931 | [
"Apache-2.0"
] | null | null | null | import click
from a2ml.api.a2ml import A2ML
from a2ml.api.utils.context import pass_context
@click.command('review', short_help='Review specified model info.')
@pass_context
def cmdl(ctx):
"""Review specified model info."""
ctx.setup_logger(format='')
A2ML(ctx).review()
| 23.75 | 67 | 0.733333 | 41 | 285 | 5 | 0.512195 | 0.078049 | 0.107317 | 0.234146 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020243 | 0.133333 | 285 | 11 | 68 | 25.909091 | 0.809717 | 0.098246 | 0 | 0 | 0 | 0 | 0.135458 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0.25 | 0.375 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
d2203cff5306179b27371494e83facf865c551b7 | 633 | py | Python | pakaman/lang/__init__.py | mikonse/pakaman | 4b6ac2ec550bfd642d34dce1fc406f2bd230e8de | [
"MIT"
] | 1 | 2020-10-18T17:57:30.000Z | 2020-10-18T17:57:30.000Z | pakaman/lang/__init__.py | mikonse/pakaman | 4b6ac2ec550bfd642d34dce1fc406f2bd230e8de | [
"MIT"
] | null | null | null | pakaman/lang/__init__.py | mikonse/pakaman | 4b6ac2ec550bfd642d34dce1fc406f2bd230e8de | [
"MIT"
] | null | null | null | from abc import ABCMeta, abstractmethod
from pathlib import Path
from typing import Optional, Callable
LANGUAGES = {}
class LanguageMeta(ABCMeta):
def __init__(cls, name, bases, classdict):
super().__init__(name, bases, classdict)
LANGUAGES[cls.lang] = cls
class LanguageBuilder(metaclass=LanguageMeta):
lang = "unknown"
def __init__(self, input_dir: Path):
self.input_dir = input_dir
@abstractmethod
def build(self, output_dir: Path):
pass
def get_lang(language: str) -> Optional[Callable]:
return LANGUAGES.get(language)
# fill LANGUAGES dict
from . import python
| 20.419355 | 50 | 0.703002 | 75 | 633 | 5.706667 | 0.493333 | 0.056075 | 0.084112 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.205371 | 633 | 30 | 51 | 21.1 | 0.850895 | 0.030016 | 0 | 0 | 0 | 0 | 0.011438 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0.055556 | 0.222222 | 0.055556 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
d2298c8e77bae56fd5b1aa57f838e597e5407c0a | 955 | py | Python | website/Contact/migrations/0006_auto_20200202_2046.py | bubai666sen/Visitor-Manager | 9ecfa087f332d368e2a52dd812c272d30c3a55df | [
"MIT"
] | null | null | null | website/Contact/migrations/0006_auto_20200202_2046.py | bubai666sen/Visitor-Manager | 9ecfa087f332d368e2a52dd812c272d30c3a55df | [
"MIT"
] | null | null | null | website/Contact/migrations/0006_auto_20200202_2046.py | bubai666sen/Visitor-Manager | 9ecfa087f332d368e2a52dd812c272d30c3a55df | [
"MIT"
] | 1 | 2020-09-14T14:37:02.000Z | 2020-09-14T14:37:02.000Z | # Generated by Django 2.2 on 2020-02-02 15:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Contact', '0005_auto_20200202_2040'),
]
operations = [
migrations.AlterField(
model_name='sitecontact',
name='email',
field=models.EmailField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='sitecontact',
name='long_address',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='sitecontact',
name='phone',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='sitecontact',
name='short_address',
field=models.CharField(blank=True, max_length=255, null=True),
),
]
| 28.088235 | 75 | 0.581152 | 95 | 955 | 5.715789 | 0.442105 | 0.14733 | 0.184162 | 0.213628 | 0.572744 | 0.572744 | 0.491713 | 0.491713 | 0.395948 | 0.395948 | 0 | 0.058559 | 0.302618 | 955 | 33 | 76 | 28.939394 | 0.756757 | 0.045026 | 0 | 0.518519 | 1 | 0 | 0.11978 | 0.025275 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.037037 | 0 | 0.148148 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
d23ba13ad2bd078385e262a6412cdbb359c9127e | 277 | py | Python | params/speed/generate_wb_speed.py | NREL/human-metrics-explore | 205d0f18e3630c72bc6b826efbb4984e1738e1e0 | [
"BSD-3-Clause"
] | null | null | null | params/speed/generate_wb_speed.py | NREL/human-metrics-explore | 205d0f18e3630c72bc6b826efbb4984e1738e1e0 | [
"BSD-3-Clause"
] | 1 | 2022-01-12T21:19:12.000Z | 2022-01-12T23:50:53.000Z | params/speed/generate_wb_speed.py | NREL/human-metrics-explore | 205d0f18e3630c72bc6b826efbb4984e1738e1e0 | [
"BSD-3-Clause"
] | null | null | null | import pandas as pd
import scipy.stats
import random
def generate_wb_speed(n):
wb_speed_list = []
for i in range(0,n):
speed_temp = random.uniform(5,20)
wb_speed_list.append(speed_temp)
#print(randomlist)
return(wb_speed_list)
| 21.307692 | 41 | 0.649819 | 41 | 277 | 4.146341 | 0.634146 | 0.164706 | 0.194118 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019608 | 0.263538 | 277 | 13 | 42 | 21.307692 | 0.813725 | 0.061372 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.444444 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d2409dbfd5929ce883a5d104515d6acd2da990ff | 539 | py | Python | js_services/migrations/0012_auto_20190430_0804.py | evgeny-dmi3ev/js-services | 8d4960ec49a44b0eda537713af9f4976456e0f5e | [
"BSD-3-Clause"
] | null | null | null | js_services/migrations/0012_auto_20190430_0804.py | evgeny-dmi3ev/js-services | 8d4960ec49a44b0eda537713af9f4976456e0f5e | [
"BSD-3-Clause"
] | null | null | null | js_services/migrations/0012_auto_20190430_0804.py | evgeny-dmi3ev/js-services | 8d4960ec49a44b0eda537713af9f4976456e0f5e | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-30 08:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('js_services', '0011_auto_20190429_1705'),
]
operations = [
#migrations.RemoveField(
#model_name='relatedservicesplugin',
#name='related_companies',
#),
#migrations.RemoveField(
#model_name='service',
#name='companies',
#),
]
| 22.458333 | 51 | 0.599258 | 52 | 539 | 5.980769 | 0.730769 | 0.135048 | 0.167203 | 0.192926 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087404 | 0.278293 | 539 | 23 | 52 | 23.434783 | 0.712082 | 0.402597 | 0 | 0 | 1 | 0 | 0.109325 | 0.073955 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.625 | 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 | 1 | 0 | 0 | 3 |
d241c05fedadf1acd6cf538416ac6f3bbf5dd345 | 112 | py | Python | test/test_linear_algebra.py | RaylaKurosaki1503/Raylas_Modules | 078281e17130d09ea1fadde0b96539046b60d4a8 | [
"MIT"
] | 1 | 2022-02-15T05:31:37.000Z | 2022-02-15T05:31:37.000Z | test/test_linear_algebra.py | RaylaKurosaki1503/Raylas_Modules | 078281e17130d09ea1fadde0b96539046b60d4a8 | [
"MIT"
] | null | null | null | test/test_linear_algebra.py | RaylaKurosaki1503/Raylas_Modules | 078281e17130d09ea1fadde0b96539046b60d4a8 | [
"MIT"
] | null | null | null | """
Author: Rayla Kurosaki
File: test_linear_algebra.py
Description:
"""
if __name__ == '__main__':
pass
| 10.181818 | 28 | 0.6875 | 13 | 112 | 5.153846 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 112 | 10 | 29 | 11.2 | 0.728261 | 0.589286 | 0 | 0 | 0 | 0 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
d244bc2f6d3fb9c7c4b324a788c011fe998a3244 | 146 | py | Python | predavanje6/operatoriListe.py | Miillky/uvod_u_programiranje | 209611e38c8fe84c727649df4b868a4278eb77c3 | [
"MIT"
] | null | null | null | predavanje6/operatoriListe.py | Miillky/uvod_u_programiranje | 209611e38c8fe84c727649df4b868a4278eb77c3 | [
"MIT"
] | null | null | null | predavanje6/operatoriListe.py | Miillky/uvod_u_programiranje | 209611e38c8fe84c727649df4b868a4278eb77c3 | [
"MIT"
] | null | null | null | a = [1,2,3]
b = [4,5,6]
print(a+b)
print(a)
print(a*2)
print(a*3)
print(b*2)
print(b*3)
print(1 in a)
print(2 in a)
print(3 in a)
print(4 in a) | 9.733333 | 13 | 0.582192 | 41 | 146 | 2.073171 | 0.243902 | 0.282353 | 0.282353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116667 | 0.178082 | 146 | 15 | 14 | 9.733333 | 0.591667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.833333 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
d247b6d6ab14bcffb1c99e71b2fdd9baff424970 | 414 | py | Python | tests/interpreter/__init__.py | ChandlerSwift/little-python | e36b45fd3f92238c02c73c025ed0f424d599123d | [
"MIT"
] | 2 | 2016-10-15T15:48:03.000Z | 2016-10-19T15:41:24.000Z | tests/interpreter/__init__.py | ChandlerSwift/little-python | e36b45fd3f92238c02c73c025ed0f424d599123d | [
"MIT"
] | 12 | 2016-10-12T13:51:53.000Z | 2017-10-21T23:12:39.000Z | tests/interpreter/__init__.py | ChandlerSwift/little-python | e36b45fd3f92238c02c73c025ed0f424d599123d | [
"MIT"
] | 1 | 2020-11-05T17:21:40.000Z | 2020-11-05T17:21:40.000Z | from littlepython import Compiler, Features
def compile(code, features=Features.ALL):
compiler = Compiler()
return compiler.compile(code, features=features)
def run(code, max_op_count=-1, **kargs):
if len(kargs) == 1 and "in_state" in kargs:
return compile(code).run(kargs["in_state"], max_op_count=max_op_count)
else:
return compile(code).run(kargs, max_op_count=max_op_count)
| 29.571429 | 78 | 0.71256 | 61 | 414 | 4.639344 | 0.360656 | 0.088339 | 0.176678 | 0.190813 | 0.318021 | 0.141343 | 0 | 0 | 0 | 0 | 0 | 0.005797 | 0.166667 | 414 | 13 | 79 | 31.846154 | 0.814493 | 0 | 0 | 0 | 0 | 0 | 0.038647 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d248a8fb58a57577819454578913f899284ce4e3 | 116 | py | Python | rial/ir/modifier/VariableMutabilityModifier.py | L3tum/RIAL | fba25f37434ff51e0de8e22ce834af589aba24e8 | [
"BSD-3-Clause"
] | 2 | 2020-06-02T20:00:28.000Z | 2020-06-06T02:15:49.000Z | rial/ir/modifier/VariableMutabilityModifier.py | L3tum/RIAL | fba25f37434ff51e0de8e22ce834af589aba24e8 | [
"BSD-3-Clause"
] | 51 | 2020-04-13T13:27:10.000Z | 2020-06-12T11:38:36.000Z | rial/ir/modifier/VariableMutabilityModifier.py | L3tum/RIAL | fba25f37434ff51e0de8e22ce834af589aba24e8 | [
"BSD-3-Clause"
] | 2 | 2020-06-24T14:44:01.000Z | 2020-11-29T04:08:54.000Z | from enum import Enum
class VariableMutabilityModifier(Enum):
CONST = "const"
MUT = "mut"
REF = "ref"
| 14.5 | 39 | 0.646552 | 13 | 116 | 5.769231 | 0.615385 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 116 | 7 | 40 | 16.571429 | 0.862069 | 0 | 0 | 0 | 0 | 0 | 0.094828 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
d2680ff326c79d68381400ec15c72d63374f4ec0 | 207 | py | Python | app/ports/api.py | jmp/fast1 | 2fb0283168d93b258da15e12af530c50de2dba75 | [
"MIT"
] | 1 | 2021-11-23T13:27:21.000Z | 2021-11-23T13:27:21.000Z | app/ports/api.py | jmp/fast1 | 2fb0283168d93b258da15e12af530c50de2dba75 | [
"MIT"
] | null | null | null | app/ports/api.py | jmp/fast1 | 2fb0283168d93b258da15e12af530c50de2dba75 | [
"MIT"
] | null | null | null | from typing import Optional, Protocol
from app.domain.circuit import Circuit
class GetCircuitUseCase(Protocol):
def get_circuit(self, ref: str) -> Optional[Circuit]:
raise NotImplementedError
| 23 | 57 | 0.763285 | 24 | 207 | 6.541667 | 0.708333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164251 | 207 | 8 | 58 | 25.875 | 0.907514 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d274fa6f50d66e1efdd10219cc980d3e5b741480 | 1,964 | py | Python | dist/Platform.app/Contents/Resources/lib/python3.7/wx/lib/pubsub/core/arg1/topicargspecimpl.py | njalloul90/Genomics_Oncology_Platform | 9bf6d0edca5df783f4e371fa1bc46b7b1576fe70 | [
"MIT"
] | 6 | 2021-07-26T14:21:25.000Z | 2021-07-26T14:32:01.000Z | dist/Platform.app/Contents/Resources/lib/python3.7/wx/lib/pubsub/core/arg1/topicargspecimpl.py | njalloul90/Genomics_Oncology_Platform | 9bf6d0edca5df783f4e371fa1bc46b7b1576fe70 | [
"MIT"
] | 9 | 2021-03-18T23:10:27.000Z | 2022-03-11T23:43:55.000Z | dist/Platform.app/Contents/Resources/lib/python3.7/wx/lib/pubsub/core/arg1/topicargspecimpl.py | njalloul90/Genomics_Oncology_Platform | 9bf6d0edca5df783f4e371fa1bc46b7b1576fe70 | [
"MIT"
] | 2 | 2019-12-02T01:39:10.000Z | 2021-02-13T22:41:00.000Z | """
:copyright: Copyright since 2006 by Oliver Schoenborn, all rights reserved.
:license: BSD, see LICENSE_BSD_Simple.txt for details.
"""
import weakref
from .topicutils import WeakNone
class SenderMissingReqdMsgDataError(RuntimeError):
"""
Ignore: Not used for this message protocol.
"""
pass
class SenderUnknownMsgDataError(RuntimeError):
"""
Ignore: Not used for this message protocol.
"""
pass
class ArgsInfo:
"""
Encode the Message Data Specification (MDS) for a given
topic. In the arg1 protocol of pubsub, this MDS is the same for all
topics, so this is quite a simple class, required only because
the part of pubsub that uses ArgsInfos supports several API
versions using one common API. So the only difference between
an ArgsInfo and an ArgSpecGiven is that ArgsInfo refers to
parent topic's ArgsInfo; other data members are the same.
Note that the MDS is always complete because it is known:
it consists of one required argument named 'data' and no
optional arguments.
"""
SPEC_MISSING = 10 # no args given
SPEC_COMPLETE = 12 # all args, but not confirmed via user spec
def __init__(self, topicNameTuple, specGiven, parentArgsInfo):
self.__argsDocs = specGiven.argsDocs or {'data':'message data'}
self.argsSpecType = self.SPEC_COMPLETE
self.allOptional = () # list of topic message optional argument names
self.allRequired = ('data',) # list of topic message required argument names
self.parentAI = WeakNone()
if parentArgsInfo is not None:
self.parentAI = weakref.ref(parentArgsInfo)
def isComplete(self):
return True
def getArgs(self):
return self.allOptional + self.allRequired
def numArgs(self):
return len(self.allOptional) + len(self.allRequired)
def getArgsDocs(self):
return self.__argsDocs.copy()
| 29.313433 | 84 | 0.687882 | 244 | 1,964 | 5.483607 | 0.495902 | 0.029895 | 0.03139 | 0.037369 | 0.083707 | 0.083707 | 0.083707 | 0.083707 | 0.083707 | 0.083707 | 0 | 0.006069 | 0.244908 | 1,964 | 66 | 85 | 29.757576 | 0.896156 | 0.473014 | 0 | 0.08 | 0 | 0 | 0.021299 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.08 | 0.08 | 0.16 | 0.64 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 |
d27ac4a919b6d060841c2aabda13312ad0a7d3b9 | 282 | py | Python | cadnano25/cadnano/fileio/encoder.py | amylittleyang/OtraCAD | 126360719704caf6850d42565fe96be53b66a22d | [
"MIT"
] | 1 | 2021-10-11T21:47:33.000Z | 2021-10-11T21:47:33.000Z | cadnano25/cadnano/fileio/encoder.py | amylittleyang/OtraCAD | 126360719704caf6850d42565fe96be53b66a22d | [
"MIT"
] | null | null | null | cadnano25/cadnano/fileio/encoder.py | amylittleyang/OtraCAD | 126360719704caf6850d42565fe96be53b66a22d | [
"MIT"
] | null | null | null | from json import dumps
from .legacyencoder import legacy_dict_from_doc
def encode(document, helix_order_list, io):
obj = legacy_dict_from_doc(document, io.name, helix_order_list)
json_string = dumps(obj, separators=(',', ':')) # compact encoding
io.write(json_string)
| 35.25 | 71 | 0.751773 | 40 | 282 | 5 | 0.55 | 0.1 | 0.14 | 0.17 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141844 | 282 | 7 | 72 | 40.285714 | 0.826446 | 0.056738 | 0 | 0 | 0 | 0 | 0.007576 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
d2803299ca349a6eba81c8c2e21f722ddea1adb3 | 191 | py | Python | harpoon/src/plugins/Config/commands/EnablePersist.py | xezzz/Harpoon | 4a0bdea10a6e961013738598726a4205a5cc4c91 | [
"MIT"
] | null | null | null | harpoon/src/plugins/Config/commands/EnablePersist.py | xezzz/Harpoon | 4a0bdea10a6e961013738598726a4205a5cc4c91 | [
"MIT"
] | null | null | null | harpoon/src/plugins/Config/commands/EnablePersist.py | xezzz/Harpoon | 4a0bdea10a6e961013738598726a4205a5cc4c91 | [
"MIT"
] | null | null | null |
async def run(plugin, ctx):
plugin.db.configs.update(ctx.guild.id, "persist", True)
await ctx.send(plugin.t(ctx.guild, "enabled_module_no_channel", _emote="YES", module="Persist")) | 31.833333 | 100 | 0.712042 | 29 | 191 | 4.551724 | 0.724138 | 0.121212 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115183 | 191 | 6 | 100 | 31.833333 | 0.781065 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 0.132275 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
9630a70105d9ed6a6f7f207cd826e80124c112cc | 611 | py | Python | api/serializers.py | njenga5/django-mediastore-site | 579fe162f32520ca95917e95fa4c841e1bbe0ab1 | [
"MIT"
] | 1 | 2020-12-19T20:49:04.000Z | 2020-12-19T20:49:04.000Z | api/serializers.py | njenga5/django-mediastore-site | 579fe162f32520ca95917e95fa4c841e1bbe0ab1 | [
"MIT"
] | null | null | null | api/serializers.py | njenga5/django-mediastore-site | 579fe162f32520ca95917e95fa4c841e1bbe0ab1 | [
"MIT"
] | null | null | null | from rest_framework import serializers
from commonops.models import CustomUser as User
from dashboard import models
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = '__all__'
class PhotoSerializer(serializers.ModelSerializer):
class Meta:
model = models.Photo
fields = '__all__'
class VideoSerializer(serializers.ModelSerializer):
class Meta:
model = models.Video
fields = '__all__'
class MusicSerializer(serializers.ModelSerializer):
class Meta:
model = models.Music
fields = '__all__'
| 21.821429 | 51 | 0.702128 | 59 | 611 | 6.983051 | 0.40678 | 0.252427 | 0.300971 | 0.339806 | 0.432039 | 0.334951 | 0 | 0 | 0 | 0 | 0 | 0 | 0.232406 | 611 | 27 | 52 | 22.62963 | 0.878465 | 0 | 0 | 0.421053 | 0 | 0 | 0.045827 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.157895 | 0 | 0.578947 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
964daf346dfa7dbbd9b59c8909a66f21fb369c1a | 430 | py | Python | Assignments/HW3/fancy_tester.py | chenchuw/EC602-Design-by-Software | c233c9d08a67abc47235282fedd866d67ccaf4ce | [
"MIT"
] | 3 | 2018-11-14T16:07:31.000Z | 2018-11-15T16:44:51.000Z | assignment4/fancy_tester.py | guozhonghao1994/BU_EC602_Assignment | e8f6b61e5cdad64e9fe943fc4f61d1fc9ad85f74 | [
"Unlicense"
] | null | null | null | assignment4/fancy_tester.py | guozhonghao1994/BU_EC602_Assignment | e8f6b61e5cdad64e9fe943fc4f61d1fc9ad85f74 | [
"Unlicense"
] | 1 | 2022-01-11T20:23:47.000Z | 2022-01-11T20:23:47.000Z | from model_complex import Complex
def test_complex_type_class(f):
"try out features of complex classes."
c = f(3,4)
d = 4 + 3j
e = 2 + 5j
print("c d e",c,d,e)
print("imag c",c.imag)
print("real c",c.real)
print("c*d",c*d)
print("abs(c)",abs(c))
print("c+d",c+d)
print("c*e*d",c*e*d)
if __name__ == '__main__':
test_complex_type_class(complex)
test_complex_type_class(Complex) | 22.631579 | 42 | 0.604651 | 79 | 430 | 3.063291 | 0.367089 | 0.049587 | 0.18595 | 0.247934 | 0.338843 | 0.115702 | 0 | 0 | 0 | 0 | 0 | 0.017964 | 0.223256 | 430 | 19 | 43 | 22.631579 | 0.706587 | 0.083721 | 0 | 0 | 0 | 0 | 0.180974 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0.0625 | 0 | 0.125 | 0.4375 | 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 | 1 | 0 | 3 |
96526ac72dd2dcda881ca5e2cf21fa3d41d1cb7f | 482 | py | Python | desktop/core/ext-py/Paste-1.7.2/tests/test_import_string.py | t3hi3x/hue | 36d71c1a8dd978b899ef2dc3eef8887b68fd99a8 | [
"Apache-2.0"
] | 19 | 2015-05-01T19:59:03.000Z | 2021-12-09T08:03:16.000Z | desktop/core/ext-py/Paste-1.7.2/tests/test_import_string.py | t3hi3x/hue | 36d71c1a8dd978b899ef2dc3eef8887b68fd99a8 | [
"Apache-2.0"
] | 1 | 2018-01-03T15:26:49.000Z | 2018-01-03T15:26:49.000Z | desktop/core/ext-py/Paste-1.7.2/tests/test_import_string.py | t3hi3x/hue | 36d71c1a8dd978b899ef2dc3eef8887b68fd99a8 | [
"Apache-2.0"
] | 30 | 2015-03-25T19:40:07.000Z | 2021-05-28T22:59:26.000Z | from paste.util.import_string import *
import sys
import os
def test_simple():
for func in eval_import, simple_import:
assert func('sys') is sys
assert func('sys.version') is sys.version
assert func('os.path.join') is os.path.join
def test_complex():
assert eval_import('sys:version') is sys.version
assert eval_import('os:getcwd()') == os.getcwd()
assert (eval_import('sys:version.split()[0]') ==
sys.version.split()[0])
| 28.352941 | 53 | 0.651452 | 70 | 482 | 4.371429 | 0.328571 | 0.196078 | 0.156863 | 0.098039 | 0.320261 | 0.183007 | 0 | 0 | 0 | 0 | 0 | 0.005249 | 0.209544 | 482 | 16 | 54 | 30.125 | 0.7979 | 0 | 0 | 0 | 0 | 0 | 0.145228 | 0.045643 | 0 | 0 | 0 | 0 | 0.461538 | 1 | 0.153846 | false | 0 | 0.538462 | 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 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
9652c6a11bcb8552ff9fbfe707491759405ce139 | 54 | py | Python | Instructions/starter_code/api_keys.py | bshub6/API-Challenge | c431ec527e4a1bdb13f3335b6ac034c7798b1751 | [
"MIT"
] | null | null | null | Instructions/starter_code/api_keys.py | bshub6/API-Challenge | c431ec527e4a1bdb13f3335b6ac034c7798b1751 | [
"MIT"
] | null | null | null | Instructions/starter_code/api_keys.py | bshub6/API-Challenge | c431ec527e4a1bdb13f3335b6ac034c7798b1751 | [
"MIT"
] | null | null | null | # OpenWeatherMap API Key
api_key = "YOUR KEY HERE!"
| 18 | 27 | 0.703704 | 8 | 54 | 4.625 | 0.625 | 0.324324 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.203704 | 54 | 2 | 28 | 27 | 0.860465 | 0.407407 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.