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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f75b44477725a64db8c67b23a49491e6c24f9e9b | 3,820 | py | Python | src/test/python/programmingtheiot/part03/integration/connection/CoapClientConnectorTest.py | kiranrameshs/IoT-ConstrainedDeviceApplication | c20a5282dae03e51a5c0e60e06f9e698839253fd | [
"MIT"
] | null | null | null | src/test/python/programmingtheiot/part03/integration/connection/CoapClientConnectorTest.py | kiranrameshs/IoT-ConstrainedDeviceApplication | c20a5282dae03e51a5c0e60e06f9e698839253fd | [
"MIT"
] | null | null | null | src/test/python/programmingtheiot/part03/integration/connection/CoapClientConnectorTest.py | kiranrameshs/IoT-ConstrainedDeviceApplication | c20a5282dae03e51a5c0e60e06f9e698839253fd | [
"MIT"
] | null | null | null | #####
#
# This class is part of the Programming the Internet of Things
# project, and is available via the MIT License, which can be
# found in the LICENSE file at the top level of this repository.
#
# Copyright (c) 2020 by Andrew D. King
#
import logging
import unittest
from time import sleep
import programmingtheiot.common.ConfigConst as ConfigConst
from programmingtheiot.common.ConfigUtil import ConfigUtil
from programmingtheiot.common.ResourceNameEnum import ResourceNameEnum
from programmingtheiot.cda.connection.CoapClientConnector import CoapClientConnector
class CoapClientConnectorTest(unittest.TestCase):
"""
This test case class contains very basic integration tests for
CoapClientConnector. It should not be considered complete,
but serve as a starting point for the student implementing
additional functionality within their Programming the IoT
environment.
"""
@classmethod
def setUpClass(self):
logging.basicConfig(format = '%(asctime)s:%(module)s:%(levelname)s:%(message)s', level = logging.DEBUG)
logging.info("Testing CoapClientConnector class...")
self.cfg = ConfigUtil()
print("Calling CoapClientConnector")
self.coapClient = CoapClientConnector()
def setUp(self):
pass
def tearDown(self):
#TODO
#clear all the resources setup for the test case
pass
#@unittest.skip("Ignore for now.")
def testConnectAndGet(self):
# TODO: implement this
pass
#@unittest.skip("Ignore for now.")
def testConnectAndDelete(self):
# TODO: implement this
pass
#@unittest.skip("Ignore for now.")
def testConnectAndPost(self):
# TODO: implement this
pass
#@unittest.skip("Ignore for now.")
def testConnectAndPut(self):
# TODO: implement this
pass
#@unittest.skip("Ignore for now.")
def testIntegrateWithGdaGetCdaCmdTopic(self):
# TODO: implement this
pass
#@unittest.skip("Ignore for now.")
def testIntegrateWithGdaPostCdaMgmtTopic(self):
# TODO: implement this
pass
#@unittest.skip("Ignore for now.")
def testConnectAndGetCon(self):
self.coapClient.sendGetRequest(resource = ResourceNameEnum.CDA_MGMT_STATUS_MSG_RESOURCE, enableCON = True, timeout = 5)
#@unittest.skip("Ignore for now.")
def testConnectAndGetNon(self):
self.coapClient.sendGetRequest(resource = ResourceNameEnum.CDA_MGMT_STATUS_MSG_RESOURCE, enableCON = False, timeout = 5)
#@unittest.skip("Ignore for now.")
def testConnectAndPutCon(self):
msg = "This is a test."
self.coapClient.sendPutRequest(resource = ResourceNameEnum.CDA_MGMT_STATUS_MSG_RESOURCE, payload = msg, enableCON = True, timeout = 5)
#@unittest.skip("Ignore for now.")
def testConnectAndPutNon(self):
msg = "This is a test."
self.coapClient.sendPutRequest(resource = ResourceNameEnum.CDA_MGMT_STATUS_MSG_RESOURCE, payload = msg, enableCON = False, timeout = 5)
#@unittest.skip("Ignore for now.")
def testConnectAndPostCon(self):
msg = "This is a test."
self.coapClient.sendPostRequest(resource = ResourceNameEnum.CDA_MGMT_STATUS_MSG_RESOURCE, payload = msg, enableCON = True, timeout = 5)
#@unittest.skip("Ignore for now.")
def testConnectAndPostNon(self):
msg = "This is a test."
self.coapClient.sendPostRequest(resource = ResourceNameEnum.CDA_MGMT_STATUS_MSG_RESOURCE, payload = msg, enableCON = False, timeout = 5)
#@unittest.skip("Ignore for now.")
def testConnectAndDeleteCon(self):
self.coapClient.sendDeleteRequest(resource = ResourceNameEnum.CDA_MGMT_STATUS_MSG_RESOURCE, enableCON = True, timeout = 5)
#@unittest.skip("Ignore for now.")
def testConnectAndDeleteNon(self):
self.coapClient.sendDeleteRequest(resource = ResourceNameEnum.CDA_MGMT_STATUS_MSG_RESOURCE, enableCON = False, timeout = 5)
def testConnectAndDiscover(self):
self.coapClient.sendDiscoveryRequest(timeout = 10)
if __name__ == "__main__":
unittest.main()
| 31.570248 | 138 | 0.763874 | 452 | 3,820 | 6.367257 | 0.30531 | 0.058374 | 0.087561 | 0.102154 | 0.503127 | 0.503127 | 0.503127 | 0.492356 | 0.492356 | 0.492356 | 0 | 0.004242 | 0.136126 | 3,820 | 121 | 139 | 31.570248 | 0.867879 | 0.291885 | 0 | 0.218182 | 0 | 0 | 0.067319 | 0.018052 | 0 | 0 | 0 | 0.008264 | 0 | 1 | 0.327273 | false | 0.145455 | 0.127273 | 0 | 0.472727 | 0.018182 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
f764ebcd084bba032a94c2d052c8a2a004d25409 | 691 | py | Python | tests/test_verify.py | JeppeKlitgaard/barista | 7a34f13112697229431bd6533a67e1e439bdbf96 | [
"MIT"
] | 2 | 2021-12-22T06:20:05.000Z | 2022-01-22T12:10:13.000Z | tests/test_verify.py | JeppeKlitgaard/barista | 7a34f13112697229431bd6533a67e1e439bdbf96 | [
"MIT"
] | 6 | 2021-11-28T06:15:33.000Z | 2022-01-01T19:33:05.000Z | tests/test_verify.py | JeppeKlitgaard/barista | 7a34f13112697229431bd6533a67e1e439bdbf96 | [
"MIT"
] | null | null | null | import pytest
from barista.models import Match
def test_both_trigger_and_triggers():
with pytest.raises(ValueError):
Match.parse_obj(
{
"replace": "asd",
"trigger": "asd",
"triggers": ["asd", "abc"],
}
)
def test_neither_trigger_or_triggers():
with pytest.raises(ValueError):
Match.parse_obj({"replace": "asd"})
def test_trigger():
Match.parse_obj(
{
"replace": "asd",
"trigger": "ads",
}
)
def test_triggers():
Match.parse_obj(
{
"replace": "asd",
"triggers": ["ads", "ads2"],
}
)
| 18.184211 | 43 | 0.486252 | 63 | 691 | 5.111111 | 0.380952 | 0.086957 | 0.161491 | 0.248447 | 0.540373 | 0.468944 | 0.354037 | 0.354037 | 0.354037 | 0.354037 | 0 | 0.002304 | 0.371925 | 691 | 37 | 44 | 18.675676 | 0.739631 | 0 | 0 | 0.285714 | 0 | 0 | 0.128799 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | true | 0 | 0.071429 | 0 | 0.214286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f772c49e2d65c8bb282197ffd1a01580201a1e72 | 530 | py | Python | backend/src/app.py | zonradkuse/city-tour-recsys | 46e9d7726a58fb5bfb1585393e0564dcc6ef69df | [
"MIT"
] | null | null | null | backend/src/app.py | zonradkuse/city-tour-recsys | 46e9d7726a58fb5bfb1585393e0564dcc6ef69df | [
"MIT"
] | null | null | null | backend/src/app.py | zonradkuse/city-tour-recsys | 46e9d7726a58fb5bfb1585393e0564dcc6ef69df | [
"MIT"
] | null | null | null | #src/app.py
from flask import Flask
from .config import app_config
from .models import db, bcrypt
from .models import UserModel, ReviewModel, NodeModel,AmenityModel,TourismModel,ShopModel
def create_app(env_name):
"""
Create app
"""
# app initiliazation
app = Flask(__name__)
app.config.from_object(app_config[env_name])
# initializing bcrypt
bcrypt.init_app(app)
db.init_app(app)
@app.route('/', methods=['GET'])
def index():
"""
example endpoint
"""
return 'Welcome!'
return app
| 16.5625 | 89 | 0.69434 | 68 | 530 | 5.235294 | 0.470588 | 0.067416 | 0.073034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.186792 | 530 | 31 | 90 | 17.096774 | 0.825986 | 0.145283 | 0 | 0 | 0 | 0 | 0.028302 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.307692 | 0 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f778d68fd33b1e3ea78a79f6e7741f3086e9cb91 | 339 | py | Python | src/DbxSync/CodeTransformer/LineParser/ImportLineParser.py | DataSentics/dbx-sync | 841b969d8c76db0fe4ec4b1588c1206f8a1e7492 | [
"MIT"
] | null | null | null | src/DbxSync/CodeTransformer/LineParser/ImportLineParser.py | DataSentics/dbx-sync | 841b969d8c76db0fe4ec4b1588c1206f8a1e7492 | [
"MIT"
] | null | null | null | src/DbxSync/CodeTransformer/LineParser/ImportLineParser.py | DataSentics/dbx-sync | 841b969d8c76db0fe4ec4b1588c1206f8a1e7492 | [
"MIT"
] | null | null | null | import re
from DbxSync.CodeTransformer.LineTransformer.ImportLine import ImportLine
class ImportLineParser:
def parse(self, line):
matches = re.match('^from[ ]+([^ ]+) import ([^ ]+)$', line)
if matches is None:
return None
else:
return ImportLine(matches.group(1), matches.group(2))
| 26.076923 | 73 | 0.622419 | 36 | 339 | 5.861111 | 0.638889 | 0.113744 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007874 | 0.250737 | 339 | 12 | 74 | 28.25 | 0.822835 | 0 | 0 | 0 | 0 | 0 | 0.094395 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.555556 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
f77b0ba768a1795736866d76c3a10e32f12b1158 | 284 | py | Python | contentPages/migrations/0034_merge_20200512_2155.py | methods/phe-cv19-site | fd5f877b8a0725a9893fa3c24a54e9495e749744 | [
"MIT"
] | 1 | 2020-09-21T16:35:16.000Z | 2020-09-21T16:35:16.000Z | contentPages/migrations/0034_merge_20200512_2155.py | methods/phe-cv19-site | fd5f877b8a0725a9893fa3c24a54e9495e749744 | [
"MIT"
] | 14 | 2020-03-25T10:29:26.000Z | 2022-01-13T03:45:38.000Z | contentPages/migrations/0034_merge_20200512_2155.py | methods/phe-cv19-site | fd5f877b8a0725a9893fa3c24a54e9495e749744 | [
"MIT"
] | null | null | null | # Generated by Django 2.2.12 on 2020-05-12 21:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contentPages', '0017_auto_20200507_1147'),
('contentPages', '0033_auto_20200505_1041'),
]
operations = [
]
| 18.933333 | 52 | 0.661972 | 33 | 284 | 5.515152 | 0.787879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.217195 | 0.221831 | 284 | 14 | 53 | 20.285714 | 0.606335 | 0.161972 | 0 | 0 | 1 | 0 | 0.29661 | 0.194915 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
f78c3b318265c18abf5ea6fa5d6323be17e352d9 | 489 | py | Python | logging_middleware.py | oslokommune/okdata-event-stream-api | 42d4c35a30ff784d00117e2d75078699abb7640e | [
"MIT"
] | 1 | 2021-09-09T11:43:41.000Z | 2021-09-09T11:43:41.000Z | logging_middleware.py | oslokommune/okdata-event-stream-api | 42d4c35a30ff784d00117e2d75078699abb7640e | [
"MIT"
] | 4 | 2021-08-04T07:10:20.000Z | 2022-03-30T14:14:14.000Z | logging_middleware.py | oslokommune/okdata-event-stream-api | 42d4c35a30ff784d00117e2d75078699abb7640e | [
"MIT"
] | null | null | null | from okdata.aws.logging import logging_wrapper
from starlette.middleware.base import BaseHTTPMiddleware
def _logging_middleware(request, call_next):
@logging_wrapper("event-stream-api", async_wrapper=True)
async def handler(event, context):
return await call_next(request)
return handler(request.scope.get("aws.event", {}), request.scope.get("aws.context"))
def add_logging_middleware(app):
app.add_middleware(BaseHTTPMiddleware, dispatch=_logging_middleware)
| 32.6 | 88 | 0.779141 | 61 | 489 | 6.04918 | 0.459016 | 0.138211 | 0.081301 | 0.097561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116564 | 489 | 14 | 89 | 34.928571 | 0.854167 | 0 | 0 | 0 | 0 | 0 | 0.07362 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
f78e45bb7edb7664ca5b309f14f4d9ed97b4cc21 | 421 | py | Python | models/networks/ResNet18.py | MorganeAyle/SNIP-it | df2bf44d6d3f7e4ea7733242a79c916735a7b49e | [
"MIT"
] | null | null | null | models/networks/ResNet18.py | MorganeAyle/SNIP-it | df2bf44d6d3f7e4ea7733242a79c916735a7b49e | [
"MIT"
] | null | null | null | models/networks/ResNet18.py | MorganeAyle/SNIP-it | df2bf44d6d3f7e4ea7733242a79c916735a7b49e | [
"MIT"
] | null | null | null | from models.Pruneable import Pruneable
from models.networks.assisting_layers.ResNetLayers import resnet18
class ResNet18(Pruneable):
def __init__(self, device="cuda", output_dim=2, input_dim=(1, 1, 1), **kwargs):
super(ResNet18, self).__init__(device=device, output_dim=output_dim, input_dim=input_dim, **kwargs)
self.m = resnet18()
def forward(self, x):
x = self.m(x)
return x
| 32.384615 | 107 | 0.695962 | 58 | 421 | 4.793103 | 0.448276 | 0.097122 | 0.079137 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034884 | 0.182898 | 421 | 12 | 108 | 35.083333 | 0.773256 | 0 | 0 | 0 | 0 | 0 | 0.009501 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
e38ffac8437cb0514ff59eb0f60f150888ef0a04 | 1,268 | py | Python | tests/test_collaborate.py | SepShr/MLCSHE | 424946a40a4455280cbdc4bcbe3e38a99744d866 | [
"MIT"
] | 2 | 2021-10-29T18:28:32.000Z | 2021-12-10T20:00:28.000Z | tests/test_collaborate.py | SepShr/MLCSHE | 424946a40a4455280cbdc4bcbe3e38a99744d866 | [
"MIT"
] | 14 | 2021-09-01T09:25:57.000Z | 2022-02-18T09:20:59.000Z | tests/test_collaborate.py | SepShr/MLCSHE | 424946a40a4455280cbdc4bcbe3e38a99744d866 | [
"MIT"
] | null | null | null | from deap import creator
from src.utils.utility import collaborate
import problem
import unittest
class TestCollaborate(unittest.TestCase):
def test_collaborate_testInput1(self):
p1 = [creator.Scenario([1]), creator.Scenario([2.5])]
a1 = [creator.Scenario([1])]
p2 = [[3], creator.OutputMLC(["a"])]
a2 = [creator.OutputMLC(["a"])]
cls = creator.Individual
fcls = creator.Scenario
k = 2
complete_solution_set = collaborate(a1, p1, a2, p2, cls, fcls, k)
expected_solution = [[[1], [3]], [[1], ['a']],
[[2.5], ['a']], [[2.5], [3]]]
self.assertEqual(complete_solution_set, expected_solution)
def test_collaborate_numTest(self):
p1 = [creator.Scenario([1]), creator.Scenario([2.5])]
a1 = [creator.Scenario([1])]
p2 = [[3], creator.OutputMLC(["a"])]
a2 = [creator.OutputMLC(["a"])]
cls = creator.Individual
fcls = creator.Scenario
k = 1
expected_solution = [[[1], [3]], [[1], ['a']], [[2.5], ['a']]]
complete_solution_set = collaborate(a1, p1, a2, p2, cls, fcls, k)
self.assertEqual(complete_solution_set, expected_solution)
if __name__ == '__main__':
unittest.main()
| 35.222222 | 73 | 0.578864 | 148 | 1,268 | 4.797297 | 0.277027 | 0.169014 | 0.090141 | 0.059155 | 0.71831 | 0.71831 | 0.71831 | 0.577465 | 0.577465 | 0.512676 | 0 | 0.044071 | 0.248423 | 1,268 | 35 | 74 | 36.228571 | 0.700944 | 0 | 0 | 0.533333 | 0 | 0 | 0.012618 | 0 | 0 | 0 | 0 | 0 | 0.066667 | 1 | 0.066667 | false | 0 | 0.133333 | 0 | 0.233333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e3a143e2225a4d3c0018a45c76f96df131fe3811 | 766 | py | Python | utils/consts.py | vinbigdata-medical/vindr-lab-uploader | 7aa74dcc44b26506c5e5131f0e2e769a9e9d9e3d | [
"MIT"
] | 8 | 2021-03-31T03:12:03.000Z | 2021-04-08T15:03:02.000Z | utils/consts.py | vinbigdata-medical/vindr-lab-uploader | 7aa74dcc44b26506c5e5131f0e2e769a9e9d9e3d | [
"MIT"
] | 1 | 2021-04-20T07:26:21.000Z | 2021-04-20T07:26:21.000Z | utils/consts.py | vinbigdata-medical/vindr-lab-uploader | 7aa74dcc44b26506c5e5131f0e2e769a9e9d9e3d | [
"MIT"
] | 1 | 2021-04-04T16:37:01.000Z | 2021-04-04T16:37:01.000Z | merge_tags = {
"StudyDate": 0x00080020,
"StudyTime": 0x00080030,
"AccessionNumber": 0x00080050,
"ReferringPhysicianName": 0x00080090,
"StudyInstanceUID": 0x0020000D,
"StudyID": 0x00200010,
"Modality": 0x00080060,
# "ModalitiesInStudy": ,
"SeriesInstanceUID": 0x0020000E,
"SeriesNumber": 0x00200011,
"SOPClassUID": 0x00080016,
"SOPInstanceUID": 0x00080018,
# "InstanceNumber": ,
"PatientAge": 0x00101010,
"PatientName": 0x00100010,
"PatientID": 0x00100020,
"PatientSex": 0x00100040,
"StudyDate": 0x00080020,
"NumberOfStudyRelatedSeries": 0x00201206,
"NumberOfStudyRelatedInstances": 0x00201208,
"BodyPartExamined": 0x00180015,
}
class InstanceExistedException(Exception):
pass
| 27.357143 | 48 | 0.695822 | 46 | 766 | 11.565217 | 0.956522 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2704 | 0.184073 | 766 | 27 | 49 | 28.37037 | 0.5808 | 0.05483 | 0 | 0.086957 | 0 | 0 | 0.36061 | 0.106796 | 0 | 0 | 0.263523 | 0 | 0 | 1 | 0 | false | 0.043478 | 0 | 0 | 0.043478 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e3b5bdbe94191c1108d8e9bd911dd31bd6ee4cff | 829 | py | Python | test.py | EnriqueNueve/UrbanAudioPlugin | 6dc988428f6a3d8a8808fd8c3d506929c200bd00 | [
"MIT"
] | null | null | null | test.py | EnriqueNueve/UrbanAudioPlugin | 6dc988428f6a3d8a8808fd8c3d506929c200bd00 | [
"MIT"
] | null | null | null | test.py | EnriqueNueve/UrbanAudioPlugin | 6dc988428f6a3d8a8808fd8c3d506929c200bd00 | [
"MIT"
] | null | null | null |
######################
# Import main modules
######################
import unittest
import librosa
from PIL import Image
import pandas as pd
import numpy as np
import tensorflow as tf
from main import getAudioModel, getTopK, LogMelSpectMesh, predictModel
######################
# Globals
######################
CLASS_LABELS = ['air conditioner','car horn','children playing',\
'dog barking','drilling', 'engine','gun shot',\
'jackhammer','siren','street music']
######################
# Unit test
######################
class MyTestCase(unittest.TestCase):
def test_audio_func(self):
data = AudioFolder('test_path')
for sample in data:
sample.data
def test_something(self):
self.assertTrue(1 == 1)
if __name__ == "__main__":
unittest.main()
| 21.815789 | 70 | 0.558504 | 83 | 829 | 5.421687 | 0.686747 | 0.031111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003008 | 0.197829 | 829 | 37 | 71 | 22.405405 | 0.673684 | 0.044632 | 0 | 0 | 0 | 0 | 0.177099 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 1 | 0.105263 | false | 0 | 0.368421 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
e3ba828a6c70dadfa91d3b4887f84f2685046e6b | 403 | py | Python | tbc/comedians/urls.py | bharathnr1/TBC | 8aa98dd5509db31610ef1fc6826b32d5e8d8dbcb | [
"MIT"
] | null | null | null | tbc/comedians/urls.py | bharathnr1/TBC | 8aa98dd5509db31610ef1fc6826b32d5e8d8dbcb | [
"MIT"
] | null | null | null | tbc/comedians/urls.py | bharathnr1/TBC | 8aa98dd5509db31610ef1fc6826b32d5e8d8dbcb | [
"MIT"
] | null | null | null | from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.urls import path
from . import views
app_name = 'comedians'
urlpatterns=[
path(r'', views.view_comedians, name = 'view_comedians'),
path(r'register_comedians/', views.register_comedians, name = 'register_comedians'),
path(r'view_comedians/', views.view_comedians, name = 'view_comedians'),
]
| 31 | 88 | 0.754342 | 55 | 403 | 5.345455 | 0.327273 | 0.221088 | 0.122449 | 0.14966 | 0.238095 | 0.238095 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 403 | 12 | 89 | 33.583333 | 0.837607 | 0 | 0 | 0 | 0 | 0 | 0.220844 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
e3c0d3548512df2fb7dc66935139ab858e495bfb | 242 | py | Python | paths.py | bathelomeo/the_file_system | 0e8af17f3f58ee9a573e340375abc5b7c3bd6476 | [
"MIT"
] | null | null | null | paths.py | bathelomeo/the_file_system | 0e8af17f3f58ee9a573e340375abc5b7c3bd6476 | [
"MIT"
] | null | null | null | paths.py | bathelomeo/the_file_system | 0e8af17f3f58ee9a573e340375abc5b7c3bd6476 | [
"MIT"
] | null | null | null | from pathlib import Path
cwd = Path.cwd()
print('\nCurrent working directory :\n' +str(cwd))
new_file = Path.joinpath(cwd, 'new_file.txt')
print('\nFull path:\n' + str(new_file))
print('\nDoes that file exist?:\n' + str(new_file.exists())) | 26.888889 | 60 | 0.694215 | 39 | 242 | 4.205128 | 0.512821 | 0.170732 | 0.121951 | 0.134146 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.115702 | 242 | 9 | 60 | 26.888889 | 0.766355 | 0 | 0 | 0 | 0 | 0 | 0.341564 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.5 | 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 | 0 | 0 | 0 | 1 | 0 | 2 |
e3d0a0ac3a706b9a37b0fad4407f48c289a3ff12 | 1,770 | py | Python | pygromos/files/gromos_system/ff/solvents/Solvents.py | SalomeRonja/PyGromosTools | 5a17740a0ec634b8b591ef74d8a420e3fd3e38ba | [
"MIT"
] | 13 | 2021-03-17T09:29:37.000Z | 2022-01-14T20:42:16.000Z | pygromos/files/gromos_system/ff/solvents/Solvents.py | SchroederB/PyGromosTools | c31c38455a849c864241a962efee9e6575f27b06 | [
"MIT"
] | 185 | 2021-03-03T14:24:55.000Z | 2022-03-31T18:39:29.000Z | pygromos/files/gromos_system/ff/solvents/Solvents.py | SchroederB/PyGromosTools | c31c38455a849c864241a962efee9e6575f27b06 | [
"MIT"
] | 13 | 2021-03-03T14:18:06.000Z | 2022-02-17T09:48:55.000Z | """
This module collects all solvent subclasses for python file and information management with gromos
"""
class Solvent():
"""Solvent
This class is giving the needed solvent infofmation for gromos in an obj.
#TODO: CONFs & TOPO in data
"""
name:str = None
coord_file_path:str = None
def __init__(self, name:str=None, coord_file:str=None):
if(name!=None):
self.name = name
self.coord_file_path = coord_file
else:
raise IOError("DID not get correct Constructor arguments in "+self.__class__.name)
def _return_all_paths(self)->list:
coll = []
if(self.coord_file_path != None):
coll.append(self.coord_file_path)
return coll
class H2O(Solvent):
def __init__(self, coord_file_path:str=None):
if(coord_file_path!=None):
super().__init__(name="H2O")
self.coord_file_path = coord_file_path
self.atomNum=3
else:
raise IOError("DID not get correct Constructor arguments in "+self.__class__.name)
class CHCL3(Solvent):
def __init__(self, coord_file_path:str=None):
if(coord_file_path!=None):
super().__init__(name="CHCL3")
self.coord_file_path = coord_file_path
self.atomNum=5
else:
raise IOError("DID not get correct Constructor arguments in "+self.__class__.name)
class DMSO(Solvent):
def __init__(self, coord_file_path:str=None):
if(coord_file_path!=None):
super().__init__(name="DMSO")
self.coord_file_path = coord_file_path
self.atomNum=4
else:
raise IOError("DID not get correct Constructor arguments in "+self.__class__.name) | 30.517241 | 102 | 0.628814 | 228 | 1,770 | 4.526316 | 0.254386 | 0.156977 | 0.20155 | 0.148256 | 0.666667 | 0.617248 | 0.592054 | 0.592054 | 0.592054 | 0.472868 | 0 | 0.00546 | 0.275706 | 1,770 | 58 | 103 | 30.517241 | 0.799532 | 0.117514 | 0 | 0.447368 | 0 | 0 | 0.125984 | 0 | 0 | 0 | 0 | 0.017241 | 0 | 1 | 0.131579 | false | 0 | 0 | 0 | 0.315789 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e3e9b70ae15d82b64f573842ba22223ac067de00 | 1,360 | py | Python | application/schemas/auth.py | krlex/backend-practice | 40019780915b9034c64ceffff3eabc506d5fa1a2 | [
"BSD-2-Clause"
] | null | null | null | application/schemas/auth.py | krlex/backend-practice | 40019780915b9034c64ceffff3eabc506d5fa1a2 | [
"BSD-2-Clause"
] | null | null | null | application/schemas/auth.py | krlex/backend-practice | 40019780915b9034c64ceffff3eabc506d5fa1a2 | [
"BSD-2-Clause"
] | 1 | 2019-09-17T19:31:37.000Z | 2019-09-17T19:31:37.000Z | from marshmallow import fields
from .base import BaseSchema
class TokenSchema(BaseSchema):
email = fields.Email(required=True, description='Email')
password = fields.Str(required=True, description='Password')
class RoleSchema(BaseSchema):
id = fields.Integer(description='ID', dump_only=True)
description = fields.String(required=True, description='Description')
name = fields.String(required=True, description='Name')
class UserRolesSchema(BaseSchema):
role = fields.Nested(RoleSchema)
class UserSchema(BaseSchema):
id = fields.Integer(description='ID', dump_only=True)
active = fields.Boolean(description='Activate the user', default=True)
admin = fields.Boolean(description='Is the user admin?', default=False)
email = fields.Email(required=True, description='Email')
password = fields.Str(
required=True,
description='Password',
load_only=True
)
roles = fields.List(
fields.Nested(UserRolesSchema),
many=True,
dump_only=True,
)
confirmed_at = fields.DateTime(
description='Time when user was confirmed',
dump_only=True,
)
class RefreshSchema(BaseSchema):
access = fields.Str()
accessExpire = fields.Integer()
refreshExpire = fields.Integer()
class LoginSchema(RefreshSchema):
refresh = fields.Str()
| 27.2 | 75 | 0.697794 | 146 | 1,360 | 6.458904 | 0.342466 | 0.111347 | 0.146341 | 0.050901 | 0.375398 | 0.301166 | 0.301166 | 0.301166 | 0.301166 | 0.195122 | 0 | 0 | 0.188971 | 1,360 | 49 | 76 | 27.755102 | 0.854941 | 0 | 0 | 0.166667 | 0 | 0 | 0.079412 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.083333 | 0.055556 | 0 | 0.694444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
e3edbe10a4f2cebea1eeed5eaf6d92e86b01375a | 1,340 | py | Python | tagupy/type/_abs_generator.py | algebra-club/TaguPy | 1ff5a792f7c78cfb6741cf27659215fef287a1c1 | [
"MIT"
] | 1 | 2021-08-21T07:36:24.000Z | 2021-08-21T07:36:24.000Z | tagupy/type/_abs_generator.py | algebra-club/TaguPy | 1ff5a792f7c78cfb6741cf27659215fef287a1c1 | [
"MIT"
] | 29 | 2021-08-15T18:12:58.000Z | 2021-09-12T14:48:17.000Z | tagupy/type/_abs_generator.py | algebra-club/TaguPy | 1ff5a792f7c78cfb6741cf27659215fef287a1c1 | [
"MIT"
] | null | null | null | """
ABC Class of any Experiment Matrix Generating Module
"""
from abc import ABC, abstractmethod
from typing import Any, Dict
import numpy as np
class _Generator(ABC):
"""
ABC Class of Experiment Matrix Generator
Method
------
get_exmatrix(**info: Dict[str, Any]) -> np.ndarray
get_alias_matrix(max_dim: int) -> np.ndarray
"""
@abstractmethod
def __init__(self, **kwargs: Dict[str, Any]):
"""
Parameters
----------
kwargs: Dict[str, Any]
generate method options of each Generator
"""
pass
@abstractmethod
def get_exmatrix(self, **info: Dict[str, Any]) -> np.ndarray:
"""
Generate Experiment Matrix
Parameters
----------
info: Dict[str, Any]
it is expected to contain following info
1. n_factor: int
number of factors you use in this experiment
2. n_level: int
number of levels, requires every factor has the same level.
3. mode: str default = "mode"
mode of factor, 'cont' or 'cat' or ''
requires every factor is under the same mode.
Return
------
exmatrix: np.ndarray
Experiment Matrix (n_experiment x n_factor)
"""
pass
| 24.363636 | 75 | 0.553731 | 152 | 1,340 | 4.789474 | 0.447368 | 0.048077 | 0.068681 | 0.057692 | 0.063187 | 0.063187 | 0 | 0 | 0 | 0 | 0 | 0.003425 | 0.346269 | 1,340 | 54 | 76 | 24.814815 | 0.827626 | 0.591045 | 0 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.2 | 0.3 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
540587a19f926786fd73af4c7abb28431b411a6d | 145,008 | py | Python | pysnmp/HM2-PLATFORM-SWITCHING-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/HM2-PLATFORM-SWITCHING-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/HM2-PLATFORM-SWITCHING-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module HM2-PLATFORM-SWITCHING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-PLATFORM-SWITCHING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:19:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint")
dot1dBasePortEntry, = mibBuilder.importSymbols("BRIDGE-MIB", "dot1dBasePortEntry")
hm2PlatformMibs, HmEnabledStatus = mibBuilder.importSymbols("HM2-TC-MIB", "hm2PlatformMibs", "HmEnabledStatus")
ifIndex, InterfaceIndex, InterfaceIndexOrZero = mibBuilder.importSymbols("IF-MIB", "ifIndex", "InterfaceIndex", "InterfaceIndexOrZero")
InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType")
dot1dPortGmrpEntry, = mibBuilder.importSymbols("P-BRIDGE-MIB", "dot1dPortGmrpEntry")
VlanId, PortList, dot1qPortVlanEntry, dot1qFdbId, VlanIndex, dot1qVlanIndex = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanId", "PortList", "dot1qPortVlanEntry", "dot1qFdbId", "VlanIndex", "dot1qVlanIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
ObjectIdentity, Counter64, Gauge32, Bits, Unsigned32, TimeTicks, Integer32, MibIdentifier, IpAddress, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Counter32, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Counter64", "Gauge32", "Bits", "Unsigned32", "TimeTicks", "Integer32", "MibIdentifier", "IpAddress", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Counter32", "NotificationType")
TruthValue, RowStatus, DisplayString, MacAddress, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "DisplayString", "MacAddress", "TextualConvention")
hm2PlatformSwitching = ModuleIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1))
hm2PlatformSwitching.setRevisions(('2011-04-12 00:00',))
if mibBuilder.loadTexts: hm2PlatformSwitching.setLastUpdated('201104120000Z')
if mibBuilder.loadTexts: hm2PlatformSwitching.setOrganization('Hirschmann Automation and Control GmbH')
class Hm2AgentPortMask(TextualConvention, OctetString):
status = 'current'
class LagList(TextualConvention, OctetString):
status = 'current'
class VlanList(TextualConvention, OctetString):
status = 'current'
class Ipv6Address(TextualConvention, OctetString):
status = 'current'
displayHint = '2x:'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(16, 16)
fixedLength = 16
class Ipv6AddressPrefix(TextualConvention, OctetString):
status = 'current'
displayHint = '2x:'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 16)
class Ipv6AddressIfIdentifier(TextualConvention, OctetString):
status = 'current'
displayHint = '2x:'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 8)
class Ipv6IfIndex(TextualConvention, Integer32):
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 2147483647)
class Ipv6IfIndexOrZero(TextualConvention, Integer32):
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647)
hm2AgentConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2))
hm2AgentLagConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2))
hm2AgentLagConfigCreate = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 1), DisplayString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(1, 15), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentLagConfigCreate.setStatus('current')
hm2AgentLagSummaryConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2), )
if mibBuilder.loadTexts: hm2AgentLagSummaryConfigTable.setStatus('current')
hm2AgentLagSummaryConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentLagSummaryLagIndex"))
if mibBuilder.loadTexts: hm2AgentLagSummaryConfigEntry.setStatus('current')
hm2AgentLagSummaryLagIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagSummaryLagIndex.setStatus('current')
hm2AgentLagSummaryName = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 15))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryName.setStatus('current')
hm2AgentLagSummaryFlushTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 3), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryFlushTimer.setStatus('obsolete')
hm2AgentLagSummaryLinkTrap = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 4), HmEnabledStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryLinkTrap.setStatus('current')
hm2AgentLagSummaryAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 5), HmEnabledStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryAdminMode.setStatus('current')
hm2AgentLagSummaryStpMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 6), HmEnabledStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryStpMode.setStatus('current')
hm2AgentLagSummaryAddPort = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 7), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryAddPort.setStatus('current')
hm2AgentLagSummaryDeletePort = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 8), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryDeletePort.setStatus('current')
hm2AgentLagSummaryStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 9), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryStatus.setStatus('current')
hm2AgentLagSummaryType = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("static", 1), ("dynamic", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagSummaryType.setStatus('current')
hm2AgentLagSummaryStaticCapability = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 11), HmEnabledStatus().clone('disable')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryStaticCapability.setStatus('current')
hm2AgentLagSummaryHashOption = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("sourceMacVlan", 1), ("destMacVlan", 2), ("sourceDestMacVlan", 3), ("sourceIPsourcePort", 4), ("destIPdestPort", 5), ("sourceDestIPPort", 6), ("enhanced", 7)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryHashOption.setStatus('current')
hm2AgentLagSummaryMinimumActiveLinks = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8)).clone(1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryMinimumActiveLinks.setStatus('current')
hm2AgentLagSummaryMaxFrameSizeLimit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 248), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagSummaryMaxFrameSizeLimit.setStatus('current')
hm2AgentLagSummaryMaxFrameSize = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 2, 1, 249), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentLagSummaryMaxFrameSize.setStatus('current')
hm2AgentLagDetailedConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 3), )
if mibBuilder.loadTexts: hm2AgentLagDetailedConfigTable.setStatus('current')
hm2AgentLagDetailedConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 3, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentLagDetailedLagIndex"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentLagDetailedIfIndex"))
if mibBuilder.loadTexts: hm2AgentLagDetailedConfigEntry.setStatus('current')
hm2AgentLagDetailedLagIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagDetailedLagIndex.setStatus('current')
hm2AgentLagDetailedIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagDetailedIfIndex.setStatus('current')
hm2AgentLagDetailedPortSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 3, 1, 3), ObjectIdentifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagDetailedPortSpeed.setStatus('current')
hm2AgentLagDetailedPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagDetailedPortStatus.setStatus('current')
hm2AgentLagConfigStaticCapability = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 4), HmEnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentLagConfigStaticCapability.setStatus('obsolete')
hm2AgentLagConfigGroupHashOption = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("sourceMacVlan", 1), ("destMacVlan", 2), ("sourceDestMacVlan", 3), ("sourceIPsourcePort", 4), ("destIPdestPort", 5), ("sourceDestIPPort", 6), ("enhanced", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentLagConfigGroupHashOption.setStatus('current')
hm2AgentLagConfigGroupMaxNumPortsPerLag = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 248), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagConfigGroupMaxNumPortsPerLag.setStatus('current')
hm2AgentLagConfigGroupMaxNumOfLags = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 249), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagConfigGroupMaxNumOfLags.setStatus('current')
hm2AgentLagConfigGroupNumOfLagsConfigured = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 250), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagConfigGroupNumOfLagsConfigured.setStatus('current')
hm2AgentLagConfigGroupLagsConfigured = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 251), LagList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentLagConfigGroupLagsConfigured.setStatus('current')
hm2AgentLagConfigSNMPExtensionGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 260))
hm2AgentLagConfigGroupPortIsLagMemberErrorReturn = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 260, 1))
if mibBuilder.loadTexts: hm2AgentLagConfigGroupPortIsLagMemberErrorReturn.setStatus('current')
hm2AgentLagMirrorProbePortLagMemberErrorReturn = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 2, 260, 2))
if mibBuilder.loadTexts: hm2AgentLagMirrorProbePortLagMemberErrorReturn.setStatus('current')
hm2AgentSwitchConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8))
hm2AgentSwitchAddressAgingTimeoutTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 4), )
if mibBuilder.loadTexts: hm2AgentSwitchAddressAgingTimeoutTable.setStatus('current')
hm2AgentSwitchAddressAgingTimeoutEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 4, 1), ).setIndexNames((0, "Q-BRIDGE-MIB", "dot1qFdbId"))
if mibBuilder.loadTexts: hm2AgentSwitchAddressAgingTimeoutEntry.setStatus('current')
hm2AgentSwitchAddressAgingTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 500000)).clone(30)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchAddressAgingTimeout.setStatus('current')
hm2AgentSwitchStaticMacFilteringTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 5), )
if mibBuilder.loadTexts: hm2AgentSwitchStaticMacFilteringTable.setStatus('current')
hm2AgentSwitchStaticMacFilteringEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 5, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchStaticMacFilteringVlanId"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchStaticMacFilteringAddress"))
if mibBuilder.loadTexts: hm2AgentSwitchStaticMacFilteringEntry.setStatus('current')
hm2AgentSwitchStaticMacFilteringVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchStaticMacFilteringVlanId.setStatus('current')
hm2AgentSwitchStaticMacFilteringAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 5, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchStaticMacFilteringAddress.setStatus('current')
hm2AgentSwitchStaticMacFilteringSourcePortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 5, 1, 3), Hm2AgentPortMask()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchStaticMacFilteringSourcePortMask.setStatus('current')
hm2AgentSwitchStaticMacFilteringDestPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 5, 1, 4), Hm2AgentPortMask()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchStaticMacFilteringDestPortMask.setStatus('current')
hm2AgentSwitchStaticMacFilteringStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 5, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentSwitchStaticMacFilteringStatus.setStatus('current')
hm2AgentSwitchSnoopingGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 6))
hm2AgentSwitchSnoopingCfgTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 6, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingCfgTable.setStatus('current')
hm2AgentSwitchSnoopingCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 6, 1, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchSnoopingProtocol"))
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingCfgEntry.setStatus('current')
hm2AgentSwitchSnoopingProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 6, 1, 1, 1), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingProtocol.setStatus('current')
hm2AgentSwitchSnoopingAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 6, 1, 1, 2), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingAdminMode.setStatus('current')
hm2AgentSwitchSnoopingPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 6, 1, 1, 3), Hm2AgentPortMask().clone(hexValue="000000000000")).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingPortMask.setStatus('current')
hm2AgentSwitchSnoopingMulticastControlFramesProcessed = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 6, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingMulticastControlFramesProcessed.setStatus('current')
hm2AgentSwitchSnoopingIntfGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7))
hm2AgentSwitchSnoopingIntfTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfTable.setStatus('current')
hm2AgentSwitchSnoopingIntfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchSnoopingProtocol"))
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfEntry.setStatus('current')
hm2AgentSwitchSnoopingIntfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfIndex.setStatus('current')
hm2AgentSwitchSnoopingIntfAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1, 2), HmEnabledStatus().clone('enable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfAdminMode.setStatus('current')
hm2AgentSwitchSnoopingIntfGroupMembershipInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(2, 3600)).clone(260)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfGroupMembershipInterval.setStatus('current')
hm2AgentSwitchSnoopingIntfMaxResponseTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1, 4), Integer32().clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfMaxResponseTime.setStatus('current')
hm2AgentSwitchSnoopingIntfMRPExpirationTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3600)).clone(260)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfMRPExpirationTime.setStatus('current')
hm2AgentSwitchSnoopingIntfFastLeaveAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1, 6), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfFastLeaveAdminMode.setStatus('current')
hm2AgentSwitchSnoopingIntfMulticastRouterMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1, 7), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfMulticastRouterMode.setStatus('current')
hm2AgentSwitchSnoopingIntfVlanIDs = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 7, 1, 1, 8), VlanList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingIntfVlanIDs.setStatus('current')
hm2AgentSwitchSnoopingVlanGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8))
hm2AgentSwitchSnoopingVlanTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingVlanTable.setStatus('current')
hm2AgentSwitchSnoopingVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8, 1, 1), ).setIndexNames((0, "Q-BRIDGE-MIB", "dot1qVlanIndex"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchSnoopingProtocol"))
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingVlanEntry.setStatus('current')
hm2AgentSwitchSnoopingVlanAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8, 1, 1, 1), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingVlanAdminMode.setStatus('current')
hm2AgentSwitchSnoopingVlanGroupMembershipInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(2, 3600)).clone(260)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingVlanGroupMembershipInterval.setStatus('current')
hm2AgentSwitchSnoopingVlanMaxResponseTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8, 1, 1, 3), Integer32().clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingVlanMaxResponseTime.setStatus('current')
hm2AgentSwitchSnoopingVlanFastLeaveAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8, 1, 1, 4), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingVlanFastLeaveAdminMode.setStatus('current')
hm2AgentSwitchSnoopingVlanMRPExpirationTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3600)).clone(260)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingVlanMRPExpirationTime.setStatus('current')
hm2AgentSwitchSnoopingVlanReportSuppMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 8, 1, 1, 6), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingVlanReportSuppMode.setStatus('current')
hm2AgentSwitchVlanStaticMrouterGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 9))
hm2AgentSwitchVlanStaticMrouterTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 9, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchVlanStaticMrouterTable.setStatus('current')
hm2AgentSwitchVlanStaticMrouterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 9, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "Q-BRIDGE-MIB", "dot1qVlanIndex"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchSnoopingProtocol"))
if mibBuilder.loadTexts: hm2AgentSwitchVlanStaticMrouterEntry.setStatus('current')
hm2AgentSwitchVlanStaticMrouterAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 9, 1, 1, 1), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchVlanStaticMrouterAdminMode.setStatus('current')
hm2AgentSwitchMFDBGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10))
hm2AgentSwitchMFDBTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchMFDBTable.setStatus('current')
hm2AgentSwitchMFDBEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchMFDBVlanId"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchMFDBMacAddress"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchMFDBProtocolType"))
if mibBuilder.loadTexts: hm2AgentSwitchMFDBEntry.setStatus('current')
hm2AgentSwitchMFDBVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1, 1, 1), VlanIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBVlanId.setStatus('current')
hm2AgentSwitchMFDBMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBMacAddress.setStatus('current')
hm2AgentSwitchMFDBProtocolType = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 248))).clone(namedValues=NamedValues(("static", 1), ("gmrp", 2), ("igmp", 3), ("mld", 4), ("mrp-mmrp", 248)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBProtocolType.setStatus('current')
hm2AgentSwitchMFDBType = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("static", 1), ("dynamic", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBType.setStatus('current')
hm2AgentSwitchMFDBDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBDescription.setStatus('current')
hm2AgentSwitchMFDBForwardingPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1, 1, 6), Hm2AgentPortMask()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBForwardingPortMask.setStatus('current')
hm2AgentSwitchMFDBFilteringPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 1, 1, 7), Hm2AgentPortMask()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBFilteringPortMask.setStatus('current')
hm2AgentSwitchMFDBSummaryTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 2), )
if mibBuilder.loadTexts: hm2AgentSwitchMFDBSummaryTable.setStatus('current')
hm2AgentSwitchMFDBSummaryEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 2, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchMFDBSummaryVlanId"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchMFDBSummaryMacAddress"))
if mibBuilder.loadTexts: hm2AgentSwitchMFDBSummaryEntry.setStatus('current')
hm2AgentSwitchMFDBSummaryVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 2, 1, 1), VlanIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBSummaryVlanId.setStatus('current')
hm2AgentSwitchMFDBSummaryMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 2, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBSummaryMacAddress.setStatus('current')
hm2AgentSwitchMFDBSummaryForwardingPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 2, 1, 3), Hm2AgentPortMask()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBSummaryForwardingPortMask.setStatus('current')
hm2AgentSwitchMFDBMaxTableEntries = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 3), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBMaxTableEntries.setStatus('current')
hm2AgentSwitchMFDBMostEntriesUsed = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 4), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBMostEntriesUsed.setStatus('current')
hm2AgentSwitchMFDBCurrentEntries = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 10, 5), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchMFDBCurrentEntries.setStatus('current')
hm2AgentSwitchStaticMacStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 248))
hm2AgentSwitchStaticMacEntries = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 248, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchStaticMacEntries.setStatus('current')
hm2AgentSwitchGARPGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249))
hm2AgentSwitchGmrpUnknownMulticastFilterMode = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("flood", 1), ("discard", 2))).clone('flood')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchGmrpUnknownMulticastFilterMode.setStatus('current')
hm2AgentSwitchGmrpPortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 10), )
if mibBuilder.loadTexts: hm2AgentSwitchGmrpPortTable.setStatus('current')
hm2AgentSwitchGmrpPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 10, 1), )
dot1dBasePortEntry.registerAugmentions(("HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchGmrpPortEntry"))
hm2AgentSwitchGmrpPortEntry.setIndexNames(*dot1dBasePortEntry.getIndexNames())
if mibBuilder.loadTexts: hm2AgentSwitchGmrpPortEntry.setStatus('current')
hm2AgentSwitchGmrpPortPktRx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 10, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchGmrpPortPktRx.setStatus('current')
hm2AgentSwitchGmrpPortPktTx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 10, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchGmrpPortPktTx.setStatus('current')
hm2AgentSwitchGvrpPortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 15), )
if mibBuilder.loadTexts: hm2AgentSwitchGvrpPortTable.setStatus('current')
hm2AgentSwitchGvrpPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 15, 1), )
dot1dBasePortEntry.registerAugmentions(("HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchGvrpPortEntry"))
hm2AgentSwitchGvrpPortEntry.setIndexNames(*dot1dBasePortEntry.getIndexNames())
if mibBuilder.loadTexts: hm2AgentSwitchGvrpPortEntry.setStatus('current')
hm2AgentSwitchGvrpPortPktRx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 15, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchGvrpPortPktRx.setStatus('current')
hm2AgentSwitchGvrpPortPktTx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 249, 15, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchGvrpPortPktTx.setStatus('current')
hm2AgentSwitchVlanMacAssociationGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 17))
hm2AgentSwitchVlanMacAssociationTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 17, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchVlanMacAssociationTable.setStatus('current')
hm2AgentSwitchVlanMacAssociationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 17, 1, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchVlanMacAssociationMacAddress"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchVlanMacAssociationVlanId"))
if mibBuilder.loadTexts: hm2AgentSwitchVlanMacAssociationEntry.setStatus('current')
hm2AgentSwitchVlanMacAssociationMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 17, 1, 1, 1), MacAddress())
if mibBuilder.loadTexts: hm2AgentSwitchVlanMacAssociationMacAddress.setStatus('current')
hm2AgentSwitchVlanMacAssociationVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 17, 1, 1, 2), VlanIndex())
if mibBuilder.loadTexts: hm2AgentSwitchVlanMacAssociationVlanId.setStatus('current')
hm2AgentSwitchVlanMacAssociationRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 17, 1, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentSwitchVlanMacAssociationRowStatus.setStatus('current')
hm2AgentSwitchProtectedPortConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 18))
hm2AgentSwitchProtectedPortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 18, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchProtectedPortTable.setStatus('current')
hm2AgentSwitchProtectedPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 18, 1, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchProtectedPortGroupId"))
if mibBuilder.loadTexts: hm2AgentSwitchProtectedPortEntry.setStatus('current')
hm2AgentSwitchProtectedPortGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 18, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)))
if mibBuilder.loadTexts: hm2AgentSwitchProtectedPortGroupId.setStatus('current')
hm2AgentSwitchProtectedPortGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 18, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchProtectedPortGroupName.setStatus('current')
hm2AgentSwitchProtectedPortPortList = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 18, 1, 1, 3), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchProtectedPortPortList.setStatus('current')
hm2AgentSwitchVlanSubnetAssociationGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 19))
hm2AgentSwitchVlanSubnetAssociationTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 19, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchVlanSubnetAssociationTable.setStatus('current')
hm2AgentSwitchVlanSubnetAssociationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 19, 1, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchVlanSubnetAssociationIPAddress"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchVlanSubnetAssociationSubnetMask"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchVlanSubnetAssociationVlanId"))
if mibBuilder.loadTexts: hm2AgentSwitchVlanSubnetAssociationEntry.setStatus('current')
hm2AgentSwitchVlanSubnetAssociationIPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 19, 1, 1, 1), IpAddress())
if mibBuilder.loadTexts: hm2AgentSwitchVlanSubnetAssociationIPAddress.setStatus('current')
hm2AgentSwitchVlanSubnetAssociationSubnetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 19, 1, 1, 2), IpAddress())
if mibBuilder.loadTexts: hm2AgentSwitchVlanSubnetAssociationSubnetMask.setStatus('current')
hm2AgentSwitchVlanSubnetAssociationVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 19, 1, 1, 3), VlanIndex())
if mibBuilder.loadTexts: hm2AgentSwitchVlanSubnetAssociationVlanId.setStatus('current')
hm2AgentSwitchVlanSubnetAssociationRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 19, 1, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentSwitchVlanSubnetAssociationRowStatus.setStatus('current')
hm2AgentSwitchSnoopingQuerierGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20))
hm2AgentSwitchSnoopingQuerierCfgTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 1), )
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierCfgTable.setStatus('current')
hm2AgentSwitchSnoopingQuerierCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 1, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchSnoopingProtocol"))
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierCfgEntry.setStatus('current')
hm2AgentSwitchSnoopingQuerierAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 1, 1, 1), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierAdminMode.setStatus('current')
hm2AgentSwitchSnoopingQuerierVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 1, 1, 2), Integer32().clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierVersion.setStatus('current')
hm2AgentSwitchSnoopingQuerierQueryInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1800)).clone(60)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierQueryInterval.setStatus('current')
hm2AgentSwitchSnoopingQuerierExpiryInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(60, 300)).clone(125)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierExpiryInterval.setStatus('current')
hm2AgentSwitchSnoopingQuerierVlanTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2), )
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierVlanTable.setStatus('current')
hm2AgentSwitchSnoopingQuerierVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1), ).setIndexNames((0, "Q-BRIDGE-MIB", "dot1qVlanIndex"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchSnoopingProtocol"))
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierVlanEntry.setStatus('current')
hm2AgentSwitchSnoopingQuerierVlanAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1, 1), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierVlanAdminMode.setStatus('current')
hm2AgentSwitchSnoopingQuerierVlanOperMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("disabled", 0), ("querier", 1), ("non-querier", 2))).clone('disabled')).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierVlanOperMode.setStatus('current')
hm2AgentSwitchSnoopingQuerierElectionParticipateMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1, 3), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierElectionParticipateMode.setStatus('deprecated')
hm2AgentSwitchSnoopingQuerierVlanAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1, 4), InetAddress().clone(hexValue="00000000")).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierVlanAddress.setStatus('current')
hm2AgentSwitchSnoopingQuerierOperVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierOperVersion.setStatus('current')
hm2AgentSwitchSnoopingQuerierOperMaxResponseTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(-1, -1), ValueRangeConstraint(0, 2147483647), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierOperMaxResponseTime.setStatus('current')
hm2AgentSwitchSnoopingQuerierLastQuerierAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1, 7), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierLastQuerierAddress.setStatus('current')
hm2AgentSwitchSnoopingQuerierLastQuerierVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 20, 2, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchSnoopingQuerierLastQuerierVersion.setStatus('current')
hm2AgentPortMirroringGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10))
hm2AgentPortMirrorTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4), )
if mibBuilder.loadTexts: hm2AgentPortMirrorTable.setStatus('current')
hm2AgentPortMirrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentPortMirrorSessionNum"))
if mibBuilder.loadTexts: hm2AgentPortMirrorEntry.setStatus('current')
hm2AgentPortMirrorSessionNum = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 1), Unsigned32())
if mibBuilder.loadTexts: hm2AgentPortMirrorSessionNum.setStatus('current')
hm2AgentPortMirrorDestinationPort = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorDestinationPort.setStatus('current')
hm2AgentPortMirrorSourcePortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 3), Hm2AgentPortMask()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorSourcePortMask.setStatus('current')
hm2AgentPortMirrorAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorAdminMode.setStatus('current')
hm2AgentPortMirrorSourceVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4042))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorSourceVlan.setStatus('current')
hm2AgentPortMirrorRemoteSourceVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 6), Unsigned32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(2, 4042), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorRemoteSourceVlan.setStatus('current')
hm2AgentPortMirrorRemoteDestinationVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 7), Unsigned32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(2, 4042), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorRemoteDestinationVlan.setStatus('current')
hm2AgentPortMirrorReflectorPort = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 8), InterfaceIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorReflectorPort.setStatus('current')
hm2AgentPortMirrorAllowMgmtMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 9), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorAllowMgmtMode.setStatus('current')
hm2AgentPortMirrorReset = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 4, 1, 248), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("reset", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorReset.setStatus('current')
hm2AgentPortMirrorTypeTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 5), )
if mibBuilder.loadTexts: hm2AgentPortMirrorTypeTable.setStatus('current')
hm2AgentPortMirrorTypeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 5, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentPortMirrorSessionNum"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentPortMirrorTypeSourcePort"))
if mibBuilder.loadTexts: hm2AgentPortMirrorTypeEntry.setStatus('current')
hm2AgentPortMirrorTypeSourcePort = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 5, 1, 1), Unsigned32())
if mibBuilder.loadTexts: hm2AgentPortMirrorTypeSourcePort.setStatus('current')
hm2AgentPortMirrorTypeType = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("tx", 1), ("rx", 2), ("txrx", 3))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorTypeType.setStatus('current')
hm2AgentPortMirrorRemoteVlan = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 6), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMirrorRemoteVlan.setStatus('current')
hm2AgentPortMirrorSNMPExtensionGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248))
hm2AgentPortMirrorVlanMirrorPortConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 1))
if mibBuilder.loadTexts: hm2AgentPortMirrorVlanMirrorPortConflict.setStatus('current')
hm2AgentPortMirrorPortVlanMirrorConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 2))
if mibBuilder.loadTexts: hm2AgentPortMirrorPortVlanMirrorConflict.setStatus('current')
hm2AgentPortMirrorProbePortAlreadySet = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 3))
if mibBuilder.loadTexts: hm2AgentPortMirrorProbePortAlreadySet.setStatus('current')
hm2AgentPortMirrorProbePortVlanConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 4))
if mibBuilder.loadTexts: hm2AgentPortMirrorProbePortVlanConflict.setStatus('current')
hm2AgentPortMirrorVlanNotCreated = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 5))
if mibBuilder.loadTexts: hm2AgentPortMirrorVlanNotCreated.setStatus('current')
hm2AgentPortMirrorInvalidSourcePort = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 6))
if mibBuilder.loadTexts: hm2AgentPortMirrorInvalidSourcePort.setStatus('current')
hm2AgentPortMirrorSourcePortDestinationPortConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 7))
if mibBuilder.loadTexts: hm2AgentPortMirrorSourcePortDestinationPortConflict.setStatus('current')
hm2AgentPortMirrorDestinationPortInvalid = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 8))
if mibBuilder.loadTexts: hm2AgentPortMirrorDestinationPortInvalid.setStatus('current')
hm2AgentPortMirrorVlanRspanVlanConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 9))
if mibBuilder.loadTexts: hm2AgentPortMirrorVlanRspanVlanConflict.setStatus('current')
hm2AgentPortMirrorRemoteSourceRemoteDestinationConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 10))
if mibBuilder.loadTexts: hm2AgentPortMirrorRemoteSourceRemoteDestinationConflict.setStatus('current')
hm2AgentPortMirrorReflectorPortInvalid = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 11))
if mibBuilder.loadTexts: hm2AgentPortMirrorReflectorPortInvalid.setStatus('current')
hm2AgentPortMirrorSourcePortReflectorPortConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 12))
if mibBuilder.loadTexts: hm2AgentPortMirrorSourcePortReflectorPortConflict.setStatus('current')
hm2AgentPortMirrorReflectorPortVlanConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 13))
if mibBuilder.loadTexts: hm2AgentPortMirrorReflectorPortVlanConflict.setStatus('current')
hm2AgentPortMirrorPrivateVlanConfigured = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 14))
if mibBuilder.loadTexts: hm2AgentPortMirrorPrivateVlanConfigured.setStatus('current')
hm2AgentPortMirrorDestinationRemotePortNotSet = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 15))
if mibBuilder.loadTexts: hm2AgentPortMirrorDestinationRemotePortNotSet.setStatus('current')
hm2AgentPortMirrorRspanVlanInconsistent = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 16))
if mibBuilder.loadTexts: hm2AgentPortMirrorRspanVlanInconsistent.setStatus('current')
hm2AgentPortMirrorRspanVlanIdInvalid = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 10, 248, 17))
if mibBuilder.loadTexts: hm2AgentPortMirrorRspanVlanIdInvalid.setStatus('current')
hm2AgentDot3adAggPortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 12), )
if mibBuilder.loadTexts: hm2AgentDot3adAggPortTable.setStatus('current')
hm2AgentDot3adAggPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 12, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDot3adAggPort"))
if mibBuilder.loadTexts: hm2AgentDot3adAggPortEntry.setStatus('current')
hm2AgentDot3adAggPort = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 12, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDot3adAggPort.setStatus('current')
hm2AgentDot3adAggPortLACPMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 12, 1, 2), HmEnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDot3adAggPortLACPMode.setStatus('current')
hm2AgentPortConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13), )
if mibBuilder.loadTexts: hm2AgentPortConfigTable.setStatus('current')
hm2AgentPortConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentPortDot1dBasePort"))
if mibBuilder.loadTexts: hm2AgentPortConfigEntry.setStatus('current')
hm2AgentPortDot1dBasePort = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentPortDot1dBasePort.setStatus('current')
hm2AgentPortIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentPortIfIndex.setStatus('current')
hm2AgentPortClearStats = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 10), HmEnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortClearStats.setStatus('current')
hm2AgentPortDot3FlowControlMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("symmetric", 1), ("asymmetric", 2), ("disable", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortDot3FlowControlMode.setStatus('current')
hm2AgentPortMaxFrameSizeLimit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 18), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentPortMaxFrameSizeLimit.setStatus('current')
hm2AgentPortMaxFrameSize = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 19), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMaxFrameSize.setStatus('current')
hm2AgentPortBroadcastControlMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 20), HmEnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortBroadcastControlMode.setStatus('current')
hm2AgentPortBroadcastControlThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 14880000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortBroadcastControlThreshold.setStatus('current')
hm2AgentPortMulticastControlMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 22), HmEnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMulticastControlMode.setStatus('current')
hm2AgentPortMulticastControlThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 14880000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMulticastControlThreshold.setStatus('current')
hm2AgentPortUnicastControlMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 24), HmEnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortUnicastControlMode.setStatus('current')
hm2AgentPortUnicastControlThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 14880000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortUnicastControlThreshold.setStatus('current')
hm2AgentPortBroadcastControlThresholdUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("percent", 1), ("pps", 2))).clone('percent')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortBroadcastControlThresholdUnit.setStatus('current')
hm2AgentPortMulticastControlThresholdUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 27), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("percent", 1), ("pps", 2))).clone('percent')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortMulticastControlThresholdUnit.setStatus('current')
hm2AgentPortUnicastControlThresholdUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 28), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("percent", 1), ("pps", 2))).clone('percent')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortUnicastControlThresholdUnit.setStatus('current')
hm2AgentPortVoiceVlanMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 29), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("none", 1), ("vlanid", 2), ("dot1p", 3), ("vlanidanddot1p", 4), ("untagged", 5), ("disable", 6)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanMode.setStatus('current')
hm2AgentPortVoiceVlanID = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4093))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanID.setStatus('current')
hm2AgentPortVoiceVlanPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 7), ValueRangeConstraint(255, 255), )).clone(255)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanPriority.setStatus('current')
hm2AgentPortVoiceVlanDataPriorityMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("trust", 1), ("untrust", 2))).clone('trust')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanDataPriorityMode.setStatus('current')
hm2AgentPortVoiceVlanOperationalStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanOperationalStatus.setStatus('current')
hm2AgentPortVoiceVlanUntagged = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("false", 0), ("true", 1))).clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanUntagged.setStatus('current')
hm2AgentPortVoiceVlanNoneMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 35), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("false", 0), ("true", 1))).clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanNoneMode.setStatus('current')
hm2AgentPortVoiceVlanDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 36), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanDSCP.setStatus('current')
hm2AgentPortVoiceVlanAuthMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 37), HmEnabledStatus().clone('enable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortVoiceVlanAuthMode.setStatus('current')
hm2AgentPortDot3FlowControlOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 38), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentPortDot3FlowControlOperStatus.setStatus('current')
hm2AgentPortSfpLinkLossAlert = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 13, 1, 248), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentPortSfpLinkLossAlert.setStatus('current')
hm2AgentProtocolConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14))
hm2AgentProtocolGroupTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 2), )
if mibBuilder.loadTexts: hm2AgentProtocolGroupTable.setStatus('current')
hm2AgentProtocolGroupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 2, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentProtocolGroupId"))
if mibBuilder.loadTexts: hm2AgentProtocolGroupEntry.setStatus('current')
hm2AgentProtocolGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)))
if mibBuilder.loadTexts: hm2AgentProtocolGroupId.setStatus('current')
hm2AgentProtocolGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 2, 1, 2), DisplayString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(1, 16), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentProtocolGroupName.setStatus('current')
hm2AgentProtocolGroupVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4093))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentProtocolGroupVlanId.setStatus('current')
hm2AgentProtocolGroupStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 2, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentProtocolGroupStatus.setStatus('current')
hm2AgentProtocolGroupPortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 3), )
if mibBuilder.loadTexts: hm2AgentProtocolGroupPortTable.setStatus('current')
hm2AgentProtocolGroupPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 3, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentProtocolGroupId"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentProtocolGroupPortIfIndex"))
if mibBuilder.loadTexts: hm2AgentProtocolGroupPortEntry.setStatus('current')
hm2AgentProtocolGroupPortIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentProtocolGroupPortIfIndex.setStatus('current')
hm2AgentProtocolGroupPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 3, 1, 2), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentProtocolGroupPortStatus.setStatus('current')
hm2AgentProtocolGroupProtocolTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 4), )
if mibBuilder.loadTexts: hm2AgentProtocolGroupProtocolTable.setStatus('current')
hm2AgentProtocolGroupProtocolEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 4, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentProtocolGroupId"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentProtocolGroupProtocolID"))
if mibBuilder.loadTexts: hm2AgentProtocolGroupProtocolEntry.setStatus('current')
hm2AgentProtocolGroupProtocolID = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1536, 65535)))
if mibBuilder.loadTexts: hm2AgentProtocolGroupProtocolID.setStatus('current')
hm2AgentProtocolGroupProtocolStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 14, 4, 1, 2), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentProtocolGroupProtocolStatus.setStatus('current')
hm2AgentStpSwitchConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15))
hm2AgentStpConfigDigestKey = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpConfigDigestKey.setStatus('current')
hm2AgentStpConfigFormatSelector = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpConfigFormatSelector.setStatus('current')
hm2AgentStpConfigName = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpConfigName.setStatus('current')
hm2AgentStpConfigRevision = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpConfigRevision.setStatus('current')
hm2AgentStpForceVersion = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("stp", 1), ("rstp", 2), ("mstp", 3))).clone('rstp')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpForceVersion.setStatus('current')
hm2AgentStpAdminMode = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 6), HmEnabledStatus().clone('enable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpAdminMode.setStatus('current')
hm2AgentStpPortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7), )
if mibBuilder.loadTexts: hm2AgentStpPortTable.setStatus('current')
hm2AgentStpPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentStpPortEntry.setStatus('current')
hm2AgentStpPortState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 1), HmEnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpPortState.setStatus('current')
hm2AgentStpPortStatsMstpBpduRx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpPortStatsMstpBpduRx.setStatus('current')
hm2AgentStpPortStatsMstpBpduTx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpPortStatsMstpBpduTx.setStatus('current')
hm2AgentStpPortStatsRstpBpduRx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpPortStatsRstpBpduRx.setStatus('current')
hm2AgentStpPortStatsRstpBpduTx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpPortStatsRstpBpduTx.setStatus('current')
hm2AgentStpPortStatsStpBpduRx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpPortStatsStpBpduRx.setStatus('current')
hm2AgentStpPortStatsStpBpduTx = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpPortStatsStpBpduTx.setStatus('current')
hm2AgentStpPortUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 8), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpPortUpTime.setStatus('current')
hm2AgentStpPortMigrationCheck = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 7, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("false", 0), ("true", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpPortMigrationCheck.setStatus('current')
hm2AgentStpCstConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8))
hm2AgentStpCstHelloTime = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstHelloTime.setStatus('current')
hm2AgentStpCstMaxAge = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstMaxAge.setStatus('current')
hm2AgentStpCstRegionalRootId = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstRegionalRootId.setStatus('current')
hm2AgentStpCstRegionalRootPathCost = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstRegionalRootPathCost.setStatus('current')
hm2AgentStpCstRootFwdDelay = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstRootFwdDelay.setStatus('current')
hm2AgentStpCstBridgeFwdDelay = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(4, 30)).clone(15)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstBridgeFwdDelay.setStatus('current')
hm2AgentStpCstBridgeHelloTime = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2)).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstBridgeHelloTime.setStatus('current')
hm2AgentStpCstBridgeHoldTime = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 8), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstBridgeHoldTime.setStatus('current')
hm2AgentStpCstBridgeMaxAge = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(6, 40)).clone(20)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstBridgeMaxAge.setStatus('current')
hm2AgentStpCstBridgeMaxHops = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 10), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(6, 40)).clone(20)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstBridgeMaxHops.setStatus('current')
hm2AgentStpCstBridgePriority = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 61440)).clone(32768)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstBridgePriority.setStatus('current')
hm2AgentStpCstBridgeHoldCount = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 8, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 40)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstBridgeHoldCount.setStatus('current')
hm2AgentStpCstPortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9), )
if mibBuilder.loadTexts: hm2AgentStpCstPortTable.setStatus('current')
hm2AgentStpCstPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentStpCstPortEntry.setStatus('current')
hm2AgentStpCstPortOperEdge = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 1), HmEnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstPortOperEdge.setStatus('current')
hm2AgentStpCstPortOperPointToPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstPortOperPointToPoint.setStatus('current')
hm2AgentStpCstPortTopologyChangeAck = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstPortTopologyChangeAck.setStatus('current')
hm2AgentStpCstPortEdge = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 4), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortEdge.setStatus('current')
hm2AgentStpCstPortForwardingState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("discarding", 1), ("learning", 2), ("forwarding", 3), ("disabled", 4), ("manualFwd", 5), ("notParticipate", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstPortForwardingState.setStatus('current')
hm2AgentStpCstPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstPortId.setStatus('current')
hm2AgentStpCstPortPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 200000000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortPathCost.setStatus('current')
hm2AgentStpCstPortPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 240)).clone(128)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortPriority.setStatus('current')
hm2AgentStpCstDesignatedBridgeId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstDesignatedBridgeId.setStatus('current')
hm2AgentStpCstDesignatedCost = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstDesignatedCost.setStatus('current')
hm2AgentStpCstDesignatedPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstDesignatedPortId.setStatus('current')
hm2AgentStpCstExtPortPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 200000000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstExtPortPathCost.setStatus('current')
hm2AgentStpCstPortBpduGuardEffect = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 13), HmEnabledStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstPortBpduGuardEffect.setStatus('current')
hm2AgentStpCstPortBpduFilter = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 14), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortBpduFilter.setStatus('current')
hm2AgentStpCstPortBpduFlood = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 15), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortBpduFlood.setStatus('current')
hm2AgentStpCstPortAutoEdge = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 16), HmEnabledStatus().clone('enable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortAutoEdge.setStatus('current')
hm2AgentStpCstPortRootGuard = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 17), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortRootGuard.setStatus('current')
hm2AgentStpCstPortTCNGuard = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 18), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortTCNGuard.setStatus('current')
hm2AgentStpCstPortLoopGuard = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 9, 1, 19), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpCstPortLoopGuard.setStatus('current')
hm2AgentStpMstTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10), )
if mibBuilder.loadTexts: hm2AgentStpMstTable.setStatus('current')
hm2AgentStpMstEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpMstId"))
if mibBuilder.loadTexts: hm2AgentStpMstEntry.setStatus('current')
hm2AgentStpMstId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstId.setStatus('current')
hm2AgentStpMstBridgePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 61440)).clone(32768)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpMstBridgePriority.setStatus('current')
hm2AgentStpMstBridgeIdentifier = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstBridgeIdentifier.setStatus('current')
hm2AgentStpMstDesignatedRootId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstDesignatedRootId.setStatus('current')
hm2AgentStpMstRootPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstRootPathCost.setStatus('current')
hm2AgentStpMstRootPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstRootPortId.setStatus('current')
hm2AgentStpMstTimeSinceTopologyChange = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 7), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstTimeSinceTopologyChange.setStatus('current')
hm2AgentStpMstTopologyChangeCount = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstTopologyChangeCount.setStatus('current')
hm2AgentStpMstTopologyChangeParm = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstTopologyChangeParm.setStatus('current')
hm2AgentStpMstRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 10, 1, 10), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStpMstRowStatus.setStatus('current')
hm2AgentStpMstPortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11), )
if mibBuilder.loadTexts: hm2AgentStpMstPortTable.setStatus('current')
hm2AgentStpMstPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpMstId"), (0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentStpMstPortEntry.setStatus('current')
hm2AgentStpMstPortForwardingState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("discarding", 1), ("learning", 2), ("forwarding", 3), ("disabled", 4), ("manualFwd", 5), ("notParticipate", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortForwardingState.setStatus('current')
hm2AgentStpMstPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortId.setStatus('current')
hm2AgentStpMstPortPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 200000000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpMstPortPathCost.setStatus('current')
hm2AgentStpMstPortPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 240)).clone(128)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpMstPortPriority.setStatus('current')
hm2AgentStpMstDesignatedBridgeId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstDesignatedBridgeId.setStatus('current')
hm2AgentStpMstDesignatedCost = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 6), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstDesignatedCost.setStatus('current')
hm2AgentStpMstDesignatedPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstDesignatedPortId.setStatus('current')
hm2AgentStpMstPortLoopInconsistentState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("false", 0), ("true", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortLoopInconsistentState.setStatus('current')
hm2AgentStpMstPortTransitionsIntoLoopInconsistentState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortTransitionsIntoLoopInconsistentState.setStatus('current')
hm2AgentStpMstPortTransitionsOutOfLoopInconsistentState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortTransitionsOutOfLoopInconsistentState.setStatus('current')
hm2AgentStpMstPortRole = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 248), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("root", 1), ("alternate", 2), ("designated", 3), ("backup", 4), ("master", 5), ("disabled", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortRole.setStatus('current')
hm2AgentStpCstAutoPortPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 249), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("false", 0), ("true", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpCstAutoPortPathCost.setStatus('current')
hm2AgentStpMstPortReceivedBridgeId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 250), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortReceivedBridgeId.setStatus('current')
hm2AgentStpMstPortReceivedRPC = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 251), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortReceivedRPC.setStatus('current')
hm2AgentStpMstPortReceivedPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 252), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortReceivedPortId.setStatus('current')
hm2AgentStpMstAutoPortPathCost = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 253), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("false", 0), ("true", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstAutoPortPathCost.setStatus('current')
hm2AgentStpMstPortReceivedRegionalRPC = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 11, 1, 254), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStpMstPortReceivedRegionalRPC.setStatus('current')
hm2AgentStpMstVlanTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 12), )
if mibBuilder.loadTexts: hm2AgentStpMstVlanTable.setStatus('current')
hm2AgentStpMstVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 12, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpMstId"), (0, "Q-BRIDGE-MIB", "dot1qVlanIndex"))
if mibBuilder.loadTexts: hm2AgentStpMstVlanEntry.setStatus('current')
hm2AgentStpMstVlanRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 12, 1, 1), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStpMstVlanRowStatus.setStatus('current')
hm2AgentStpBpduGuardMode = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 13), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpBpduGuardMode.setStatus('current')
hm2AgentStpBpduFilterDefault = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 14), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpBpduFilterDefault.setStatus('current')
hm2AgentStpRingOnlyMode = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 248), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpRingOnlyMode.setStatus('current')
hm2AgentStpRingOnlyModeIntfOne = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 249), InterfaceIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpRingOnlyModeIntfOne.setStatus('current')
hm2AgentStpRingOnlyModeIntfTwo = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 250), InterfaceIndexOrZero()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentStpRingOnlyModeIntfTwo.setStatus('current')
hm2AgentStpMstSNMPExtensionGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 260))
hm2AgentStpMstInstanceVlanErrorReturn = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 260, 1))
if mibBuilder.loadTexts: hm2AgentStpMstInstanceVlanErrorReturn.setStatus('current')
hm2AgentStpCstFwdDelayErrorReturn = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 260, 2))
if mibBuilder.loadTexts: hm2AgentStpCstFwdDelayErrorReturn.setStatus('current')
hm2AgentStpMstSwitchVersionConflict = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 15, 260, 3))
if mibBuilder.loadTexts: hm2AgentStpMstSwitchVersionConflict.setStatus('current')
hm2AgentClassOfServiceGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 17))
hm2AgentClassOfServicePortTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 17, 1), )
if mibBuilder.loadTexts: hm2AgentClassOfServicePortTable.setStatus('current')
hm2AgentClassOfServicePortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 17, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentClassOfServicePortPriority"))
if mibBuilder.loadTexts: hm2AgentClassOfServicePortEntry.setStatus('current')
hm2AgentClassOfServicePortPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 17, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7)))
if mibBuilder.loadTexts: hm2AgentClassOfServicePortPriority.setStatus('current')
hm2AgentClassOfServicePortClass = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 17, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentClassOfServicePortClass.setStatus('current')
hm2AgentSystemGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 3))
hm2AgentClearVlan = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 3, 9), HmEnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentClearVlan.setStatus('current')
hm2AgentDaiConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21))
hm2AgentDaiSrcMacValidate = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiSrcMacValidate.setStatus('current')
hm2AgentDaiDstMacValidate = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiDstMacValidate.setStatus('current')
hm2AgentDaiIPValidate = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 3), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiIPValidate.setStatus('current')
hm2AgentDaiVlanConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 4), )
if mibBuilder.loadTexts: hm2AgentDaiVlanConfigTable.setStatus('current')
hm2AgentDaiVlanConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 4, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDaiVlanIndex"))
if mibBuilder.loadTexts: hm2AgentDaiVlanConfigEntry.setStatus('current')
hm2AgentDaiVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 4, 1, 1), VlanIndex())
if mibBuilder.loadTexts: hm2AgentDaiVlanIndex.setStatus('current')
hm2AgentDaiVlanDynArpInspEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 4, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiVlanDynArpInspEnable.setStatus('current')
hm2AgentDaiVlanLoggingEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 4, 1, 3), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiVlanLoggingEnable.setStatus('current')
hm2AgentDaiVlanArpAclName = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 4, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiVlanArpAclName.setStatus('current')
hm2AgentDaiVlanArpAclStaticFlag = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 4, 1, 5), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiVlanArpAclStaticFlag.setStatus('current')
hm2AgentDaiVlanBindingCheckEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 4, 1, 248), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiVlanBindingCheckEnable.setStatus('current')
hm2AgentDaiStatsReset = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("reset", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiStatsReset.setStatus('current')
hm2AgentDaiVlanStatsTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6), )
if mibBuilder.loadTexts: hm2AgentDaiVlanStatsTable.setStatus('current')
hm2AgentDaiVlanStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDaiVlanStatsIndex"))
if mibBuilder.loadTexts: hm2AgentDaiVlanStatsEntry.setStatus('current')
hm2AgentDaiVlanStatsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 1), VlanIndex())
if mibBuilder.loadTexts: hm2AgentDaiVlanStatsIndex.setStatus('current')
hm2AgentDaiVlanPktsForwarded = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanPktsForwarded.setStatus('current')
hm2AgentDaiVlanPktsDropped = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanPktsDropped.setStatus('current')
hm2AgentDaiVlanDhcpDrops = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanDhcpDrops.setStatus('current')
hm2AgentDaiVlanDhcpPermits = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanDhcpPermits.setStatus('current')
hm2AgentDaiVlanAclDrops = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanAclDrops.setStatus('current')
hm2AgentDaiVlanAclPermits = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanAclPermits.setStatus('current')
hm2AgentDaiVlanSrcMacFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanSrcMacFailures.setStatus('current')
hm2AgentDaiVlanDstMacFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanDstMacFailures.setStatus('current')
hm2AgentDaiVlanIpValidFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 6, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDaiVlanIpValidFailures.setStatus('current')
hm2AgentDaiIfConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 7), )
if mibBuilder.loadTexts: hm2AgentDaiIfConfigTable.setStatus('current')
hm2AgentDaiIfConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 7, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentDaiIfConfigEntry.setStatus('current')
hm2AgentDaiIfTrustEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 7, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiIfTrustEnable.setStatus('current')
hm2AgentDaiIfRateLimit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 7, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(-1, -1), ValueRangeConstraint(0, 300), )).clone(-1)).setUnits('packets per second').setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiIfRateLimit.setStatus('current')
hm2AgentDaiIfBurstInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 7, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiIfBurstInterval.setStatus('current')
hm2AgentDaiIfAutoDisable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 21, 7, 1, 248), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDaiIfAutoDisable.setStatus('current')
hm2AgentArpAclGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22))
hm2AgentArpAclTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 1), )
if mibBuilder.loadTexts: hm2AgentArpAclTable.setStatus('current')
hm2AgentArpAclEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 1, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentArpAclName"))
if mibBuilder.loadTexts: hm2AgentArpAclEntry.setStatus('current')
hm2AgentArpAclName = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentArpAclName.setStatus('current')
hm2AgentArpAclRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 1, 1, 2), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentArpAclRowStatus.setStatus('current')
hm2AgentArpAclRuleTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 2), )
if mibBuilder.loadTexts: hm2AgentArpAclRuleTable.setStatus('current')
hm2AgentArpAclRuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 2, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentArpAclName"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentArpAclRuleMatchSenderIpAddr"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentArpAclRuleMatchSenderMacAddr"))
if mibBuilder.loadTexts: hm2AgentArpAclRuleEntry.setStatus('current')
hm2AgentArpAclRuleMatchSenderIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 2, 1, 1), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentArpAclRuleMatchSenderIpAddr.setStatus('current')
hm2AgentArpAclRuleMatchSenderMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 2, 1, 2), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentArpAclRuleMatchSenderMacAddr.setStatus('current')
hm2AgentArpAclRuleRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 22, 2, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentArpAclRuleRowStatus.setStatus('current')
hm2AgentDhcpSnoopingConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23))
hm2AgentDhcpSnoopingAdminMode = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingAdminMode.setStatus('current')
hm2AgentDhcpSnoopingVerifyMac = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingVerifyMac.setStatus('current')
hm2AgentDhcpSnoopingVlanConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 3), )
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingVlanConfigTable.setStatus('current')
hm2AgentDhcpSnoopingVlanConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 3, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDhcpSnoopingVlanIndex"))
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingVlanConfigEntry.setStatus('current')
hm2AgentDhcpSnoopingVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 3, 1, 1), VlanIndex())
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingVlanIndex.setStatus('current')
hm2AgentDhcpSnoopingVlanEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 3, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingVlanEnable.setStatus('current')
hm2AgentDhcpSnoopingIfConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 4), )
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingIfConfigTable.setStatus('current')
hm2AgentDhcpSnoopingIfConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 4, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingIfConfigEntry.setStatus('current')
hm2AgentDhcpSnoopingIfTrustEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 4, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingIfTrustEnable.setStatus('current')
hm2AgentDhcpSnoopingIfLogEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 4, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingIfLogEnable.setStatus('current')
hm2AgentDhcpSnoopingIfRateLimit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(-1, -1), ValueRangeConstraint(0, 150), )).clone(-1)).setUnits('packets per second').setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingIfRateLimit.setStatus('current')
hm2AgentDhcpSnoopingIfBurstInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 4, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 15)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingIfBurstInterval.setStatus('current')
hm2AgentDhcpSnoopingIfAutoDisable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 4, 1, 248), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingIfAutoDisable.setStatus('current')
hm2AgentIpsgIfConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 5), )
if mibBuilder.loadTexts: hm2AgentIpsgIfConfigTable.setStatus('current')
hm2AgentIpsgIfConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 5, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentIpsgIfConfigEntry.setStatus('current')
hm2AgentIpsgIfVerifySource = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 5, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentIpsgIfVerifySource.setStatus('current')
hm2AgentIpsgIfPortSecurity = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 5, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentIpsgIfPortSecurity.setStatus('current')
hm2AgentDhcpSnoopingStatsReset = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("reset", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingStatsReset.setStatus('current')
hm2AgentDhcpSnoopingStatsTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 7), )
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingStatsTable.setStatus('current')
hm2AgentDhcpSnoopingStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 7, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingStatsEntry.setStatus('current')
hm2AgentDhcpSnoopingMacVerifyFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 7, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingMacVerifyFailures.setStatus('current')
hm2AgentDhcpSnoopingInvalidClientMessages = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 7, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingInvalidClientMessages.setStatus('current')
hm2AgentDhcpSnoopingInvalidServerMessages = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 7, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingInvalidServerMessages.setStatus('current')
hm2AgentStaticIpsgBindingTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 8), )
if mibBuilder.loadTexts: hm2AgentStaticIpsgBindingTable.setStatus('current')
hm2AgentStaticIpsgBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 8, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStaticIpsgBindingIfIndex"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStaticIpsgBindingVlanId"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStaticIpsgBindingMacAddr"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStaticIpsgBindingIpAddr"))
if mibBuilder.loadTexts: hm2AgentStaticIpsgBindingEntry.setStatus('current')
hm2AgentStaticIpsgBindingIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 8, 1, 1), InterfaceIndex()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticIpsgBindingIfIndex.setStatus('current')
hm2AgentStaticIpsgBindingVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 8, 1, 2), VlanIndex()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticIpsgBindingVlanId.setStatus('current')
hm2AgentStaticIpsgBindingMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 8, 1, 3), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticIpsgBindingMacAddr.setStatus('current')
hm2AgentStaticIpsgBindingIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 8, 1, 4), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticIpsgBindingIpAddr.setStatus('current')
hm2AgentStaticIpsgBindingRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 8, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticIpsgBindingRowStatus.setStatus('current')
hm2AgentStaticIpsgBindingHwStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 8, 1, 248), TruthValue().clone('false')).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentStaticIpsgBindingHwStatus.setStatus('current')
hm2AgentDynamicIpsgBindingTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 9), )
if mibBuilder.loadTexts: hm2AgentDynamicIpsgBindingTable.setStatus('current')
hm2AgentDynamicIpsgBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 9, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDynamicIpsgBindingIfIndex"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDynamicIpsgBindingVlanId"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDynamicIpsgBindingMacAddr"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDynamicIpsgBindingIpAddr"))
if mibBuilder.loadTexts: hm2AgentDynamicIpsgBindingEntry.setStatus('current')
hm2AgentDynamicIpsgBindingIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 9, 1, 1), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicIpsgBindingIfIndex.setStatus('current')
hm2AgentDynamicIpsgBindingVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 9, 1, 2), VlanIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicIpsgBindingVlanId.setStatus('current')
hm2AgentDynamicIpsgBindingMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 9, 1, 3), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicIpsgBindingMacAddr.setStatus('current')
hm2AgentDynamicIpsgBindingIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 9, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicIpsgBindingIpAddr.setStatus('current')
hm2AgentDynamicIpsgBindingHwStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 9, 1, 248), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicIpsgBindingHwStatus.setStatus('current')
hm2AgentStaticDsBindingTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 10), )
if mibBuilder.loadTexts: hm2AgentStaticDsBindingTable.setStatus('current')
hm2AgentStaticDsBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 10, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStaticDsBindingMacAddr"))
if mibBuilder.loadTexts: hm2AgentStaticDsBindingEntry.setStatus('current')
hm2AgentStaticDsBindingIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 10, 1, 1), InterfaceIndexOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticDsBindingIfIndex.setStatus('current')
hm2AgentStaticDsBindingVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 10, 1, 2), VlanId().clone(1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticDsBindingVlanId.setStatus('current')
hm2AgentStaticDsBindingMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 10, 1, 3), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticDsBindingMacAddr.setStatus('current')
hm2AgentStaticDsBindingIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 10, 1, 4), IpAddress().clone(hexValue="00000000")).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticDsBindingIpAddr.setStatus('current')
hm2AgentStaticDsBindingRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 10, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2AgentStaticDsBindingRowStatus.setStatus('current')
hm2AgentDynamicDsBindingTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 11), )
if mibBuilder.loadTexts: hm2AgentDynamicDsBindingTable.setStatus('current')
hm2AgentDynamicDsBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 11, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDynamicDsBindingMacAddr"))
if mibBuilder.loadTexts: hm2AgentDynamicDsBindingEntry.setStatus('current')
hm2AgentDynamicDsBindingIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 11, 1, 1), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicDsBindingIfIndex.setStatus('current')
hm2AgentDynamicDsBindingVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 11, 1, 2), VlanIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicDsBindingVlanId.setStatus('current')
hm2AgentDynamicDsBindingMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 11, 1, 3), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicDsBindingMacAddr.setStatus('current')
hm2AgentDynamicDsBindingIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 11, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicDsBindingIpAddr.setStatus('current')
hm2AgentDynamicDsBindingLeaseRemainingTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 11, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDynamicDsBindingLeaseRemainingTime.setStatus('current')
hm2AgentDhcpSnoopingRemoteFileName = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 12), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingRemoteFileName.setStatus('current')
hm2AgentDhcpSnoopingRemoteIpAddr = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 13), IpAddress().clone(hexValue="00000000")).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingRemoteIpAddr.setStatus('current')
hm2AgentDhcpSnoopingStoreInterval = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 23, 14), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(15, 86400)).clone(300)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpSnoopingStoreInterval.setStatus('current')
hm2AgentDhcpL2RelayConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24))
hm2AgentDhcpL2RelayAdminMode = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayAdminMode.setStatus('current')
hm2AgentDhcpL2RelayIfConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 2), )
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayIfConfigTable.setStatus('current')
hm2AgentDhcpL2RelayIfConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayIfConfigEntry.setStatus('current')
hm2AgentDhcpL2RelayIfEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 2, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayIfEnable.setStatus('current')
hm2AgentDhcpL2RelayIfTrustEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 2, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayIfTrustEnable.setStatus('current')
hm2AgentDhcpL2RelayVlanConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 3), )
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayVlanConfigTable.setStatus('current')
hm2AgentDhcpL2RelayVlanConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 3, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentDhcpL2RelayVlanIndex"))
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayVlanConfigEntry.setStatus('current')
hm2AgentDhcpL2RelayVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 3, 1, 1), VlanIndex())
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayVlanIndex.setStatus('current')
hm2AgentDhcpL2RelayVlanEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 3, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayVlanEnable.setStatus('current')
hm2AgentDhcpL2RelayCircuitIdVlanEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 3, 1, 3), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayCircuitIdVlanEnable.setStatus('current')
hm2AgentDhcpL2RelayRemoteIdVlanEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 3, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayRemoteIdVlanEnable.setStatus('current')
hm2AgentDhcpL2RelayVlanRemoteIdType = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 3, 1, 248), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("ip", 1), ("mac", 2), ("client-id", 3), ("other", 4))).clone('mac')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayVlanRemoteIdType.setStatus('current')
hm2AgentDhcpL2RelayStatsReset = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("reset", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayStatsReset.setStatus('current')
hm2AgentDhcpL2RelayStatsTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 7), )
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayStatsTable.setStatus('current')
hm2AgentDhcpL2RelayStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 7, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayStatsEntry.setStatus('current')
hm2AgentDhcpL2RelayUntrustedSrvrMsgsWithOptn82 = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 7, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayUntrustedSrvrMsgsWithOptn82.setStatus('current')
hm2AgentDhcpL2RelayUntrustedClntMsgsWithOptn82 = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 7, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayUntrustedClntMsgsWithOptn82.setStatus('current')
hm2AgentDhcpL2RelayTrustedSrvrMsgsWithoutOptn82 = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 7, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayTrustedSrvrMsgsWithoutOptn82.setStatus('current')
hm2AgentDhcpL2RelayTrustedClntMsgsWithoutOptn82 = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 24, 7, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentDhcpL2RelayTrustedClntMsgsWithoutOptn82.setStatus('current')
hm2AgentSwitchVoiceVLANGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 25))
hm2AgentSwitchVoiceVLANAdminMode = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 25, 1), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSwitchVoiceVLANAdminMode.setStatus('current')
hm2AgentSwitchVoiceVlanDeviceTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 25, 2), )
if mibBuilder.loadTexts: hm2AgentSwitchVoiceVlanDeviceTable.setStatus('current')
hm2AgentSwitchVoiceVlanDeviceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 25, 2, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchVoiceVlanInterfaceNum"), (0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSwitchVoiceVlanDeviceMacAddress"))
if mibBuilder.loadTexts: hm2AgentSwitchVoiceVlanDeviceEntry.setStatus('current')
hm2AgentSwitchVoiceVlanInterfaceNum = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 25, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchVoiceVlanInterfaceNum.setStatus('current')
hm2AgentSwitchVoiceVlanDeviceMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 25, 2, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSwitchVoiceVlanDeviceMacAddress.setStatus('current')
hm2AgentSdmPreferConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 27))
hm2AgentSdmPreferCurrentTemplate = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 27, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3, 10, 11))).clone(namedValues=NamedValues(("ipv4RoutingDefault", 2), ("ipv4DataCenter", 3), ("ipv4RoutingUnicast", 10), ("ipv4RoutingMulticast", 11)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentSdmPreferCurrentTemplate.setStatus('current')
hm2AgentSdmPreferNextTemplate = MibScalar((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 27, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 2, 3, 10, 11))).clone(namedValues=NamedValues(("default", 0), ("ipv4RoutingDefault", 2), ("ipv4DataCenter", 3), ("ipv4RoutingUnicast", 10), ("ipv4RoutingMulticast", 11)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2AgentSdmPreferNextTemplate.setStatus('current')
hm2AgentSdmTemplateSummaryTable = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28))
hm2AgentSdmTemplateTable = MibTable((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1), )
if mibBuilder.loadTexts: hm2AgentSdmTemplateTable.setStatus('current')
hm2AgentSdmTemplateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1), ).setIndexNames((0, "HM2-PLATFORM-SWITCHING-MIB", "hm2AgentSdmTemplateId"))
if mibBuilder.loadTexts: hm2AgentSdmTemplateEntry.setStatus('current')
hm2AgentSdmTemplateId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3, 10, 11))).clone(namedValues=NamedValues(("ipv4RoutingDefault", 2), ("ipv4DataCenter", 3), ("ipv4RoutingUnicast", 10), ("ipv4RoutingMulticast", 11))))
if mibBuilder.loadTexts: hm2AgentSdmTemplateId.setStatus('current')
hm2AgentArpEntries = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentArpEntries.setStatus('current')
hm2AgentIPv4UnicastRoutes = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentIPv4UnicastRoutes.setStatus('current')
hm2AgentIPv6NdpEntries = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentIPv6NdpEntries.setStatus('current')
hm2AgentIPv6UnicastRoutes = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentIPv6UnicastRoutes.setStatus('current')
hm2AgentEcmpNextHops = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentEcmpNextHops.setStatus('current')
hm2AgentIPv4MulticastRoutes = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentIPv4MulticastRoutes.setStatus('current')
hm2AgentIPv6MulticastRoutes = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 12, 1, 2, 8, 28, 1, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2AgentIPv6MulticastRoutes.setStatus('current')
hm2PlatformSwitchingTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 12, 1, 0))
hm2PlatformStpInstanceNewRootTrap = NotificationType((1, 3, 6, 1, 4, 1, 248, 12, 1, 0, 10)).setObjects(("HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpMstId"))
if mibBuilder.loadTexts: hm2PlatformStpInstanceNewRootTrap.setStatus('current')
hm2PlatformStpInstanceTopologyChangeTrap = NotificationType((1, 3, 6, 1, 4, 1, 248, 12, 1, 0, 11)).setObjects(("HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpMstId"))
if mibBuilder.loadTexts: hm2PlatformStpInstanceTopologyChangeTrap.setStatus('current')
hm2PlatformDaiIntfErrorDisabledTrap = NotificationType((1, 3, 6, 1, 4, 1, 248, 12, 1, 0, 15)).setObjects(("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2PlatformDaiIntfErrorDisabledTrap.setStatus('current')
hm2PlatformStpInstanceLoopInconsistentStartTrap = NotificationType((1, 3, 6, 1, 4, 1, 248, 12, 1, 0, 16)).setObjects(("HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpMstId"), ("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2PlatformStpInstanceLoopInconsistentStartTrap.setStatus('current')
hm2PlatformStpInstanceLoopInconsistentEndTrap = NotificationType((1, 3, 6, 1, 4, 1, 248, 12, 1, 0, 17)).setObjects(("HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpMstId"), ("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2PlatformStpInstanceLoopInconsistentEndTrap.setStatus('current')
hm2PlatformDhcpSnoopingIntfErrorDisabledTrap = NotificationType((1, 3, 6, 1, 4, 1, 248, 12, 1, 0, 18)).setObjects(("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hm2PlatformDhcpSnoopingIntfErrorDisabledTrap.setStatus('current')
hm2PlatformStpCstBpduGuardTrap = NotificationType((1, 3, 6, 1, 4, 1, 248, 12, 1, 0, 248)).setObjects(("IF-MIB", "ifIndex"), ("HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpCstPortEdge"), ("HM2-PLATFORM-SWITCHING-MIB", "hm2AgentStpCstPortBpduGuardEffect"))
if mibBuilder.loadTexts: hm2PlatformStpCstBpduGuardTrap.setStatus('current')
mibBuilder.exportSymbols("HM2-PLATFORM-SWITCHING-MIB", hm2AgentStpSwitchConfigGroup=hm2AgentStpSwitchConfigGroup, Hm2AgentPortMask=Hm2AgentPortMask, hm2AgentProtocolGroupPortIfIndex=hm2AgentProtocolGroupPortIfIndex, hm2AgentSwitchProtectedPortGroupName=hm2AgentSwitchProtectedPortGroupName, hm2AgentSdmPreferConfigGroup=hm2AgentSdmPreferConfigGroup, hm2AgentDhcpL2RelayVlanRemoteIdType=hm2AgentDhcpL2RelayVlanRemoteIdType, hm2AgentSwitchSnoopingQuerierCfgTable=hm2AgentSwitchSnoopingQuerierCfgTable, hm2AgentStpMstTopologyChangeCount=hm2AgentStpMstTopologyChangeCount, hm2AgentDhcpL2RelayCircuitIdVlanEnable=hm2AgentDhcpL2RelayCircuitIdVlanEnable, hm2AgentSwitchMFDBType=hm2AgentSwitchMFDBType, hm2AgentSwitchProtectedPortPortList=hm2AgentSwitchProtectedPortPortList, hm2AgentDhcpSnoopingInvalidClientMessages=hm2AgentDhcpSnoopingInvalidClientMessages, hm2AgentClassOfServiceGroup=hm2AgentClassOfServiceGroup, hm2AgentProtocolGroupProtocolStatus=hm2AgentProtocolGroupProtocolStatus, hm2AgentPortMirrorRspanVlanIdInvalid=hm2AgentPortMirrorRspanVlanIdInvalid, hm2AgentIpsgIfPortSecurity=hm2AgentIpsgIfPortSecurity, hm2AgentSwitchSnoopingCfgEntry=hm2AgentSwitchSnoopingCfgEntry, hm2AgentDhcpSnoopingStatsReset=hm2AgentDhcpSnoopingStatsReset, hm2AgentSwitchStaticMacFilteringSourcePortMask=hm2AgentSwitchStaticMacFilteringSourcePortMask, hm2AgentStpPortStatsMstpBpduRx=hm2AgentStpPortStatsMstpBpduRx, hm2AgentDynamicDsBindingTable=hm2AgentDynamicDsBindingTable, hm2AgentSwitchMFDBGroup=hm2AgentSwitchMFDBGroup, hm2AgentDhcpL2RelayIfConfigTable=hm2AgentDhcpL2RelayIfConfigTable, hm2AgentSwitchMFDBFilteringPortMask=hm2AgentSwitchMFDBFilteringPortMask, hm2AgentDhcpL2RelayStatsEntry=hm2AgentDhcpL2RelayStatsEntry, hm2AgentStaticIpsgBindingIpAddr=hm2AgentStaticIpsgBindingIpAddr, hm2AgentStpMstTimeSinceTopologyChange=hm2AgentStpMstTimeSinceTopologyChange, hm2PlatformStpCstBpduGuardTrap=hm2PlatformStpCstBpduGuardTrap, hm2AgentDhcpSnoopingVlanIndex=hm2AgentDhcpSnoopingVlanIndex, hm2AgentPortMirrorTypeSourcePort=hm2AgentPortMirrorTypeSourcePort, hm2AgentProtocolGroupStatus=hm2AgentProtocolGroupStatus, hm2AgentPortMirrorInvalidSourcePort=hm2AgentPortMirrorInvalidSourcePort, hm2AgentSwitchMFDBCurrentEntries=hm2AgentSwitchMFDBCurrentEntries, hm2AgentDhcpL2RelayStatsReset=hm2AgentDhcpL2RelayStatsReset, hm2AgentLagSummaryAdminMode=hm2AgentLagSummaryAdminMode, hm2AgentStpCstPortForwardingState=hm2AgentStpCstPortForwardingState, hm2AgentPortMirrorProbePortAlreadySet=hm2AgentPortMirrorProbePortAlreadySet, hm2AgentClassOfServicePortTable=hm2AgentClassOfServicePortTable, hm2AgentStaticIpsgBindingVlanId=hm2AgentStaticIpsgBindingVlanId, hm2AgentArpAclRuleTable=hm2AgentArpAclRuleTable, hm2AgentArpEntries=hm2AgentArpEntries, hm2AgentLagConfigGroup=hm2AgentLagConfigGroup, hm2AgentStpConfigName=hm2AgentStpConfigName, hm2AgentStpRingOnlyModeIntfTwo=hm2AgentStpRingOnlyModeIntfTwo, hm2AgentStpMstPortReceivedRPC=hm2AgentStpMstPortReceivedRPC, hm2AgentDhcpSnoopingIfConfigEntry=hm2AgentDhcpSnoopingIfConfigEntry, hm2AgentDhcpL2RelayIfConfigEntry=hm2AgentDhcpL2RelayIfConfigEntry, hm2AgentLagSummaryDeletePort=hm2AgentLagSummaryDeletePort, hm2AgentSwitchVlanSubnetAssociationGroup=hm2AgentSwitchVlanSubnetAssociationGroup, hm2AgentStpMstSNMPExtensionGroup=hm2AgentStpMstSNMPExtensionGroup, hm2AgentStpCstBridgeHoldCount=hm2AgentStpCstBridgeHoldCount, hm2AgentPortMulticastControlThreshold=hm2AgentPortMulticastControlThreshold, hm2AgentDhcpSnoopingConfigGroup=hm2AgentDhcpSnoopingConfigGroup, hm2AgentSwitchProtectedPortEntry=hm2AgentSwitchProtectedPortEntry, hm2AgentSwitchStaticMacEntries=hm2AgentSwitchStaticMacEntries, hm2AgentDynamicDsBindingIfIndex=hm2AgentDynamicDsBindingIfIndex, hm2AgentStpCstPortEntry=hm2AgentStpCstPortEntry, hm2AgentLagSummaryStatus=hm2AgentLagSummaryStatus, hm2AgentSwitchProtectedPortGroupId=hm2AgentSwitchProtectedPortGroupId, hm2AgentLagSummaryConfigEntry=hm2AgentLagSummaryConfigEntry, hm2AgentSwitchVlanSubnetAssociationVlanId=hm2AgentSwitchVlanSubnetAssociationVlanId, hm2AgentStaticIpsgBindingEntry=hm2AgentStaticIpsgBindingEntry, hm2AgentArpAclGroup=hm2AgentArpAclGroup, hm2AgentDhcpSnoopingStoreInterval=hm2AgentDhcpSnoopingStoreInterval, hm2AgentSwitchSnoopingVlanMRPExpirationTime=hm2AgentSwitchSnoopingVlanMRPExpirationTime, hm2AgentSwitchMFDBSummaryTable=hm2AgentSwitchMFDBSummaryTable, hm2AgentStpCstPortBpduFilter=hm2AgentStpCstPortBpduFilter, hm2AgentPortMaxFrameSize=hm2AgentPortMaxFrameSize, hm2AgentSwitchStaticMacFilteringDestPortMask=hm2AgentSwitchStaticMacFilteringDestPortMask, hm2AgentDaiIfTrustEnable=hm2AgentDaiIfTrustEnable, hm2AgentLagDetailedConfigTable=hm2AgentLagDetailedConfigTable, hm2AgentSwitchAddressAgingTimeoutEntry=hm2AgentSwitchAddressAgingTimeoutEntry, hm2AgentStpMstPortReceivedBridgeId=hm2AgentStpMstPortReceivedBridgeId, hm2AgentDhcpL2RelayIfEnable=hm2AgentDhcpL2RelayIfEnable, hm2AgentDhcpL2RelayVlanIndex=hm2AgentDhcpL2RelayVlanIndex, hm2AgentSwitchSnoopingIntfMaxResponseTime=hm2AgentSwitchSnoopingIntfMaxResponseTime, hm2AgentSwitchProtectedPortConfigGroup=hm2AgentSwitchProtectedPortConfigGroup, hm2AgentDynamicIpsgBindingIpAddr=hm2AgentDynamicIpsgBindingIpAddr, hm2AgentStpMstPortPathCost=hm2AgentStpMstPortPathCost, hm2AgentSwitchSnoopingGroup=hm2AgentSwitchSnoopingGroup, hm2AgentStpConfigFormatSelector=hm2AgentStpConfigFormatSelector, hm2AgentStpCstBridgeMaxAge=hm2AgentStpCstBridgeMaxAge, hm2AgentDaiSrcMacValidate=hm2AgentDaiSrcMacValidate, hm2AgentSwitchSnoopingVlanTable=hm2AgentSwitchSnoopingVlanTable, hm2AgentSwitchGARPGroup=hm2AgentSwitchGARPGroup, hm2AgentArpAclRuleRowStatus=hm2AgentArpAclRuleRowStatus, hm2AgentDaiIfAutoDisable=hm2AgentDaiIfAutoDisable, hm2AgentStpMstPortTable=hm2AgentStpMstPortTable, hm2AgentLagDetailedLagIndex=hm2AgentLagDetailedLagIndex, hm2AgentSwitchMFDBProtocolType=hm2AgentSwitchMFDBProtocolType, hm2AgentLagDetailedPortSpeed=hm2AgentLagDetailedPortSpeed, hm2AgentStpCstPortTable=hm2AgentStpCstPortTable, hm2AgentStaticIpsgBindingIfIndex=hm2AgentStaticIpsgBindingIfIndex, hm2AgentSwitchSnoopingVlanEntry=hm2AgentSwitchSnoopingVlanEntry, hm2AgentSwitchStaticMacFilteringAddress=hm2AgentSwitchStaticMacFilteringAddress, hm2AgentStpForceVersion=hm2AgentStpForceVersion, hm2AgentDynamicIpsgBindingTable=hm2AgentDynamicIpsgBindingTable, hm2AgentClassOfServicePortEntry=hm2AgentClassOfServicePortEntry, hm2AgentDynamicIpsgBindingHwStatus=hm2AgentDynamicIpsgBindingHwStatus, hm2AgentPortVoiceVlanNoneMode=hm2AgentPortVoiceVlanNoneMode, hm2AgentPortMulticastControlMode=hm2AgentPortMulticastControlMode, hm2AgentStpCstAutoPortPathCost=hm2AgentStpCstAutoPortPathCost, hm2AgentPortMirrorTypeTable=hm2AgentPortMirrorTypeTable, hm2AgentDhcpSnoopingIfLogEnable=hm2AgentDhcpSnoopingIfLogEnable, hm2AgentStpPortStatsRstpBpduTx=hm2AgentStpPortStatsRstpBpduTx, hm2AgentDhcpSnoopingMacVerifyFailures=hm2AgentDhcpSnoopingMacVerifyFailures, Ipv6AddressPrefix=Ipv6AddressPrefix, hm2AgentSwitchSnoopingQuerierVlanEntry=hm2AgentSwitchSnoopingQuerierVlanEntry, hm2AgentProtocolConfigGroup=hm2AgentProtocolConfigGroup, hm2AgentStpMstRootPathCost=hm2AgentStpMstRootPathCost, hm2AgentSwitchVlanSubnetAssociationTable=hm2AgentSwitchVlanSubnetAssociationTable, hm2AgentStpCstRegionalRootId=hm2AgentStpCstRegionalRootId, hm2AgentSwitchSnoopingQuerierElectionParticipateMode=hm2AgentSwitchSnoopingQuerierElectionParticipateMode, hm2AgentStpCstBridgeFwdDelay=hm2AgentStpCstBridgeFwdDelay, hm2AgentPortMirrorReflectorPortInvalid=hm2AgentPortMirrorReflectorPortInvalid, hm2AgentPortMirrorSourcePortDestinationPortConflict=hm2AgentPortMirrorSourcePortDestinationPortConflict, hm2AgentPortDot3FlowControlMode=hm2AgentPortDot3FlowControlMode, hm2AgentStpMstDesignatedPortId=hm2AgentStpMstDesignatedPortId, hm2AgentProtocolGroupPortStatus=hm2AgentProtocolGroupPortStatus, hm2AgentProtocolGroupProtocolID=hm2AgentProtocolGroupProtocolID, hm2AgentSwitchVoiceVlanDeviceTable=hm2AgentSwitchVoiceVlanDeviceTable, hm2AgentDaiVlanLoggingEnable=hm2AgentDaiVlanLoggingEnable, hm2AgentSwitchSnoopingQuerierOperVersion=hm2AgentSwitchSnoopingQuerierOperVersion, hm2AgentDaiVlanSrcMacFailures=hm2AgentDaiVlanSrcMacFailures, hm2AgentPortIfIndex=hm2AgentPortIfIndex, hm2AgentStpMstPortLoopInconsistentState=hm2AgentStpMstPortLoopInconsistentState, hm2AgentSwitchMFDBMacAddress=hm2AgentSwitchMFDBMacAddress, hm2AgentSwitchSnoopingIntfIndex=hm2AgentSwitchSnoopingIntfIndex, hm2AgentDynamicDsBindingIpAddr=hm2AgentDynamicDsBindingIpAddr, hm2AgentPortVoiceVlanPriority=hm2AgentPortVoiceVlanPriority, hm2AgentPortConfigTable=hm2AgentPortConfigTable, hm2AgentSwitchStaticMacFilteringTable=hm2AgentSwitchStaticMacFilteringTable, hm2AgentSystemGroup=hm2AgentSystemGroup, hm2AgentSwitchSnoopingQuerierVlanOperMode=hm2AgentSwitchSnoopingQuerierVlanOperMode, hm2AgentSdmPreferNextTemplate=hm2AgentSdmPreferNextTemplate, hm2AgentSwitchSnoopingIntfVlanIDs=hm2AgentSwitchSnoopingIntfVlanIDs, hm2AgentSwitchSnoopingIntfTable=hm2AgentSwitchSnoopingIntfTable, hm2AgentDhcpL2RelayStatsTable=hm2AgentDhcpL2RelayStatsTable, hm2AgentStpMstId=hm2AgentStpMstId, hm2AgentStpCstPortLoopGuard=hm2AgentStpCstPortLoopGuard, hm2AgentProtocolGroupEntry=hm2AgentProtocolGroupEntry, hm2AgentPortMirrorSourcePortMask=hm2AgentPortMirrorSourcePortMask, hm2AgentDhcpSnoopingRemoteIpAddr=hm2AgentDhcpSnoopingRemoteIpAddr, hm2AgentDhcpSnoopingIfAutoDisable=hm2AgentDhcpSnoopingIfAutoDisable, hm2AgentStpMstRootPortId=hm2AgentStpMstRootPortId, hm2AgentStpMstPortPriority=hm2AgentStpMstPortPriority, hm2AgentPortMirrorPortVlanMirrorConflict=hm2AgentPortMirrorPortVlanMirrorConflict, hm2AgentPortVoiceVlanAuthMode=hm2AgentPortVoiceVlanAuthMode, hm2AgentSwitchVlanMacAssociationRowStatus=hm2AgentSwitchVlanMacAssociationRowStatus, hm2AgentDaiVlanPktsForwarded=hm2AgentDaiVlanPktsForwarded, hm2AgentSwitchSnoopingQuerierCfgEntry=hm2AgentSwitchSnoopingQuerierCfgEntry, hm2AgentSwitchSnoopingVlanAdminMode=hm2AgentSwitchSnoopingVlanAdminMode, hm2AgentStpCstPortTopologyChangeAck=hm2AgentStpCstPortTopologyChangeAck, hm2AgentPortMirrorReset=hm2AgentPortMirrorReset, hm2PlatformDaiIntfErrorDisabledTrap=hm2PlatformDaiIntfErrorDisabledTrap, hm2PlatformSwitchingTraps=hm2PlatformSwitchingTraps, hm2AgentArpAclRuleMatchSenderIpAddr=hm2AgentArpAclRuleMatchSenderIpAddr, hm2AgentPortMaxFrameSizeLimit=hm2AgentPortMaxFrameSizeLimit, hm2AgentStpMstPortId=hm2AgentStpMstPortId, hm2AgentStpCstDesignatedBridgeId=hm2AgentStpCstDesignatedBridgeId, hm2AgentDot3adAggPortEntry=hm2AgentDot3adAggPortEntry, hm2AgentSwitchSnoopingQuerierQueryInterval=hm2AgentSwitchSnoopingQuerierQueryInterval, hm2AgentStpCstPortId=hm2AgentStpCstPortId, hm2AgentPortMirrorAdminMode=hm2AgentPortMirrorAdminMode, hm2AgentSwitchSnoopingQuerierVlanAdminMode=hm2AgentSwitchSnoopingQuerierVlanAdminMode, hm2AgentArpAclRowStatus=hm2AgentArpAclRowStatus, hm2AgentSwitchGmrpPortPktRx=hm2AgentSwitchGmrpPortPktRx, hm2AgentStpMstAutoPortPathCost=hm2AgentStpMstAutoPortPathCost, hm2AgentPortVoiceVlanDSCP=hm2AgentPortVoiceVlanDSCP, hm2AgentStpPortMigrationCheck=hm2AgentStpPortMigrationCheck, hm2AgentDaiVlanDynArpInspEnable=hm2AgentDaiVlanDynArpInspEnable, hm2AgentSwitchVoiceVLANAdminMode=hm2AgentSwitchVoiceVLANAdminMode, hm2AgentStpCstBridgeHoldTime=hm2AgentStpCstBridgeHoldTime, hm2AgentStpConfigDigestKey=hm2AgentStpConfigDigestKey, hm2AgentSwitchGmrpUnknownMulticastFilterMode=hm2AgentSwitchGmrpUnknownMulticastFilterMode, Ipv6IfIndexOrZero=Ipv6IfIndexOrZero, hm2AgentDhcpL2RelayTrustedClntMsgsWithoutOptn82=hm2AgentDhcpL2RelayTrustedClntMsgsWithoutOptn82, hm2AgentSwitchSnoopingAdminMode=hm2AgentSwitchSnoopingAdminMode, hm2AgentSwitchVlanSubnetAssociationIPAddress=hm2AgentSwitchVlanSubnetAssociationIPAddress, hm2AgentPortSfpLinkLossAlert=hm2AgentPortSfpLinkLossAlert, hm2AgentStpConfigRevision=hm2AgentStpConfigRevision, hm2AgentStpMstTopologyChangeParm=hm2AgentStpMstTopologyChangeParm, hm2AgentPortVoiceVlanOperationalStatus=hm2AgentPortVoiceVlanOperationalStatus, hm2AgentDaiVlanDhcpDrops=hm2AgentDaiVlanDhcpDrops, hm2AgentSwitchSnoopingQuerierVlanAddress=hm2AgentSwitchSnoopingQuerierVlanAddress, hm2PlatformDhcpSnoopingIntfErrorDisabledTrap=hm2PlatformDhcpSnoopingIntfErrorDisabledTrap, hm2AgentPortVoiceVlanDataPriorityMode=hm2AgentPortVoiceVlanDataPriorityMode, hm2AgentStpMstPortRole=hm2AgentStpMstPortRole, hm2AgentSwitchVlanMacAssociationGroup=hm2AgentSwitchVlanMacAssociationGroup, hm2AgentSwitchAddressAgingTimeout=hm2AgentSwitchAddressAgingTimeout, hm2AgentDaiVlanArpAclStaticFlag=hm2AgentDaiVlanArpAclStaticFlag, hm2AgentDhcpSnoopingStatsEntry=hm2AgentDhcpSnoopingStatsEntry, hm2AgentStpPortState=hm2AgentStpPortState, hm2AgentPortMirrorSessionNum=hm2AgentPortMirrorSessionNum, hm2AgentDhcpL2RelayConfigGroup=hm2AgentDhcpL2RelayConfigGroup, hm2AgentSwitchSnoopingQuerierGroup=hm2AgentSwitchSnoopingQuerierGroup, hm2AgentSwitchMFDBTable=hm2AgentSwitchMFDBTable, hm2AgentPortMirrorDestinationPort=hm2AgentPortMirrorDestinationPort, hm2AgentDaiVlanPktsDropped=hm2AgentDaiVlanPktsDropped, hm2AgentPortMirrorSourcePortReflectorPortConflict=hm2AgentPortMirrorSourcePortReflectorPortConflict, hm2AgentDynamicIpsgBindingMacAddr=hm2AgentDynamicIpsgBindingMacAddr, hm2AgentSwitchVlanStaticMrouterTable=hm2AgentSwitchVlanStaticMrouterTable, hm2AgentStpMstPortEntry=hm2AgentStpMstPortEntry, hm2AgentSwitchMFDBSummaryVlanId=hm2AgentSwitchMFDBSummaryVlanId, hm2AgentDaiVlanAclDrops=hm2AgentDaiVlanAclDrops, hm2AgentStpMstPortReceivedPortId=hm2AgentStpMstPortReceivedPortId, hm2AgentPortBroadcastControlThresholdUnit=hm2AgentPortBroadcastControlThresholdUnit, hm2AgentSwitchVlanStaticMrouterAdminMode=hm2AgentSwitchVlanStaticMrouterAdminMode, hm2AgentStaticDsBindingEntry=hm2AgentStaticDsBindingEntry, hm2AgentLagDetailedIfIndex=hm2AgentLagDetailedIfIndex, hm2AgentArpAclRuleEntry=hm2AgentArpAclRuleEntry, hm2AgentSwitchSnoopingCfgTable=hm2AgentSwitchSnoopingCfgTable, hm2AgentSwitchSnoopingQuerierLastQuerierAddress=hm2AgentSwitchSnoopingQuerierLastQuerierAddress, LagList=LagList, hm2AgentSwitchMFDBEntry=hm2AgentSwitchMFDBEntry, hm2AgentIPv6NdpEntries=hm2AgentIPv6NdpEntries, hm2AgentStpCstPortOperPointToPoint=hm2AgentStpCstPortOperPointToPoint, hm2AgentStpMstRowStatus=hm2AgentStpMstRowStatus, Ipv6Address=Ipv6Address, hm2AgentStaticIpsgBindingRowStatus=hm2AgentStaticIpsgBindingRowStatus, hm2AgentPortMirrorEntry=hm2AgentPortMirrorEntry, hm2AgentStaticDsBindingRowStatus=hm2AgentStaticDsBindingRowStatus, hm2AgentSwitchSnoopingQuerierVlanTable=hm2AgentSwitchSnoopingQuerierVlanTable, hm2AgentSwitchSnoopingQuerierLastQuerierVersion=hm2AgentSwitchSnoopingQuerierLastQuerierVersion, hm2AgentStpCstRootFwdDelay=hm2AgentStpCstRootFwdDelay, hm2AgentStpCstDesignatedCost=hm2AgentStpCstDesignatedCost, hm2AgentProtocolGroupProtocolTable=hm2AgentProtocolGroupProtocolTable, hm2AgentLagSummaryConfigTable=hm2AgentLagSummaryConfigTable, hm2AgentSwitchSnoopingQuerierAdminMode=hm2AgentSwitchSnoopingQuerierAdminMode, hm2AgentSwitchSnoopingVlanGroup=hm2AgentSwitchSnoopingVlanGroup, VlanList=VlanList, hm2AgentSwitchVlanMacAssociationVlanId=hm2AgentSwitchVlanMacAssociationVlanId, hm2AgentSwitchVoiceVLANGroup=hm2AgentSwitchVoiceVLANGroup, hm2AgentSwitchGvrpPortPktTx=hm2AgentSwitchGvrpPortPktTx, hm2AgentSwitchSnoopingPortMask=hm2AgentSwitchSnoopingPortMask, hm2AgentPortVoiceVlanMode=hm2AgentPortVoiceVlanMode, hm2AgentStaticIpsgBindingMacAddr=hm2AgentStaticIpsgBindingMacAddr, hm2AgentPortBroadcastControlThreshold=hm2AgentPortBroadcastControlThreshold, hm2AgentSwitchSnoopingIntfMulticastRouterMode=hm2AgentSwitchSnoopingIntfMulticastRouterMode, hm2AgentSwitchStaticMacFilteringEntry=hm2AgentSwitchStaticMacFilteringEntry, hm2AgentSwitchMFDBSummaryForwardingPortMask=hm2AgentSwitchMFDBSummaryForwardingPortMask, hm2AgentDaiVlanStatsIndex=hm2AgentDaiVlanStatsIndex, hm2AgentStpCstPortTCNGuard=hm2AgentStpCstPortTCNGuard, hm2AgentSwitchSnoopingProtocol=hm2AgentSwitchSnoopingProtocol, hm2AgentPortMirrorVlanMirrorPortConflict=hm2AgentPortMirrorVlanMirrorPortConflict, hm2AgentDaiConfigGroup=hm2AgentDaiConfigGroup, hm2AgentLagSummaryStpMode=hm2AgentLagSummaryStpMode, hm2AgentDhcpSnoopingVlanConfigEntry=hm2AgentDhcpSnoopingVlanConfigEntry, hm2AgentIPv6MulticastRoutes=hm2AgentIPv6MulticastRoutes, hm2AgentLagConfigSNMPExtensionGroup=hm2AgentLagConfigSNMPExtensionGroup, hm2AgentClassOfServicePortPriority=hm2AgentClassOfServicePortPriority, hm2AgentSwitchSnoopingIntfAdminMode=hm2AgentSwitchSnoopingIntfAdminMode, hm2AgentSwitchGvrpPortPktRx=hm2AgentSwitchGvrpPortPktRx, hm2AgentStpMstPortForwardingState=hm2AgentStpMstPortForwardingState)
mibBuilder.exportSymbols("HM2-PLATFORM-SWITCHING-MIB", hm2AgentStpMstVlanTable=hm2AgentStpMstVlanTable, hm2AgentSdmTemplateSummaryTable=hm2AgentSdmTemplateSummaryTable, hm2AgentPortUnicastControlMode=hm2AgentPortUnicastControlMode, hm2AgentSwitchMFDBSummaryEntry=hm2AgentSwitchMFDBSummaryEntry, hm2AgentStpMstPortReceivedRegionalRPC=hm2AgentStpMstPortReceivedRegionalRPC, hm2AgentStaticDsBindingIpAddr=hm2AgentStaticDsBindingIpAddr, hm2AgentStaticDsBindingVlanId=hm2AgentStaticDsBindingVlanId, hm2AgentSwitchMFDBForwardingPortMask=hm2AgentSwitchMFDBForwardingPortMask, hm2AgentIpsgIfConfigEntry=hm2AgentIpsgIfConfigEntry, hm2AgentDaiVlanAclPermits=hm2AgentDaiVlanAclPermits, hm2AgentSwitchSnoopingIntfGroupMembershipInterval=hm2AgentSwitchSnoopingIntfGroupMembershipInterval, hm2AgentDaiIfConfigTable=hm2AgentDaiIfConfigTable, hm2AgentStpMstTable=hm2AgentStpMstTable, hm2AgentArpAclEntry=hm2AgentArpAclEntry, hm2AgentSwitchSnoopingVlanMaxResponseTime=hm2AgentSwitchSnoopingVlanMaxResponseTime, hm2AgentSwitchMFDBVlanId=hm2AgentSwitchMFDBVlanId, hm2AgentDhcpSnoopingStatsTable=hm2AgentDhcpSnoopingStatsTable, hm2AgentLagSummaryFlushTimer=hm2AgentLagSummaryFlushTimer, hm2AgentSdmTemplateId=hm2AgentSdmTemplateId, hm2AgentSwitchVlanSubnetAssociationEntry=hm2AgentSwitchVlanSubnetAssociationEntry, hm2PlatformSwitching=hm2PlatformSwitching, hm2AgentLagSummaryMinimumActiveLinks=hm2AgentLagSummaryMinimumActiveLinks, hm2AgentPortMirrorDestinationPortInvalid=hm2AgentPortMirrorDestinationPortInvalid, hm2AgentStpCstHelloTime=hm2AgentStpCstHelloTime, hm2AgentPortConfigEntry=hm2AgentPortConfigEntry, hm2AgentStpMstSwitchVersionConflict=hm2AgentStpMstSwitchVersionConflict, hm2AgentDaiVlanBindingCheckEnable=hm2AgentDaiVlanBindingCheckEnable, hm2AgentStpMstVlanRowStatus=hm2AgentStpMstVlanRowStatus, hm2AgentStpPortTable=hm2AgentStpPortTable, hm2AgentStpCstPortOperEdge=hm2AgentStpCstPortOperEdge, hm2AgentDynamicDsBindingEntry=hm2AgentDynamicDsBindingEntry, hm2AgentSwitchVlanMacAssociationTable=hm2AgentSwitchVlanMacAssociationTable, hm2AgentDhcpSnoopingInvalidServerMessages=hm2AgentDhcpSnoopingInvalidServerMessages, hm2AgentPortClearStats=hm2AgentPortClearStats, hm2AgentDaiDstMacValidate=hm2AgentDaiDstMacValidate, hm2AgentLagConfigGroupPortIsLagMemberErrorReturn=hm2AgentLagConfigGroupPortIsLagMemberErrorReturn, hm2AgentDhcpL2RelayUntrustedSrvrMsgsWithOptn82=hm2AgentDhcpL2RelayUntrustedSrvrMsgsWithOptn82, hm2AgentStpBpduFilterDefault=hm2AgentStpBpduFilterDefault, hm2AgentDaiVlanStatsEntry=hm2AgentDaiVlanStatsEntry, hm2AgentDhcpSnoopingVlanConfigTable=hm2AgentDhcpSnoopingVlanConfigTable, hm2AgentPortDot3FlowControlOperStatus=hm2AgentPortDot3FlowControlOperStatus, hm2AgentSwitchConfigGroup=hm2AgentSwitchConfigGroup, hm2AgentDynamicIpsgBindingIfIndex=hm2AgentDynamicIpsgBindingIfIndex, hm2AgentLagConfigCreate=hm2AgentLagConfigCreate, hm2PlatformStpInstanceTopologyChangeTrap=hm2PlatformStpInstanceTopologyChangeTrap, hm2AgentDaiVlanDhcpPermits=hm2AgentDaiVlanDhcpPermits, hm2AgentSwitchSnoopingQuerierVersion=hm2AgentSwitchSnoopingQuerierVersion, hm2AgentSwitchMFDBSummaryMacAddress=hm2AgentSwitchMFDBSummaryMacAddress, hm2AgentDaiIPValidate=hm2AgentDaiIPValidate, hm2AgentSwitchVlanStaticMrouterEntry=hm2AgentSwitchVlanStaticMrouterEntry, hm2AgentDhcpSnoopingIfBurstInterval=hm2AgentDhcpSnoopingIfBurstInterval, hm2AgentDhcpL2RelayRemoteIdVlanEnable=hm2AgentDhcpL2RelayRemoteIdVlanEnable, hm2AgentProtocolGroupPortTable=hm2AgentProtocolGroupPortTable, hm2AgentLagSummaryMaxFrameSize=hm2AgentLagSummaryMaxFrameSize, hm2AgentLagConfigGroupMaxNumPortsPerLag=hm2AgentLagConfigGroupMaxNumPortsPerLag, hm2AgentSdmTemplateEntry=hm2AgentSdmTemplateEntry, hm2AgentLagConfigGroupHashOption=hm2AgentLagConfigGroupHashOption, hm2PlatformStpInstanceLoopInconsistentStartTrap=hm2PlatformStpInstanceLoopInconsistentStartTrap, hm2AgentStpCstPortAutoEdge=hm2AgentStpCstPortAutoEdge, hm2AgentProtocolGroupPortEntry=hm2AgentProtocolGroupPortEntry, hm2AgentDhcpSnoopingIfTrustEnable=hm2AgentDhcpSnoopingIfTrustEnable, hm2AgentConfigGroup=hm2AgentConfigGroup, hm2AgentSwitchGmrpPortEntry=hm2AgentSwitchGmrpPortEntry, hm2AgentSwitchVoiceVlanInterfaceNum=hm2AgentSwitchVoiceVlanInterfaceNum, hm2AgentStpMstPortTransitionsOutOfLoopInconsistentState=hm2AgentStpMstPortTransitionsOutOfLoopInconsistentState, hm2AgentSwitchSnoopingIntfFastLeaveAdminMode=hm2AgentSwitchSnoopingIntfFastLeaveAdminMode, hm2AgentDynamicDsBindingMacAddr=hm2AgentDynamicDsBindingMacAddr, hm2AgentDhcpL2RelayVlanConfigTable=hm2AgentDhcpL2RelayVlanConfigTable, hm2AgentDhcpSnoopingRemoteFileName=hm2AgentDhcpSnoopingRemoteFileName, hm2AgentStpCstPortEdge=hm2AgentStpCstPortEdge, hm2AgentStaticIpsgBindingTable=hm2AgentStaticIpsgBindingTable, PYSNMP_MODULE_ID=hm2PlatformSwitching, hm2AgentStpCstRegionalRootPathCost=hm2AgentStpCstRegionalRootPathCost, hm2AgentLagConfigGroupNumOfLagsConfigured=hm2AgentLagConfigGroupNumOfLagsConfigured, hm2AgentIPv4MulticastRoutes=hm2AgentIPv4MulticastRoutes, hm2AgentPortMirrorPrivateVlanConfigured=hm2AgentPortMirrorPrivateVlanConfigured, hm2AgentPortMirrorRemoteVlan=hm2AgentPortMirrorRemoteVlan, hm2AgentPortMirrorRemoteDestinationVlan=hm2AgentPortMirrorRemoteDestinationVlan, hm2AgentDot3adAggPortTable=hm2AgentDot3adAggPortTable, hm2AgentClearVlan=hm2AgentClearVlan, hm2AgentDaiIfConfigEntry=hm2AgentDaiIfConfigEntry, hm2AgentSwitchVoiceVlanDeviceMacAddress=hm2AgentSwitchVoiceVlanDeviceMacAddress, hm2AgentPortMirrorDestinationRemotePortNotSet=hm2AgentPortMirrorDestinationRemotePortNotSet, hm2AgentArpAclRuleMatchSenderMacAddr=hm2AgentArpAclRuleMatchSenderMacAddr, hm2AgentDaiVlanIndex=hm2AgentDaiVlanIndex, hm2AgentSwitchGmrpPortTable=hm2AgentSwitchGmrpPortTable, hm2AgentProtocolGroupName=hm2AgentProtocolGroupName, hm2AgentDhcpL2RelayVlanConfigEntry=hm2AgentDhcpL2RelayVlanConfigEntry, hm2AgentIPv6UnicastRoutes=hm2AgentIPv6UnicastRoutes, hm2AgentStpMstDesignatedRootId=hm2AgentStpMstDesignatedRootId, hm2AgentDaiStatsReset=hm2AgentDaiStatsReset, hm2AgentSwitchAddressAgingTimeoutTable=hm2AgentSwitchAddressAgingTimeoutTable, hm2AgentProtocolGroupTable=hm2AgentProtocolGroupTable, hm2AgentStpMstPortTransitionsIntoLoopInconsistentState=hm2AgentStpMstPortTransitionsIntoLoopInconsistentState, hm2PlatformStpInstanceLoopInconsistentEndTrap=hm2PlatformStpInstanceLoopInconsistentEndTrap, hm2AgentIpsgIfVerifySource=hm2AgentIpsgIfVerifySource, hm2AgentStaticDsBindingIfIndex=hm2AgentStaticDsBindingIfIndex, hm2AgentPortMirrorReflectorPortVlanConflict=hm2AgentPortMirrorReflectorPortVlanConflict, hm2AgentDynamicIpsgBindingEntry=hm2AgentDynamicIpsgBindingEntry, hm2AgentPortUnicastControlThreshold=hm2AgentPortUnicastControlThreshold, hm2AgentSwitchGmrpPortPktTx=hm2AgentSwitchGmrpPortPktTx, hm2AgentDhcpSnoopingIfConfigTable=hm2AgentDhcpSnoopingIfConfigTable, hm2AgentPortMirrorRemoteSourceVlan=hm2AgentPortMirrorRemoteSourceVlan, hm2AgentIPv4UnicastRoutes=hm2AgentIPv4UnicastRoutes, hm2AgentSwitchStaticMacFilteringVlanId=hm2AgentSwitchStaticMacFilteringVlanId, hm2AgentPortMirrorVlanNotCreated=hm2AgentPortMirrorVlanNotCreated, hm2AgentSwitchSnoopingVlanReportSuppMode=hm2AgentSwitchSnoopingVlanReportSuppMode, hm2AgentDaiVlanConfigTable=hm2AgentDaiVlanConfigTable, hm2AgentPortUnicastControlThresholdUnit=hm2AgentPortUnicastControlThresholdUnit, hm2AgentStpCstPortPathCost=hm2AgentStpCstPortPathCost, hm2AgentSwitchVoiceVlanDeviceEntry=hm2AgentSwitchVoiceVlanDeviceEntry, hm2AgentDhcpL2RelayAdminMode=hm2AgentDhcpL2RelayAdminMode, hm2AgentPortMirrorSourceVlan=hm2AgentPortMirrorSourceVlan, hm2AgentSwitchMFDBMostEntriesUsed=hm2AgentSwitchMFDBMostEntriesUsed, hm2AgentStpCstBridgeMaxHops=hm2AgentStpCstBridgeMaxHops, hm2AgentStpCstBridgeHelloTime=hm2AgentStpCstBridgeHelloTime, hm2AgentSwitchVlanMacAssociationEntry=hm2AgentSwitchVlanMacAssociationEntry, hm2AgentDaiIfRateLimit=hm2AgentDaiIfRateLimit, hm2AgentSwitchGvrpPortEntry=hm2AgentSwitchGvrpPortEntry, hm2AgentPortMirroringGroup=hm2AgentPortMirroringGroup, Ipv6AddressIfIdentifier=Ipv6AddressIfIdentifier, hm2AgentStpCstFwdDelayErrorReturn=hm2AgentStpCstFwdDelayErrorReturn, hm2AgentSwitchVlanStaticMrouterGroup=hm2AgentSwitchVlanStaticMrouterGroup, hm2AgentProtocolGroupVlanId=hm2AgentProtocolGroupVlanId, hm2AgentStpAdminMode=hm2AgentStpAdminMode, hm2AgentSdmPreferCurrentTemplate=hm2AgentSdmPreferCurrentTemplate, hm2AgentDaiVlanDstMacFailures=hm2AgentDaiVlanDstMacFailures, hm2AgentDynamicDsBindingVlanId=hm2AgentDynamicDsBindingVlanId, hm2AgentLagSummaryName=hm2AgentLagSummaryName, hm2AgentSwitchStaticMacStatsGroup=hm2AgentSwitchStaticMacStatsGroup, hm2AgentStpCstMaxAge=hm2AgentStpCstMaxAge, hm2AgentStaticDsBindingTable=hm2AgentStaticDsBindingTable, hm2AgentStpPortUpTime=hm2AgentStpPortUpTime, hm2AgentLagMirrorProbePortLagMemberErrorReturn=hm2AgentLagMirrorProbePortLagMemberErrorReturn, hm2AgentPortMirrorAllowMgmtMode=hm2AgentPortMirrorAllowMgmtMode, hm2AgentSwitchGvrpPortTable=hm2AgentSwitchGvrpPortTable, hm2AgentStpCstConfigGroup=hm2AgentStpCstConfigGroup, hm2AgentStpCstPortPriority=hm2AgentStpCstPortPriority, hm2AgentClassOfServicePortClass=hm2AgentClassOfServicePortClass, hm2AgentStpPortStatsStpBpduTx=hm2AgentStpPortStatsStpBpduTx, hm2AgentSwitchProtectedPortTable=hm2AgentSwitchProtectedPortTable, hm2AgentLagDetailedConfigEntry=hm2AgentLagDetailedConfigEntry, hm2AgentDaiIfBurstInterval=hm2AgentDaiIfBurstInterval, hm2AgentLagConfigStaticCapability=hm2AgentLagConfigStaticCapability, hm2AgentStaticIpsgBindingHwStatus=hm2AgentStaticIpsgBindingHwStatus, hm2AgentPortMirrorReflectorPort=hm2AgentPortMirrorReflectorPort, Ipv6IfIndex=Ipv6IfIndex, hm2AgentLagSummaryStaticCapability=hm2AgentLagSummaryStaticCapability, hm2AgentDynamicDsBindingLeaseRemainingTime=hm2AgentDynamicDsBindingLeaseRemainingTime, hm2AgentDaiVlanStatsTable=hm2AgentDaiVlanStatsTable, hm2AgentSwitchSnoopingVlanGroupMembershipInterval=hm2AgentSwitchSnoopingVlanGroupMembershipInterval, hm2AgentStpCstBridgePriority=hm2AgentStpCstBridgePriority, hm2AgentDaiVlanIpValidFailures=hm2AgentDaiVlanIpValidFailures, hm2AgentStpBpduGuardMode=hm2AgentStpBpduGuardMode, hm2AgentStpMstInstanceVlanErrorReturn=hm2AgentStpMstInstanceVlanErrorReturn, hm2AgentDhcpL2RelayUntrustedClntMsgsWithOptn82=hm2AgentDhcpL2RelayUntrustedClntMsgsWithOptn82, hm2AgentLagSummaryMaxFrameSizeLimit=hm2AgentLagSummaryMaxFrameSizeLimit, hm2AgentPortMirrorRspanVlanInconsistent=hm2AgentPortMirrorRspanVlanInconsistent, hm2AgentDot3adAggPort=hm2AgentDot3adAggPort, hm2AgentSwitchSnoopingIntfGroup=hm2AgentSwitchSnoopingIntfGroup, hm2AgentStpRingOnlyMode=hm2AgentStpRingOnlyMode, hm2AgentPortMirrorProbePortVlanConflict=hm2AgentPortMirrorProbePortVlanConflict, hm2AgentStpPortStatsRstpBpduRx=hm2AgentStpPortStatsRstpBpduRx, hm2AgentLagSummaryLagIndex=hm2AgentLagSummaryLagIndex, hm2AgentPortMirrorSNMPExtensionGroup=hm2AgentPortMirrorSNMPExtensionGroup, hm2AgentStpCstPortBpduFlood=hm2AgentStpCstPortBpduFlood, hm2AgentSwitchSnoopingIntfEntry=hm2AgentSwitchSnoopingIntfEntry, hm2AgentPortDot1dBasePort=hm2AgentPortDot1dBasePort, hm2AgentPortMirrorVlanRspanVlanConflict=hm2AgentPortMirrorVlanRspanVlanConflict, hm2AgentStpPortStatsStpBpduRx=hm2AgentStpPortStatsStpBpduRx, hm2AgentProtocolGroupProtocolEntry=hm2AgentProtocolGroupProtocolEntry, hm2AgentStpPortStatsMstpBpduTx=hm2AgentStpPortStatsMstpBpduTx, hm2AgentSwitchSnoopingMulticastControlFramesProcessed=hm2AgentSwitchSnoopingMulticastControlFramesProcessed, hm2AgentDhcpSnoopingIfRateLimit=hm2AgentDhcpSnoopingIfRateLimit, hm2AgentStpMstVlanEntry=hm2AgentStpMstVlanEntry, hm2AgentSwitchMFDBDescription=hm2AgentSwitchMFDBDescription, hm2AgentSwitchMFDBMaxTableEntries=hm2AgentSwitchMFDBMaxTableEntries, hm2AgentLagSummaryType=hm2AgentLagSummaryType, hm2AgentDot3adAggPortLACPMode=hm2AgentDot3adAggPortLACPMode, hm2AgentEcmpNextHops=hm2AgentEcmpNextHops, hm2AgentDhcpL2RelayIfTrustEnable=hm2AgentDhcpL2RelayIfTrustEnable, hm2AgentStaticDsBindingMacAddr=hm2AgentStaticDsBindingMacAddr, hm2AgentDynamicIpsgBindingVlanId=hm2AgentDynamicIpsgBindingVlanId, hm2AgentStpCstDesignatedPortId=hm2AgentStpCstDesignatedPortId, hm2AgentStpCstPortRootGuard=hm2AgentStpCstPortRootGuard, hm2AgentStpMstDesignatedCost=hm2AgentStpMstDesignatedCost, hm2AgentArpAclTable=hm2AgentArpAclTable, hm2AgentDaiVlanConfigEntry=hm2AgentDaiVlanConfigEntry, hm2AgentSwitchVlanSubnetAssociationSubnetMask=hm2AgentSwitchVlanSubnetAssociationSubnetMask, hm2AgentStpRingOnlyModeIntfOne=hm2AgentStpRingOnlyModeIntfOne, hm2AgentLagSummaryAddPort=hm2AgentLagSummaryAddPort, hm2AgentSdmTemplateTable=hm2AgentSdmTemplateTable, hm2AgentSwitchSnoopingVlanFastLeaveAdminMode=hm2AgentSwitchSnoopingVlanFastLeaveAdminMode, hm2AgentStpCstPortBpduGuardEffect=hm2AgentStpCstPortBpduGuardEffect, hm2AgentStpMstBridgeIdentifier=hm2AgentStpMstBridgeIdentifier, hm2AgentPortVoiceVlanUntagged=hm2AgentPortVoiceVlanUntagged, hm2AgentSwitchStaticMacFilteringStatus=hm2AgentSwitchStaticMacFilteringStatus, hm2AgentSwitchSnoopingQuerierOperMaxResponseTime=hm2AgentSwitchSnoopingQuerierOperMaxResponseTime, hm2AgentStpPortEntry=hm2AgentStpPortEntry, hm2AgentStpMstBridgePriority=hm2AgentStpMstBridgePriority, hm2AgentDaiVlanArpAclName=hm2AgentDaiVlanArpAclName, hm2AgentLagSummaryLinkTrap=hm2AgentLagSummaryLinkTrap, hm2AgentSwitchVlanMacAssociationMacAddress=hm2AgentSwitchVlanMacAssociationMacAddress, hm2AgentPortMirrorTypeType=hm2AgentPortMirrorTypeType, hm2AgentSwitchVlanSubnetAssociationRowStatus=hm2AgentSwitchVlanSubnetAssociationRowStatus, hm2AgentDhcpL2RelayTrustedSrvrMsgsWithoutOptn82=hm2AgentDhcpL2RelayTrustedSrvrMsgsWithoutOptn82, hm2AgentPortVoiceVlanID=hm2AgentPortVoiceVlanID, hm2AgentLagConfigGroupMaxNumOfLags=hm2AgentLagConfigGroupMaxNumOfLags, hm2AgentStpMstEntry=hm2AgentStpMstEntry, hm2AgentStpMstDesignatedBridgeId=hm2AgentStpMstDesignatedBridgeId, hm2AgentLagConfigGroupLagsConfigured=hm2AgentLagConfigGroupLagsConfigured, hm2AgentLagSummaryHashOption=hm2AgentLagSummaryHashOption, hm2AgentSwitchSnoopingQuerierExpiryInterval=hm2AgentSwitchSnoopingQuerierExpiryInterval, hm2AgentLagDetailedPortStatus=hm2AgentLagDetailedPortStatus, hm2AgentPortMirrorTable=hm2AgentPortMirrorTable, hm2AgentPortMirrorRemoteSourceRemoteDestinationConflict=hm2AgentPortMirrorRemoteSourceRemoteDestinationConflict, hm2AgentDhcpSnoopingAdminMode=hm2AgentDhcpSnoopingAdminMode, hm2AgentArpAclName=hm2AgentArpAclName, hm2AgentDhcpSnoopingVlanEnable=hm2AgentDhcpSnoopingVlanEnable, hm2AgentDhcpSnoopingVerifyMac=hm2AgentDhcpSnoopingVerifyMac, hm2AgentStpCstExtPortPathCost=hm2AgentStpCstExtPortPathCost, hm2AgentSwitchSnoopingIntfMRPExpirationTime=hm2AgentSwitchSnoopingIntfMRPExpirationTime, hm2PlatformStpInstanceNewRootTrap=hm2PlatformStpInstanceNewRootTrap, hm2AgentPortMulticastControlThresholdUnit=hm2AgentPortMulticastControlThresholdUnit, hm2AgentProtocolGroupId=hm2AgentProtocolGroupId, hm2AgentDhcpL2RelayVlanEnable=hm2AgentDhcpL2RelayVlanEnable, hm2AgentPortBroadcastControlMode=hm2AgentPortBroadcastControlMode, hm2AgentIpsgIfConfigTable=hm2AgentIpsgIfConfigTable, hm2AgentPortMirrorTypeEntry=hm2AgentPortMirrorTypeEntry)
| 147.967347 | 16,414 | 0.796687 | 14,084 | 145,008 | 8.202499 | 0.053465 | 0.009279 | 0.020645 | 0.016412 | 0.377246 | 0.350109 | 0.313312 | 0.300656 | 0.257756 | 0.23596 | 0 | 0.089455 | 0.072906 | 145,008 | 979 | 16,415 | 148.118488 | 0.769868 | 0.002386 | 0 | 0.013485 | 0 | 0 | 0.082694 | 0.024113 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.012448 | 0 | 0.040456 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
540681f185075dc1d17cb1a8e54e0bcf54a5c534 | 307 | py | Python | Ago-Dic-2019/NoemiEstherFloresPardo/Practica1/Names.py | Arbupa/DAS_Sistemas | 52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1 | [
"MIT"
] | 41 | 2017-09-26T09:36:32.000Z | 2022-03-19T18:05:25.000Z | Ago-Dic-2019/NoemiEstherFloresPardo/Practica1/Names.py | Arbupa/DAS_Sistemas | 52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1 | [
"MIT"
] | 67 | 2017-09-11T05:06:12.000Z | 2022-02-14T04:44:04.000Z | Ago-Dic-2019/NoemiEstherFloresPardo/Practica1/Names.py | Arbupa/DAS_Sistemas | 52263ab91436b2e5a24ce6f8493aaa2e2fe92fb1 | [
"MIT"
] | 210 | 2017-09-01T00:10:08.000Z | 2022-03-19T18:05:12.000Z | """3-1. Names: Store the names of a few of your friends in a list called names. Print
each person’s name by accessing each element in the list, one at a time."""
names = ['Reynaldo', 'Horacio', 'Pablo', 'Genesis', 'Angelica']
print(names[0])
print(names[1])
print(names[2])
print(names[3])
print(names[4]) | 30.7 | 85 | 0.693811 | 54 | 307 | 3.944444 | 0.592593 | 0.234742 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026616 | 0.143322 | 307 | 10 | 86 | 30.7 | 0.78327 | 0.504886 | 0 | 0 | 0 | 0 | 0.238095 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.833333 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
540b1bb62ffed6ced4d40e8f7bab8243a4a794df | 250 | py | Python | catalog/bindings/csw/arc_by_bulge.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/csw/arc_by_bulge.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | catalog/bindings/csw/arc_by_bulge.py | NIVANorge/s-enda-playground | 56ae0a8978f0ba8a5546330786c882c31e17757a | [
"Apache-2.0"
] | null | null | null | from dataclasses import dataclass
from bindings.csw.arc_by_bulge_type import ArcByBulgeType
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class ArcByBulge(ArcByBulgeType):
class Meta:
namespace = "http://www.opengis.net/gml"
| 22.727273 | 57 | 0.764 | 31 | 250 | 5.935484 | 0.645161 | 0.141304 | 0.173913 | 0.25 | 0.315217 | 0.315217 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136 | 250 | 10 | 58 | 25 | 0.851852 | 0 | 0 | 0 | 0 | 0 | 0.208 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
54106c42a2c0510db3041d882fa76bad1a0a6c10 | 1,970 | py | Python | evan/api/serializers/users.py | eillarra/evan | befe0f8daedd1b1f629097110d92e68534e43da1 | [
"MIT"
] | null | null | null | evan/api/serializers/users.py | eillarra/evan | befe0f8daedd1b1f629097110d92e68534e43da1 | [
"MIT"
] | 20 | 2021-03-31T20:10:46.000Z | 2022-02-15T09:58:13.000Z | evan/api/serializers/users.py | eillarra/evan | befe0f8daedd1b1f629097110d92e68534e43da1 | [
"MIT"
] | null | null | null | from django.contrib.auth import get_user_model
from django_countries.serializer_fields import CountryField
from drf_writable_nested import UniqueFieldsMixin, NestedUpdateMixin, WritableNestedModelSerializer
from rest_framework import serializers
from evan.models import Profile
class AttendeeSerializer(serializers.ModelSerializer):
name = serializers.SerializerMethodField(read_only=True)
affiliation = serializers.SerializerMethodField(read_only=True)
country = serializers.SerializerMethodField(read_only=True)
connect = serializers.SerializerMethodField(read_only=True)
class Meta:
model = get_user_model()
fields = ("id", "name", "affiliation", "country", "connect")
def get_affiliation(self, obj) -> str:
return obj.profile.affiliation
def get_connect(self, obj) -> bool:
return obj.profile.can_be_contacted()
def get_country(self, obj) -> str:
return {"code": obj.profile.country.code, "name": obj.profile.country.name} if obj.profile.country else None
def get_name(self, obj) -> str:
return " ".join([obj.first_name, obj.last_name])
class ProfileSerializer(UniqueFieldsMixin, WritableNestedModelSerializer):
country = CountryField(country_dict=True, allow_null=True)
class Meta:
model = Profile
exclude = ("user",)
class UserSerializer(NestedUpdateMixin, serializers.ModelSerializer):
self = serializers.HyperlinkedIdentityField(view_name="v1:user-detail")
profile = ProfileSerializer()
class Meta:
model = get_user_model()
fields = ("self", "id", "username", "email", "first_name", "last_name", "profile")
read_only_fields = ("username",)
class UserBasicSerializer(serializers.ModelSerializer):
self = serializers.HyperlinkedIdentityField(view_name="v1:user-detail")
class Meta:
model = get_user_model()
fields = ("self", "id", "username", "email", "first_name", "last_name")
| 35.178571 | 116 | 0.724873 | 212 | 1,970 | 6.570755 | 0.311321 | 0.028715 | 0.034458 | 0.11486 | 0.368988 | 0.242642 | 0.242642 | 0.21967 | 0.21967 | 0.21967 | 0 | 0.001219 | 0.167005 | 1,970 | 55 | 117 | 35.818182 | 0.847654 | 0 | 0 | 0.236842 | 0 | 0 | 0.082741 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.131579 | 0.105263 | 0.763158 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
54210734a7b8553782233316b9670685e2298aaf | 242 | py | Python | apps/comisiones/urls.py | Kingarturs/mercedez-crm | 882c0bb4c011a41e82c203ebd1e0b36dc075dfd7 | [
"Apache-2.0"
] | null | null | null | apps/comisiones/urls.py | Kingarturs/mercedez-crm | 882c0bb4c011a41e82c203ebd1e0b36dc075dfd7 | [
"Apache-2.0"
] | null | null | null | apps/comisiones/urls.py | Kingarturs/mercedez-crm | 882c0bb4c011a41e82c203ebd1e0b36dc075dfd7 | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from apps.comisiones import views as comisiones_views
from django.contrib.auth.decorators import login_required
urlpatterns = [
path('', login_required(comisiones_views.comisionesView, login_url='/login')),
] | 34.571429 | 82 | 0.805785 | 31 | 242 | 6.129032 | 0.548387 | 0.105263 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.103306 | 242 | 7 | 83 | 34.571429 | 0.875576 | 0 | 0 | 0 | 0 | 0 | 0.024691 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 0 | 0 | 0 | 2 |
5424c8dab6369b1b13e6e926d873ec0cf6d839ca | 818 | py | Python | src/test_policy.py | danielle-snyk/snyky | 82004570bb25f4e9445220f92e7251514d12b630 | [
"Apache-2.0"
] | 9 | 2020-01-03T20:28:17.000Z | 2021-08-19T17:15:25.000Z | src/test_policy.py | danielle-snyk/snyky | 82004570bb25f4e9445220f92e7251514d12b630 | [
"Apache-2.0"
] | 2 | 2019-10-31T08:29:44.000Z | 2020-01-06T19:50:03.000Z | src/test_policy.py | danielle-snyk/snyky | 82004570bb25f4e9445220f92e7251514d12b630 | [
"Apache-2.0"
] | 10 | 2019-12-17T08:57:49.000Z | 2022-02-08T12:37:05.000Z | import pytest
from policykit import Conftest
class TestPolicy(object):
@pytest.fixture
def conftest(self):
return Conftest()
def test_policy(self, conftest):
run = conftest.verify()
assert run.success
def test_pytest_config(self, conftest):
run = conftest.test("pytest.ini", namespace="pytest")
assert run.success
def test_pipfile(self, conftest):
run = conftest.test("Pipfile", namespace="pipfile", input="toml")
assert run.success
def test_dockerfile(self, conftest):
run = conftest.test("Dockerfile", namespace="docker")
assert run.success
def test_kubernetes_manifest_for_warnings(self, conftest):
run = conftest.test("snyky.yaml")
result = run.results[0]
assert not result.Warnings
| 27.266667 | 73 | 0.661369 | 94 | 818 | 5.659574 | 0.382979 | 0.065789 | 0.140977 | 0.216165 | 0.37594 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001597 | 0.234719 | 818 | 29 | 74 | 28.206897 | 0.848243 | 0 | 0 | 0.181818 | 0 | 0 | 0.07335 | 0 | 0 | 0 | 0 | 0 | 0.227273 | 1 | 0.272727 | false | 0 | 0.090909 | 0.045455 | 0.454545 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
542cbfd948163bb26962ec3873d6fd16eb4143c9 | 632 | py | Python | scripts/stop_mongodb_primery_daemon.py | cloudify-examples/mongodb-blueprint | 8bf9a96d72401a6db3d61e82466270640d2903ba | [
"Apache-2.0"
] | 3 | 2016-07-12T18:20:52.000Z | 2016-11-07T12:55:18.000Z | scripts/stop_mongodb_primery_daemon.py | cloudify-examples/mongodb-blueprint | 8bf9a96d72401a6db3d61e82466270640d2903ba | [
"Apache-2.0"
] | 1 | 2017-06-11T07:12:46.000Z | 2017-06-11T07:12:46.000Z | scripts/stop_mongodb_primery_daemon.py | cloudify-examples/mongodb-blueprint | 8bf9a96d72401a6db3d61e82466270640d2903ba | [
"Apache-2.0"
] | null | null | null | import os
from signal import SIGKILL
from cloudify import ctx
def _stop_process():
os.killpg(
ctx.instance.runtime_properties['pid'],
SIGKILL)
def _unset_runtime_properties():
ctx.instance.runtime_properties.pop('pid', None)
for runtime_property in ctx.instance.runtime_properties:
if runtime_property.startswith('mongo_primery_host_'):
ctx.instance.runtime_properties.pop(runtime_property)
def main():
try:
_stop_process()
_unset_runtime_properties()
except:
ctx.logger.exception('failed')
raise
if __name__ == '__main__':
main()
| 20.387097 | 65 | 0.683544 | 72 | 632 | 5.611111 | 0.472222 | 0.252475 | 0.178218 | 0.277228 | 0.153465 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.221519 | 632 | 30 | 66 | 21.066667 | 0.821138 | 0 | 0 | 0 | 0 | 0 | 0.061709 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.285714 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
581deb36cc7d06eac46a44cbbbefd92981e23451 | 1,049 | py | Python | ProjectEuler.Problem.018.py | jihunroh/ProjectEuler-Python | 2fceaf5c3dd61038004b6128c5d9ee7a76142bca | [
"MIT"
] | null | null | null | ProjectEuler.Problem.018.py | jihunroh/ProjectEuler-Python | 2fceaf5c3dd61038004b6128c5d9ee7a76142bca | [
"MIT"
] | null | null | null | ProjectEuler.Problem.018.py | jihunroh/ProjectEuler-Python | 2fceaf5c3dd61038004b6128c5d9ee7a76142bca | [
"MIT"
] | null | null | null | from ProjectEulerCommons.Base import *
triangle = [list(map(int, line.split(' '))) + [0] * (15 - 1 - i) for i, line in enumerate(
"""75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23""".splitlines())]
def reduce_to_local_maximum_path(triangle):
if len(triangle) == 1:
return triangle[0][0]
else:
return reduce_to_local_maximum_path(triangle[0:len(triangle) - 2] + [[step + max(triangle[-1][i:i+2]) for i, step in enumerate(triangle[-2]) if step is not 0]])
Answer(
reduce_to_local_maximum_path(triangle)
)
"""
------------------------------------------------
ProjectEuler.Problem.018.py
The Answer is: 1074
Time Elasped: 0.005049943923950195sec
------------------------------------------------
"""
| 28.351351 | 168 | 0.605338 | 205 | 1,049 | 3.039024 | 0.565854 | 0.038523 | 0.0626 | 0.096308 | 0.154093 | 0.154093 | 0 | 0 | 0 | 0 | 0 | 0.338592 | 0.21449 | 1,049 | 36 | 169 | 29.138889 | 0.417476 | 0 | 0 | 0 | 0 | 0 | 0.002066 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.090909 | 0 | 0.363636 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5831bcb34288a143649c99a14e072f15de7aa45d | 792 | py | Python | dapodik/sekolah/yayasan.py | hexatester/dapodik | d89c0fb899c89e866527f6b7b57f741abd6444ea | [
"MIT"
] | 4 | 2021-02-01T15:19:35.000Z | 2022-01-26T02:47:21.000Z | dapodik/sekolah/yayasan.py | hexatester/dapodik | d89c0fb899c89e866527f6b7b57f741abd6444ea | [
"MIT"
] | 3 | 2020-01-08T17:07:15.000Z | 2020-01-08T18:05:12.000Z | dapodik/sekolah/yayasan.py | hexatester/dapodik | d89c0fb899c89e866527f6b7b57f741abd6444ea | [
"MIT"
] | 2 | 2021-08-04T13:48:08.000Z | 2021-12-25T02:36:49.000Z | from datetime import datetime
from typing import Optional
import attr
@attr.dataclass
class Yayasan:
yayasan_id: str
nama: str
alamat_jalan: str
rt: str
rw: str
nama_dusun: str
desa_kelurahan: str
kode_wilayah: str
kode_pos: str
lintang: str
bujur: str
nomor_telepon: Optional[str]
nomor_fax: Optional[str]
email: Optional[str]
website: Optional[str]
npyp: Optional[str]
nama_pimpinan_yayasan: str
no_pendirian_yayasan: str
tanggal_pendirian_yayasan: str
nomor_pengesahan_pn_ln: Optional[str]
nomor_sk_bn: Optional[str]
tanggal_sk_bn: str
create_date: datetime
last_update: datetime
soft_delete: str
last_sync: datetime
updater_id: str
kode_wilayah_str: str
vld_count: int
| 20.842105 | 41 | 0.70202 | 108 | 792 | 4.87963 | 0.462963 | 0.14611 | 0.053131 | 0.064516 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.239899 | 792 | 37 | 42 | 21.405405 | 0.875415 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.088235 | 0 | 0.970588 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
583d2395a105d77066a7ada66c5955b238189f4e | 812 | py | Python | articles/views.py | MohammadaliMirhamed/simple-weblog-django | 0922393c54283036bd1a8d1c65a1410a01c573c6 | [
"MIT"
] | 3 | 2021-09-07T06:58:05.000Z | 2021-09-24T08:36:36.000Z | articles/views.py | MohammadaliMirhamed/simple-weblog-django | 0922393c54283036bd1a8d1c65a1410a01c573c6 | [
"MIT"
] | null | null | null | articles/views.py | MohammadaliMirhamed/simple-weblog-django | 0922393c54283036bd1a8d1c65a1410a01c573c6 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.http import HttpResponse
from articles.models import Articles,GeneralSetting,Menu
from django.conf import settings
# from django.shortcuts import render
# def hello(request):
# return render(request, "template/index.html", {})
def index(request):
artcs = Articles.objects.all().order_by('-id')
mnus = Menu.objects.all().order_by('id')
setts = GeneralSetting.objects.filter(id=1)[0]
# return HttpResponse(setts)
return render(request, 'index.html', {'artcs': artcs , 'mnus':mnus ,'setts':setts})
def show(request,articles_id):
artcs = Articles.objects.filter(id=articles_id)[0]
mnus = Menu.objects.all().order_by('id')
# return HttpResponse(artcs.text)
return render(request, 'readmore.html', {'artc': artcs, 'mnus':mnus})
| 31.230769 | 86 | 0.716749 | 107 | 812 | 5.392523 | 0.327103 | 0.069324 | 0.098787 | 0.088388 | 0.233969 | 0.093588 | 0.093588 | 0 | 0 | 0 | 0 | 0.004274 | 0.135468 | 812 | 25 | 87 | 32.48 | 0.817664 | 0.205665 | 0 | 0.153846 | 0 | 0 | 0.081505 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.153846 | false | 0 | 0.307692 | 0 | 0.615385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
58416835e573b99e1e42b0e6dff47feedd80b71e | 17,160 | py | Python | collector_service_sdk/api/key/create_collector_key_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | 5 | 2019-07-31T04:11:05.000Z | 2021-01-07T03:23:20.000Z | collector_service_sdk/api/key/create_collector_key_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | null | null | null | collector_service_sdk/api/key/create_collector_key_pb2.py | easyopsapis/easyops-api-python | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: create_collector_key.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='create_collector_key.proto',
package='key',
syntax='proto3',
serialized_options=None,
serialized_pb=_b('\n\x1a\x63reate_collector_key.proto\x12\x03key\"\xfc\x03\n\x19\x43reateCollectorKeyRequest\x12\x35\n\x06parent\x18\x01 \x01(\x0b\x32%.key.CreateCollectorKeyRequest.Parent\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\x0f\n\x07keyName\x18\x03 \x01(\t\x12\x0e\n\x06labels\x18\x04 \x03(\t\x12\x12\n\nmetricType\x18\x05 \x01(\t\x12\x10\n\x08\x64\x61taType\x18\x06 \x01(\t\x12\x11\n\tagentType\x18\x07 \x01(\t\x12;\n\ttagDefine\x18\x08 \x03(\x0b\x32(.key.CreateCollectorKeyRequest.TagDefine\x12?\n\x0bparamDefine\x18\t \x03(\x0b\x32*.key.CreateCollectorKeyRequest.ParamDefine\x12\x0c\n\x04help\x18\n \x01(\t\x12\x0c\n\x04unit\x18\x0b \x01(\t\x1a\x16\n\x06Parent\x12\x0c\n\x04name\x18\x01 \x01(\t\x1a<\n\tTagDefine\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x02 \x01(\t\x12\x10\n\x08readOnly\x18\x03 \x01(\x08\x1aQ\n\x0bParamDefine\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tvalueType\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x03 \x01(\t\x12\x10\n\x08readOnly\x18\x04 \x01(\x08\"+\n\x1a\x43reateCollectorKeyResponse\x12\r\n\x05keyId\x18\x01 \x01(\t\"\x84\x01\n!CreateCollectorKeyResponseWrapper\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x63odeExplain\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\t\x12-\n\x04\x64\x61ta\x18\x04 \x01(\x0b\x32\x1f.key.CreateCollectorKeyResponseb\x06proto3')
)
_CREATECOLLECTORKEYREQUEST_PARENT = _descriptor.Descriptor(
name='Parent',
full_name='key.CreateCollectorKeyRequest.Parent',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='key.CreateCollectorKeyRequest.Parent.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=377,
serialized_end=399,
)
_CREATECOLLECTORKEYREQUEST_TAGDEFINE = _descriptor.Descriptor(
name='TagDefine',
full_name='key.CreateCollectorKeyRequest.TagDefine',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='key.CreateCollectorKeyRequest.TagDefine.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='default', full_name='key.CreateCollectorKeyRequest.TagDefine.default', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='readOnly', full_name='key.CreateCollectorKeyRequest.TagDefine.readOnly', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=401,
serialized_end=461,
)
_CREATECOLLECTORKEYREQUEST_PARAMDEFINE = _descriptor.Descriptor(
name='ParamDefine',
full_name='key.CreateCollectorKeyRequest.ParamDefine',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='key.CreateCollectorKeyRequest.ParamDefine.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='valueType', full_name='key.CreateCollectorKeyRequest.ParamDefine.valueType', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='default', full_name='key.CreateCollectorKeyRequest.ParamDefine.default', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='readOnly', full_name='key.CreateCollectorKeyRequest.ParamDefine.readOnly', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=463,
serialized_end=544,
)
_CREATECOLLECTORKEYREQUEST = _descriptor.Descriptor(
name='CreateCollectorKeyRequest',
full_name='key.CreateCollectorKeyRequest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='parent', full_name='key.CreateCollectorKeyRequest.parent', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='key', full_name='key.CreateCollectorKeyRequest.key', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='keyName', full_name='key.CreateCollectorKeyRequest.keyName', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='labels', full_name='key.CreateCollectorKeyRequest.labels', index=3,
number=4, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='metricType', full_name='key.CreateCollectorKeyRequest.metricType', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='dataType', full_name='key.CreateCollectorKeyRequest.dataType', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='agentType', full_name='key.CreateCollectorKeyRequest.agentType', index=6,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='tagDefine', full_name='key.CreateCollectorKeyRequest.tagDefine', index=7,
number=8, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='paramDefine', full_name='key.CreateCollectorKeyRequest.paramDefine', index=8,
number=9, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='help', full_name='key.CreateCollectorKeyRequest.help', index=9,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='unit', full_name='key.CreateCollectorKeyRequest.unit', index=10,
number=11, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_CREATECOLLECTORKEYREQUEST_PARENT, _CREATECOLLECTORKEYREQUEST_TAGDEFINE, _CREATECOLLECTORKEYREQUEST_PARAMDEFINE, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=36,
serialized_end=544,
)
_CREATECOLLECTORKEYRESPONSE = _descriptor.Descriptor(
name='CreateCollectorKeyResponse',
full_name='key.CreateCollectorKeyResponse',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='keyId', full_name='key.CreateCollectorKeyResponse.keyId', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=546,
serialized_end=589,
)
_CREATECOLLECTORKEYRESPONSEWRAPPER = _descriptor.Descriptor(
name='CreateCollectorKeyResponseWrapper',
full_name='key.CreateCollectorKeyResponseWrapper',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='code', full_name='key.CreateCollectorKeyResponseWrapper.code', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='codeExplain', full_name='key.CreateCollectorKeyResponseWrapper.codeExplain', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='error', full_name='key.CreateCollectorKeyResponseWrapper.error', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='data', full_name='key.CreateCollectorKeyResponseWrapper.data', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=592,
serialized_end=724,
)
_CREATECOLLECTORKEYREQUEST_PARENT.containing_type = _CREATECOLLECTORKEYREQUEST
_CREATECOLLECTORKEYREQUEST_TAGDEFINE.containing_type = _CREATECOLLECTORKEYREQUEST
_CREATECOLLECTORKEYREQUEST_PARAMDEFINE.containing_type = _CREATECOLLECTORKEYREQUEST
_CREATECOLLECTORKEYREQUEST.fields_by_name['parent'].message_type = _CREATECOLLECTORKEYREQUEST_PARENT
_CREATECOLLECTORKEYREQUEST.fields_by_name['tagDefine'].message_type = _CREATECOLLECTORKEYREQUEST_TAGDEFINE
_CREATECOLLECTORKEYREQUEST.fields_by_name['paramDefine'].message_type = _CREATECOLLECTORKEYREQUEST_PARAMDEFINE
_CREATECOLLECTORKEYRESPONSEWRAPPER.fields_by_name['data'].message_type = _CREATECOLLECTORKEYRESPONSE
DESCRIPTOR.message_types_by_name['CreateCollectorKeyRequest'] = _CREATECOLLECTORKEYREQUEST
DESCRIPTOR.message_types_by_name['CreateCollectorKeyResponse'] = _CREATECOLLECTORKEYRESPONSE
DESCRIPTOR.message_types_by_name['CreateCollectorKeyResponseWrapper'] = _CREATECOLLECTORKEYRESPONSEWRAPPER
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
CreateCollectorKeyRequest = _reflection.GeneratedProtocolMessageType('CreateCollectorKeyRequest', (_message.Message,), {
'Parent' : _reflection.GeneratedProtocolMessageType('Parent', (_message.Message,), {
'DESCRIPTOR' : _CREATECOLLECTORKEYREQUEST_PARENT,
'__module__' : 'create_collector_key_pb2'
# @@protoc_insertion_point(class_scope:key.CreateCollectorKeyRequest.Parent)
})
,
'TagDefine' : _reflection.GeneratedProtocolMessageType('TagDefine', (_message.Message,), {
'DESCRIPTOR' : _CREATECOLLECTORKEYREQUEST_TAGDEFINE,
'__module__' : 'create_collector_key_pb2'
# @@protoc_insertion_point(class_scope:key.CreateCollectorKeyRequest.TagDefine)
})
,
'ParamDefine' : _reflection.GeneratedProtocolMessageType('ParamDefine', (_message.Message,), {
'DESCRIPTOR' : _CREATECOLLECTORKEYREQUEST_PARAMDEFINE,
'__module__' : 'create_collector_key_pb2'
# @@protoc_insertion_point(class_scope:key.CreateCollectorKeyRequest.ParamDefine)
})
,
'DESCRIPTOR' : _CREATECOLLECTORKEYREQUEST,
'__module__' : 'create_collector_key_pb2'
# @@protoc_insertion_point(class_scope:key.CreateCollectorKeyRequest)
})
_sym_db.RegisterMessage(CreateCollectorKeyRequest)
_sym_db.RegisterMessage(CreateCollectorKeyRequest.Parent)
_sym_db.RegisterMessage(CreateCollectorKeyRequest.TagDefine)
_sym_db.RegisterMessage(CreateCollectorKeyRequest.ParamDefine)
CreateCollectorKeyResponse = _reflection.GeneratedProtocolMessageType('CreateCollectorKeyResponse', (_message.Message,), {
'DESCRIPTOR' : _CREATECOLLECTORKEYRESPONSE,
'__module__' : 'create_collector_key_pb2'
# @@protoc_insertion_point(class_scope:key.CreateCollectorKeyResponse)
})
_sym_db.RegisterMessage(CreateCollectorKeyResponse)
CreateCollectorKeyResponseWrapper = _reflection.GeneratedProtocolMessageType('CreateCollectorKeyResponseWrapper', (_message.Message,), {
'DESCRIPTOR' : _CREATECOLLECTORKEYRESPONSEWRAPPER,
'__module__' : 'create_collector_key_pb2'
# @@protoc_insertion_point(class_scope:key.CreateCollectorKeyResponseWrapper)
})
_sym_db.RegisterMessage(CreateCollectorKeyResponseWrapper)
# @@protoc_insertion_point(module_scope)
| 43.333333 | 1,351 | 0.754487 | 2,003 | 17,160 | 6.190215 | 0.092361 | 0.050327 | 0.052504 | 0.038713 | 0.633599 | 0.596661 | 0.586902 | 0.554238 | 0.549238 | 0.545447 | 0 | 0.035304 | 0.121853 | 17,160 | 395 | 1,352 | 43.443038 | 0.787511 | 0.03683 | 0 | 0.673184 | 1 | 0.002793 | 0.210341 | 0.177646 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.013966 | 0 | 0.013966 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
584522e7b0e3bbde35d47122b38e787e80527d38 | 4,758 | py | Python | datablend/core/exceptions.py | bahp/datablend | f0b69a012af6ea7cedc9210d46b3047d8e0bf504 | [
"FTL",
"RSA-MD",
"CECILL-B"
] | null | null | null | datablend/core/exceptions.py | bahp/datablend | f0b69a012af6ea7cedc9210d46b3047d8e0bf504 | [
"FTL",
"RSA-MD",
"CECILL-B"
] | 1 | 2021-05-26T13:09:08.000Z | 2021-05-26T13:09:08.000Z | datablend/core/exceptions.py | bahp/datablend | f0b69a012af6ea7cedc9210d46b3047d8e0bf504 | [
"FTL",
"RSA-MD",
"CECILL-B"
] | null | null | null | # Libraries.
import pandas as pd
class IncompatibleBlenderTemplateError(Exception):
pass
class InvalidBlenderTemplateError(Exception):
pass
class BTNullValueError(InvalidBlenderTemplateError):
"""Error used in the BlenderTemplate.
Not all the columns in the template have been renamed.
Example
-------
========= ============
from_name to_name
========= ============
StudyNo study_number
Age age
Gender
Sex sex
========= ============
"""
def __init__(self, column):
self.column = column
def __str__(self):
msg = "\n{0}: The BlenderTemplate column <{1}> has NULL values. "
return msg.format(self.__class__.__name__, str(self.column))
class BTDuplicateError(InvalidBlenderTemplateError):
"""Error used in the BlenderTemplate.
The column has duplicated values.
.. code:
=========
from_name
=========
StudyNo
Age
Age
Sex
=========
"""
def __init__(self, column, values):
self.column = column
self.values = values
def __str__(self):
msg = "\n{0}: The BlenderTemplate column <{1}> has duplicated values {2}."
return msg.format(self.__class__.__name__, str(self.column), self.values)
class BTMissingRequiredColumnsError(InvalidBlenderTemplateError):
"""Error used in the BlenderTemplate.
The required columns ['from_name', 'to_name'] are missing.
"""
def __init__(self, missing):
self.missing = missing
def __str__(self):
msg = "\n{0}: The BlenderTemplate is missing the following required columns: {1}.\n"
return msg.format(self.__class__.__name__, str(self.missing))
class MissingRequiredColumns(IncompatibleBlenderTemplateError):
"""Error used for errors in the BlenderTemplate.
Attributes:
"""
def __init__(self, widget, missing):
self.widget = widget
self.missing = missing
def __str__(self):
msg = "\n{0}: The BlenderTemplate for {1} must have these columns: {2}.\n"
return msg.format(self.__class__.__name__, self.widget, str(self.missing))
class WrongColumnType(IncompatibleBlenderTemplateError):
pass
class ReplaceWidgetMapWarning(Warning):
"""Warning used for errors in the ReplaceWidget map.
It warns if the map does not contain all the elements in the data.
It warns if the map contains elements that do not appear in the data.
"""
diff1_ = set()
diff2_ = set()
def __init__(self, key, to_replace, data, max_size=10, verbose=10):
"""Constructor.
.. note:
diff1_: elements of data not appearing in replace map.
diff2_: elements of replace map not appearing in data.
Parameters
----------
key: string
Name of the column
dict_values: list
List of keys in the replace map.
data_values: list
List of unique elements in the data.
max_size: int
Max number of elements over which warning should not
be raised.
Returns
-------
"""
def notnull(l):
return [e for e in l if pd.notnull(e)]
# Attributes
self.key = key
self.dict_values = set(notnull(to_replace.keys()))
self.data_values = set(notnull(data.unique()))
self.max_size = max_size
self.verbose = verbose
# Set information
self.diff1_ = self.data_values - self.dict_values
self.diff2_ = self.dict_values - self.data_values
def _is_warning_diff1(self):
return bool(self.diff1_) and len(self.diff1_) < self.max_size
def _is_warning_diff2(self):
return bool(self.diff2_) and len(self.diff2_) < self.max_size
def is_warning(self):
if self.verbose > 9:
return self._is_warning_diff1() |\
self._is_warning_diff2()
return self._is_warning_diff1()
def __str__(self):
"""Returns warning string."""
msg = "\n{0}: Issue with 'to_replace' map for <{1}>.\n"
if self.diff1_:
msg += "\tThe map does not contain all values appearing in\n"
msg += "\tthe data. Please ensure that this is correct. The\n"
msg += "\tvalues are: {2}\n\n"
if self.diff2_:
msg += "\tThe map contains values that do not appear in the\n"
msg += "\tdata. Please ensure that this is correct. The\n"
msg += "\tvalues are: {3}\n"
return msg.format(self.__class__.__name__,
self.key.upper(),
str(self.diff1_),
str(self.diff2_))
| 27.988235 | 92 | 0.595418 | 553 | 4,758 | 4.882459 | 0.22604 | 0.02037 | 0.02037 | 0.035185 | 0.338889 | 0.268148 | 0.215556 | 0.171481 | 0.134074 | 0.103704 | 0 | 0.011269 | 0.291299 | 4,758 | 169 | 93 | 28.153846 | 0.789442 | 0.261665 | 0 | 0.173913 | 0 | 0 | 0.174143 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.202899 | false | 0.043478 | 0.014493 | 0.043478 | 0.507246 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
584c39d4128933b12a300c99f91a36afedbf25aa | 6,531 | py | Python | rldb/db/paper__c51/algo__c51/entries.py | seungjaeryanlee/sotarl | 8c471c4666d6210c68f3cb468e439a2b168c785d | [
"MIT"
] | 45 | 2019-05-13T17:39:33.000Z | 2022-03-07T23:44:13.000Z | rldb/db/paper__c51/algo__c51/entries.py | seungjaeryanlee/sotarl | 8c471c4666d6210c68f3cb468e439a2b168c785d | [
"MIT"
] | 2 | 2019-03-29T01:41:59.000Z | 2019-07-02T02:48:31.000Z | rldb/db/paper__c51/algo__c51/entries.py | seungjaeryanlee/sotarl | 8c471c4666d6210c68f3cb468e439a2b168c785d | [
"MIT"
] | 2 | 2020-04-07T20:57:30.000Z | 2020-07-08T12:55:15.000Z | entries = [
{
'env-title': 'atari-alien',
'env-variant': 'No-op start',
'score': 3166,
},
{
'env-title': 'atari-amidar',
'env-variant': 'No-op start',
'score': 1735,
},
{
'env-title': 'atari-assault',
'env-variant': 'No-op start',
'score': 7203,
},
{
'env-title': 'atari-asterix',
'env-variant': 'No-op start',
'score': 406211,
},
{
'env-title': 'atari-asteroids',
'env-variant': 'No-op start',
'score': 1516,
},
{
'env-title': 'atari-atlantis',
'env-variant': 'No-op start',
'score': 841075,
},
{
'env-title': 'atari-bank-heist',
'env-variant': 'No-op start',
'score': 976,
},
{
'env-title': 'atari-battle-zone',
'env-variant': 'No-op start',
'score': 28742,
},
{
'env-title': 'atari-beam-rider',
'env-variant': 'No-op start',
'score': 14074,
},
{
'env-title': 'atari-berzerk',
'env-variant': 'No-op start',
'score': 1645,
},
{
'env-title': 'atari-bowling',
'env-variant': 'No-op start',
'score': 81.8,
},
{
'env-title': 'atari-boxing',
'env-variant': 'No-op start',
'score': 97.8,
},
{
'env-title': 'atari-breakout',
'env-variant': 'No-op start',
'score': 748,
},
{
'env-title': 'atari-centipede',
'env-variant': 'No-op start',
'score': 9646,
},
{
'env-title': 'atari-chopper-command',
'env-variant': 'No-op start',
'score': 15600,
},
{
'env-title': 'atari-crazy-climber',
'env-variant': 'No-op start',
'score': 179877,
},
{
'env-title': 'atari-defender',
'env-variant': 'No-op start',
'score': 47092,
},
{
'env-title': 'atari-demon-attack',
'env-variant': 'No-op start',
'score': 130955,
},
{
'env-title': 'atari-double-dunk',
'env-variant': 'No-op start',
'score': 2.5,
},
{
'env-title': 'atari-enduro',
'env-variant': 'No-op start',
'score': 3454,
},
{
'env-title': 'atari-fishing-derby',
'env-variant': 'No-op start',
'score': 8.9,
},
{
'env-title': 'atari-freeway',
'env-variant': 'No-op start',
'score': 33.9,
},
{
'env-title': 'atari-frostbite',
'env-variant': 'No-op start',
'score': 3965,
},
{
'env-title': 'atari-gopher',
'env-variant': 'No-op start',
'score': 33641,
},
{
'env-title': 'atari-gravitar',
'env-variant': 'No-op start',
'score': 440,
},
{
'env-title': 'atari-hero',
'env-variant': 'No-op start',
'score': 38874,
},
{
'env-title': 'atari-ice-hockey',
'env-variant': 'No-op start',
'score': -3.5,
},
{
'env-title': 'atari-jamesbond',
'env-variant': 'No-op start',
'score': 1909,
},
{
'env-title': 'atari-kangaroo',
'env-variant': 'No-op start',
'score': 12853,
},
{
'env-title': 'atari-krull',
'env-variant': 'No-op start',
'score': 9735,
},
{
'env-title': 'atari-kung-fu-master',
'env-variant': 'No-op start',
'score': 48192,
},
{
'env-title': 'atari-montezuma-revenge',
'env-variant': 'No-op start',
'score': 0.0,
},
{
'env-title': 'atari-ms-pacman',
'env-variant': 'No-op start',
'score': 3415,
},
{
'env-title': 'atari-name-this-game',
'env-variant': 'No-op start',
'score': 12542,
},
{
'env-title': 'atari-phoenix',
'env-variant': 'No-op start',
'score': 17490,
},
{
'env-title': 'atari-pitfall',
'env-variant': 'No-op start',
'score': 0.0,
},
{
'env-title': 'atari-pong',
'env-variant': 'No-op start',
'score': 20.9,
},
{
'env-title': 'atari-private-eye',
'env-variant': 'No-op start',
'score': 15095,
},
{
'env-title': 'atari-qbert',
'env-variant': 'No-op start',
'score': 23784,
},
{
'env-title': 'atari-riverraid',
'env-variant': 'No-op start',
'score': 17322,
},
{
'env-title': 'atari-road-runner',
'env-variant': 'No-op start',
'score': 55839,
},
{
'env-title': 'atari-robotank',
'env-variant': 'No-op start',
'score': 52.3,
},
{
'env-title': 'atari-seaquest',
'env-variant': 'No-op start',
'score': 266434,
},
{
'env-title': 'atari-skiing',
'env-variant': 'No-op start',
'score': -13901,
},
{
'env-title': 'atari-solaris',
'env-variant': 'No-op start',
'score': 8342,
},
{
'env-title': 'atari-space-invaders',
'env-variant': 'No-op start',
'score': 5747,
},
{
'env-title': 'atari-star-gunner',
'env-variant': 'No-op start',
'score': 49095,
},
{
'env-title': 'atari-surround',
'env-variant': 'No-op start',
'score': 6.8,
},
{
'env-title': 'atari-tennis',
'env-variant': 'No-op start',
'score': 23.1,
},
{
'env-title': 'atari-time-pilot',
'env-variant': 'No-op start',
'score': 8329,
},
{
'env-title': 'atari-tutankham',
'env-variant': 'No-op start',
'score': 280,
},
{
'env-title': 'atari-up-n-down',
'env-variant': 'No-op start',
'score': 15612,
},
{
'env-title': 'atari-venture',
'env-variant': 'No-op start',
'score': 1520,
},
{
'env-title': 'atari-video-pinball',
'env-variant': 'No-op start',
'score': 949604,
},
{
'env-title': 'atari-wizard-of-wor',
'env-variant': 'No-op start',
'score': 9300,
},
{
'env-title': 'atari-yars-revenge',
'env-variant': 'No-op start',
'score': 35050,
},
{
'env-title': 'atari-zaxxon',
'env-variant': 'No-op start',
'score': 10513,
},
]
| 22.677083 | 47 | 0.434237 | 666 | 6,531 | 4.258258 | 0.225225 | 0.16079 | 0.261284 | 0.281382 | 0.497884 | 0.497884 | 0.040903 | 0.027504 | 0.027504 | 0.027504 | 0 | 0.056563 | 0.358444 | 6,531 | 287 | 48 | 22.756098 | 0.620286 | 0 | 0 | 0.205575 | 0 | 0 | 0.444495 | 0.006737 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
585ea08aaef61a3b6670aca7cc2c7e8b17489f69 | 503 | py | Python | cloudmarker/test/test_main.py | TinLe/cloudmarker | 29698420457a86d5d8a0bac156bc98bd656198e1 | [
"MIT"
] | 208 | 2019-04-10T05:15:11.000Z | 2022-03-16T17:41:29.000Z | cloudmarker/test/test_main.py | TinLe/cloudmarker | 29698420457a86d5d8a0bac156bc98bd656198e1 | [
"MIT"
] | 88 | 2018-12-17T18:24:13.000Z | 2021-05-15T04:19:53.000Z | cloudmarker/test/test_main.py | TinLe/cloudmarker | 29698420457a86d5d8a0bac156bc98bd656198e1 | [
"MIT"
] | 15 | 2019-01-03T04:18:33.000Z | 2021-06-03T09:24:31.000Z | """Tests for package execution."""
import importlib
import unittest
from unittest import mock
class MainTest(unittest.TestCase):
"""Tests for package execution."""
@mock.patch('sys.argv', ['cloudmarker', '-c', '-n'])
def test_main(self):
# Run cloudmarker package with only the default base
# configuration and ensure that it runs without issues.
module = importlib.import_module('cloudmarker.__main__')
self.assertEqual(type(module).__name__, 'module')
| 27.944444 | 64 | 0.689861 | 59 | 503 | 5.711864 | 0.677966 | 0.047478 | 0.089021 | 0.142433 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190855 | 503 | 17 | 65 | 29.588235 | 0.82801 | 0.324056 | 0 | 0 | 0 | 0 | 0.14939 | 0 | 0 | 0 | 0 | 0 | 0.125 | 1 | 0.125 | false | 0 | 0.5 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
586003e124053988fad522f5103dd2e6faabc6ea | 2,217 | py | Python | platform/views/login.py | Make-O-Matic/MOM-Platform | 56e55521675aedaf9171c49f9b19b6fdf54d6314 | [
"MIT"
] | 1 | 2018-05-05T15:04:30.000Z | 2018-05-05T15:04:30.000Z | platform/views/login.py | Make-O-Matic/MOM-Platform | 56e55521675aedaf9171c49f9b19b6fdf54d6314 | [
"MIT"
] | null | null | null | platform/views/login.py | Make-O-Matic/MOM-Platform | 56e55521675aedaf9171c49f9b19b6fdf54d6314 | [
"MIT"
] | null | null | null | # Copyright (c) 2016-2017 Enproduktion GmbH & Laber's Lab e.U. (FN 394440i, Austria)
# 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 flask import render_template, flash, session
from flask.views import MethodView
from platform import database
from platform.models.user import User
from platform.models import forms
# Error Handling
from platform import app
from platform.views.errors import ShowErrors
from platform.models.errors import ServerError
class ShowLogin(MethodView):
methods = ["GET", "POST"]
def dispatch_request(self):
form = forms.UserLogin()
if form.validate_on_submit():
db = database.get_db()
user = User.get_by_login(db, form.username.data,
form.password.data)
if user:
session['username'] = user.username
flash("Login successful", "success");
else:
flash("Login failed (your fault)", "error");
return render_template("login.html", form = form)
@app.errorhandler(ServerError)
def handle_invalid_usage(error):
errorview = ShowErrors()
return errorview.dispatch_request(error.message)
| 37.576271 | 84 | 0.713126 | 296 | 2,217 | 5.304054 | 0.533784 | 0.056051 | 0.034395 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008074 | 0.217862 | 2,217 | 58 | 85 | 38.224138 | 0.897347 | 0.504285 | 0 | 0 | 0 | 0 | 0.072155 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0.038462 | 0.307692 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
586b2f638fe329d9ed8d94d23f0ad2a7acfd661e | 7,444 | py | Python | wtfhack/settings/base.py | vaginessa/wtfhack | c4655b09336972605dbebdb3b9a507d2b1ed8a99 | [
"BSD-3-Clause"
] | 2 | 2017-02-19T23:11:30.000Z | 2017-06-01T16:31:53.000Z | wtfhack/settings/base.py | vaginessa/wtfhack | c4655b09336972605dbebdb3b9a507d2b1ed8a99 | [
"BSD-3-Clause"
] | null | null | null | wtfhack/settings/base.py | vaginessa/wtfhack | c4655b09336972605dbebdb3b9a507d2b1ed8a99 | [
"BSD-3-Clause"
] | 1 | 2016-06-27T01:54:09.000Z | 2016-06-27T01:54:09.000Z | """
This is your project's main settings file that can be committed to your
repo. If you need to override a setting locally, use local.py
"""
import os
import dj_database_url
# Your project root
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__) + "../../../")
# Bundles is a dictionary of two dictionaries, css and js, which list css files
# and js files that can be bundled together by the minify app.
MINIFY_BUNDLES = {
'css': {
'base_css': (
'css/style.css',
),
},
'js': {
'libs_js': (
'js/libs/jquery-1.6.2.min.js',
'js/libs/modernizr-2.0.6.min.js',
),
}
}
# DEBUG = TEMPLATE_DEBUG = True
SUPPORTED_NONLOCALES = ['media', 'admin', 'static']
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# Defines the views served for root URLs.
ROOT_URLCONF = 'wtfhack.urls'
EXTERNAL_APPS = [
# Django contrib apps
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.markup',
'django.contrib.humanize',
'django.contrib.syndication',
'django.contrib.staticfiles',
#Github authentication
'social_auth',
# Third-party apps, patches, fixes
#'djcelery',
'django_nose',
# 'debug_toolbar', # Uncomment for debug-toolbar support
'django_extensions',
'crispy_forms',
# Database migrations
'south',
]
INTERNAL_APPS = [
# Application base, containing global templates.
'wtfhack.base',
# Local apps, referenced via wtfhack.appname
]
INSTALLED_APPS = EXTERNAL_APPS + INTERNAL_APPS
AUTHENTICATION_BACKENDS = (
'social_auth.backends.contrib.github.GithubBackend',
'django.contrib.auth.backends.ModelBackend',
)
GITHUB_APP_ID = '967927ca94e211a24a20'
GITHUB_API_SECRET = '101a39e1a0d4c6e3c2b1f01b116bb327ef6bc682'
LOGIN_URL = '/login-form/'
LOGIN_REDIRECT_URL = '/submit'
LOGIN_ERROR_URL = '/login-error/'
SOCIAL_AUTH_COMPLETE_URL_NAME = 'socialauth_complete'
SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'
SOCIAL_AUTH_DEFAULT_USERNAME = 'Hacker'
# Place bcrypt first in the list, so it will be the default password hashing
# mechanism
PASSWORD_HASHERS = (
#'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.MD5PasswordHasher',
'django.contrib.auth.hashers.CryptPasswordHasher',
)
# Sessions
#
# By default, be at least somewhat secure with our session cookies.
SESSION_COOKIE_HTTPONLY = True
# Set this to true if you are using https
SESSION_COOKIE_SECURE = False
## Tests
TEST_RUNNER = 'test_utils.runner.RadicalTestSuiteRunner'
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.example.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.example.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.example.com/static/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
# URL prefix for static files.
# Example: "http://media.example.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
MIDDLEWARE_CLASSES = [
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# 'debug_toolbar.middleware.DebugToolbarMiddleware', # Uncomment for debug-toolbar support
]
TEMPLATE_CONTEXT_PROCESSORS = [
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.media',
'django.core.context_processors.request',
'django.core.context_processors.i18n',
'django.core.context_processors.static',
'django.core.context_processors.csrf',
'django.contrib.messages.context_processors.messages',
'social_auth.context_processors.social_auth_by_name_backends',
'social_auth.context_processors.social_auth_backends',
'social_auth.context_processors.social_auth_by_type_backends',
'social_auth.context_processors.social_auth_login_redirect',
]
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
# "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(PROJECT_ROOT, 'templates'),
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
FIXTURE_DIRS = (
os.path.join(PROJECT_ROOT, 'fixtures'),
)
def custom_show_toolbar(request):
""" Only show the debug toolbar to users with the superuser flag. """
return request.user.is_superuser
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
'HIDE_DJANGO_SQL': True,
'TAG': 'body',
'SHOW_TEMPLATE_CONTEXT': True,
'ENABLE_STACKTRACES': True,
}
DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
)
# Specify a model to use for user profiles, if desired.
#AUTH_PROFILE_MODULE = 'wtfhack.accounts.UserProfile'
FILE_UPLOAD_PERMISSIONS = 0664
# The WSGI Application to use for runserver
WSGI_APPLICATION = 'wtfhack.wsgi.application'
DATABASES = {
'default': dj_database_url.config()
}
| 30.633745 | 94 | 0.738984 | 920 | 7,444 | 5.821739 | 0.357609 | 0.063107 | 0.03174 | 0.026886 | 0.140403 | 0.113704 | 0.092793 | 0.04873 | 0.043316 | 0.043316 | 0 | 0.00999 | 0.152875 | 7,444 | 242 | 95 | 30.760331 | 0.839359 | 0.341617 | 0 | 0.014925 | 0 | 0 | 0.545651 | 0.461904 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.044776 | 0.014925 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
587d36068c40f9a938536fa607aa7d2b3c84250a | 387 | py | Python | nf_common_source/code/services/dataframe_service/dataframe_helpers/dataframe_filter_and_renamer.py | boro-alpha/nf_common | 66d6844d9ae9a86a3e5b461f92e1ba0ec15e85ef | [
"MIT"
] | null | null | null | nf_common_source/code/services/dataframe_service/dataframe_helpers/dataframe_filter_and_renamer.py | boro-alpha/nf_common | 66d6844d9ae9a86a3e5b461f92e1ba0ec15e85ef | [
"MIT"
] | null | null | null | nf_common_source/code/services/dataframe_service/dataframe_helpers/dataframe_filter_and_renamer.py | boro-alpha/nf_common | 66d6844d9ae9a86a3e5b461f92e1ba0ec15e85ef | [
"MIT"
] | null | null | null | import pandas
def dataframe_filter_and_rename(
dataframe: pandas.DataFrame,
filter_and_rename_dictionary: dict) \
-> pandas.DataFrame:
dataframe = \
dataframe.filter(
items=filter_and_rename_dictionary.keys())
dataframe = \
dataframe.rename(
columns=filter_and_rename_dictionary)
return \
dataframe
| 21.5 | 54 | 0.640827 | 36 | 387 | 6.555556 | 0.361111 | 0.152542 | 0.254237 | 0.317797 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.289406 | 387 | 17 | 55 | 22.764706 | 0.858182 | 0 | 0 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.076923 | 0 | 0.230769 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
587fc1efe96e5f0c23454177b21071cda89390a5 | 1,105 | py | Python | test/webdnn_test/util_test/assertion_test.py | steerapi/webdnn | 1df51cc094e5a528cfd3452c264905708eadb491 | [
"MIT"
] | 1 | 2021-04-09T15:55:35.000Z | 2021-04-09T15:55:35.000Z | test/webdnn_test/util_test/assertion_test.py | steerapi/webdnn | 1df51cc094e5a528cfd3452c264905708eadb491 | [
"MIT"
] | null | null | null | test/webdnn_test/util_test/assertion_test.py | steerapi/webdnn | 1df51cc094e5a528cfd3452c264905708eadb491 | [
"MIT"
] | null | null | null | import warnings
from nose.tools import raises
from webdnn.util.assertion import assert_sequence_type
def test_assert_sequence_type_auto_fix_with_list():
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
v = assert_sequence_type([1.0, 2, 3.0], int, auto_fix=True, warning=True)
assert len(w) == 1, len(w)
assert isinstance(v, list), type(v)
assert len(v) == 3, len(v)
assert v[0] == 1, v[0]
assert v[1] == 2, v[1]
assert v[2] == 3, v[2]
def test_assert_sequence_type_auto_fix_with_tuple():
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
v = assert_sequence_type((1.0, 2, 3.0), int, auto_fix=True, warning=False)
assert len(w) == 0, len(w)
assert isinstance(v, tuple), type(v)
assert len(v) == 3, len(v)
assert v[0] == 1, v[0]
assert v[1] == 2, v[1]
assert v[2] == 3, v[2]
@raises(TypeError)
def test_assert_sequence_type_raise_error():
assert_sequence_type((1.0, 2, 3.0), int, auto_fix=False)
| 29.864865 | 82 | 0.627149 | 178 | 1,105 | 3.713483 | 0.219101 | 0.14826 | 0.19062 | 0.09531 | 0.750378 | 0.649017 | 0.649017 | 0.649017 | 0.540091 | 0.540091 | 0 | 0.043581 | 0.231674 | 1,105 | 36 | 83 | 30.694444 | 0.734982 | 0 | 0 | 0.461538 | 0 | 0 | 0.01086 | 0 | 0 | 0 | 0 | 0 | 0.730769 | 1 | 0.115385 | false | 0 | 0.115385 | 0 | 0.230769 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
588d08dc010e619753e5ce68c78b93f29ec58c8b | 5,500 | py | Python | yamwapi/yamwapi_test.py | eggpi/mwapi | 8a03ff8fe0e9578d444302b1c3b15695b9b4589b | [
"MIT"
] | 2 | 2018-05-10T20:46:17.000Z | 2019-12-11T13:15:56.000Z | yamwapi/yamwapi_test.py | eggpi/yamwapi | 8a03ff8fe0e9578d444302b1c3b15695b9b4589b | [
"MIT"
] | null | null | null | yamwapi/yamwapi_test.py | eggpi/yamwapi | 8a03ff8fe0e9578d444302b1c3b15695b9b4589b | [
"MIT"
] | null | null | null | import yamwapi
import mock
import requests_mock
import unittest
import urllib.parse
class MediaWikiAPITest(unittest.TestCase):
TEST_API_URL = 'http://w.org/api.php'
TEST_USER_AGENT = 'user agent'
def setUp(self):
self._api = yamwapi.MediaWikiAPI(self.TEST_API_URL, self.TEST_USER_AGENT)
def test_default_options(self):
self.assertEqual(self._api.options.maxlag, 5)
self.assertEqual(self._api.options.max_retries_maxlag, 3)
self.assertEqual(self._api.options.http_retries, 3)
def test_session_options(self):
self._api.options.http_retries = 5
self.assertEqual(
self._api.session.adapters['http://'].max_retries.total,
self._api.options.http_retries)
self.assertEqual(
self._api.session.adapters['https://'].max_retries.total,
self._api.options.http_retries)
def test_simple_query_with_options(self):
self._api.options.maxlag = 3
expected_request = {
'pageids': '12345',
'format': 'json',
'continue': '',
'maxlag': '3',
'action': 'query',
'utf8': ''
}
with requests_mock.mock() as m:
m.post(self.TEST_API_URL, json = {})
self.assertEqual(next(self._api.query({'pageids': '12345'})), {})
request = m.request_history[0]
sent = urllib.parse.parse_qsl(request.text, keep_blank_values = True)
self.assertEqual(dict(sent), expected_request)
self.assertEqual(
request.headers['User-Agent'], self.TEST_USER_AGENT)
def test_simple_parse_with_options(self):
self._api.options.maxlag = 3
expected_request = {
'text': '{{ cn }}',
'format': 'json',
'maxlag': '3',
'action': 'parse',
'utf8': ''
}
with requests_mock.mock() as m:
m.post(self.TEST_API_URL, json = {})
self.assertEqual(self._api.parse({'text': '{{ cn }}'}), {})
request = m.request_history[0]
sent = urllib.parse.parse_qsl(request.text, keep_blank_values = True)
self.assertTrue(dict(sent), expected_request)
self.assertEqual(
request.headers['User-Agent'], self.TEST_USER_AGENT)
def test_retry_after_once(self):
with mock.patch.object(self._api.session, 'post') as mock_post:
with mock.patch.object(yamwapi.time, 'sleep') as mock_sleep:
mock_retry_after_response = mock.MagicMock()
mock_retry_after_response.headers = {'Retry-After': '3.5'}
mock_post.side_effect = [
mock_retry_after_response, mock.MagicMock()]
self._api.parse({'text': 'x'})
mock_sleep.assert_called_once_with(3.5)
self.assertEqual(mock_post.call_count, 2)
def test_retry_after_too_many(self):
self._api.options.max_retries_maxlag = 1
with mock.patch.object(self._api.session, 'post') as mock_post:
with mock.patch.object(yamwapi.time, 'sleep') as mock_sleep:
mock_retry_after_response = mock.MagicMock()
mock_retry_after_response.headers = {'Retry-After': '3.5'}
mock_post.side_effect = [
mock_retry_after_response, mock_retry_after_response,
mock.MagicMock()]
with self.assertRaises(yamwapi.MediaWikiAPIError):
self._api.parse({'text': 'x'})
mock_sleep.assert_called_once_with(3.5)
def test_cache_maxlag_retry(self):
with mock.patch.object(self._api.session, 'post') as mock_post:
with mock.patch.object(yamwapi.time, 'sleep') as mock_sleep:
mock_maxlag_response = mock.MagicMock()
mock_maxlag_response.json.return_value = {
'error': {
'code': 'maxlag',
'info': 'Waiting for host: 3.5 seconds lagged'}
}
mock_post.side_effect = [
mock_maxlag_response, mock.MagicMock()]
self._api.parse({'text': 'x'})
mock_sleep.assert_called_once_with(3.5)
self.assertEqual(mock_post.call_count, 2)
def test_no_retries_fail(self):
self._api.options.max_retries_maxlag = 0
with mock.patch.object(self._api.session, 'post') as mock_post:
with mock.patch.object(yamwapi.time, 'sleep') as mock_sleep:
mock_retry_after_response = mock.MagicMock()
mock_retry_after_response.headers = {'Retry-After': '3.5'}
mock_post.side_effect = [
mock_retry_after_response, mock_retry_after_response,
mock.MagicMock()]
with self.assertRaises(yamwapi.MediaWikiAPIError):
self._api.parse({'text': 'x'})
mock_sleep.assert_not_called() # just raise the exception
def test_no_retries_success(self):
self._api.options.max_retries_maxlag = 0
with mock.patch.object(self._api.session, 'post') as mock_post:
with mock.patch.object(yamwapi.time, 'sleep') as mock_sleep:
mock_post.return_value = mock.MagicMock()
self._api.parse({'text': 'x'})
mock_sleep.assert_not_called()
if __name__ == '__main__':
unittest.main()
| 42.96875 | 81 | 0.589818 | 635 | 5,500 | 4.811024 | 0.170079 | 0.059574 | 0.050409 | 0.079214 | 0.782651 | 0.724714 | 0.682815 | 0.671686 | 0.645499 | 0.645499 | 0 | 0.010551 | 0.293455 | 5,500 | 127 | 82 | 43.307087 | 0.775605 | 0.004364 | 0 | 0.578947 | 0 | 0 | 0.065765 | 0 | 0 | 0 | 0 | 0 | 0.175439 | 1 | 0.087719 | false | 0 | 0.04386 | 0 | 0.157895 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5894a8f44a0b43cda3f97e2c236cae8003383bcc | 1,066 | py | Python | boardgame/player.py | suryaambrose/boardgame | 459f9ae26ce571d34da88c295eb577b835f3ad13 | [
"MIT"
] | null | null | null | boardgame/player.py | suryaambrose/boardgame | 459f9ae26ce571d34da88c295eb577b835f3ad13 | [
"MIT"
] | null | null | null | boardgame/player.py | suryaambrose/boardgame | 459f9ae26ce571d34da88c295eb577b835f3ad13 | [
"MIT"
] | null | null | null | class Player(object):
"""
Base class for players
"""
def __init__(self, name):
"""
:param name: player's name (str)
"""
self.name = name
def play(self, state):
"""
Human player is asked to choose a move, AI player
decides which move to play.
:param state: Current state of the game (GameState)
"""
raise NotImplementedError()
class HumanPlayer(Player):
"""
Base class for human players
"""
def __init__(self, name, game_viewer):
"""
:param name: player's name (str)
:param game_viewer: Game displayer class (GameViewer)
"""
Player.__init__(self, name)
self.game_viewer = game_viewer
def play(self, state):
self.game_viewer.showState(state)
return self.game_viewer.waitForAMove()
class AiPlayer(Player):
"""
Base class for AI Player containing an algorithm to play.
"""
def __init__(self, name, algorithm):
"""
Create an AiPlayer
@algorithm : Algorithm to be used by the class
"""
Player.__init__(self, name)
self.algo = algorithm
def play(self, state):
return self.algo.getBestNextMove(state)
| 20.5 | 58 | 0.689493 | 144 | 1,066 | 4.923611 | 0.340278 | 0.067701 | 0.084626 | 0.06347 | 0.188999 | 0.06488 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190432 | 1,066 | 51 | 59 | 20.901961 | 0.821553 | 0.400563 | 0 | 0.277778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.055556 | 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 | 0 | 1 | 0 | 0 | 2 |
589c2badb2ed0d75718ad02ad0024380b5ec448a | 406 | py | Python | corehq/apps/importer/urls.py | johan--/commcare-hq | 86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd | [
"BSD-3-Clause"
] | null | null | null | corehq/apps/importer/urls.py | johan--/commcare-hq | 86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd | [
"BSD-3-Clause"
] | 1 | 2022-03-12T01:03:25.000Z | 2022-03-12T01:03:25.000Z | corehq/apps/importer/urls.py | johan--/commcare-hq | 86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd | [
"BSD-3-Clause"
] | null | null | null | from django.conf.urls import *
urlpatterns = patterns('corehq.apps.importer.views',
url(r'^excel/config/$', 'excel_config', name='excel_config'),
url(r'^excel/fields/$', 'excel_fields', name='excel_fields'),
url(r'^excel/commit/$', 'excel_commit', name='excel_commit'),
url(r'^importer_ajax/(?P<download_id>[0-9a-fA-Z]{25,32})/$',
'importer_job_poll', name='importer_job_poll'),
)
| 40.6 | 65 | 0.669951 | 58 | 406 | 4.482759 | 0.517241 | 0.061538 | 0.103846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016621 | 0.110837 | 406 | 9 | 66 | 45.111111 | 0.703601 | 0 | 0 | 0 | 0 | 0 | 0.564039 | 0.192118 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 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 | 0 | 0 | 0 | 2 |
589eaecc97f12868ba91ce091baa19a6e2a41483 | 991 | py | Python | apps/diary/migrations/0003_auto_20210304_0008.py | nafe93/ML_Diary_WEB | e68b31393d4e1e81133fb7b98c33c2a63fde9718 | [
"MIT"
] | null | null | null | apps/diary/migrations/0003_auto_20210304_0008.py | nafe93/ML_Diary_WEB | e68b31393d4e1e81133fb7b98c33c2a63fde9718 | [
"MIT"
] | null | null | null | apps/diary/migrations/0003_auto_20210304_0008.py | nafe93/ML_Diary_WEB | e68b31393d4e1e81133fb7b98c33c2a63fde9718 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2021-03-03 21:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('diary', '0002_diaryentry_mood'),
]
operations = [
migrations.RemoveField(
model_name='diaryentry',
name='mood',
),
migrations.AddField(
model_name='diaryentry',
name='negativeness',
field=models.FloatField(blank=True, null=True, verbose_name='Negativeness'),
),
migrations.AddField(
model_name='diaryentry',
name='neutrality',
field=models.FloatField(blank=True, null=True, verbose_name='Neutrality'),
),
migrations.AddField(
model_name='diaryentry',
name='positiveness',
field=models.FloatField(blank=True, null=True, verbose_name='Positiveness'),
),
]
| 28.314286 | 88 | 0.59334 | 94 | 991 | 6.106383 | 0.457447 | 0.062718 | 0.132404 | 0.160279 | 0.470383 | 0.470383 | 0.256098 | 0.256098 | 0.256098 | 0 | 0 | 0.029703 | 0.286579 | 991 | 34 | 89 | 29.147059 | 0.782178 | 0.068618 | 0 | 0.407407 | 1 | 0 | 0.148913 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.074074 | 0 | 0.185185 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5431ff61acb0bec438baa441a613a87fe6dd783c | 3,099 | py | Python | docs/tutorials/detection/demo_webcam.py | ptrendx/gluon-cv | 5017de97bffcdf7fd90a0be5cdd3201dc7af769e | [
"Apache-2.0"
] | 11 | 2019-12-11T12:47:30.000Z | 2021-01-21T16:36:56.000Z | docs/tutorials/detection/demo_webcam.py | ptrendx/gluon-cv | 5017de97bffcdf7fd90a0be5cdd3201dc7af769e | [
"Apache-2.0"
] | 3 | 2019-09-03T01:35:15.000Z | 2019-11-13T06:28:00.000Z | docs/tutorials/detection/demo_webcam.py | ptrendx/gluon-cv | 5017de97bffcdf7fd90a0be5cdd3201dc7af769e | [
"Apache-2.0"
] | 3 | 2020-01-10T16:50:08.000Z | 2020-11-13T06:59:13.000Z | """09. Run an object detection model on your webcam
==================================================
This article will shows how to play with pre-trained object detection models by running
them directly on your webcam video stream.
.. note::
- This tutorial has only been tested in a MacOS environment
- Python packages required: cv2, matplotlib
- You need a webcam :)
- Python compatible with matplotlib rendering, installed as a framework in MacOS see guide `here <https://matplotlib.org/faq/osx_framework.html>`__
Loading the model and webcam
----------------------------
Finished preparation? Let's get started!
First, import the necessary libraries into python.
.. code-block:: python
import time
import cv2
import gluoncv as gcv
import mxnet as mx
In this tutorial we use ``ssd_512_mobilenet1.0_voc``, a snappy network with good accuracy that should be
well above 1 frame per second on most laptops. Feel free to try a different model from
the `Gluon Model Zoo <../../model_zoo/detection.html>`__ !
.. code-block:: python
# Load the model
net = gcv.model_zoo.get_model('ssd_512_mobilenet1.0_voc', pretrained=True)
We create the webcam handler in opencv to be able to acquire the frames:
.. code-block:: python
# Load the webcam handler
cap = cv2.VideoCapture(0)
time.sleep(1) ### letting the camera autofocus
Detection loop
--------------
The detection loop consists of four phases:
* loading the webcam frame
* pre-processing the image
* running the image through the network
* updating the output with the resulting predictions
.. code-block:: python
axes = None
NUM_FRAMES = 200 # you can change this
for i in range(NUM_FRAMES):
# Load frame from the camera
ret, frame = cap.read()
# Image pre-processing
frame = mx.nd.array(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)).astype('uint8')
rgb_nd, frame = gcv.data.transforms.presets.ssd.transform_test(frame, short=512, max_size=700)
# Run frame through network
class_IDs, scores, bounding_boxes = net(rgb_nd)
# Display the result
img = gcv.utils.viz.cv_plot_bbox(frame, bounding_boxes[0], scores[0], class_IDs[0], class_names=net.classes)
gcv.utils.viz.cv_plot_image(img)
cv2.waitKey(1)
We release the webcam before exiting the script
.. code-block:: python
cap.release()
cv2.destroyAllWindows()
Results
---------
Download the script to run the demo:
:download:`Download demo_webcam_run.py<../../../scripts/detection/demo_webcam_run.py>`
Run the script using `pythonw` on MacOS:
.. code-block:: bash
pythonw demo_webcam_run.py --num-frames 200
.. note::
On MacOS, to enable matplotlib rendering you need python installed as a framework,
see guide `here <https://matplotlib.org/faq/osx_framework.html>`__
If all goes well you should be able to detect objects from the available
classes of the VOC dataset. That includes persons, chairs and TV Screens!
.. image:: https://media.giphy.com/media/9JvoKeUeCt4bdRf3Cv/giphy.gif
"""
| 26.262712 | 151 | 0.693772 | 445 | 3,099 | 4.74382 | 0.469663 | 0.02558 | 0.035528 | 0.021317 | 0.102321 | 0.046424 | 0.046424 | 0.046424 | 0.046424 | 0.046424 | 0 | 0.017138 | 0.190384 | 3,099 | 117 | 152 | 26.487179 | 0.824233 | 0.996773 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
543c061aedd5460ebc67005daf966e2b9849b3f2 | 232 | py | Python | Others/code_festival/code-festival-2014-relay/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | 2 | 2020-06-12T09:54:23.000Z | 2021-05-04T01:34:07.000Z | Others/code_festival/code-festival-2014-relay/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | 961 | 2020-06-23T07:26:22.000Z | 2022-03-31T21:34:52.000Z | Others/code_festival/code-festival-2014-relay/b.py | KATO-Hiro/AtCoder | cbbdb18e95110b604728a54aed83a6ed6b993fde | [
"CC0-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
def main():
a, s = map(int, input().split())
if a >= s:
print('Congratulations!')
else:
print('Enjoy another semester...')
if __name__ == '__main__':
main()
| 15.466667 | 43 | 0.474138 | 25 | 232 | 4.08 | 0.76 | 0.039216 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006452 | 0.331897 | 232 | 14 | 44 | 16.571429 | 0.651613 | 0.090517 | 0 | 0 | 0 | 0 | 0.251282 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0 | 0 | 0 | 0.125 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5446e46f0e318f88048a393ce0914809fa6a79bd | 2,278 | py | Python | scripts/benchmark_configurations.py | yashadhikari/ELISA | d9eee200d119a37264ba3b738b01c319d9c760c2 | [
"MIT"
] | null | null | null | scripts/benchmark_configurations.py | yashadhikari/ELISA | d9eee200d119a37264ba3b738b01c319d9c760c2 | [
"MIT"
] | null | null | null | scripts/benchmark_configurations.py | yashadhikari/ELISA | d9eee200d119a37264ba3b738b01c319d9c760c2 | [
"MIT"
] | null | null | null | from memory import Cache, Memory
MEMORY_ACCESS_TIME = 10
DRAM = Memory(lines=2**20, delay=MEMORY_ACCESS_TIME)
dram_only = {
'memory_heirarchy': [DRAM],
'pipeline_enabled': True,
'name': 'dram_only'
}
DRAM = Memory(lines=2**20, delay=MEMORY_ACCESS_TIME)
L1 = Cache(lines=2**10, delay=0, next_level=DRAM)
L1_caching = {
'memory_heirarchy': [L1, DRAM],
'pipeline_enabled': True,
'name': 'L1_caching'
}
DRAM = Memory(lines=2**20, delay=MEMORY_ACCESS_TIME)
L2 = Cache(lines=2**12, delay=3, next_level=DRAM)
L1 = Cache(lines=2**10, delay=0, next_level=L2)
L2_caching = {
'memory_heirarchy': [L1, L2, DRAM],
'pipeline_enabled': True,
'name': 'L2_caching'
}
DRAM = Memory(lines=2**20, delay=MEMORY_ACCESS_TIME)
L3 = Cache(lines=2**14, delay=3, next_level=DRAM)
L2 = Cache(lines=2**12, delay=3, next_level=L3)
L1 = Cache(lines=2**10, delay=0, next_level=L2)
L3_caching = {
'memory_heirarchy': [L1, L2, L3, DRAM],
'pipeline_enabled': True,
'name': 'L3_caching'
}
DRAM = Memory(lines=2**20, delay=MEMORY_ACCESS_TIME)
dram_only_no_pipelining = {
'memory_heirarchy': [DRAM],
'pipeline_enabled': False,
'name': 'dram_only_no_pipelining'
}
DRAM = Memory(lines=2**20, delay=MEMORY_ACCESS_TIME)
L1 = Cache(lines=2**10, delay=0, next_level=DRAM)
L1_caching_no_pipelining = {
'memory_heirarchy': [L1, DRAM],
'pipeline_enabled': False,
'name': 'L1_caching_no_pipelining'
}
DRAM = Memory(lines=2**20, delay=MEMORY_ACCESS_TIME)
L2 = Cache(lines=2**12, delay=3, next_level=DRAM)
L1 = Cache(lines=2**10, delay=0, next_level=L2)
L2_caching_no_pipelining = {
'memory_heirarchy': [L1, L2, DRAM],
'pipeline_enabled': False,
'name': 'L2_caching_no_pipelining'
}
DRAM = Memory(lines=2**20, delay=MEMORY_ACCESS_TIME)
L3 = Cache(lines=2**14, delay=3, next_level=DRAM)
L2 = Cache(lines=2**12, delay=3, next_level=L3)
L1 = Cache(lines=2**10, delay=0, next_level=L2)
L3_caching_no_pipelining = {
'memory_heirarchy': [L1, L2, L3, DRAM],
'pipeline_enabled': False,
'name': 'L3_caching_no_pipelining'
}
configurations = [dram_only, L1_caching, L2_caching, L3_caching,
dram_only_no_pipelining, L1_caching_no_pipelining,
L2_caching_no_pipelining, L3_caching_no_pipelining]
| 28.835443 | 69 | 0.693152 | 342 | 2,278 | 4.342105 | 0.093567 | 0.080808 | 0.088889 | 0.086195 | 0.841077 | 0.749495 | 0.692929 | 0.625589 | 0.571717 | 0.571717 | 0 | 0.06318 | 0.152327 | 2,278 | 78 | 70 | 29.205128 | 0.705852 | 0 | 0 | 0.553846 | 0 | 0 | 0.185332 | 0.041722 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.015385 | 0 | 0.015385 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
5453b5b552c3edaf8f9f3af50fb0c4c84109585d | 541 | py | Python | py2nb/nb2py.py | DSqiansun/py2nb | 772ce7eb6bc3715124e2c3c228c99e49a1608039 | [
"MIT"
] | 1 | 2019-01-04T16:09:19.000Z | 2019-01-04T16:09:19.000Z | py2nb/nb2py.py | bjornaa/py2nb | 772ce7eb6bc3715124e2c3c228c99e49a1608039 | [
"MIT"
] | null | null | null | py2nb/nb2py.py | bjornaa/py2nb | 772ce7eb6bc3715124e2c3c228c99e49a1608039 | [
"MIT"
] | 2 | 2019-01-02T21:14:09.000Z | 2021-05-14T17:05:34.000Z | import nbformat
def nb2py(nbfile, pyfile):
nb = nbformat.read(nbfile, as_version=4)
with open(pyfile, mode='wt', encoding='utf-8') as pyf:
for cell in nb.cells:
type = cell.cell_type
if type == 'code':
pyf.write('#%%\n')
pyf.write(cell.source)
pyf.write('\n\n')
elif type == 'markdown':
pyf.write('#%%\n')
pyf.write('"""\n')
pyf.write(cell.source)
pyf.write('\n"""\n\n')
| 24.590909 | 58 | 0.452865 | 64 | 541 | 3.796875 | 0.484375 | 0.230453 | 0.185185 | 0.148148 | 0.341564 | 0.304527 | 0.304527 | 0.304527 | 0.304527 | 0.304527 | 0 | 0.008982 | 0.382625 | 541 | 21 | 59 | 25.761905 | 0.718563 | 0 | 0 | 0.266667 | 0 | 0 | 0.086876 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.066667 | 0 | 0.133333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
54547513728eb1e362401508d3049d530994148e | 1,256 | py | Python | autogoal/contrib/sklearn/__init__.py | yacth/autogoal | a55c1534161e850587e2ca3533aa2fd5ae28569e | [
"MIT"
] | null | null | null | autogoal/contrib/sklearn/__init__.py | yacth/autogoal | a55c1534161e850587e2ca3533aa2fd5ae28569e | [
"MIT"
] | null | null | null | autogoal/contrib/sklearn/__init__.py | yacth/autogoal | a55c1534161e850587e2ca3533aa2fd5ae28569e | [
"MIT"
] | null | null | null | """
This module contains wrappers for several estimators and transformers
from `scikit-learn`.
!!! warning
Importing this module requires `sklearn` with a version equal or greater
than `0.22`. You can either install it manually or with `pip install autogoal[sklearn]`.
Most of the classes and functions inside this module deal with the automatic
generation of wrappers and thus are considered private API.
The main public functionality exposed by this module is the function
[find_classes](/api/autogoal.contrib.sklearn/#find_classes), which allows to
enumerate the wrappers implemented in this module applying some filters.
!!! note
You can manually import any wrapper class directly from `autogoal.contrib.sklearn._generated`
buy beware that namespace changes wildly from version to version and classes in it
might disappear or change their signature anytime.
"""
try:
import sklearn
major, minor, *rest = sklearn.__version__.split(".")
assert int(major) == 0 and int(minor) >= 22
except:
print("(!) Code in `autogoal.contrib.sklearn` requires `sklearn=^0.22`.")
print("(!) You can install it with `pip install autogoal[sklearn]`.")
raise ImportError()
from ._generated import *
from ._manual import *
| 35.885714 | 97 | 0.749204 | 174 | 1,256 | 5.356322 | 0.557471 | 0.053648 | 0.070815 | 0.04721 | 0.062232 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008629 | 0.169586 | 1,256 | 34 | 98 | 36.941176 | 0.884947 | 0.701433 | 0 | 0 | 0 | 0 | 0.340599 | 0.070845 | 0 | 0 | 0 | 0 | 0.1 | 1 | 0 | true | 0 | 0.4 | 0 | 0.4 | 0.2 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
545630c62dda66dac307aa2df2410f3bbfc1e8de | 338 | py | Python | 32 parient child class.py | thanwaimdy/Others | e64b45d5b8113c745b6dfecfd54d731c9b0f27a6 | [
"MIT"
] | null | null | null | 32 parient child class.py | thanwaimdy/Others | e64b45d5b8113c745b6dfecfd54d731c9b0f27a6 | [
"MIT"
] | null | null | null | 32 parient child class.py | thanwaimdy/Others | e64b45d5b8113c745b6dfecfd54d731c9b0f27a6 | [
"MIT"
] | null | null | null | # you will learn more about superclass and subclass
print("Hello let's start the class")
class parents:
var1 = "one"
var2 = "two"
class child(parents):
# var1 = "one"
# var2 = "two"
var2 = "three"
obj = parents()
cobj = child()
print(obj.var1)
print(obj.var2)
print(cobj.var1)
print(cobj.var2)
| 12.071429 | 51 | 0.60355 | 46 | 338 | 4.434783 | 0.521739 | 0.107843 | 0.137255 | 0.176471 | 0.205882 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036145 | 0.263314 | 338 | 27 | 52 | 12.518519 | 0.783133 | 0.239645 | 0 | 0 | 0 | 0 | 0.151394 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0.416667 | 0.416667 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
5470b728fece7c013228ca516ac57a250d05d027 | 252 | py | Python | splitiorequests/models/splits/depends.py | mikoblog/splitio-requests | c09b069e49f5224cbe3f892a5731c62885fd6151 | [
"MIT"
] | null | null | null | splitiorequests/models/splits/depends.py | mikoblog/splitio-requests | c09b069e49f5224cbe3f892a5731c62885fd6151 | [
"MIT"
] | 4 | 2020-11-22T12:07:45.000Z | 2021-03-26T23:44:12.000Z | splitiorequests/models/splits/depends.py | mikoblog/splitio-requests | c09b069e49f5224cbe3f892a5731c62885fd6151 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Depends dataclass"""
from typing import List
from dataclasses import dataclass
@dataclass
class Depends:
"""Split Definition's Rule's Condition's Matcher's Depends model"""
splitName: str
treatments: List[str]
| 19.384615 | 71 | 0.702381 | 32 | 252 | 5.53125 | 0.65625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004808 | 0.174603 | 252 | 12 | 72 | 21 | 0.846154 | 0.404762 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 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 | 0 | 0 | 0 | 2 |
5475bff1e28db07ad788dae614bde2a3e0dbdf44 | 191 | py | Python | exercises/en/exc_03_14_03.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | 2 | 2020-07-07T01:46:37.000Z | 2021-04-20T03:19:43.000Z | exercises/en/exc_03_14_03.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | exercises/en/exc_03_14_03.py | tuanducdesign/spacy-course | f8d092c5fa2997fccb3f367d174dce8667932b3d | [
"MIT"
] | null | null | null | import spacy
nlp = spacy.blank("en")
people = ["David Bowie", "Angela Merkel", "Lady Gaga"]
# Create a list of patterns for the PhraseMatcher
patterns = [nlp(person) for person in people]
| 21.222222 | 54 | 0.712042 | 28 | 191 | 4.857143 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167539 | 191 | 8 | 55 | 23.875 | 0.855346 | 0.246073 | 0 | 0 | 0 | 0 | 0.246479 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
547e36b08f8099fec18f3e7dde89cfbe7457401e | 1,257 | py | Python | aboutAppUi.py | sky7st/PTT-Beauty-Downloader | 94c67b611e3c86dde9a855d027fa955ceb3b4c06 | [
"MIT"
] | null | null | null | aboutAppUi.py | sky7st/PTT-Beauty-Downloader | 94c67b611e3c86dde9a855d027fa955ceb3b4c06 | [
"MIT"
] | null | null | null | aboutAppUi.py | sky7st/PTT-Beauty-Downloader | 94c67b611e3c86dde9a855d027fa955ceb3b4c06 | [
"MIT"
] | 1 | 2017-12-06T02:56:28.000Z | 2017-12-06T02:56:28.000Z | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'aboutApp.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_AboutAppDialog(object):
def setupUi(self, AboutAppDialog):
AboutAppDialog.setObjectName(_fromUtf8("AboutAppDialog"))
AboutAppDialog.setWindowModality(QtCore.Qt.NonModal)
AboutAppDialog.setEnabled(False)
AboutAppDialog.resize(400, 300)
AboutAppDialog.setSizeGripEnabled(False)
AboutAppDialog.setModal(True)
self.retranslateUi(AboutAppDialog)
QtCore.QMetaObject.connectSlotsByName(AboutAppDialog)
def retranslateUi(self, AboutAppDialog):
AboutAppDialog.setWindowTitle(_translate("AboutAppDialog", "關於此APP", None))
| 31.425 | 83 | 0.731106 | 127 | 1,257 | 7.165354 | 0.535433 | 0.07033 | 0.087912 | 0.123077 | 0.18022 | 0.18022 | 0.18022 | 0.18022 | 0.18022 | 0.18022 | 0 | 0.017442 | 0.178998 | 1,257 | 39 | 84 | 32.230769 | 0.864341 | 0.144789 | 0 | 0.24 | 1 | 0 | 0.031865 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.04 | 0.12 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
54894b3284ca925d82895c18a4ff30f1a627b65d | 2,534 | py | Python | XICRA_pip/XICRA/scripts/multiQC_report.py | MartaLoBalastegui/XICRA | 74a7e74379c7e1b3fc1360d2c609994e884ee37a | [
"MIT"
] | 3 | 2021-05-16T21:13:22.000Z | 2022-01-23T08:47:48.000Z | XICRA_pip/XICRA/scripts/multiQC_report.py | MartaLoBalastegui/XICRA | 74a7e74379c7e1b3fc1360d2c609994e884ee37a | [
"MIT"
] | 16 | 2021-03-11T10:51:25.000Z | 2022-03-12T01:02:00.000Z | XICRA_pip/XICRA/scripts/multiQC_report.py | MartaLoBalastegui/XICRA | 74a7e74379c7e1b3fc1360d2c609994e884ee37a | [
"MIT"
] | 3 | 2021-03-05T10:07:38.000Z | 2022-01-23T08:48:06.000Z | #!/usr/bin/env python3
##########################################################
## Jose F. Sanchez ##
## Copyright (C) 2019 Lauro Sumoy Lab, IGTP, Spain ##
##########################################################
"""
Calls multiQC to generate HTML statistics reports.
"""
## useful imports
import os
import io
import sys
from io import open
from sys import argv
from termcolor import colored
## import my modules
from HCGB import functions
from XICRA.config import set_config
############
def multiQC_module_call(givenList, name, path, option):
"""
Prepares files for multiQC report generation.
:param givenList: List of folder to search for multiQC report.
:param name: Name to include in the html report.
:param path: Absolute path for the output folder.
:param option: Some options to provide to multiQC_call.
:type givenList: list
:type name: string
:type path: string
:type option: string
.. seealso:: This function depends on other XICRA functions called:
- :func:`XICRA.scripts.functions.printList2file`
- :func:`XICRA.scripts.multiQC_report.multiQC_call`
"""
pathFile = path + '/' + 'samples.txt'
functions.main_functions.printList2file(pathFile, givenList)
multiQC_call(pathFile, name, path, option)
############
def multiQC_call(pathFile, name, folder, option):
"""
multiQC_ report generation call.
:param pathFile: File containing list of files to include in report.
:param name: Name to include in the html report.
:param folder: Absolute path for the output folder.
:param option: Options to provide to multiQC call.
:type pathFile: string
:type name: string
:type folder: string
:type option: string
:returns: :func:`XICRA.scripts.functions.system_call_functions.system_call` output (OK/FALSE)
.. seealso:: This function depends on other XICRA functions called:
- :func:`XICRA.scripts.functions.system_call_functions.system_call`
"""
multiqc_bin = set_config.get_exe("multiqc")
## set options for call
cmd = "%s --force -o %s -n %s -l %s -p -i 'MultiQC report' -b 'HTML report generated for multiple samples and steps' %s" %(multiqc_bin, folder, name, pathFile, option)
## if a report was previously generated in the folder
## force to delete and generate a new one
return(functions.system_call_functions.system_call(cmd))
| 33.342105 | 171 | 0.635754 | 309 | 2,534 | 5.139159 | 0.355987 | 0.056675 | 0.071788 | 0.047229 | 0.328086 | 0.328086 | 0.304156 | 0.262594 | 0.210957 | 0.15869 | 0 | 0.003573 | 0.226914 | 2,534 | 75 | 172 | 33.786667 | 0.807044 | 0.569455 | 0 | 0 | 0 | 0.0625 | 0.173052 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.5 | 0 | 0.625 | 0.0625 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
54979c743453102a9e9fc5139b8a2a1db69e2967 | 345 | py | Python | tests/test_flask_init.py | DilwoarH/digitalmarketplace-utils | 5d45efe09d274f2e6642ce320eb8d83aec798ce7 | [
"MIT"
] | null | null | null | tests/test_flask_init.py | DilwoarH/digitalmarketplace-utils | 5d45efe09d274f2e6642ce320eb8d83aec798ce7 | [
"MIT"
] | null | null | null | tests/test_flask_init.py | DilwoarH/digitalmarketplace-utils | 5d45efe09d274f2e6642ce320eb8d83aec798ce7 | [
"MIT"
] | null | null | null | from dmutils.flask_init import pluralize
import pytest
@pytest.mark.parametrize("count,singular,plural,output", [
(0, "person", "people", "people"),
(1, "person", "people", "person"),
(2, "person", "people", "people"),
])
def test_pluralize(count, singular, plural, output):
assert pluralize(count, singular, plural) == output
| 28.75 | 58 | 0.675362 | 40 | 345 | 5.775 | 0.525 | 0.168831 | 0.246753 | 0.324675 | 0.294372 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010169 | 0.144928 | 345 | 11 | 59 | 31.363636 | 0.772881 | 0 | 0 | 0 | 0 | 0 | 0.237681 | 0.081159 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.111111 | false | 0 | 0.222222 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
549af427e5ffda0129ded2fc53d016a5bf38653d | 2,344 | py | Python | test/layers/activations/activations.py | hzhexuan/onnx2keras | 816124526d27d0ec61fb62422a309d7172c720b0 | [
"MIT"
] | 2 | 2021-04-24T00:57:53.000Z | 2021-11-17T11:27:15.000Z | test/layers/activations/activations.py | ag169/onnx2keras | 0c817fb7bd776f38bab0fcca00b1af26753bf02f | [
"MIT"
] | null | null | null | test/layers/activations/activations.py | ag169/onnx2keras | 0c817fb7bd776f38bab0fcca00b1af26753bf02f | [
"MIT"
] | 2 | 2020-02-03T12:28:33.000Z | 2020-05-22T11:05:03.000Z | import torch
import numpy as np
import onnx
import os
from onnx2keras import onnx_to_keras, check_torch_keras_error
from relu import LayerReLUTest, FReLUTest
from hard_tanh import LayerHardtanhTest, FHardtanhTest
from leaky_relu import LayerLeakyReLUTest, FLeakyReLUTest
from selu import LayerSELUTest, FSELUTest
from sigmoid import LayerSigmoidTest, FSigmoidTest
from tanh import LayerTanhTest, FTanhTest
from log_sigmoid import LayerLogSigmoidTest, FLogSigmoidTest
# from threshold import LayerThresholdTest, FThresholdTest # Not Supported by ONNX
from relu6 import LayerReLU6Test, FReLU6Test
from softmax import LayerSoftmaxTest, FSoftmaxTest
# from log_softmax import LayerLogSoftmaxTest, FLogSoftmaxTest # Not Supported by ONNX
# TODO:
# Threshold, Softmax2d, LogSoftmax, ELU, CELU, Hardshrink, \
# Softplus, Softshrink, MultiheadAttention, PReLU, Softsign, Softmin, Tanhshrink, RReLU, GLU
if __name__ == '__main__':
max_error = 0
for act_type in [
# LayerLogSoftmaxTest, FLogSoftmaxTest, # Not Supported by ONNX
LayerSoftmaxTest, FSoftmaxTest,
LayerReLU6Test, FReLU6Test,
# LayerThresholdTest, FThresholdTest, # Not Supported by ONNX
LayerLogSigmoidTest, FLogSigmoidTest,
LayerTanhTest, FTanhTest,
LayerSigmoidTest, FSigmoidTest,
LayerSELUTest, FSELUTest,
LayerLeakyReLUTest, FLeakyReLUTest,
LayerHardtanhTest, FHardtanhTest,
LayerReLUTest, FReLUTest,]:
for i in range(10):
model = act_type()
model.eval()
input_np = np.random.uniform(0, 1, (1, 3, 224, 224))
input_var = torch.FloatTensor(input_np)
torch.onnx.export(model, input_var, "_tmpnet.onnx", verbose=True, input_names=['test_in'],
output_names=['test_out'])
onnx_model = onnx.load('_tmpnet.onnx')
k_model = onnx_to_keras(onnx_model, ['test_in'])
os.unlink('_tmpnet.onnx')
error = check_torch_keras_error(model, k_model, input_np)
print('Error:', error)
if max_error < error:
max_error = error
print('Max error: {0}'.format(max_error))
| 39.066667 | 102 | 0.656997 | 234 | 2,344 | 6.388889 | 0.418803 | 0.026756 | 0.037458 | 0.048161 | 0.136455 | 0.136455 | 0 | 0 | 0 | 0 | 0 | 0.012331 | 0.273464 | 2,344 | 59 | 103 | 39.728814 | 0.865531 | 0.188993 | 0 | 0 | 0 | 0 | 0.045527 | 0 | 0 | 0 | 0 | 0.016949 | 0 | 1 | 0 | false | 0 | 0.341463 | 0 | 0.341463 | 0.04878 | 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 | 0 | 0 | 0 | 2 |
549cf5bca5aa7f11085c5cb5bda986044b9b69c0 | 1,394 | py | Python | structural/bridge.py | zitryss/Design-Patterns-in-Python | 700ce9df25cba0baf96cd5e3ee41e7d5940c6a9b | [
"MIT"
] | 5 | 2017-07-09T12:08:45.000Z | 2018-03-06T01:39:10.000Z | structural/bridge.py | zitryss/Design-Patterns-in-Python | 700ce9df25cba0baf96cd5e3ee41e7d5940c6a9b | [
"MIT"
] | null | null | null | structural/bridge.py | zitryss/Design-Patterns-in-Python | 700ce9df25cba0baf96cd5e3ee41e7d5940c6a9b | [
"MIT"
] | null | null | null | """
Decouple an abstraction from its implementation so that the two can vary
independently.
"""
import abc
class Abstraction:
"""
Define the abstraction's interface.
Maintain a reference to an object of type Implementor.
"""
def __init__(self, imp):
self._imp = imp
def operation(self):
self._imp.operation_imp()
class Implementor(metaclass=abc.ABCMeta):
"""
Define the interface for implementation classes. This interface
doesn't have to correspond exactly to Abstraction's interface; in
fact the two interfaces can be quite different. Typically the
Implementor interface provides only primitive operations, and
Abstraction defines higher-level operations based on these
primitives.
"""
@abc.abstractmethod
def operation_imp(self):
pass
class ConcreteImplementorA(Implementor):
"""
Implement the Implementor interface and define its concrete
implementation.
"""
def operation_imp(self):
pass
class ConcreteImplementorB(Implementor):
"""
Implement the Implementor interface and define its concrete
implementation.
"""
def operation_imp(self):
pass
def main():
concrete_implementor_a = ConcreteImplementorA()
abstraction = Abstraction(concrete_implementor_a)
abstraction.operation()
if __name__ == "__main__":
main()
| 21.446154 | 72 | 0.701578 | 153 | 1,394 | 6.248366 | 0.457516 | 0.029289 | 0.072176 | 0.059623 | 0.243724 | 0.243724 | 0.209205 | 0.209205 | 0.209205 | 0.209205 | 0 | 0 | 0.227403 | 1,394 | 64 | 73 | 21.78125 | 0.887651 | 0.469871 | 0 | 0.272727 | 0 | 0 | 0.01252 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0.136364 | 0.045455 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
54b906d4d92e5b6c29cc05e65387f63d82d29351 | 547 | py | Python | lightbulb/ext/wtf/base.py | tandemdude/lightbulb-ext-wtf | e15c56b80865e7cafd012441f5a32554fb787041 | [
"Beerware"
] | 2 | 2022-01-16T14:18:32.000Z | 2022-03-13T11:36:00.000Z | lightbulb/ext/wtf/base.py | tandemdude/lightbulb-wtf | e15c56b80865e7cafd012441f5a32554fb787041 | [
"Beerware"
] | null | null | null | lightbulb/ext/wtf/base.py | tandemdude/lightbulb-wtf | e15c56b80865e7cafd012441f5a32554fb787041 | [
"Beerware"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright © tandemdude 2021-present
from __future__ import annotations
__all__ = ["_NotAGeneric", "_SingleArgBase"]
import abc
import typing as t
T = t.TypeVar("T")
class _NotAGeneric(abc.ABC):
@abc.abstractmethod
def __getitem__(self, item: t.Any) -> t.Any:
...
class _SingleArgBase(_NotAGeneric, t.Generic[T], abc.ABC):
def __init__(self, val: t.Optional[T] = None) -> None:
self.val = val
def __getitem__(self, item: T) -> _SingleArgBase[T]:
return self.__class__(item)
| 21.88 | 58 | 0.659963 | 70 | 547 | 4.742857 | 0.471429 | 0.054217 | 0.084337 | 0.108434 | 0.114458 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01139 | 0.197441 | 547 | 24 | 59 | 22.791667 | 0.742597 | 0.104205 | 0 | 0 | 0 | 0 | 0.055441 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.214286 | 0.071429 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
54bbe006be9d09be6d68f206062b71313040dcf7 | 210 | py | Python | check_smiles.py | jensengroup/fragreact | 2a9113505fd469e934eec6c6ac8200de67f65dd6 | [
"MIT"
] | 2 | 2018-10-01T00:40:12.000Z | 2020-01-16T15:02:51.000Z | check_smiles.py | jensengroup/fragreact | 2a9113505fd469e934eec6c6ac8200de67f65dd6 | [
"MIT"
] | null | null | null | check_smiles.py | jensengroup/fragreact | 2a9113505fd469e934eec6c6ac8200de67f65dd6 | [
"MIT"
] | 1 | 2021-04-24T10:53:30.000Z | 2021-04-24T10:53:30.000Z |
import numpy as np
import re
from rdkit import Chem
if __name__ == "__main__":
import sys
args = sys.argv[1:]
smiless = args
for smiles in smiless:
m = Chem.MolFromSmiles(smiles)
| 12.352941 | 38 | 0.638095 | 29 | 210 | 4.344828 | 0.724138 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006667 | 0.285714 | 210 | 16 | 39 | 13.125 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0.038647 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 0.444444 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
49c9f817ac66870ba737059eed179db3b9543096 | 11,296 | py | Python | digsby/src/tests/datastore/v0.py | ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | [
"Python-2.0"
] | 35 | 2015-08-15T14:32:38.000Z | 2021-12-09T16:21:26.000Z | digsby/src/tests/datastore/v0.py | niterain/digsby | 16a62c7df1018a49eaa8151c0f8b881c7e252949 | [
"Python-2.0"
] | 4 | 2015-09-12T10:42:57.000Z | 2017-02-27T04:05:51.000Z | digsby/src/tests/datastore/v0.py | niterain/digsby | 16a62c7df1018a49eaa8151c0f8b881c7e252949 | [
"Python-2.0"
] | 15 | 2015-07-10T23:58:07.000Z | 2022-01-23T22:16:33.000Z | import path
import unittest
import hashlib
import sysident
from datastore.v0 import LoginInfo
from tests.datastore.common import YAMLDatastoreTests
data = '''
---
last: !python/unicode username
users:
? !python/unicode username
:
password: !binary |
/3m/lJnajX0=
autologin: False
save: True
username: !python/unicode username
? !python/unicode veryreactive1
:
username: !python/unicode veryreactive1
save: False
autologin: False
password: ""
~:
status: ""
pos: !python/tuple
- 136
- 106
"":
pos: !python/tuple
- 200
- 200
password: ""
autologin: False
save: False
username: ""
'''
## Old classes for compatibility testing
import syck
import os.path
import stdpaths
import traceback
import cPickle
class SplashDiskStorage(object):
info_default = {'': dict(username='',
password='',
save=False,
autologin=False,
pos=(200, 200)),
None: dict()}
last_default = ''
def get_conf_dir(self):
'Returns (and makes, if necessary) the user application directory.'
c_dir = stdpaths.userdata
try:
return c_dir
finally:
if not os.path.exists(c_dir):
os.mkdir(c_dir)
def get_splash_data_path(self):
return os.path.join(self.get_conf_dir(), self.data_file_name %
('dev' if sys.REVISION == 'dev' else ''))
def crypt_pws(self, info, codec):
for user in info:
if 'password' in info[user]:
if codec == 'encode':
encrypted_password = self.simple_crypt(
info[user]['password'].encode('utf8'),
keymat=user.encode('utf8')
)
info[user]['password'] = encrypted_password
elif codec == 'decode':
decrypted_password = self.simple_crypt(
info[user]['password'],
keymat=user.encode('utf8')
)
info[user]['password'] = decrypted_password.decode('utf8')
else:
raise AssertionError
def simple_crypt(self, s, k=None, keymat=''):
raise NotImplementedError
def save_to_disk(self, last, info):
raise NotImplementedError
def load_from_disk(self):
raise NotImplementedError
def can_write(self):
fname = os.path.join(self.get_conf_dir(), '__test__')
test_data = "test"
try:
with open(fname, 'wb') as f:
f.write(test_data)
with open(fname, 'rb') as f:
if f.read() == test_data:
return True
return False
except Exception:
return False
finally:
try:
if os.path.exists(fname):
os.remove(fname)
except Exception:
pass
class NewSplashDiskStorage(SplashDiskStorage):
data_file_name = 'logininfo%s.yaml'
def __init__(self):
SplashDiskStorage.__init__(self)
def get_conf_dir(self):
'Returns (and makes, if necessary) the user application directory.'
c_dir = stdpaths.userlocaldata
try:
return c_dir
finally:
if not os.path.exists(c_dir):
os.makedirs(c_dir)
def simple_crypt(self, s, k=None, keymat=''):
from M2Crypto.RC4 import RC4
if k is None:
k = self._get_key(keymat)
return RC4(k).update(s)
def _get_key(self, keymat=''):
keys = getattr(self, '_keys', None)
if keys is None:
keys = self._keys = {}
key = keys.get(keymat, None)
if key is not None:
return key
self._keys[keymat] = sysident.sysident(append=keymat)
return self._keys[keymat]
def load_from_disk(self):
path = self.get_splash_data_path()
try:
with open(path, 'rb') as f:
all_info = syck.load(f)
if not isinstance(all_info, dict):
all_info = {}
info = all_info.get('users', self.info_default)
last = all_info.get('last', self.last_default)
self.crypt_pws(info, 'decode')
except Exception, _e:
traceback.print_exc()
return last, info
def save_to_disk(self, last, info):
path = self.get_splash_data_path()
self.crypt_pws(info, 'encode')
for_yaml = {'users': info,
'last': last}
try:
with open(path, 'wb') as f:
syck.dump(for_yaml, f)
except Exception:
traceback.print_exc()
self.crypt_pws(info, 'decode')
return True
## End old classes
class _LoginInfoTests(object):
'''
Base class for tests in common for old "NewSplashDiskStorage"
and LoginInfo
'''
_filepath = path.path(__file__).parent / 'test.yaml'
def create_datastore(self):
raise NotImplementedError
def setUp(self):
# Part of the key to encrypt passwords is sysident, which is
# (designed to be) machine specific. In order for tests to be
# machine-independent, we're replacing it with something predictable.
def new_sysident(prepend='', append=''):
return hashlib.sha1(prepend + append).digest()
self._old_sysident = sysident.sysident
sysident.sysident = new_sysident
self.datastore = self.create_datastore()
self.flat_data = dict([
(('last',), u'username'),
(('users', u'username', 'username'), u'username'),
(('users', u'username', 'save'), True),
(('users', u'username', 'password'), 'password'),
(('users', u'username', 'autologin'), False),
(('users', '', 'username'), ''),
(('users', '', 'save'), False),
(('users', '', 'password'), ''),
(('users', '', 'pos'), (200, 200)),
(('users', '', 'autologin'), False),
(('users', u'veryreactive1', 'username'), u'veryreactive1'),
(('users', u'veryreactive1', 'password'), ''),
(('users', u'veryreactive1', 'save'), False),
(('users', u'veryreactive1', 'autologin'), False),
(('users', None, 'status'), ''),
(('users', 'pos'), (136, 106)),
])
def tearDown(self):
sysident.sysident = self._old_sysident
del self.datastore
self._filepath.remove()
def test_load_from_disk(self):
last, allinfo = self.datastore.load_from_disk()
self.assertEqual(last, self.flat_data.get(('last',)))
for key in self.flat_data:
if key[0] == 'users':
key = key[1:]
else:
continue
val = reduce(lambda a, b: a.get(b), key, allinfo)
self.assertEqual(val, self.flat_data.get(('users',) + key))
def test_change_password(self):
other_datastore = self.create_datastore()
_last, allinfo = self.datastore.load_from_disk()
new_password = 'new password'
username = 'veryreactive1'
key = (username, 'password')
allinfo[username]['password'] = new_password
self.datastore.save_to_disk(username, allinfo)
other_last, other_allinfo = other_datastore.load_from_disk()
last, allinfo = self.datastore.load_from_disk()
self.assertEqual(last, username)
self.assertEqual(allinfo[username]['password'], new_password)
self.assertEqual(other_last, username)
self.assertEqual(other_allinfo[username]['password'], new_password)
def test_add_new_user(self):
other_datastore = self.create_datastore()
_last, allinfo = self.datastore.load_from_disk()
new_username = 'new name'
self.assertEqual(None, allinfo.get(new_username, None))
self.assertRaises(KeyError, lambda: allinfo[new_username])
allinfo[new_username] = {}
allinfo[new_username]['username'] = new_username
allinfo[new_username]['password'] = 'a password'
allinfo[new_username]['save'] = True
allinfo[new_username]['autologin'] = False
self.datastore.save_to_disk(new_username, allinfo)
other_last, other_allinfo = other_datastore.load_from_disk()
last, allinfo = self.datastore.load_from_disk()
self.assertEqual(last, new_username)
self.assertEqual(other_last, new_username)
for key in ('username', 'password', 'save', 'autologin'):
self.assertEqual(allinfo[new_username][key],
other_allinfo[new_username][key])
self.assertEqual(allinfo[new_username]['username'], new_username)
self.assertEqual(allinfo[new_username]['password'], 'a password')
self.assertEqual(allinfo[new_username]['save'], True)
self.assertEqual(allinfo[new_username]['autologin'], False)
class LoginInfoTests(_LoginInfoTests, YAMLDatastoreTests):
'''
All the tests for a YAMLDatastore (with some overrides, see notes
in methods below) and those for NewSplashDiskStorage class.
'''
def create_datastore(self):
with self._filepath.open('wb') as f:
f.write(data)
return LoginInfo(filepath=self._filepath)
def test_clear(self):
# Note: sorting them because LoginInfo requires a 'username' key in
# order to decrypt the value of 'password'. If username gets cleared
# first, password will throw an Invalid Key error
for k, _v in sorted(self.datastore.items()):
self.datastore.clear(k)
self.assertRaises(KeyError, lambda: self.datastore.get(k))
def test_file_write(self):
new_dstore = self.create_datastore()
self.test_set_new()
## This doesn't work because the password doesn't get re-encrypted when
## the username is changed. see note in LoginInfo.
#self.test_set_existing()
new_items = set(new_dstore.items())
my_items = set(self.datastore.items())
self.assertEqual(my_items, new_items)
class OldLoginInfoTests(_LoginInfoTests, unittest.TestCase):
'''
Tests for NewSplashDiskStorage.
'''
# Apologies for the naming - let this be a lesson to everyone, don't use
# New, Old, etc in class names.
def create_datastore(self):
with self._filepath.open('wb') as f:
f.write(data)
datastore = NewSplashDiskStorage()
datastore.get_splash_data_path = lambda: self._filepath
return datastore
def suite():
s = unittest.TestSuite()
loader = unittest.TestLoader()
tests = map(loader.loadTestsFromTestCase, [
OldLoginInfoTests,
LoginInfoTests,
])
s.addTests(
tests
)
return s
if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(suite())
#unittest.main()
| 31.20442 | 83 | 0.574274 | 1,220 | 11,296 | 5.14918 | 0.197541 | 0.03327 | 0.034384 | 0.0234 | 0.297358 | 0.225883 | 0.177173 | 0.137695 | 0.128144 | 0.128144 | 0 | 0.006813 | 0.311349 | 11,296 | 361 | 84 | 31.290859 | 0.800746 | 0.060021 | 0 | 0.273408 | 0 | 0 | 0.126649 | 0 | 0 | 0 | 0 | 0 | 0.067416 | 0 | null | null | 0.089888 | 0.044944 | null | null | 0.007491 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
49d59e031af88536ec1304039072879c345a2c40 | 2,516 | py | Python | apps/admin/views/forms.py | leigeng2014/sango2 | aa0a3ed1a316d8afc9482f072f2aa57cffe9a10f | [
"Apache-2.0"
] | null | null | null | apps/admin/views/forms.py | leigeng2014/sango2 | aa0a3ed1a316d8afc9482f072f2aa57cffe9a10f | [
"Apache-2.0"
] | null | null | null | apps/admin/views/forms.py | leigeng2014/sango2 | aa0a3ed1a316d8afc9482f072f2aa57cffe9a10f | [
"Apache-2.0"
] | null | null | null | #-*- coding:utf-8 -*-
from django import forms
from apps.admin import admin_configuration
import apps.admin.auth
class ModeratorCreationForm(forms.Form):
"""
新建管理员表单
"""
username = forms.CharField(label="帐号",max_length=30,help_text = r"必须,30个字符以内")
email = forms.EmailField(label="邮箱",help_text=u"请输入管理员联系邮箱地址")
password1 = forms.CharField(label=u"密码", widget=forms.PasswordInput)
password2 = forms.CharField(label=u"确认密码", widget=forms.PasswordInput,
help_text = "请输入与上面密码一致的密码。")
#(角色,描述)
permissions = forms.MultipleChoiceField(choices=[(perm["code"], perm["description"]) for key,perm in admin_configuration.all_permissions.items()])
def clean_username(self):
username = self.cleaned_data['username']
if apps.admin.auth.get_mid_by_username(username) is not None:
raise forms.ValidationError("该帐号已存在,请重新选择.")
else:
return username
def clean_password2(self):
password1 = self.cleaned_data.get("password1", "")
password2 = self.cleaned_data["password2"]
if password1 != password2:
raise forms.ValidationError("确认密码与密码不符,请重新输入.")
return password2
class ModeratorManageForm(forms.Form):
"""
管理员管理表单
"""
password1 = forms.CharField(label=u"密码", required=False, widget=forms.PasswordInput)
password2 = forms.CharField(label=u"确认密码", required=False, widget=forms.PasswordInput,
help_text = u"请输入与上面密码一致的密码。")
permissions = forms.MultipleChoiceField(choices = [(perm["code"],perm["description"]) for key,perm in admin_configuration.all_permissions.items()])
def clean_password2(self):
password1 = self.cleaned_data.get("password1", "")
password2 = self.cleaned_data["password2"]
if password1 != password2:
raise forms.ValidationError(u"确认密码与密码不符,请重新输入.")
return password2
class ModeratorResetPasswordForm(forms.Form):
"""
管理员自己修改密码表单
"""
password1 = forms.CharField(label=u"密码", widget=forms.PasswordInput)
password2 = forms.CharField(label=u"确认密码", widget=forms.PasswordInput,
help_text = u"请输入与上面密码一致的密码。")
def clean_password2(self):
password1 = self.cleaned_data.get("password1", "")
password2 = self.cleaned_data["password2"]
if password1 != password2:
raise forms.ValidationError(u"确认密码与密码不符,请重新输入.")
return password2
| 36.463768 | 152 | 0.658585 | 265 | 2,516 | 6.158491 | 0.29434 | 0.060049 | 0.081495 | 0.073529 | 0.707108 | 0.667279 | 0.648284 | 0.61152 | 0.61152 | 0.576593 | 0 | 0.01783 | 0.219793 | 2,516 | 68 | 153 | 37 | 0.813551 | 0.02186 | 0 | 0.581395 | 0 | 0 | 0.102312 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.093023 | false | 0.511628 | 0.069767 | 0 | 0.55814 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
49d893701cfa26c3a11ad9c2765ab19273e21d65 | 112 | py | Python | pil/grey.py | classmember/proof_of_concept | da284ca57806f7c05c1b39bebfe0d681db2260fc | [
"MIT"
] | null | null | null | pil/grey.py | classmember/proof_of_concept | da284ca57806f7c05c1b39bebfe0d681db2260fc | [
"MIT"
] | null | null | null | pil/grey.py | classmember/proof_of_concept | da284ca57806f7c05c1b39bebfe0d681db2260fc | [
"MIT"
] | null | null | null | from convert import *
bali = open_image('bali.jpg')
a = convert_halftoning(bali)
a.save('a.png', 'png') | 16 | 30 | 0.651786 | 17 | 112 | 4.176471 | 0.647059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 112 | 7 | 31 | 16 | 0.771739 | 0 | 0 | 0 | 0 | 0 | 0.149533 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
49de3fd242d38790ee0a8493928c291eae334d96 | 475 | py | Python | cov_bsv/knowledge_base/__init__.py | anniebowles/VA_COVID-19_NLP_BSV | 0fa3014d6bcde92f0bab601226d1619612565c46 | [
"MIT"
] | null | null | null | cov_bsv/knowledge_base/__init__.py | anniebowles/VA_COVID-19_NLP_BSV | 0fa3014d6bcde92f0bab601226d1619612565c46 | [
"MIT"
] | null | null | null | cov_bsv/knowledge_base/__init__.py | anniebowles/VA_COVID-19_NLP_BSV | 0fa3014d6bcde92f0bab601226d1619612565c46 | [
"MIT"
] | null | null | null | from .concept_tag_rules import concept_tag_rules
from .target_rules import target_rules
from .context_rules import context_rules
from .postprocess_rules import postprocess_rules
from .preprocess_rules import preprocess_rules
from .section_rules import section_rules
from .entity_rules import entity_rules
__all__ = [
"concept_tag_rules",
"target_rules",
"context_rules",
"postprocess_rules",
"preprocess_rules",
"section_rules",
"entity_rules"
]
| 26.388889 | 48 | 0.793684 | 60 | 475 | 5.816667 | 0.2 | 0.22063 | 0.12894 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143158 | 475 | 17 | 49 | 27.941176 | 0.857494 | 0 | 0 | 0 | 0 | 0 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4375 | 0 | 0.4375 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
49e7088c9d54d8c0a0200ad8356b10cc42a575b9 | 349 | py | Python | hcap/views/pending_authorizations_view.py | fabiommendes/capacidade_hospitalar | 4f675b574573eb3f51e6be8a927ea230bf2712c7 | [
"MIT"
] | null | null | null | hcap/views/pending_authorizations_view.py | fabiommendes/capacidade_hospitalar | 4f675b574573eb3f51e6be8a927ea230bf2712c7 | [
"MIT"
] | 31 | 2020-04-11T13:38:17.000Z | 2021-09-22T18:51:11.000Z | hcap/views/pending_authorizations_view.py | fabiommendes/capacidade_hospitalar | 4f675b574573eb3f51e6be8a927ea230bf2712c7 | [
"MIT"
] | 1 | 2020-04-12T17:51:20.000Z | 2020-04-12T17:51:20.000Z | from django.contrib.auth.decorators import user_passes_test
from django.views.generic import TemplateView
class PendingAuthorizationsView(TemplateView):
template_name = "hcap/pending_authorizations.html"
pending_authorizations_view = user_passes_test(lambda u: u.is_authenticated and u.is_manager)(
PendingAuthorizationsView.as_view()
)
| 29.083333 | 94 | 0.833811 | 42 | 349 | 6.666667 | 0.666667 | 0.071429 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.097421 | 349 | 11 | 95 | 31.727273 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0.091691 | 0.091691 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.285714 | 0.285714 | 0 | 0.571429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
49fa45bda66383c82618310f01bab046c3315921 | 551 | py | Python | CybORG/CybORG/Shared/Plugins/__init__.py | rafvasq/cage-challenge-1 | 95affdfa38afc1124f1a1a09c92fbc0ed5b96318 | [
"MIT"
] | 18 | 2021-08-20T15:07:55.000Z | 2022-03-11T12:05:15.000Z | CybORG/CybORG/Shared/Plugins/__init__.py | rafvasq/cage-challenge-1 | 95affdfa38afc1124f1a1a09c92fbc0ed5b96318 | [
"MIT"
] | 7 | 2021-11-09T06:46:58.000Z | 2022-03-31T12:35:06.000Z | CybORG/CybORG/Shared/Plugins/__init__.py | rafvasq/cage-challenge-1 | 95affdfa38afc1124f1a1a09c92fbc0ed5b96318 | [
"MIT"
] | 13 | 2021-08-17T00:26:31.000Z | 2022-03-29T20:06:45.000Z | # CLASSIFICATION: UNCLASSIFIED
#
# (c) Copyright Commonwealth of Australia 2019
#
# This work is copyright. Apart from any use permitted under the
# Copyright Act 1968, no part may be reproduced or modified by any
# process without prior written permission from the Commonwealth.
#
# *** FILE HEADERS AND COPYRIGHT STATEMENTS CANNOT BE REMOVED ***
#
# Direct inquiries to:
# Cyber & Electronic Warfare Division / Defence Science & Technology
# Team Project Lead: Martin Lucas
# e-mail Address: Martin.Lucas@dst.defence.gov.au
| 36.733333 | 68 | 0.733212 | 71 | 551 | 5.690141 | 0.84507 | 0.054455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0181 | 0.197822 | 551 | 14 | 69 | 39.357143 | 0.895928 | 0.947368 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b708f85810ff49417718dee5ba574ed378a53b61 | 257 | py | Python | setup.py | universvm/sequence-recovery-benchmark | 7160c68a8bee8870e169e2e1010c0964c3fe62b0 | [
"MIT"
] | null | null | null | setup.py | universvm/sequence-recovery-benchmark | 7160c68a8bee8870e169e2e1010c0964c3fe62b0 | [
"MIT"
] | null | null | null | setup.py | universvm/sequence-recovery-benchmark | 7160c68a8bee8870e169e2e1010c0964c3fe62b0 | [
"MIT"
] | null | null | null | from setuptools import find_packages, setup
setup(
name="benchmark",
packages=find_packages(include=["benchmark"]),
version="0.1.0",
description="Sequence recovery benchmark",
author="Rokas",
license="MIT",
test_suite="test",
)
| 21.416667 | 50 | 0.677043 | 29 | 257 | 5.896552 | 0.724138 | 0.140351 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014151 | 0.175097 | 257 | 11 | 51 | 23.363636 | 0.792453 | 0 | 0 | 0 | 0 | 0 | 0.241245 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.1 | 0 | 0.1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b70e428610e8bc88b075f49551bc03797440977c | 2,145 | py | Python | quffka/gq.py | maremun/quffka | 94ae57383e7cb1772ac3b6c62003069b9922245b | [
"MIT"
] | 15 | 2018-02-13T15:49:05.000Z | 2022-01-29T06:40:10.000Z | quffka/gq.py | maremun/quffka | 94ae57383e7cb1772ac3b6c62003069b9922245b | [
"MIT"
] | 2 | 2019-01-21T10:19:44.000Z | 2019-06-03T12:51:53.000Z | quffka/gq.py | maremun/quffka | 94ae57383e7cb1772ac3b6c62003069b9922245b | [
"MIT"
] | 2 | 2019-05-19T08:42:29.000Z | 2021-02-26T02:42:28.000Z | # enconding: utf-8
# gaussquad.py
# TODO fix Documentation
import numpy as np
import numpy.polynomial.hermite as herm
from .basics import get_D
def generate_gq_weights(d, n, deg=2):
'''
Subsample points and weights for Gauss-Hermite quadrature.
Args
d: the number of dimensions of the integral.
n: number of SR rules to be equivalent to in terms of output feature
dimensionality D.
deg: the degree of the polynomial that is approximated accurately by
this quadrule is 2-1.
Returns
W_subsampled: the points, matrix of size d x D.
A_subsampled: the weights, vector of size D.
'''
W, A = herm.hermgauss(deg)
# Use ortho for higher dimensions
# W, A = orth.line.schemes.hermite(d, 30)
# make sure we are not working with object datatype
# W = np.array(W, dtype='float64')
# A = np.array(A, dtype='float64')
# normalize weights
# this is where the 1/sqrt(pi) constant is hidden
# since sum of the weights is exactly the constant!
A = A / A.sum()
D = get_D(d, n)
c = np.empty((d, D))
I = np.arange(W.shape[0])
for i in range(d):
c[i] = np.random.choice(I, D, True, A)
c = c.astype('int')
W_subsampled = W[c]
A_subsampled = np.sum(np.log(A[c]), axis=0)
A_subsampled -= A_subsampled.max()
A_subsampled = np.exp(A_subsampled)
# I = np.arange(W.shape[0])
# c = np.random.choice(I, d*L, True, A)
# W_subsampled = np.reshape(W[c], (d,L))
# A_subsampled = np.prod(np.reshape(A[c], (d,L)), axis=0)
## W_subsampled = np.ascontiguousarray(W_subsampled.T).T # for faster tensordot
# normalize weights of subsampled points
A_subsampled /= A_subsampled.sum()
W_subsampled *= np.sqrt(2)
return W_subsampled.T, np.sqrt(A_subsampled)
def explicit_map(Z, W):
nsamples = W.shape[0]
ZW = Z @ W
fZ = np.hstack((np.cos(ZW), np.sin(ZW)))
return fZ
def rbf_kernel_via_explicit_map(X, Y, A):
A = np.sqrt(A)
A = np.concatenate((A, A))
X = np.einsum('j,ij->ij', A, X)
Y = np.einsum('j,ij->ij', A, Y)
K = X @ Y.T
return K
| 29.791667 | 84 | 0.620979 | 354 | 2,145 | 3.689266 | 0.384181 | 0.084227 | 0.01608 | 0.015314 | 0.070444 | 0.045942 | 0 | 0 | 0 | 0 | 0 | 0.010572 | 0.25035 | 2,145 | 71 | 85 | 30.211268 | 0.801617 | 0.507692 | 0 | 0 | 1 | 0 | 0.01927 | 0 | 0 | 0 | 0 | 0.014085 | 0 | 1 | 0.096774 | false | 0 | 0.096774 | 0 | 0.290323 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b73d02da711369575af6b60c3b7e0fe26cc69cda | 490 | py | Python | envdsys/envdatasystem/migrations/0004_auto_20210226_1849.py | NOAA-PMEL/envDataSystem | 4db4a3569d2329658799a3eef06ce36dd5c0597d | [
"Unlicense"
] | 1 | 2021-11-06T19:22:53.000Z | 2021-11-06T19:22:53.000Z | envdsys/envdatasystem/migrations/0004_auto_20210226_1849.py | NOAA-PMEL/envDataSystem | 4db4a3569d2329658799a3eef06ce36dd5c0597d | [
"Unlicense"
] | 25 | 2019-06-18T20:40:36.000Z | 2021-07-23T20:56:48.000Z | envdsys/envdatasystem/migrations/0004_auto_20210226_1849.py | NOAA-PMEL/envDataSystem | 4db4a3569d2329658799a3eef06ce36dd5c0597d | [
"Unlicense"
] | null | null | null | # Generated by Django 3.1.7 on 2021-02-26 18:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('envdatasystem', '0003_auto_20210226_1835'),
]
operations = [
migrations.RemoveField(
model_name='samplingsystemlocation',
name='sampling_system',
),
migrations.RemoveField(
model_name='samplingsystemsamplepoint',
name='sampling_system',
),
]
| 22.272727 | 53 | 0.612245 | 44 | 490 | 6.659091 | 0.727273 | 0.143345 | 0.177474 | 0.204778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088825 | 0.287755 | 490 | 21 | 54 | 23.333333 | 0.750716 | 0.091837 | 0 | 0.4 | 1 | 0 | 0.255079 | 0.158014 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b7445c1cfdea5b84c6d0aa6473a93a580ceadd53 | 222 | py | Python | test/apis/__init__.py | Tomos-Evans/garrison | 6a0eea6822f7a5a64e80852427d4576c9018d0b4 | [
"MIT"
] | 1 | 2018-10-20T15:53:15.000Z | 2018-10-20T15:53:15.000Z | test/apis/__init__.py | Tomos-Evans/garrison | 6a0eea6822f7a5a64e80852427d4576c9018d0b4 | [
"MIT"
] | null | null | null | test/apis/__init__.py | Tomos-Evans/garrison | 6a0eea6822f7a5a64e80852427d4576c9018d0b4 | [
"MIT"
] | null | null | null | from test import TestCase
class ApiTestCase(TestCase):
def setUp(self):
super().setUp()
self.client = self.app.test_client()
from .ingredients import *
from .drinks import *
from .dispensers import *
| 20.181818 | 44 | 0.689189 | 27 | 222 | 5.62963 | 0.555556 | 0.118421 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.207207 | 222 | 10 | 45 | 22.2 | 0.863636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.5 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
3f77ef93412bbbd17581efee0f5ad86f74210215 | 62,748 | py | Python | src/fastqfilter.py | isovic/samscripts | 4b8c122220ee7bc5909903e3ecabb8ed6a72965d | [
"MIT"
] | 4 | 2015-09-30T13:17:47.000Z | 2019-03-13T14:25:15.000Z | src/fastqfilter.py | isovic/samscripts | 4b8c122220ee7bc5909903e3ecabb8ed6a72965d | [
"MIT"
] | 5 | 2015-11-09T09:21:44.000Z | 2016-08-18T09:18:44.000Z | src/fastqfilter.py | isovic/samscripts | 4b8c122220ee7bc5909903e3ecabb8ed6a72965d | [
"MIT"
] | 6 | 2015-05-11T09:04:52.000Z | 2020-06-08T21:47:51.000Z | #! /usr/bin/env python3
# Copyright Ivan Sovic, 2015. www.sovic.org
#
# A script that takes an input FASTA/FASTQ file and performs various methods
# of filtering on it. Examples include: selecting sequences that contain certain
# strings in their header, and others.
import re
import os
import sys
import fastqparser
import numpy as np
import random
import operator;
def filter_seqs_by_header(input_fastq_path, header_patterns_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
try:
fp_filter = open(header_patterns_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % header_patterns_path);
exit(0);
filter_headers = fp_filter.readlines();
filter_headers = [line.strip() for line in filter_headers if (len(line.strip()) > 0)];
fp_filter.close();
num_matches = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
for filter_header in filter_headers:
if ((filter_header[-1] == ';' and filter_header[0:-1].lower() == header.lower()) or
(filter_header[-1] != ';' and filter_header.lower() in header.lower())):
num_matches += 1;
sys.stderr.write('\rFound %d seqs, last: "%s".' % (num_matches, header));
fp_out.write('\n'.join(read) + '\n');
break;
sys.stderr.write('\n');
fp_in.close();
def filter_seqs_by_read_id(input_fastq_path, read_id_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
try:
fp_filter = open(read_id_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % read_id_path);
exit(0);
filter_read_ids = fp_filter.readlines();
fp_filter.close();
filter_read_ids = [int(line.strip()) for line in filter_read_ids if (len(line.strip()) > 0)];
id_hash = {};
for read_id in filter_read_ids:
id_hash[read_id] = 1;
num_matches = 0;
num_reads = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
if (num_reads in id_hash):
num_matches += 1;
sys.stderr.write('\rFound %d seqs.' % (num_matches));
fp_out.write('\n'.join(read) + '\n');
num_reads += 1;
sys.stderr.write('\n');
fp_in.close();
def filter_seqs_by_header_list(input_fastq_path, filter_headers, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_matches = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
for filter_header in filter_headers:
if ((filter_header[-1] == ';' and filter_header[0:-1].lower() == header.lower()) or
(filter_header[-1] != ';' and filter_header.lower() in header.lower())):
num_matches += 1;
sys.stderr.write('\rFound %d seqs, last: "%s".' % (num_matches, header));
fp_out.write('\n'.join(read) + '\n');
break;
sys.stderr.write('\n');
fp_in.close();
def filter_duplicate_ncbi_id(input_fastq_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_matches = 0;
id_hash = {};
i = 0;
while True:
i += 1;
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
header_id = header.split()[0].lower();
if (header_id in id_hash):
continue;
num_matches += 1;
if ((i % 1000) == 0):
sys.stderr.write('\rFound %d seqs, last: "%s".' % (num_matches, header));
fp_out.write('\n'.join(read) + '\n');
id_hash[header_id] = True;
sys.stderr.write('\n');
fp_in.close();
def join_fastq_lines(input_fastq_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_matches = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
fp_out.write('\n'.join(read) + '\n');
sys.stderr.write('\n');
fp_in.close();
def filter_seqs_by_length(input_fastq_path, length_threshold, is_less_than, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_matches = 0;
i = 0;
while True:
i += 1;
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
if ((is_less_than == False and len(read[1]) >= length_threshold) or (is_less_than == True and len(read[1]) <= length_threshold)):
num_matches += 1;
if ((i % 1000) == 0):
sys.stderr.write('\rFound %d seqs, last: "%s".' % (num_matches, header));
fp_out.write('\n'.join(read) + '\n');
# fp_out.write('\n');
# fp_out.write('(1) ' + read[0] + '\n');
# fp_out.write('(2) ' + read[1] + '\n');
# exit(1);
sys.stderr.write('\n');
fp_in.close();
def base_quality_stats(input_fastq_path):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_reads = 0;
means_1d = [];
means_2d = [];
while True:
if ((num_reads % 100) == 0):
sys.stderr.write('\rProcessing seq %d...' % num_reads);
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
if (len(read) < 4):
sys.stderr.write('Given file is not a FASTQ file! Exiting.\n');
exit(1);
quals = read[3];
phreds = [];
for char in quals:
phreds.append(ord(char) - 33);
if (('twodir' in header.lower()) or ('-2d' in header.lower())):
means_2d.append(np.mean(phreds));
else:
means_1d.append(np.mean(phreds));
num_reads += 1;
sys.stderr.write('\n');
if (len(means_1d) > 0):
sys.stdout.write('[1d] avg = %5.2f\tstd = %5.2f\tmin = %2d\tmax = %2d\n' % (np.mean(means_1d), np.std(means_1d), min(means_1d), max(means_1d)));
else:
sys.stdout.write('[1d] avg = %5.2f\tstd = %5.2f\tmin = %2d\tmax = %2d\n' % (0.0, 0.0, 0.0, 0.0));
if (len(means_2d) > 0):
sys.stdout.write('[2d] avg = %5.2f\tstd = %5.2f\tmin = %2d\tmax = %2d\n' % (np.mean(means_2d), np.std(means_2d), min(means_2d), max(means_2d)));
else:
sys.stdout.write('[2d] avg = %5.2f\tstd = %5.2f\tmin = %2d\tmax = %2d\n' % (0.0, 0.0, 0.0, 0.0));
fp_in.close();
def base_quality_filter(input_fastq_path, lte_gte, qv_threshold, out_fastq_path, fp_out):
# print 'lte_gte = "%s"' % (lte_gte);
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
return;
num_reads = 0;
num_outputted_reads = 0;
num_skipped_reads = 0;
while True:
if ((num_reads % 1000) == 0):
sys.stderr.write('\rProcessing seq %d, (%d passed)...' % (num_reads, num_outputted_reads));
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
if (len(read) < 4):
sys.stderr.write('Given file is not a FASTQ file! Exiting.\n');
return;
quals = read[3];
phreds = [];
for char in quals:
phreds.append(ord(char) - 33);
mean_qv = np.mean(phreds);
if ((lte_gte == 'gt' and mean_qv > qv_threshold) or
(lte_gte == 'gte' and mean_qv >= qv_threshold) or
(lte_gte == 'lt' and mean_qv < qv_threshold) or
(lte_gte == 'lte' and mean_qv <= qv_threshold) or
(lte_gte == 'eq' and mean_qv == qv_threshold)):
fp_out.write('\n'.join(read) + '\n');
num_outputted_reads += 1;
else:
num_skipped_reads += 1;
num_reads += 1;
sys.stderr.write('\n');
sys.stderr.write('Total number of sequences: %d\n' % (num_reads));
sys.stderr.write('Number of outputted sequences: %d\n' % (num_outputted_reads));
sys.stderr.write('Number of sequences not satisfying condition: %d\n' % (num_skipped_reads));
sys.stderr.write('\n');
fp_in.close();
def reverse_complement_seqs(input_fastq_path):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_reads = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
if (len(read) == 2):
sys.stdout.write('%s\n' % read[0]);
sys.stdout.write('%s\n' % fastqparser.revcomp_seq(read[1]));
elif (len(read) == 4):
sys.stdout.write('%s\n' % read[0]);
sys.stdout.write('%s\n' % fastqparser.revcomp_seq(read[1]));
sys.stdout.write('%s\n' % read[2]);
sys.stdout.write('%s\n' % read[3][::-1]);
num_reads += 1;
sys.stderr.write('\n');
fp_in.close();
def hard_clip(input_fastq_path, num_bases):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_reads = 0;
sys.stderr.write('Trimming %dbp from the beginning and ending of each sequence.\n' % num_bases);
sys.stderr.write('Starting to process file "%s".\n' % input_fastq_path);
while True:
num_reads += 1;
if ((num_reads % 1000) == 0):
sys.stderr.write('\rProcessing seq %d...' % num_reads);
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
if (len(read[1]) <= (2*num_bases)):
# sys.stderr.write('Skipping, len(read[1]) = %d, num_bases = %d\n' % (len(read[1]), num_bases) );
continue;
if (len(read) == 2):
clipped_seq = read[1][num_bases:-num_bases];
sys.stdout.write('%s_clipped\n' % read[0]);
sys.stdout.write('%s\n' % clipped_seq);
elif (len(read) == 4):
clipped_seq = read[1][num_bases:-num_bases];
clipped_qual = read[3][num_bases:-num_bases];
sys.stdout.write('%s_clipped\n' % read[0]);
sys.stdout.write('%s\n' % clipped_seq);
sys.stdout.write('%s\n' % read[2]);
sys.stdout.write('%s\n' % clipped_qual);
sys.stderr.write('\n');
fp_in.close();
def remove_special_chars_from_headers(input_fastq_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_matches = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
# read[0] = read[0][0] + read[0][1:].replace();
read[0] = read[0][0] + re.sub('[^0-9a-zA-Z]', '_', read[0][1:]); # re.sub("[|:", "_", read[0][1:]);
fp_out.write('\n'.join(read) + '\n');
sys.stderr.write('\n');
fp_in.close();
def filter_for_marginalign(input_fastq_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
if (fp_out == None):
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except:
sys.stderr.write('ERROR: Could not open file "%s" for writing! Exiting.\n' % out_fastq_path);
exit(0);
num_matches = 0;
header_hash = {};
while True:
[header, read] = get_single_read(fp_in);
if (len(read) == 0):
break;
# read[0] = read[0][0] + read[0][1:].replace();
if (len(read[1]) <= 50000):
# read[0] = read[0][0] + re.sub('[^0-9a-zA-Z]', '_', read[0][1:]); # re.sub("[|:", "_", read[0][1:]);
new_header = read[0][0] + re.sub('[^0-9a-zA-Z]', '_', read[0][1:]); # re.sub("[|:", "_", read[0][1:]);
header_hash[new_header[1:]] = read[0][1:];
read[0] = new_header;
fp_out.write('\n'.join(read) + '\n');
sys.stderr.write('\n');
fp_in.close();
return header_hash;
def wrap_fastq_file(input_fastq_path, wrap_length, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
current_read = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
current_read += 1;
read[1] = re.sub("(.{%d})"%(wrap_length), "\\1\n", read[1], 0, re.DOTALL); ### Wrap the sequence line, because DALIGNER has a 9998bp line len limit.
if (len(read) == 4):
read[3] = re.sub("(.{%d})"%(wrap_length), "\\1\n", read[3], 0, re.DOTALL); ### Wrap the qual line, because DALIGNER has a 9998bp line len limit.
fp_out.write('\n'.join(read) + '\n');
sys.stderr.write('\n');
fp_in.close();
def convert_to_uppercase(input_fastq_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
current_read = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
current_read += 1;
read[1] = read[1].upper();
fp_out.write('\n'.join(read) + '\n');
sys.stderr.write('\n');
fp_in.close();
def enumerate_headers(input_fastq_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
current_read = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
current_read += 1;
# read[1] = read[1].upper();
read[0] = read[0][0] + str(current_read);
if (len(read) == 4):
read[2] = '+' + str(current_read);
fp_out.write('\n'.join(read) + '\n');
sys.stderr.write('\n');
fp_in.close();
### Modifies the FASTQ headers to replace all special chars with '_'.
def keep_gi_header(input_fastq_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_matches = 0;
# header_hash = {};
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
read[0] = read[0].split()[0];
fp_out.write('\n'.join(read) + '\n');
sys.stderr.write('\n');
fp_in.close();
# return header_hash;
### Modifies the FASTQ headers to replace all special chars with '_'.
def uniquify_headers(input_fastq_path, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_seqs = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
read[0] = read[0].split()[0] + '-%d' % (num_seqs);
fp_out.write('\n'.join(read) + '\n');
num_seqs += 1;
sys.stderr.write('\n');
fp_in.close();
# return header_hash;
def count_1d2d(input_fastq_path):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_reads = 0;
num_1d = 0;
num_2d = 0;
while True:
if ((num_reads % 100) == 0):
sys.stderr.write('\rProcessing seq %d...' % num_reads);
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
if (('twodir' in header.lower()) or ('2d' in header.lower())):
num_2d += 1;
else:
num_1d += 1;
num_reads += 1;
sys.stderr.write('\n');
fp_in.close();
try:
sys.stdout.write('num_1d = %d (%.2f%%)\n' % (num_1d, (float(num_1d) / float(num_reads) * 100.0)));
sys.stdout.write('num_2d = %d (%.2f%%)\n' % (num_2d, (float(num_2d) / float(num_reads) * 100.0)));
sys.stdout.write('num_reads = %d\n' % (num_reads));
except Exception as e:
sys.stderr.write(str(e));
pass;
def check_nanopore_paths(input_fastq_path, fast5_root_path):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_reads = 0;
num_wrong_paths = 0;
while True:
if ((num_reads % 1000) == 0):
sys.stderr.write('\rProcessing seq %d...' % num_reads);
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
path_from_header = header.split()[-1];
if (os.path.exists('%s/%s' % (fast5_root_path, path_from_header)) == False):
num_wrong_paths += 1;
sys.stderr.write('[%d] ' % (num_wrong_paths));
sys.stdout.write('%s\n' % (header));
num_reads += 1;
sys.stderr.write('\n');
fp_in.close();
### Subsample
# Subsampling calculates a total number of bases that should be in the result (according to a given coverage)
# and then current total number of bases
# Uses the ratio of the two to randomly select which row will be output as a result.
# Depending on the randomly generated numbers, the exact coverage of the result could vary,
# but should be close enough to a give parameter, given a large enough sample
def subsample(input_fastq_path, desired_coverage, ref_genome_size):
if input_fastq_path.endswith('.fa') or input_fastq_path.endswith('.fasta'):
type = 'fasta'
elif input_fastq_path.endswith('.fq') or input_fastq_path.endswith('.fastq'):
type = 'fastq'
else:
sys.stderr.write('\nUnrecognized file extension! Assuming fasta format!')
type = 'fasta'
[headers, seqs, quals] = fastqparser.read_fastq(input_fastq_path)
numBases = sum([len(seq) for seq in seqs])
desiredNumBases = desired_coverage * ref_genome_size
ratio = float(desiredNumBases) / numBases
if desiredNumBases > numBases:
sys.stderr.write('Insufficient data for coverage %d\n' % desired_coverage)
exit(1)
sys.stderr.write('\n\nStatistics:')
sys.stderr.write('\nNumber of desired/current bases: %i/%i' % (desiredNumBases, numBases))
sys.stderr.write('\nGenome size: %i' % ref_genome_size)
sys.stderr.write('\nDesired coverage: %i' % desired_coverage)
sys.stderr.write('\nRatio: %f' % ratio)
numOutputBases = 0
numOutputSeqs = 0
for i in range(len(headers)):
rnd = random.random()
if rnd <= ratio:
# Print the correspodning row
numOutputBases += len(seqs[i])
numOutputSeqs += 1
if type == 'fasta':
sys.stdout.write('>%s\n%s\n' % (headers[i], seqs[i]))
elif type == 'fastq':
sys.stdout.write('@%s\n%s\n+%s\n%s\n' % (headers[i], seqs[i], headers[i], quals[i]))
else:
exception('Critical Error! Invalid filetype')
sys.stderr.write('\nOutput bases: %i' % numOutputBases)
sys.stderr.write('\nOutput seqs: %i' % numOutputSeqs)
sys.stderr.write('\n')
def getPaired(input_fastq_path, target_fastq_path):
if input_fastq_path.endswith('.fa') or input_fastq_path.endswith('.fasta'):
type = 'fasta'
elif input_fastq_path.endswith('.fq') or input_fastq_path.endswith('.fastq'):
type = 'fastq'
else:
sys.stderr.write('\nUnrecognized file extension! Assuming fasta format!')
type = 'fasta'
[iheaders, iseqs, iquals] = fastqparser.read_fastq(input_fastq_path)
[theaders, tseqs, tquals] = fastqparser.read_fastq(target_fastq_path)
sys.stderr.write('\n\nLoaded input and target files!\n')
sys.stderr.write('ilen = %d, tlen = %d \n' % (len(iheaders), len(theaders)))
sys.stderr.write('Hashing target file headers ...')
tdict = {}
for theader in theaders:
theader = theader.split()[0]
tdict[theader] = 1
for i in range(len(iheaders)):
iheader = iheaders[i]
iheader = iheader.split()[0]
if iheader in tdict:
if type == 'fasta':
sys.stdout.write('>%s\n%s\n' % (iheaders[i], iseqs[i]))
elif type == 'fastq':
sys.stdout.write('@%s\n%s\n+%s\n%s\n' % (iheaders[i], iseqs[i], iheaders[i], iquals[i]))
else:
exception('Critical Error! Invalid filetype')
# else:
# import pdb
# pdb.set_trace()
if (i%100 == 0):
sys.stderr.write('\nProcessed %d reads' % i)
def fastq2fasta(input_fastq_path, replace_semicolon=True):
if not (input_fastq_path.endswith('.fq') or input_fastq_path.endswith('.fastq')):
sys.stderr.write('\nUnrecognized file extension! Assuming fastq or fasta format!')
[headers, seqs, quals] = fastqparser.read_fastq(input_fastq_path)
for i in range(len(headers)):
if (replace_semicolon == True):
newheader = headers[i].replace(':', ' ')
sys.stdout.write('>%s\n%s\n' % (newheader, seqs[i]))
else:
sys.stdout.write('>%s\n%s\n' % (headers[i], seqs[i]))
def length_distribution(input_path):
if (input_path.endswith('.fq') or input_path.endswith('.fastq')):
pass
elif (input_path.endswith('.fa') or input_path.endswith('.fasta')):
pass
else:
sys.stderr.write('\nUnrecognized file extension! Assuming fastq or fasta format!')
[headers, seqs, quals] = fastqparser.read_fastq(input_path)
distrib = {}
for i in range(len(headers)):
length = len(seqs[i])
if length in distrib:
distrib[length] += 1
else:
distrib[length] = 1
sys.stdout.write('\n\n%d sequences!' % len(distrib))
for length,count in distrib.iteritems():
sys.stdout.write('\n%d sequences of length %d' % (count, length))
sys.stdout.write('\n')
def extract_subseqs(input_fastq_path, start_coord, end_coord, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_matches = 0;
i = 0;
while True:
i += 1;
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
if (start_coord < len(read[1])):
current_end = end_coord if (end_coord < len(read[1])) else len(read[1]);
read[1] = read[1][start_coord:current_end];
if (len(read) == 4):
read[3] = read[3][start_coord:current_end];
fp_out.write('\n'.join(read) + '\n');
num_matches += 1;
if ((i % 1000) == 0):
sys.stderr.write('\rProcessed %d seqs.' % (num_matches));
sys.stderr.write('\n');
fp_in.close();
def msa2fasta(input_path, fp_out):
[headers, seqs, quals] = fastqparser.read_fastq(input_path)
for i in range(0, len(seqs)):
seqs[i] = seqs[i].upper();
cons_seq = '';
for i in range(0, len(seqs[0])):
base_counts = {'A': 0, 'C': 0, 'T': 0, 'G': 0, '.': 0, '-': 0};
for j in range(0, len(seqs)):
base_counts[seqs[j][i]] += 1;
sorted_base_counts = sorted(base_counts.items(), key=operator.itemgetter(1));
# Print sorted_base_counts;
if ((sorted_base_counts[-1][0] in '.-') == False):
cons_seq += sorted_base_counts[-1][0]
fp_out.write('>Consensus_from_MSA\n%s\n' % (cons_seq));
def separate_seqs(input_fastq_file, out_folder, headers_as_fn=False):
if (not os.path.exists(out_folder)):
os.makedirs(out_folder);
[headers, seqs, quals] = fastqparser.read_fastq(input_fastq_file);
for i in range(len(seqs)):
if (headers_as_fn == False):
fp = open('%s/%d.fast%c' % (out_folder, (i+1), input_fastq_file[-1]), 'w');
# out_prefix = headers[i].split()[0].replace('/', '-')
# fp = open('%s/%02d.%s.fast%c' % (out_folder, (i+1), out_prefix, input_fastq_file[-1]), 'w');
else:
fname = headers[i].split()[0].replace('|', '_');
fname = fname.replace('/', '-');
fp = open('%s/%s.fast%c' % (out_folder, fname, input_fastq_file[-1]), 'w');
# fp = open('%s/%d' % (out_folder, (i+1)), 'w');
if (len(quals[i]) == 0):
fp.write('>%s\n%s\n' % (headers[i], seqs[i]));
else:
fp.write('@%s\n%s\n+\n%s\n' % (headers[i], seqs[i], quals[i]));
fp.close();
def convert_reads_to_pacbio_format(reads_file, pacbio_reads_file):
try:
fp_in = open(reads_file, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % reads_file);
exit(0);
try:
fp_out = open(pacbio_reads_file, 'w');
except:
sys.stderr.write('ERROR: Could not open file "%s" for writing! Exiting.\n' % pacbio_reads_file);
exit(0);
current_read = 0;
header_conversion_hash = {};
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
current_read += 1;
if (len(read[1]) <= 50): ### DALIGNER has a lower length limit of 'k'. Trim more just to be safe.
sys.stderr.write('Found a read shorter than 10bp. Removing from the output.\n');
continue;
### Check if the read is already formatted like PacBio.
if (header.count('/') == 2 and 'RQ' in header):
fp_out.write('\n'.join(read) + '\n');
continue;
trimmed_header = header.replace('_', ' ').split()[0];
# pacbio_header = '%s/%d/0_%d RQ=0.850' % (trimmed_header, current_read, len(read[1]));
pacbio_header = 'S1/%d/0_%d RQ=0.850' % (current_read, len(read[1]));
header_conversion_hash[pacbio_header] = header;
read[0] = '%s%s' % (read[0][0], pacbio_header); ### Keep the first char of the header line.
read[1] = re.sub("(.{500})", "\\1\n", read[1], 0, re.DOTALL); ### Wrap the sequence line, because DALIGNER has a 9998bp line len limit.
if (len(read) == 4):
read[3] = re.sub("(.{500})", "\\1\n", read[3], 0, re.DOTALL); ### Wrap the qual line, because DALIGNER has a 9998bp line len limit.
fp_out.write('\n'.join(read) + '\n');
sys.stderr.write('\n');
fp_in.close();
fp_out.close();
return header_conversion_hash;
def add_dummy_qv(input_fastq_path, dummy_qv_val, out_fastq_path, fp_out):
try:
fp_in = open(input_fastq_path, 'r');
except:
sys.stderr.write('ERROR: Could not open file "%s" for reading! Exiting.\n' % input_fastq_path);
exit(0);
num_reads = 0;
while True:
[header, read] = fastqparser.get_single_read(fp_in);
if (len(read) == 0):
break;
quals = chr(dummy_qv_val + 33) * len(read[1]);
fp_out.write('@%s\n%s\n+\n%s\n' % (read[0][1:], read[1], quals));
num_reads += 1;
sys.stderr.write('\n');
fp_in.close();
if __name__ == "__main__":
if (len(sys.argv) < 2):
sys.stderr.write('Various filtering methods for FASTA/FASTQ files.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\theader\n');
sys.stderr.write('\tduplicateid\n');
sys.stderr.write('\tjoin\n');
sys.stderr.write('\tminlen\n');
sys.stderr.write('\tmaxlen\n');
sys.stderr.write('\tqualstats\n');
sys.stderr.write('\treverse\n');
sys.stderr.write('\thardclip\n');
sys.stderr.write('\tspecialchars\n');
sys.stderr.write('\tmarginalign\n');
sys.stderr.write('\twrap\n');
sys.stderr.write('\ttouppercase\n');
sys.stderr.write('\tenumerate\n');
sys.stderr.write('\tgiheader\n');
sys.stderr.write('\tuniquify\n');
sys.stderr.write('\tqvfilter\n');
sys.stderr.write('\tinfo\n');
sys.stderr.write('\tcount1d2d\n');
sys.stderr.write('\tsubsample\n');
sys.stderr.write('\tfastq2fasta\n');
sys.stderr.write('\tfastq2fasta2\n');
sys.stderr.write('\tgetPairedHeaders\n');
sys.stderr.write('\tchecknanoporepaths\n');
sys.stderr.write('\tlength_distribution\n')
sys.stderr.write('\t1d\n');
sys.stderr.write('\t2d\n');
sys.stderr.write('\treadid\n');
sys.stderr.write('\tsubseqs\n');
sys.stderr.write('\tmsa2fasta\n');
sys.stderr.write('\tseparate\n');
sys.stderr.write('\t2pacbio\n');
sys.stderr.write('\tadddummyqv\n');
exit(0);
if (sys.argv[1] == 'header'):
if (len(sys.argv) < 4 or len(sys.argv) > 5):
sys.stderr.write('Takes a FASTA/FASTQ file and a file containing header patterns. Extracts all sequences containing the specified header patterns.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_pattern_file> <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
sys.stderr.write('\tIf any of the patterns match a substring of a header, the sequence will be outputted.\n');
sys.stderr.write('\tTo match the entire header and not only a substring, place a semicolon ";" character at the end of the pattern line.\n');
sys.stderr.write('\n');
exit(0);
header_patterns_path = sys.argv[2];
input_fastq_path = sys.argv[3];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 5):
out_fastq_path = sys.argv[4];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
filter_seqs_by_header(input_fastq_path, header_patterns_path, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'duplicateid'):
if (len(sys.argv) < 3 or len(sys.argv) > 4):
sys.stderr.write('Filters the duplicate FASTA/FASTQ entries. Duplicates are equal entries up to the first space. (E.g. gi|49175990|ref|NC_000913.2|)\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
filter_duplicate_ncbi_id(input_fastq_path, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'join'):
if (len(sys.argv) < 3 or len(sys.argv) > 4):
sys.stderr.write('If a FASTA/FASTQ entries are stored in lines of specific width, this tool joins them all into one line.');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(e);
exit(0);
join_fastq_lines(input_fastq_path, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'minlen'):
if (len(sys.argv) < 4 or len(sys.argv) > 5):
sys.stderr.write('Extracts only sequences which have length >= min_len.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s min_len <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
min_length = int(sys.argv[2]);
input_fastq_path = sys.argv[3];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 5):
out_fastq_path = sys.argv[4];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(e);
exit(0);
filter_seqs_by_length(input_fastq_path, min_length, False, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'maxlen'):
if (len(sys.argv) < 4 or len(sys.argv) > 5):
sys.stderr.write('Extracts only sequences which have length <= max_len.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s max_len <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
max_length = int(sys.argv[2]);
input_fastq_path = sys.argv[3];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 5):
out_fastq_path = sys.argv[4];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(e);
exit(0);
filter_seqs_by_length(input_fastq_path, max_length, True, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'qualstats'):
if (len(sys.argv) < 3 or len(sys.argv) > 3):
sys.stderr.write('This is not an actual filter, but calculates statistics of the base qualities provided in the FASTQ file.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
input_fastq_path = sys.argv[2];
base_quality_stats(input_fastq_path);
exit(0);
elif (sys.argv[1] == 'reverse'):
if (len(sys.argv) < 3 or len(sys.argv) > 3):
sys.stderr.write('Reverse complements all sequences in a given file.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
input_fastq_path = sys.argv[2];
reverse_complement_seqs(input_fastq_path);
exit(0);
elif (sys.argv[1] == 'hardclip'):
if (len(sys.argv) < 4 or len(sys.argv) > 4):
sys.stderr.write('Trim each sequence from the left and the right end by a given amount of bases.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s num_bases <input_fastq_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
num_bases = int(sys.argv[2]);
input_fastq_path = sys.argv[3];
hard_clip(input_fastq_path, num_bases);
exit(0);
elif (sys.argv[1] == 'specialchars'):
if (len(sys.argv) < 3 or len(sys.argv) > 4):
sys.stderr.write('Removes any non-alnum character from the sequences\' header and replaces it with \'_\'.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
remove_special_chars_from_headers(input_fastq_path, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'marginalign'):
if (len(sys.argv) < 3 or len(sys.argv) > 4):
sys.stderr.write('Removes any non-alnum character from the sequences\' header and replaces it with \'_\'. Also, removes all reads larger than 50kbp.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
filter_for_marginalign(input_fastq_path, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'wrap'):
if (len(sys.argv) < 4 or len(sys.argv) > 5):
sys.stderr.write('Wraps FASTA/FASTQ files to have line length up to a given number of characters.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s line_length <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
wrap_length = int(sys.argv[2]);
input_fastq_path = sys.argv[3];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 5):
out_fastq_path = sys.argv[4];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
wrap_fastq_file(input_fastq_path, wrap_length, out_fastq_path, fp_out)
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'touppercase'):
if (len(sys.argv) < 4 or len(sys.argv) > 4):
sys.stderr.write('Converts lowercase bases (e.g. masking regions) to upper case.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
convert_to_uppercase(input_fastq_path, out_fastq_path, fp_out)
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'enumerate'):
if (len(sys.argv) < 4 or len(sys.argv) > 4):
sys.stderr.write('Replace headers of FASTQ sequences with their ordinal numbers.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
enumerate_headers(input_fastq_path, out_fastq_path, fp_out)
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'giheader'):
if (len(sys.argv) < 4 or len(sys.argv) > 4):
sys.stderr.write('If a FASTQ file contains whitespaces, remove everything after the first whitespace.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
keep_gi_header(input_fastq_path, out_fastq_path, fp_out)
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'uniquify'):
if (len(sys.argv) < 4 or len(sys.argv) > 4):
sys.stderr.write('Makes all headers in a FASTQ file unique by adding a number at the end of the header. Also, splits headers up to the first whitespace.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
uniquify_headers(input_fastq_path, out_fastq_path, fp_out)
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'qvfilter'):
if (len(sys.argv) < 5 or len(sys.argv) > 6):
sys.stderr.write('Output only reads which have average base qualities above or below certain threshold.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s lte_gte threshold <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
sys.stderr.write('\tlte_gte - Select which reads to output. Can be either "lt", "lte", "gt", "gte" or "eq".\n');
sys.stderr.write('\n');
exit(0);
lte_gte = sys.argv[2];
qv_threshold = int(sys.argv[3]);
input_fastq_path = sys.argv[4];
if ((lte_gte in ['lt', 'lte', 'gt', 'gte', 'eq']) == False):
sys.stderr.write('ERROR: Incorrect value of the lte_gte parameter. Should be either "<" or ">".');
exit(1);
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 6):
out_fastq_path = sys.argv[5];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
base_quality_filter(input_fastq_path, lte_gte, qv_threshold, out_fastq_path, fp_out)
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'info'):
if (len(sys.argv) < 3 or len(sys.argv) > 4):
sys.stderr.write('Tool for obtaining basic stats from FASTA/FASTQ files, such as number of sequences, total sequence length, average sequence length, etc.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<input_reference_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
sys.stderr.write('\t<input_reference_file> - If a reference is given, coverage is caluclated using the Lander-Waterman equation.\n');
sys.stderr.write('\n');
exit(0);
input_fastq_path = sys.argv[2];
if (len(sys.argv) == 4):
reference_path = sys.argv[3];
[ref_ret_string, ref_num_seqs, ref_total_seq_len, ref_average_seq_len, max_seq_len] = fastqparser.count_seq_length(reference_path);
# sys.stdout.write('Reference info:\n');
sys.stdout.write('(reference) Info for "%s".\n' % (reference_path));
sys.stdout.write(ref_ret_string);
sys.stdout.write('\n');
[ret_string, num_seqs, total_seq_len, average_seq_len, max_seq_len] = fastqparser.count_seq_length(input_fastq_path);
# sys.stdout.write('FASTQ info:\n');
if (len(sys.argv) == 4):
sys.stdout.write('(reads) Info for "%s".\n' % (input_fastq_path));
else:
sys.stdout.write('Info for "%s".\n' % (input_fastq_path));
sys.stdout.write(ret_string);
if (len(sys.argv) == 4):
sys.stdout.write('\n');
sys.stdout.write('Coverage: %.2fx\n' % (float(total_seq_len) / float(ref_total_seq_len)));
sys.stdout.write('\n');
exit(0);
elif (sys.argv[1] == 'count1d2d'):
if (len(sys.argv) < 3 or len(sys.argv) > 3):
sys.stderr.write('This is not an actual filter, but counts the number of 1d or 2d reads.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
input_fastq_path = sys.argv[2];
count_1d2d(input_fastq_path);
exit(0);
elif (sys.argv[1] == 'subsample'):
if (len(sys.argv) < 5 or len(sys.argv) > 5):
sys.stderr.write('Subsamples a given fasta/fastq file to a given coverage. Prints the result to stdout.\n')
sys.stderr.write('If the initail coverage is too low, prints out the original file.\n')
sys.stderr.write('Usage:\n')
sys.stderr.write('\t%s %s <input_fasta(q)_file> <desired_coverage> <ref_genome_size>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]))
sys.stderr.write('\n')
exit(0);
input_fastq_path = sys.argv[2]
desired_coverage = float(sys.argv[3])
ref_genome_size = int(sys.argv[4])
subsample(input_fastq_path, desired_coverage, ref_genome_size)
exit(0);
elif (sys.argv[1] == 'getPairedHeaders'):
if (len(sys.argv) != 4 ):
sys.stderr.write('Outputs all fasta/fastq sequences for an input file, whose headers are present in a given target fasta/fastq file.\n')
sys.stderr.write('Prints results to stdout.\n')
sys.stderr.write('Useful when subsampling paired end reads in separate files.\n')
sys.stderr.write('Usage:\n')
sys.stderr.write('\t%s %s <input_fasta(q)_file> <target_fasta(q)_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]))
sys.stderr.write('\n')
exit(0);
input_fastq_path = sys.argv[2]
target_fastq_path = sys.argv[3]
getPaired(input_fastq_path, target_fastq_path)
exit(0);
elif (sys.argv[1] == 'fastq2fasta'):
if (len(sys.argv) < 3 or len(sys.argv) > 3):
sys.stderr.write('Outputs a given fastq file in fasta format. Replaces the ":" characters with blank spaces.\n')
sys.stderr.write('Additionally, replaces colons in header with spaces (relevant for running L&S pipeline).\n')
sys.stderr.write('Usage:\n')
sys.stderr.write('\t%s %s <input_fastq_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]))
sys.stderr.write('\n')
exit(0);
input_fastq_path = sys.argv[2]
fastq2fasta(input_fastq_path, True)
exit(0);
elif (sys.argv[1] == 'fastq2fasta2'):
if (len(sys.argv) < 3 or len(sys.argv) > 3):
sys.stderr.write('Outputs a given fastq file in fasta format. Does not replace the ":" characters with blank spaces (unlike fastq2fasta).\n')
sys.stderr.write('Additionally, replaces colons in header with spaces (relevant for running L&S pipeline).\n')
sys.stderr.write('Usage:\n')
sys.stderr.write('\t%s %s <input_fastq_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]))
sys.stderr.write('\n')
exit(0);
input_fastq_path = sys.argv[2]
fastq2fasta(input_fastq_path, False)
exit(0);
elif (sys.argv[1] == 'checknanoporepaths'):
if (len(sys.argv) < 4 or len(sys.argv) > 4):
sys.stderr.write('This is not an actual filter, but removes extra spaces from nanopore paths.\n')
sys.stderr.write('So that reads file can be used with nanopolish.\n')
sys.stderr.write('Usage:\n')
sys.stderr.write('\t%s %s <input_fastq_file> <fast5_root_path>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]))
sys.stderr.write('\n')
exit(0)
input_fastq_path = sys.argv[2]
fast5_root_path = sys.argv[3]
check_nanopore_paths(input_fastq_path, fast5_root_path)
exit(0)
elif (sys.argv[1] == 'length_distribution'):
if (len(sys.argv) < 3 or len(sys.argv) > 3):
sys.stderr.write('Outputs the distribution of reads in a fasta/fastq file.\n')
sys.stderr.write('Usage:\n')
sys.stderr.write('\t%s %s <input_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]))
sys.stderr.write('\n')
exit(0)
input_path = sys.argv[2]
length_distribution(input_path)
exit(0);
elif (sys.argv[1] == '1d' or sys.argv[1] == '2d'):
if (len(sys.argv) < 3 or len(sys.argv) > 4):
sys.stderr.write('Extracts only reads with typical %s (nanopore) headers (those containing either "1d", "template" or "complement"; "2d" or "twodir" in their header).\n' % (sys.argv[1]));
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
# header_patterns_path = sys.argv[2];
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
if (sys.argv[1] == '1d'):
filter_seqs_by_header_list(input_fastq_path, ['1d', 'template', 'complement'], out_fastq_path, fp_out);
else:
filter_seqs_by_header_list(input_fastq_path, ['2d', 'twodir'], out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'readid'):
if (len(sys.argv) < 4 or len(sys.argv) > 5):
sys.stderr.write('Takes a FASTA/FASTQ file and a file containing seq IDs (0-offset). Extracts all seqs with given IDs.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_id_file> <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
read_id_path = sys.argv[2];
input_fastq_path = sys.argv[3];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 5):
out_fastq_path = sys.argv[4];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
filter_seqs_by_read_id(input_fastq_path, read_id_path, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'subseqs'):
if (len(sys.argv) < 5 or len(sys.argv) > 6):
sys.stderr.write('Extracts bases from all sequences in a FASTA file between specified coordinates. End coordinate is not inclusive.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> start end [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
input_fastq_path = sys.argv[2];
start_coord = int(sys.argv[3]);
end_coord = int(sys.argv[4]);
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 6):
out_fastq_path = sys.argv[5];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
extract_subseqs(input_fastq_path, start_coord, end_coord, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'msa2fasta'):
if (len(sys.argv) < 3 or len(sys.argv) > 4):
sys.stderr.write('Takes a multifasta file of multiple sequence alignments, and produces a majority vote consensus. Only [ACTG] bases are considered for output. Gaps in the input file are denoted by either a \'.\' or a \'-\'.\n');
sys.stderr.write('Usage:\n')
sys.stderr.write('\t%s %s <input_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]))
sys.stderr.write('\n')
exit(0)
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
msa2fasta(input_fastq_path, fp_out)
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
elif (sys.argv[1] == 'separate'):
if (len(sys.argv) < 4 or len(sys.argv) > 5 ):
sys.stderr.write('Separate a FASTA/FASTQ file into individual sequence files. File names will be numbers assigned to sequences sequentially.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> <out_folder> [headers_as_fn]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
sys.stderr.write(' headers_as_fn - if "true", output files will be named the same as the header of the corresponding sequence.\n');
sys.stderr.write('\n');
exit(0);
input_fastq_path = sys.argv[2];
out_folder = sys.argv[3];
headers_as_fn = False;
if (len(sys.argv) >= 5):
headers_as_fn = True if (sys.argv[4].lower() in ['true', '1']) else False;
separate_seqs(input_fastq_path, out_folder, headers_as_fn=headers_as_fn);
elif (sys.argv[1] == '2pacbio'):
if (len(sys.argv) < 4 or len(sys.argv) > 4):
sys.stderr.write('Makes all headers in a FASTQ file unique by adding a number at the end of the header. Also, splits headers up to the first whitespace.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> <out_converted_fastq_file>\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
input_fastq_path = sys.argv[2];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 4):
out_fastq_path = sys.argv[3];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
fp_out.close();
convert_reads_to_pacbio_format(input_fastq_path, out_fastq_path)
# if (fp_out != sys.stdout):
# fp_out.close();
exit(0);
elif (sys.argv[1] == 'adddummyqv'):
if (len(sys.argv) < 4 or len(sys.argv) > 5):
sys.stderr.write('Takes an input FASTA/FASTQ file and converts it to a FASTQ format if necessary, while replacing all QVs with a given qv_val value.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s qv_val <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
sys.stderr.write('\n');
exit(0);
dummy_qv_val = int(sys.argv[2]);
input_fastq_path = sys.argv[3];
out_fastq_path = '';
fp_out = sys.stdout;
if (len(sys.argv) == 5):
out_fastq_path = sys.argv[4];
if (input_fastq_path == out_fastq_path):
sys.stderr.write('ERROR: Output and input files are the same! Exiting.\n');
exit(0);
try:
fp_out = open(out_fastq_path, 'w');
except Exception as e:
sys.stderr.write(str(e));
exit(0);
add_dummy_qv(input_fastq_path, dummy_qv_val, out_fastq_path, fp_out);
if (fp_out != sys.stdout):
fp_out.close();
exit(0);
else:
sys.stderr.write('ERROR: Unknown subcommand!\n');
exit(0);
| 36.823944 | 241 | 0.56244 | 8,798 | 62,748 | 3.838486 | 0.064446 | 0.078351 | 0.12188 | 0.052412 | 0.742679 | 0.713452 | 0.691481 | 0.675432 | 0.649877 | 0.633443 | 0 | 0.01926 | 0.279292 | 62,748 | 1,703 | 242 | 36.845567 | 0.727506 | 0.03793 | 0 | 0.69313 | 0 | 0.017557 | 0.192298 | 0.01272 | 0 | 0 | 0 | 0 | 0 | 1 | 0.021374 | false | 0.003053 | 0.005344 | 0 | 0.028244 | 0.000763 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3f7f8dcdb7554c4849560c6cfe9c5ac1457542ae | 236 | py | Python | setup.py | mythmgn/py_amis | 58577c45265a8164641e2d053756358cafebe454 | [
"Apache-2.0"
] | 1 | 2020-02-29T03:41:54.000Z | 2020-02-29T03:41:54.000Z | setup.py | mythmgn/py_amis | 58577c45265a8164641e2d053756358cafebe454 | [
"Apache-2.0"
] | null | null | null | setup.py | mythmgn/py_amis | 58577c45265a8164641e2d053756358cafebe454 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*
# Copyright: See LICENSE for details.
# Authors: Guannan Ma (@mythmgn),
"""
:description:
setuptools
"""
import setuptools
setuptools.setup()
# vi:set tw=0 ts=4 sw=4 nowrap fdm=indent
| 15.733333 | 41 | 0.669492 | 33 | 236 | 4.787879 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020305 | 0.165254 | 236 | 14 | 42 | 16.857143 | 0.781726 | 0.754237 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
3f82941b016805d12215646d369438bf63873785 | 541 | py | Python | skimage/data/_detect.py | zhanwenchen/scikit-image | af8a78e5b12ebb5709a57f9350b4b1f4c8f0c7db | [
"BSD-3-Clause"
] | 3 | 2019-02-28T16:05:36.000Z | 2020-04-03T17:29:07.000Z | Lib/site-packages/skimage/data/_detect.py | caiyongji/Anaconda-py36.5-tensorflow-built-env | f4eb40b5ca3f49dfc929ff3ad2b4bb877e9663e2 | [
"PSF-2.0"
] | 26 | 2020-03-24T18:07:06.000Z | 2022-03-12T00:12:27.000Z | site-packages/skimage/data/_detect.py | Wristlebane/Pyto | 901ac307b68486d8289105c159ca702318bea5b0 | [
"MIT"
] | 3 | 2019-12-31T23:21:40.000Z | 2020-04-03T17:29:08.000Z | import os as _os
data_dir = _os.path.abspath(_os.path.dirname(__file__))
def lbp_frontal_face_cascade_filename():
"""
Returns the path to the XML file containing information about the weak
classifiers of a cascade classifier trained using LBP features. It is part
of the OpenCV repository [1]_.
References
----------
.. [1] OpenCV lbpcascade trained files
https://github.com/Itseez/opencv/tree/master/data/lbpcascades
"""
return _os.path.join(data_dir, 'lbpcascade_frontalface_opencv.xml')
| 30.055556 | 78 | 0.709797 | 73 | 541 | 5.027397 | 0.671233 | 0.049046 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004566 | 0.190388 | 541 | 17 | 79 | 31.823529 | 0.833333 | 0.567468 | 0 | 0 | 0 | 0 | 0.170103 | 0.170103 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
3f93dc280aafbe3f924e7cdbe454605227bfed3d | 546 | py | Python | api/v2/serializers/fields/tag.py | simpsonw/atmosphere | 3a5203ef0b563de3a0e8c8c8715df88186532d7a | [
"BSD-3-Clause"
] | 197 | 2016-12-08T02:33:32.000Z | 2022-03-23T14:27:47.000Z | api/v2/serializers/fields/tag.py | simpsonw/atmosphere | 3a5203ef0b563de3a0e8c8c8715df88186532d7a | [
"BSD-3-Clause"
] | 385 | 2017-01-03T22:51:46.000Z | 2020-12-16T16:20:42.000Z | api/v2/serializers/fields/tag.py | benlazarine/atmosphere | 38fad8e4002e510e8b4294f2bb5bc75e8e1817fa | [
"BSD-3-Clause"
] | 50 | 2016-12-08T08:32:25.000Z | 2021-12-10T00:21:39.000Z | from core.models import Tag
from rest_framework import serializers
from api.v2.serializers.summaries import TagSummarySerializer
class TagRelatedField(serializers.RelatedField):
def __init__(self, **kwargs):
kwargs['read_only'] = True
super(TagRelatedField, self).__init__(**kwargs)
def to_representation(self, value):
serializer = TagSummarySerializer(value, context=self.context)
return serializer.data
def to_internal_value(self, data):
tag = Tag.objects.get(id=data)
return tag
| 30.333333 | 70 | 0.723443 | 62 | 546 | 6.16129 | 0.548387 | 0.026178 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002257 | 0.188645 | 546 | 17 | 71 | 32.117647 | 0.860045 | 0 | 0 | 0 | 0 | 0 | 0.016484 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.230769 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
3f951db61db200f7eaa2d422686b1174a4eac32a | 435 | py | Python | gcp_audit_rules/gcp_iam_custom_role_changes.py | designing-penguin/panther-analysis | 26034cea4504f43227f8d3789225f6ca7b35dfe0 | [
"Apache-2.0"
] | null | null | null | gcp_audit_rules/gcp_iam_custom_role_changes.py | designing-penguin/panther-analysis | 26034cea4504f43227f8d3789225f6ca7b35dfe0 | [
"Apache-2.0"
] | null | null | null | gcp_audit_rules/gcp_iam_custom_role_changes.py | designing-penguin/panther-analysis | 26034cea4504f43227f8d3789225f6ca7b35dfe0 | [
"Apache-2.0"
] | null | null | null | ROLE_METHODS = {
'google.iam.admin.v1.CreateRole', 'google.iam.admin.v1.DeleteRole',
'google.iam.admin.v1.UpdateRole'
}
def rule(event):
return (event['resource'].get('type') == 'iam_role' and
event['protoPayload'].get('methodName') in ROLE_METHODS)
def dedup(event):
return event['resource'].get('labels', {}).get('project_id',
'<PROJECT_NOT_FOUND>')
| 29 | 73 | 0.583908 | 49 | 435 | 5.061224 | 0.530612 | 0.108871 | 0.169355 | 0.193548 | 0.217742 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009119 | 0.243678 | 435 | 14 | 74 | 31.071429 | 0.744681 | 0 | 0 | 0 | 0 | 0 | 0.402299 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0 | 0.2 | 0.4 | 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 | 0 | 0 | 0 | 2 |
3fa4af1406ba94fe5ccfb3dfd44c11d30dbeccaf | 187 | gyp | Python | binding.gyp | jack-douglas/TruckSim-Telemetry | 5c6f086e534ffe3c7e363e09923a443002176317 | [
"MIT"
] | 43 | 2019-05-03T14:38:31.000Z | 2022-03-15T09:18:13.000Z | binding.gyp | donatocl/TruckSim-Telemetry | 75c5513cf1f128cdf67d7ce60f17cec0260e440b | [
"MIT"
] | 13 | 2019-05-01T16:07:17.000Z | 2022-02-23T10:37:40.000Z | binding.gyp | donatocl/TruckSim-Telemetry | 75c5513cf1f128cdf67d7ce60f17cec0260e440b | [
"MIT"
] | 10 | 2019-05-15T20:27:38.000Z | 2022-03-14T09:03:53.000Z | {
"targets": [
{
"target_name": "scsSDKTelemetry",
"sources": [ "scsSDKTelemetry.cc" ],
"cflags": ["-fexceptions"],
"cflags_cc": ["-fexceptions"]
}
]
} | 18.7 | 42 | 0.502674 | 12 | 187 | 7.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.278075 | 187 | 10 | 43 | 18.7 | 0.681481 | 0 | 0 | 0 | 0 | 0 | 0.515957 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3fa8a8eda08a065fae5c675e18ad4f268031bb1c | 226 | py | Python | src/test/test_model/test_synapses/test_synapses.py | Fassial/pku-intern | 4463e7d5a5844c8002f7e3d01b4fadc3a20e2038 | [
"MIT"
] | null | null | null | src/test/test_model/test_synapses/test_synapses.py | Fassial/pku-intern | 4463e7d5a5844c8002f7e3d01b4fadc3a20e2038 | [
"MIT"
] | null | null | null | src/test/test_model/test_synapses/test_synapses.py | Fassial/pku-intern | 4463e7d5a5844c8002f7e3d01b4fadc3a20e2038 | [
"MIT"
] | null | null | null | """
Created on 21:34, May. 23rd, 2021
Author: fassial
Filename: test_synapses.py
"""
# local dep
import model
__all__ = [
"test_synapses",
]
## define test func
# define test_synapses func
def test_synapses():
pass
| 12.555556 | 33 | 0.690265 | 31 | 226 | 4.774194 | 0.709677 | 0.324324 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054945 | 0.19469 | 226 | 17 | 34 | 13.294118 | 0.758242 | 0.575221 | 0 | 0 | 0 | 0 | 0.154762 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.166667 | 0.166667 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
3fa9f01dcb82a10bbd8733fb9fce438e8bd50c41 | 2,795 | py | Python | aliyun-python-sdk-arms/aliyunsdkarms/request/v20190808/ApplyScenarioRequest.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | 1,001 | 2015-07-24T01:32:41.000Z | 2022-03-25T01:28:18.000Z | aliyun-python-sdk-arms/aliyunsdkarms/request/v20190808/ApplyScenarioRequest.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | 363 | 2015-10-20T03:15:00.000Z | 2022-03-08T12:26:19.000Z | aliyun-python-sdk-arms/aliyunsdkarms/request/v20190808/ApplyScenarioRequest.py | yndu13/aliyun-openapi-python-sdk | 12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5 | [
"Apache-2.0"
] | 682 | 2015-09-22T07:19:02.000Z | 2022-03-22T09:51:46.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from aliyunsdkcore.request import RpcRequest
from aliyunsdkarms.endpoint import endpoint_data
class ApplyScenarioRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'ARMS', '2019-08-08', 'ApplyScenario','arms')
self.set_method('POST')
if hasattr(self, "endpoint_map"):
setattr(self, "endpoint_map", endpoint_data.getEndpointMap())
if hasattr(self, "endpoint_regional"):
setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional())
def get_SnForce(self):
return self.get_query_params().get('SnForce')
def set_SnForce(self,SnForce):
self.add_query_param('SnForce',SnForce)
def get_Sign(self):
return self.get_query_params().get('Sign')
def set_Sign(self,Sign):
self.add_query_param('Sign',Sign)
def get_SnStat(self):
return self.get_query_params().get('SnStat')
def set_SnStat(self,SnStat):
self.add_query_param('SnStat',SnStat)
def get_Scenario(self):
return self.get_query_params().get('Scenario')
def set_Scenario(self,Scenario):
self.add_query_param('Scenario',Scenario)
def get_SnDump(self):
return self.get_query_params().get('SnDump')
def set_SnDump(self,SnDump):
self.add_query_param('SnDump',SnDump)
def get_AppId(self):
return self.get_query_params().get('AppId')
def set_AppId(self,AppId):
self.add_query_param('AppId',AppId)
def get_Name(self):
return self.get_query_params().get('Name')
def set_Name(self,Name):
self.add_query_param('Name',Name)
def get_SnTransfer(self):
return self.get_query_params().get('SnTransfer')
def set_SnTransfer(self,SnTransfer):
self.add_query_param('SnTransfer',SnTransfer)
def get_UpdateOption(self):
return self.get_query_params().get('UpdateOption')
def set_UpdateOption(self,UpdateOption):
self.add_query_param('UpdateOption',UpdateOption)
def get_Config(self):
return self.get_query_params().get('Config')
def set_Config(self,Config):
self.add_query_param('Config',Config) | 30.380435 | 74 | 0.745259 | 394 | 2,795 | 5.093909 | 0.291878 | 0.029895 | 0.069756 | 0.084704 | 0.154459 | 0.154459 | 0.154459 | 0 | 0 | 0 | 0 | 0.005002 | 0.141682 | 2,795 | 92 | 75 | 30.380435 | 0.831597 | 0.269767 | 0 | 0 | 0 | 0 | 0.116718 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.42 | false | 0 | 0.04 | 0.2 | 0.68 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
3fbc091ac1d93ddc7aad65ce2e81099aba935665 | 8,370 | py | Python | tests/protocol/client/test_client_channel.py | mirlarof/lime-python | 9961379562bd9d362b16c0ee66f3bde652070b22 | [
"Apache-2.0"
] | 2 | 2019-09-10T15:10:11.000Z | 2021-02-05T21:44:38.000Z | tests/protocol/client/test_client_channel.py | mirlarof/lime-python | 9961379562bd9d362b16c0ee66f3bde652070b22 | [
"Apache-2.0"
] | 9 | 2021-05-19T21:08:15.000Z | 2021-05-31T20:43:26.000Z | tests/protocol/client/test_client_channel.py | mirlarof/lime-python | 9961379562bd9d362b16c0ee66f3bde652070b22 | [
"Apache-2.0"
] | 3 | 2019-09-10T15:10:32.000Z | 2022-01-24T13:36:46.000Z | from asyncio import Future
from typing import Any, Awaitable
from pytest import fixture, mark
from pytest_mock import MockerFixture
from src import (ClientChannel, PlainAuthentication, Session,
SessionCompression, SessionEncryption, SessionState)
from .transport_dummy import TransportDummy
SESSION_ID = '1234'
SEND_SESSION_METHOD = 'send_session'
TO = 'me@take.net'
FROM_N = 'you@take.net'
class TestClientChannel:
@fixture(autouse=True)
def target(self) -> ClientChannel:
yield ClientChannel(
TransportDummy(SessionCompression.NONE, SessionEncryption.NONE),
False,
False
)
@mark.asyncio
async def test_start_new_session_async(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
target.state = SessionState.NEW
spy = mocker.spy(target, SEND_SESSION_METHOD)
sent_session = Session(SessionState.NEW)
# Act
target.start_new_session_async()
# Assert
sent_session.id = spy.call_args[0][0].id
spy.assert_called_once_with(sent_session)
@mark.asyncio
async def test_negotiate_session_async(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
target.state = SessionState.NEGOTIATING
spy = mocker.spy(target, SEND_SESSION_METHOD)
sent_session = Session(
SessionState.NEGOTIATING,
compression=SessionCompression.GZIP,
encryption=SessionEncryption.TLS
)
# Act
target.negotiate_session_async(
SessionCompression.GZIP,
SessionEncryption.TLS
)
# Assert
sent_session.id = spy.call_args[0][0].id
spy.assert_called_once_with(sent_session)
@mark.asyncio
async def test_authenticate_session_async(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
target.state = SessionState.AUTHENTICATING
target.session_id = SESSION_ID
spy = mocker.spy(target, SEND_SESSION_METHOD)
identity = 'test@take.net'
instance = 'test'
authentication = PlainAuthentication('any-pswd')
sent_session = Session(
SessionState.AUTHENTICATING,
scheme=authentication.scheme,
authentication=authentication
)
sent_session.from_n = f'{identity}/{instance}'
sent_session.id = SESSION_ID
# Act
target.authenticate_session_async(
identity,
authentication,
instance
)
# Assert
spy.assert_called_once_with(sent_session)
@mark.asyncio
async def test_send_finishing_session_async(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
target.state = SessionState.ESTABLISHED
target.session_id = SESSION_ID
spy = mocker.spy(target, SEND_SESSION_METHOD)
sent_session = Session(SessionState.FINISHING)
sent_session.id = SESSION_ID
# Act
target.send_finishing_session_async()
# Assert
spy.assert_called_once_with(sent_session)
@mark.asyncio
async def test_on_session_established(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
session = Session(SessionState.ESTABLISHED)
session.id = SESSION_ID
session.to = TO
session.from_n = FROM_N
spy = mocker.spy(target, 'on_session_established')
# Act
target.on_session(session)
# Assert
spy.assert_called_once_with(session)
assert target.local_node == str(session.to)
assert target.remote_node == session.from_n
@mark.asyncio
async def test_on_session_negotiating(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
session = Session(SessionState.NEGOTIATING)
session.id = SESSION_ID
spy = mocker.spy(target, 'on_session_negotiating')
# Act
target.on_session(session)
# Assert
spy.assert_called_once_with(session)
@mark.asyncio
async def test_on_session_authenticating(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
session = Session(SessionState.AUTHENTICATING)
session.id = SESSION_ID
spy = mocker.spy(target, 'on_session_authenticating')
# Act
target.on_session(session)
# Assert
spy.assert_called_once_with(session)
@mark.asyncio
async def test_on_session_finished(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
session = Session(SessionState.FINISHED)
session.id = SESSION_ID
spy_transport = mocker.spy(target.transport, 'close_async')
# Act
target.on_session(session)
# Assert
spy_transport.assert_called_once()
@mark.asyncio
async def test_on_session_failed(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
session = Session(SessionState.FAILED)
session.id = SESSION_ID
spy_transport = mocker.spy(target.transport, 'close_async')
# Act
target.on_session(session)
# Assert
spy_transport.assert_called_once()
@mark.asyncio
async def test_establish_session_async(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
compression = SessionCompression.GZIP
encryption = SessionEncryption.TLS
identity = TO
authentication = PlainAuthentication('any-pswd')
instance = 'test'
target.state = SessionState.NEW
start_result = Session(SessionState.AUTHENTICATING)
auth_result = Session(SessionState.ESTABLISHED)
mocker.patch.object( # noqa: WPS316
target,
'start_new_session_async',
return_value=self.__async_return(start_result)
)
mocker.patch.object(
target,
'authenticate_session_async',
return_value=self.__async_return(auth_result)
)
# Act
result: Future = await target.establish_session_async(
compression,
encryption,
identity,
authentication,
instance
)
# Assert
assert result == Session(SessionState.ESTABLISHED)
@mark.asyncio
async def test_establish_session_async_with_encryption_compression_options(
self,
mocker: MockerFixture,
target: ClientChannel
) -> None:
# Arrange
compression = None
encryption = None
identity = TO
authentication = PlainAuthentication('any-pswd')
instance = 'test'
target.state = SessionState.NEW
start_result = Session(
SessionState.NEGOTIATING,
encryption_options=[SessionEncryption.TLS],
compression_options=[SessionCompression.GZIP]
)
neg_result = Session(SessionState.AUTHENTICATING)
auth_result = Session(SessionState.ESTABLISHED)
mocker.patch.object( # noqa: WPS316
target,
'start_new_session_async',
return_value=self.__async_return(start_result)
)
mocker.patch.object( # noqa: WPS316
target,
'negotiate_session_async',
return_value=self.__async_return(neg_result)
)
mocker.patch.object(
target,
'authenticate_session_async',
return_value=self.__async_return(auth_result)
)
# Act
result: Future = await target.establish_session_async(
compression,
encryption,
identity,
authentication,
instance
)
# Assert
assert result == Session(SessionState.ESTABLISHED)
def __async_return(self, result: Any) -> Awaitable[Any]:
fut = Future()
fut.set_result(result)
return fut
| 26.741214 | 79 | 0.613501 | 786 | 8,370 | 6.291349 | 0.12341 | 0.03822 | 0.035592 | 0.042265 | 0.716279 | 0.70637 | 0.674419 | 0.645905 | 0.6182 | 0.605056 | 0 | 0.002956 | 0.312903 | 8,370 | 312 | 80 | 26.826923 | 0.856894 | 0.02951 | 0 | 0.622222 | 0 | 0 | 0.039698 | 0.026094 | 0 | 0 | 0 | 0 | 0.057778 | 1 | 0.008889 | false | 0 | 0.026667 | 0 | 0.044444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
3fbfdbfb2eec41a74169e47551888968305b3804 | 4,706 | py | Python | custom_components/nest_protect/pynest/models.py | LeandroIssa/ha-nest-protect | 6c7b0e4c950946a3daeb24b1c84f087e160e182c | [
"MIT"
] | null | null | null | custom_components/nest_protect/pynest/models.py | LeandroIssa/ha-nest-protect | 6c7b0e4c950946a3daeb24b1c84f087e160e182c | [
"MIT"
] | null | null | null | custom_components/nest_protect/pynest/models.py | LeandroIssa/ha-nest-protect | 6c7b0e4c950946a3daeb24b1c84f087e160e182c | [
"MIT"
] | null | null | null | """Models used by PyNest."""
from dataclasses import dataclass, field
import datetime
from typing import Any
@dataclass
class NestLimits:
"""Nest Limits."""
thermostats_per_structure: int
structures: int
smoke_detectors_per_structure: int
smoke_detectors: int
thermostats: int
@dataclass
class NestUrls:
"""Nest Urls."""
rubyapi_url: str
czfe_url: str
log_upload_url: str
transport_url: str
weather_url: str
support_url: str
direct_transport_url: str
@dataclass
class NestResponse:
"""Class that reflects a Nest API response."""
access_token: float
email: str
expires_in: str
userid: str
is_superuser: bool
language: str
weave: dict[str, str]
user: str
is_staff: bool
urls: NestUrls = field(default_factory=NestUrls)
limits: NestLimits = field(default_factory=NestLimits)
_2fa_state: str = None
_2fa_enabled: bool = None
_2fa_state_changed: str = None
def is_expired(self):
"""Check if session is expired."""
# Tue, 01-Mar-2022 23:15:55 GMT
expiry_date = datetime.datetime.strptime(
self.expires_in, "%a, %d-%b-%Y %H:%M:%S %Z"
)
if expiry_date <= datetime.datetime.now():
return True
return False
@dataclass
class Bucket:
"""Class that reflects a Nest API response."""
object_key: str
object_revision: str
object_timestamp: str
value: Any
@dataclass
class WhereBucket(Bucket):
"""Class that reflects a Nest API response."""
object_key: str
object_revision: str
object_timestamp: str
value: Any
@dataclass
class TopazBucketValue:
"""Nest Protect values."""
spoken_where_id: str
creation_time: int
installed_locale: str
ntp_green_led_brightness: int
component_buzzer_test_passed: bool
wifi_ip_address: str
wired_led_enable: bool
wifi_regulatory_domain: str
co_blame_duration: int
is_rcs_capable: bool
fabric_id: str
battery_health_state: int
steam_detection_enable: bool
hushed_state: bool
capability_level: float
home_alarm_link_type: int
model: str
component_smoke_test_passed: bool
component_speaker_test_passed: bool
removed_from_base: bool
smoke_sequence_number: int
home_away_input: bool
device_locale: str
co_blame_threshold: int
kl_software_version: str
component_us_test_passed: bool
auto_away: bool
night_light_enable: bool
component_als_test_passed: bool
speaker_test_results: 32768
wired_or_battery: int
is_rcs_used: bool
replace_by_date_utc_secs: int
certification_body: 2
component_pir_test_passed: bool
structure_id: str
software_version: str
component_hum_test_passed: bool
home_alarm_link_capable: bool
night_light_brightness: int
device_external_color: str
latest_manual_test_end_utc_secs: int
smoke_status: int
latest_manual_test_start_utc_secs: int
component_temp_test_passed: bool
home_alarm_link_connected: bool
co_status: int
heat_status: int
product_id: int
night_light_continuous: bool
co_previous_peak: int
auto_away_decision_time_secs: int
component_co_test_passed: bool
where_id: str
serial_number: str
component_heat_test_passed: bool
latest_manual_test_cancelled: bool
thread_mac_address: str
resource_id: str
buzzer_test_results: int
wifi_mac_address: str
line_power_present: bool
gesture_hush_enable: bool
device_born_on_date_utc_secs: int
ntp_green_led_enable: bool
component_led_test_passed: bool
co_sequence_number: int
thread_ip_address: list[str]
component_wifi_test_passed: bool
heads_up_enable: bool
battery_level: int
@dataclass
class TopazBucket(Bucket):
"""Class that reflects a Nest API response."""
value: TopazBucketValue = field(default_factory=TopazBucketValue)
@dataclass
class GoogleAuthResponse:
"""TODO."""
access_token: str
expires_in: int
scope: str
token_type: str
id_token: str
def is_expired(self):
"""Check if access token is expired."""
expiry_date = datetime.datetime.now() + datetime.timedelta(
seconds=self.expires_in - 5
)
if expiry_date <= datetime.datetime.now():
return True
return False
# TODO rewrite to snake_case
@dataclass
class NestAuthClaims:
"""TODO."""
subject: Any
expirationTime: str
policyId: str
structureConstraint: str
@dataclass
class NestAuthResponse:
"""TODO."""
jwt: str
claims: NestAuthClaims = field(default_factory=NestAuthClaims)
| 22.625 | 69 | 0.70272 | 607 | 4,706 | 5.115321 | 0.359143 | 0.038647 | 0.054106 | 0.023188 | 0.167794 | 0.158454 | 0.126248 | 0.11562 | 0.10306 | 0.10306 | 0 | 0.006069 | 0.229707 | 4,706 | 207 | 70 | 22.7343 | 0.850483 | 0.078623 | 0 | 0.168831 | 0 | 0 | 0.005622 | 0 | 0 | 0 | 0 | 0.004831 | 0 | 1 | 0.012987 | false | 0.077922 | 0.019481 | 0 | 0.883117 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
3fd37bbb933b3b0cb2759836099d356e64db0b08 | 425 | py | Python | wins/tests/utils.py | uktrade/export-wins-data | 46caa444812e89abe504bec8c15aa7f7ba1a247e | [
"MIT"
] | 5 | 2016-09-12T12:52:45.000Z | 2020-03-24T14:43:13.000Z | wins/tests/utils.py | uktrade/export-wins-data | 46caa444812e89abe504bec8c15aa7f7ba1a247e | [
"MIT"
] | 435 | 2016-10-18T12:51:39.000Z | 2021-06-09T17:22:08.000Z | wins/tests/utils.py | uktrade/export-wins-data | 46caa444812e89abe504bec8c15aa7f7ba1a247e | [
"MIT"
] | 2 | 2016-12-06T10:37:21.000Z | 2017-02-22T17:27:43.000Z | from datetime import datetime
from rest_framework.fields import DateField, DateTimeField
def format_date_or_datetime(value):
"""
Formats a date or datetime using DRF fields.
This is for use in tests when comparing dates and datetimes with JSON-formatted values.
"""
if isinstance(value, datetime):
return DateTimeField().to_representation(value)
return DateField().to_representation(value) | 30.357143 | 91 | 0.752941 | 54 | 425 | 5.814815 | 0.685185 | 0.038217 | 0.089172 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181176 | 425 | 14 | 92 | 30.357143 | 0.902299 | 0.312941 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
3fec5649c5f4d54218c6534a3abe0e3fa6d8d997 | 750 | py | Python | tests/conftest.py | chris48s/datapackage-py | 1277f3c75d26692aec3794e9e25ffb4f5e07cac7 | [
"MIT"
] | 183 | 2016-03-24T11:34:10.000Z | 2022-01-12T19:28:04.000Z | tests/conftest.py | chris48s/datapackage-py | 1277f3c75d26692aec3794e9e25ffb4f5e07cac7 | [
"MIT"
] | 189 | 2016-03-14T15:21:44.000Z | 2021-09-21T17:48:39.000Z | tests/conftest.py | okfn/datapackage-model-py | 52416bd5be2e146490ee91f51b80d9b2178e0070 | [
"MIT"
] | 47 | 2016-03-17T17:32:41.000Z | 2021-06-21T15:49:14.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import mock
import pytest
import tempfile
from datapackage import DataPackage
# Fixtures
@pytest.yield_fixture()
def tmpfile():
with tempfile.NamedTemporaryFile() as file:
yield file
@pytest.yield_fixture()
def txt_tmpfile():
with tempfile.NamedTemporaryFile(suffix='.txt') as file:
yield file
@pytest.yield_fixture()
def csv_tmpfile():
with tempfile.NamedTemporaryFile(suffix='.csv') as file:
yield file
@pytest.yield_fixture()
def json_tmpfile():
with tempfile.NamedTemporaryFile(suffix='.json') as file:
yield file
| 20.27027 | 61 | 0.741333 | 90 | 750 | 5.888889 | 0.322222 | 0.075472 | 0.120755 | 0.158491 | 0.44717 | 0.203774 | 0.203774 | 0.203774 | 0 | 0 | 0 | 0.001608 | 0.170667 | 750 | 36 | 62 | 20.833333 | 0.850482 | 0.04 | 0 | 0.333333 | 0 | 0 | 0.018131 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0.333333 | 0 | 0.5 | 0.041667 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
3fee0ed4741d260aa2433e2e4a58f461d9191d0f | 250 | py | Python | reader/cashData/config.py | sifarone/gce_k8s_deployment | f596e17b9d0263ae24c61ebba9925af4719b4306 | [
"MIT"
] | null | null | null | reader/cashData/config.py | sifarone/gce_k8s_deployment | f596e17b9d0263ae24c61ebba9925af4719b4306 | [
"MIT"
] | null | null | null | reader/cashData/config.py | sifarone/gce_k8s_deployment | f596e17b9d0263ae24c61ebba9925af4719b4306 | [
"MIT"
] | 1 | 2021-01-24T17:07:37.000Z | 2021-01-24T17:07:37.000Z | import os
DB_HOST = os.environ['MONGODB_HOST']
DB_PORT = int(os.environ['MONGODB_PORT'])
REDIS_HOST = os.environ['REDIS_HOST']
REDIS_PORT = int(os.environ['REDIS_PORT'])
DATABASE = 'MasterStockData_DB'
COLLECTION = 'StockBhavData_C'
| 22.727273 | 45 | 0.716 | 34 | 250 | 4.970588 | 0.411765 | 0.213018 | 0.153846 | 0.189349 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148 | 250 | 10 | 46 | 25 | 0.793427 | 0 | 0 | 0 | 0 | 0 | 0.308 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b20362291ca8a987f518f0af34f9be9a495ceece | 387 | py | Python | tic-tac-toe.py | morrow6698/per6_jake_pygame | 8ccc6f7a6c276a3a979effc82714a872c33d7a64 | [
"MIT"
] | null | null | null | tic-tac-toe.py | morrow6698/per6_jake_pygame | 8ccc6f7a6c276a3a979effc82714a872c33d7a64 | [
"MIT"
] | null | null | null | tic-tac-toe.py | morrow6698/per6_jake_pygame | 8ccc6f7a6c276a3a979effc82714a872c33d7a64 | [
"MIT"
] | null | null | null | from gpiozero import Button
button_right = Button(2)
button_left = Button(18)
button_down = Button(25)
button_up = Button(8)
while True:
if button_right.is_pressed:
print('turn right')
elif button_left.is_pressed:
print('turn left')
elif button_down.is_pressed:
print('turn down')
elif button_up.is_pressed:
print('turn up')
| 20.368421 | 32 | 0.656331 | 54 | 387 | 4.481481 | 0.37037 | 0.14876 | 0.231405 | 0.297521 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020619 | 0.248062 | 387 | 18 | 33 | 21.5 | 0.810997 | 0 | 0 | 0 | 0 | 0 | 0.090439 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.071429 | 0 | 0.071429 | 0.285714 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b745d539f4c5b6534ab2e03c9bc21fa2247fb5c9 | 3,585 | py | Python | tpch_schema.py | csruiliu/tpch-pyspark | ec707ddd8a5e917b08e0ee1ce320b826fa6aa977 | [
"MIT"
] | null | null | null | tpch_schema.py | csruiliu/tpch-pyspark | ec707ddd8a5e917b08e0ee1ce320b826fa6aa977 | [
"MIT"
] | null | null | null | tpch_schema.py | csruiliu/tpch-pyspark | ec707ddd8a5e917b08e0ee1ce320b826fa6aa977 | [
"MIT"
] | null | null | null | from pyspark.sql.types import (
StructType,
StructField,
IntegerType,
DoubleType,
StringType,
DateType
)
schema_part = StructType([
StructField("P_PARTKEY", IntegerType(), nullable=False),
StructField("P_NAME", StringType(), True),
StructField("P_MFGR", StringType(), True),
StructField("P_BRAND", StringType(), True),
StructField("P_TYPE", StringType(), True),
StructField("P_SIZE", IntegerType(), True),
StructField("P_CONTAINER", StringType(), True),
StructField("P_RETAILPRICE", DoubleType(), True),
StructField("P_COMMENT", StringType(), True)
])
schema_supplier = StructType([
StructField("S_SUPPKEY", IntegerType(), nullable=False),
StructField("S_NAME", StringType(), True),
StructField("S_ADDRESS", StringType(), True),
StructField("S_NATIONKEY", IntegerType(), False),
StructField("S_PHONE", StringType(), True),
StructField("S_ACCTBAL", DoubleType(), True),
StructField("S_COMMENT", StringType(), True)
])
schema_partsupp = StructType([
StructField("PS_PARTKEY", IntegerType(), nullable=False),
StructField("PS_SUPPKEY", IntegerType(), False),
StructField("PS_AVAILQTY", IntegerType(), True),
StructField("PS_SUPPLYCOST", DoubleType(), True),
StructField("PS_COMMENT", StringType(), True)
])
schema_customer = StructType([
StructField("C_CUSTKEY", IntegerType(), nullable=False),
StructField("C_NAME", StringType(), True),
StructField("C_ADDRESS", StringType(), True),
StructField("C_NATIONKEY", IntegerType(), False),
StructField("C_PHONE", StringType(), True),
StructField("C_ACCTBAL", DoubleType(), True),
StructField("C_MKTSEGMENT", StringType(), True),
StructField("C_COMMENT", StringType(), True),
])
schema_orders = StructType([
StructField("O_ORDERKEY", IntegerType(), nullable=False),
StructField("O_CUSTKEY", IntegerType(), False),
StructField("O_ORDERSTATUS", StringType(), True),
StructField("O_TOTALPRICE", DoubleType(), True),
StructField("O_ORDERDATE", DateType(), True),
StructField("O_ORDERPRIORITY", StringType(), True),
StructField("O_CLERK", StringType(), True),
StructField("O_SHIPPRIORITY", IntegerType(), True),
StructField("O_COMMENT", StringType(), True)
])
schema_lineitem = StructType([
StructField("L_ORDERKEY", IntegerType(), nullable=False),
StructField("L_PARTKEY", IntegerType(), False),
StructField("L_SUPPKEY", IntegerType(), False),
StructField("L_LINENUMBER", IntegerType(), True),
StructField("L_QUANTITY", DoubleType(), True),
StructField("L_EXTENDEDPRICE", DoubleType(), True),
StructField("L_DISCOUNT", DoubleType(), True),
StructField("L_TAX", DoubleType(), True),
StructField("L_RETURNFLAG", StringType(), True),
StructField("L_LINESTATUS", StringType(), True),
StructField("L_SHIPDATE", DateType(), True),
StructField("L_COMMITDATE", DateType(), True),
StructField("L_RECEIPTDATE", DateType(), True),
StructField("L_SHIPINSTRUCT", StringType(), True),
StructField("L_SHIPMODE", StringType(), True),
StructField("L_COMMENT", StringType(), True)
])
schema_nation = StructType([
StructField("N_NATIONKEY", IntegerType(), nullable=False),
StructField("N_NAME", StringType(), True),
StructField("N_REGIONKEY", IntegerType(), False),
StructField("N_COMMENT", StringType(), True)
])
schema_region = StructType([
StructField("R_REGIONKEY", IntegerType(), nullable=False),
StructField("R_NAME", StringType(), True),
StructField("R_COMMENT", StringType(), True)
])
| 38.138298 | 62 | 0.692887 | 348 | 3,585 | 6.939655 | 0.198276 | 0.236025 | 0.217391 | 0.115942 | 0.070393 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.140028 | 3,585 | 93 | 63 | 38.548387 | 0.783328 | 0 | 0 | 0.094118 | 0 | 0 | 0.16569 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.011765 | 0 | 0.011765 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b757eaa546afe33d54f93dda4c485ef4fef1bc35 | 2,270 | py | Python | opentok/exceptions.py | Nyceane/fitstream-jetson-nano | cd4fe9210670669dd683912f1f7ac1539037726d | [
"Apache-2.0"
] | null | null | null | opentok/exceptions.py | Nyceane/fitstream-jetson-nano | cd4fe9210670669dd683912f1f7ac1539037726d | [
"Apache-2.0"
] | null | null | null | opentok/exceptions.py | Nyceane/fitstream-jetson-nano | cd4fe9210670669dd683912f1f7ac1539037726d | [
"Apache-2.0"
] | null | null | null | class OpenTokException(Exception):
"""Defines exceptions thrown by the OpenTok SDK.
"""
pass
class RequestError(OpenTokException):
"""Indicates an error during the request. Most likely an error connecting
to the OpenTok API servers. (HTTP 500 error).
"""
pass
class AuthError(OpenTokException):
"""Indicates that the problem was likely with credentials. Check your API
key and API secret and try again.
"""
pass
class NotFoundError(OpenTokException):
"""Indicates that the element requested was not found. Check the parameters
of the request.
"""
pass
class ArchiveError(OpenTokException):
"""Indicates that there was a archive specific problem, probably the status
of the requested archive is invalid.
"""
pass
class SignalingError(OpenTokException):
"""Indicates that there was a signaling specific problem, one of the parameter
is invalid or the type|data string doesn't have a correct size"""
pass
class GetStreamError(OpenTokException):
"""Indicates that the data in the request is invalid, or the session_id or stream_id
are invalid"""
pass
class ForceDisconnectError(OpenTokException):
"""
Indicates that there was a force disconnect specific problem:
One of the arguments is invalid or the client specified by the connectionId property
is not connected to the session
"""
pass
class SipDialError(OpenTokException):
"""
Indicates that there was a SIP dial specific problem:
The Session ID passed in is invalid or you attempt to start a SIP call for a session
that does not use the OpenTok Media Router.
"""
pass
class SetStreamClassError(OpenTokException):
"""
Indicates that there is invalid data in the JSON request.
It may also indicate that invalid layout options have been passed
"""
pass
class BroadcastError(OpenTokException):
"""
Indicates that data in your request data is invalid JSON. It may also indicate
that you passed in invalid layout options. Or you have exceeded the limit of five
simultaneous RTMP streams for an OpenTok session. Or you specified and invalid resolution.
Or The broadcast has already started for the session
"""
pass
| 30.266667 | 94 | 0.722467 | 298 | 2,270 | 5.496644 | 0.389262 | 0.054945 | 0.159341 | 0.103785 | 0.14652 | 0.092796 | 0 | 0 | 0 | 0 | 0 | 0.001702 | 0.223348 | 2,270 | 74 | 95 | 30.675676 | 0.927396 | 0.659031 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
b75ad2e27170c0b1a1e1510df71b596ff7b274d9 | 414 | py | Python | meregistro/apps/titulos/forms/CohorteEstablecimientoConfirmarForm.py | MERegistro/meregistro | 6cde3cab2bd1a8e3084fa38147de377d229391e3 | [
"BSD-3-Clause"
] | null | null | null | meregistro/apps/titulos/forms/CohorteEstablecimientoConfirmarForm.py | MERegistro/meregistro | 6cde3cab2bd1a8e3084fa38147de377d229391e3 | [
"BSD-3-Clause"
] | null | null | null | meregistro/apps/titulos/forms/CohorteEstablecimientoConfirmarForm.py | MERegistro/meregistro | 6cde3cab2bd1a8e3084fa38147de377d229391e3 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from django.forms import ModelForm
from django.core.exceptions import ValidationError
from django import forms
from apps.titulos.models import CohorteEstablecimiento
class CohorteEstablecimientoConfirmarForm(forms.ModelForm):
inscriptos = forms.IntegerField(required=True, min_value=1)
class Meta:
model = CohorteEstablecimiento
exclude = ('establecimiento', 'cohorte', 'estado')
| 27.6 | 60 | 0.794686 | 44 | 414 | 7.454545 | 0.681818 | 0.091463 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00545 | 0.113527 | 414 | 14 | 61 | 29.571429 | 0.888283 | 0.050725 | 0 | 0 | 0 | 0 | 0.071795 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
b75cd134e448826440db10faa22e25ff9e9a908f | 718 | py | Python | python/eclockhw.py | timboldt/epaper-display | c11076846cc7ed8251e08766c842b520254c8a89 | [
"Apache-2.0"
] | 1 | 2020-07-27T16:29:26.000Z | 2020-07-27T16:29:26.000Z | python/eclockhw.py | timboldt/epaper-display | c11076846cc7ed8251e08766c842b520254c8a89 | [
"Apache-2.0"
] | null | null | null | python/eclockhw.py | timboldt/epaper-display | c11076846cc7ed8251e08766c842b520254c8a89 | [
"Apache-2.0"
] | null | null | null |
import analogio
from digitalio import DigitalInOut, Direction
import time
class Battery():
def __init__(self, pin):
self._adc = analogio.AnalogIn(pin)
def voltage(self):
return self._adc.value * 3.3 / 65536.0 * 2.0
class PowerSwitch():
def __init__(self, pin):
self._done = DigitalInOut(pin)
self._done.direction = Direction.OUTPUT
self._done.value = False
def turn_off(self):
# TPL5111 triggers on rising edge.
self._done.value = True
time.sleep(0.5)
# Will normally not reach this point.
# Repeat the signal, if necessary
self._done.value = False
time.sleep(0.5)
self._done.value = True
| 25.642857 | 52 | 0.623955 | 92 | 718 | 4.684783 | 0.51087 | 0.111369 | 0.12065 | 0.064965 | 0.083527 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034884 | 0.281337 | 718 | 27 | 53 | 26.592593 | 0.800388 | 0.139276 | 0 | 0.421053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.210526 | false | 0 | 0.157895 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
b75f0ab4bf06e713c0674b69ea9ad131a749a4a6 | 712 | py | Python | context/identifier.py | frapa/gala | cfaba6dd3966d26715dd84101d451ff96ff37c0a | [
"MIT"
] | 1 | 2018-07-22T16:19:29.000Z | 2018-07-22T16:19:29.000Z | context/identifier.py | frapa/gala | cfaba6dd3966d26715dd84101d451ff96ff37c0a | [
"MIT"
] | null | null | null | context/identifier.py | frapa/gala | cfaba6dd3966d26715dd84101d451ff96ff37c0a | [
"MIT"
] | null | null | null | from code_object import *
class Identifier(CodeObject):
def __init__(self, parent, expr):
super(Identifier, self).__init__(parent)
self.identifier = expr if type(expr) is str else "".join(expr.children)
def get_fully_qualified_name(self):
return self.identifier
def add_to_scope(self):
self.get_scope().add(self, self.get_parent())
def add_to_parent_scope(self):
self.get_scope().get_parent_scope().add(self, self.get_parent())
def to_c(self):
return "{id}".format(id=self.identifier)
def __repr__(self):
return "ID: {id}".format(id=self.identifier)
def __str__(self):
return '`{id}`'.format(id=self.identifier) | 27.384615 | 79 | 0.658708 | 97 | 712 | 4.505155 | 0.329897 | 0.160183 | 0.100687 | 0.09611 | 0.437071 | 0.352403 | 0.283753 | 0 | 0 | 0 | 0 | 0 | 0.205056 | 712 | 26 | 80 | 27.384615 | 0.772085 | 0 | 0 | 0 | 0 | 0 | 0.025245 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.411765 | false | 0 | 0.058824 | 0.235294 | 0.764706 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
b76cfdeb970cf383a02911cf1268a2f8536a12ae | 4,434 | py | Python | ingest/importer/conversion/metadata_entity.py | ebi-ait/ingest-client | d5654ab50c5f7357d5b08bcc6eae22633176b11e | [
"Apache-2.0"
] | null | null | null | ingest/importer/conversion/metadata_entity.py | ebi-ait/ingest-client | d5654ab50c5f7357d5b08bcc6eae22633176b11e | [
"Apache-2.0"
] | 15 | 2020-10-06T08:15:34.000Z | 2022-03-24T18:31:04.000Z | ingest/importer/conversion/metadata_entity.py | ebi-ait/ingest-client | d5654ab50c5f7357d5b08bcc6eae22633176b11e | [
"Apache-2.0"
] | null | null | null | import copy
from ingest.importer.data_node import DataNode
from ingest.importer.spreadsheet.ingest_worksheet import IngestRow
TYPE_UNDEFINED = 'undefined'
class MetadataEntity:
# TODO enforce definition of concrete and domain types for all MetadataEntity
# It's only currently done this way to minimise friction with other parts of the system
def __init__(self, concrete_type=TYPE_UNDEFINED, domain_type=TYPE_UNDEFINED, object_id=None,
content={}, links={}, external_links={}, linking_details={}, row: IngestRow = None,
is_reference=False, is_linking_reference=False, is_module=False):
self._concrete_type = concrete_type
self._domain_type = domain_type
self.object_id = object_id
self._content = DataNode(defaults=copy.deepcopy(content))
self._links = copy.deepcopy(links)
self._external_links = copy.deepcopy(external_links)
self._linking_details = DataNode(defaults=copy.deepcopy(linking_details))
self._spreadsheet_location = {
'row_index': row.index,
'worksheet_title': row.worksheet_title,
} if row else None
self._is_reference = is_reference
self._is_linking_reference = is_linking_reference
self._is_module = is_module
@property
def concrete_type(self):
return self._concrete_type
@property
def domain_type(self):
return self._domain_type
@property
def content(self):
return copy.deepcopy(self._content)
def get_content(self, content_property):
return self._content[content_property]
def define_content(self, content_property, value):
self._content[content_property] = value
def define_linking_detail(self, link_property, value):
self._linking_details[link_property] = value
@property
def linking_details(self):
return self._linking_details.as_dict()
def get_linking_detail(self, link_property):
return self._linking_details[link_property]
@property
def links(self):
return copy.deepcopy(self._links)
def get_links(self, link_entity_type):
return self._links.get(link_entity_type)
def add_links(self, link_entity_type, new_links):
self._do_add_links(self._links, link_entity_type, new_links)
@property
def is_reference(self):
return self._is_reference
@property
def is_linking_reference(self):
return self._is_linking_reference
@property
def is_module(self):
return self._is_module
@property
def external_links(self):
return copy.deepcopy(self._external_links)
def get_external_links(self, link_entity_type):
return self._external_links.get(link_entity_type)
def add_external_links(self, link_entity_type, new_links):
self._do_add_links(self._external_links, link_entity_type, new_links)
@staticmethod
def _do_add_links(link_map, link_entity_type, new_links):
existent_links = link_map.get(link_entity_type)
if existent_links is None:
existent_links = []
link_map[link_entity_type] = existent_links
existent_links.extend(new_links)
def retain_fields(self, *allowed_fields):
removed_fields = []
for key in self._content.keys():
if key not in allowed_fields:
removed_fields.append({'key': key, 'value': self._content[key]})
self._content.remove_field(key)
return removed_fields
def add_module_entity(self, module_entity):
for field, value in module_entity.content.as_dict().items():
module_list = self._content[field]
if not module_list:
module_list = []
self._content[field] = module_list
module_list.append(value)
def get_spreadsheet_location(self):
return self._spreadsheet_location
def map_for_submission(self):
return {
'is_reference': self.is_reference,
'is_linking_reference': self._is_linking_reference,
'concrete_type': self.concrete_type,
'content': self._content.as_dict(),
'links_by_entity': self.links,
'external_links_by_entity': self.external_links,
'linking_details': self.linking_details,
'spreadsheet_location': self._spreadsheet_location
}
| 34.372093 | 100 | 0.682679 | 539 | 4,434 | 5.239332 | 0.176252 | 0.046742 | 0.054533 | 0.030099 | 0.26983 | 0.166431 | 0.077904 | 0.034703 | 0.034703 | 0.034703 | 0 | 0 | 0.236807 | 4,434 | 128 | 101 | 34.640625 | 0.834515 | 0.03631 | 0 | 0.090909 | 0 | 0 | 0.03911 | 0.005621 | 0 | 0 | 0 | 0.007813 | 0 | 1 | 0.232323 | false | 0 | 0.030303 | 0.151515 | 0.434343 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
b77146176cb2acc137a2b04338016091bff2c3e4 | 2,157 | py | Python | ros/src/twist_controller/twist_controller.py | yangchengtest/UdaCity_Car_Final | 5ea4bf01c08e37506a329cad5ff3598911c95121 | [
"MIT"
] | null | null | null | ros/src/twist_controller/twist_controller.py | yangchengtest/UdaCity_Car_Final | 5ea4bf01c08e37506a329cad5ff3598911c95121 | [
"MIT"
] | null | null | null | ros/src/twist_controller/twist_controller.py | yangchengtest/UdaCity_Car_Final | 5ea4bf01c08e37506a329cad5ff3598911c95121 | [
"MIT"
] | null | null | null | import rospy
from pid import PID
from lowpass import LowPassFilter
from yaw_controller import YawController
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, cp):
self.cp = cp
self.yaw_controller = YawController(
wheel_base=cp.wheel_base,
steer_ratio=cp.steer_ratio,
min_speed=cp.min_speed,
max_lat_accel=cp.max_lat_accel,
max_steer_angle=cp.max_steer_angle)
self.cp = cp
self.pid = PID(kp=5, ki=0.5, kd=0.5, mn=cp.decel_limit, mx=cp.accel_limit)
#self.vel_lpf = LowPassFilter(tau=0.5, ts=0.02)
self.s_lpf = LowPassFilter(tau=3, ts=1)
self.t_lpf = LowPassFilter(tau=3, ts=1)
self.last_time = 0
def reset(self):
self.pid.reset()
def control(self,linear_vel, angular_vel, current_vel,dbw_enabled):
# TODO: Change the arg, kwarg list to suit your needs
# Return throttle, brake, steer
if not dbw_enabled:
self.reset()
return 0, 0, 0
else:
#current_vel = self.vel_lpf.filt(current_vel)
vel_err = linear_vel - current_vel
steering = self.yaw_controller.get_steering(linear_vel, angular_vel, current_vel)
steering = self.s_lpf.filt(steering)
current_time = rospy.get_time()
sample_time = current_time - self.last_time
acceleration = self.pid.step(vel_err, sample_time)
acceleration = self.t_lpf.filt(acceleration)
if acceleration > 0.0:
throttle = acceleration
brake = 0.0
else:
throttle = 0.0
deceleration = -acceleration
if deceleration < self.cp.brake_deadband:
deceleration = 0.0
deceleration = min(deceleration, -self.cp.decel_limit)
brake = deceleration * (
self.cp.vehicle_mass + self.cp.fuel_capacity * GAS_DENSITY) * self.cp.wheel_radius
# Return throttle, brake, steer
return throttle, brake, steering
| 32.681818 | 110 | 0.594808 | 273 | 2,157 | 4.483516 | 0.326007 | 0.039216 | 0.046569 | 0.019608 | 0.121732 | 0.091503 | 0.044118 | 0 | 0 | 0 | 0 | 0.024557 | 0.320352 | 2,157 | 65 | 111 | 33.184615 | 0.810368 | 0.093649 | 0 | 0.086957 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015385 | 0 | 1 | 0.065217 | false | 0.065217 | 0.086957 | 0 | 0.217391 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
b77629fce1bae42b53bd84d5708f518bb9a86807 | 672 | py | Python | composeml/tests/test_label_plots.py | anhuaxiang/compose | edf674401fb39e0eefe5f5ea533d8be153f2c01d | [
"BSD-3-Clause"
] | 1 | 2019-10-28T05:23:49.000Z | 2019-10-28T05:23:49.000Z | composeml/tests/test_label_plots.py | anhuaxiang/compose | edf674401fb39e0eefe5f5ea533d8be153f2c01d | [
"BSD-3-Clause"
] | null | null | null | composeml/tests/test_label_plots.py | anhuaxiang/compose | edf674401fb39e0eefe5f5ea533d8be153f2c01d | [
"BSD-3-Clause"
] | null | null | null | def test_count_by_time_categorical(total_spent):
labels = range(2)
total_spent = total_spent.bin(2, labels=labels)
ax = total_spent.plot.count_by_time()
assert ax.get_title() == 'Label Count vs. Cutoff Times'
def test_count_by_time_continuous(total_spent):
ax = total_spent.plot.count_by_time()
assert ax.get_title() == 'Label vs. Cutoff Times'
def test_distribution_categorical(total_spent):
ax = total_spent.bin(2, labels=range(2))
ax = ax.plot.dist()
assert ax.get_title() == 'Label Distribution'
def test_distribution_continuous(total_spent):
ax = total_spent.plot.dist()
assert ax.get_title() == 'Label Distribution'
| 30.545455 | 59 | 0.724702 | 99 | 672 | 4.616162 | 0.242424 | 0.218818 | 0.09628 | 0.140044 | 0.768053 | 0.503282 | 0.503282 | 0.389497 | 0.210066 | 0.210066 | 0 | 0.007067 | 0.157738 | 672 | 21 | 60 | 32 | 0.800353 | 0 | 0 | 0.266667 | 0 | 0 | 0.127976 | 0 | 0 | 0 | 0 | 0 | 0.266667 | 1 | 0.266667 | false | 0 | 0 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b779e0f00ef49e5774fa8bc4c713405cd586d6b6 | 28,874 | py | Python | ion/services/coi/test/test_resource_registry_service.py | ooici/coi-services | 43246f46a82e597345507afd7dfc7373cb346afa | [
"BSD-2-Clause"
] | 3 | 2016-09-20T09:50:06.000Z | 2018-08-10T01:41:38.000Z | ion/services/coi/test/test_resource_registry_service.py | ooici/coi-services | 43246f46a82e597345507afd7dfc7373cb346afa | [
"BSD-2-Clause"
] | null | null | null | ion/services/coi/test/test_resource_registry_service.py | ooici/coi-services | 43246f46a82e597345507afd7dfc7373cb346afa | [
"BSD-2-Clause"
] | 2 | 2016-03-16T22:25:49.000Z | 2016-11-26T14:54:21.000Z | #!/usr/bin/env python
__author__ = 'Michael Meisinger, Thomas Lennan, Stephen Henrie'
import unittest, simplejson
from nose.plugins.attrib import attr
from pyon.core.exception import BadRequest, Conflict, NotFound, Inconsistent
from pyon.public import IonObject, PRED, RT, LCS, LCE, AS, iex, log, OT
from pyon.ion.resource import lcstate
from pyon.util.int_test import IonIntegrationTestCase
from interface.objects import Attachment, AttachmentType, Resource, DataProcess, Transform, ProcessDefinition
from interface.services.coi.iresource_registry_service import ResourceRegistryServiceClient
@attr('INT', group='coi')
class TestResourceRegistry(IonIntegrationTestCase):
def setUp(self):
# Start container
self._start_container()
self.container.start_rel_from_url('res/deploy/r2deploy.yml')
# Now create client to bank service
self.resource_registry_service = ResourceRegistryServiceClient()
@unittest.skip('Represents a bug in storage/retrieval')
def test_tuple_in_dict(self):
# create a resource with a tuple saved in a dict
transform_obj = IonObject(RT.Transform)
transform_obj.configuration = {}
transform_obj.configuration["tuple"] = ('STRING',)
transform_id, _ = self.resource_registry_service.create(transform_obj)
# read the resource back
returned_transform_obj = self.resource_registry_service.read(transform_id)
self.assertEqual(transform_obj.configuration["tuple"], returned_transform_obj.configuration["tuple"])
def test_basics(self):
# Sequence all the tests so that we can save numerous system start and stops
self._do_test_crud()
self._do_test_read_mult()
self._do_test_lifecycle()
self._do_test_attach()
self._do_test_association()
self._do_test_find_resources()
self._do_test_find_objects_mult()
def _do_test_crud(self):
# Some quick registry tests
# Can't call new with fields that aren't defined in the object's schema
with self.assertRaises(TypeError) as cm:
IonObject("UserInfo", name="name", foo="bar")
self.assertTrue(cm.exception.message == "__init__() got an unexpected keyword argument 'foo'")
# TODO: This error is different than with other methods of initialization - CHANGE
# Can't call new with fields that aren't defined in the object's schema
with self.assertRaises(AttributeError) as cm:
IonObject("UserInfo", {"name": "name", "foo": "bar"})
self.assertIn("object has no attribute 'foo'", cm.exception.message)
# Can't call new with fields that aren't defined in the object's schema
with self.assertRaises(TypeError) as cm:
IonObject("UserInfo", {"name": "name"}, foo="bar")
self.assertTrue(cm.exception.message == "__init__() got an unexpected keyword argument 'foo'")
# Instantiate an object
obj = IonObject("UserInfo", name="name")
# # Can set attributes that aren't in the object's schema
# with self.assertRaises(AttributeError) as cm:
# setattr(obj, "foo", "bar")
# self.assertTrue(cm.exception.message == "'UserInfo' object has no attribute 'foo'")
# Cam't call update with object that hasn't been persisted
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.update(obj)
self.assertTrue(cm.exception.message.startswith("Object does not have required '_id' or '_rev' attribute"))
# Persist object and read it back
obj_id, obj_rev = self.resource_registry_service.create(obj)
read_obj = self.resource_registry_service.read(obj_id)
# Cannot create object with _id and _rev fields pre-set
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.create(read_obj)
# Update object
read_obj.name = "John Doe"
self.resource_registry_service.update(read_obj)
# Update should fail with revision mismatch
with self.assertRaises(Conflict) as cm:
self.resource_registry_service.update(read_obj)
# Re-read and update object
read_obj = self.resource_registry_service.read(obj_id)
self.resource_registry_service.update(read_obj)
# Delete object
self.resource_registry_service.delete(obj_id)
# Make sure read, update and delete report error
with self.assertRaises(NotFound) as cm:
self.resource_registry_service.read(obj_id)
self.assertTrue(cm.exception.message.startswith("Object with id"))
with self.assertRaises(NotFound) as cm:
self.resource_registry_service.update(read_obj)
self.assertTrue(cm.exception.message.startswith("Object with id"))
with self.assertRaises(NotFound) as cm:
self.resource_registry_service.delete(obj_id)
self.assertTrue(cm.exception.message.startswith("Object with id"))
# Owner creation tests
user = IonObject("ActorIdentity", name='user')
uid,_ = self.resource_registry_service.create(user)
inst = IonObject("InstrumentDevice", name='instrument')
iid,_ = self.resource_registry_service.create(inst, headers={'ion-actor-id':str(uid)})
ids,_ = self.resource_registry_service.find_objects(iid, PRED.hasOwner, RT.ActorIdentity, id_only=True)
self.assertEquals(len(ids), 1)
assoc = self.resource_registry_service.read(ids[0])
self.resource_registry_service.delete(iid)
with self.assertRaises(NotFound) as ex:
assoc = self.resource_registry_service.read(iid)
def _do_test_read_mult(self):
test_resource1_id,_ = self.resource_registry_service.create(Resource(name='test1'))
test_resource2_id,_ = self.resource_registry_service.create(Resource(name='test2'))
res_list = [test_resource1_id, test_resource2_id]
objects = self.resource_registry_service.read_mult(res_list)
for o in objects:
self.assertIsInstance(o,Resource)
self.assertTrue(o._id in res_list)
def _do_test_lifecycle(self):
# Lifecycle tests
att = IonObject("InstrumentDevice", name='mine', description='desc')
rid,rev = self.resource_registry_service.create(att)
att1 = self.resource_registry_service.read(rid)
self.assertEquals(att1.name, att.name)
self.assertEquals(att1.lcstate, LCS.DRAFT)
self.assertEquals(att1.availability, AS.PRIVATE)
new_state = self.resource_registry_service.execute_lifecycle_transition(rid, LCE.PLAN)
self.assertEquals(new_state, lcstate(LCS.PLANNED, AS.PRIVATE))
att2 = self.resource_registry_service.read(rid)
self.assertEquals(att2.lcstate, LCS.PLANNED)
self.assertEquals(att2.availability, AS.PRIVATE)
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.execute_lifecycle_transition(rid, LCE.UNANNOUNCE)
self.assertIn("has no transition for event unannounce", cm.exception.message)
new_state = self.resource_registry_service.execute_lifecycle_transition(rid, LCE.DEVELOP)
self.assertEquals(new_state, lcstate(LCS.DEVELOPED, AS.PRIVATE))
with self.assertRaises(BadRequest):
self.resource_registry_service.execute_lifecycle_transition(
resource_id=rid, transition_event='NONE##')
self.resource_registry_service.set_lifecycle_state(rid, lcstate(LCS.INTEGRATED, AS.PRIVATE))
att1 = self.resource_registry_service.read(rid)
self.assertEquals(att1.lcstate, LCS.INTEGRATED)
self.assertEquals(att1.availability, AS.PRIVATE)
def _do_test_attach(self):
binary = "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x03\x00\x00\x00(-\x0fS\x00\x00\x00\x03sBIT\x08\x08\x08\xdb\xe1O\xe0\x00\x00\x00~PLTEf3\x00\xfc\xf7\xe0\xee\xcc\x00\xd3\xa0\x00\xcc\x99\x00\xec\xcdc\x9fl\x00\xdd\xb2\x00\xff\xff\xff|I\x00\xf9\xdb\x00\xdd\xb5\x19\xd9\xad\x10\xb6\x83\x00\xf8\xd6\x00\xf2\xc5\x00\xd8\xab\x00n;\x00\xff\xcc\x00\xd6\xa4\t\xeb\xb8\x00\x83Q\x00\xadz\x00\xff\xde\x00\xff\xd6\x00\xd6\xa3\x00\xdf\xaf\x00\xde\xad\x10\xbc\x8e\x00\xec\xbe\x00\xec\xd4d\xff\xe3\x00tA\x00\xf6\xc4\x00\xf6\xce\x00\xa5u\x00\xde\xa5\x00\xf7\xbd\x00\xd6\xad\x08\xdd\xaf\x19\x8cR\x00\xea\xb7\x00\xee\xe9\xdf\xc5\x00\x00\x00\tpHYs\x00\x00\n\xf0\x00\x00\n\xf0\x01B\xac4\x98\x00\x00\x00\x1ctEXtSoftware\x00Adobe Fireworks CS4\x06\xb2\xd3\xa0\x00\x00\x00\x15tEXtCreation Time\x0029/4/09Oq\xfdE\x00\x00\x00\xadIDAT\x18\x95M\x8f\x8d\x0e\x820\x0c\x84;ZdC~f\x07\xb2\x11D\x86\x89\xe8\xfb\xbf\xa0+h\xe2\x97\\\xd2^\x93\xb6\x07:1\x9f)q\x9e\xa5\x06\xad\xd5\x13\x8b\xac,\xb3\x02\x9d\x12C\xa1-\xef;M\x08*\x19\xce\x0e?\x1a\xeb4\xcc\xd4\x0c\x831\x87V\xca\xa1\x1a\xd3\x08@\xe4\xbd\xb7\x15P;\xc8\xd4{\x91\xbf\x11\x90\xffg\xdd\x8di\xfa\xb6\x0bs2Z\xff\xe8yg2\xdc\x11T\x96\xc7\x05\xa5\xef\x96+\xa7\xa59E\xae\xe1\x84cm^1\xa6\xb3\xda\x85\xc8\xd8/\x17se\x0eN^'\x8c\xc7\x8e\x88\xa8\xf6p\x8e\xc2;\xc6.\xd0\x11.\x91o\x12\x7f\xcb\xa5\xfe\x00\x89]\x10:\xf5\x00\x0e\xbf\x00\x00\x00\x00IEND\xaeB`\x82"
# Owner creation tests
instrument = IonObject("InstrumentDevice", name='instrument')
iid,_ = self.resource_registry_service.create(instrument)
att = Attachment(content=binary, attachment_type=AttachmentType.BLOB)
aid1 = self.resource_registry_service.create_attachment(iid, att)
att1 = self.resource_registry_service.read_attachment(aid1, include_content=True)
self.assertEquals(binary, att1.content)
import base64
att = Attachment(content=base64.encodestring(binary), attachment_type=AttachmentType.ASCII)
aid2 = self.resource_registry_service.create_attachment(iid, att)
att1 = self.resource_registry_service.read_attachment(aid2, include_content=True)
self.assertEquals(binary, base64.decodestring(att1.content))
att_ids = self.resource_registry_service.find_attachments(iid, id_only=True)
self.assertEquals(att_ids, [aid1, aid2])
att_ids = self.resource_registry_service.find_attachments(iid, id_only=True, descending=True)
self.assertEquals(att_ids, [aid2, aid1])
att_ids = self.resource_registry_service.find_attachments(iid, id_only=True, descending=True, limit=1)
self.assertEquals(att_ids, [aid2])
atts = self.resource_registry_service.find_attachments(iid, id_only=False, include_content=True, limit=1)
self.assertEquals(atts[0].content, binary)
self.resource_registry_service.delete_attachment(aid1)
att_ids = self.resource_registry_service.find_attachments(iid, id_only=True)
self.assertEquals(att_ids, [aid2])
self.resource_registry_service.delete_attachment(aid2)
att_ids = self.resource_registry_service.find_attachments(iid, id_only=True)
self.assertEquals(att_ids, [])
def _do_test_association(self):
# Instantiate ActorIdentity object
actor_identity_obj = IonObject("ActorIdentity", name="name")
actor_identity_obj_id, actor_identity_obj_rev = self.resource_registry_service.create(actor_identity_obj)
read_actor_identity_obj = self.resource_registry_service.read(actor_identity_obj_id)
# Instantiate UserInfo object
user_info_obj = IonObject("UserInfo", name="name")
user_info_obj_id, user_info_obj_rev = self.resource_registry_service.create(user_info_obj)
read_user_info_obj = self.resource_registry_service.read(user_info_obj_id)
# Test create failures
with self.assertRaises(AttributeError) as cm:
self.resource_registry_service.create_association(actor_identity_obj_id, PRED.bogus, user_info_obj_id)
self.assertTrue(cm.exception.message == "bogus")
# Predicate not provided
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.create_association(actor_identity_obj_id, None, user_info_obj_id)
self.assertTrue(cm.exception.message == "Association must have all elements set")
# Subject id or object not provided
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.create_association(None, PRED.hasInfo, user_info_obj_id)
self.assertTrue(cm.exception.message == "Association must have all elements set")
# Object id or object not provided
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.create_association(actor_identity_obj_id, PRED.hasInfo, None)
self.assertTrue(cm.exception.message == "Association must have all elements set")
# Bad subject id
with self.assertRaises(NotFound) as cm:
self.resource_registry_service.create_association("bogus", PRED.hasInfo, user_info_obj_id)
self.assertTrue(cm.exception.message == "Object with id bogus does not exist.")
# Bad object id
with self.assertRaises(NotFound) as cm:
self.resource_registry_service.create_association(actor_identity_obj_id, PRED.hasInfo, "bogus")
self.assertTrue(cm.exception.message == "Object with id bogus does not exist.")
# _id missing from subject
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.create_association(actor_identity_obj, PRED.hasInfo, user_info_obj_id)
self.assertTrue(cm.exception.message.startswith("Subject id"))
# _id missing from object
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.create_association(actor_identity_obj_id, PRED.hasInfo, user_info_obj)
self.assertTrue(cm.exception.message.startswith("Object id"))
# Wrong subject type
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.create_association(user_info_obj_id, PRED.hasInfo, user_info_obj_id)
self.assertTrue(cm.exception.message == "Illegal subject type UserInfo for predicate hasInfo")
# Wrong object type
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.create_association(actor_identity_obj_id, PRED.hasInfo, actor_identity_obj_id)
self.assertTrue(cm.exception.message == "Illegal object type ActorIdentity for predicate hasInfo")
# Create two different association types between the same subject and predicate
assoc_id1, assoc_rev1 = self.resource_registry_service.create_association(actor_identity_obj_id, PRED.hasInfo, user_info_obj_id)
# Read object, subject
res_obj1 = self.resource_registry_service.read_object(actor_identity_obj_id, PRED.hasInfo, RT.UserInfo)
self.assertEquals(res_obj1._id, user_info_obj_id)
res_obj1 = self.resource_registry_service.read_object(actor_identity_obj_id, PRED.hasInfo, RT.UserInfo, id_only=True)
self.assertEquals(res_obj1, user_info_obj_id)
res_obj2 = self.resource_registry_service.read_subject(RT.ActorIdentity, PRED.hasInfo, user_info_obj_id)
self.assertEquals(res_obj2._id, actor_identity_obj_id)
res_obj2 = self.resource_registry_service.read_subject(RT.ActorIdentity, PRED.hasInfo, user_info_obj_id, id_only=True)
self.assertEquals(res_obj2, actor_identity_obj_id)
# Search for associations (good cases)
ret1 = self.resource_registry_service.find_associations(actor_identity_obj_id, PRED.hasInfo, user_info_obj_id)
ret2 = self.resource_registry_service.find_associations(actor_identity_obj_id, PRED.hasInfo)
ret3 = self.resource_registry_service.find_associations(None, PRED.hasInfo)
self.assertTrue(len(ret1) == len(ret2) == len(ret3))
self.assertTrue(ret1[0]._id == ret2[0]._id == ret3[0]._id)
ret1 = self.resource_registry_service.find_associations(actor_identity_obj_id, PRED.hasInfo, user_info_obj_id, None, False)
ret2 = self.resource_registry_service.find_associations(actor_identity_obj_id, PRED.hasInfo, id_only=False)
ret3 = self.resource_registry_service.find_associations(predicate=PRED.hasInfo, id_only=False)
self.assertTrue(ret1 == ret2 == ret3)
# Search for associations (good cases)
ret1 = self.resource_registry_service.find_associations(read_actor_identity_obj, PRED.hasInfo, read_user_info_obj)
ret2 = self.resource_registry_service.find_associations(read_actor_identity_obj, PRED.hasInfo)
ret3 = self.resource_registry_service.find_associations(None, PRED.hasInfo)
self.assertTrue(len(ret1) == len(ret2) == len(ret3))
self.assertTrue(ret1[0]._id == ret2[0]._id == ret3[0]._id)
ret1 = self.resource_registry_service.find_associations(actor_identity_obj_id, PRED.hasInfo, read_user_info_obj, None, True)
ret2 = self.resource_registry_service.find_associations(actor_identity_obj_id, PRED.hasInfo, id_only=True)
ret3 = self.resource_registry_service.find_associations(predicate=PRED.hasInfo, id_only=True)
self.assertTrue(ret1 == ret2 == ret3)
# Search for associations (bad cases)
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.find_associations(None, None, None)
self.assertIn("Illegal parameters", cm.exception.message)
# Find subjects (good cases)
subj_ret1 = self.resource_registry_service.find_subjects(RT.ActorIdentity, PRED.hasInfo, user_info_obj_id, True)
subj_ret2 = self.resource_registry_service.find_subjects(RT.ActorIdentity, PRED.hasInfo, read_user_info_obj, True)
self.assertTrue(len(subj_ret1) == len(subj_ret2))
self.assertTrue(subj_ret1[0] == subj_ret2[0])
self.assertTrue(subj_ret1[1][0]._id == subj_ret2[1][0]._id)
subj_ret3 = self.resource_registry_service.find_subjects(None, PRED.hasInfo, user_info_obj_id, True)
subj_ret4 = self.resource_registry_service.find_subjects(None, None, read_user_info_obj, True)
self.assertTrue(len(subj_ret3) == len(subj_ret4))
self.assertTrue(subj_ret3[0] == subj_ret4[0])
self.assertTrue(subj_ret3[1][0]._id == subj_ret4[1][0]._id)
subj_ret5 = self.resource_registry_service.find_subjects(None, PRED.hasInfo, user_info_obj_id, False)
subj_ret6 = self.resource_registry_service.find_subjects(None, None, read_user_info_obj, False)
self.assertTrue(len(subj_ret5) == len(subj_ret6))
self.assertTrue(subj_ret5[0][0]._id == subj_ret6[0][0]._id)
self.assertTrue(subj_ret5[1][0]._id == subj_ret6[1][0]._id)
# Find subjects (bad cases)
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.find_subjects(None, None, None)
self.assertTrue(cm.exception.message == "Must provide object")
with self.assertRaises(AttributeError) as cm:
self.resource_registry_service.find_subjects(RT.UserCredentials, PRED.bogus, user_info_obj_id, True)
self.assertTrue(cm.exception.message == "bogus")
ret = self.resource_registry_service.find_subjects(RT.UserInfo, PRED.hasCredentials, user_info_obj_id, True)
self.assertTrue(len(ret[0]) == 0)
ret = self.resource_registry_service.find_subjects(RT.UserCredentials, PRED.hasInfo, user_info_obj_id, True)
self.assertTrue(len(ret[0]) == 0)
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.find_subjects(RT.UserCredentials, PRED.hasInfo, user_info_obj, True)
self.assertTrue(cm.exception.message == "Object id not available in object")
# Find objects (good cases)
subj_ret1 = self.resource_registry_service.find_objects(actor_identity_obj_id, PRED.hasInfo, RT.UserInfo, True)
subj_ret2 = self.resource_registry_service.find_objects(read_actor_identity_obj, PRED.hasInfo, RT.UserInfo, True)
self.assertTrue(len(subj_ret1) == len(subj_ret2))
self.assertTrue(subj_ret1[0] == subj_ret2[0])
self.assertTrue(subj_ret1[1][0]._id == subj_ret2[1][0]._id)
subj_ret3 = self.resource_registry_service.find_objects(actor_identity_obj_id, PRED.hasInfo, None, True)
subj_ret4 = self.resource_registry_service.find_objects(actor_identity_obj_id, None, None, True)
self.assertTrue(len(subj_ret3) == len(subj_ret4))
self.assertTrue(subj_ret3[0] == subj_ret4[0])
self.assertTrue(subj_ret3[1][0]._id == subj_ret4[1][0]._id)
subj_ret5 = self.resource_registry_service.find_objects(actor_identity_obj_id, PRED.hasInfo, None, False)
subj_ret6 = self.resource_registry_service.find_objects(read_actor_identity_obj, None, None, False)
self.assertTrue(len(subj_ret5) == len(subj_ret6))
self.assertTrue(subj_ret5[0][0]._id == subj_ret6[0][0]._id)
self.assertTrue(subj_ret5[1][0]._id == subj_ret6[1][0]._id)
# Find objects (bad cases)
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.find_objects(None, None, None)
self.assertTrue(cm.exception.message == "Must provide subject")
with self.assertRaises(AttributeError) as cm:
self.resource_registry_service.find_objects(actor_identity_obj_id, PRED.bogus, RT.UserCredentials, True)
self.assertTrue(cm.exception.message == "bogus")
ret = self.resource_registry_service.find_objects(actor_identity_obj_id, PRED.hasCredentials, RT.ActorIdentity, True)
self.assertTrue(len(ret[0]) == 0)
ret = self.resource_registry_service.find_objects(actor_identity_obj_id, PRED.hasInfo, RT.UserCredentials, True)
self.assertTrue(len(ret[0]) == 0)
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.find_objects(actor_identity_obj, PRED.hasInfo, RT.UserInfo, True)
self.assertTrue(cm.exception.message == "Object id not available in subject")
# Get association (bad cases)
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.get_association(None, None, None)
self.assertIn("Illegal parameters", cm.exception.message)
assoc = self.resource_registry_service.get_association(actor_identity_obj_id, PRED.hasInfo, user_info_obj_id)
self.assertTrue(assoc._id == assoc_id1)
# Delete (bad cases)
with self.assertRaises(NotFound) as cm:
self.resource_registry_service.delete_association("bogus")
self.assertTrue(cm.exception.message == "Object with id bogus does not exist.")
# Delete other association
self.resource_registry_service.delete_association(assoc_id1)
# Delete resources
self.resource_registry_service.delete(actor_identity_obj_id)
self.resource_registry_service.delete(user_info_obj_id)
def _do_test_find_resources(self):
with self.assertRaises(BadRequest) as cm:
self.resource_registry_service.find_resources(RT.UserInfo, LCS.DRAFT, "name", False)
self.assertTrue(cm.exception.message == "find by name does not support lcstate")
ret = self.resource_registry_service.find_resources(RT.UserInfo, None, "name", False)
self.assertEquals(len(ret[0]), 0)
# Instantiate an object
obj = IonObject("InstrumentAgentInstance", name="name")
# Persist object and read it back
obj_id, obj_rev = self.resource_registry_service.create(obj)
read_obj = self.resource_registry_service.read(obj_id)
ret = self.resource_registry_service.find_resources(RT.InstrumentAgentInstance, None, "name", False)
self.assertEquals(len(ret[0]), 1)
self.assertEquals(ret[0][0]._id, read_obj._id)
ret = self.resource_registry_service.find_resources(RT.InstrumentAgentInstance, LCS.DEPLOYED, None, False)
self.assertEquals(len(ret[0]), 1)
self.assertEquals(ret[0][0]._id, read_obj._id)
def _do_test_find_objects_mult(self):
dp = DataProcess()
transform = Transform()
pd = ProcessDefinition()
dp_id, _ = self.resource_registry_service.create(dp)
transform_id, _ = self.resource_registry_service.create(transform)
pd_id, _ = self.resource_registry_service.create(pd)
self.resource_registry_service.create_association(subject=dp_id, object=transform_id, predicate=PRED.hasTransform)
self.resource_registry_service.create_association(subject=transform_id, object=pd_id, predicate=PRED.hasProcessDefinition)
results, _ = self.resource_registry_service.find_objects_mult(subjects=[dp_id],id_only=True)
self.assertTrue(results == [transform_id])
results, _ = self.resource_registry_service.find_objects_mult(subjects=[dp_id, transform_id], id_only=True)
results.sort()
correct = [transform_id, pd_id]
correct.sort()
self.assertTrue(results == correct)
@attr('EXT')
def test_get_resource_extension(self):
#Testing multiple instrument owners
subject1 = "/DC=org/DC=cilogon/C=US/O=ProtectNetwork/CN=Roger Unwin A254"
actor_identity_obj1 = IonObject(RT.ActorIdentity, {"name": subject1})
actor_id1,_ = self.resource_registry_service.create(actor_identity_obj1)
user_info_obj1 = IonObject(RT.UserInfo, {"name": "Foo"})
user_info_id1,_ = self.resource_registry_service.create(user_info_obj1)
self.resource_registry_service.create_association(actor_id1, PRED.hasInfo, user_info_id1)
subject2 = "/DC=org/DC=cilogon/C=US/O=ProtectNetwork/CN=Bob Cumbers A256"
actor_identity_obj2 = IonObject(RT.ActorIdentity, {"name": subject2})
actor_id2,_ = self.resource_registry_service.create(actor_identity_obj2)
user_info_obj2 = IonObject(RT.UserInfo, {"name": "Foo2"})
user_info_id2,_ = self.resource_registry_service.create(user_info_obj2)
self.resource_registry_service.create_association(actor_id2, PRED.hasInfo, user_info_id2)
test_obj = IonObject(RT.InformationResource, {"name": "TestResource"})
test_obj_id,_ = self.resource_registry_service.create(test_obj)
self.resource_registry_service.create_association(test_obj_id, PRED.hasOwner, actor_id1)
self.resource_registry_service.create_association(test_obj_id, PRED.hasOwner, actor_id2)
extended_resource = self.resource_registry_service.get_resource_extension(test_obj_id, OT.ExtendedInformationResource )
self.assertEqual(test_obj_id,extended_resource._id)
self.assertEqual(len(extended_resource.owners),2)
extended_resource_list = self.resource_registry_service.get_resource_extension(str([user_info_id1,user_info_id2]), OT.ExtendedInformationResource)
self.assertEqual(len(extended_resource_list), 2)
optional_args = {'user_id': user_info_id1}
extended_resource = self.resource_registry_service.get_resource_extension(test_obj_id, OT.TestExtendedInformationResource, optional_args=optional_args )
self.assertEqual(test_obj_id,extended_resource._id)
self.assertEqual(len(extended_resource.owners),2)
self.assertEqual(extended_resource.user_id, user_info_id1)
@attr('PREP')
def test_prepare_resource_support(self):
prepare_data = self.resource_registry_service.prepare_resource_support(resource_type=RT.StreamDefinition)
self.assertEqual(prepare_data.create_request.service_name, "resource_registry")
self.assertEqual(prepare_data.create_request.service_operation, "create")
self.assertEqual(prepare_data.create_request.request_parameters, { "object": "$(object)" })
self.assertEqual(prepare_data.update_request.service_name, "resource_registry")
self.assertEqual(prepare_data.update_request.service_operation, "update")
self.assertEqual(prepare_data.update_request.request_parameters, { "object": "$(object)" })
res_id,_ = self.resource_registry_service.create(prepare_data.resource)
prepare_data = self.resource_registry_service.prepare_resource_support(resource_type=RT.StreamDefinition, resource_id=res_id)
prepare_data.resource.name = "test_stream_def"
prepare_data.resource.stream_type = "test_type"
stream_def_id,_ = self.resource_registry_service.update(prepare_data.resource)
#def ion_object_encoder(obj):
# return obj.__dict__
#print simplejson.dumps(prepare_data, default=ion_object_encoder, indent=2)
stream_def = self.resource_registry_service.read(stream_def_id)
self.assertEqual(stream_def.name, prepare_data.resource.name)
self.assertEqual(stream_def.stream_type, prepare_data.resource.stream_type)
| 53.077206 | 1,405 | 0.724423 | 3,789 | 28,874 | 5.256004 | 0.137239 | 0.110871 | 0.13658 | 0.184384 | 0.698569 | 0.652523 | 0.591414 | 0.546724 | 0.510972 | 0.485865 | 0 | 0.025882 | 0.173028 | 28,874 | 543 | 1,406 | 53.174954 | 0.80815 | 0.069821 | 0 | 0.299419 | 0 | 0.008721 | 0.107516 | 0.056576 | 0 | 0 | 0 | 0.001842 | 0.392442 | 1 | 0.034884 | false | 0 | 0.026163 | 0 | 0.063953 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b77dc80830d938465ea57078ee0559b3fe1969c6 | 2,242 | py | Python | template.py | GrgDev/AdventOfCode | 70279cac889a5b47083d334d157fa615a77b2322 | [
"BSD-3-Clause"
] | null | null | null | template.py | GrgDev/AdventOfCode | 70279cac889a5b47083d334d157fa615a77b2322 | [
"BSD-3-Clause"
] | null | null | null | template.py | GrgDev/AdventOfCode | 70279cac889a5b47083d334d157fa615a77b2322 | [
"BSD-3-Clause"
] | null | null | null | import argparse
# This file is a template file for all of my Advent of Code 2020 puzzle solutions.
# The parse_args function here generally just parses for two things: input file and puzzle part.
# I believe every AOC puzzle comes in two parts and so sometimes requires two code paths.
# Sometimes it is easier to implement two different code solutions per part but this gives you
# the option of using the same code in case there's a lot of logic overlap between the two parts.
# There's usually a lot of overlap.
#
# -i or --input should be set to the full file path of the input file
# -p or --part should be set to either 1 or 2 to denote if this is for the first or second puzzle part
def parse_args(args=None):
parser = argparse.ArgumentParser()
parser.add_argument(
'-i', '--input',
type=open,
help='Input File',
required=True
)
parser.add_argument(
'-p', '--part',
type=int,
help='Puzzle Part',
required=True
)
return parser.parse_args(args)
# Just about every AOC puzzle gives you a large input file that you need to parse into some usable data structure.
# Do that here and return the collection of data structures to be handled by another function.
def parse_input(file_handler):
line_outputs = []
for line in file_handler:
pass # TODO: Put file parsing code here
return line_outputs
# This function is here to isolate and organize the puzzle solving logic after input parsing.
def solve_puzzle(parsed_contents, puzzle_part=1):
pass # TODO: Solve the rest of the fucking puzzle
def main(args=None):
parsed_args = parse_args(args)
input_handler = parsed_args.input
puzzle_part = parsed_args.part
parsed_input = parse_input(input_handler)
solve_puzzle(parsed_input, puzzle_part)
if __name__ == '__main__':
# See the parse_args() function comment at the top to understand the arg usage in the line below.
main("-i ./example_input.txt -p 1".split())
# Uncomment the line above if you want to run this code from the IDE and want to pass the args via code.
# Uncomment the line below instead if you want to run this code from the CLI and pass args there as well.
# main()
| 38 | 114 | 0.714541 | 363 | 2,242 | 4.316804 | 0.391185 | 0.03829 | 0.024888 | 0.025526 | 0.037013 | 0.037013 | 0.037013 | 0.037013 | 0.037013 | 0 | 0 | 0.004595 | 0.223461 | 2,242 | 58 | 115 | 38.655172 | 0.895462 | 0.597235 | 0 | 0.193548 | 0 | 0 | 0.082579 | 0 | 0 | 0 | 0 | 0.017241 | 0 | 1 | 0.129032 | false | 0.064516 | 0.032258 | 0 | 0.225806 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
b7a023d5132075a90c007f4d0794e0533b8836d2 | 113 | py | Python | hackerrank/30-days-of-code/day-5.py | vaishali-bariwal/Practice-Coding-Questions | 747bfcb1cb2be5340daa745f2b9938f0ee87c9ac | [
"Unlicense"
] | 25 | 2018-05-22T15:18:50.000Z | 2022-01-08T02:41:46.000Z | hackerrank/30-days-of-code/day-5.py | vaishali-bariwal/Practice-Coding-Questions | 747bfcb1cb2be5340daa745f2b9938f0ee87c9ac | [
"Unlicense"
] | 1 | 2019-05-24T16:55:27.000Z | 2019-05-24T16:55:27.000Z | hackerrank/30-days-of-code/day-5.py | vaishali-bariwal/Practice-Coding-Questions | 747bfcb1cb2be5340daa745f2b9938f0ee87c9ac | [
"Unlicense"
] | 18 | 2018-09-20T15:39:26.000Z | 2022-03-02T21:38:22.000Z | #!/bin/python3
import sys
n = int(input().strip())
for i in range(1,11):
print(n, "x", i, "=", n*i) | 14.125 | 30 | 0.504425 | 20 | 113 | 2.85 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047059 | 0.247788 | 113 | 8 | 30 | 14.125 | 0.623529 | 0.115044 | 0 | 0 | 0 | 0 | 0.021505 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b7a04e092d05bba2ae1209757c82024b9f7c9fc9 | 146 | py | Python | timecog/__init__.py | bitwalk/misc-cogs | 426a172b02c1b95bf0f64aa2ff21f6acc7754c89 | [
"MIT"
] | 5 | 2020-09-19T18:33:54.000Z | 2021-12-19T18:46:24.000Z | timecog/__init__.py | bitwalk/misc-cogs | 426a172b02c1b95bf0f64aa2ff21f6acc7754c89 | [
"MIT"
] | 99 | 2020-09-11T05:42:31.000Z | 2022-03-30T21:19:30.000Z | timecog/__init__.py | bitwalk/misc-cogs | 426a172b02c1b95bf0f64aa2ff21f6acc7754c89 | [
"MIT"
] | 11 | 2020-09-11T05:30:00.000Z | 2021-10-01T15:55:09.000Z | from .timecog import TimeCog
__red_end_user_data_statement__ = "Reminders are stored."
def setup(bot):
n = TimeCog(bot)
bot.add_cog(n)
| 16.222222 | 57 | 0.726027 | 22 | 146 | 4.409091 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178082 | 146 | 8 | 58 | 18.25 | 0.808333 | 0 | 0 | 0 | 0 | 0 | 0.143836 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b7a24b1c2460a16c4ad5fcb152e2eab823ad83c9 | 15,039 | py | Python | ChuanHang/Spider_ChuanH_demo.py | penetest/AirPCrawler | 89a2a2f3f66d6693ba492fa79a47953057aaf888 | [
"MIT"
] | 3 | 2017-07-05T06:15:59.000Z | 2020-04-07T13:07:05.000Z | ChuanHang/Spider_ChuanH_demo.py | penetest/AirPCrawler | 89a2a2f3f66d6693ba492fa79a47953057aaf888 | [
"MIT"
] | null | null | null | ChuanHang/Spider_ChuanH_demo.py | penetest/AirPCrawler | 89a2a2f3f66d6693ba492fa79a47953057aaf888 | [
"MIT"
] | 3 | 2017-07-18T02:51:54.000Z | 2020-05-03T16:53:21.000Z | #! coding:utf-8
import requests
import sys
from bs4 import BeautifulSoup
import csv
import urllib
import json
import time,datetime
import re
#from adsl import Adsl
import codecs
reload(sys)
sys.setdefaultencoding('utf8')
h1 = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding':'gzip, deflate, sdch',
'Accept-Language':'zh-CN,zh;q=0.8',
#Cookie:Webtrends=111.160.254.58.1464136223732083; BIGipServerpool_sc_122.119.122.51=830109562.20480.0000; JSESSIONID=0000M2suWXhIhzAP_5BzKDkE78S:1a5jgnqlj; OZ_1U_671=vid=v744f3c10a3ea8.0&ctime=1464140663<ime=1464140662; OZ_1Y_671=erefer=-&eurl=http%3A//sc.travelsky.com/scet/queryAv.do%3Flan%3Dcn%26countrytype%3D0%26travelType%3D0%26cityNameOrg%3D%25E5%258C%2597%25E4%25BA%25AC%26cityCodeOrg%3DPEK%26cityNameDes%3D%25E5%258E%25A6%25E9%2597%25A8%26cityCodeDes%3DXMN%26takeoffDate%3D2016-05-28%26returnDate%3D2016-05-28%26cabinStage%3D0%26adultNum%3D1%26childNum%3D0&etime=1464139715&ctime=1464140663<ime=1464140662&compid=671
'Host':'www.scal.com.cn',
'Proxy-Connection':'keep-alive',
'Upgrade-Insecure-Requests':1,
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36'
}
#爬取数据
##from_h:出发地 to_h: 到达地 date_h: 出发时间,
def data_Crawling(from_h,to_h,date_h,i_orgcity, i_dstCity):
s = requests.Session()
data = '{"AirlineType":"Single","IsFixedCabin":false,"RouteList":[{"RouteIndex":1,"RouteName":"单 程","OrgCity":"'+from_h+'","DesCity":"'+to_h+'","OrgCityName":"'+i_orgcity+'","DesCityName":"'+i_dstCity+'","FlightDate":"'+date_h+'"}],"AVType":0}'
#data = urllib.urlencode(data)
data = urllib.quote(data)
data = 'http://www.scal.com.cn/Web/ETicket/AirlineList?AirlineParamJSON='+data
try:
resp = s.post(data,timeout=15)
url = re.search(r'arrPageValue.AirlineParamJSON = (.*?);',resp.text)
#print url.group(1)
data = json.loads( url.group(1))
#print(data)
data1 = re.search(r'arrPageValue.AirlineParamJSON = .*\[(.*?)\].*;',resp.text).group(1).replace("}","")
#data1 = str(data['RouteList'][0]).replace("}","")
data11 = data['AirlineType']
data1 += ',\"AirlineType\":\"'+data11+'\"'
data11 = data['AVType']
data1 += ',\"AVType\":'+str(data11)
data1 += ',\"CardFlag\":null'
data11 = data['Flag']
data1 += ',\"Flag\":null'
data11 = data['BuyerType']
data1 += ',\"BuyerType\":'+str(data11)
data11 = data['IsFixedCabin']
data1 += ',\"IsFixedCabin\":'+str(data11).lower()
data11 = data['PassKey']
data1 += ',\"PassKey\":\"'+data11+'\"}'
data1 = json.loads(data1)
resp1 = s.post('http://www.scal.com.cn/Web/ETicket/GetSingleChina',json=data1)
return resp1.text,resp1.status_code
except requests.exceptions.ReadTimeout:
return -1,-1
except requests.exceptions.ConnectionError:
return -2,-2
except AttributeError:
#print resp.text
return -1,-1
# 解析数据
def data_analyze(loaddata,filename,i_orgcity, i_dstCity):
# 采用BeautifulSoup解析网页
writer = csv.writer(codecs.open(filename, "a"), dialect='excel')
# soup = BeautifulSoup(loaddata.decode('utf-8'), "html.parser")
# info = soup.find_all("table",class_="__cabin_table__")
# loaddata = json.loads(loaddata)
#print loaddata
loaddata=json.loads( loaddata["AirlineListJSON"])
DesCity = loaddata['DesCity']
#DesCityName = loaddata['DesCityName']
DesCityName =i_orgcity
OrgCity = loaddata['OrgCity']
#OrgCityName = loaddata['OrgCityName']
OrgCityName = i_dstCity
FlightDateText = loaddata['FlightDateText']
headinfo = DesCity+","+DesCityName+","+OrgCity+","+OrgCityName+","+FlightDateText
#print len(loaddata['SRI_FlightList'])
allpriceinfo = loaddata['SRI_FlightList']
for price in allpriceinfo:
#print price
FlightNo = price["FlightNo"]
PlaneModel = price["PlaneModel"]
PlaneModelName = price["PlaneModelName"]
TakeOffTimeShort = price["TakeOffTimeShort"]
ArriveTimeShort = price["ArriveTimeShort"]
TotalFlightTime = price["TotalFlightTime"]
AirTax = str(price["AirTax"])
#FlightCS = price["FlightCS"]
info = headinfo+","+FlightNo+","+PlaneModel+","+PlaneModelName+","+TakeOffTimeShort+","+ArriveTimeShort+","+TotalFlightTime+","+AirTax
CabinModel = price["CabinModel"]
CabinRebate = CabinModel['CabinRebate']
SellCode = CabinModel['SellCode']
SaleRuleParam = CabinModel['SaleRuleParam']
RealPriceText = str(CabinModel['RealPriceText'])
CabinNO = CabinModel['CabinNO']
OldPrice = str(CabinModel['OldPrice'])
CheckINAndMeal = CabinModel['CheckINAndMeal']
FareBasis = CabinModel['FareBasis']
NewPrice = str(CabinModel['NewPrice'])
OperateTypePrice = CabinModel['OperateTypePrice']
RealPrice = str(CabinModel['RealPrice'])
CabinRuleDescription = str(CabinModel['CabinRuleDescription']).replace(",",";")
CabinName = CabinModel['CabinName']
info1= info+ ","+CabinRebate+","+SellCode+","+SaleRuleParam+","+RealPriceText+","+CabinNO+","+OldPrice+","+CheckINAndMeal+","+FareBasis+","+NewPrice+","+OperateTypePrice+","+RealPrice+","+CabinRuleDescription+","+CabinName
writer.writerow([info1])
SRI_CabinList = price["SRI_CabinList"]
for CabinModel in SRI_CabinList:
CabinRebate = CabinModel['CabinRebate']
SellCode = CabinModel['SellCode']
SaleRuleParam = CabinModel['SaleRuleParam']
RealPriceText = str(CabinModel['RealPriceText'])
CabinNO = CabinModel['CabinNO']
OldPrice = str(CabinModel['OldPrice'])
CheckINAndMeal = CabinModel['CheckINAndMeal']
FareBasis = CabinModel['FareBasis']
NewPrice = str(CabinModel['NewPrice'])
OperateTypePrice = CabinModel['OperateTypePrice']
RealPrice = str(CabinModel['RealPrice'])
CabinRuleDescription = str(CabinModel['CabinRuleDescription']).replace(",",";")
CabinName = CabinModel['CabinName']
info2 = info+","+CabinRebate+","+SellCode+","+SaleRuleParam+","+RealPriceText+","+CabinNO+","+OldPrice+","+CheckINAndMeal+","+FareBasis+","+NewPrice+","+OperateTypePrice+","+RealPrice+","+CabinRuleDescription+","+CabinName
writer.writerow([info2])
#print loaddata["DefaultCabinRuleForCH"]
def city_to_code(i_orgcity,i_dstCity):
#设置是否找到代码
str_szm="WUS,CJU,HND,NRT,ZQZ,TLV,MFM,AKU,ALA,AAT,AMS,AAQ,TSE,AKA,AQG,AKL,MCO,ORL,BAR,BWI,BAK,CDG,DPS,BCN,PER,BAV,BSD,BHY,PEK,AEB,FRU,BOS,PDX,BUD,BHK,BNE,BRU,CZX,CHG,CTU,CIF,OKA,DRW,KIX,DLU,DLC,DAT,DQA,DXB,DIG,DTW,DOY,DUS,DNH,YTO,DSN,ENH,ERL,FRA,PHL,FOC,FUG,KVD,CPH,CAN,KWE,KWL,HRB,HIA,HAK,HMI,HLD,HAM,HZG,HDG,HGH,HFE,HTN,HAN,HEL,HET,WAW,WAS,JGD,JXA,IEV,KUL,TNA,KGD,JMU,JGN,JJN,JZH,KHG,KRT,CAI,CBR,CGN,KJA,CLE,KRL,KMG,LXA,LAS,LHW,RDM,LYS,RIX,LIS,LJG,LLB,LYI,KOJ,LON,LAD,LAX,MAD,MLA,GDX,MNL,NZH,BKK,LUM,MXP,MOW,MEL,MDG,MUC,KHN,NKG,NNG,NAO,NCE,NGB,NYC,PIT,HKT,NDG,JIQ,CIT,TAO,IQN,SYX,XMN,SWA,SHA,PVG,SZX,SHE,LED,SAN,SJW,SYM,STO,STR,ZRH,TCG,TAS,TPE,TYN,TVS,TCZ,TSN,THQ,TGO,TLQ,VAR,WEH,VCE,VIE,WEF,WNZ,WUA,ULN,HLH,URC,WUX,WUH,XIY,XNN,JHG,SEA,SYD,XIL,HKG,SIN,OVB,ACX,HOU,XUZ,YKS,ATL,YNT,ENY,YNJ,YNZ,SVX,IKT,YIN,YIH,INC,UYN,YCU,CTS,ZHA,DYG,CGQ,CSX,CIH,CGO,CHI,ZHY,CKG,ZUH,GVA,BKI,TYO,ADD,NBO,AUH,PUS,XNT,AOG,JNZ,LYA,NNY,IST,CCU,KOW,HTA,PO1,HAJ,ES1,DO1,DU1,DR1,BO1,MA1,BN1,HE1,HG1,CMB,BOM,KCA,BHX,ABJ,NUE,ODS,ROM,SFO,TRN,SCN,ATH,MEM,MAN,PHX,YVR,MLE,JIU,LYG,FLR,NTG,MIG,DEN,OAK,YYJ,BER,XFN,OSL,GOT,ZAG,BUH,PRG,CKY,MLW,DKR,FNA,FIH,BJL,YAO,TLS,BIO,PUW,GEG,ANC,EUG,SAC,SJC,BOI,PSC,YUL,ADL,WLG,KRY,DFW,YTY,JNG,MSO,RNO,MRS,SHP,BPE,NLT,YOW,ZYI,HJJ,MSP,HYN,BPL,YZY,HZH,IQM,YYC,MIA,YYT,YYG,YQM,YQT,YQB,YHZ,WNH,YIW,LZH,JUH,CGD,DDG,HEK,JDZ,JIL,KJI,LZO,MXZ,OHE,RLK,TEN,YBP,TXN,YIC,YIE,ZJO,LLV,JUZ,KHH,HEL,KHV,LYS,LCX,LPF,WDS"
str_cs_cn="武夷山|济州|东京羽田|东京成田|张家口|特拉维夫|澳门|阿克苏|阿拉木图|阿勒泰|阿姆斯特丹|阿纳帕|阿斯塔纳|安康|安庆|奥克兰(新西兰)|奥兰多|奥兰多赫恩登|博鳌|巴尔蒂摩|巴库|巴黎|巴厘岛|巴塞罗那|柏斯|包头|保山|北海|北京|百色|比什凯克|波士顿|波特兰|布达佩斯|布哈拉|布里斯本|布鲁塞尔|常州|朝阳|成都|赤峰|冲绳|达尔文|大阪|大理|大连|大同|大庆|迪拜|迪庆|底特律|东营|杜塞尔多夫|敦煌|多伦多|鄂尔多斯|恩施|二连浩特|法兰克福|费城|福州|阜阳|甘贾|哥本哈根|广州|贵阳|桂林|哈尔滨|淮安|海口|哈密|海拉尔|汉堡|汉中|邯郸|杭州|合肥|和田|河内|赫尔辛基|呼和浩特|华沙|华盛顿|加格达奇|鸡西|基辅|吉隆坡|济南|加里宁格勒|佳木斯|嘉峪关|泉州|九寨沟|喀什|喀土穆|开罗|堪培拉|科隆|克拉斯诺亚尔斯克|克利夫兰|库尔勒|昆明|拉萨|拉斯维加斯|兰州|雷德蒙德|里昂|里加|里斯本|丽江|荔波|临沂|鹿儿岛|伦敦|罗安达|洛杉矶|马德里|马尔他|马加丹|马尼拉|满洲里|曼谷|芒市|米兰|莫斯科|墨尔本|牡丹江|慕尼黑|南昌|南京|南宁|南充|尼斯|宁波|纽约|匹兹堡|普吉|齐齐哈尔|黔江|奇姆肯特|青岛|庆阳|三亚|厦门|揭阳|上海虹桥|上海浦东|深圳|沈阳|圣彼得堡|圣地亚哥|石家庄|思茅|斯德哥尔摩|斯图加特|苏黎世|塔城|塔什干|台北桃园|太原|唐山|腾冲|天津|天水|通辽|吐鲁番|瓦纳|威海|威尼斯|维也纳|潍坊|温州|乌海|乌兰巴托|乌兰浩特|乌鲁木齐|无锡|武汉|西安|西宁|西双版纳|西雅图|悉尼|锡林浩特|香港|新加坡|新西伯利亚|兴义|休斯顿|徐州|雅库茨克|亚特兰大|烟台|延安|延吉|盐城|叶卡捷琳堡|伊尔库茨克|伊宁|宜昌|银川|榆林|运城|札幌|湛江|张家界|长春|长沙|长治|郑州|芝加哥|中卫|重庆|珠海|日内瓦|沙巴|东京|亚的斯亚贝巴|内罗毕|阿布扎比|釜山|邢台|鞍山|锦州|洛阳|南阳|伊斯坦布尔|加尔各答|赣州|赤塔|波茨坦|汉诺威|埃森|多特蒙德|杜伊斯堡|德累斯顿|波鸿|曼海姆|波恩|海德堡|哈根|科伦坡|孟买|库车|伯明翰|阿比让|纽伦堡|奥德萨|罗马|旧金山|都灵|萨尔布吕肯|雅典|孟菲斯|曼彻斯特|菲尼克斯|温哥华|马累|九江|连云港|佛罗伦萨|南通|绵阳|丹佛|奥克兰(美国)|维多利亚|柏林|襄阳|奥斯陆|哥德堡|萨格勒布|布加勒斯特|布拉格|科纳克里|蒙罗维亚|达喀尔|弗里敦|金沙萨|班珠尔|雅温得|图卢兹|毕尔巴鄂|普尔曼|斯波坎|安克雷奇|尤金|萨克拉门托|圣何塞|博伊西|帕斯科|蒙特利尔|阿德莱德|惠灵顿|克拉玛依|达拉斯|扬州|济宁|米苏拉|雷诺|马赛|秦皇岛(山海关)|秦皇岛(北戴河)|那拉提|渥太华|遵义|怀化|明尼阿波利斯|台州|博乐|张掖|黎平|且末|卡尔加里|迈阿密|圣约翰斯|夏洛特|蒙克顿|雷湾|魁北克|哈利法克斯|文山|义乌|柳州|九华山|常德|丹东|黑河|景德镇|吉林|喀纳斯|泸州|梅州|漠河|巴彦淖尔|铜仁|宜宾|黄山|宜春|阿尔山|张家口|吕梁|衢州|高雄|赫尔辛基|哈巴罗夫斯克|里昂|龙岩|六盘水|十堰"
list_szm = str_szm.split(',')
list_cs_cn = str_cs_cn.split('|')
try:
oflag = list_cs_cn.index(i_orgcity)
except ValueError:
print "对不起,不支持该出发地"
return -1,-1
try:
dflag = list_cs_cn.index(i_dstCity)
except ValueError:
print "对不起,不支持该目的地"
return -1,-1
return (list_szm[oflag],list_szm[dflag])
#往返城市
def swap_o_d(i_dstCity, i_orgcity, i_startDate):
# 出发城市代码
# orgcity = "PEK"
# 到达城市代码
# dstCity = "CGO"
# 将城市名转换成城市代码
(orgcity, dstCity) = city_to_code(i_orgcity, i_dstCity)
if(orgcity == -1 or dstCity == -1):
return -1
# 出发日期,格式为:2016-05-15
startDate = i_startDate
# 保存数据文件名
currdatatime = datetime.datetime.now().strftime('%Y-%m-%d')
filename = "ChuanH-"+currdatatime+"-"+ startDate + ".csv"
print "正在抓取和解析数据..."
for n in range(9):
loaddata, status_code = data_Crawling(orgcity, dstCity, startDate,i_orgcity, i_dstCity)
#超时异常处理,若是超时将等待6分钟
if( loaddata == -1 or status_code == -1 ):
print "请求超时,下次请求将在5s后进行,请耐心等待..."
# aa = Adsl()
# aa.reconnect()
time.sleep(5)
continue
elif( loaddata == -2 or status_code == -2 ):
print "连接中断,下次请求将在5s后进行,请耐心等待..."
# aa = Adsl()
# aa.reconnect()
time.sleep(5)
continue
try:
loaddata = json.loads(loaddata)
flag = loaddata['Result']
except ValueError:
#print loaddata
print '页面抓取失败..,尝试重新抓取'
# aa = Adsl()
# aa.reconnect()
time.sleep(5)
continue
except TypeError:
#print loaddata
print '页面抓取失败..,尝试重新抓取'
# aa = Adsl()
# aa.reconnect()
time.sleep(5)
continue
#print loaddata
if (flag == True):
IsDirect = loaddata['IsDirect']
if(IsDirect == True):
break
else:
return 0
else:
return 0
# if (flag):
# return 0
# else:
# print("抓取失败,3s后尝试第%d次抓取数据....." % n)
# #print loaddata,status_code
# time.sleep(3)
if (n >= 8):
print "抓取失败次数在太多了,无能为力..."
#fairleCount = fairleCount+1
return -1
# fp = open("data2.html",'w')
# fp.write(loaddata)
# fp.close()
# fpr = open("data2.html")
# loaddata = fpr.read()
# fpr.close()
data_analyze(loaddata, filename,i_orgcity, i_dstCity)
# data_analyze(loaddata,"PEK-CAN2016-05-20.csv")
#主函数
def main():
list_o_d = [('广州','上海浦东'),
('广州','上海虹桥'),
('上海浦东','厦门'),
('上海虹桥','厦门'),
('成都','深圳'),
('重庆','深圳'),
('杭州','深圳'),
('长沙','北京'),
('长沙','上海浦东'),
('长沙','上海虹桥'),
('喀什','乌鲁木齐'),
('成都','拉萨'),
('郑州','昆明'),
('贵阳','北京'),
('兰州','北京'),
('成都','杭州'),
('贵阳','深圳'),
('银川','北京'),
('昆明','丽江'),
('成都','南京'),
('重庆','西安'),
('重庆','长沙'),
('阿克苏','乌鲁木齐'),
('南昌','上海虹桥'),
('南昌','上海浦东'),
('武汉','厦门'),
('成都','长沙'),
('北京','珠海'),
('海拉尔','北京'),
('成都','丽江'),
('上海虹桥','揭阳'),
('杭州','贵阳'),
('重庆','济南'),
('杭州','厦门'),
('成都','青岛'),
('重庆','乌鲁木齐'),
('济南','西安'),
('西双版纳','丽江'),
('广州','义乌'),
('天津','西安'),
('杭州','天津'),
('广州','长春'),
('成都','兰州'),
('南昌','昆明'),
('广州','揭阳'),
('广州','桂林'),
('郑州','贵阳'),
('成都','石家庄'),
('大庆','北京'),
('贵阳','南京'),
('重庆','贵阳'),
('沈阳','深圳'),
('武夷山','厦门')]
days = [3,7,14,20]
for day in days:
i_startDate = (datetime.datetime.now()+datetime.timedelta(days=day)).strftime('%Y-%m-%d')
for data in list_o_d:
i_orgcity = data[0]
i_dstCity = data[1]
#i_startDate = "2016-05-29"
print "目前采集的数据信息为(往来航班):", i_orgcity,i_dstCity,i_startDate
flag1 = swap_o_d(i_dstCity, i_orgcity, i_startDate)
if(flag1 == 0):
print "查询当日无航班!或无直达航班"
continue
elif(flag1 == -1):
continue
else:
print '*********往,结束*********'
#半中场休息
time.sleep(3)
flag2 = swap_o_d(i_orgcity, i_dstCity, i_startDate)
if(flag2 == 0):
print "查询当日无航班!或无直达航班"
continue
elif(flag2 == -1):
continue
else:
print '*********来,结束*********'
#中场休息
time.sleep(3)
print "任务完成"
if __name__ == "__main__":
main()
# ( loaddata,code)= data_Crawling('PEK','CAN','2016-06-28')
# print loaddata
# with open("chuanhang.json",'w') as fp:
# json.dump(loaddata,fp)
# with open("chuanhang.json",'r') as fpr:
# loaddata = json.load(fpr)
# data_analyze(loaddata,"shanh.csv") | 46.131902 | 1,409 | 0.577499 | 1,927 | 15,039 | 4.448884 | 0.548521 | 0.013064 | 0.010498 | 0.014931 | 0.224892 | 0.221626 | 0.208328 | 0.185699 | 0.175668 | 0.168203 | 0 | 0.035938 | 0.235853 | 15,039 | 326 | 1,410 | 46.131902 | 0.710059 | 0.136911 | 0 | 0.260331 | 0 | 0.020661 | 0.358764 | 0.237627 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.008264 | 0.03719 | null | null | 0.057851 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b7a5f27206cda89a33864aa98d4dc4361e87c87d | 512 | py | Python | tech_project/lib/python2.7/site-packages/connected_accounts/forms.py | priyamshah112/Project-Descripton-Blog | 8e01016c6be79776c4f5ca75563fa3daa839e39e | [
"MIT"
] | 36 | 2015-06-01T12:42:56.000Z | 2020-02-13T21:06:20.000Z | tech_project/lib/python2.7/site-packages/connected_accounts/forms.py | priyamshah112/Project-Descripton-Blog | 8e01016c6be79776c4f5ca75563fa3daa839e39e | [
"MIT"
] | 4 | 2015-12-14T13:33:38.000Z | 2017-01-31T12:22:58.000Z | tech_project/lib/python2.7/site-packages/connected_accounts/forms.py | priyamshah112/Project-Descripton-Blog | 8e01016c6be79776c4f5ca75563fa3daa839e39e | [
"MIT"
] | 7 | 2015-12-14T11:14:41.000Z | 2020-05-21T08:25:28.000Z | from django import forms
from django.contrib.admin.widgets import AdminRadioSelect
from django.utils.translation import ugettext_lazy as _
from .provider_pool import providers
class AccountCreationForm(forms.Form):
provider = forms.ChoiceField(
label=_('Provider'),
choices=sorted(providers.as_choices(enabled_only=True), key=lambda provider: provider[1]),
widget=AdminRadioSelect(attrs={'class': 'radiolist'}),
error_messages={'required': _('Please select a provider.')})
| 36.571429 | 98 | 0.746094 | 58 | 512 | 6.448276 | 0.655172 | 0.080214 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002283 | 0.144531 | 512 | 13 | 99 | 39.384615 | 0.851598 | 0 | 0 | 0 | 0 | 0 | 0.107422 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
b7b9125ca9c5a07b32c450a0b1a90e012b310580 | 4,797 | py | Python | test/validators/test_string_validator.py | jmmease/ipyplotly | 498b6ad362c5ffdb5106f8ab3566af68eb7076d9 | [
"MIT"
] | 8 | 2017-12-20T21:19:05.000Z | 2018-04-25T20:19:46.000Z | test/validators/test_string_validator.py | jonmmease/ipyplotly | 498b6ad362c5ffdb5106f8ab3566af68eb7076d9 | [
"MIT"
] | 11 | 2018-01-19T17:14:27.000Z | 2018-02-20T00:02:40.000Z | test/validators/test_string_validator.py | jonmmease/ipyplotly | 498b6ad362c5ffdb5106f8ab3566af68eb7076d9 | [
"MIT"
] | 1 | 2020-05-26T10:48:14.000Z | 2020-05-26T10:48:14.000Z | import pytest
from ipyplotly.basevalidators import StringValidator
import numpy as np
# Fixtures
# --------
@pytest.fixture()
def validator():
return StringValidator('prop', 'parent')
@pytest.fixture()
def validator_values():
return StringValidator('prop', 'parent', values=['foo', 'BAR', ''])
@pytest.fixture()
def validator_no_blanks():
return StringValidator('prop', 'parent', no_blank=True)
@pytest.fixture
def validator_aok():
return StringValidator('prop', 'parent', array_ok=True)
@pytest.fixture
def validator_aok_values():
return StringValidator('prop', 'parent', values=['foo', 'BAR', '', 'baz'], array_ok=True)
@pytest.fixture()
def validator_no_blanks_aok():
return StringValidator('prop', 'parent', no_blank=True, array_ok=True)
# Array not ok
# ------------
# ### Acceptance ###
@pytest.mark.parametrize('val',
['bar', 'HELLO!!!', 'world!@#$%^&*()', ''])
def test_acceptance(val, validator: StringValidator):
assert validator.validate_coerce(val) == val
# ### Rejection by value ###
@pytest.mark.parametrize('val',
[(), [], [1, 2, 3], set(), np.nan, np.pi])
def test_rejection(val, validator: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator.validate_coerce(val)
assert 'Invalid value' in str(validation_failure.value)
# Valid values
# ------------
@pytest.mark.parametrize('val',
['foo', 'BAR', ''])
def test_acceptance_values(val, validator_values: StringValidator):
assert validator_values.validate_coerce(val) == val
@pytest.mark.parametrize('val',
['FOO', 'bar', 'other', '1234'])
def test_rejection_values(val, validator_values: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_values.validate_coerce(val)
assert 'Invalid value'.format(val=val) in str(validation_failure.value)
assert "['foo', 'BAR', '']" in str(validation_failure.value)
# ### No blanks ###
@pytest.mark.parametrize('val',
['bar', 'HELLO!!!', 'world!@#$%^&*()'])
def test_acceptance_no_blanks(val, validator_no_blanks: StringValidator):
assert validator_no_blanks.validate_coerce(val) == val
@pytest.mark.parametrize('val',
[''])
def test_rejection_no_blanks(val, validator_no_blanks: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_no_blanks.validate_coerce(val)
assert 'A non-empty string' in str(validation_failure.value)
# Array ok
# --------
# ### Acceptance ###
@pytest.mark.parametrize('val',
['foo', 'BAR', '', 'baz'])
def test_acceptance_aok_scalars(val, validator_aok: StringValidator):
assert validator_aok.validate_coerce(val) == val
@pytest.mark.parametrize('val',
['foo', ['foo'], np.array(['BAR', ''], dtype='object'), ['baz', 'baz', 'baz']])
def test_acceptance_aok_list(val, validator_aok: StringValidator):
coerce_val = validator_aok.validate_coerce(val)
if isinstance(val, (list, np.ndarray)):
assert np.array_equal(coerce_val, np.array(val, dtype=coerce_val.dtype))
else:
assert coerce_val == val
# ### Rejection by type ###
@pytest.mark.parametrize('val',
[['foo', ()], ['foo', 3, 4], [3, 2, 1]])
def test_rejection_aok(val, validator_aok: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_aok.validate_coerce(val)
assert 'Invalid element(s)' in str(validation_failure.value)
# ### Rejection by value ###
@pytest.mark.parametrize('val',
[['foo', 'bar'], ['3', '4'], ['BAR', 'BAR', 'hello!']])
def test_rejection_aok_values(val, validator_aok_values: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_aok_values.validate_coerce(val)
assert 'Invalid element(s)' in str(validation_failure.value)
# ### No blanks ###
@pytest.mark.parametrize('val',
['123', ['bar', 'HELLO!!!'], ['world!@#$%^&*()']])
def test_acceptance_no_blanks_aok(val, validator_no_blanks_aok: StringValidator):
coerce_val = validator_no_blanks_aok.validate_coerce(val)
if isinstance(val, (list, np.ndarray)):
assert np.array_equal(coerce_val, np.array(val, dtype=coerce_val.dtype))
else:
assert coerce_val == val
@pytest.mark.parametrize('val',
['', ['foo', 'bar', ''], ['']])
def test_rejection_no_blanks_aok(val, validator_no_blanks_aok: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_no_blanks_aok.validate_coerce(val)
assert 'A non-empty string' in str(validation_failure.value)
| 32.194631 | 104 | 0.652074 | 554 | 4,797 | 5.440433 | 0.138989 | 0.059721 | 0.08361 | 0.095554 | 0.818182 | 0.714997 | 0.627405 | 0.521566 | 0.447246 | 0.355674 | 0 | 0.004349 | 0.185116 | 4,797 | 148 | 105 | 32.412162 | 0.766692 | 0.041276 | 0 | 0.4 | 0 | 0 | 0.086803 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.2 | false | 0 | 0.033333 | 0.066667 | 0.3 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b7ca55369c68c7f98a44e55abbd53821434fe77f | 381 | py | Python | output/models/nist_data/atomic/duration/schema_instance/nistschema_sv_iv_atomic_duration_enumeration_3_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/duration/schema_instance/nistschema_sv_iv_atomic_duration_enumeration_3_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/duration/schema_instance/nistschema_sv_iv_atomic_duration_enumeration_3_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.nist_data.atomic.duration.schema_instance.nistschema_sv_iv_atomic_duration_enumeration_3_xsd.nistschema_sv_iv_atomic_duration_enumeration_3 import (
NistschemaSvIvAtomicDurationEnumeration3,
NistschemaSvIvAtomicDurationEnumeration3Type,
)
__all__ = [
"NistschemaSvIvAtomicDurationEnumeration3",
"NistschemaSvIvAtomicDurationEnumeration3Type",
]
| 38.1 | 167 | 0.868766 | 30 | 381 | 10.4 | 0.633333 | 0.134615 | 0.089744 | 0.128205 | 0.25641 | 0.25641 | 0.25641 | 0 | 0 | 0 | 0 | 0.017094 | 0.07874 | 381 | 9 | 168 | 42.333333 | 0.871795 | 0 | 0 | 0 | 0 | 0 | 0.220472 | 0.220472 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
b7d967735ebd20c1a2c30b36c3ffce33abe5c5c4 | 354 | py | Python | django_web/core/models.py | YoungchanChang/ES_BERT_CHAT | 5dd919d3ba559ca9171ca73bd9e1052734f3060e | [
"Apache-2.0"
] | 1 | 2022-02-13T03:09:23.000Z | 2022-02-13T03:09:23.000Z | django_web/core/models.py | YoungchanChang/ES_BERT_CHAT | 5dd919d3ba559ca9171ca73bd9e1052734f3060e | [
"Apache-2.0"
] | null | null | null | django_web/core/models.py | YoungchanChang/ES_BERT_CHAT | 5dd919d3ba559ca9171ca73bd9e1052734f3060e | [
"Apache-2.0"
] | 1 | 2022-02-13T03:09:23.000Z | 2022-02-13T03:09:23.000Z | from django.db import models
from . import managers
# Create your models here.
class TimeStampedModel(models.Model):
""" TimeStampedModel Model Definition """
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
objects = managers.CustomModelManager()
class Meta:
abstract = True | 25.285714 | 53 | 0.731638 | 39 | 354 | 6.564103 | 0.615385 | 0.148438 | 0.179688 | 0.203125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183616 | 354 | 14 | 54 | 25.285714 | 0.885813 | 0.169492 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
b7dc283c1ade8eed20f39c9479f50b002991183f | 156 | py | Python | main.py | OConnellErin/CS261_Stacks | d1ad48c0b48e5b4d759c9e53b189f893e84c70a9 | [
"FSFAP"
] | null | null | null | main.py | OConnellErin/CS261_Stacks | d1ad48c0b48e5b4d759c9e53b189f893e84c70a9 | [
"FSFAP"
] | null | null | null | main.py | OConnellErin/CS261_Stacks | d1ad48c0b48e5b4d759c9e53b189f893e84c70a9 | [
"FSFAP"
] | null | null | null | # Stack Scratchpad
# Erin O'Connell
# Use this as a "scratchpad" to tinker with your stack.
from stack import Stack
# Example
ages = Stack()
print(ages)
| 14.181818 | 55 | 0.724359 | 24 | 156 | 4.708333 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.192308 | 156 | 10 | 56 | 15.6 | 0.896825 | 0.596154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
b7e96b5a857b94fdcceceaa4fff0005d750f8749 | 3,624 | py | Python | apps/xformmanager/management/commands/sync_schema.py | commtrack/commtrack-old-to-del | cc9c22754ac192a45483cef609bdcf09aa990340 | [
"BSD-3-Clause"
] | 1 | 2017-05-19T07:23:00.000Z | 2017-05-19T07:23:00.000Z | apps/xformmanager/management/commands/sync_schema.py | commtrack/commtrack-old-to-del | cc9c22754ac192a45483cef609bdcf09aa990340 | [
"BSD-3-Clause"
] | null | null | null | apps/xformmanager/management/commands/sync_schema.py | commtrack/commtrack-old-to-del | cc9c22754ac192a45483cef609bdcf09aa990340 | [
"BSD-3-Clause"
] | null | null | null | """ This script downloads synchronization data from a remote server,
deletes local xforms and submissions, and loads the data
"""
import bz2
import sys
import tarfile
import urllib2
import httplib
import cStringIO
from urlparse import urlparse
from optparse import make_option
from django.core.management.base import LabelCommand, CommandError
from django_rest_interface import util as rest_util
from xformmanager.management.commands.util import submit_schema
from xformmanager.models import FormDefModel
class Command(LabelCommand):
option_list = LabelCommand.option_list + (
make_option('-q','--quiet', action='store_false', dest='verbose', \
default=True, help='Quiet output'),
make_option('-?','--debug', action='store_true', dest='debug', \
default=False, help='Generate some files'),
)
help = "Synchronizes CommCareHQ with a specified remote server."
args = "<remote_ip username password local_dns>"
label = 'IP address of the remote server (including port), ' + \
'username, password, and DNS of local server'
def handle(self, *args, **options):
if len(args) < 3:
raise CommandError('Please specify %s.' % self.label)
remote_ip = args[0]
username = args[1]
password = args[2]
local_dns = None
if len(args) == 4:
local_dns = args[3]
verbose = options.get('verbose', True)
debug = options.get('debug', False)
if verbose:
print "This script assumes a local server is running. " + \
"To launch your local server, run './manage.py runserver'"
rest_util.are_you_sure()
file = "schemata.tar"
generate_schemata(remote_ip, username, \
password, download=True, to=file, debug=False)
if local_dns:
load_schemata(file, local_dns)
else:
load_schemata(file)
def __del__(self):
pass
def generate_schemata(remote_url, username, password, latest=True, download=False, to="schemata.tar", debug=False):
""" Generate sync data from remote server
remote_url: url of remote server (ip:port)
username, password: credentials for logging in
"""
status = rest_util.login(remote_url, username, password)
if not status:
print "Sorry. Your credentials were not accepted."
sys.exit()
url = 'http://%s/api/xforms/?format=sync' % remote_url
if latest:
xmlns_buffer = rest_util.get_field_as_bz2(FormDefModel, 'target_namespace', debug)
print "Generating latest remote schemata..."
else:
xmlns_buffer = ''
print "Generating all remote submissions archive..."
response = rest_util.request(url, username, password, xmlns_buffer)
print "Generated"
if download:
fout = open(to, 'w+b')
fout.write(response.read())
fout.close()
print "Schemata downloaded to %s" % to
return response
def load_schemata(schemata_file, localserver="127.0.0.1:8000"):
""" This script loads new data into the local CommCareHQ server
Arguments:
args[0] - tar file of exported schemata
"""
if not tarfile.is_tarfile(schemata_file):
fin = open(schemata_file)
contents = fin.read(256)
fin.close()
if contents.lower().find("no ") != -1:
print "No new schemata"
else:
print "This is not a valid schemata file"
else:
rest_util.extract_and_process(schemata_file, submit_schema, localserver)
| 36.24 | 115 | 0.639901 | 440 | 3,624 | 5.147727 | 0.379545 | 0.049448 | 0.025166 | 0.021192 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008965 | 0.261313 | 3,624 | 99 | 116 | 36.606061 | 0.837131 | 0 | 0 | 0.051282 | 0 | 0 | 0.218029 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.102564 | 0.153846 | null | null | 0.102564 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
b7ef783b638dfbad8ba8f9f8565f3583ebeb0f54 | 1,356 | py | Python | app/__init__.py | luxutao/staffms | 6fe2a263fca4a817fbd18965327bd8ad5326dc6b | [
"Apache-2.0"
] | 1 | 2019-12-25T11:11:33.000Z | 2019-12-25T11:11:33.000Z | app/__init__.py | luxutao/staffms | 6fe2a263fca4a817fbd18965327bd8ad5326dc6b | [
"Apache-2.0"
] | null | null | null | app/__init__.py | luxutao/staffms | 6fe2a263fca4a817fbd18965327bd8ad5326dc6b | [
"Apache-2.0"
] | null | null | null | #!/usr/local/bin/python3
# -*- conding: utf-8 -*-
import json
import logging
from config import Config
from .utils import db, cache
from app.auth import auth_api
from app.company import company_api
from app.department import department_api
from app.job import job_api
from app.staff import staff_api
from flask import Flask
# 将创建app的动作封装成一个函数
def create_app():
# 创建app实例对象
app = Flask(__name__)
# 加载配置
app.config.from_object(Config)
# 执行额外的初始化
Config.init_app(app)
db.init_app(app)
cache.init_app(app)
# 添加日志
# app.logger = logging.getLogger(__name__)
# app.logger.setLevel(level=logging.INFO)
# handler = logging.FileHandler("/var/log/uwsgi/flaskapi_info.log")
# handler.setLevel(logging.INFO)
# formatter = logging.Formatter(
# '%(asctime)s - %(name)s - %(process)d - %(thread)d - %(filename)s - %(levelname)s - %(message)s')
# handler.setFormatter(formatter)
# # if not app.logger.handlers:
# app.logger.addHandler(handler)
# 定制错误
@app.errorhandler(404)
def page_not_found(error):
return json.dumps({'code': 404, 'msg': "404 Not Found"}), 404
app.register_blueprint(auth_api)
app.register_blueprint(company_api)
app.register_blueprint(department_api)
app.register_blueprint(job_api)
app.register_blueprint(staff_api)
return app | 28.25 | 107 | 0.698378 | 181 | 1,356 | 5.060773 | 0.38674 | 0.03821 | 0.10917 | 0.100437 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012613 | 0.181416 | 1,356 | 48 | 108 | 28.25 | 0.812613 | 0.368732 | 0 | 0 | 0 | 0 | 0.023838 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.08 | false | 0 | 0.4 | 0.04 | 0.56 | 0.2 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4d09e20b82bf513f5486d55dd3eb8d4f86362d9b | 1,180 | py | Python | code/main_sampler.py | Amritds/StackGAN | e977de26b97a6fc3f0e51f1721a5cfa867bf0665 | [
"MIT"
] | null | null | null | code/main_sampler.py | Amritds/StackGAN | e977de26b97a6fc3f0e51f1721a5cfa867bf0665 | [
"MIT"
] | null | null | null | code/main_sampler.py | Amritds/StackGAN | e977de26b97a6fc3f0e51f1721a5cfa867bf0665 | [
"MIT"
] | null | null | null | from __future__ import print_function
import torch.backends.cudnn as cudnn
import torch
import torchvision.transforms as transforms
import argparse
import os
import random
import sys
import pprint
import datetime
import dateutil
import dateutil.tz
from StackGAN.code.miscc.datasets import TextDataset
from StackGAN.code.miscc.config import cfg, cfg_from_file
from StackGAN.code.miscc.utils import mkdir_p
from StackGAN.code.trainer import GANTrainer
cfg_from_file('/home/iitm/a-PyTorch-Tutorial-to-Image-Captioning/StackGAN/code/cfg/coco_eval.yml')
cfg.GPU_ID ='0'
cfg.DATA_DIR = ''
print('Using config:')
pprint.pprint(cfg)
manualSeed = random.randint(1, 10000)
random.seed(manualSeed)
torch.manual_seed(manualSeed)
if cfg.CUDA:
torch.cuda.manual_seed_all(manualSeed)
now = datetime.datetime.now(dateutil.tz.tzlocal())
timestamp = now.strftime('%Y_%m_%d_%H_%M_%S')
output_dir = '../output/%s_%s_%s' % \
(cfg.DATASET_NAME, cfg.CONFIG_NAME, timestamp)
num_gpu = len(cfg.GPU_ID.split(','))
datapath= '%s' % (cfg.DATA_PATH)
algo = GANTrainer(output_dir)
def sample(datapath):
return algo.sample(datapath + '/mini_batch_captions.t7', cfg.STAGE)
| 25.652174 | 98 | 0.767797 | 175 | 1,180 | 4.994286 | 0.48 | 0.06865 | 0.073227 | 0.072082 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007656 | 0.114407 | 1,180 | 45 | 99 | 26.222222 | 0.828708 | 0 | 0 | 0 | 0 | 0.028571 | 0.132203 | 0.088136 | 0 | 0 | 0 | 0 | 0 | 1 | 0.028571 | false | 0 | 0.457143 | 0.028571 | 0.514286 | 0.114286 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4d14577344161eaddb23944cf58fe52e2f7814a6 | 3,146 | py | Python | endpoints/yomomma.py | Andy-THE-Coder/imgen | 95e39d9f1c83dcf9dafaac17d58dffecadcc2de2 | [
"MIT"
] | 86 | 2020-05-03T11:10:09.000Z | 2022-03-16T21:54:58.000Z | endpoints/yomomma.py | Andy-THE-Coder/imgen | 95e39d9f1c83dcf9dafaac17d58dffecadcc2de2 | [
"MIT"
] | 15 | 2018-03-05T16:59:44.000Z | 2019-01-04T21:34:49.000Z | endpoints/yomomma.py | Andy-THE-Coder/imgen | 95e39d9f1c83dcf9dafaac17d58dffecadcc2de2 | [
"MIT"
] | 66 | 2020-05-01T15:49:19.000Z | 2022-03-04T16:15:46.000Z | from flask import jsonify
from utils.endpoint import Endpoint, setup
from random import choice
@setup
class YoMomma(Endpoint):
"""
This endpoint only returns a yo momma joke. No parameters are required.
"""
params = []
def generate(self, avatars, text, usernames, kwargs):
choices = ['Yo momma so fat when she walked past the TV I missed three episodes',
'Yo momma so stupid she stuck a battery up her ass and said "I GOT THE POWER"',
'Yo momma so dumb, when y\'all were driving to Disneyland, she saw a sign that said "Disneyland left", so she went home',
'Yo momma so fat she needs cheat codes for Wii Fit',
'Yo momma so fat when she went to KFC and they asker her what size of bucket, she said "The one on the roof"',
'Yo momma so fat, I took a picture of her last Christmas and it\'s still printing',
'Yo momma so fat and old when God said "Let there be light" he asked your momma to step out of the way',
'Yo momma so fat when she stept out in a yellow jacket people yell TAXI',
'Yo momma so fat I tried driving around her and I ran out of gas',
'Yo momma so fat it took Thanos two snaps to kill her',
'Yo momma so fat she sued Nintendo for guessing her weight',
'Yo momma so dumb, she tripped over WiFi',
'Yo momma so fat she has two watches, one for each timezone',
'Yo momma so fat she left the house in high heels and came back in flip flops',
'Yo momma so fat her blood type is Nutella',
'Yo momma so fat she uses Google Earth to take a selfie',
'Yo momma so fat even Dora could not explore her',
'Yo momma so fat she jumped in the air and got stuck',
'Yo momma so fat that when we were born, she gave the hospital stretch marks',
'Yo momma so fat she wears a sock on each toe',
'Yo momma so fat the army uses her underwear as parachutes',
'Yo momma so fat her patronus is a cake',
'Yo momma so fat when she tripped over on 4th Ave, she landed on 12th',
'Yo momma so fat the only way she burns calories is when her food is on fire',
'Yo momma so fat she won all 75 Hunger Games',
'Yo momma so fat when she steps on a scale it says "One at a time please"',
'Yo momma so fat she got her own area code',
'Yo momma so fat even Kirby can'' eat her',
'Yo momma so fat when she went to the beach Greenpeace threw her into the ocean',
'Yo momma so fat a vampire bit her and got Type 2 diabetes',
'Yo momma so fat she uses butter for her chapstick',
'Yo momma so fat when she walks backwards she beeps',
'Yo momma so fat she puts mayo on her diet pills']
return jsonify({"text": choice(choices)})
| 64.204082 | 140 | 0.588366 | 490 | 3,146 | 3.777551 | 0.426531 | 0.128579 | 0.160454 | 0.194489 | 0.240411 | 0.118314 | 0.027012 | 0.027012 | 0 | 0 | 0 | 0.002985 | 0.361093 | 3,146 | 48 | 141 | 65.541667 | 0.91791 | 0.022568 | 0 | 0 | 0 | 0.02439 | 0.636483 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.02439 | false | 0 | 0.073171 | 0 | 0.170732 | 0.02439 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4d39c866ede8f42966e46944b9c082afe954714d | 753 | py | Python | nlpete/data/tokenizers/word_splitter.py | epwalsh/nlp-models | 59adc47fd048e4a33e83d1fc167c3c0404aad6f0 | [
"MIT"
] | 95 | 2018-10-21T19:54:47.000Z | 2021-09-28T16:16:26.000Z | nlpete/data/tokenizers/word_splitter.py | epwalsh/nlp-models | 59adc47fd048e4a33e83d1fc167c3c0404aad6f0 | [
"MIT"
] | 30 | 2018-10-09T18:47:18.000Z | 2021-04-12T20:23:39.000Z | nlpete/data/tokenizers/word_splitter.py | epwalsh/nlp-models | 59adc47fd048e4a33e83d1fc167c3c0404aad6f0 | [
"MIT"
] | 12 | 2018-11-09T17:38:41.000Z | 2020-07-10T15:46:33.000Z | import re
from typing import List
from overrides import overrides
from allennlp.data.tokenizers import Token, Tokenizer
@Tokenizer.register("nl2bash")
class NL2BashWordSplitter(Tokenizer):
"""
A tokenizer for the NL2Bash model.
This is basically just a ``WhitespaceTokenizer`` which keeps runs of (unicode) letters,
digits, and whitespace together, while every other non-whitespace character becomes a separate word.
"""
@overrides
def tokenize(self, sentence: str) -> List[Token]:
# We use the [^\W\d_] pattern as a trick to match unicode letters
tokens = [
Token(m.group(), idx=m.start())
for m in re.finditer(r"[^\W\d_]+|\s+|\d+|\S", sentence)
]
return tokens
| 28.961538 | 104 | 0.664011 | 97 | 753 | 5.134021 | 0.680412 | 0.056225 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005181 | 0.231076 | 753 | 25 | 105 | 30.12 | 0.854922 | 0.383798 | 0 | 0 | 0 | 0 | 0.061364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0 | 0.307692 | 0 | 0.538462 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4d3b8e19aa4cb99d7b0f40314b35a403372133ab | 3,568 | py | Python | Boolean Gates/Boolean_Gates_Keras.py | Vignesh1326/Computational-Intelligence | 8156072f2091aac6d67828f568db25b4d15a48b7 | [
"MIT"
] | null | null | null | Boolean Gates/Boolean_Gates_Keras.py | Vignesh1326/Computational-Intelligence | 8156072f2091aac6d67828f568db25b4d15a48b7 | [
"MIT"
] | null | null | null | Boolean Gates/Boolean_Gates_Keras.py | Vignesh1326/Computational-Intelligence | 8156072f2091aac6d67828f568db25b4d15a48b7 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""CSE18163_CI_ASSIGN2.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1eKP1yKjJISADvyJYEBwlJuTPdxdFdedx
"""
import tensorflow as tf
import numpy as np
#Callback function to stop the epoch/training the model when accuracy becomes 100%
class myCallback(tf.keras.callbacks.Callback):
def on_epoch_end(self, epoch, logs={}):
if(logs.get('binary_accuracy')==1.0):
print("\n Training stopped! Reached 100% accuracy")
self.model.stop_training = True
#Creating the model
model = tf.keras.Sequential([
tf.keras.layers.Dense(16, activation='relu', input_shape=(2,)),
tf.keras.layers.Dense(1, activation='sigmoid')
])
callbacks = myCallback()
model.compile(optimizer='adam', loss='mean_squared_error', metrics=['binary_accuracy'])
#XOR
x = np.array([[0, 0],[0, 1],[1, 0],[1, 1]],dtype = float)
y = np.array([[0],[1],[1],[0]],dtype=float)
model.fit(x,y,epochs=500,callbacks=[callbacks])
print()
print("The output of XOR gate is :")
print()
print('X1\t X2\t\ts\t Y')
s = model.predict(x)
ans = model.predict(x).round()
for i in range(4):
print(x[i][0],'\t',x[i][1],'\t ',s[i][0],'\t ',ans[i][0])
#AND
x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=float)
y = np.array([[0], [0], [0], [1]], dtype=float)
model.fit(x, y, epochs=500, callbacks=[callbacks])
print()
print("The output for AND gate is: ")
print()
print('X1\t X2\t s\t\t Y')
s = model.predict(x).round()
ans = model.predict(x).round()
for i in range(4):
print(x[i][0],'\t',x[i][1],'\t ',s[i][0],'\t ',ans[i][0])
#OR
x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=float)
y = np.array([[0], [1], [1], [1]], dtype=float)
model.fit(x, y, epochs=500, callbacks=[callbacks])
print()
print("The output for OR gate is: ")
print()
print('X1\t X2\t\ts\t Y')
s = model.predict(x)
ans = model.predict(x).round()
for i in range(4):
print(x[i][0],'\t',x[i][1],'\t ',s[i][0],'\t ',ans[i][0])
#NAND
x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=float)
y = np.array([[1], [1], [1], [0]], dtype=float)
model.fit(x, y, epochs=500, callbacks=[callbacks])
print()
print("The output for NAND gate is: ")
print()
print('X1\t X2\t\ts\t Y')
s = model.predict(x)
ans = model.predict(x).round()
for i in range(4):
print(x[i][0],'\t',x[i][1],'\t ',s[i][0],'\t ',ans[i][0])
#NOR
x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=float)
y = np.array([[1], [0], [0], [0]], dtype=float)
model.fit(x, y, epochs=500, callbacks=[callbacks])
print()
print("The output of NOR gate is: ")
print()
print('X1\t X2\t\ts\t Y')
s = model.predict(x)
ans = model.predict(x).round()
for i in range(4):
print(x[i][0],'\t',x[i][1],'\t ',s[i][0],'\t ',ans[i][0])
#XNOR
x = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=float)
y = np.array([[1], [0], [0], [1]], dtype=float)
model.fit(x, y, epochs=500, callbacks=[callbacks])
print()
print("The output of XNOR gate is: ")
print()
print('X1\t X2\t\ts\t Y')
s = model.predict(x)
ans = model.predict(x).round()
for i in range(4):
print(x[i][0],'\t',x[i][1],'\t ',s[i][0],'\t ',ans[i][0])
#NOT
x = np.array([[0],[1]],dtype=float)
y = np.array([[1],[0]], dtype = float)
model.fit(x,y,epochs = 500,callbacks=[callbacks])
print()
print("The output of NOT gate is: ")
print()
print('X1\t\ts\t Y')
s = model1.predict(x)
ans = model1.predict(x).round()
for i in range(2):
print(x[i][0],'\t',s[i][0],'\t',ans[i][0,]) | 29.983193 | 87 | 0.580998 | 647 | 3,568 | 3.188563 | 0.171561 | 0.020359 | 0.020359 | 0.030538 | 0.660204 | 0.653902 | 0.636937 | 0.625303 | 0.600582 | 0.600582 | 0 | 0.055965 | 0.163677 | 3,568 | 119 | 88 | 29.983193 | 0.635389 | 0.089126 | 0 | 0.611111 | 1 | 0 | 0.16051 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.011111 | false | 0 | 0.022222 | 0 | 0.044444 | 0.4 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.