content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
{ 'targets': [ { 'target_name': 'xwalk_extensions_unittest', 'type': 'executable', 'dependencies': [ '../../base/base.gyp:base', '../../base/base.gyp:run_all_unittests', '../../testing/gtest.gyp:gtest', 'extensions.gyp:xwalk_extensions', ], 'sources': [ 'browser/xwalk_extension_function_handler_unittest.cc', 'common/xwalk_extension_server_unittest.cc', ], }, { 'target_name': 'xwalk_extensions_browsertest', 'type': 'executable', 'dependencies': [ '../../base/base.gyp:base', '../../content/content.gyp:content_browser', '../../content/content_shell_and_tests.gyp:test_support_content', '../../net/net.gyp:net', '../../skia/skia.gyp:skia', '../../testing/gtest.gyp:gtest', '../test/base/base.gyp:xwalk_test_base', '../xwalk.gyp:xwalk_runtime', 'extensions.gyp:xwalk_extensions', 'extensions_resources.gyp:xwalk_extensions_resources', 'external_extension_sample.gyp:*', ], 'defines': [ 'HAS_OUT_OF_PROC_TEST_RUNNER', ], 'variables': { 'jsapi_component': 'extensions', }, 'includes': [ '../xwalk_jsapi.gypi', ], 'sources': [ 'test/bad_extension_test.cc', 'test/conflicting_entry_points.cc', 'test/context_destruction.cc', 'test/crash_extension_process.cc', 'test/export_object.cc', 'test/extension_in_iframe.cc', 'test/external_extension.cc', 'test/external_extension_multi_process.cc', 'test/in_process_threads_browsertest.cc', 'test/internal_extension_browsertest.cc', 'test/internal_extension_browsertest.h', 'test/nested_namespace.cc', 'test/namespace_read_only.cc', 'test/test.idl', 'test/v8tools_module.cc', 'test/xwalk_extensions_browsertest.cc', 'test/xwalk_extensions_test_base.cc', 'test/xwalk_extensions_test_base.h', ], }, ], }
{'targets': [{'target_name': 'xwalk_extensions_unittest', 'type': 'executable', 'dependencies': ['../../base/base.gyp:base', '../../base/base.gyp:run_all_unittests', '../../testing/gtest.gyp:gtest', 'extensions.gyp:xwalk_extensions'], 'sources': ['browser/xwalk_extension_function_handler_unittest.cc', 'common/xwalk_extension_server_unittest.cc']}, {'target_name': 'xwalk_extensions_browsertest', 'type': 'executable', 'dependencies': ['../../base/base.gyp:base', '../../content/content.gyp:content_browser', '../../content/content_shell_and_tests.gyp:test_support_content', '../../net/net.gyp:net', '../../skia/skia.gyp:skia', '../../testing/gtest.gyp:gtest', '../test/base/base.gyp:xwalk_test_base', '../xwalk.gyp:xwalk_runtime', 'extensions.gyp:xwalk_extensions', 'extensions_resources.gyp:xwalk_extensions_resources', 'external_extension_sample.gyp:*'], 'defines': ['HAS_OUT_OF_PROC_TEST_RUNNER'], 'variables': {'jsapi_component': 'extensions'}, 'includes': ['../xwalk_jsapi.gypi'], 'sources': ['test/bad_extension_test.cc', 'test/conflicting_entry_points.cc', 'test/context_destruction.cc', 'test/crash_extension_process.cc', 'test/export_object.cc', 'test/extension_in_iframe.cc', 'test/external_extension.cc', 'test/external_extension_multi_process.cc', 'test/in_process_threads_browsertest.cc', 'test/internal_extension_browsertest.cc', 'test/internal_extension_browsertest.h', 'test/nested_namespace.cc', 'test/namespace_read_only.cc', 'test/test.idl', 'test/v8tools_module.cc', 'test/xwalk_extensions_browsertest.cc', 'test/xwalk_extensions_test_base.cc', 'test/xwalk_extensions_test_base.h']}]}
class Solution: @staticmethod def naive(n,edges): adj = {i:[] for i in range(n)} for u,v in edges: adj[u].append(v) adj[v].append(u) # no cycle, only one fully connected tree visited = set() def dfs(i,fro): if i in visited: return False visited.add(i) for child in adj[i]: if child != fro: if not dfs(child,i): return False return True if not dfs(0,-1): return False if len(visited)!=n: return False return True
class Solution: @staticmethod def naive(n, edges): adj = {i: [] for i in range(n)} for (u, v) in edges: adj[u].append(v) adj[v].append(u) visited = set() def dfs(i, fro): if i in visited: return False visited.add(i) for child in adj[i]: if child != fro: if not dfs(child, i): return False return True if not dfs(0, -1): return False if len(visited) != n: return False return True
class CardSelectionConfigController(object): cs = None controller = None pos = None def __init__(self, cs, controller, pos=-1): self.cs = cs self.controller = controller self.pos = pos def save(self): if self.pos < 0: self.controller.add_cs(self.cs) else: self.controller.update_cs(self.cs, self.pos) def get_nth_card_text(self, n): return self.cs.cards[n].text def set_nth_card_text(self, n, text): self.cs.cards[n].text = text def get_task_text(self): return self.cs.text_p1 def set_task_text(self, txt): self.cs.text_p1 = txt def get_rule(self): return self.cs.rule def set_rule(self, txt): self.cs.rule = txt def get_extra_text(self): return self.cs.text_p2 def set_extra_text(self, txt): self.cs.text_p2 = txt def get_instructions(self): return self.cs.instructions def set_instructions(self, txt): self.cs.instructions = txt def is_fixed_position(self): return self.cs.is_fixed_position def set_is_fixed_position(self, val): self.cs.is_fixed_position = bool(val)
class Cardselectionconfigcontroller(object): cs = None controller = None pos = None def __init__(self, cs, controller, pos=-1): self.cs = cs self.controller = controller self.pos = pos def save(self): if self.pos < 0: self.controller.add_cs(self.cs) else: self.controller.update_cs(self.cs, self.pos) def get_nth_card_text(self, n): return self.cs.cards[n].text def set_nth_card_text(self, n, text): self.cs.cards[n].text = text def get_task_text(self): return self.cs.text_p1 def set_task_text(self, txt): self.cs.text_p1 = txt def get_rule(self): return self.cs.rule def set_rule(self, txt): self.cs.rule = txt def get_extra_text(self): return self.cs.text_p2 def set_extra_text(self, txt): self.cs.text_p2 = txt def get_instructions(self): return self.cs.instructions def set_instructions(self, txt): self.cs.instructions = txt def is_fixed_position(self): return self.cs.is_fixed_position def set_is_fixed_position(self, val): self.cs.is_fixed_position = bool(val)
T = int(input()) for _ in range(T): n = int(input()) s = [int(s_arr) for s_arr in input().split(' ')] misere, count = 0, 0 for i in range(n): misere ^= s[i] if s[i] <= 1: count += 1 print ("Second" if (count == n and misere == 1) or (count < n and misere == 0) else "First")
t = int(input()) for _ in range(T): n = int(input()) s = [int(s_arr) for s_arr in input().split(' ')] (misere, count) = (0, 0) for i in range(n): misere ^= s[i] if s[i] <= 1: count += 1 print('Second' if count == n and misere == 1 or (count < n and misere == 0) else 'First')
# tests transition from small to large int representation by multiplication for rhs in range(2, 11): lhs = 1 for k in range(100): res = lhs * rhs print(lhs, '*', rhs, '=', res) lhs = res # below tests pos/neg combinations that overflow small int # 31-bit overflow i = 1 << 20 print(i * i) print(i * -i) print(-i * i) print(-i * -i) # 63-bit overflow i = 1 << 40 print(i * i) print(i * -i) print(-i * i) print(-i * -i)
for rhs in range(2, 11): lhs = 1 for k in range(100): res = lhs * rhs print(lhs, '*', rhs, '=', res) lhs = res i = 1 << 20 print(i * i) print(i * -i) print(-i * i) print(-i * -i) i = 1 << 40 print(i * i) print(i * -i) print(-i * i) print(-i * -i)
class Solution: def findComplement(self, num: int) -> int: r = '{:08b}'.format(num).lstrip('0') r2 = '' for i in r: if i == '0': r2 += '1' else: r2 += '0' r3 = int(r2, 2) return r3 if __name__ == '__main__': s = Solution() r = s.findComplement(5) print(r)
class Solution: def find_complement(self, num: int) -> int: r = '{:08b}'.format(num).lstrip('0') r2 = '' for i in r: if i == '0': r2 += '1' else: r2 += '0' r3 = int(r2, 2) return r3 if __name__ == '__main__': s = solution() r = s.findComplement(5) print(r)
def filter_museums(request): sub = {'nature': 1, 'memorial': 2, 'art': 3, 'gallery': 4, 'history': 5} categories = [sub[i] for i in sub if request.GET.get(i) != 'false'] return categories
def filter_museums(request): sub = {'nature': 1, 'memorial': 2, 'art': 3, 'gallery': 4, 'history': 5} categories = [sub[i] for i in sub if request.GET.get(i) != 'false'] return categories
for i in range(1, 70, 2): s= str(i+1) print("printf \"26\\n30\\n" + s + "\\n\" > tile.sizes") print("./polycc --tile --parallel NusValidation.cpp") print("gcc -o nus" + s + " -O2 NusValidation.cpp.pluto.c -fopenmp -lm") print("cp nus" + s + " exp") print("./exp/nus" + s)
for i in range(1, 70, 2): s = str(i + 1) print('printf "26\\n30\\n' + s + '\\n" > tile.sizes') print('./polycc --tile --parallel NusValidation.cpp') print('gcc -o nus' + s + ' -O2 NusValidation.cpp.pluto.c -fopenmp -lm') print('cp nus' + s + ' exp') print('./exp/nus' + s)
# Puzzle Input with open('Day05_Input.txt') as puzzle_input: seats = puzzle_input.read().split('\n') # Converts a list containing a binary number to a decimal number def bin_to_decimal(bin_num): dec_num = 0 bin_len = len(bin_num) for pos, bit in enumerate(bin_num): if bit == 1: dec_num += 2 ** (bin_len - pos - 1) return dec_num # Calculates all the seats IDs seat_id = [] for s in seats: seat_position = [[], []] # Convert from letters to binary for letter in s[:-3]: seat_position[0] += [0] if letter == 'F' else [1] for letter in s[-3:]: seat_position[1] += [0] if letter == 'L' else [1] # Convert from binary to seat ID seat_id += [bin_to_decimal(seat_position[0]) * 8 + bin_to_decimal(seat_position[1])] print(max(seat_id))
with open('Day05_Input.txt') as puzzle_input: seats = puzzle_input.read().split('\n') def bin_to_decimal(bin_num): dec_num = 0 bin_len = len(bin_num) for (pos, bit) in enumerate(bin_num): if bit == 1: dec_num += 2 ** (bin_len - pos - 1) return dec_num seat_id = [] for s in seats: seat_position = [[], []] for letter in s[:-3]: seat_position[0] += [0] if letter == 'F' else [1] for letter in s[-3:]: seat_position[1] += [0] if letter == 'L' else [1] seat_id += [bin_to_decimal(seat_position[0]) * 8 + bin_to_decimal(seat_position[1])] print(max(seat_id))
# All traversals in one: Pre, post and inorder # Time complexity: O(3n) # Space complexity: O(4n), 4 stacks are being used class Node(): def __init__(self, key): self.left = None self.value = key self.right = None def traversal(node): if node is None: return [] stack = [[node, 1]] preorder = [] inorder = [] postorder = [] while(len(stack)!=0): curr = stack[-1][0] if(stack[-1][1] == 1): preorder.append(curr.value) stack[-1][1] += 1 if(curr.left): stack.append([curr.left, 1]) if(stack[-1][1] == 2): inorder.append(curr.value) stack[-1][1] += 1 if(curr.right): stack.append([curr.right, 1]) if(stack[-1][1] == 3): postorder.append(curr.value) stack.pop() return(preorder, inorder, postorder) root = Node(1) root.left = Node(2) root.right = Node(7) root.left.left = Node(3) root.left.left.right = Node(4) root.left.left.right.right = Node(5) root.left.left.right.right.right = Node(6) root.right.left = Node(8) root.right.right = Node(9) root.right.right.right = Node(10) preorder, inorder, postorder = traversal(root) print('Inorder traversal:', inorder) print('Preorder traversal:', preorder) print('Postorder traversal:', postorder)
class Node: def __init__(self, key): self.left = None self.value = key self.right = None def traversal(node): if node is None: return [] stack = [[node, 1]] preorder = [] inorder = [] postorder = [] while len(stack) != 0: curr = stack[-1][0] if stack[-1][1] == 1: preorder.append(curr.value) stack[-1][1] += 1 if curr.left: stack.append([curr.left, 1]) if stack[-1][1] == 2: inorder.append(curr.value) stack[-1][1] += 1 if curr.right: stack.append([curr.right, 1]) if stack[-1][1] == 3: postorder.append(curr.value) stack.pop() return (preorder, inorder, postorder) root = node(1) root.left = node(2) root.right = node(7) root.left.left = node(3) root.left.left.right = node(4) root.left.left.right.right = node(5) root.left.left.right.right.right = node(6) root.right.left = node(8) root.right.right = node(9) root.right.right.right = node(10) (preorder, inorder, postorder) = traversal(root) print('Inorder traversal:', inorder) print('Preorder traversal:', preorder) print('Postorder traversal:', postorder)
file = open("/disk/lulu/database/TSGene/pro/TSG.genepos.qukong.txt") #f = open("out.txt", "w") for line in file: # print line, list = line.strip().split("\t") # print list if list[4] == "-": line1 = line.strip().replace("-", "") print (line1) # print >> f, "%s" % line1 else: print (list[0], "\t", list[1], "\t", list[2], "\t", list[3], "\t", list[5], "\t", list[6], "\t", list[7], "\t", list[8]) list1 = list[4].strip().split('|') for i in list1: print (list[0], "\t", list[1], "\t", list[2], "\t", i, "\t", list[5], "\t", list[6], "\t", list[7], "\t", list[8])
file = open('/disk/lulu/database/TSGene/pro/TSG.genepos.qukong.txt') for line in file: list = line.strip().split('\t') if list[4] == '-': line1 = line.strip().replace('-', '') print(line1) else: print(list[0], '\t', list[1], '\t', list[2], '\t', list[3], '\t', list[5], '\t', list[6], '\t', list[7], '\t', list[8]) list1 = list[4].strip().split('|') for i in list1: print(list[0], '\t', list[1], '\t', list[2], '\t', i, '\t', list[5], '\t', list[6], '\t', list[7], '\t', list[8])
# -*- coding: utf-8 -*- class EndOfStream(Exception): pass class InvalidSyntaxError(Exception): pass class InvalidCommandFormat(InvalidSyntaxError): pass class TokenNotFound(InvalidSyntaxError): pass class DeprecatedSyntax(InvalidSyntaxError): pass class RenderingError(Exception): pass class ApertureSelectionError(Exception): pass class FeatureNotSupportedError(Exception): pass def suppress_context(exc: Exception) -> Exception: exc.__suppress_context__ = True return exc
class Endofstream(Exception): pass class Invalidsyntaxerror(Exception): pass class Invalidcommandformat(InvalidSyntaxError): pass class Tokennotfound(InvalidSyntaxError): pass class Deprecatedsyntax(InvalidSyntaxError): pass class Renderingerror(Exception): pass class Apertureselectionerror(Exception): pass class Featurenotsupportederror(Exception): pass def suppress_context(exc: Exception) -> Exception: exc.__suppress_context__ = True return exc
src = [] include_tmp = [] if aos_global_config.compiler == 'armcc': src = Split(''' compilers/armlibc/armcc_libc.c ''') include_tmp = Split(''' compilers/armlibc ''') elif aos_global_config.compiler == 'rvct': src = Split(''' compilers/armlibc/armcc_libc.c ''') include_tmp = Split(''' compilers/armlibc ''') elif aos_global_config.compiler == 'iar': src = Split(''' compilers/iar/iar_libc.c ''') include_tmp = Split(''' compilers/iar ''') elif aos_global_config.board != 'linuxhost': src = Split(''' newlib_stub.c ''') component = aos_component('newlib_stub', src) for i in include_tmp: component.add_global_includes(i)
src = [] include_tmp = [] if aos_global_config.compiler == 'armcc': src = split('\n compilers/armlibc/armcc_libc.c\n ') include_tmp = split('\n compilers/armlibc\n ') elif aos_global_config.compiler == 'rvct': src = split('\n compilers/armlibc/armcc_libc.c\n ') include_tmp = split('\n compilers/armlibc\n ') elif aos_global_config.compiler == 'iar': src = split('\n compilers/iar/iar_libc.c\n ') include_tmp = split('\n compilers/iar\n ') elif aos_global_config.board != 'linuxhost': src = split('\n newlib_stub.c\n ') component = aos_component('newlib_stub', src) for i in include_tmp: component.add_global_includes(i)
# # PySNMP MIB module CISCO-PRIVATE-VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-PRIVATE-VLAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:33:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") vtpVlanEntry, vtpVlanEditEntry = mibBuilder.importSymbols("CISCO-VTP-MIB", "vtpVlanEntry", "vtpVlanEditEntry") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup") Counter32, IpAddress, Unsigned32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, TimeTicks, MibIdentifier, ObjectIdentity, Counter64, Integer32, Bits, iso, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "IpAddress", "Unsigned32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "TimeTicks", "MibIdentifier", "ObjectIdentity", "Counter64", "Integer32", "Bits", "iso", "NotificationType") TextualConvention, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString") ciscoPrivateVlanMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 173)) ciscoPrivateVlanMIB.setRevisions(('2005-09-08 00:00', '2002-07-24 00:00', '2001-05-23 00:00', '2001-04-17 00:00',)) if mibBuilder.loadTexts: ciscoPrivateVlanMIB.setLastUpdated('200509080000Z') if mibBuilder.loadTexts: ciscoPrivateVlanMIB.setOrganization('Cisco Systems, Inc.') class PrivateVlanType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("normal", 1), ("primary", 2), ("isolated", 3), ("community", 4), ("twoWayCommunity", 5)) class VlanIndexOrZero(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 4095) class VlanIndexBitmap(TextualConvention, OctetString): status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 128) cpvlanMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1)) cpvlanVlanObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1)) cpvlanPortObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2)) cpvlanSVIObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3)) cpvlanVlanTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1), ) if mibBuilder.loadTexts: cpvlanVlanTable.setStatus('current') cpvlanVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1), ) vtpVlanEntry.registerAugmentions(("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanEntry")) cpvlanVlanEntry.setIndexNames(*vtpVlanEntry.getIndexNames()) if mibBuilder.loadTexts: cpvlanVlanEntry.setStatus('current') cpvlanVlanPrivateVlanType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1, 1), PrivateVlanType()).setMaxAccess("readonly") if mibBuilder.loadTexts: cpvlanVlanPrivateVlanType.setStatus('current') cpvlanVlanAssociatedPrimaryVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1, 2), VlanIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: cpvlanVlanAssociatedPrimaryVlan.setStatus('current') cpvlanVlanEditTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2), ) if mibBuilder.loadTexts: cpvlanVlanEditTable.setStatus('current') cpvlanVlanEditEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1), ) vtpVlanEditEntry.registerAugmentions(("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanEditEntry")) cpvlanVlanEditEntry.setIndexNames(*vtpVlanEditEntry.getIndexNames()) if mibBuilder.loadTexts: cpvlanVlanEditEntry.setStatus('current') cpvlanVlanEditPrivateVlanType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1, 1), PrivateVlanType().clone('normal')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanVlanEditPrivateVlanType.setStatus('current') cpvlanVlanEditAssocPrimaryVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1, 2), VlanIndexOrZero()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanVlanEditAssocPrimaryVlan.setStatus('current') cpvlanPrivatePortTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1), ) if mibBuilder.loadTexts: cpvlanPrivatePortTable.setStatus('current') cpvlanPrivatePortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cpvlanPrivatePortEntry.setStatus('current') cpvlanPrivatePortSecondaryVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1, 1, 1), VlanIndexOrZero()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanPrivatePortSecondaryVlan.setStatus('current') cpvlanPromPortTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2), ) if mibBuilder.loadTexts: cpvlanPromPortTable.setStatus('current') cpvlanPromPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cpvlanPromPortEntry.setStatus('current') cpvlanPromPortMultiPrimaryVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 1), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cpvlanPromPortMultiPrimaryVlan.setStatus('current') cpvlanPromPortSecondaryRemap = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap.setStatus('current') cpvlanPromPortSecondaryRemap2k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap2k.setStatus('current') cpvlanPromPortSecondaryRemap3k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap3k.setStatus('current') cpvlanPromPortSecondaryRemap4k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap4k.setStatus('current') cpvlanPromPortTwoWayRemapCapable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 6), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cpvlanPromPortTwoWayRemapCapable.setStatus('current') cpvlanPortModeTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3), ) if mibBuilder.loadTexts: cpvlanPortModeTable.setStatus('current') cpvlanPortModeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cpvlanPortModeEntry.setStatus('current') cpvlanPortMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("nonPrivateVlan", 1), ("host", 2), ("promiscuous", 3), ("secondaryTrunk", 4), ("promiscuousTrunk", 5))).clone('nonPrivateVlan')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanPortMode.setStatus('current') cpvlanTrunkPortTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4), ) if mibBuilder.loadTexts: cpvlanTrunkPortTable.setStatus('current') cpvlanTrunkPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cpvlanTrunkPortEntry.setStatus('current') cpvlanTrunkPortDynamicState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("onNoNegotiate", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortDynamicState.setStatus('current') cpvlanTrunkPortEncapType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dot1Q", 1), ("isl", 2), ("negotiate", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortEncapType.setStatus('current') cpvlanTrunkPortNativeVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 3), VlanIndexOrZero()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortNativeVlan.setStatus('current') cpvlanTrunkPortSecondaryVlans = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 4), VlanIndexBitmap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans.setStatus('current') cpvlanTrunkPortSecondaryVlans2k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 5), VlanIndexBitmap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans2k.setStatus('current') cpvlanTrunkPortSecondaryVlans3k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 6), VlanIndexBitmap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans3k.setStatus('current') cpvlanTrunkPortSecondaryVlans4k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 7), VlanIndexBitmap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans4k.setStatus('current') cpvlanTrunkPortNormalVlans = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 8), VlanIndexBitmap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans.setStatus('current') cpvlanTrunkPortNormalVlans2k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 9), VlanIndexBitmap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans2k.setStatus('current') cpvlanTrunkPortNormalVlans3k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 10), VlanIndexBitmap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans3k.setStatus('current') cpvlanTrunkPortNormalVlans4k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 11), VlanIndexBitmap()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans4k.setStatus('current') cpvlanTrunkPortDynamicStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("trunking", 1), ("notTrunking", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cpvlanTrunkPortDynamicStatus.setStatus('current') cpvlanTrunkPortEncapOperType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dot1Q", 1), ("isl", 2), ("notApplicable", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cpvlanTrunkPortEncapOperType.setStatus('current') cpvlanSVIMappingTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1), ) if mibBuilder.loadTexts: cpvlanSVIMappingTable.setStatus('current') cpvlanSVIMappingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-PRIVATE-VLAN-MIB", "cpvlanSVIMappingVlanIndex")) if mibBuilder.loadTexts: cpvlanSVIMappingEntry.setStatus('current') cpvlanSVIMappingVlanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1, 1), VlanIndexOrZero()) if mibBuilder.loadTexts: cpvlanSVIMappingVlanIndex.setStatus('current') cpvlanSVIMappingPrimarySVI = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1, 2), VlanIndexOrZero()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cpvlanSVIMappingPrimarySVI.setStatus('current') cpvlanMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2)) cpvlanMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 1)) cpvlanMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2)) cpvlanMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 1, 1)).setObjects() if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlanMIBCompliance = cpvlanMIBCompliance.setStatus('current') cpvlanVlanGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 1)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanPrivateVlanType"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanAssociatedPrimaryVlan"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanEditPrivateVlanType"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanVlanEditAssocPrimaryVlan")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlanVlanGroup = cpvlanVlanGroup.setStatus('current') cpvlanPrivatePortGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 2)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanPrivatePortSecondaryVlan")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlanPrivatePortGroup = cpvlanPrivatePortGroup.setStatus('current') cpvlanPromPortGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 3)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortMultiPrimaryVlan"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortSecondaryRemap"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortTwoWayRemapCapable")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlanPromPortGroup = cpvlanPromPortGroup.setStatus('current') cpvlanPromPort4kGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 4)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortSecondaryRemap2k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortSecondaryRemap3k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanPromPortSecondaryRemap4k")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlanPromPort4kGroup = cpvlanPromPort4kGroup.setStatus('current') cpvlanPortModeGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 5)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanPortMode")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlanPortModeGroup = cpvlanPortModeGroup.setStatus('current') cpvlanSVIMappingGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 6)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanSVIMappingPrimarySVI")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlanSVIMappingGroup = cpvlanSVIMappingGroup.setStatus('current') cpvlanTrunkPortGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 7)).setObjects(("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortDynamicState"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortEncapType"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNativeVlan"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortSecondaryVlans"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortSecondaryVlans2k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortSecondaryVlans3k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortSecondaryVlans4k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNormalVlans"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNormalVlans2k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNormalVlans3k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortNormalVlans4k"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortDynamicStatus"), ("CISCO-PRIVATE-VLAN-MIB", "cpvlanTrunkPortEncapOperType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlanTrunkPortGroup = cpvlanTrunkPortGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-PRIVATE-VLAN-MIB", cpvlanPromPortTwoWayRemapCapable=cpvlanPromPortTwoWayRemapCapable, cpvlanPortModeTable=cpvlanPortModeTable, cpvlanPromPort4kGroup=cpvlanPromPort4kGroup, VlanIndexBitmap=VlanIndexBitmap, cpvlanVlanTable=cpvlanVlanTable, cpvlanVlanEditAssocPrimaryVlan=cpvlanVlanEditAssocPrimaryVlan, cpvlanTrunkPortTable=cpvlanTrunkPortTable, cpvlanPortModeGroup=cpvlanPortModeGroup, cpvlanPromPortGroup=cpvlanPromPortGroup, cpvlanTrunkPortEncapOperType=cpvlanTrunkPortEncapOperType, cpvlanMIBConformance=cpvlanMIBConformance, cpvlanPrivatePortSecondaryVlan=cpvlanPrivatePortSecondaryVlan, cpvlanTrunkPortNormalVlans2k=cpvlanTrunkPortNormalVlans2k, cpvlanVlanPrivateVlanType=cpvlanVlanPrivateVlanType, cpvlanSVIObjects=cpvlanSVIObjects, PrivateVlanType=PrivateVlanType, cpvlanPortModeEntry=cpvlanPortModeEntry, cpvlanTrunkPortDynamicState=cpvlanTrunkPortDynamicState, cpvlanTrunkPortNativeVlan=cpvlanTrunkPortNativeVlan, VlanIndexOrZero=VlanIndexOrZero, cpvlanPromPortSecondaryRemap4k=cpvlanPromPortSecondaryRemap4k, cpvlanVlanObjects=cpvlanVlanObjects, cpvlanPromPortEntry=cpvlanPromPortEntry, cpvlanPromPortSecondaryRemap3k=cpvlanPromPortSecondaryRemap3k, cpvlanTrunkPortEncapType=cpvlanTrunkPortEncapType, cpvlanSVIMappingGroup=cpvlanSVIMappingGroup, cpvlanTrunkPortSecondaryVlans2k=cpvlanTrunkPortSecondaryVlans2k, cpvlanTrunkPortEntry=cpvlanTrunkPortEntry, cpvlanSVIMappingTable=cpvlanSVIMappingTable, cpvlanVlanGroup=cpvlanVlanGroup, cpvlanVlanEditPrivateVlanType=cpvlanVlanEditPrivateVlanType, cpvlanPortObjects=cpvlanPortObjects, cpvlanSVIMappingVlanIndex=cpvlanSVIMappingVlanIndex, PYSNMP_MODULE_ID=ciscoPrivateVlanMIB, cpvlanSVIMappingEntry=cpvlanSVIMappingEntry, cpvlanMIBCompliance=cpvlanMIBCompliance, cpvlanTrunkPortSecondaryVlans3k=cpvlanTrunkPortSecondaryVlans3k, cpvlanVlanEditTable=cpvlanVlanEditTable, cpvlanPrivatePortGroup=cpvlanPrivatePortGroup, cpvlanSVIMappingPrimarySVI=cpvlanSVIMappingPrimarySVI, cpvlanVlanEntry=cpvlanVlanEntry, cpvlanPrivatePortTable=cpvlanPrivatePortTable, cpvlanTrunkPortDynamicStatus=cpvlanTrunkPortDynamicStatus, cpvlanPromPortSecondaryRemap2k=cpvlanPromPortSecondaryRemap2k, cpvlanPromPortMultiPrimaryVlan=cpvlanPromPortMultiPrimaryVlan, cpvlanPortMode=cpvlanPortMode, cpvlanMIBCompliances=cpvlanMIBCompliances, cpvlanPromPortTable=cpvlanPromPortTable, cpvlanTrunkPortNormalVlans=cpvlanTrunkPortNormalVlans, ciscoPrivateVlanMIB=ciscoPrivateVlanMIB, cpvlanVlanAssociatedPrimaryVlan=cpvlanVlanAssociatedPrimaryVlan, cpvlanVlanEditEntry=cpvlanVlanEditEntry, cpvlanTrunkPortGroup=cpvlanTrunkPortGroup, cpvlanPromPortSecondaryRemap=cpvlanPromPortSecondaryRemap, cpvlanTrunkPortNormalVlans3k=cpvlanTrunkPortNormalVlans3k, cpvlanMIBObjects=cpvlanMIBObjects, cpvlanTrunkPortSecondaryVlans4k=cpvlanTrunkPortSecondaryVlans4k, cpvlanTrunkPortNormalVlans4k=cpvlanTrunkPortNormalVlans4k, cpvlanMIBGroups=cpvlanMIBGroups, cpvlanPrivatePortEntry=cpvlanPrivatePortEntry, cpvlanTrunkPortSecondaryVlans=cpvlanTrunkPortSecondaryVlans)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint') (cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt') (vtp_vlan_entry, vtp_vlan_edit_entry) = mibBuilder.importSymbols('CISCO-VTP-MIB', 'vtpVlanEntry', 'vtpVlanEditEntry') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup') (counter32, ip_address, unsigned32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, time_ticks, mib_identifier, object_identity, counter64, integer32, bits, iso, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'IpAddress', 'Unsigned32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'TimeTicks', 'MibIdentifier', 'ObjectIdentity', 'Counter64', 'Integer32', 'Bits', 'iso', 'NotificationType') (textual_convention, truth_value, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'DisplayString') cisco_private_vlan_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 173)) ciscoPrivateVlanMIB.setRevisions(('2005-09-08 00:00', '2002-07-24 00:00', '2001-05-23 00:00', '2001-04-17 00:00')) if mibBuilder.loadTexts: ciscoPrivateVlanMIB.setLastUpdated('200509080000Z') if mibBuilder.loadTexts: ciscoPrivateVlanMIB.setOrganization('Cisco Systems, Inc.') class Privatevlantype(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5)) named_values = named_values(('normal', 1), ('primary', 2), ('isolated', 3), ('community', 4), ('twoWayCommunity', 5)) class Vlanindexorzero(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 4095) class Vlanindexbitmap(TextualConvention, OctetString): status = 'current' subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 128) cpvlan_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1)) cpvlan_vlan_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1)) cpvlan_port_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2)) cpvlan_svi_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3)) cpvlan_vlan_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1)) if mibBuilder.loadTexts: cpvlanVlanTable.setStatus('current') cpvlan_vlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1)) vtpVlanEntry.registerAugmentions(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanEntry')) cpvlanVlanEntry.setIndexNames(*vtpVlanEntry.getIndexNames()) if mibBuilder.loadTexts: cpvlanVlanEntry.setStatus('current') cpvlan_vlan_private_vlan_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1, 1), private_vlan_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: cpvlanVlanPrivateVlanType.setStatus('current') cpvlan_vlan_associated_primary_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 1, 1, 2), vlan_index_or_zero()).setMaxAccess('readonly') if mibBuilder.loadTexts: cpvlanVlanAssociatedPrimaryVlan.setStatus('current') cpvlan_vlan_edit_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2)) if mibBuilder.loadTexts: cpvlanVlanEditTable.setStatus('current') cpvlan_vlan_edit_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1)) vtpVlanEditEntry.registerAugmentions(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanEditEntry')) cpvlanVlanEditEntry.setIndexNames(*vtpVlanEditEntry.getIndexNames()) if mibBuilder.loadTexts: cpvlanVlanEditEntry.setStatus('current') cpvlan_vlan_edit_private_vlan_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1, 1), private_vlan_type().clone('normal')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanVlanEditPrivateVlanType.setStatus('current') cpvlan_vlan_edit_assoc_primary_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 1, 2, 1, 2), vlan_index_or_zero()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanVlanEditAssocPrimaryVlan.setStatus('current') cpvlan_private_port_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1)) if mibBuilder.loadTexts: cpvlanPrivatePortTable.setStatus('current') cpvlan_private_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: cpvlanPrivatePortEntry.setStatus('current') cpvlan_private_port_secondary_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 1, 1, 1), vlan_index_or_zero()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanPrivatePortSecondaryVlan.setStatus('current') cpvlan_prom_port_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2)) if mibBuilder.loadTexts: cpvlanPromPortTable.setStatus('current') cpvlan_prom_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: cpvlanPromPortEntry.setStatus('current') cpvlan_prom_port_multi_primary_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 1), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: cpvlanPromPortMultiPrimaryVlan.setStatus('current') cpvlan_prom_port_secondary_remap = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap.setStatus('current') cpvlan_prom_port_secondary_remap2k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap2k.setStatus('current') cpvlan_prom_port_secondary_remap3k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap3k.setStatus('current') cpvlan_prom_port_secondary_remap4k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 5), octet_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanPromPortSecondaryRemap4k.setStatus('current') cpvlan_prom_port_two_way_remap_capable = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 2, 1, 6), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: cpvlanPromPortTwoWayRemapCapable.setStatus('current') cpvlan_port_mode_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3)) if mibBuilder.loadTexts: cpvlanPortModeTable.setStatus('current') cpvlan_port_mode_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: cpvlanPortModeEntry.setStatus('current') cpvlan_port_mode = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 3, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('nonPrivateVlan', 1), ('host', 2), ('promiscuous', 3), ('secondaryTrunk', 4), ('promiscuousTrunk', 5))).clone('nonPrivateVlan')).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanPortMode.setStatus('current') cpvlan_trunk_port_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4)) if mibBuilder.loadTexts: cpvlanTrunkPortTable.setStatus('current') cpvlan_trunk_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: cpvlanTrunkPortEntry.setStatus('current') cpvlan_trunk_port_dynamic_state = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('on', 1), ('onNoNegotiate', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortDynamicState.setStatus('current') cpvlan_trunk_port_encap_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('dot1Q', 1), ('isl', 2), ('negotiate', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortEncapType.setStatus('current') cpvlan_trunk_port_native_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 3), vlan_index_or_zero()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortNativeVlan.setStatus('current') cpvlan_trunk_port_secondary_vlans = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 4), vlan_index_bitmap()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans.setStatus('current') cpvlan_trunk_port_secondary_vlans2k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 5), vlan_index_bitmap()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans2k.setStatus('current') cpvlan_trunk_port_secondary_vlans3k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 6), vlan_index_bitmap()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans3k.setStatus('current') cpvlan_trunk_port_secondary_vlans4k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 7), vlan_index_bitmap()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortSecondaryVlans4k.setStatus('current') cpvlan_trunk_port_normal_vlans = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 8), vlan_index_bitmap()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans.setStatus('current') cpvlan_trunk_port_normal_vlans2k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 9), vlan_index_bitmap()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans2k.setStatus('current') cpvlan_trunk_port_normal_vlans3k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 10), vlan_index_bitmap()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans3k.setStatus('current') cpvlan_trunk_port_normal_vlans4k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 11), vlan_index_bitmap()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanTrunkPortNormalVlans4k.setStatus('current') cpvlan_trunk_port_dynamic_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('trunking', 1), ('notTrunking', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cpvlanTrunkPortDynamicStatus.setStatus('current') cpvlan_trunk_port_encap_oper_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 2, 4, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('dot1Q', 1), ('isl', 2), ('notApplicable', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cpvlanTrunkPortEncapOperType.setStatus('current') cpvlan_svi_mapping_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1)) if mibBuilder.loadTexts: cpvlanSVIMappingTable.setStatus('current') cpvlan_svi_mapping_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1)).setIndexNames((0, 'CISCO-PRIVATE-VLAN-MIB', 'cpvlanSVIMappingVlanIndex')) if mibBuilder.loadTexts: cpvlanSVIMappingEntry.setStatus('current') cpvlan_svi_mapping_vlan_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1, 1), vlan_index_or_zero()) if mibBuilder.loadTexts: cpvlanSVIMappingVlanIndex.setStatus('current') cpvlan_svi_mapping_primary_svi = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 173, 1, 3, 1, 1, 2), vlan_index_or_zero()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cpvlanSVIMappingPrimarySVI.setStatus('current') cpvlan_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2)) cpvlan_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 1)) cpvlan_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2)) cpvlan_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 1, 1)).setObjects() if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlan_mib_compliance = cpvlanMIBCompliance.setStatus('current') cpvlan_vlan_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 1)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanPrivateVlanType'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanAssociatedPrimaryVlan'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanEditPrivateVlanType'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanVlanEditAssocPrimaryVlan')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlan_vlan_group = cpvlanVlanGroup.setStatus('current') cpvlan_private_port_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 2)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPrivatePortSecondaryVlan')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlan_private_port_group = cpvlanPrivatePortGroup.setStatus('current') cpvlan_prom_port_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 3)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortMultiPrimaryVlan'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortSecondaryRemap'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortTwoWayRemapCapable')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlan_prom_port_group = cpvlanPromPortGroup.setStatus('current') cpvlan_prom_port4k_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 4)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortSecondaryRemap2k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortSecondaryRemap3k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPromPortSecondaryRemap4k')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlan_prom_port4k_group = cpvlanPromPort4kGroup.setStatus('current') cpvlan_port_mode_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 5)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanPortMode')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlan_port_mode_group = cpvlanPortModeGroup.setStatus('current') cpvlan_svi_mapping_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 6)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanSVIMappingPrimarySVI')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlan_svi_mapping_group = cpvlanSVIMappingGroup.setStatus('current') cpvlan_trunk_port_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 173, 2, 2, 7)).setObjects(('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortDynamicState'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortEncapType'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNativeVlan'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortSecondaryVlans'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortSecondaryVlans2k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortSecondaryVlans3k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortSecondaryVlans4k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNormalVlans'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNormalVlans2k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNormalVlans3k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortNormalVlans4k'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortDynamicStatus'), ('CISCO-PRIVATE-VLAN-MIB', 'cpvlanTrunkPortEncapOperType')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cpvlan_trunk_port_group = cpvlanTrunkPortGroup.setStatus('current') mibBuilder.exportSymbols('CISCO-PRIVATE-VLAN-MIB', cpvlanPromPortTwoWayRemapCapable=cpvlanPromPortTwoWayRemapCapable, cpvlanPortModeTable=cpvlanPortModeTable, cpvlanPromPort4kGroup=cpvlanPromPort4kGroup, VlanIndexBitmap=VlanIndexBitmap, cpvlanVlanTable=cpvlanVlanTable, cpvlanVlanEditAssocPrimaryVlan=cpvlanVlanEditAssocPrimaryVlan, cpvlanTrunkPortTable=cpvlanTrunkPortTable, cpvlanPortModeGroup=cpvlanPortModeGroup, cpvlanPromPortGroup=cpvlanPromPortGroup, cpvlanTrunkPortEncapOperType=cpvlanTrunkPortEncapOperType, cpvlanMIBConformance=cpvlanMIBConformance, cpvlanPrivatePortSecondaryVlan=cpvlanPrivatePortSecondaryVlan, cpvlanTrunkPortNormalVlans2k=cpvlanTrunkPortNormalVlans2k, cpvlanVlanPrivateVlanType=cpvlanVlanPrivateVlanType, cpvlanSVIObjects=cpvlanSVIObjects, PrivateVlanType=PrivateVlanType, cpvlanPortModeEntry=cpvlanPortModeEntry, cpvlanTrunkPortDynamicState=cpvlanTrunkPortDynamicState, cpvlanTrunkPortNativeVlan=cpvlanTrunkPortNativeVlan, VlanIndexOrZero=VlanIndexOrZero, cpvlanPromPortSecondaryRemap4k=cpvlanPromPortSecondaryRemap4k, cpvlanVlanObjects=cpvlanVlanObjects, cpvlanPromPortEntry=cpvlanPromPortEntry, cpvlanPromPortSecondaryRemap3k=cpvlanPromPortSecondaryRemap3k, cpvlanTrunkPortEncapType=cpvlanTrunkPortEncapType, cpvlanSVIMappingGroup=cpvlanSVIMappingGroup, cpvlanTrunkPortSecondaryVlans2k=cpvlanTrunkPortSecondaryVlans2k, cpvlanTrunkPortEntry=cpvlanTrunkPortEntry, cpvlanSVIMappingTable=cpvlanSVIMappingTable, cpvlanVlanGroup=cpvlanVlanGroup, cpvlanVlanEditPrivateVlanType=cpvlanVlanEditPrivateVlanType, cpvlanPortObjects=cpvlanPortObjects, cpvlanSVIMappingVlanIndex=cpvlanSVIMappingVlanIndex, PYSNMP_MODULE_ID=ciscoPrivateVlanMIB, cpvlanSVIMappingEntry=cpvlanSVIMappingEntry, cpvlanMIBCompliance=cpvlanMIBCompliance, cpvlanTrunkPortSecondaryVlans3k=cpvlanTrunkPortSecondaryVlans3k, cpvlanVlanEditTable=cpvlanVlanEditTable, cpvlanPrivatePortGroup=cpvlanPrivatePortGroup, cpvlanSVIMappingPrimarySVI=cpvlanSVIMappingPrimarySVI, cpvlanVlanEntry=cpvlanVlanEntry, cpvlanPrivatePortTable=cpvlanPrivatePortTable, cpvlanTrunkPortDynamicStatus=cpvlanTrunkPortDynamicStatus, cpvlanPromPortSecondaryRemap2k=cpvlanPromPortSecondaryRemap2k, cpvlanPromPortMultiPrimaryVlan=cpvlanPromPortMultiPrimaryVlan, cpvlanPortMode=cpvlanPortMode, cpvlanMIBCompliances=cpvlanMIBCompliances, cpvlanPromPortTable=cpvlanPromPortTable, cpvlanTrunkPortNormalVlans=cpvlanTrunkPortNormalVlans, ciscoPrivateVlanMIB=ciscoPrivateVlanMIB, cpvlanVlanAssociatedPrimaryVlan=cpvlanVlanAssociatedPrimaryVlan, cpvlanVlanEditEntry=cpvlanVlanEditEntry, cpvlanTrunkPortGroup=cpvlanTrunkPortGroup, cpvlanPromPortSecondaryRemap=cpvlanPromPortSecondaryRemap, cpvlanTrunkPortNormalVlans3k=cpvlanTrunkPortNormalVlans3k, cpvlanMIBObjects=cpvlanMIBObjects, cpvlanTrunkPortSecondaryVlans4k=cpvlanTrunkPortSecondaryVlans4k, cpvlanTrunkPortNormalVlans4k=cpvlanTrunkPortNormalVlans4k, cpvlanMIBGroups=cpvlanMIBGroups, cpvlanPrivatePortEntry=cpvlanPrivatePortEntry, cpvlanTrunkPortSecondaryVlans=cpvlanTrunkPortSecondaryVlans)
class Solution: def rangeSumBST(self, root, L, R): def dfs(node): if node: if L <= node.val <= R: self.ans = self.ans + node.val if L < node.val: dfs(node.left) if R > node.val: dfs(node.right) self.ans = 0 dfs(root) return self.ans
class Solution: def range_sum_bst(self, root, L, R): def dfs(node): if node: if L <= node.val <= R: self.ans = self.ans + node.val if L < node.val: dfs(node.left) if R > node.val: dfs(node.right) self.ans = 0 dfs(root) return self.ans
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # @author jsbxyyx # @since 1.0 class Types: BIT = -7 TINYINT = -6 SMALLINT = 5 INTEGER = 4 BIGINT = -5 FLOAT = 6 REAL = 7 DOUBLE = 8 NUMERIC = 2 DECIMAL = 3 CHAR = 1 VARCHAR = 12 LONGVARCHAR = -1 DATE = 91 TIME = 92 TIMESTAMP = 93 BINARY = -2 VARBINARY = -3 LONGVARBINARY = -4 NULL = 0 OTHER = 1111 JAVA_OBJECT = 2000 DISTINCT = 2001 STRUCT = 2002 ARRAY = 2003 BLOB = 2004 CLOB = 2005 REF = 2006 DATALINK = 70 BOOLEAN = 16 ROWID = -8 NCHAR = -15 NVARCHAR = -9 LONGNVARCHAR = -16 NCLOB = 2011 SQLXML = 2009 REF_CURSOR = 2012 TIME_WITH_TIMEZONE = 2013 TIMESTAMP_WITH_TIMEZONE = 2014 # mysql INT = 4 DATETIME = 93 TINYTEXT = 2005 TEXT = 2005 MEDIUMTEXT = 2005 LONGTEXT = 2005 JSON = 2005 @classmethod def get(cls, name: str): return getattr(cls, name.upper(), None)
class Types: bit = -7 tinyint = -6 smallint = 5 integer = 4 bigint = -5 float = 6 real = 7 double = 8 numeric = 2 decimal = 3 char = 1 varchar = 12 longvarchar = -1 date = 91 time = 92 timestamp = 93 binary = -2 varbinary = -3 longvarbinary = -4 null = 0 other = 1111 java_object = 2000 distinct = 2001 struct = 2002 array = 2003 blob = 2004 clob = 2005 ref = 2006 datalink = 70 boolean = 16 rowid = -8 nchar = -15 nvarchar = -9 longnvarchar = -16 nclob = 2011 sqlxml = 2009 ref_cursor = 2012 time_with_timezone = 2013 timestamp_with_timezone = 2014 int = 4 datetime = 93 tinytext = 2005 text = 2005 mediumtext = 2005 longtext = 2005 json = 2005 @classmethod def get(cls, name: str): return getattr(cls, name.upper(), None)
class Count(object): version=1.5 def add(self,x,y): return x+y def sub(self,x,y): return x-y if __name__ == '__main__': c=Count() print(c.add(1,2)) print(c.sub(10,5))
class Count(object): version = 1.5 def add(self, x, y): return x + y def sub(self, x, y): return x - y if __name__ == '__main__': c = count() print(c.add(1, 2)) print(c.sub(10, 5))
expected_output = { "sensor_list": { "Environmental Monitoring": { "sensor": { "PEM Iout": {"location": "P1", "reading": "0 A", "state": "Normal"}, "PEM Vin": {"location": "P1", "reading": "104 V AC", "state": "Normal"}, "PEM Vout": {"location": "P1", "reading": "0 V DC", "state": "Normal"}, "Temp: Asic1": { "location": "0", "reading": "41 Celsius", "state": "Normal", }, "Temp: C2D C0": { "location": "R0", "reading": "38 Celsius", "state": "Normal", }, "Temp: C2D C1": { "location": "R0", "reading": "34 Celsius", "state": "Normal", }, "Temp: CPP Rear": { "location": "F0", "reading": "54 Celsius", "state": "Normal", }, "Temp: CPU AIR": { "location": "R0", "reading": "31 Celsius", "state": "Normal", }, "Temp: Center": { "location": "0", "reading": "34 Celsius", "state": "Normal", }, "Temp: FC": { "location": "P1", "reading": "27 Celsius", "state": "Fan Speed 65%", }, "Temp: HKP Die": { "location": "F0", "reading": "51 Celsius", "state": "Normal", }, "Temp: Inlet": { "location": "R0", "reading": "27 Celsius", "state": "Normal", }, "Temp: Left": { "location": "0", "reading": "29 Celsius", "state": "Normal", }, "Temp: Left Ext": { "location": "F0", "reading": "39 Celsius", "state": "Normal", }, "Temp: MCH AIR": { "location": "R0", "reading": "39 Celsius", "state": "Normal", }, "Temp: MCH DIE": { "location": "R0", "reading": "52 Celsius", "state": "Normal", }, "Temp: MCH Die": { "location": "F0", "reading": "60 Celsius", "state": "Normal", }, "Temp: Olv Die": { "location": "F0", "reading": "49 Celsius", "state": "Normal", }, "Temp: Outlet": { "location": "R0", "reading": "29 Celsius", "state": "Normal", }, "Temp: PEM": { "location": "P1", "reading": "26 Celsius", "state": "Normal", }, "Temp: Pop Die": { "location": "F0", "reading": "56 Celsius", "state": "Normal", }, "Temp: Rght Ext": { "location": "F0", "reading": "39 Celsius", "state": "Normal", }, "Temp: Right": { "location": "0", "reading": "33 Celsius", "state": "Normal", }, "Temp: SCBY AIR": { "location": "R0", "reading": "39 Celsius", "state": "Normal", }, "V1: 12v": {"location": "R0", "reading": "11821 mV", "state": "Normal"}, "V1: GP1": {"location": "R0", "reading": "913 mV", "state": "Normal"}, "V1: GP2": {"location": "R0", "reading": "1191 mV", "state": "Normal"}, "V1: VDD": {"location": "R0", "reading": "3281 mV", "state": "Normal"}, "V1: VMA": {"location": "R0", "reading": "1201 mV", "state": "Normal"}, "V1: VMB": {"location": "R0", "reading": "2504 mV", "state": "Normal"}, "V1: VMC": {"location": "R0", "reading": "3295 mV", "state": "Normal"}, "V1: VMD": {"location": "R0", "reading": "2500 mV", "state": "Normal"}, "V1: VME": {"location": "R0", "reading": "1801 mV", "state": "Normal"}, "V1: VMF": {"location": "R0", "reading": "1533 mV", "state": "Normal"}, "V2: 12v": {"location": "R0", "reading": "11821 mV", "state": "Normal"}, "V2: GP1": {"location": "R0", "reading": "2497 mV", "state": "Normal"}, "V2: GP2": {"location": "R0", "reading": "1186 mV", "state": "Normal"}, "V2: VDD": {"location": "R0", "reading": "3276 mV", "state": "Normal"}, "V2: VMA": {"location": "R0", "reading": "1054 mV", "state": "Normal"}, "V2: VMB": {"location": "R0", "reading": "1098 mV", "state": "Normal"}, "V2: VMC": {"location": "R0", "reading": "1059 mV", "state": "Normal"}, "V2: VMD": {"location": "R0", "reading": "991 mV", "state": "Normal"}, "V2: VME": {"location": "R0", "reading": "1103 mV", "state": "Normal"}, "V2: VMF": {"location": "R0", "reading": "1005 mV", "state": "Normal"}, "V3: 12v": {"location": "F0", "reading": "11806 mV", "state": "Normal"}, "V3: VDD": {"location": "F0", "reading": "3286 mV", "state": "Normal"}, "V3: VMA": {"location": "F0", "reading": "3291 mV", "state": "Normal"}, "V3: VMB": {"location": "F0", "reading": "2495 mV", "state": "Normal"}, "V3: VMC": {"location": "F0", "reading": "1499 mV", "state": "Normal"}, "V3: VMD": {"location": "F0", "reading": "1000 mV", "state": "Normal"}, } } } }
expected_output = {'sensor_list': {'Environmental Monitoring': {'sensor': {'PEM Iout': {'location': 'P1', 'reading': '0 A', 'state': 'Normal'}, 'PEM Vin': {'location': 'P1', 'reading': '104 V AC', 'state': 'Normal'}, 'PEM Vout': {'location': 'P1', 'reading': '0 V DC', 'state': 'Normal'}, 'Temp: Asic1': {'location': '0', 'reading': '41 Celsius', 'state': 'Normal'}, 'Temp: C2D C0': {'location': 'R0', 'reading': '38 Celsius', 'state': 'Normal'}, 'Temp: C2D C1': {'location': 'R0', 'reading': '34 Celsius', 'state': 'Normal'}, 'Temp: CPP Rear': {'location': 'F0', 'reading': '54 Celsius', 'state': 'Normal'}, 'Temp: CPU AIR': {'location': 'R0', 'reading': '31 Celsius', 'state': 'Normal'}, 'Temp: Center': {'location': '0', 'reading': '34 Celsius', 'state': 'Normal'}, 'Temp: FC': {'location': 'P1', 'reading': '27 Celsius', 'state': 'Fan Speed 65%'}, 'Temp: HKP Die': {'location': 'F0', 'reading': '51 Celsius', 'state': 'Normal'}, 'Temp: Inlet': {'location': 'R0', 'reading': '27 Celsius', 'state': 'Normal'}, 'Temp: Left': {'location': '0', 'reading': '29 Celsius', 'state': 'Normal'}, 'Temp: Left Ext': {'location': 'F0', 'reading': '39 Celsius', 'state': 'Normal'}, 'Temp: MCH AIR': {'location': 'R0', 'reading': '39 Celsius', 'state': 'Normal'}, 'Temp: MCH DIE': {'location': 'R0', 'reading': '52 Celsius', 'state': 'Normal'}, 'Temp: MCH Die': {'location': 'F0', 'reading': '60 Celsius', 'state': 'Normal'}, 'Temp: Olv Die': {'location': 'F0', 'reading': '49 Celsius', 'state': 'Normal'}, 'Temp: Outlet': {'location': 'R0', 'reading': '29 Celsius', 'state': 'Normal'}, 'Temp: PEM': {'location': 'P1', 'reading': '26 Celsius', 'state': 'Normal'}, 'Temp: Pop Die': {'location': 'F0', 'reading': '56 Celsius', 'state': 'Normal'}, 'Temp: Rght Ext': {'location': 'F0', 'reading': '39 Celsius', 'state': 'Normal'}, 'Temp: Right': {'location': '0', 'reading': '33 Celsius', 'state': 'Normal'}, 'Temp: SCBY AIR': {'location': 'R0', 'reading': '39 Celsius', 'state': 'Normal'}, 'V1: 12v': {'location': 'R0', 'reading': '11821 mV', 'state': 'Normal'}, 'V1: GP1': {'location': 'R0', 'reading': '913 mV', 'state': 'Normal'}, 'V1: GP2': {'location': 'R0', 'reading': '1191 mV', 'state': 'Normal'}, 'V1: VDD': {'location': 'R0', 'reading': '3281 mV', 'state': 'Normal'}, 'V1: VMA': {'location': 'R0', 'reading': '1201 mV', 'state': 'Normal'}, 'V1: VMB': {'location': 'R0', 'reading': '2504 mV', 'state': 'Normal'}, 'V1: VMC': {'location': 'R0', 'reading': '3295 mV', 'state': 'Normal'}, 'V1: VMD': {'location': 'R0', 'reading': '2500 mV', 'state': 'Normal'}, 'V1: VME': {'location': 'R0', 'reading': '1801 mV', 'state': 'Normal'}, 'V1: VMF': {'location': 'R0', 'reading': '1533 mV', 'state': 'Normal'}, 'V2: 12v': {'location': 'R0', 'reading': '11821 mV', 'state': 'Normal'}, 'V2: GP1': {'location': 'R0', 'reading': '2497 mV', 'state': 'Normal'}, 'V2: GP2': {'location': 'R0', 'reading': '1186 mV', 'state': 'Normal'}, 'V2: VDD': {'location': 'R0', 'reading': '3276 mV', 'state': 'Normal'}, 'V2: VMA': {'location': 'R0', 'reading': '1054 mV', 'state': 'Normal'}, 'V2: VMB': {'location': 'R0', 'reading': '1098 mV', 'state': 'Normal'}, 'V2: VMC': {'location': 'R0', 'reading': '1059 mV', 'state': 'Normal'}, 'V2: VMD': {'location': 'R0', 'reading': '991 mV', 'state': 'Normal'}, 'V2: VME': {'location': 'R0', 'reading': '1103 mV', 'state': 'Normal'}, 'V2: VMF': {'location': 'R0', 'reading': '1005 mV', 'state': 'Normal'}, 'V3: 12v': {'location': 'F0', 'reading': '11806 mV', 'state': 'Normal'}, 'V3: VDD': {'location': 'F0', 'reading': '3286 mV', 'state': 'Normal'}, 'V3: VMA': {'location': 'F0', 'reading': '3291 mV', 'state': 'Normal'}, 'V3: VMB': {'location': 'F0', 'reading': '2495 mV', 'state': 'Normal'}, 'V3: VMC': {'location': 'F0', 'reading': '1499 mV', 'state': 'Normal'}, 'V3: VMD': {'location': 'F0', 'reading': '1000 mV', 'state': 'Normal'}}}}}
class AST: def __init__(self, **fields): for k, v in fields.items(): setattr(self, k, v) class mod(AST): pass class Module(mod): _fields = ('body',) class Interactive(mod): _fields = ('body',) class Expression(mod): _fields = ('body',) class Suite(mod): _fields = ('body',) class stmt(AST): pass class FunctionDef(stmt): _fields = ('name', 'args', 'body', 'decorator_list', 'returns') class AsyncFunctionDef(stmt): _fields = ('name', 'args', 'body', 'decorator_list', 'returns') class ClassDef(stmt): _fields = ('name', 'bases', 'keywords', 'body', 'decorator_list') class Return(stmt): _fields = ('value',) class Delete(stmt): _fields = ('targets',) class Assign(stmt): _fields = ('targets', 'value') class AugAssign(stmt): _fields = ('target', 'op', 'value') class AnnAssign(stmt): _fields = ('target', 'annotation', 'value', 'simple') class For(stmt): _fields = ('target', 'iter', 'body', 'orelse') class AsyncFor(stmt): _fields = ('target', 'iter', 'body', 'orelse') class While(stmt): _fields = ('test', 'body', 'orelse') class If(stmt): _fields = ('test', 'body', 'orelse') class With(stmt): _fields = ('items', 'body') class AsyncWith(stmt): _fields = ('items', 'body') class Raise(stmt): _fields = ('exc', 'cause') class Try(stmt): _fields = ('body', 'handlers', 'orelse', 'finalbody') class Assert(stmt): _fields = ('test', 'msg') class Import(stmt): _fields = ('names',) class ImportFrom(stmt): _fields = ('module', 'names', 'level') class Global(stmt): _fields = ('names',) class Nonlocal(stmt): _fields = ('names',) class Expr(stmt): _fields = ('value',) class Pass(stmt): _fields = () class Break(stmt): _fields = () class Continue(stmt): _fields = () class expr(AST): pass class BoolOp(expr): _fields = ('op', 'values') class BinOp(expr): _fields = ('left', 'op', 'right') class UnaryOp(expr): _fields = ('op', 'operand') class Lambda(expr): _fields = ('args', 'body') class IfExp(expr): _fields = ('test', 'body', 'orelse') class Dict(expr): _fields = ('keys', 'values') class Set(expr): _fields = ('elts',) class ListComp(expr): _fields = ('elt', 'generators') class SetComp(expr): _fields = ('elt', 'generators') class DictComp(expr): _fields = ('key', 'value', 'generators') class GeneratorExp(expr): _fields = ('elt', 'generators') class Await(expr): _fields = ('value',) class Yield(expr): _fields = ('value',) class YieldFrom(expr): _fields = ('value',) class Compare(expr): _fields = ('left', 'ops', 'comparators') class Call(expr): _fields = ('func', 'args', 'keywords') class Num(expr): _fields = ('n',) class Str(expr): _fields = ('s',) class FormattedValue(expr): _fields = ('value', 'conversion', 'format_spec') class JoinedStr(expr): _fields = ('values',) class Bytes(expr): _fields = ('s',) class NameConstant(expr): _fields = ('value',) class Ellipsis(expr): _fields = () class Constant(expr): _fields = ('value',) class Attribute(expr): _fields = ('value', 'attr', 'ctx') class Subscript(expr): _fields = ('value', 'slice', 'ctx') class Starred(expr): _fields = ('value', 'ctx') class Name(expr): _fields = ('id', 'ctx') class List(expr): _fields = ('elts', 'ctx') class Tuple(expr): _fields = ('elts', 'ctx') class expr_context(AST): pass class Load(expr_context): _fields = () class Store(expr_context): _fields = () class StoreConst(expr_context): _fields = () class Del(expr_context): _fields = () class AugLoad(expr_context): _fields = () class AugStore(expr_context): _fields = () class Param(expr_context): _fields = () class slice(AST): pass class Slice(slice): _fields = ('lower', 'upper', 'step') class ExtSlice(slice): _fields = ('dims',) class Index(slice): _fields = ('value',) class boolop(AST): pass class And(boolop): _fields = () class Or(boolop): _fields = () class operator(AST): pass class Add(operator): _fields = () class Sub(operator): _fields = () class Mult(operator): _fields = () class MatMult(operator): _fields = () class Div(operator): _fields = () class Mod(operator): _fields = () class Pow(operator): _fields = () class LShift(operator): _fields = () class RShift(operator): _fields = () class BitOr(operator): _fields = () class BitXor(operator): _fields = () class BitAnd(operator): _fields = () class FloorDiv(operator): _fields = () class unaryop(AST): pass class Invert(unaryop): _fields = () class Not(unaryop): _fields = () class UAdd(unaryop): _fields = () class USub(unaryop): _fields = () class cmpop(AST): pass class Eq(cmpop): _fields = () class NotEq(cmpop): _fields = () class Lt(cmpop): _fields = () class LtE(cmpop): _fields = () class Gt(cmpop): _fields = () class GtE(cmpop): _fields = () class Is(cmpop): _fields = () class IsNot(cmpop): _fields = () class In(cmpop): _fields = () class NotIn(cmpop): _fields = () class comprehension(AST): _fields = ('target', 'iter', 'ifs', 'is_async') class excepthandler(AST): pass class ExceptHandler(excepthandler): _fields = ('type', 'name', 'body') class arguments(AST): _fields = ('args', 'vararg', 'kwonlyargs', 'kw_defaults', 'kwarg', 'defaults') class arg(AST): _fields = ('arg', 'annotation') class keyword(AST): _fields = ('arg', 'value') class alias(AST): _fields = ('name', 'asname') class withitem(AST): _fields = ('context_expr', 'optional_vars')
class Ast: def __init__(self, **fields): for (k, v) in fields.items(): setattr(self, k, v) class Mod(AST): pass class Module(mod): _fields = ('body',) class Interactive(mod): _fields = ('body',) class Expression(mod): _fields = ('body',) class Suite(mod): _fields = ('body',) class Stmt(AST): pass class Functiondef(stmt): _fields = ('name', 'args', 'body', 'decorator_list', 'returns') class Asyncfunctiondef(stmt): _fields = ('name', 'args', 'body', 'decorator_list', 'returns') class Classdef(stmt): _fields = ('name', 'bases', 'keywords', 'body', 'decorator_list') class Return(stmt): _fields = ('value',) class Delete(stmt): _fields = ('targets',) class Assign(stmt): _fields = ('targets', 'value') class Augassign(stmt): _fields = ('target', 'op', 'value') class Annassign(stmt): _fields = ('target', 'annotation', 'value', 'simple') class For(stmt): _fields = ('target', 'iter', 'body', 'orelse') class Asyncfor(stmt): _fields = ('target', 'iter', 'body', 'orelse') class While(stmt): _fields = ('test', 'body', 'orelse') class If(stmt): _fields = ('test', 'body', 'orelse') class With(stmt): _fields = ('items', 'body') class Asyncwith(stmt): _fields = ('items', 'body') class Raise(stmt): _fields = ('exc', 'cause') class Try(stmt): _fields = ('body', 'handlers', 'orelse', 'finalbody') class Assert(stmt): _fields = ('test', 'msg') class Import(stmt): _fields = ('names',) class Importfrom(stmt): _fields = ('module', 'names', 'level') class Global(stmt): _fields = ('names',) class Nonlocal(stmt): _fields = ('names',) class Expr(stmt): _fields = ('value',) class Pass(stmt): _fields = () class Break(stmt): _fields = () class Continue(stmt): _fields = () class Expr(AST): pass class Boolop(expr): _fields = ('op', 'values') class Binop(expr): _fields = ('left', 'op', 'right') class Unaryop(expr): _fields = ('op', 'operand') class Lambda(expr): _fields = ('args', 'body') class Ifexp(expr): _fields = ('test', 'body', 'orelse') class Dict(expr): _fields = ('keys', 'values') class Set(expr): _fields = ('elts',) class Listcomp(expr): _fields = ('elt', 'generators') class Setcomp(expr): _fields = ('elt', 'generators') class Dictcomp(expr): _fields = ('key', 'value', 'generators') class Generatorexp(expr): _fields = ('elt', 'generators') class Await(expr): _fields = ('value',) class Yield(expr): _fields = ('value',) class Yieldfrom(expr): _fields = ('value',) class Compare(expr): _fields = ('left', 'ops', 'comparators') class Call(expr): _fields = ('func', 'args', 'keywords') class Num(expr): _fields = ('n',) class Str(expr): _fields = ('s',) class Formattedvalue(expr): _fields = ('value', 'conversion', 'format_spec') class Joinedstr(expr): _fields = ('values',) class Bytes(expr): _fields = ('s',) class Nameconstant(expr): _fields = ('value',) class Ellipsis(expr): _fields = () class Constant(expr): _fields = ('value',) class Attribute(expr): _fields = ('value', 'attr', 'ctx') class Subscript(expr): _fields = ('value', 'slice', 'ctx') class Starred(expr): _fields = ('value', 'ctx') class Name(expr): _fields = ('id', 'ctx') class List(expr): _fields = ('elts', 'ctx') class Tuple(expr): _fields = ('elts', 'ctx') class Expr_Context(AST): pass class Load(expr_context): _fields = () class Store(expr_context): _fields = () class Storeconst(expr_context): _fields = () class Del(expr_context): _fields = () class Augload(expr_context): _fields = () class Augstore(expr_context): _fields = () class Param(expr_context): _fields = () class Slice(AST): pass class Slice(slice): _fields = ('lower', 'upper', 'step') class Extslice(slice): _fields = ('dims',) class Index(slice): _fields = ('value',) class Boolop(AST): pass class And(boolop): _fields = () class Or(boolop): _fields = () class Operator(AST): pass class Add(operator): _fields = () class Sub(operator): _fields = () class Mult(operator): _fields = () class Matmult(operator): _fields = () class Div(operator): _fields = () class Mod(operator): _fields = () class Pow(operator): _fields = () class Lshift(operator): _fields = () class Rshift(operator): _fields = () class Bitor(operator): _fields = () class Bitxor(operator): _fields = () class Bitand(operator): _fields = () class Floordiv(operator): _fields = () class Unaryop(AST): pass class Invert(unaryop): _fields = () class Not(unaryop): _fields = () class Uadd(unaryop): _fields = () class Usub(unaryop): _fields = () class Cmpop(AST): pass class Eq(cmpop): _fields = () class Noteq(cmpop): _fields = () class Lt(cmpop): _fields = () class Lte(cmpop): _fields = () class Gt(cmpop): _fields = () class Gte(cmpop): _fields = () class Is(cmpop): _fields = () class Isnot(cmpop): _fields = () class In(cmpop): _fields = () class Notin(cmpop): _fields = () class Comprehension(AST): _fields = ('target', 'iter', 'ifs', 'is_async') class Excepthandler(AST): pass class Excepthandler(excepthandler): _fields = ('type', 'name', 'body') class Arguments(AST): _fields = ('args', 'vararg', 'kwonlyargs', 'kw_defaults', 'kwarg', 'defaults') class Arg(AST): _fields = ('arg', 'annotation') class Keyword(AST): _fields = ('arg', 'value') class Alias(AST): _fields = ('name', 'asname') class Withitem(AST): _fields = ('context_expr', 'optional_vars')
# Approach 1 - Backtracking class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: def backtrack(remain, comb, next_start): if remain == 0: results.append(comb.copy()) return elif remain < 0: return for i in range(next_start, len(candidates)): comb.append(candidates[i]) backtrack(remain - candidates[i], comb, i) comb.pop() results = [] backtrack(target, [], 0) return results
class Solution: def combination_sum(self, candidates: List[int], target: int) -> List[List[int]]: def backtrack(remain, comb, next_start): if remain == 0: results.append(comb.copy()) return elif remain < 0: return for i in range(next_start, len(candidates)): comb.append(candidates[i]) backtrack(remain - candidates[i], comb, i) comb.pop() results = [] backtrack(target, [], 0) return results
#Find the Prime Numbers in a given range with total count. #(so basically prime number is a number which is only divisible by '1' & itself) #examples : 2, 3, 5, 7, 11, 13,... def error(): try: #Finds the Prime Numbers in a given range: ip = int(input("Enter the range to find Prime Numbers: ")) if ip <= 0: print("Wrong Input") print("Input must be a positive value") print("Start again..") error() print("Prime Numbers: ") for num in range(1, ip + 1): if num > 1: for i in range(2, num): if (num % i) == 0: i+=1 break else: lst = list() lst.append(num) print(lst, end=" ") #Counts the Prime Numbers in a given range: def count_Prime_nums(n): count = 0 for num in range(n): if num <= 1: continue for i in range(2, num): if (num % i) == 0: break else: count += 1 return count print("\nTotal no. of Prime Numbers: ", count_Prime_nums(ip)) except: #If there's an error, without giving a Traceback it prints a message #and also restarts the programme by itself using Recursion. print("Wrong Input") print("Start again..") error() error()
def error(): try: ip = int(input('Enter the range to find Prime Numbers: ')) if ip <= 0: print('Wrong Input') print('Input must be a positive value') print('Start again..') error() print('Prime Numbers: ') for num in range(1, ip + 1): if num > 1: for i in range(2, num): if num % i == 0: i += 1 break else: lst = list() lst.append(num) print(lst, end=' ') def count__prime_nums(n): count = 0 for num in range(n): if num <= 1: continue for i in range(2, num): if num % i == 0: break else: count += 1 return count print('\nTotal no. of Prime Numbers: ', count__prime_nums(ip)) except: print('Wrong Input') print('Start again..') error() error()
class Solution: def spiralMatrixIII(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: res = [(r0, c0)] step = 1 while len(res) < R * C: # right for j in range(step): c0 += 1 if self._in_grid(c0, r0, C, R): res.append((r0, c0)) # down for i in range(step): r0 += 1 if self._in_grid(c0, r0, C, R): res.append((r0, c0)) step += 1 # left for j in range(step): c0 -= 1 if self._in_grid(c0, r0, C, R): res.append((r0, c0)) # up for i in range(step): r0 -= 1 if self._in_grid(c0, r0, C, R): res.append((r0, c0)) step += 1 return res def _in_grid(self, c0, r0, C, R): return 0 <= c0 < C and 0 <= r0 < R
class Solution: def spiral_matrix_iii(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]: res = [(r0, c0)] step = 1 while len(res) < R * C: for j in range(step): c0 += 1 if self._in_grid(c0, r0, C, R): res.append((r0, c0)) for i in range(step): r0 += 1 if self._in_grid(c0, r0, C, R): res.append((r0, c0)) step += 1 for j in range(step): c0 -= 1 if self._in_grid(c0, r0, C, R): res.append((r0, c0)) for i in range(step): r0 -= 1 if self._in_grid(c0, r0, C, R): res.append((r0, c0)) step += 1 return res def _in_grid(self, c0, r0, C, R): return 0 <= c0 < C and 0 <= r0 < R
def get_sql(): limit = 6 sql = f"SELEct speed from world where animal='dolphin' limit {limit}" return sql def get_query_template(): limit = 6 query_template = ( f"SELEct speed from world where animal='dolphin' group by family limit {limit}" ) return query_template def get_query(): limit = 99 query = f"SELEct speed from world where animal='dolphin' and name is not null group by family limit {limit}" return query
def get_sql(): limit = 6 sql = f"SELEct speed from world where animal='dolphin' limit {limit}" return sql def get_query_template(): limit = 6 query_template = f"SELEct speed from world where animal='dolphin' group by family limit {limit}" return query_template def get_query(): limit = 99 query = f"SELEct speed from world where animal='dolphin' and name is not null group by family limit {limit}" return query
postponed = 'POSTPONED' scheduled = 'SCHEDULED' awarded = 'AWARDED' suspended = 'SUSPENDED' inPlay = 'IN_PLAY' canceled = 'CANCELED' paused = 'PAUSED' finished = 'FINISHED' matchToBePlayedList = [scheduled, suspended, paused, inPlay]
postponed = 'POSTPONED' scheduled = 'SCHEDULED' awarded = 'AWARDED' suspended = 'SUSPENDED' in_play = 'IN_PLAY' canceled = 'CANCELED' paused = 'PAUSED' finished = 'FINISHED' match_to_be_played_list = [scheduled, suspended, paused, inPlay]
class ActionException(Exception): pass class PingTimeout(Exception): pass class MeruException(Exception): pass
class Actionexception(Exception): pass class Pingtimeout(Exception): pass class Meruexception(Exception): pass
class Table(object): def __init__(self, name, columns): self.name = name self.columns = columns
class Table(object): def __init__(self, name, columns): self.name = name self.columns = columns
def test_add_group(app, xlsx_groups): old_list = app.group.get_group_list() app.group.add_new_group(xlsx_groups) new_list = app.group.get_group_list() old_list.append(xlsx_groups) assert sorted(old_list) == sorted(new_list)
def test_add_group(app, xlsx_groups): old_list = app.group.get_group_list() app.group.add_new_group(xlsx_groups) new_list = app.group.get_group_list() old_list.append(xlsx_groups) assert sorted(old_list) == sorted(new_list)
''' Created on 18 Sep 2017 @author: ywz '''
""" Created on 18 Sep 2017 @author: ywz """
a = 3 b = 4.0 c = a + b d = a - b e = a / b tup = (a, b, c, d, e) tup
a = 3 b = 4.0 c = a + b d = a - b e = a / b tup = (a, b, c, d, e) tup
#!/usr/bin/env python NAME = 'Newdefend (NewDefend)' def is_waf(self): # Newdefend reveals itself within the server headers without any mal requests if self.matchheader(('Server', 'Newdefend')): return True for attack in self.attacks: r = attack(self) if r is None: return _, page = r if any(i in page for i in (b'http://www.newdefend.com/feedback', b'/nd-block/')): return True return False
name = 'Newdefend (NewDefend)' def is_waf(self): if self.matchheader(('Server', 'Newdefend')): return True for attack in self.attacks: r = attack(self) if r is None: return (_, page) = r if any((i in page for i in (b'http://www.newdefend.com/feedback', b'/nd-block/'))): return True return False
# Example: Send Picture Message id = api.send_message( from_ = '+1234567980', to = '+1234567981', media = ['http://host/path/to/file'] )
id = api.send_message(from_='+1234567980', to='+1234567981', media=['http://host/path/to/file'])
def lps(string, result=[]): if len(string) > 0: end = 0 for i in range(1, len(string)): if string[i] == string[0] and i > end: end = i if not result: result.append(string[0: end + 1]) elif len(string[0: end+1]) > len(result[0]): result.pop() result.append(string[0: end + 1]) lps(string[1:], result) if __name__ == "__main__": string = "bananas" result = [] lps(string, result) print(result[0])
def lps(string, result=[]): if len(string) > 0: end = 0 for i in range(1, len(string)): if string[i] == string[0] and i > end: end = i if not result: result.append(string[0:end + 1]) elif len(string[0:end + 1]) > len(result[0]): result.pop() result.append(string[0:end + 1]) lps(string[1:], result) if __name__ == '__main__': string = 'bananas' result = [] lps(string, result) print(result[0])
# Exercise 66 - Translator d = dict(weather = "clima", earth = "terra", rain = "chuva") def vocabulary(word): return d[word] if word in d else '' word = input('Enter word: ') print(vocabulary(word))
d = dict(weather='clima', earth='terra', rain='chuva') def vocabulary(word): return d[word] if word in d else '' word = input('Enter word: ') print(vocabulary(word))
def bytes2human(n): # http://code.activestate.com/recipes/578019 symbols = ("K", "M", "G", "T", "P", "E", "Z", "Y") prefix = {} for i, s in enumerate(symbols): prefix[s] = 1 << (i + 1) * 10 for s in reversed(symbols): if n >= prefix[s]: value = float(n) / prefix[s] return "%.1f%s" % (value, s) return "%sB" % n
def bytes2human(n): symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') prefix = {} for (i, s) in enumerate(symbols): prefix[s] = 1 << (i + 1) * 10 for s in reversed(symbols): if n >= prefix[s]: value = float(n) / prefix[s] return '%.1f%s' % (value, s) return '%sB' % n
#!/usr/bin/env python NAME = 'Radware AppWall' def is_waf(self): if self.matchheader(('X-SL-CompState', '.')): return True for attack in self.attacks: r = attack(self) if r is None: return _, responsebody = r # Most reliable fingerprint is this on block page if all(i in responsebody for i in (b'because we have detected unauthorized activity', b'<TITLE>Unauthorized Request Blocked</TITLE>', b'If you believe that there has been some mistake', b'?Subject=Security Page - Case Number')): return True # Restored a fingerprint for radware previously discarded if b'CloudWebSec@radware.com' in responsebody: return True return False
name = 'Radware AppWall' def is_waf(self): if self.matchheader(('X-SL-CompState', '.')): return True for attack in self.attacks: r = attack(self) if r is None: return (_, responsebody) = r if all((i in responsebody for i in (b'because we have detected unauthorized activity', b'<TITLE>Unauthorized Request Blocked</TITLE>', b'If you believe that there has been some mistake', b'?Subject=Security Page - Case Number'))): return True if b'CloudWebSec@radware.com' in responsebody: return True return False
def domainchanger(email,newdom,olddom = "1"): email = email.split("@") if newdom != email[1]: newemail = email[0] + "@"+ newdom return f"Changed: {newemail}" else: newemail = email[0] + "@"+ email[1] return f"Unchanged: {newemail}" email = input("Enter your email: ") newdom = input("Enter your newdomain: ") olddom = input("Enter your old domain: ") if olddom == "": print(domainchanger(email,newdom)) else: print(domainchanger(email,newdom,olddom))
def domainchanger(email, newdom, olddom='1'): email = email.split('@') if newdom != email[1]: newemail = email[0] + '@' + newdom return f'Changed: {newemail}' else: newemail = email[0] + '@' + email[1] return f'Unchanged: {newemail}' email = input('Enter your email: ') newdom = input('Enter your newdomain: ') olddom = input('Enter your old domain: ') if olddom == '': print(domainchanger(email, newdom)) else: print(domainchanger(email, newdom, olddom))
class Vector: def __init__(self, length=3, vec=None): self._vec = [] if isinstance(vec, list): self._vec = vec.copy() else: if isinstance(length, (int, float)): for i in range(int(length)): self._vec.append(0) self._length = len(self._vec) def __repr__(self): s = str(self.__class__) s += '(' s += str(self._vec) s += ')' return s def __str__(self): s = '(' for i in range(self._length): s += str(self._vec[i]) if i < self._length - 1: s += ', ' s += ')' return s def __iter__(self): self._In = 0 return self def __next__(self): self._In += 1 if self._In - 1 < self._length: return self._vec[self._In - 1] else: raise StopIteration def correctIndex(self, index): if isinstance(index, (int, float)): key = int(index) if key >= 0 and key < self._length: return key return None def __getitem__(self, key): index = self.correctIndex(key) if index != None: return self._vec[index] def __setitem__(self, key, value): index = self.correctIndex(key) if index != None: self._vec[index] = value def __add__(self, other): if isinstance(other, Vector): if self._length == other.getLength(): newVector = Vector(length = self._length) for i in range(self._length): newVector[i] = self[i] + other[i] return newVector def __iadd__(self, other): return self + other def __mul__(self, other): if isinstance(other, (int, float)): newVector = Vector(length = self._length) for i in range(self._length): newVector[i] = self[i] * other return newVector if isinstance(other, type(self)): sp = 0 for i in range(len(other)): sp += self[i] * other[i] return Vector(vec = [sp]) def __imul__(self, other): return self * other def __sub__(self, other): return self + (other * -1) def __isub__(self, other): return self - other def __div__(self, other): if isinstance(other, (int, float)): if other != 0: return self * (1 / other) def __idiv__(self, other): return self / other def __len__(self): return len(self._vec) def getLength(self): return self._length def __eq__(self, other): if isinstance(other, type(self)): if len(self) == len(other): for i in range(len(self)): if self[i] != other[i]: return False return True return False def __ne__(self, other): return not self == other
class Vector: def __init__(self, length=3, vec=None): self._vec = [] if isinstance(vec, list): self._vec = vec.copy() elif isinstance(length, (int, float)): for i in range(int(length)): self._vec.append(0) self._length = len(self._vec) def __repr__(self): s = str(self.__class__) s += '(' s += str(self._vec) s += ')' return s def __str__(self): s = '(' for i in range(self._length): s += str(self._vec[i]) if i < self._length - 1: s += ', ' s += ')' return s def __iter__(self): self._In = 0 return self def __next__(self): self._In += 1 if self._In - 1 < self._length: return self._vec[self._In - 1] else: raise StopIteration def correct_index(self, index): if isinstance(index, (int, float)): key = int(index) if key >= 0 and key < self._length: return key return None def __getitem__(self, key): index = self.correctIndex(key) if index != None: return self._vec[index] def __setitem__(self, key, value): index = self.correctIndex(key) if index != None: self._vec[index] = value def __add__(self, other): if isinstance(other, Vector): if self._length == other.getLength(): new_vector = vector(length=self._length) for i in range(self._length): newVector[i] = self[i] + other[i] return newVector def __iadd__(self, other): return self + other def __mul__(self, other): if isinstance(other, (int, float)): new_vector = vector(length=self._length) for i in range(self._length): newVector[i] = self[i] * other return newVector if isinstance(other, type(self)): sp = 0 for i in range(len(other)): sp += self[i] * other[i] return vector(vec=[sp]) def __imul__(self, other): return self * other def __sub__(self, other): return self + other * -1 def __isub__(self, other): return self - other def __div__(self, other): if isinstance(other, (int, float)): if other != 0: return self * (1 / other) def __idiv__(self, other): return self / other def __len__(self): return len(self._vec) def get_length(self): return self._length def __eq__(self, other): if isinstance(other, type(self)): if len(self) == len(other): for i in range(len(self)): if self[i] != other[i]: return False return True return False def __ne__(self, other): return not self == other
''' This file contains config values (like the port numbers) used by our library ''' #:port to use for socket communications PORT = 1001 #:ip address of group to use for multicast communications MULTICAST_GROUP_IP = '224.15.35.42' #:port to use for multicast communications MULTICAST_PORT = 10000 #:the default timeout for all sockets DEFAULT_TIMEOUT = 10 #:the max size of a queue for socket requests MAX_CONNECT_REQUESTS = 5 #:the max buffer size for socket data NETWORK_CHUNK_SIZE = 8192 #max buffer size to read
""" This file contains config values (like the port numbers) used by our library """ port = 1001 multicast_group_ip = '224.15.35.42' multicast_port = 10000 default_timeout = 10 max_connect_requests = 5 network_chunk_size = 8192
food_items = [ "ham", #"spam", "eggs", "nuts" ] for food in food_items: if food == "spam": print ("No spam please") break print ("Great - ", food) #else: # print ("I am glad - There was no spam") print ("Finally I have finished")
food_items = ['ham', 'eggs', 'nuts'] for food in food_items: if food == 'spam': print('No spam please') break print('Great - ', food) print('Finally I have finished')
# https://leetcode.com/problems/sum-of-two-integers/ class Solution: def getSum(self, a: int, b: int) -> int: result = sum([a, b]) return result a = 1 b = 2 s = Solution() result = s.getSum(a, b)
class Solution: def get_sum(self, a: int, b: int) -> int: result = sum([a, b]) return result a = 1 b = 2 s = solution() result = s.getSum(a, b)
class HttpHeaders: X_CORRELATION_ID = "X-Correlation-ID" CONTENT_TYPE = "Content-Type" ACCEPT = 'Accept'
class Httpheaders: x_correlation_id = 'X-Correlation-ID' content_type = 'Content-Type' accept = 'Accept'
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-repodb' ES_DOC_TYPE = 'chemical' API_PREFIX = 'repodb' API_VERSION = ''
es_host = 'localhost:9200' es_index = 'pending-repodb' es_doc_type = 'chemical' api_prefix = 'repodb' api_version = ''
def match(text, pattern, base=10): text_len = len(text) pattern_len = len(pattern) text_hash = _get_hash(text[:pattern_len], base) pattern_hash = _get_hash(pattern, base) matches = [] for i in xrange(text_len - pattern_len + 1): if pattern_hash == text_hash: # If the hashes match, we also need to check if the text substring # and the pattern are the same. Hash matches can be result of # collisons. if pattern == text[i:i + pattern_len]: matches.append(i) if i >= text_len - pattern_len: break # Text hash considering only the most significant digit. text_hash_msd_only = ord(text[i]) * base ** (pattern_len - 1) # Note that we do not multiply the exponent of the base for the second # term in the summation because the exponent for the least significant # digit is 0. text_hash = (base * (text_hash - text_hash_msd_only) + ord(text[i + pattern_len])) return matches def _get_hash(text, base): text_hash = 0 for i in xrange(len(text)): text_hash = text_hash + (ord(text[-i - 1]) * base ** i) return text_hash
def match(text, pattern, base=10): text_len = len(text) pattern_len = len(pattern) text_hash = _get_hash(text[:pattern_len], base) pattern_hash = _get_hash(pattern, base) matches = [] for i in xrange(text_len - pattern_len + 1): if pattern_hash == text_hash: if pattern == text[i:i + pattern_len]: matches.append(i) if i >= text_len - pattern_len: break text_hash_msd_only = ord(text[i]) * base ** (pattern_len - 1) text_hash = base * (text_hash - text_hash_msd_only) + ord(text[i + pattern_len]) return matches def _get_hash(text, base): text_hash = 0 for i in xrange(len(text)): text_hash = text_hash + ord(text[-i - 1]) * base ** i return text_hash
class Form: company: str user: str days: int def __init__(self, company, user, days): self.company = company self.user = user self.days = days
class Form: company: str user: str days: int def __init__(self, company, user, days): self.company = company self.user = user self.days = days
def large(arr): if (len(arr)) < 0: return 0 max_sum = current = arr[0] for num in arr[1:]: current = max(current + num, num) max_sum = max(current, max_sum) return max_sum if __name__ == "__main__": print(large([1, -1, 3, -4, 5, -3, 6, -3, 2, -1]))
def large(arr): if len(arr) < 0: return 0 max_sum = current = arr[0] for num in arr[1:]: current = max(current + num, num) max_sum = max(current, max_sum) return max_sum if __name__ == '__main__': print(large([1, -1, 3, -4, 5, -3, 6, -3, 2, -1]))
for i in range(int(input())): n, k, s = list(map(int, input().split())) total = k * s count = 0 val = False m = 0 for j in range(1, s + 1): if (j % 7) != 0: count += n m += 1 else: continue if count >= total: val = True break if val: print(m) else: print(-1)
for i in range(int(input())): (n, k, s) = list(map(int, input().split())) total = k * s count = 0 val = False m = 0 for j in range(1, s + 1): if j % 7 != 0: count += n m += 1 else: continue if count >= total: val = True break if val: print(m) else: print(-1)
# Python program to display astrological sign # or Zodiac sign for given date of birth def zodiac_sign(day, month): # checks month and date within the valid range # of a specified zodiac if month == 'december': astro_sign = 'Sagittarius' if (day < 22) else 'capricorn' elif month == 'january': astro_sign = 'Capricorn' if (day < 20) else 'aquarius' elif month == 'february': astro_sign = 'Aquarius' if (day < 19) else 'pisces' elif month == 'march': astro_sign = 'Pisces' if (day < 21) else 'aries' elif month == 'april': astro_sign = 'Aries' if (day < 20) else 'taurus' elif month == 'may': astro_sign = 'Taurus' if (day < 21) else 'gemini' elif month == 'june': astro_sign = 'Gemini' if (day < 21) else 'cancer' elif month == 'july': astro_sign = 'Cancer' if (day < 23) else 'leo' elif month == 'august': astro_sign = 'Leo' if (day < 23) else 'virgo' elif month == 'september': astro_sign = 'Virgo' if (day < 23) else 'libra' elif month == 'october': astro_sign = 'Libra' if (day < 23) else 'scorpio' elif month == 'november': astro_sign = 'scorpio' if (day < 22) else 'sagittarius' print(astro_sign) # Driver code if __name__ == '__main__': day = 21 month = "april" zodiac_sign(day, month)
def zodiac_sign(day, month): if month == 'december': astro_sign = 'Sagittarius' if day < 22 else 'capricorn' elif month == 'january': astro_sign = 'Capricorn' if day < 20 else 'aquarius' elif month == 'february': astro_sign = 'Aquarius' if day < 19 else 'pisces' elif month == 'march': astro_sign = 'Pisces' if day < 21 else 'aries' elif month == 'april': astro_sign = 'Aries' if day < 20 else 'taurus' elif month == 'may': astro_sign = 'Taurus' if day < 21 else 'gemini' elif month == 'june': astro_sign = 'Gemini' if day < 21 else 'cancer' elif month == 'july': astro_sign = 'Cancer' if day < 23 else 'leo' elif month == 'august': astro_sign = 'Leo' if day < 23 else 'virgo' elif month == 'september': astro_sign = 'Virgo' if day < 23 else 'libra' elif month == 'october': astro_sign = 'Libra' if day < 23 else 'scorpio' elif month == 'november': astro_sign = 'scorpio' if day < 22 else 'sagittarius' print(astro_sign) if __name__ == '__main__': day = 21 month = 'april' zodiac_sign(day, month)
class Redirect(Exception): def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs
class Redirect(Exception): def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs
audio = [ "aif", "cda", "mid", "midi", "mp3", "mpa", "ogg", "wav", "wma", "wpl" ] compressed = [ "arj", "deb", "gz", "pkg", "rar", "rpm", "tar", "z", "zip" ] image = [ "ai", "bmp", "gif", "ico", "jpeg", "jpg", "png", "ps", "psd", "svg", "tif", "tiff", "webp" ] spreadsheet = [ "ods", "xlr", "xls", "xlsx" ] text = [ "doc", "docx", "odt", "pdf", "rtf", "tex", "txt", "wks", "wpd", "wps" ] video = [ "avi", "mp4" ]
audio = ['aif', 'cda', 'mid', 'midi', 'mp3', 'mpa', 'ogg', 'wav', 'wma', 'wpl'] compressed = ['arj', 'deb', 'gz', 'pkg', 'rar', 'rpm', 'tar', 'z', 'zip'] image = ['ai', 'bmp', 'gif', 'ico', 'jpeg', 'jpg', 'png', 'ps', 'psd', 'svg', 'tif', 'tiff', 'webp'] spreadsheet = ['ods', 'xlr', 'xls', 'xlsx'] text = ['doc', 'docx', 'odt', 'pdf', 'rtf', 'tex', 'txt', 'wks', 'wpd', 'wps'] video = ['avi', 'mp4']
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class UnknownSizeError(Exception): def __init__(self, cls): self.cls = cls def __str__(self): return f'The size of `{self.cls}` is unkown, the object could not be generated.' class UnavalibleAttributeError(Exception): def __init__(self, cls, attr_name): self.cls = cls self.attr_name = attr_name def __str__(self): return f'Did not defined attribute `{self.attr_name}` for `{self.cls}`.'
class Unknownsizeerror(Exception): def __init__(self, cls): self.cls = cls def __str__(self): return f'The size of `{self.cls}` is unkown, the object could not be generated.' class Unavalibleattributeerror(Exception): def __init__(self, cls, attr_name): self.cls = cls self.attr_name = attr_name def __str__(self): return f'Did not defined attribute `{self.attr_name}` for `{self.cls}`.'
# test short circuit expressions outside if conditionals print(() or 1) print((1,) or 1) print(() and 1) print((1,) and 1) print("PASS")
print(() or 1) print((1,) or 1) print(() and 1) print((1,) and 1) print('PASS')
TRAINING_DATA = [ ( "i went to amsterdem last year and the canals were beautiful", {"entities": [(10, 19, "TOURIST_DESTINATION")]}, ), ( "You should visit Paris once in your life, but the Eiffel Tower is kinda boring", {"entities": [(17, 22, "TOURIST_DESTINATION")]}, ), ("There's also a Paris in Arkansas, lol", {"entities": []}), ( "Berlin is perfect for summer holiday: lots of parks, great nightlife, cheap beer!", {"entities": [(0, 6, "TOURIST_DESTINATION")]}, ), ]
training_data = [('i went to amsterdem last year and the canals were beautiful', {'entities': [(10, 19, 'TOURIST_DESTINATION')]}), ('You should visit Paris once in your life, but the Eiffel Tower is kinda boring', {'entities': [(17, 22, 'TOURIST_DESTINATION')]}), ("There's also a Paris in Arkansas, lol", {'entities': []}), ('Berlin is perfect for summer holiday: lots of parks, great nightlife, cheap beer!', {'entities': [(0, 6, 'TOURIST_DESTINATION')]})]
class LoraCommands: ## Returns the firmware version and release date in format: "RN2903 X.Y.Z MMM DD YYYY HH:MM:SS" GET_VERSION = 'sys get ver' ## Resets LoRa stack RESET_STACK = 'mac reset' ## Sets the LoRA functionality to radio (needs to be done before anything else) START_RADIO_OP = 'mac pause' ## Sets the radio pwr to the given value in dB (range from 2dB to 20dB) SET_RADIO_POWER = 'radio set pwr {}' ## Gets current operating mode (LoRa or FSK) GET_RADIO_MODE = 'radio get mod' ## Gets radio frequency GET_RADIO_FREQUENCY = 'radio get freq' ## Gets radio spreading factor (values can be sf7, sf8, sf9, sf10, sf11, sf12) GET_RADIO_SPREADING_FACTOR = 'radio get sf' ## Sets the radio functionality to receive continuously SET_CONTINUOUS_RADIO_RECEPTION = 'radio rx 0' ## Exits the radio functionality to receive continuously EXIT_CONTINUOUS_RADIO_RECEPTION = 'radio rxstop' ## Disables the watchdog timer timeout for continuous reception DISABLE_TIMEOUT = 'radio set wdt 0' ## Turns the LoRa stick LED on TURN_OFF_RED_LED = 'sys set pindig GPIO11 0' ## Turns the LoRa stick LED off TURN_ON_RED_LED = 'sys set pindig GPIO11 1' ## Turns the LoRa stick LED on TURN_OFF_BLUE_LED = 'sys set pindig GPIO10 0' ## Turns the LoRa stick LED off TURN_ON_BLUE_LED = 'sys set pindig GPIO10 1' ## Data was successfully received RADIO_DATA_OK = 'ok' ## An error occured during radio operations RADIO_DATA_ERROR = 'radio_err' ## The radio line was busy RADIO_LINE_BUSY = 'busy' ## Input of radio command was invalid RADIO_INVALID_PARAM = 'invalid_param' ## Data received over radio RADIO_RADIO_DATA_RECEIVED = 'radio_rx' ## Radio data transmission was successful RADIO_TRANSFER_OK = 'radio_tx_ok' ## Radio transfer over radio RADIO_DATA_TRANSFER = 'radio tx {}'
class Loracommands: get_version = 'sys get ver' reset_stack = 'mac reset' start_radio_op = 'mac pause' set_radio_power = 'radio set pwr {}' get_radio_mode = 'radio get mod' get_radio_frequency = 'radio get freq' get_radio_spreading_factor = 'radio get sf' set_continuous_radio_reception = 'radio rx 0' exit_continuous_radio_reception = 'radio rxstop' disable_timeout = 'radio set wdt 0' turn_off_red_led = 'sys set pindig GPIO11 0' turn_on_red_led = 'sys set pindig GPIO11 1' turn_off_blue_led = 'sys set pindig GPIO10 0' turn_on_blue_led = 'sys set pindig GPIO10 1' radio_data_ok = 'ok' radio_data_error = 'radio_err' radio_line_busy = 'busy' radio_invalid_param = 'invalid_param' radio_radio_data_received = 'radio_rx' radio_transfer_ok = 'radio_tx_ok' radio_data_transfer = 'radio tx {}'
# DataBase Credentials database="da665kfg2oc9og" user = "aourrzrdjlrpjo" password = "12359d0fa8d70aeea4d2ef3acd96eb794f178dee42887f7c350ad49a4d78e323" host = "ec2-18-207-95-219.compute-1.amazonaws.com" port = "5432"
database = 'da665kfg2oc9og' user = 'aourrzrdjlrpjo' password = '12359d0fa8d70aeea4d2ef3acd96eb794f178dee42887f7c350ad49a4d78e323' host = 'ec2-18-207-95-219.compute-1.amazonaws.com' port = '5432'
# http://codeforces.com/contest/268/problem/C n, m = map(int, input().split()) d = min(n, m) print(d + 1) for i in range(d + 1): print("{} {}".format(d-i, i))
(n, m) = map(int, input().split()) d = min(n, m) print(d + 1) for i in range(d + 1): print('{} {}'.format(d - i, i))
infile = "input_file.txt" outfile = "output_file.txt" delete_list = [ # Your words you want to fill to filter. "Dog","Bird","Pig" ] with open(infile) as fin, open(outfile, "w+") as fout: for line in fin: for word in delete_list: line = line.replace(word, "") fout.write(line)
infile = 'input_file.txt' outfile = 'output_file.txt' delete_list = ['Dog', 'Bird', 'Pig'] with open(infile) as fin, open(outfile, 'w+') as fout: for line in fin: for word in delete_list: line = line.replace(word, '') fout.write(line)
answers =[ "Apple", "Apricot", "Avocado", "Banana", "Bilberry", "Blackberry", "Blackcurrant", "Blueberry", "Cherry", "Coconut", "Cranberry", "Date", "Dragonfruit", "Durian", "Grape", "Grapefruit", "Guava", "Jackfruit", "Jujube", "Kiwifruit", "Kumquat", "Lemon", "Lime", "Longan", "Lychee", "Mango", "Mangosteen", "Melon", "Cantaloupe", "Honeydew", "Watermelon", "Orange", "Mandarine", "Tangerine", "Papaya", "Passionfruit", "Peach", "Pear", "Plum", "Prune", "Pineapple", "Pomegranate", "Pomelo", "Raspberry", "Rambutan", "Salak", "Strawberry", "Tamarind", "Tomato" ]
answers = ['Apple', 'Apricot', 'Avocado', 'Banana', 'Bilberry', 'Blackberry', 'Blackcurrant', 'Blueberry', 'Cherry', 'Coconut', 'Cranberry', 'Date', 'Dragonfruit', 'Durian', 'Grape', 'Grapefruit', 'Guava', 'Jackfruit', 'Jujube', 'Kiwifruit', 'Kumquat', 'Lemon', 'Lime', 'Longan', 'Lychee', 'Mango', 'Mangosteen', 'Melon', 'Cantaloupe', 'Honeydew', 'Watermelon', 'Orange', 'Mandarine', 'Tangerine', 'Papaya', 'Passionfruit', 'Peach', 'Pear', 'Plum', 'Prune', 'Pineapple', 'Pomegranate', 'Pomelo', 'Raspberry', 'Rambutan', 'Salak', 'Strawberry', 'Tamarind', 'Tomato']
puzzle_input_list = [] with open("input.txt", "r") as puzzle_input: for line in puzzle_input: line = line.strip() puzzle_input_list.append(line) open_brackets = {"{", "(", "[", "<"} bracket_mapping = {"}": "{", ")": "(", "]": "[", ">": "<", "{": "}", "(": ")", "[": "]", "<": ">" } bracket_to_points = {")": 1, "]": 2, "}": 3, ">": 4} incomplete_lines = [] for puzzle_line in puzzle_input_list: brackets = [] valid_line = True for bracket in puzzle_line: if bracket in open_brackets: brackets.append(bracket) else: if brackets[-1] == bracket_mapping[bracket]: del brackets[-1] else: valid_line = False if valid_line is True: incomplete_lines.append(brackets) scores = [] for incomplete_line in incomplete_lines: score = 0 for character in incomplete_line[::-1]: score *= 5 score += bracket_to_points[bracket_mapping[character]] scores.append(score) scores.sort() print(scores) print(scores[len(scores)//2])
puzzle_input_list = [] with open('input.txt', 'r') as puzzle_input: for line in puzzle_input: line = line.strip() puzzle_input_list.append(line) open_brackets = {'{', '(', '[', '<'} bracket_mapping = {'}': '{', ')': '(', ']': '[', '>': '<', '{': '}', '(': ')', '[': ']', '<': '>'} bracket_to_points = {')': 1, ']': 2, '}': 3, '>': 4} incomplete_lines = [] for puzzle_line in puzzle_input_list: brackets = [] valid_line = True for bracket in puzzle_line: if bracket in open_brackets: brackets.append(bracket) elif brackets[-1] == bracket_mapping[bracket]: del brackets[-1] else: valid_line = False if valid_line is True: incomplete_lines.append(brackets) scores = [] for incomplete_line in incomplete_lines: score = 0 for character in incomplete_line[::-1]: score *= 5 score += bracket_to_points[bracket_mapping[character]] scores.append(score) scores.sort() print(scores) print(scores[len(scores) // 2])
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Average Scores #Problem level: 7 kyu def average(array): return round(sum(array)/len(array))
def average(array): return round(sum(array) / len(array))
class Allergies(object): items = { 'eggs': 1, 'peanuts': 2, 'shellfish': 4, 'strawberries': 8, 'tomatoes': 16, 'chocolate': 32, 'pollen': 64, 'cats': 128, } def __init__(self, score): self._score = score def is_allergic_to(self, item): return bool(Allergies.items.get(item, 0) & self._score) @property def lst(self): return [k for k, v in Allergies.items.items() if v & self._score]
class Allergies(object): items = {'eggs': 1, 'peanuts': 2, 'shellfish': 4, 'strawberries': 8, 'tomatoes': 16, 'chocolate': 32, 'pollen': 64, 'cats': 128} def __init__(self, score): self._score = score def is_allergic_to(self, item): return bool(Allergies.items.get(item, 0) & self._score) @property def lst(self): return [k for (k, v) in Allergies.items.items() if v & self._score]
def main(): # Let's create a dictionary with student keys and GPA values student_gpa = {"john": 3.5, "jane": 4.0, "bob": 2.8, "mary": 3.2} # There are four student records in this dictionary assert len(student_gpa) == 4 # Each student has a name key and a GPA value assert len(student_gpa.keys()) == len(student_gpa.values()) # We can get the names in isolation for student in student_gpa.keys(): assert len(student) > 2 # We can get the GPAs in isolation for gpa in student_gpa.values(): assert gpa > 2.0 # We can get the GPA for a specific student assert student_gpa["john"] == 3.5 # We can access the student and GPA simultaneously for student, gpa in student_gpa.items(): print(f"Student {student} has a {gpa} GPA") if __name__ == "__main__": main()
def main(): student_gpa = {'john': 3.5, 'jane': 4.0, 'bob': 2.8, 'mary': 3.2} assert len(student_gpa) == 4 assert len(student_gpa.keys()) == len(student_gpa.values()) for student in student_gpa.keys(): assert len(student) > 2 for gpa in student_gpa.values(): assert gpa > 2.0 assert student_gpa['john'] == 3.5 for (student, gpa) in student_gpa.items(): print(f'Student {student} has a {gpa} GPA') if __name__ == '__main__': main()
class Heap: def __init__(self,comp): self.hp = [] self.size = 0 self.comp = comp def push(self,value): self.hp.append(value) self.size += 1 self._heapifyForInsertion() def pop(self): if self.size == 0: return None value = self.hp[0] self.hp[0] = self.hp[self.size - 1] self.hp.pop() self.size -= 1 self._heapifyForDeletion() return value def _heapifyForInsertion(self): if self.size <= 1: return index = self.size - 1 parent = (index - 1) // 2 while self.comp(self.hp[index],self.hp[parent]): self.hp[index], self.hp[parent] = self.hp[parent], self.hp[index] if parent == 0: break index = parent parent = (index - 1) // 2 def _heapifyForDeletion(self): if self.size <= 1: return index = 0 lChild = 2 * index + 1 rChild = 2 * index + 2 minPos = 0 if lChild > (self.size - 1): minPos = rChild elif rChild > (self.size - 1): minPos = lChild else: minPos = lChild if self.comp(self.hp[lChild],self.hp[rChild]) else rChild while self.comp(self.hp[minPos],self.hp[index]): self.hp[index], self.hp[minPos] = self.hp[minPos], self.hp[index] index = minPos lChild = 2 * index + 1 rChild = 2 * index + 2 if lChild > (self.size - 1) and rChild > (self.size - 1): break elif lChild > (self.size - 1): minPos = rChild elif rChild > (self.size - 1): minPos = lChild else: minPos = lChild if self.comp(self.hp[lChild],self.hp[rChild]) else rChild def getHeap(self): return self.hp def Size(self): return self.size
class Heap: def __init__(self, comp): self.hp = [] self.size = 0 self.comp = comp def push(self, value): self.hp.append(value) self.size += 1 self._heapifyForInsertion() def pop(self): if self.size == 0: return None value = self.hp[0] self.hp[0] = self.hp[self.size - 1] self.hp.pop() self.size -= 1 self._heapifyForDeletion() return value def _heapify_for_insertion(self): if self.size <= 1: return index = self.size - 1 parent = (index - 1) // 2 while self.comp(self.hp[index], self.hp[parent]): (self.hp[index], self.hp[parent]) = (self.hp[parent], self.hp[index]) if parent == 0: break index = parent parent = (index - 1) // 2 def _heapify_for_deletion(self): if self.size <= 1: return index = 0 l_child = 2 * index + 1 r_child = 2 * index + 2 min_pos = 0 if lChild > self.size - 1: min_pos = rChild elif rChild > self.size - 1: min_pos = lChild else: min_pos = lChild if self.comp(self.hp[lChild], self.hp[rChild]) else rChild while self.comp(self.hp[minPos], self.hp[index]): (self.hp[index], self.hp[minPos]) = (self.hp[minPos], self.hp[index]) index = minPos l_child = 2 * index + 1 r_child = 2 * index + 2 if lChild > self.size - 1 and rChild > self.size - 1: break elif lChild > self.size - 1: min_pos = rChild elif rChild > self.size - 1: min_pos = lChild else: min_pos = lChild if self.comp(self.hp[lChild], self.hp[rChild]) else rChild def get_heap(self): return self.hp def size(self): return self.size
names = [] for i in range(10): X =str(input('')) names.append(X) print(names[2]) print(names[6]) print(names[8])
names = [] for i in range(10): x = str(input('')) names.append(X) print(names[2]) print(names[6]) print(names[8])
def addBinary(a: str, b: str) -> str: n_a = len(a) n_b = len(b) max_n = max(n_a, n_b) a = a.rjust(max_n, "0") b = b.rjust(max_n, "0") jin_bit = 0 result = "" for i in range(max_n - 1, -1, -1): tmp_a = int(a[i]) tmp_b = int(b[i]) tmp = tmp_a + tmp_b + jin_bit result = "{}{}".format(tmp % 2, result) jin_bit = tmp // 2 if jin_bit != 0: result = "{}{}".format(1, result) return result if __name__ == "__main__" : a = "11" b = "11" c = "11".rjust(2,"0") result = addBinary(a,b) print(result)
def add_binary(a: str, b: str) -> str: n_a = len(a) n_b = len(b) max_n = max(n_a, n_b) a = a.rjust(max_n, '0') b = b.rjust(max_n, '0') jin_bit = 0 result = '' for i in range(max_n - 1, -1, -1): tmp_a = int(a[i]) tmp_b = int(b[i]) tmp = tmp_a + tmp_b + jin_bit result = '{}{}'.format(tmp % 2, result) jin_bit = tmp // 2 if jin_bit != 0: result = '{}{}'.format(1, result) return result if __name__ == '__main__': a = '11' b = '11' c = '11'.rjust(2, '0') result = add_binary(a, b) print(result)
# Performance note: I benchmarked this code using a set instead of # a list for the stopwords and was surprised to find that the list # performed /better/ than the set - maybe because it's only a small # list. stopwords = ''' i a an are as at be by for from how in is it of on or that the this to was what when where '''.split() def strip_stopwords(sentence): "Removes stopwords - also normalizes whitespace" words = sentence.split() sentence = [] for word in words: if word.lower() not in stopwords: sentence.append(word) return u' '.join(sentence)
stopwords = '\ni\na\nan\nare\nas\nat\nbe\nby\nfor\nfrom\nhow\nin\nis\nit\nof\non\nor\nthat\nthe\nthis\nto\nwas\nwhat\nwhen\nwhere\n'.split() def strip_stopwords(sentence): """Removes stopwords - also normalizes whitespace""" words = sentence.split() sentence = [] for word in words: if word.lower() not in stopwords: sentence.append(word) return u' '.join(sentence)
# st2common __all__ = ["MASKED_ATTRIBUTES_BLACKLIST", "MASKED_ATTRIBUTE_VALUE"] # A blacklist of attributes which should be masked in the log messages by default. # Note: If an attribute is an object or a dict, we try to recursively process it and mask the # values. MASKED_ATTRIBUTES_BLACKLIST = [ "password", "auth_token", "token", "secret", "credentials", "st2_auth_token", ] # Value with which the masked attribute values are replaced MASKED_ATTRIBUTE_VALUE = "********"
__all__ = ['MASKED_ATTRIBUTES_BLACKLIST', 'MASKED_ATTRIBUTE_VALUE'] masked_attributes_blacklist = ['password', 'auth_token', 'token', 'secret', 'credentials', 'st2_auth_token'] masked_attribute_value = '********'
combination = [(True,True,True),(True,True,False),(True,False,True),(True,False,False),(False,True,True),(False,True,False),(False,False,True),(False,False,False)] variable = {'p':0,'q':1,'r':2} kb = '' q = '' priority = {'~':3,'v':1,'^':2} def input_rules(): global kb,q kb = (input("Enter rule : ")) q = (input("enter query : ")) def _eval(i,val1,val2): if i=='^': return val2 and val1 return val2 or val1 def evaluatePostfix(exp,comb): stack = [] for i in exp: if isOperand(i): stack.append(comb[variable[i]]) elif i == '~': val1 = stack.pop() stack.append(not val1) else: val1 = stack.pop() val2 = stack.pop() stack.append(_eval(i,val1,val2)) return stack.pop() def toPostfix(infix): stack=[] postfix = '' for c in infix: if isOperand(c): postfix += c else: if isLeftParanthesis(c): stack.append(c) elif isRightParanthesis(c): operator = stack.pop() while not isLeftParanthesis(operator): postfix += operator operator = stack.pop() else: while (not isEmpty(stack)) and hasLessOrEqualPriority(c,peek(stack)): postfix += stack.pop() stack.append(c) while (not isEmpty(stack)): postfix += stack.pop() return postfix def entailment(): global kb,q print('*'*10 + "Truth Table Reference" + '*'*10) print('kb','alpha') print('*'*10) for comb in combination: s = evaluatePostfix(toPostfix(kb),comb) f = evaluatePostfix(toPostfix(q),comb) print(s,f) print('-'*10) if s and not f: return False return True def isOperand(c): return c.isalpha() and c!= 'v' def isLeftParanthesis(c): return c=='(' def isRightParanthesis(c): return c==')' def isEmpty(stack): return len(stack)==0 def peek(stack): return stack[-1] def hasLessOrEqualPriority(c1,c2): try: return priority[c1]<=priority[c2] except KeyError: return False input_rules() ans = entailment() if ans: print("Knowledge base entails query") else: print("Knowledge base does not entail query") #test #(~qv~pvr)^(~q^p)^q # (pvq)^(~rvp)
combination = [(True, True, True), (True, True, False), (True, False, True), (True, False, False), (False, True, True), (False, True, False), (False, False, True), (False, False, False)] variable = {'p': 0, 'q': 1, 'r': 2} kb = '' q = '' priority = {'~': 3, 'v': 1, '^': 2} def input_rules(): global kb, q kb = input('Enter rule : ') q = input('enter query : ') def _eval(i, val1, val2): if i == '^': return val2 and val1 return val2 or val1 def evaluate_postfix(exp, comb): stack = [] for i in exp: if is_operand(i): stack.append(comb[variable[i]]) elif i == '~': val1 = stack.pop() stack.append(not val1) else: val1 = stack.pop() val2 = stack.pop() stack.append(_eval(i, val1, val2)) return stack.pop() def to_postfix(infix): stack = [] postfix = '' for c in infix: if is_operand(c): postfix += c elif is_left_paranthesis(c): stack.append(c) elif is_right_paranthesis(c): operator = stack.pop() while not is_left_paranthesis(operator): postfix += operator operator = stack.pop() else: while not is_empty(stack) and has_less_or_equal_priority(c, peek(stack)): postfix += stack.pop() stack.append(c) while not is_empty(stack): postfix += stack.pop() return postfix def entailment(): global kb, q print('*' * 10 + 'Truth Table Reference' + '*' * 10) print('kb', 'alpha') print('*' * 10) for comb in combination: s = evaluate_postfix(to_postfix(kb), comb) f = evaluate_postfix(to_postfix(q), comb) print(s, f) print('-' * 10) if s and (not f): return False return True def is_operand(c): return c.isalpha() and c != 'v' def is_left_paranthesis(c): return c == '(' def is_right_paranthesis(c): return c == ')' def is_empty(stack): return len(stack) == 0 def peek(stack): return stack[-1] def has_less_or_equal_priority(c1, c2): try: return priority[c1] <= priority[c2] except KeyError: return False input_rules() ans = entailment() if ans: print('Knowledge base entails query') else: print('Knowledge base does not entail query')
{ 'includes': [ 'common.gypi', ], 'targets': [ { 'target_name': 'svg', 'type': 'static_library', 'include_dirs': [ '../include/config', '../include/core', '../include/xml', '../include/utils', '../include/svg', ], 'sources': [ '../include/svg/SkSVGAttribute.h', '../include/svg/SkSVGBase.h', '../include/svg/SkSVGPaintState.h', '../include/svg/SkSVGParser.h', '../include/svg/SkSVGTypes.h', '../src/svg/SkSVGCircle.cpp', '../src/svg/SkSVGCircle.h', '../src/svg/SkSVGClipPath.cpp', '../src/svg/SkSVGClipPath.h', '../src/svg/SkSVGDefs.cpp', '../src/svg/SkSVGDefs.h', '../src/svg/SkSVGElements.cpp', '../src/svg/SkSVGElements.h', '../src/svg/SkSVGEllipse.cpp', '../src/svg/SkSVGEllipse.h', '../src/svg/SkSVGFeColorMatrix.cpp', '../src/svg/SkSVGFeColorMatrix.h', '../src/svg/SkSVGFilter.cpp', '../src/svg/SkSVGFilter.h', '../src/svg/SkSVGG.cpp', '../src/svg/SkSVGG.h', '../src/svg/SkSVGGradient.cpp', '../src/svg/SkSVGGradient.h', '../src/svg/SkSVGGroup.cpp', '../src/svg/SkSVGGroup.h', '../src/svg/SkSVGImage.cpp', '../src/svg/SkSVGImage.h', '../src/svg/SkSVGLine.cpp', '../src/svg/SkSVGLine.h', '../src/svg/SkSVGLinearGradient.cpp', '../src/svg/SkSVGLinearGradient.h', '../src/svg/SkSVGMask.cpp', '../src/svg/SkSVGMask.h', '../src/svg/SkSVGMetadata.cpp', '../src/svg/SkSVGMetadata.h', '../src/svg/SkSVGPaintState.cpp', '../src/svg/SkSVGParser.cpp', '../src/svg/SkSVGPath.cpp', '../src/svg/SkSVGPath.h', '../src/svg/SkSVGPolygon.cpp', '../src/svg/SkSVGPolygon.h', '../src/svg/SkSVGPolyline.cpp', '../src/svg/SkSVGPolyline.h', '../src/svg/SkSVGRadialGradient.cpp', '../src/svg/SkSVGRadialGradient.h', '../src/svg/SkSVGRect.cpp', '../src/svg/SkSVGRect.h', '../src/svg/SkSVGStop.cpp', '../src/svg/SkSVGStop.h', '../src/svg/SkSVGSVG.cpp', '../src/svg/SkSVGSVG.h', '../src/svg/SkSVGSymbol.cpp', '../src/svg/SkSVGSymbol.h', '../src/svg/SkSVGText.cpp', '../src/svg/SkSVGText.h', '../src/svg/SkSVGUse.cpp', ], 'sources!' : [ '../src/svg/SkSVG.cpp', # doesn't compile, maybe this is test code? ], 'direct_dependent_settings': { 'include_dirs': [ '../include/svg', ], }, }, ], } # Local Variables: # tab-width:2 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=2 shiftwidth=2:
{'includes': ['common.gypi'], 'targets': [{'target_name': 'svg', 'type': 'static_library', 'include_dirs': ['../include/config', '../include/core', '../include/xml', '../include/utils', '../include/svg'], 'sources': ['../include/svg/SkSVGAttribute.h', '../include/svg/SkSVGBase.h', '../include/svg/SkSVGPaintState.h', '../include/svg/SkSVGParser.h', '../include/svg/SkSVGTypes.h', '../src/svg/SkSVGCircle.cpp', '../src/svg/SkSVGCircle.h', '../src/svg/SkSVGClipPath.cpp', '../src/svg/SkSVGClipPath.h', '../src/svg/SkSVGDefs.cpp', '../src/svg/SkSVGDefs.h', '../src/svg/SkSVGElements.cpp', '../src/svg/SkSVGElements.h', '../src/svg/SkSVGEllipse.cpp', '../src/svg/SkSVGEllipse.h', '../src/svg/SkSVGFeColorMatrix.cpp', '../src/svg/SkSVGFeColorMatrix.h', '../src/svg/SkSVGFilter.cpp', '../src/svg/SkSVGFilter.h', '../src/svg/SkSVGG.cpp', '../src/svg/SkSVGG.h', '../src/svg/SkSVGGradient.cpp', '../src/svg/SkSVGGradient.h', '../src/svg/SkSVGGroup.cpp', '../src/svg/SkSVGGroup.h', '../src/svg/SkSVGImage.cpp', '../src/svg/SkSVGImage.h', '../src/svg/SkSVGLine.cpp', '../src/svg/SkSVGLine.h', '../src/svg/SkSVGLinearGradient.cpp', '../src/svg/SkSVGLinearGradient.h', '../src/svg/SkSVGMask.cpp', '../src/svg/SkSVGMask.h', '../src/svg/SkSVGMetadata.cpp', '../src/svg/SkSVGMetadata.h', '../src/svg/SkSVGPaintState.cpp', '../src/svg/SkSVGParser.cpp', '../src/svg/SkSVGPath.cpp', '../src/svg/SkSVGPath.h', '../src/svg/SkSVGPolygon.cpp', '../src/svg/SkSVGPolygon.h', '../src/svg/SkSVGPolyline.cpp', '../src/svg/SkSVGPolyline.h', '../src/svg/SkSVGRadialGradient.cpp', '../src/svg/SkSVGRadialGradient.h', '../src/svg/SkSVGRect.cpp', '../src/svg/SkSVGRect.h', '../src/svg/SkSVGStop.cpp', '../src/svg/SkSVGStop.h', '../src/svg/SkSVGSVG.cpp', '../src/svg/SkSVGSVG.h', '../src/svg/SkSVGSymbol.cpp', '../src/svg/SkSVGSymbol.h', '../src/svg/SkSVGText.cpp', '../src/svg/SkSVGText.h', '../src/svg/SkSVGUse.cpp'], 'sources!': ['../src/svg/SkSVG.cpp'], 'direct_dependent_settings': {'include_dirs': ['../include/svg']}}]}
def SetUpGame(): global WreckContainer, ShipContainer, PlanetContainer, ArchiveContainer, playerShip, gameData, SystemContainer GameData = gameData() GameData.tutorial = False PlanetContainer = [Planet(0, -1050, 1000)] GameData.homePlanet = PlanetContainer[0] GameData.tasks = [] PlanetContainer[0].baseAt = 0 ShipContainer = [] ShipContainer.append(enemyShip(200, 200, 0, 0, 2, (0, -1050, 1500))) WreckContainer = [] SystemContainer = [(0, 0, "Home System")] for newPlanetX in range(-1, 2): for newPlanetY in range(-1, 2): if newPlanetX == 0 and newPlanetY == 0: continue PlanetContainer.append( Planet( newPlanetX * 20000 + random.randint(-8000, 8000), newPlanetY * 18000 + random.randint(-6000, 6000), random.randint(250, 1500), ) ) PlanetContainer[-1].enemyAt = random.choice( (None, random.randint(0, 360))) PlanetContainer[0].playerLanded = "base" ArchiveContainer = [] playerShip.X = 0 playerShip.Y = 25 playerShip.angle = 0 playerShip.faceAngle = 180 playerShip.speed = 0 playerShip.hull = 592 playerShip.toX = 0 playerShip.toY = 0 playerView.X = 0 playerView.Y = 0 playerView.angle = 0 playerView.zoomfactor = 1 gameData.basesBuilt = 0 playerShip.oil = 1000 star.params = ( random.random(), random.random(), random.random(), random.random(), random.random(), ) checkProgress("game started")
def set_up_game(): global WreckContainer, ShipContainer, PlanetContainer, ArchiveContainer, playerShip, gameData, SystemContainer game_data = game_data() GameData.tutorial = False planet_container = [planet(0, -1050, 1000)] GameData.homePlanet = PlanetContainer[0] GameData.tasks = [] PlanetContainer[0].baseAt = 0 ship_container = [] ShipContainer.append(enemy_ship(200, 200, 0, 0, 2, (0, -1050, 1500))) wreck_container = [] system_container = [(0, 0, 'Home System')] for new_planet_x in range(-1, 2): for new_planet_y in range(-1, 2): if newPlanetX == 0 and newPlanetY == 0: continue PlanetContainer.append(planet(newPlanetX * 20000 + random.randint(-8000, 8000), newPlanetY * 18000 + random.randint(-6000, 6000), random.randint(250, 1500))) PlanetContainer[-1].enemyAt = random.choice((None, random.randint(0, 360))) PlanetContainer[0].playerLanded = 'base' archive_container = [] playerShip.X = 0 playerShip.Y = 25 playerShip.angle = 0 playerShip.faceAngle = 180 playerShip.speed = 0 playerShip.hull = 592 playerShip.toX = 0 playerShip.toY = 0 playerView.X = 0 playerView.Y = 0 playerView.angle = 0 playerView.zoomfactor = 1 gameData.basesBuilt = 0 playerShip.oil = 1000 star.params = (random.random(), random.random(), random.random(), random.random(), random.random()) check_progress('game started')
class SearchGoogleNewsError(Exception): pass class SearchGoogleNewsDataSourceNotFound(Exception): pass class SearchGoogleNewsParseError(Exception): pass
class Searchgooglenewserror(Exception): pass class Searchgooglenewsdatasourcenotfound(Exception): pass class Searchgooglenewsparseerror(Exception): pass
#!/usr/bin/env python3 # Character Picture Grid grid = [ [".", ".", ".", ".", ".", "."], [".", "O", "O", ".", ".", "."], ["O", "O", "O", "O", ".", "."], ["O", "O", "O", "O", "O", "."], [".", "O", "O", "O", "O", "O"], ["O", "O", "O", "O", "O", "."], ["O", "O", "O", "O", ".", "."], [".", "O", "O", ".", ".", "."], [".", ".", ".", ".", ".", "."], ] rows = len(grid) columns = len(grid[0]) for x in range(columns): for y in range(rows): print(grid[y][x], end="") print()
grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['.', '.', '.', '.', '.', '.']] rows = len(grid) columns = len(grid[0]) for x in range(columns): for y in range(rows): print(grid[y][x], end='') print()
# # PySNMP MIB module HH3C-VM-MAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-VM-MAN-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:30:16 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") SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint") entPhysicalAssetID, = mibBuilder.importSymbols("ENTITY-MIB", "entPhysicalAssetID") hh3cSurveillanceMIB, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3cSurveillanceMIB") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, TimeTicks, ModuleIdentity, NotificationType, ObjectIdentity, IpAddress, MibIdentifier, Integer32, iso, Bits, Gauge32, Counter32, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "TimeTicks", "ModuleIdentity", "NotificationType", "ObjectIdentity", "IpAddress", "MibIdentifier", "Integer32", "iso", "Bits", "Gauge32", "Counter32", "Unsigned32") DateAndTime, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "DateAndTime", "TextualConvention", "DisplayString") hh3cVMMan = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 9, 1)) if mibBuilder.loadTexts: hh3cVMMan.setLastUpdated('200704130000Z') if mibBuilder.loadTexts: hh3cVMMan.setOrganization('Hangzhou H3C Tech. Co., Ltd.') if mibBuilder.loadTexts: hh3cVMMan.setContactInfo('Platform Team Hangzhou H3C Tech. Co., Ltd. Hai-Dian District Beijing P.R. China http://www.h3c.com Zip:100085 ') if mibBuilder.loadTexts: hh3cVMMan.setDescription('VM is one of surveillance features, implementing user authentication, configuration management, network management and control signalling forwarding. This MIB contains objects to manage the VM feature.') hh3cVMManMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1)) hh3cVMCapabilitySet = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 1), Bits().clone(namedValues=NamedValues(("cms", 0), ("css", 1), ("dm", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cVMCapabilitySet.setStatus('current') if mibBuilder.loadTexts: hh3cVMCapabilitySet.setDescription('Components included in the VM feature represented by bit fields. VM feature includes three componets: CMS(Central Management Server), CSS(Control Signalling Server) and DM(Data Managment). A bit set to 1 indicates the corresponding component of this bit is included otherwise indicates the corresponding component of this bit is not included. VM can include one or more components at one time. ') hh3cVMStat = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2)) hh3cVMStatTotalConnEstablishRequests = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cVMStatTotalConnEstablishRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatTotalConnEstablishRequests.setDescription('The total number of establishment requests for video connection.') hh3cVMStatSuccConnEstablishRequests = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cVMStatSuccConnEstablishRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatSuccConnEstablishRequests.setDescription('The total number of successful establishment requests for video connection.') hh3cVMStatFailConnEstablishRequests = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cVMStatFailConnEstablishRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatFailConnEstablishRequests.setDescription('The total number of unsuccessful establishment requests for video connection.') hh3cVMStatTotalConnReleaseRequests = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cVMStatTotalConnReleaseRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatTotalConnReleaseRequests.setDescription('The total number of release requests for video connection.') hh3cVMStatSuccConnReleaseRequests = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cVMStatSuccConnReleaseRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatSuccConnReleaseRequests.setDescription('The total number of successful release requests for video connection.') hh3cVMStatFailConnReleaseRequests = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cVMStatFailConnReleaseRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatFailConnReleaseRequests.setDescription('The total number of unsuccessful release requests for video connection.') hh3cVMStatExceptionTerminationConn = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cVMStatExceptionTerminationConn.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatExceptionTerminationConn.setDescription('The total number of exceptional termination for video connection.') hh3cVMManMIBTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2)) hh3cVMManTrapPrex = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0)) hh3cVMManDeviceOnlineTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 1)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName")) if mibBuilder.loadTexts: hh3cVMManDeviceOnlineTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManDeviceOnlineTrap.setDescription('Send a trap about the device having been registered to VM.') hh3cVMManDeviceOfflineTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 2)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName")) if mibBuilder.loadTexts: hh3cVMManDeviceOfflineTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManDeviceOfflineTrap.setDescription('Send a trap about the device having been unregistered to VM.') hh3cVMManForwardDeviceExternalSemaphoreTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 3)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUExternalInputAlarmChannelID")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceExternalSemaphoreTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceExternalSemaphoreTrap.setDescription('Forward a trap about external semaphore alarm, which is created by the third party device.') hh3cVMManForwardDeviceVideoLossTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 4)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceVideoLossTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceVideoLossTrap.setDescription('Forward a trap about video loss, which is created by the third party device.') hh3cVMManForwardDeviceVideoRecoverTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 5)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceVideoRecoverTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceVideoRecoverTrap.setDescription('Forward a trap about video recovery after loss, which is created by the third party device.') hh3cVMManForwardDeviceMotionDetectTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 6)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegionCoordinateX1"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegionCoordinateY1"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegionCoordinateX2"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegionCoordinateY2")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceMotionDetectTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceMotionDetectTrap.setDescription('Forward a trap about motion detection, which is created by the third party device.') hh3cVMManForwardDeviceCoverTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 7)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegionCoordinateX1"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegionCoordinateY1"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegionCoordinateX2"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegionCoordinateY2")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceCoverTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceCoverTrap.setDescription('Forward a trap about video cover, which is created by the third party device.') hh3cVMManForwardDeviceCpuUsageThresholdTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 8)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManCpuUsage"), ("HH3C-VM-MAN-MIB", "hh3cVMManCpuUsageThreshold")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceCpuUsageThresholdTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceCpuUsageThresholdTrap.setDescription('Forward a trap about cpu usage exceeding its threshold, which is created by the third party device.') hh3cVMManForwardDeviceMemUsageThresholdTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 9)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManMemUsage"), ("HH3C-VM-MAN-MIB", "hh3cVMManMemUsageThreshold")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceMemUsageThresholdTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceMemUsageThresholdTrap.setDescription('Forward a trap about memory usage exceeding its threshold, which is created by the third party device.') hh3cVMManForwardDeviceHardDiskUsageThresholdTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 10)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManHardDiskUsage"), ("HH3C-VM-MAN-MIB", "hh3cVMManHardDiskUsageThreshold")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceHardDiskUsageThresholdTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceHardDiskUsageThresholdTrap.setDescription('Forward a trap about harddisk usage exceeding its threshold, which is created by the third party device.') hh3cVMManForwardDeviceTemperatureThresholdTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 11)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManTemperature"), ("HH3C-VM-MAN-MIB", "hh3cVMManTemperatureThreshold")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceTemperatureThresholdTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceTemperatureThresholdTrap.setDescription('Forward a trap about temperature exceeding its threshold, which is created by the third party device.') hh3cVMManForwardDeviceStartKinescopeTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 12)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceStartKinescopeTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceStartKinescopeTrap.setDescription('Forward a trap about starting kinescope, which is created by the third party device.') hh3cVMManForwardDeviceStopKinescopeTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 13)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName")) if mibBuilder.loadTexts: hh3cVMManForwardDeviceStopKinescopeTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceStopKinescopeTrap.setDescription('Forward a trap about stopping kinescope, which is created by the third party device.') hh3cVMManClientReportTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 14)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManUserName"), ("HH3C-VM-MAN-MIB", "hh3cVMManReportContent")) if mibBuilder.loadTexts: hh3cVMManClientReportTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientReportTrap.setDescription('Send a trap about the fault which is reported by clients.') hh3cVMManClientRealtimeSurveillanceNoVideoTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 15)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManUserName"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName")) if mibBuilder.loadTexts: hh3cVMManClientRealtimeSurveillanceNoVideoTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientRealtimeSurveillanceNoVideoTrap.setDescription("Send a trap about no realtime surveillance video stream which is reported by clients. hh3cVMManRegDevIP, entPhysicalAssetID, hh3cVMManRegDevName and hh3cVMManPUECVideoChannelName describe an EC's relative information. ") hh3cVMManClientVODNoVideoTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 16)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManUserName"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVODStart"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVODEnd"), ("HH3C-VM-MAN-MIB", "hh3cVMManIPSANDevIP")) if mibBuilder.loadTexts: hh3cVMManClientVODNoVideoTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODNoVideoTrap.setDescription("Send a trap about no VOD video stream which is reported by clients. hh3cVMManRegDevIP, entPhysicalAssetID, hh3cVMManRegDevName and hh3cVMManPUECVideoChannelName describe an EC's relative information.") hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 17)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManUserName"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVideoStreamDiscontinuityInterval"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientStatPeriod")) if mibBuilder.loadTexts: hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap.setDescription("Send a trap about the realtime surveillance video stream discontinuity which is reported by clients. entPhysicalAssetID, hh3cVMManRegDevIP, hh3cVMManRegDevName and hh3cVMManPUECVideoChannelName describe an EC's relative information.") hh3cVMManClientVODVideoStreamDiscontinuityTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 18)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManUserName"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevName"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVODStart"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVODEnd"), ("HH3C-VM-MAN-MIB", "hh3cVMManIPSANDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVideoStreamDiscontinuityInterval"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientStatPeriod")) if mibBuilder.loadTexts: hh3cVMManClientVODVideoStreamDiscontinuityTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODVideoStreamDiscontinuityTrap.setDescription("Send a trap about the VOD video stream discontinuity which is reported by clients. hh3cVMManRegDevIP, entPhysicalAssetID, hh3cVMManRegDevName and hh3cVMManPUECVideoChannelName describe an EC's relative information.") hh3cVMManClientCtlConnExceptionTerminationTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 19)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManUserName")) if mibBuilder.loadTexts: hh3cVMManClientCtlConnExceptionTerminationTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientCtlConnExceptionTerminationTrap.setDescription('Send a trap about the exceptional termination for control connection. ') hh3cVMManClientFrequencyLoginFailTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 20)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManUserName"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientLoginFailNum"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientLoginFailNumThreshold"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientStatPeriod")) if mibBuilder.loadTexts: hh3cVMManClientFrequencyLoginFailTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientFrequencyLoginFailTrap.setDescription('Send a trap about the frequency of client login failure.') hh3cVMManClientFrequencyVODFailTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 21)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManUserName"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVODFailNum"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientVODFailNumThreshold"), ("HH3C-VM-MAN-MIB", "hh3cVMManClientStatPeriod")) if mibBuilder.loadTexts: hh3cVMManClientFrequencyVODFailTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientFrequencyVODFailTrap.setDescription('Send a trap about the frequency of client VOD failure.') hh3cVMManDMECDisobeyStorageScheduleTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 22)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName")) if mibBuilder.loadTexts: hh3cVMManDMECDisobeyStorageScheduleTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManDMECDisobeyStorageScheduleTrap.setDescription('Send a trap about EC disobeying storage schedule created by DM.') hh3cVMManDMECDisobeyStorageScheduleRecoverTrap = NotificationType((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 23)).setObjects(("ENTITY-MIB", "entPhysicalAssetID"), ("HH3C-VM-MAN-MIB", "hh3cVMManRegDevIP"), ("HH3C-VM-MAN-MIB", "hh3cVMManPUECVideoChannelName")) if mibBuilder.loadTexts: hh3cVMManDMECDisobeyStorageScheduleRecoverTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManDMECDisobeyStorageScheduleRecoverTrap.setDescription('Send a trap about recovery after EC disobeying storage schedule created by DM.') hh3cVMManTrapObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1)) hh3cVMManIPSANDevIP = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 1), IpAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManIPSANDevIP.setStatus('current') if mibBuilder.loadTexts: hh3cVMManIPSANDevIP.setDescription('IP address of IPSAN Device which can store video data.') hh3cVMManRegDevIP = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 2), IpAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManRegDevIP.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegDevIP.setDescription('IP address of devices which can registered or unregistered to VM.') hh3cVMManRegDevName = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManRegDevName.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegDevName.setDescription('Name of devices which can registered or unregistered to VM.') hh3cVMManRegionCoordinateX1 = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 4), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManRegionCoordinateX1.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateX1.setDescription('The horizontal coordinate of top left point of the motion detection region.') hh3cVMManRegionCoordinateY1 = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 5), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManRegionCoordinateY1.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateY1.setDescription('The vertical coordinate of top left point of the motion detection region.') hh3cVMManRegionCoordinateX2 = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 6), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManRegionCoordinateX2.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateX2.setDescription('The horizontal coordinate of botton right point of the motion detection region.') hh3cVMManRegionCoordinateY2 = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 7), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManRegionCoordinateY2.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateY2.setDescription('The horizontal coordinate of botton right point of the motion detection region.') hh3cVMManCpuUsage = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManCpuUsage.setStatus('current') if mibBuilder.loadTexts: hh3cVMManCpuUsage.setDescription('The CPU usage for this entity. Generally, the CPU usage will caculate the overall CPU usage on the entity, and it is not sensible with the number of CPU on the entity. ') hh3cVMManCpuUsageThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManCpuUsageThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManCpuUsageThreshold.setDescription('The threshold for the CPU usage. When the CPU usage exceeds the threshold, a notification will be sent.') hh3cVMManMemUsage = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 10), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManMemUsage.setStatus('current') if mibBuilder.loadTexts: hh3cVMManMemUsage.setDescription('The memory usage for the entity. This object indicates what percent of memory are used. ') hh3cVMManMemUsageThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManMemUsageThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManMemUsageThreshold.setDescription('The threshold for the Memory usage. When the memory usage exceeds the threshold, a notification will be sent. ') hh3cVMManHardDiskUsage = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManHardDiskUsage.setStatus('current') if mibBuilder.loadTexts: hh3cVMManHardDiskUsage.setDescription('The hard disk usage for the entity. This object indicates what percent of hard disk are used. ') hh3cVMManHardDiskUsageThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 13), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManHardDiskUsageThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManHardDiskUsageThreshold.setDescription('The threshold for the hard disk usage. When the hard disk usage exceeds the threshold, a notification will be sent. ') hh3cVMManTemperature = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 14), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManTemperature.setStatus('current') if mibBuilder.loadTexts: hh3cVMManTemperature.setDescription('The temperature for the entity. ') hh3cVMManTemperatureThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 15), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManTemperatureThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManTemperatureThreshold.setDescription('The threshold for the temperature. When the temperature exceeds the threshold, a notification will be sent. ') hh3cVMManClientIP = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 16), IpAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientIP.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientIP.setDescription('The client device IP address.') hh3cVMManUserName = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 17), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManUserName.setStatus('current') if mibBuilder.loadTexts: hh3cVMManUserName.setDescription('The client user name.') hh3cVMManReportContent = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 18), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManReportContent.setStatus('current') if mibBuilder.loadTexts: hh3cVMManReportContent.setDescription('The details of the fault which reported by clients') hh3cVMManClientVideoStreamDiscontinuityInterval = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 19), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientVideoStreamDiscontinuityInterval.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVideoStreamDiscontinuityInterval.setDescription('Video stream discontinuity interval. ') hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 20), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold.setDescription('The threshold for the video stream discontinuity interval. When the discontinuity interval exceeds the threshold, a notification will be sent. ') hh3cVMManClientStatPeriod = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 21), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientStatPeriod.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientStatPeriod.setDescription('The client statistic period. ') hh3cVMManClientLoginFailNum = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 22), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientLoginFailNum.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientLoginFailNum.setDescription('The total number of client login failure in last statistic period which is defined by hh3cVMManClientStatPeriod entity.') hh3cVMManClientLoginFailNumThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 23), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientLoginFailNumThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientLoginFailNumThreshold.setDescription('The threshold for the total number of client login failure in last statistic period. When the number exceeds the threshold, a notification will be sent. ') hh3cVMManClientVODFailNum = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 24), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientVODFailNum.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODFailNum.setDescription('The total number of client VOD failure in last statistic period which is defined by hh3cVMManClientStatPeriod entity.') hh3cVMManClientVODFailNumThreshold = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 25), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientVODFailNumThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODFailNumThreshold.setDescription('The threshold for the total number of client VOD failure in last statistic period. When the number exceeds the threshold, a notification will be sent. ') hh3cVMManClientVODStart = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 26), DateAndTime()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientVODStart.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODStart.setDescription('The start time for VOD.') hh3cVMManClientVODEnd = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 27), DateAndTime()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManClientVODEnd.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODEnd.setDescription('The end time for VOD.') hh3cVMManPUExternalInputAlarmChannelID = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 28), Unsigned32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManPUExternalInputAlarmChannelID.setStatus('current') if mibBuilder.loadTexts: hh3cVMManPUExternalInputAlarmChannelID.setDescription('The ID of the external input alarm channel.') hh3cVMManPUECVideoChannelName = MibScalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 29), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hh3cVMManPUECVideoChannelName.setStatus('current') if mibBuilder.loadTexts: hh3cVMManPUECVideoChannelName.setDescription('The name of the video channel. It is suggested that the name includes the channel ID information.') mibBuilder.exportSymbols("HH3C-VM-MAN-MIB", hh3cVMManPUExternalInputAlarmChannelID=hh3cVMManPUExternalInputAlarmChannelID, hh3cVMManClientVODEnd=hh3cVMManClientVODEnd, hh3cVMManDMECDisobeyStorageScheduleRecoverTrap=hh3cVMManDMECDisobeyStorageScheduleRecoverTrap, hh3cVMManDeviceOfflineTrap=hh3cVMManDeviceOfflineTrap, hh3cVMManIPSANDevIP=hh3cVMManIPSANDevIP, hh3cVMManTemperatureThreshold=hh3cVMManTemperatureThreshold, hh3cVMManClientStatPeriod=hh3cVMManClientStatPeriod, hh3cVMManForwardDeviceCpuUsageThresholdTrap=hh3cVMManForwardDeviceCpuUsageThresholdTrap, hh3cVMManClientRealtimeSurveillanceNoVideoTrap=hh3cVMManClientRealtimeSurveillanceNoVideoTrap, hh3cVMManClientVODFailNumThreshold=hh3cVMManClientVODFailNumThreshold, hh3cVMMan=hh3cVMMan, hh3cVMStatFailConnEstablishRequests=hh3cVMStatFailConnEstablishRequests, hh3cVMStatTotalConnEstablishRequests=hh3cVMStatTotalConnEstablishRequests, hh3cVMStat=hh3cVMStat, hh3cVMStatSuccConnEstablishRequests=hh3cVMStatSuccConnEstablishRequests, hh3cVMStatExceptionTerminationConn=hh3cVMStatExceptionTerminationConn, hh3cVMManForwardDeviceExternalSemaphoreTrap=hh3cVMManForwardDeviceExternalSemaphoreTrap, hh3cVMManForwardDeviceStopKinescopeTrap=hh3cVMManForwardDeviceStopKinescopeTrap, hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap=hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap, hh3cVMManCpuUsageThreshold=hh3cVMManCpuUsageThreshold, hh3cVMManUserName=hh3cVMManUserName, hh3cVMManClientFrequencyLoginFailTrap=hh3cVMManClientFrequencyLoginFailTrap, hh3cVMManReportContent=hh3cVMManReportContent, hh3cVMManPUECVideoChannelName=hh3cVMManPUECVideoChannelName, hh3cVMStatFailConnReleaseRequests=hh3cVMStatFailConnReleaseRequests, hh3cVMManForwardDeviceMotionDetectTrap=hh3cVMManForwardDeviceMotionDetectTrap, hh3cVMManForwardDeviceHardDiskUsageThresholdTrap=hh3cVMManForwardDeviceHardDiskUsageThresholdTrap, hh3cVMManTrapPrex=hh3cVMManTrapPrex, hh3cVMStatTotalConnReleaseRequests=hh3cVMStatTotalConnReleaseRequests, hh3cVMManForwardDeviceStartKinescopeTrap=hh3cVMManForwardDeviceStartKinescopeTrap, hh3cVMManClientVODNoVideoTrap=hh3cVMManClientVODNoVideoTrap, hh3cVMManRegionCoordinateY2=hh3cVMManRegionCoordinateY2, hh3cVMManCpuUsage=hh3cVMManCpuUsage, hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold=hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold, hh3cVMManClientVODStart=hh3cVMManClientVODStart, hh3cVMManMIBTrap=hh3cVMManMIBTrap, hh3cVMCapabilitySet=hh3cVMCapabilitySet, hh3cVMManRegionCoordinateY1=hh3cVMManRegionCoordinateY1, hh3cVMManMIBObjects=hh3cVMManMIBObjects, hh3cVMManForwardDeviceTemperatureThresholdTrap=hh3cVMManForwardDeviceTemperatureThresholdTrap, hh3cVMManClientCtlConnExceptionTerminationTrap=hh3cVMManClientCtlConnExceptionTerminationTrap, hh3cVMManForwardDeviceMemUsageThresholdTrap=hh3cVMManForwardDeviceMemUsageThresholdTrap, hh3cVMManClientFrequencyVODFailTrap=hh3cVMManClientFrequencyVODFailTrap, hh3cVMManDMECDisobeyStorageScheduleTrap=hh3cVMManDMECDisobeyStorageScheduleTrap, hh3cVMManRegDevIP=hh3cVMManRegDevIP, hh3cVMManMemUsage=hh3cVMManMemUsage, hh3cVMManTemperature=hh3cVMManTemperature, hh3cVMManClientLoginFailNumThreshold=hh3cVMManClientLoginFailNumThreshold, hh3cVMManClientVODFailNum=hh3cVMManClientVODFailNum, hh3cVMManClientReportTrap=hh3cVMManClientReportTrap, hh3cVMManHardDiskUsage=hh3cVMManHardDiskUsage, hh3cVMManDeviceOnlineTrap=hh3cVMManDeviceOnlineTrap, hh3cVMManForwardDeviceVideoLossTrap=hh3cVMManForwardDeviceVideoLossTrap, hh3cVMManClientLoginFailNum=hh3cVMManClientLoginFailNum, hh3cVMManRegionCoordinateX1=hh3cVMManRegionCoordinateX1, hh3cVMManRegDevName=hh3cVMManRegDevName, hh3cVMManClientIP=hh3cVMManClientIP, PYSNMP_MODULE_ID=hh3cVMMan, hh3cVMManClientVODVideoStreamDiscontinuityTrap=hh3cVMManClientVODVideoStreamDiscontinuityTrap, hh3cVMManTrapObjects=hh3cVMManTrapObjects, hh3cVMManClientVideoStreamDiscontinuityInterval=hh3cVMManClientVideoStreamDiscontinuityInterval, hh3cVMManForwardDeviceCoverTrap=hh3cVMManForwardDeviceCoverTrap, hh3cVMManRegionCoordinateX2=hh3cVMManRegionCoordinateX2, hh3cVMStatSuccConnReleaseRequests=hh3cVMStatSuccConnReleaseRequests, hh3cVMManMemUsageThreshold=hh3cVMManMemUsageThreshold, hh3cVMManHardDiskUsageThreshold=hh3cVMManHardDiskUsageThreshold, hh3cVMManForwardDeviceVideoRecoverTrap=hh3cVMManForwardDeviceVideoRecoverTrap)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_intersection, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueSizeConstraint') (ent_physical_asset_id,) = mibBuilder.importSymbols('ENTITY-MIB', 'entPhysicalAssetID') (hh3c_surveillance_mib,) = mibBuilder.importSymbols('HH3C-OID-MIB', 'hh3cSurveillanceMIB') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, time_ticks, module_identity, notification_type, object_identity, ip_address, mib_identifier, integer32, iso, bits, gauge32, counter32, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'TimeTicks', 'ModuleIdentity', 'NotificationType', 'ObjectIdentity', 'IpAddress', 'MibIdentifier', 'Integer32', 'iso', 'Bits', 'Gauge32', 'Counter32', 'Unsigned32') (date_and_time, textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'DateAndTime', 'TextualConvention', 'DisplayString') hh3c_vm_man = module_identity((1, 3, 6, 1, 4, 1, 25506, 9, 1)) if mibBuilder.loadTexts: hh3cVMMan.setLastUpdated('200704130000Z') if mibBuilder.loadTexts: hh3cVMMan.setOrganization('Hangzhou H3C Tech. Co., Ltd.') if mibBuilder.loadTexts: hh3cVMMan.setContactInfo('Platform Team Hangzhou H3C Tech. Co., Ltd. Hai-Dian District Beijing P.R. China http://www.h3c.com Zip:100085 ') if mibBuilder.loadTexts: hh3cVMMan.setDescription('VM is one of surveillance features, implementing user authentication, configuration management, network management and control signalling forwarding. This MIB contains objects to manage the VM feature.') hh3c_vm_man_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1)) hh3c_vm_capability_set = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 1), bits().clone(namedValues=named_values(('cms', 0), ('css', 1), ('dm', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cVMCapabilitySet.setStatus('current') if mibBuilder.loadTexts: hh3cVMCapabilitySet.setDescription('Components included in the VM feature represented by bit fields. VM feature includes three componets: CMS(Central Management Server), CSS(Control Signalling Server) and DM(Data Managment). A bit set to 1 indicates the corresponding component of this bit is included otherwise indicates the corresponding component of this bit is not included. VM can include one or more components at one time. ') hh3c_vm_stat = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2)) hh3c_vm_stat_total_conn_establish_requests = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cVMStatTotalConnEstablishRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatTotalConnEstablishRequests.setDescription('The total number of establishment requests for video connection.') hh3c_vm_stat_succ_conn_establish_requests = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cVMStatSuccConnEstablishRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatSuccConnEstablishRequests.setDescription('The total number of successful establishment requests for video connection.') hh3c_vm_stat_fail_conn_establish_requests = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cVMStatFailConnEstablishRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatFailConnEstablishRequests.setDescription('The total number of unsuccessful establishment requests for video connection.') hh3c_vm_stat_total_conn_release_requests = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cVMStatTotalConnReleaseRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatTotalConnReleaseRequests.setDescription('The total number of release requests for video connection.') hh3c_vm_stat_succ_conn_release_requests = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cVMStatSuccConnReleaseRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatSuccConnReleaseRequests.setDescription('The total number of successful release requests for video connection.') hh3c_vm_stat_fail_conn_release_requests = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cVMStatFailConnReleaseRequests.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatFailConnReleaseRequests.setDescription('The total number of unsuccessful release requests for video connection.') hh3c_vm_stat_exception_termination_conn = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 1, 2, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hh3cVMStatExceptionTerminationConn.setStatus('current') if mibBuilder.loadTexts: hh3cVMStatExceptionTerminationConn.setDescription('The total number of exceptional termination for video connection.') hh3c_vm_man_mib_trap = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2)) hh3c_vm_man_trap_prex = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0)) hh3c_vm_man_device_online_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 1)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName')) if mibBuilder.loadTexts: hh3cVMManDeviceOnlineTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManDeviceOnlineTrap.setDescription('Send a trap about the device having been registered to VM.') hh3c_vm_man_device_offline_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 2)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName')) if mibBuilder.loadTexts: hh3cVMManDeviceOfflineTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManDeviceOfflineTrap.setDescription('Send a trap about the device having been unregistered to VM.') hh3c_vm_man_forward_device_external_semaphore_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 3)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUExternalInputAlarmChannelID')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceExternalSemaphoreTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceExternalSemaphoreTrap.setDescription('Forward a trap about external semaphore alarm, which is created by the third party device.') hh3c_vm_man_forward_device_video_loss_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 4)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceVideoLossTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceVideoLossTrap.setDescription('Forward a trap about video loss, which is created by the third party device.') hh3c_vm_man_forward_device_video_recover_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 5)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceVideoRecoverTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceVideoRecoverTrap.setDescription('Forward a trap about video recovery after loss, which is created by the third party device.') hh3c_vm_man_forward_device_motion_detect_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 6)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegionCoordinateX1'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegionCoordinateY1'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegionCoordinateX2'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegionCoordinateY2')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceMotionDetectTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceMotionDetectTrap.setDescription('Forward a trap about motion detection, which is created by the third party device.') hh3c_vm_man_forward_device_cover_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 7)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegionCoordinateX1'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegionCoordinateY1'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegionCoordinateX2'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegionCoordinateY2')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceCoverTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceCoverTrap.setDescription('Forward a trap about video cover, which is created by the third party device.') hh3c_vm_man_forward_device_cpu_usage_threshold_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 8)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManCpuUsage'), ('HH3C-VM-MAN-MIB', 'hh3cVMManCpuUsageThreshold')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceCpuUsageThresholdTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceCpuUsageThresholdTrap.setDescription('Forward a trap about cpu usage exceeding its threshold, which is created by the third party device.') hh3c_vm_man_forward_device_mem_usage_threshold_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 9)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManMemUsage'), ('HH3C-VM-MAN-MIB', 'hh3cVMManMemUsageThreshold')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceMemUsageThresholdTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceMemUsageThresholdTrap.setDescription('Forward a trap about memory usage exceeding its threshold, which is created by the third party device.') hh3c_vm_man_forward_device_hard_disk_usage_threshold_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 10)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManHardDiskUsage'), ('HH3C-VM-MAN-MIB', 'hh3cVMManHardDiskUsageThreshold')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceHardDiskUsageThresholdTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceHardDiskUsageThresholdTrap.setDescription('Forward a trap about harddisk usage exceeding its threshold, which is created by the third party device.') hh3c_vm_man_forward_device_temperature_threshold_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 11)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManTemperature'), ('HH3C-VM-MAN-MIB', 'hh3cVMManTemperatureThreshold')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceTemperatureThresholdTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceTemperatureThresholdTrap.setDescription('Forward a trap about temperature exceeding its threshold, which is created by the third party device.') hh3c_vm_man_forward_device_start_kinescope_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 12)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceStartKinescopeTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceStartKinescopeTrap.setDescription('Forward a trap about starting kinescope, which is created by the third party device.') hh3c_vm_man_forward_device_stop_kinescope_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 13)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName')) if mibBuilder.loadTexts: hh3cVMManForwardDeviceStopKinescopeTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManForwardDeviceStopKinescopeTrap.setDescription('Forward a trap about stopping kinescope, which is created by the third party device.') hh3c_vm_man_client_report_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 14)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManUserName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManReportContent')) if mibBuilder.loadTexts: hh3cVMManClientReportTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientReportTrap.setDescription('Send a trap about the fault which is reported by clients.') hh3c_vm_man_client_realtime_surveillance_no_video_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 15)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManUserName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName')) if mibBuilder.loadTexts: hh3cVMManClientRealtimeSurveillanceNoVideoTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientRealtimeSurveillanceNoVideoTrap.setDescription("Send a trap about no realtime surveillance video stream which is reported by clients. hh3cVMManRegDevIP, entPhysicalAssetID, hh3cVMManRegDevName and hh3cVMManPUECVideoChannelName describe an EC's relative information. ") hh3c_vm_man_client_vod_no_video_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 16)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManUserName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVODStart'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVODEnd'), ('HH3C-VM-MAN-MIB', 'hh3cVMManIPSANDevIP')) if mibBuilder.loadTexts: hh3cVMManClientVODNoVideoTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODNoVideoTrap.setDescription("Send a trap about no VOD video stream which is reported by clients. hh3cVMManRegDevIP, entPhysicalAssetID, hh3cVMManRegDevName and hh3cVMManPUECVideoChannelName describe an EC's relative information.") hh3c_vm_man_client_realtime_surveillance_video_stream_discontinuity_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 17)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManUserName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVideoStreamDiscontinuityInterval'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientStatPeriod')) if mibBuilder.loadTexts: hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap.setDescription("Send a trap about the realtime surveillance video stream discontinuity which is reported by clients. entPhysicalAssetID, hh3cVMManRegDevIP, hh3cVMManRegDevName and hh3cVMManPUECVideoChannelName describe an EC's relative information.") hh3c_vm_man_client_vod_video_stream_discontinuity_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 18)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManUserName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVODStart'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVODEnd'), ('HH3C-VM-MAN-MIB', 'hh3cVMManIPSANDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVideoStreamDiscontinuityInterval'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientStatPeriod')) if mibBuilder.loadTexts: hh3cVMManClientVODVideoStreamDiscontinuityTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODVideoStreamDiscontinuityTrap.setDescription("Send a trap about the VOD video stream discontinuity which is reported by clients. hh3cVMManRegDevIP, entPhysicalAssetID, hh3cVMManRegDevName and hh3cVMManPUECVideoChannelName describe an EC's relative information.") hh3c_vm_man_client_ctl_conn_exception_termination_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 19)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManUserName')) if mibBuilder.loadTexts: hh3cVMManClientCtlConnExceptionTerminationTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientCtlConnExceptionTerminationTrap.setDescription('Send a trap about the exceptional termination for control connection. ') hh3c_vm_man_client_frequency_login_fail_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 20)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManUserName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientLoginFailNum'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientLoginFailNumThreshold'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientStatPeriod')) if mibBuilder.loadTexts: hh3cVMManClientFrequencyLoginFailTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientFrequencyLoginFailTrap.setDescription('Send a trap about the frequency of client login failure.') hh3c_vm_man_client_frequency_vod_fail_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 21)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManUserName'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVODFailNum'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientVODFailNumThreshold'), ('HH3C-VM-MAN-MIB', 'hh3cVMManClientStatPeriod')) if mibBuilder.loadTexts: hh3cVMManClientFrequencyVODFailTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientFrequencyVODFailTrap.setDescription('Send a trap about the frequency of client VOD failure.') hh3c_vm_man_dmec_disobey_storage_schedule_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 22)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName')) if mibBuilder.loadTexts: hh3cVMManDMECDisobeyStorageScheduleTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManDMECDisobeyStorageScheduleTrap.setDescription('Send a trap about EC disobeying storage schedule created by DM.') hh3c_vm_man_dmec_disobey_storage_schedule_recover_trap = notification_type((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 0, 23)).setObjects(('ENTITY-MIB', 'entPhysicalAssetID'), ('HH3C-VM-MAN-MIB', 'hh3cVMManRegDevIP'), ('HH3C-VM-MAN-MIB', 'hh3cVMManPUECVideoChannelName')) if mibBuilder.loadTexts: hh3cVMManDMECDisobeyStorageScheduleRecoverTrap.setStatus('current') if mibBuilder.loadTexts: hh3cVMManDMECDisobeyStorageScheduleRecoverTrap.setDescription('Send a trap about recovery after EC disobeying storage schedule created by DM.') hh3c_vm_man_trap_objects = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1)) hh3c_vm_man_ipsan_dev_ip = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 1), ip_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManIPSANDevIP.setStatus('current') if mibBuilder.loadTexts: hh3cVMManIPSANDevIP.setDescription('IP address of IPSAN Device which can store video data.') hh3c_vm_man_reg_dev_ip = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 2), ip_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManRegDevIP.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegDevIP.setDescription('IP address of devices which can registered or unregistered to VM.') hh3c_vm_man_reg_dev_name = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManRegDevName.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegDevName.setDescription('Name of devices which can registered or unregistered to VM.') hh3c_vm_man_region_coordinate_x1 = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 4), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateX1.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateX1.setDescription('The horizontal coordinate of top left point of the motion detection region.') hh3c_vm_man_region_coordinate_y1 = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 5), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateY1.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateY1.setDescription('The vertical coordinate of top left point of the motion detection region.') hh3c_vm_man_region_coordinate_x2 = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 6), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateX2.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateX2.setDescription('The horizontal coordinate of botton right point of the motion detection region.') hh3c_vm_man_region_coordinate_y2 = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 7), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateY2.setStatus('current') if mibBuilder.loadTexts: hh3cVMManRegionCoordinateY2.setDescription('The horizontal coordinate of botton right point of the motion detection region.') hh3c_vm_man_cpu_usage = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 8), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManCpuUsage.setStatus('current') if mibBuilder.loadTexts: hh3cVMManCpuUsage.setDescription('The CPU usage for this entity. Generally, the CPU usage will caculate the overall CPU usage on the entity, and it is not sensible with the number of CPU on the entity. ') hh3c_vm_man_cpu_usage_threshold = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 9), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManCpuUsageThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManCpuUsageThreshold.setDescription('The threshold for the CPU usage. When the CPU usage exceeds the threshold, a notification will be sent.') hh3c_vm_man_mem_usage = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 10), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManMemUsage.setStatus('current') if mibBuilder.loadTexts: hh3cVMManMemUsage.setDescription('The memory usage for the entity. This object indicates what percent of memory are used. ') hh3c_vm_man_mem_usage_threshold = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 11), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManMemUsageThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManMemUsageThreshold.setDescription('The threshold for the Memory usage. When the memory usage exceeds the threshold, a notification will be sent. ') hh3c_vm_man_hard_disk_usage = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 12), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManHardDiskUsage.setStatus('current') if mibBuilder.loadTexts: hh3cVMManHardDiskUsage.setDescription('The hard disk usage for the entity. This object indicates what percent of hard disk are used. ') hh3c_vm_man_hard_disk_usage_threshold = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 13), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManHardDiskUsageThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManHardDiskUsageThreshold.setDescription('The threshold for the hard disk usage. When the hard disk usage exceeds the threshold, a notification will be sent. ') hh3c_vm_man_temperature = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 14), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManTemperature.setStatus('current') if mibBuilder.loadTexts: hh3cVMManTemperature.setDescription('The temperature for the entity. ') hh3c_vm_man_temperature_threshold = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 15), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManTemperatureThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManTemperatureThreshold.setDescription('The threshold for the temperature. When the temperature exceeds the threshold, a notification will be sent. ') hh3c_vm_man_client_ip = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 16), ip_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientIP.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientIP.setDescription('The client device IP address.') hh3c_vm_man_user_name = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 17), display_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManUserName.setStatus('current') if mibBuilder.loadTexts: hh3cVMManUserName.setDescription('The client user name.') hh3c_vm_man_report_content = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 18), display_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManReportContent.setStatus('current') if mibBuilder.loadTexts: hh3cVMManReportContent.setDescription('The details of the fault which reported by clients') hh3c_vm_man_client_video_stream_discontinuity_interval = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 19), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientVideoStreamDiscontinuityInterval.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVideoStreamDiscontinuityInterval.setDescription('Video stream discontinuity interval. ') hh3c_vm_man_client_video_stream_discontinuity_interval_threshold = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 20), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold.setDescription('The threshold for the video stream discontinuity interval. When the discontinuity interval exceeds the threshold, a notification will be sent. ') hh3c_vm_man_client_stat_period = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 21), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientStatPeriod.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientStatPeriod.setDescription('The client statistic period. ') hh3c_vm_man_client_login_fail_num = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 22), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientLoginFailNum.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientLoginFailNum.setDescription('The total number of client login failure in last statistic period which is defined by hh3cVMManClientStatPeriod entity.') hh3c_vm_man_client_login_fail_num_threshold = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 23), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientLoginFailNumThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientLoginFailNumThreshold.setDescription('The threshold for the total number of client login failure in last statistic period. When the number exceeds the threshold, a notification will be sent. ') hh3c_vm_man_client_vod_fail_num = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 24), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientVODFailNum.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODFailNum.setDescription('The total number of client VOD failure in last statistic period which is defined by hh3cVMManClientStatPeriod entity.') hh3c_vm_man_client_vod_fail_num_threshold = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 25), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientVODFailNumThreshold.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODFailNumThreshold.setDescription('The threshold for the total number of client VOD failure in last statistic period. When the number exceeds the threshold, a notification will be sent. ') hh3c_vm_man_client_vod_start = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 26), date_and_time()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientVODStart.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODStart.setDescription('The start time for VOD.') hh3c_vm_man_client_vod_end = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 27), date_and_time()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManClientVODEnd.setStatus('current') if mibBuilder.loadTexts: hh3cVMManClientVODEnd.setDescription('The end time for VOD.') hh3c_vm_man_pu_external_input_alarm_channel_id = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 28), unsigned32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManPUExternalInputAlarmChannelID.setStatus('current') if mibBuilder.loadTexts: hh3cVMManPUExternalInputAlarmChannelID.setDescription('The ID of the external input alarm channel.') hh3c_vm_man_puec_video_channel_name = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 9, 1, 2, 1, 29), display_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hh3cVMManPUECVideoChannelName.setStatus('current') if mibBuilder.loadTexts: hh3cVMManPUECVideoChannelName.setDescription('The name of the video channel. It is suggested that the name includes the channel ID information.') mibBuilder.exportSymbols('HH3C-VM-MAN-MIB', hh3cVMManPUExternalInputAlarmChannelID=hh3cVMManPUExternalInputAlarmChannelID, hh3cVMManClientVODEnd=hh3cVMManClientVODEnd, hh3cVMManDMECDisobeyStorageScheduleRecoverTrap=hh3cVMManDMECDisobeyStorageScheduleRecoverTrap, hh3cVMManDeviceOfflineTrap=hh3cVMManDeviceOfflineTrap, hh3cVMManIPSANDevIP=hh3cVMManIPSANDevIP, hh3cVMManTemperatureThreshold=hh3cVMManTemperatureThreshold, hh3cVMManClientStatPeriod=hh3cVMManClientStatPeriod, hh3cVMManForwardDeviceCpuUsageThresholdTrap=hh3cVMManForwardDeviceCpuUsageThresholdTrap, hh3cVMManClientRealtimeSurveillanceNoVideoTrap=hh3cVMManClientRealtimeSurveillanceNoVideoTrap, hh3cVMManClientVODFailNumThreshold=hh3cVMManClientVODFailNumThreshold, hh3cVMMan=hh3cVMMan, hh3cVMStatFailConnEstablishRequests=hh3cVMStatFailConnEstablishRequests, hh3cVMStatTotalConnEstablishRequests=hh3cVMStatTotalConnEstablishRequests, hh3cVMStat=hh3cVMStat, hh3cVMStatSuccConnEstablishRequests=hh3cVMStatSuccConnEstablishRequests, hh3cVMStatExceptionTerminationConn=hh3cVMStatExceptionTerminationConn, hh3cVMManForwardDeviceExternalSemaphoreTrap=hh3cVMManForwardDeviceExternalSemaphoreTrap, hh3cVMManForwardDeviceStopKinescopeTrap=hh3cVMManForwardDeviceStopKinescopeTrap, hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap=hh3cVMManClientRealtimeSurveillanceVideoStreamDiscontinuityTrap, hh3cVMManCpuUsageThreshold=hh3cVMManCpuUsageThreshold, hh3cVMManUserName=hh3cVMManUserName, hh3cVMManClientFrequencyLoginFailTrap=hh3cVMManClientFrequencyLoginFailTrap, hh3cVMManReportContent=hh3cVMManReportContent, hh3cVMManPUECVideoChannelName=hh3cVMManPUECVideoChannelName, hh3cVMStatFailConnReleaseRequests=hh3cVMStatFailConnReleaseRequests, hh3cVMManForwardDeviceMotionDetectTrap=hh3cVMManForwardDeviceMotionDetectTrap, hh3cVMManForwardDeviceHardDiskUsageThresholdTrap=hh3cVMManForwardDeviceHardDiskUsageThresholdTrap, hh3cVMManTrapPrex=hh3cVMManTrapPrex, hh3cVMStatTotalConnReleaseRequests=hh3cVMStatTotalConnReleaseRequests, hh3cVMManForwardDeviceStartKinescopeTrap=hh3cVMManForwardDeviceStartKinescopeTrap, hh3cVMManClientVODNoVideoTrap=hh3cVMManClientVODNoVideoTrap, hh3cVMManRegionCoordinateY2=hh3cVMManRegionCoordinateY2, hh3cVMManCpuUsage=hh3cVMManCpuUsage, hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold=hh3cVMManClientVideoStreamDiscontinuityIntervalThreshold, hh3cVMManClientVODStart=hh3cVMManClientVODStart, hh3cVMManMIBTrap=hh3cVMManMIBTrap, hh3cVMCapabilitySet=hh3cVMCapabilitySet, hh3cVMManRegionCoordinateY1=hh3cVMManRegionCoordinateY1, hh3cVMManMIBObjects=hh3cVMManMIBObjects, hh3cVMManForwardDeviceTemperatureThresholdTrap=hh3cVMManForwardDeviceTemperatureThresholdTrap, hh3cVMManClientCtlConnExceptionTerminationTrap=hh3cVMManClientCtlConnExceptionTerminationTrap, hh3cVMManForwardDeviceMemUsageThresholdTrap=hh3cVMManForwardDeviceMemUsageThresholdTrap, hh3cVMManClientFrequencyVODFailTrap=hh3cVMManClientFrequencyVODFailTrap, hh3cVMManDMECDisobeyStorageScheduleTrap=hh3cVMManDMECDisobeyStorageScheduleTrap, hh3cVMManRegDevIP=hh3cVMManRegDevIP, hh3cVMManMemUsage=hh3cVMManMemUsage, hh3cVMManTemperature=hh3cVMManTemperature, hh3cVMManClientLoginFailNumThreshold=hh3cVMManClientLoginFailNumThreshold, hh3cVMManClientVODFailNum=hh3cVMManClientVODFailNum, hh3cVMManClientReportTrap=hh3cVMManClientReportTrap, hh3cVMManHardDiskUsage=hh3cVMManHardDiskUsage, hh3cVMManDeviceOnlineTrap=hh3cVMManDeviceOnlineTrap, hh3cVMManForwardDeviceVideoLossTrap=hh3cVMManForwardDeviceVideoLossTrap, hh3cVMManClientLoginFailNum=hh3cVMManClientLoginFailNum, hh3cVMManRegionCoordinateX1=hh3cVMManRegionCoordinateX1, hh3cVMManRegDevName=hh3cVMManRegDevName, hh3cVMManClientIP=hh3cVMManClientIP, PYSNMP_MODULE_ID=hh3cVMMan, hh3cVMManClientVODVideoStreamDiscontinuityTrap=hh3cVMManClientVODVideoStreamDiscontinuityTrap, hh3cVMManTrapObjects=hh3cVMManTrapObjects, hh3cVMManClientVideoStreamDiscontinuityInterval=hh3cVMManClientVideoStreamDiscontinuityInterval, hh3cVMManForwardDeviceCoverTrap=hh3cVMManForwardDeviceCoverTrap, hh3cVMManRegionCoordinateX2=hh3cVMManRegionCoordinateX2, hh3cVMStatSuccConnReleaseRequests=hh3cVMStatSuccConnReleaseRequests, hh3cVMManMemUsageThreshold=hh3cVMManMemUsageThreshold, hh3cVMManHardDiskUsageThreshold=hh3cVMManHardDiskUsageThreshold, hh3cVMManForwardDeviceVideoRecoverTrap=hh3cVMManForwardDeviceVideoRecoverTrap)
# 17. Take 10 integers from keyboard using loop and print their average value on the screen. (use array to store inputs). numbers = list(map(int, input("Enter 10 numbers:").split())) if len(numbers) >= 10: numbers = numbers[0:10] print("10 Numbers are", numbers) print("Average=", sum(numbers)/len(numbers))
numbers = list(map(int, input('Enter 10 numbers:').split())) if len(numbers) >= 10: numbers = numbers[0:10] print('10 Numbers are', numbers) print('Average=', sum(numbers) / len(numbers))
def parse_parts(line): space_separated_parts = line.split() bounds = space_separated_parts[0].split('-') char = space_separated_parts[1].split(':')[0] password = space_separated_parts[2] return int(bounds[0]), int(bounds[1]), char, password def is_valid_first(min_req, max_req, letter, password): letter_count = password.count(letter) return letter_count >= min_req and letter_count <= max_req # exactly one of the positions must equal the letter # => logical 'xor' of the two comparisions, 'xor' is equivalent to '!=' def is_valid_second(pos1, pos2, letter, password): return (password[pos1-1] == letter) != (password[pos2-1] == letter) def main(): input_filename = 'input.txt' star_number = 2 num_valid_pws = 0 with open(input_filename, 'r') as input: for line in input: num1, num2, letter, password = parse_parts(line) if star_number == 1: if is_valid_first(num1, num2, letter, password): num_valid_pws += 1 elif star_number == 2: if is_valid_second(num1, num2, letter, password): num_valid_pws += 1 print('Number of valid passwords: {}'.format(num_valid_pws)) if __name__ == "__main__": main()
def parse_parts(line): space_separated_parts = line.split() bounds = space_separated_parts[0].split('-') char = space_separated_parts[1].split(':')[0] password = space_separated_parts[2] return (int(bounds[0]), int(bounds[1]), char, password) def is_valid_first(min_req, max_req, letter, password): letter_count = password.count(letter) return letter_count >= min_req and letter_count <= max_req def is_valid_second(pos1, pos2, letter, password): return (password[pos1 - 1] == letter) != (password[pos2 - 1] == letter) def main(): input_filename = 'input.txt' star_number = 2 num_valid_pws = 0 with open(input_filename, 'r') as input: for line in input: (num1, num2, letter, password) = parse_parts(line) if star_number == 1: if is_valid_first(num1, num2, letter, password): num_valid_pws += 1 elif star_number == 2: if is_valid_second(num1, num2, letter, password): num_valid_pws += 1 print('Number of valid passwords: {}'.format(num_valid_pws)) if __name__ == '__main__': main()
# Given a collection of numbers, return all possible permutations. # For example, # [1,2,3] have the following permutations: # [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]. # [1,2] have the following permutations: # [1,2], [2,1] class Solution: # @param {integer[]} nums # @return {integer[][]} def permute(self, nums): # stack version(1): ans = [] stack = [([], nums)] while stack: ret, nums = stack.pop(0) if nums: for i in range(len(nums)): stack.append((ret + [nums[i]], nums[:i] + nums[i+1:])) else: ans.append(ret) return ans # stack version(2): # if not nums: # return nums # res = [[nums[0]]] # for i in range(1, len(nums)): # for j in range(len(res)): # tmp = res.pop(0) # for k in range(len(tmp)+ 1): # res.append(tmp[:k] + [nums[i]] + tmp[k:]) # return res # recursion version: # if len(nums) <= 1: # return [nums] # permutations = [] # for i in range(len(nums)): # permutations.extend([ [nums[i]] + p for p in self.permute(nums[:i] + nums[i+1:]) ]) # return permutations
class Solution: def permute(self, nums): ans = [] stack = [([], nums)] while stack: (ret, nums) = stack.pop(0) if nums: for i in range(len(nums)): stack.append((ret + [nums[i]], nums[:i] + nums[i + 1:])) else: ans.append(ret) return ans
# import pytest class TestDatabase: def test___call__(self): # synced assert True def test_default_schema(self): # synced assert True def test_schema_names(self): # synced assert True def test_table_names(self): # synced assert True def test_view_names(self): # synced assert True def test_create_table(self): # synced assert True def test_drop_table(self): # synced assert True def test_refresh_table(self): # synced assert True def test_exists_table(self): # synced assert True def test_reset(self): # synced assert True def test__get_metadata(self): # synced assert True def test__cache_metadata(self): # synced assert True def test__post_reshape_soon(self): # synced assert True def test__sync_with_db(self): # synced assert True def test__reflect_database(self): # synced assert True def test__reflect_schema(self): # synced assert True def test__reflect_object(self): # synced assert True def test__autoload_models(self): # synced assert True def test_cls_instrument(self): # synced assert True def test__remove_expired_metadata_objects(self): # synced assert True def test__remove_object_if_exists(self): # synced assert True def test__name_from_object(self): # synced assert True def test__normalize_table(self): # synced assert True def test__table_name(self): # synced assert True def test_table_name(self): # synced assert True def test__scalar_name(self): # synced assert True def test_scalar_name(self): # synced assert True def test__collection_name(self): # synced assert True def test_collection_name(self): # synced assert True
class Testdatabase: def test___call__(self): assert True def test_default_schema(self): assert True def test_schema_names(self): assert True def test_table_names(self): assert True def test_view_names(self): assert True def test_create_table(self): assert True def test_drop_table(self): assert True def test_refresh_table(self): assert True def test_exists_table(self): assert True def test_reset(self): assert True def test__get_metadata(self): assert True def test__cache_metadata(self): assert True def test__post_reshape_soon(self): assert True def test__sync_with_db(self): assert True def test__reflect_database(self): assert True def test__reflect_schema(self): assert True def test__reflect_object(self): assert True def test__autoload_models(self): assert True def test_cls_instrument(self): assert True def test__remove_expired_metadata_objects(self): assert True def test__remove_object_if_exists(self): assert True def test__name_from_object(self): assert True def test__normalize_table(self): assert True def test__table_name(self): assert True def test_table_name(self): assert True def test__scalar_name(self): assert True def test_scalar_name(self): assert True def test__collection_name(self): assert True def test_collection_name(self): assert True
class Vetor: def __init__(self, x=0, y=0): self.x = x self.y = y def __repr__(self): return 'Vetor (%r,%r)' % (self.x, self.y) def __mul__(self, escalar): x = self.x * escalar y = self.y * escalar return Vetor(x, y) def __add__(self, outro): x = self.x + outro.x y = self.y + outro.y return Vetor(x, y) def __bool__(self): return bool(self.x or self.y) def __float__(self): return float(self.x) + float(self.y) v = Vetor(3, 5) print(v*3) v1 = Vetor(0, 0) v2 = Vetor(8, 2) print(v1+v2) print(float(v2)) print(bool(v1)) print(bool(v2))
class Vetor: def __init__(self, x=0, y=0): self.x = x self.y = y def __repr__(self): return 'Vetor (%r,%r)' % (self.x, self.y) def __mul__(self, escalar): x = self.x * escalar y = self.y * escalar return vetor(x, y) def __add__(self, outro): x = self.x + outro.x y = self.y + outro.y return vetor(x, y) def __bool__(self): return bool(self.x or self.y) def __float__(self): return float(self.x) + float(self.y) v = vetor(3, 5) print(v * 3) v1 = vetor(0, 0) v2 = vetor(8, 2) print(v1 + v2) print(float(v2)) print(bool(v1)) print(bool(v2))
SUBJ_REPORT = "Problem Report: ExCEED Labs" ERROR_NO_EMAIL_TO_GET_AHOLD = "We need to know how to get ahold of you!" ERROR_NO_REPORT = "Don't forget to add your problem report or request!" ERROR_NOT_SUBMITTED = "There was a problem with your submission. Please try again!" SUCCESS_REPORT_SUBMITTED = "Success! Your problem report or request has been submitted to the ExCEED Labs directors."
subj_report = 'Problem Report: ExCEED Labs' error_no_email_to_get_ahold = 'We need to know how to get ahold of you!' error_no_report = "Don't forget to add your problem report or request!" error_not_submitted = 'There was a problem with your submission. Please try again!' success_report_submitted = 'Success! Your problem report or request has been submitted to the ExCEED Labs directors.'
# Sum square difference # https://projecteuler.net/problem=6 def solve(n): sn = (n*(n+1)//2) * (n*(n+1)//2) sn2 = n*(n+1)*(2*n+1)//6 # sum of first n squared natural numbers return abs(sn - sn2) print(solve(100))
def solve(n): sn = n * (n + 1) // 2 * (n * (n + 1) // 2) sn2 = n * (n + 1) * (2 * n + 1) // 6 return abs(sn - sn2) print(solve(100))
_base_ = [ '../_base_/models/paa_distil_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( type='LAD', # student pretrained='torchvision://resnet50', backbone=dict(depth=50), bbox_head=dict(type='PAA_LAD_Head'), # teacher teacher_pretrained="http://download.openmmlab.com/mmdetection/v2.0/paa/paa_r101_fpn_1x_coco/paa_r101_fpn_1x_coco_20200821-0a1825a4.pth", teacher_backbone=dict(depth=101), teacher_bbox_head=dict(type='PAA_LAD_Head')) # optimizer optimizer = dict(lr=0.01) data = dict(samples_per_gpu=4, workers_per_gpu=4) optimizer_config = dict( _delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
_base_ = ['../_base_/models/paa_distil_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'] model = dict(type='LAD', pretrained='torchvision://resnet50', backbone=dict(depth=50), bbox_head=dict(type='PAA_LAD_Head'), teacher_pretrained='http://download.openmmlab.com/mmdetection/v2.0/paa/paa_r101_fpn_1x_coco/paa_r101_fpn_1x_coco_20200821-0a1825a4.pth', teacher_backbone=dict(depth=101), teacher_bbox_head=dict(type='PAA_LAD_Head')) optimizer = dict(lr=0.01) data = dict(samples_per_gpu=4, workers_per_gpu=4) optimizer_config = dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
class Solution(object): def solveNQueens(self, n): def dfs(queens, xy_sub, xy_plus): row = len(queens) if row == n: result.append(queens) return None for col in range(n): if col not in queens and col + row not in xy_plus and row - col not in xy_sub: dfs(queens + [col], xy_sub + [row - col], xy_plus + [row + col]) result = [] dfs([], [], []) return [["."* i + "Q" + "."* (n -i-1) for i in s] for s in result]
class Solution(object): def solve_n_queens(self, n): def dfs(queens, xy_sub, xy_plus): row = len(queens) if row == n: result.append(queens) return None for col in range(n): if col not in queens and col + row not in xy_plus and (row - col not in xy_sub): dfs(queens + [col], xy_sub + [row - col], xy_plus + [row + col]) result = [] dfs([], [], []) return [['.' * i + 'Q' + '.' * (n - i - 1) for i in s] for s in result]
def merge_sort_time(job_list): ''' sorts the list by timestamp :return: array ''' if len(job_list) > 1: mid = len(job_list) // 2 lefthalf = job_list[:mid] righthalf = job_list[mid:] merge_sort_time(lefthalf) merge_sort_time(righthalf) i = 0 j = 0 k = 0 while i < len(lefthalf) and j < len(righthalf): if lefthalf[i]['time'] > righthalf[j]['time']: job_list[k] = lefthalf[i] i = i + 1 else: job_list[k] = righthalf[j] j = j + 1 k = k + 1 while i < len(lefthalf): job_list[k] = lefthalf[i] i = i + 1 k = k + 1 while j < len(righthalf): job_list[k] = righthalf[j] j = j + 1 k = k + 1
def merge_sort_time(job_list): """ sorts the list by timestamp :return: array """ if len(job_list) > 1: mid = len(job_list) // 2 lefthalf = job_list[:mid] righthalf = job_list[mid:] merge_sort_time(lefthalf) merge_sort_time(righthalf) i = 0 j = 0 k = 0 while i < len(lefthalf) and j < len(righthalf): if lefthalf[i]['time'] > righthalf[j]['time']: job_list[k] = lefthalf[i] i = i + 1 else: job_list[k] = righthalf[j] j = j + 1 k = k + 1 while i < len(lefthalf): job_list[k] = lefthalf[i] i = i + 1 k = k + 1 while j < len(righthalf): job_list[k] = righthalf[j] j = j + 1 k = k + 1
# # PySNMP MIB module CHARACTER-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/CHARACTER-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:06:47 2016 # On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose # Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52) # ( ObjectIdentifier, OctetString, Integer, ) = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") ( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ( ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint") ( InterfaceIndex, ) = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") ( ObjectGroup, NotificationGroup, ModuleCompliance, ) = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") ( MibIdentifier, transmission, Bits, Integer32, IpAddress, Gauge32, mib_2, Counter32, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Unsigned32, ObjectIdentity, TimeTicks, ModuleIdentity, NotificationType, ) = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "transmission", "Bits", "Integer32", "IpAddress", "Gauge32", "mib-2", "Counter32", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Unsigned32", "ObjectIdentity", "TimeTicks", "ModuleIdentity", "NotificationType") ( TextualConvention, DisplayString, AutonomousType, InstancePointer, ) = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "AutonomousType", "InstancePointer") char = ModuleIdentity((1, 3, 6, 1, 2, 1, 19)) if mibBuilder.loadTexts: char.setLastUpdated('9405261700Z') if mibBuilder.loadTexts: char.setOrganization('IETF Character MIB Working Group') if mibBuilder.loadTexts: char.setContactInfo(' Bob Stewart\n Postal: Xyplex, Inc.\n 295 Foster Street\n Littleton, MA 01460\n\n Tel: 508-952-4816\n Fax: 508-952-4887\n\n E-mail: rlstewart@eng.xyplex.com') if mibBuilder.loadTexts: char.setDescription('The MIB module for character stream devices.') class PortIndex(Integer32, TextualConvention): displayHint = 'd' charNumber = MibScalar((1, 3, 6, 1, 2, 1, 19, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: charNumber.setDescription('The number of entries in charPortTable, regardless\n of their current state.') charPortTable = MibTable((1, 3, 6, 1, 2, 1, 19, 2), ) if mibBuilder.loadTexts: charPortTable.setDescription('A list of port entries. The number of entries is\n given by the value of charNumber.') charPortEntry = MibTableRow((1, 3, 6, 1, 2, 1, 19, 2, 1), ).setIndexNames((0, "CHARACTER-MIB", "charPortIndex")) if mibBuilder.loadTexts: charPortEntry.setDescription('Status and parameter values for a character port.') charPortIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 1), PortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortIndex.setDescription('A unique value for each character port, perhaps\n corresponding to the same value of ifIndex when the\n character port is associated with a hardware port\n represented by an ifIndex.') charPortName = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0,32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortName.setDescription('An administratively assigned name for the port,\n typically with some local significance.') charPortType = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("physical", 1), ("virtual", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortType.setDescription("The port's type, 'physical' if the port represents\n an external hardware connector, 'virtual' if it does\n not.") charPortHardware = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 4), AutonomousType()).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortHardware.setDescription("A reference to hardware MIB definitions specific to\n a physical port's external connector. For example,\n if the connector is RS-232, then the value of this\n object refers to a MIB sub-tree defining objects\n specific to RS-232. If an agent is not configured\n to have such values, the agent returns the object\n identifier:\n\n nullHardware OBJECT IDENTIFIER ::= { 0 0 }\n ") charPortReset = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("ready", 1), ("execute", 2),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortReset.setDescription("A control to force the port into a clean, initial\n state, both hardware and software, disconnecting all\n the port's existing sessions. In response to a\n get-request or get-next-request, the agent always\n returns 'ready' as the value. Setting the value to\n 'execute' causes a reset.") charPortAdminStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("off", 3), ("maintenance", 4),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortAdminStatus.setDescription("The port's desired state, independent of flow\n control. 'enabled' indicates that the port is\n allowed to pass characters and form new sessions.\n 'disabled' indicates that the port is allowed to\n pass characters but not form new sessions. 'off'\n indicates that the port is not allowed to pass\n characters or have any sessions. 'maintenance'\n indicates a maintenance mode, exclusive of normal\n operation, such as running a test.\n\n 'enabled' corresponds to ifAdminStatus 'up'.\n 'disabled' and 'off' correspond to ifAdminStatus\n 'down'. 'maintenance' corresponds to ifAdminStatus\n 'test'.") charPortOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5,))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("maintenance", 3), ("absent", 4), ("active", 5),))).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortOperStatus.setDescription("The port's actual, operational state, independent\n of flow control. 'up' indicates able to function\n normally. 'down' indicates inability to function\n for administrative or operational reasons.\n 'maintenance' indicates a maintenance mode,\n exclusive of normal operation, such as running a\n test. 'absent' indicates that port hardware is not\n present. 'active' indicates up with a user present\n (e.g. logged in).\n\n 'up' and 'active' correspond to ifOperStatus 'up'.\n 'down' and 'absent' correspond to ifOperStatus\n 'down'. 'maintenance' corresponds to ifOperStatus\n 'test'.") charPortLastChange = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 8), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortLastChange.setDescription('The value of sysUpTime at the time the port entered\n its current operational state. If the current state\n was entered prior to the last reinitialization of\n the local network management subsystem, then this\n object contains a zero value.') charPortInFlowType = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5,))).clone(namedValues=NamedValues(("none", 1), ("xonXoff", 2), ("hardware", 3), ("ctsRts", 4), ("dsrDtr", 5),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortInFlowType.setDescription("The port's type of input flow control. 'none'\n indicates no flow control at this level or below.\n 'xonXoff' indicates software flow control by\n recognizing XON and XOFF characters. 'hardware'\n indicates flow control delegated to the lower level,\n for example a parallel port.\n\n 'ctsRts' and 'dsrDtr' are specific to RS-232-like\n ports. Although not architecturally pure, they are\n included here for simplicity's sake.") charPortOutFlowType = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5,))).clone(namedValues=NamedValues(("none", 1), ("xonXoff", 2), ("hardware", 3), ("ctsRts", 4), ("dsrDtr", 5),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortOutFlowType.setDescription("The port's type of output flow control. 'none'\n indicates no flow control at this level or below.\n 'xonXoff' indicates software flow control by\n recognizing XON and XOFF characters. 'hardware'\n indicates flow control delegated to the lower level,\n for example a parallel port.\n\n 'ctsRts' and 'dsrDtr' are specific to RS-232-like\n ports. Although not architecturally pure, they are\n included here for simplicy's sake.") charPortInFlowState = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("none", 1), ("unknown", 2), ("stop", 3), ("go", 4),))).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortInFlowState.setDescription("The current operational state of input flow control\n on the port. 'none' indicates not applicable.\n 'unknown' indicates this level does not know.\n 'stop' indicates flow not allowed. 'go' indicates\n flow allowed.") charPortOutFlowState = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("none", 1), ("unknown", 2), ("stop", 3), ("go", 4),))).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortOutFlowState.setDescription("The current operational state of output flow\n control on the port. 'none' indicates not\n applicable. 'unknown' indicates this level does not\n know. 'stop' indicates flow not allowed. 'go'\n indicates flow allowed.") charPortInCharacters = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortInCharacters.setDescription("Total number of characters detected as input from\n the port since system re-initialization and while\n the port operational state was 'up', 'active', or\n 'maintenance', including, for example, framing, flow\n control (i.e. XON and XOFF), each occurrence of a\n BREAK condition, locally-processed input, and input\n sent to all sessions.") charPortOutCharacters = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortOutCharacters.setDescription("Total number of characters detected as output to\n the port since system re-initialization and while\n the port operational state was 'up', 'active', or\n 'maintenance', including, for example, framing, flow\n control (i.e. XON and XOFF), each occurrence of a\n BREAK condition, locally-created output, and output\n received from all sessions.") charPortAdminOrigin = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("dynamic", 1), ("network", 2), ("local", 3), ("none", 4),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortAdminOrigin.setDescription("The administratively allowed origin for\n establishing session on the port. 'dynamic' allows\n 'network' or 'local' session establishment. 'none'\n disallows session establishment.") charPortSessionMaximum = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1,2147483647))).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortSessionMaximum.setDescription('The maximum number of concurrent sessions allowed\n on the port. A value of -1 indicates no maximum.\n Setting the maximum to less than the current number\n of sessions has unspecified results.') charPortSessionNumber = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 17), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortSessionNumber.setDescription('The number of open sessions on the port that are in\n the connecting, connected, or disconnecting state.') charPortSessionIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortSessionIndex.setDescription("The value of charSessIndex for the port's first or\n only active session. If the port has no active\n session, the agent returns the value zero.") charPortInFlowTypes = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 19), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1,1)).setFixedLength(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortInFlowTypes.setDescription("The port's types of input flow control at the\n software level. Hardware-level flow control is\n independently controlled by the appropriate\n hardware-level MIB.\n\n A value of zero indicates no flow control.\n Depending on the specific implementation, any or\n all combinations of flow control may be chosen by\n adding the values:\n\n 128 xonXoff, recognizing XON and XOFF characters\n 64 enqHost, ENQ/ACK to allow input to host\n 32 enqTerm, ACK to allow output to port\n ") charPortOutFlowTypes = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 20), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1,1)).setFixedLength(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: charPortOutFlowTypes.setDescription("The port's types of output flow control at the\n software level. Hardware-level flow control is\n independently controlled by the appropriate\n hardware-level MIB.\n\n A value of zero indicates no flow control.\n Depending on the specific implementation, any or\n all combinations of flow control may be chosen by\n adding the values:\n\n 128 xonXoff, recognizing XON and XOFF characters\n 64 enqHost, ENQ/ACK to allow input to host\n 32 enqTerm, ACK to allow output to port\n ") charPortLowerIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 2, 1, 21), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: charPortLowerIfIndex.setDescription('The ifIndex value of the lower level hardware supporting\n this character port, zero if none.') charSessTable = MibTable((1, 3, 6, 1, 2, 1, 19, 3), ) if mibBuilder.loadTexts: charSessTable.setDescription('A list of port session entries.') charSessEntry = MibTableRow((1, 3, 6, 1, 2, 1, 19, 3, 1), ).setIndexNames((0, "CHARACTER-MIB", "charSessPortIndex"), (0, "CHARACTER-MIB", "charSessIndex")) if mibBuilder.loadTexts: charSessEntry.setDescription('Status and parameter values for a character port\n session.') charSessPortIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 1), PortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessPortIndex.setDescription('The value of charPortIndex for the port to which\n this session belongs.') charSessIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessIndex.setDescription('The session index in the context of the port, a\n non-zero positive integer. Session indexes within a\n port need not be sequential. Session indexes may be\n reused for different ports. For example, port 1 and\n port 3 may both have a session 2 at the same time.\n Session indexes may have any valid integer value,\n with any meaning convenient to the agent\n implementation.') charSessKill = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("ready", 1), ("execute", 2),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: charSessKill.setDescription("A control to terminate the session. In response to\n a get-request or get-next-request, the agent always\n returns 'ready' as the value. Setting the value to\n 'execute' causes termination.") charSessState = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("connecting", 1), ("connected", 2), ("disconnecting", 3),))).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessState.setDescription("The current operational state of the session,\n disregarding flow control. 'connected' indicates\n that character data could flow on the network side\n of session. 'connecting' indicates moving from\n nonexistent toward 'connected'. 'disconnecting'\n indicates moving from 'connected' or 'connecting' to\n nonexistent.") charSessProtocol = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 5), AutonomousType()).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessProtocol.setDescription('The network protocol over which the session is\n running. Other OBJECT IDENTIFIER values may be\n defined elsewhere, in association with specific\n protocols. However, this document assigns those of\n known interest as of this writing.') wellKnownProtocols = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 4)) protocolOther = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 4, 1)) protocolTelnet = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 4, 2)) protocolRlogin = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 4, 3)) protocolLat = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 4, 4)) protocolX29 = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 4, 5)) protocolVtp = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 4, 6)) charSessOperOrigin = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("unknown", 1), ("network", 2), ("local", 3),))).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessOperOrigin.setDescription("The session's source of establishment.") charSessInCharacters = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessInCharacters.setDescription("This session's subset of charPortInCharacters.") charSessOutCharacters = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessOutCharacters.setDescription("This session's subset of charPortOutCharacters.") charSessConnectionId = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 9), InstancePointer()).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessConnectionId.setDescription('A reference to additional local MIB information.\n This should be the highest available related MIB,\n corresponding to charSessProtocol, such as Telnet.\n For example, the value for a TCP connection (in the\n absence of a Telnet MIB) is the object identifier of\n tcpConnState. If an agent is not configured to have\n such values, the agent returns the object\n identifier:\n\n nullConnectionId OBJECT IDENTIFIER ::= { 0 0 }\n ') charSessStartTime = MibTableColumn((1, 3, 6, 1, 2, 1, 19, 3, 1, 10), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: charSessStartTime.setDescription('The value of sysUpTime in MIB-2 when the session\n entered connecting state.') charConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 5)) charGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 5, 1)) charCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 19, 5, 2)) charCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 19, 5, 2, 1)).setObjects(*(("CHARACTER-MIB", "charGroup"),)) if mibBuilder.loadTexts: charCompliance.setDescription('The compliance statement for SNMPv2 entities\n which have Character hardware interfaces.') charGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 19, 5, 1, 1)).setObjects(*(("CHARACTER-MIB", "charNumber"), ("CHARACTER-MIB", "charPortIndex"), ("CHARACTER-MIB", "charPortName"), ("CHARACTER-MIB", "charPortType"), ("CHARACTER-MIB", "charPortHardware"), ("CHARACTER-MIB", "charPortReset"), ("CHARACTER-MIB", "charPortAdminStatus"), ("CHARACTER-MIB", "charPortOperStatus"), ("CHARACTER-MIB", "charPortLastChange"), ("CHARACTER-MIB", "charPortInFlowState"), ("CHARACTER-MIB", "charPortOutFlowState"), ("CHARACTER-MIB", "charPortAdminOrigin"), ("CHARACTER-MIB", "charPortSessionMaximum"), ("CHARACTER-MIB", "charPortInFlowTypes"), ("CHARACTER-MIB", "charPortOutFlowTypes"), ("CHARACTER-MIB", "charPortInCharacters"), ("CHARACTER-MIB", "charPortOutCharacters"), ("CHARACTER-MIB", "charPortSessionNumber"), ("CHARACTER-MIB", "charPortSessionIndex"), ("CHARACTER-MIB", "charPortLowerIfIndex"), ("CHARACTER-MIB", "charSessPortIndex"), ("CHARACTER-MIB", "charSessIndex"), ("CHARACTER-MIB", "charSessKill"), ("CHARACTER-MIB", "charSessState"), ("CHARACTER-MIB", "charSessProtocol"), ("CHARACTER-MIB", "charSessOperOrigin"), ("CHARACTER-MIB", "charSessInCharacters"), ("CHARACTER-MIB", "charSessOutCharacters"), ("CHARACTER-MIB", "charSessConnectionId"), ("CHARACTER-MIB", "charSessStartTime"),)) if mibBuilder.loadTexts: charGroup.setDescription('A collection of objects providing information\n applicable to all Character interfaces.') mibBuilder.exportSymbols("CHARACTER-MIB", protocolOther=protocolOther, charPortAdminOrigin=charPortAdminOrigin, charPortSessionMaximum=charPortSessionMaximum, charSessIndex=charSessIndex, charSessInCharacters=charSessInCharacters, charPortAdminStatus=charPortAdminStatus, charSessEntry=charSessEntry, charNumber=charNumber, charPortType=charPortType, charSessKill=charSessKill, protocolRlogin=protocolRlogin, charCompliance=charCompliance, charPortInCharacters=charPortInCharacters, charPortLowerIfIndex=charPortLowerIfIndex, charPortOutFlowState=charPortOutFlowState, charConformance=charConformance, charSessConnectionId=charSessConnectionId, charPortOutCharacters=charPortOutCharacters, charSessStartTime=charSessStartTime, charSessOutCharacters=charSessOutCharacters, wellKnownProtocols=wellKnownProtocols, charPortIndex=charPortIndex, charPortReset=charPortReset, charPortInFlowType=charPortInFlowType, charPortHardware=charPortHardware, protocolLat=protocolLat, charPortLastChange=charPortLastChange, charPortSessionIndex=charPortSessionIndex, protocolVtp=protocolVtp, charSessTable=charSessTable, charSessProtocol=charSessProtocol, charSessOperOrigin=charSessOperOrigin, charPortOutFlowTypes=charPortOutFlowTypes, protocolTelnet=protocolTelnet, charPortOutFlowType=charPortOutFlowType, charPortTable=charPortTable, charPortInFlowState=charPortInFlowState, charSessPortIndex=charSessPortIndex, PortIndex=PortIndex, charPortSessionNumber=charPortSessionNumber, charCompliances=charCompliances, PYSNMP_MODULE_ID=char, charGroups=charGroups, charPortEntry=charPortEntry, charPortInFlowTypes=charPortInFlowTypes, charPortOperStatus=charPortOperStatus, charGroup=charGroup, charPortName=charPortName, charSessState=charSessState, char=char, protocolX29=protocolX29)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint') (interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex') (object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance') (mib_identifier, transmission, bits, integer32, ip_address, gauge32, mib_2, counter32, counter64, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, unsigned32, object_identity, time_ticks, module_identity, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'transmission', 'Bits', 'Integer32', 'IpAddress', 'Gauge32', 'mib-2', 'Counter32', 'Counter64', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'Unsigned32', 'ObjectIdentity', 'TimeTicks', 'ModuleIdentity', 'NotificationType') (textual_convention, display_string, autonomous_type, instance_pointer) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString', 'AutonomousType', 'InstancePointer') char = module_identity((1, 3, 6, 1, 2, 1, 19)) if mibBuilder.loadTexts: char.setLastUpdated('9405261700Z') if mibBuilder.loadTexts: char.setOrganization('IETF Character MIB Working Group') if mibBuilder.loadTexts: char.setContactInfo(' Bob Stewart\n Postal: Xyplex, Inc.\n 295 Foster Street\n Littleton, MA 01460\n\n Tel: 508-952-4816\n Fax: 508-952-4887\n\n E-mail: rlstewart@eng.xyplex.com') if mibBuilder.loadTexts: char.setDescription('The MIB module for character stream devices.') class Portindex(Integer32, TextualConvention): display_hint = 'd' char_number = mib_scalar((1, 3, 6, 1, 2, 1, 19, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: charNumber.setDescription('The number of entries in charPortTable, regardless\n of their current state.') char_port_table = mib_table((1, 3, 6, 1, 2, 1, 19, 2)) if mibBuilder.loadTexts: charPortTable.setDescription('A list of port entries. The number of entries is\n given by the value of charNumber.') char_port_entry = mib_table_row((1, 3, 6, 1, 2, 1, 19, 2, 1)).setIndexNames((0, 'CHARACTER-MIB', 'charPortIndex')) if mibBuilder.loadTexts: charPortEntry.setDescription('Status and parameter values for a character port.') char_port_index = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 1), port_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortIndex.setDescription('A unique value for each character port, perhaps\n corresponding to the same value of ifIndex when the\n character port is associated with a hardware port\n represented by an ifIndex.') char_port_name = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortName.setDescription('An administratively assigned name for the port,\n typically with some local significance.') char_port_type = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('physical', 1), ('virtual', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortType.setDescription("The port's type, 'physical' if the port represents\n an external hardware connector, 'virtual' if it does\n not.") char_port_hardware = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 4), autonomous_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortHardware.setDescription("A reference to hardware MIB definitions specific to\n a physical port's external connector. For example,\n if the connector is RS-232, then the value of this\n object refers to a MIB sub-tree defining objects\n specific to RS-232. If an agent is not configured\n to have such values, the agent returns the object\n identifier:\n\n nullHardware OBJECT IDENTIFIER ::= { 0 0 }\n ") char_port_reset = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ready', 1), ('execute', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortReset.setDescription("A control to force the port into a clean, initial\n state, both hardware and software, disconnecting all\n the port's existing sessions. In response to a\n get-request or get-next-request, the agent always\n returns 'ready' as the value. Setting the value to\n 'execute' causes a reset.") char_port_admin_status = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2), ('off', 3), ('maintenance', 4)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortAdminStatus.setDescription("The port's desired state, independent of flow\n control. 'enabled' indicates that the port is\n allowed to pass characters and form new sessions.\n 'disabled' indicates that the port is allowed to\n pass characters but not form new sessions. 'off'\n indicates that the port is not allowed to pass\n characters or have any sessions. 'maintenance'\n indicates a maintenance mode, exclusive of normal\n operation, such as running a test.\n\n 'enabled' corresponds to ifAdminStatus 'up'.\n 'disabled' and 'off' correspond to ifAdminStatus\n 'down'. 'maintenance' corresponds to ifAdminStatus\n 'test'.") char_port_oper_status = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('up', 1), ('down', 2), ('maintenance', 3), ('absent', 4), ('active', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortOperStatus.setDescription("The port's actual, operational state, independent\n of flow control. 'up' indicates able to function\n normally. 'down' indicates inability to function\n for administrative or operational reasons.\n 'maintenance' indicates a maintenance mode,\n exclusive of normal operation, such as running a\n test. 'absent' indicates that port hardware is not\n present. 'active' indicates up with a user present\n (e.g. logged in).\n\n 'up' and 'active' correspond to ifOperStatus 'up'.\n 'down' and 'absent' correspond to ifOperStatus\n 'down'. 'maintenance' corresponds to ifOperStatus\n 'test'.") char_port_last_change = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 8), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortLastChange.setDescription('The value of sysUpTime at the time the port entered\n its current operational state. If the current state\n was entered prior to the last reinitialization of\n the local network management subsystem, then this\n object contains a zero value.') char_port_in_flow_type = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('none', 1), ('xonXoff', 2), ('hardware', 3), ('ctsRts', 4), ('dsrDtr', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortInFlowType.setDescription("The port's type of input flow control. 'none'\n indicates no flow control at this level or below.\n 'xonXoff' indicates software flow control by\n recognizing XON and XOFF characters. 'hardware'\n indicates flow control delegated to the lower level,\n for example a parallel port.\n\n 'ctsRts' and 'dsrDtr' are specific to RS-232-like\n ports. Although not architecturally pure, they are\n included here for simplicity's sake.") char_port_out_flow_type = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('none', 1), ('xonXoff', 2), ('hardware', 3), ('ctsRts', 4), ('dsrDtr', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortOutFlowType.setDescription("The port's type of output flow control. 'none'\n indicates no flow control at this level or below.\n 'xonXoff' indicates software flow control by\n recognizing XON and XOFF characters. 'hardware'\n indicates flow control delegated to the lower level,\n for example a parallel port.\n\n 'ctsRts' and 'dsrDtr' are specific to RS-232-like\n ports. Although not architecturally pure, they are\n included here for simplicy's sake.") char_port_in_flow_state = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('none', 1), ('unknown', 2), ('stop', 3), ('go', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortInFlowState.setDescription("The current operational state of input flow control\n on the port. 'none' indicates not applicable.\n 'unknown' indicates this level does not know.\n 'stop' indicates flow not allowed. 'go' indicates\n flow allowed.") char_port_out_flow_state = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('none', 1), ('unknown', 2), ('stop', 3), ('go', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortOutFlowState.setDescription("The current operational state of output flow\n control on the port. 'none' indicates not\n applicable. 'unknown' indicates this level does not\n know. 'stop' indicates flow not allowed. 'go'\n indicates flow allowed.") char_port_in_characters = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 13), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortInCharacters.setDescription("Total number of characters detected as input from\n the port since system re-initialization and while\n the port operational state was 'up', 'active', or\n 'maintenance', including, for example, framing, flow\n control (i.e. XON and XOFF), each occurrence of a\n BREAK condition, locally-processed input, and input\n sent to all sessions.") char_port_out_characters = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortOutCharacters.setDescription("Total number of characters detected as output to\n the port since system re-initialization and while\n the port operational state was 'up', 'active', or\n 'maintenance', including, for example, framing, flow\n control (i.e. XON and XOFF), each occurrence of a\n BREAK condition, locally-created output, and output\n received from all sessions.") char_port_admin_origin = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('dynamic', 1), ('network', 2), ('local', 3), ('none', 4)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortAdminOrigin.setDescription("The administratively allowed origin for\n establishing session on the port. 'dynamic' allows\n 'network' or 'local' session establishment. 'none'\n disallows session establishment.") char_port_session_maximum = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(-1, 2147483647))).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortSessionMaximum.setDescription('The maximum number of concurrent sessions allowed\n on the port. A value of -1 indicates no maximum.\n Setting the maximum to less than the current number\n of sessions has unspecified results.') char_port_session_number = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 17), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortSessionNumber.setDescription('The number of open sessions on the port that are in\n the connecting, connected, or disconnecting state.') char_port_session_index = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 18), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortSessionIndex.setDescription("The value of charSessIndex for the port's first or\n only active session. If the port has no active\n session, the agent returns the value zero.") char_port_in_flow_types = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 19), octet_string().subtype(subtypeSpec=value_size_constraint(1, 1)).setFixedLength(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortInFlowTypes.setDescription("The port's types of input flow control at the\n software level. Hardware-level flow control is\n independently controlled by the appropriate\n hardware-level MIB.\n\n A value of zero indicates no flow control.\n Depending on the specific implementation, any or\n all combinations of flow control may be chosen by\n adding the values:\n\n 128 xonXoff, recognizing XON and XOFF characters\n 64 enqHost, ENQ/ACK to allow input to host\n 32 enqTerm, ACK to allow output to port\n ") char_port_out_flow_types = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 20), octet_string().subtype(subtypeSpec=value_size_constraint(1, 1)).setFixedLength(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: charPortOutFlowTypes.setDescription("The port's types of output flow control at the\n software level. Hardware-level flow control is\n independently controlled by the appropriate\n hardware-level MIB.\n\n A value of zero indicates no flow control.\n Depending on the specific implementation, any or\n all combinations of flow control may be chosen by\n adding the values:\n\n 128 xonXoff, recognizing XON and XOFF characters\n 64 enqHost, ENQ/ACK to allow input to host\n 32 enqTerm, ACK to allow output to port\n ") char_port_lower_if_index = mib_table_column((1, 3, 6, 1, 2, 1, 19, 2, 1, 21), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: charPortLowerIfIndex.setDescription('The ifIndex value of the lower level hardware supporting\n this character port, zero if none.') char_sess_table = mib_table((1, 3, 6, 1, 2, 1, 19, 3)) if mibBuilder.loadTexts: charSessTable.setDescription('A list of port session entries.') char_sess_entry = mib_table_row((1, 3, 6, 1, 2, 1, 19, 3, 1)).setIndexNames((0, 'CHARACTER-MIB', 'charSessPortIndex'), (0, 'CHARACTER-MIB', 'charSessIndex')) if mibBuilder.loadTexts: charSessEntry.setDescription('Status and parameter values for a character port\n session.') char_sess_port_index = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 1), port_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessPortIndex.setDescription('The value of charPortIndex for the port to which\n this session belongs.') char_sess_index = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessIndex.setDescription('The session index in the context of the port, a\n non-zero positive integer. Session indexes within a\n port need not be sequential. Session indexes may be\n reused for different ports. For example, port 1 and\n port 3 may both have a session 2 at the same time.\n Session indexes may have any valid integer value,\n with any meaning convenient to the agent\n implementation.') char_sess_kill = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ready', 1), ('execute', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: charSessKill.setDescription("A control to terminate the session. In response to\n a get-request or get-next-request, the agent always\n returns 'ready' as the value. Setting the value to\n 'execute' causes termination.") char_sess_state = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('connecting', 1), ('connected', 2), ('disconnecting', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessState.setDescription("The current operational state of the session,\n disregarding flow control. 'connected' indicates\n that character data could flow on the network side\n of session. 'connecting' indicates moving from\n nonexistent toward 'connected'. 'disconnecting'\n indicates moving from 'connected' or 'connecting' to\n nonexistent.") char_sess_protocol = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 5), autonomous_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessProtocol.setDescription('The network protocol over which the session is\n running. Other OBJECT IDENTIFIER values may be\n defined elsewhere, in association with specific\n protocols. However, this document assigns those of\n known interest as of this writing.') well_known_protocols = mib_identifier((1, 3, 6, 1, 2, 1, 19, 4)) protocol_other = mib_identifier((1, 3, 6, 1, 2, 1, 19, 4, 1)) protocol_telnet = mib_identifier((1, 3, 6, 1, 2, 1, 19, 4, 2)) protocol_rlogin = mib_identifier((1, 3, 6, 1, 2, 1, 19, 4, 3)) protocol_lat = mib_identifier((1, 3, 6, 1, 2, 1, 19, 4, 4)) protocol_x29 = mib_identifier((1, 3, 6, 1, 2, 1, 19, 4, 5)) protocol_vtp = mib_identifier((1, 3, 6, 1, 2, 1, 19, 4, 6)) char_sess_oper_origin = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('unknown', 1), ('network', 2), ('local', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessOperOrigin.setDescription("The session's source of establishment.") char_sess_in_characters = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessInCharacters.setDescription("This session's subset of charPortInCharacters.") char_sess_out_characters = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 8), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessOutCharacters.setDescription("This session's subset of charPortOutCharacters.") char_sess_connection_id = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 9), instance_pointer()).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessConnectionId.setDescription('A reference to additional local MIB information.\n This should be the highest available related MIB,\n corresponding to charSessProtocol, such as Telnet.\n For example, the value for a TCP connection (in the\n absence of a Telnet MIB) is the object identifier of\n tcpConnState. If an agent is not configured to have\n such values, the agent returns the object\n identifier:\n\n nullConnectionId OBJECT IDENTIFIER ::= { 0 0 }\n ') char_sess_start_time = mib_table_column((1, 3, 6, 1, 2, 1, 19, 3, 1, 10), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: charSessStartTime.setDescription('The value of sysUpTime in MIB-2 when the session\n entered connecting state.') char_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 19, 5)) char_groups = mib_identifier((1, 3, 6, 1, 2, 1, 19, 5, 1)) char_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 19, 5, 2)) char_compliance = module_compliance((1, 3, 6, 1, 2, 1, 19, 5, 2, 1)).setObjects(*(('CHARACTER-MIB', 'charGroup'),)) if mibBuilder.loadTexts: charCompliance.setDescription('The compliance statement for SNMPv2 entities\n which have Character hardware interfaces.') char_group = object_group((1, 3, 6, 1, 2, 1, 19, 5, 1, 1)).setObjects(*(('CHARACTER-MIB', 'charNumber'), ('CHARACTER-MIB', 'charPortIndex'), ('CHARACTER-MIB', 'charPortName'), ('CHARACTER-MIB', 'charPortType'), ('CHARACTER-MIB', 'charPortHardware'), ('CHARACTER-MIB', 'charPortReset'), ('CHARACTER-MIB', 'charPortAdminStatus'), ('CHARACTER-MIB', 'charPortOperStatus'), ('CHARACTER-MIB', 'charPortLastChange'), ('CHARACTER-MIB', 'charPortInFlowState'), ('CHARACTER-MIB', 'charPortOutFlowState'), ('CHARACTER-MIB', 'charPortAdminOrigin'), ('CHARACTER-MIB', 'charPortSessionMaximum'), ('CHARACTER-MIB', 'charPortInFlowTypes'), ('CHARACTER-MIB', 'charPortOutFlowTypes'), ('CHARACTER-MIB', 'charPortInCharacters'), ('CHARACTER-MIB', 'charPortOutCharacters'), ('CHARACTER-MIB', 'charPortSessionNumber'), ('CHARACTER-MIB', 'charPortSessionIndex'), ('CHARACTER-MIB', 'charPortLowerIfIndex'), ('CHARACTER-MIB', 'charSessPortIndex'), ('CHARACTER-MIB', 'charSessIndex'), ('CHARACTER-MIB', 'charSessKill'), ('CHARACTER-MIB', 'charSessState'), ('CHARACTER-MIB', 'charSessProtocol'), ('CHARACTER-MIB', 'charSessOperOrigin'), ('CHARACTER-MIB', 'charSessInCharacters'), ('CHARACTER-MIB', 'charSessOutCharacters'), ('CHARACTER-MIB', 'charSessConnectionId'), ('CHARACTER-MIB', 'charSessStartTime'))) if mibBuilder.loadTexts: charGroup.setDescription('A collection of objects providing information\n applicable to all Character interfaces.') mibBuilder.exportSymbols('CHARACTER-MIB', protocolOther=protocolOther, charPortAdminOrigin=charPortAdminOrigin, charPortSessionMaximum=charPortSessionMaximum, charSessIndex=charSessIndex, charSessInCharacters=charSessInCharacters, charPortAdminStatus=charPortAdminStatus, charSessEntry=charSessEntry, charNumber=charNumber, charPortType=charPortType, charSessKill=charSessKill, protocolRlogin=protocolRlogin, charCompliance=charCompliance, charPortInCharacters=charPortInCharacters, charPortLowerIfIndex=charPortLowerIfIndex, charPortOutFlowState=charPortOutFlowState, charConformance=charConformance, charSessConnectionId=charSessConnectionId, charPortOutCharacters=charPortOutCharacters, charSessStartTime=charSessStartTime, charSessOutCharacters=charSessOutCharacters, wellKnownProtocols=wellKnownProtocols, charPortIndex=charPortIndex, charPortReset=charPortReset, charPortInFlowType=charPortInFlowType, charPortHardware=charPortHardware, protocolLat=protocolLat, charPortLastChange=charPortLastChange, charPortSessionIndex=charPortSessionIndex, protocolVtp=protocolVtp, charSessTable=charSessTable, charSessProtocol=charSessProtocol, charSessOperOrigin=charSessOperOrigin, charPortOutFlowTypes=charPortOutFlowTypes, protocolTelnet=protocolTelnet, charPortOutFlowType=charPortOutFlowType, charPortTable=charPortTable, charPortInFlowState=charPortInFlowState, charSessPortIndex=charSessPortIndex, PortIndex=PortIndex, charPortSessionNumber=charPortSessionNumber, charCompliances=charCompliances, PYSNMP_MODULE_ID=char, charGroups=charGroups, charPortEntry=charPortEntry, charPortInFlowTypes=charPortInFlowTypes, charPortOperStatus=charPortOperStatus, charGroup=charGroup, charPortName=charPortName, charSessState=charSessState, char=char, protocolX29=protocolX29)
def write_results(results, save_path): output = [] for k, v in results.items(): output.append("{}: {}".format(k, v)) output.append("\n") output.append("If you need to access these results for the future " "they are stored in: {}".format(save_path)) with open(save_path, 'w') as fp: fp.write("\n".join(output)) return "\n".join(output)
def write_results(results, save_path): output = [] for (k, v) in results.items(): output.append('{}: {}'.format(k, v)) output.append('\n') output.append('If you need to access these results for the future they are stored in: {}'.format(save_path)) with open(save_path, 'w') as fp: fp.write('\n'.join(output)) return '\n'.join(output)
houses = {"Harry": "Gryffindor", "Draco": "Slytherin"} houses["Hermione"] = "Gryffindor" print(houses["Harry"])
houses = {'Harry': 'Gryffindor', 'Draco': 'Slytherin'} houses['Hermione'] = 'Gryffindor' print(houses['Harry'])
# class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def oddEvenList(self, head): if not head: return None i = 0 tmp = head first = True prev = None tmp_even_head = None tail = None while tmp: if i % 2 != 0: if first: second_list = ListNode(tmp.val) tmp_even_head = second_list second_list.next = None first = False else: second_list.next = ListNode(tmp.val) second_list = second_list.next second_list.next = None if tmp and tmp.next: prev.next = tmp.next else: tail = tmp prev = tmp tmp = tmp.next i += 1 if tmp_even_head: tail.next = tmp_even_head return head
class Solution: def odd_even_list(self, head): if not head: return None i = 0 tmp = head first = True prev = None tmp_even_head = None tail = None while tmp: if i % 2 != 0: if first: second_list = list_node(tmp.val) tmp_even_head = second_list second_list.next = None first = False else: second_list.next = list_node(tmp.val) second_list = second_list.next second_list.next = None if tmp and tmp.next: prev.next = tmp.next else: tail = tmp prev = tmp tmp = tmp.next i += 1 if tmp_even_head: tail.next = tmp_even_head return head
def lineup_students(string): return sorted(string.split(), key=lambda x: (len(x), x), reverse=True) # lineup_students = lambda s: sorted(s.split(), key=lambda x: (len(x), x), reverse=True)
def lineup_students(string): return sorted(string.split(), key=lambda x: (len(x), x), reverse=True)
# Accept a positive integer and print the reverse of it. n = int(input("Enter a positive integer: ")) # | n = 123 print() rev = 0 # | rev = 0 while n > 0: # | 123 > 0 = True | 12 > 0 = True | 1 > 0 = True | digit = n % 10 # extract the last digit # | digit = 123 % 10 = 3 | digit = 12 % 10 = 2 | digit = 1 % 10 = 1 | rev = rev * 10 + digit # ?? # | rev = 0 * 10 + 3 = 3 | rev = 3 * 10 + 2 = 32 | rev = 32 * 10 + 1 = 321 | n = n // 10 # remove the last digit # | n = 123 // 10 = 12 | n = 12 // 10 = 1 | n = 1 // 10 = 0 | print("The reverse of the number is:", rev)
n = int(input('Enter a positive integer: ')) print() rev = 0 while n > 0: digit = n % 10 rev = rev * 10 + digit n = n // 10 print('The reverse of the number is:', rev)
def parse_plotter_args(parser): parser.add_option( "--name_of_3dmodel", type="string", default="airplane/airplane_0630.ply", help="name of 3D model to plot using the 'plot_subclouds' script", ) parser.add_option( "--save_plot_frames", action="store_true", default=False, help="whether to record the 3D model shown in 'plot_subclouds' script", ) parser.add_option( "--plotted_image_folder", type="string", default="./gif_images", help="folder to store the images created if save_plot_frames=True", ) return parser
def parse_plotter_args(parser): parser.add_option('--name_of_3dmodel', type='string', default='airplane/airplane_0630.ply', help="name of 3D model to plot using the 'plot_subclouds' script") parser.add_option('--save_plot_frames', action='store_true', default=False, help="whether to record the 3D model shown in 'plot_subclouds' script") parser.add_option('--plotted_image_folder', type='string', default='./gif_images', help='folder to store the images created if save_plot_frames=True') return parser
PART_NAMES = [ "nose", "leftEye", "rightEye", "leftEar", "rightEar", "leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee", "leftAnkle", "rightAnkle" ] NUM_KEYPOINTS = len(PART_NAMES) PART_IDS = {pn: pid for pid, pn in enumerate(PART_NAMES)} CONNECTED_PART_NAMES = [ ("leftHip", "leftShoulder"), ("leftElbow", "leftShoulder"), ("leftElbow", "leftWrist"), ("leftHip", "leftKnee"), ("leftKnee", "leftAnkle"), ("rightHip", "rightShoulder"), ("rightElbow", "rightShoulder"), ("rightElbow", "rightWrist"), ("rightHip", "rightKnee"), ("rightKnee", "rightAnkle"), ("leftShoulder", "rightShoulder"), ("leftHip", "rightHip") ] CONNECTED_PART_INDICES = [(PART_IDS[a], PART_IDS[b]) for a, b in CONNECTED_PART_NAMES] LOCAL_MAXIMUM_RADIUS = 1 POSE_CHAIN = [ ("nose", "leftEye"), ("leftEye", "leftEar"), ("nose", "rightEye"), ("rightEye", "rightEar"), ("nose", "leftShoulder"), ("leftShoulder", "leftElbow"), ("leftElbow", "leftWrist"), ("leftShoulder", "leftHip"), ("leftHip", "leftKnee"), ("leftKnee", "leftAnkle"), ("nose", "rightShoulder"), ("rightShoulder", "rightElbow"), ("rightElbow", "rightWrist"), ("rightShoulder", "rightHip"), ("rightHip", "rightKnee"), ("rightKnee", "rightAnkle") ] MOVABLE_PART = [ [("rightShoulder", "rightElbow"), ("rightElbow", "rightWrist")], [("leftShoulder", "leftElbow"), ("leftElbow", "leftWrist")], [("rightElbow", "rightShoulder"), ("rightShoulder", "rightHip")], [("leftElbow", "leftShoulder"), ("leftShoulder", "leftHip")], [("leftHip", "leftKnee"), ("leftKnee", "leftAnkle")], [("rightHip", "rightKnee"), ("rightKnee", "rightAnkle")] ] PIVOT_POINT = [ "rightElbow", "leftElbow", "rightShoulder", "leftShoulder", "leftKnee", "rightKnee" ] PARENT_CHILD_TUPLES = [(PART_IDS[parent], PART_IDS[child]) for parent, child in POSE_CHAIN] PART_CHANNELS = [ 'left_face', 'right_face', 'right_upper_leg_front', 'right_lower_leg_back', 'right_upper_leg_back', 'left_lower_leg_front', 'left_upper_leg_front', 'left_upper_leg_back', 'left_lower_leg_back', 'right_feet', 'right_lower_leg_front', 'left_feet', 'torso_front', 'torso_back', 'right_upper_arm_front', 'right_upper_arm_back', 'right_lower_arm_back', 'left_lower_arm_front', 'left_upper_arm_front', 'left_upper_arm_back', 'left_lower_arm_back', 'right_hand', 'right_lower_arm_front', 'left_hand' ]
part_names = ['nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder', 'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist', 'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle'] num_keypoints = len(PART_NAMES) part_ids = {pn: pid for (pid, pn) in enumerate(PART_NAMES)} connected_part_names = [('leftHip', 'leftShoulder'), ('leftElbow', 'leftShoulder'), ('leftElbow', 'leftWrist'), ('leftHip', 'leftKnee'), ('leftKnee', 'leftAnkle'), ('rightHip', 'rightShoulder'), ('rightElbow', 'rightShoulder'), ('rightElbow', 'rightWrist'), ('rightHip', 'rightKnee'), ('rightKnee', 'rightAnkle'), ('leftShoulder', 'rightShoulder'), ('leftHip', 'rightHip')] connected_part_indices = [(PART_IDS[a], PART_IDS[b]) for (a, b) in CONNECTED_PART_NAMES] local_maximum_radius = 1 pose_chain = [('nose', 'leftEye'), ('leftEye', 'leftEar'), ('nose', 'rightEye'), ('rightEye', 'rightEar'), ('nose', 'leftShoulder'), ('leftShoulder', 'leftElbow'), ('leftElbow', 'leftWrist'), ('leftShoulder', 'leftHip'), ('leftHip', 'leftKnee'), ('leftKnee', 'leftAnkle'), ('nose', 'rightShoulder'), ('rightShoulder', 'rightElbow'), ('rightElbow', 'rightWrist'), ('rightShoulder', 'rightHip'), ('rightHip', 'rightKnee'), ('rightKnee', 'rightAnkle')] movable_part = [[('rightShoulder', 'rightElbow'), ('rightElbow', 'rightWrist')], [('leftShoulder', 'leftElbow'), ('leftElbow', 'leftWrist')], [('rightElbow', 'rightShoulder'), ('rightShoulder', 'rightHip')], [('leftElbow', 'leftShoulder'), ('leftShoulder', 'leftHip')], [('leftHip', 'leftKnee'), ('leftKnee', 'leftAnkle')], [('rightHip', 'rightKnee'), ('rightKnee', 'rightAnkle')]] pivot_point = ['rightElbow', 'leftElbow', 'rightShoulder', 'leftShoulder', 'leftKnee', 'rightKnee'] parent_child_tuples = [(PART_IDS[parent], PART_IDS[child]) for (parent, child) in POSE_CHAIN] part_channels = ['left_face', 'right_face', 'right_upper_leg_front', 'right_lower_leg_back', 'right_upper_leg_back', 'left_lower_leg_front', 'left_upper_leg_front', 'left_upper_leg_back', 'left_lower_leg_back', 'right_feet', 'right_lower_leg_front', 'left_feet', 'torso_front', 'torso_back', 'right_upper_arm_front', 'right_upper_arm_back', 'right_lower_arm_back', 'left_lower_arm_front', 'left_upper_arm_front', 'left_upper_arm_back', 'left_lower_arm_back', 'right_hand', 'right_lower_arm_front', 'left_hand']
to_remove = input() word = input() while to_remove in word: word = word.replace(to_remove, '') print(word)
to_remove = input() word = input() while to_remove in word: word = word.replace(to_remove, '') print(word)
BASE_URL = 'https://www.instagram.com/' LOGIN_URL = BASE_URL + 'accounts/login/ajax/' LOGOUT_URL = BASE_URL + 'accounts/logout/' MEDIA_URL = BASE_URL + '{0}/media' CHROME_WIN_UA = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36' STORIES_URL = 'https://i.instagram.com/api/v1/feed/user/{0}/reel_media/' STORIES_UA = 'Instagram 9.5.2 (iPhone7,2; iPhone OS 9_3_3; en_US; en-US; scale=2.00; 750x1334) AppleWebKit/420+' STORIES_COOKIE = 'ds_user_id={0}; sessionid={1};' TAGS_URL = BASE_URL + 'explore/tags/{0}/?__a=1' LOCATIONS_URL = BASE_URL + 'explore/locations/{0}/?__a=1' VIEW_MEDIA_URL = BASE_URL + 'p/{0}/?__a=1' SEARCH_URL = BASE_URL + 'web/search/topsearch/?context=blended&query={0}' QUERY_COMMENTS = BASE_URL + 'graphql/query/?query_id=17852405266163336&shortcode={0}&first=100&after={1}' QUERY_HASHTAG = BASE_URL + 'graphql/query/?query_id=17882293912014529&tag_name={0}&first=100&after={1}' QUERY_LOCATION = BASE_URL + 'graphql/query/?query_id=17881432870018455&id={0}&first=100&after={1}'
base_url = 'https://www.instagram.com/' login_url = BASE_URL + 'accounts/login/ajax/' logout_url = BASE_URL + 'accounts/logout/' media_url = BASE_URL + '{0}/media' chrome_win_ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36' stories_url = 'https://i.instagram.com/api/v1/feed/user/{0}/reel_media/' stories_ua = 'Instagram 9.5.2 (iPhone7,2; iPhone OS 9_3_3; en_US; en-US; scale=2.00; 750x1334) AppleWebKit/420+' stories_cookie = 'ds_user_id={0}; sessionid={1};' tags_url = BASE_URL + 'explore/tags/{0}/?__a=1' locations_url = BASE_URL + 'explore/locations/{0}/?__a=1' view_media_url = BASE_URL + 'p/{0}/?__a=1' search_url = BASE_URL + 'web/search/topsearch/?context=blended&query={0}' query_comments = BASE_URL + 'graphql/query/?query_id=17852405266163336&shortcode={0}&first=100&after={1}' query_hashtag = BASE_URL + 'graphql/query/?query_id=17882293912014529&tag_name={0}&first=100&after={1}' query_location = BASE_URL + 'graphql/query/?query_id=17881432870018455&id={0}&first=100&after={1}'
if __name__ == '__main__': name = ' aleX' print(name.strip()) # name = name.strip() if name.startswith('al'): print('yes') if name.endswith('X'): print('yes') print(name.replace('l', 'p')) # name = name.replace('l', 'p') print(name.split('l')) print(type(name.split('e'))) print(name.upper()) print(name.lower()) print(name[2]) print(name[:3]) print(name[3:]) print(name.index('e')) print(name[:len(name) - 1])
if __name__ == '__main__': name = ' aleX' print(name.strip()) if name.startswith('al'): print('yes') if name.endswith('X'): print('yes') print(name.replace('l', 'p')) print(name.split('l')) print(type(name.split('e'))) print(name.upper()) print(name.lower()) print(name[2]) print(name[:3]) print(name[3:]) print(name.index('e')) print(name[:len(name) - 1])
''' Created on 16.1.2017 @author: jm ''' class GedcomLine(object): ''' Gedcom line container, which can also carry the lower level gedcom lines. Example - level 2 - tag 'GIVN' - value 'Johan' ...} ''' # Current path elemements # See https://docs.python.org/3/faq/programming.html#how-do-i-create-static-class-data-and-static-class-methods path_elem = [] def __init__(self, line, linenum=0): ''' Constructor: Parses and stores a gedcom line Different constructors: GedcomLine("1 GIVN Ville") GedcomLine("1 GIVN Ville", 20) GedcomLine((1, "GIVN", "Ville")) GedcomLine((1, "GIVN", "Ville"), 20) ''' self.path = "" self.attributes = {} self.linenum = linenum if type(line) == str: # Parse line tkns = line.split(None,2) self.line = line else: tkns = tuple(line) self.level = int(tkns[0]) self.tag = tkns[1] if len(tkns) > 2: self.value = tkns[2] else: self.value = "" self.line = str(self) self.set_path(self.level, self.tag) def __str__(self): ''' Get the original line ''' try: ret = "{} {} {}".format(self.level, self.tag, self.value).rstrip() except: ret = "* Not complete *" return ret def set_path(self, level, tag): ''' Update self.path with given tag and level ''' if level > len(GedcomLine.path_elem): raise RuntimeError("{} Invalid level {}: {}".format(self.path, level, self.line)) if level == len(GedcomLine.path_elem): GedcomLine.path_elem.append(tag) else: GedcomLine.path_elem[level] = tag GedcomLine.path_elem = GedcomLine.path_elem[:self.level+1] self.path = ".".join(GedcomLine.path_elem) return self.path def set_attr(self, key, value): ''' Optional attributes like name TYPE as a tuple {'TYPE':'marriage'} ''' self.attributes[key] = value def get_attr(self, key): ''' Get optional attribute value ''' if key in self.attributes: return self.attributes[key] return None def get_year(self): '''If value has a four digit last part, the numeric value of it is returned ''' p = self.value.split() try: if len(p) > 0 and len(p[-1]) == 4: return int(p[-1]) except: return None def emit(self, f): # Print out current line to file f f.emit(str(self))
""" Created on 16.1.2017 @author: jm """ class Gedcomline(object): """ Gedcom line container, which can also carry the lower level gedcom lines. Example - level 2 - tag 'GIVN' - value 'Johan' ...} """ path_elem = [] def __init__(self, line, linenum=0): """ Constructor: Parses and stores a gedcom line Different constructors: GedcomLine("1 GIVN Ville") GedcomLine("1 GIVN Ville", 20) GedcomLine((1, "GIVN", "Ville")) GedcomLine((1, "GIVN", "Ville"), 20) """ self.path = '' self.attributes = {} self.linenum = linenum if type(line) == str: tkns = line.split(None, 2) self.line = line else: tkns = tuple(line) self.level = int(tkns[0]) self.tag = tkns[1] if len(tkns) > 2: self.value = tkns[2] else: self.value = '' self.line = str(self) self.set_path(self.level, self.tag) def __str__(self): """ Get the original line """ try: ret = '{} {} {}'.format(self.level, self.tag, self.value).rstrip() except: ret = '* Not complete *' return ret def set_path(self, level, tag): """ Update self.path with given tag and level """ if level > len(GedcomLine.path_elem): raise runtime_error('{} Invalid level {}: {}'.format(self.path, level, self.line)) if level == len(GedcomLine.path_elem): GedcomLine.path_elem.append(tag) else: GedcomLine.path_elem[level] = tag GedcomLine.path_elem = GedcomLine.path_elem[:self.level + 1] self.path = '.'.join(GedcomLine.path_elem) return self.path def set_attr(self, key, value): """ Optional attributes like name TYPE as a tuple {'TYPE':'marriage'} """ self.attributes[key] = value def get_attr(self, key): """ Get optional attribute value """ if key in self.attributes: return self.attributes[key] return None def get_year(self): """If value has a four digit last part, the numeric value of it is returned """ p = self.value.split() try: if len(p) > 0 and len(p[-1]) == 4: return int(p[-1]) except: return None def emit(self, f): f.emit(str(self))
'''input 1 1 1 0 1 0 0 0 1 0 1 3 4 5 6 7 8 9 -2 -3 4 -2 8 3 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 1 -8 6 -2 -8 -8 4 8 7 -6 2 2 -9 2 0 1 7 -5 0 -2 -6 5 5 6 -6 7 -9 6 -5 8 0 -9 -7 -7 23 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 3 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 1 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 3 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 1 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 -2 ''' # -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem C # FIXME: More smarter. def calc_benefit(my_schedule, others_schedule, benefit_table, answer): score = 0 if sum(my_schedule) == 0: return benefit_total for index, other_schedule in enumerate(others_schedule): count = 0 for mine, other in zip(my_schedule, other_schedule): if mine == other == 1: count += 1 score += benefit_table[index][count] return max(score, benefit_total) # FIXME: More smarter. def dfs(my_schedule, others_schedule, benefit_table, benefit_total, pos): if pos == 10: return calc_benefit(my_schedule, others_schedule, benefit_table, benefit_total) my_schedule[pos] = 0 foo = dfs(my_schedule, others_schedule, benefit_table, benefit_total, pos + 1) my_schedule[pos] = 1 bar = dfs(my_schedule, others_schedule, benefit_table, benefit_total, pos + 1) return max(foo, bar) if __name__ == '__main__': shop_count = int(input()) others_schedule = [list(map(int, input().split())) for _ in range(shop_count)] benefit_table = [list(map(int, input().split())) for _ in range(shop_count)] benefit_total = -1000000000 my_schedule = [None] * (10) # See: https://www.youtube.com/watch?v=GWhYUxeDe70 benefit_total = dfs(my_schedule, others_schedule, benefit_table, benefit_total, 0) print(benefit_total)
"""input 1 1 1 0 1 0 0 0 1 0 1 3 4 5 6 7 8 9 -2 -3 4 -2 8 3 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 1 -8 6 -2 -8 -8 4 8 7 -6 2 2 -9 2 0 1 7 -5 0 -2 -6 5 5 6 -6 7 -9 6 -5 8 0 -9 -7 -7 23 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 3 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 1 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 3 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 1 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 -2 """ def calc_benefit(my_schedule, others_schedule, benefit_table, answer): score = 0 if sum(my_schedule) == 0: return benefit_total for (index, other_schedule) in enumerate(others_schedule): count = 0 for (mine, other) in zip(my_schedule, other_schedule): if mine == other == 1: count += 1 score += benefit_table[index][count] return max(score, benefit_total) def dfs(my_schedule, others_schedule, benefit_table, benefit_total, pos): if pos == 10: return calc_benefit(my_schedule, others_schedule, benefit_table, benefit_total) my_schedule[pos] = 0 foo = dfs(my_schedule, others_schedule, benefit_table, benefit_total, pos + 1) my_schedule[pos] = 1 bar = dfs(my_schedule, others_schedule, benefit_table, benefit_total, pos + 1) return max(foo, bar) if __name__ == '__main__': shop_count = int(input()) others_schedule = [list(map(int, input().split())) for _ in range(shop_count)] benefit_table = [list(map(int, input().split())) for _ in range(shop_count)] benefit_total = -1000000000 my_schedule = [None] * 10 benefit_total = dfs(my_schedule, others_schedule, benefit_table, benefit_total, 0) print(benefit_total)
filename = 'programming_poll.txt' responses = [] while True: response = input("\nWhy do you like programming? ") responses.append(response) continue_poll = input("Would you like to let someone else respond? (y/n) ") if continue_poll != 'y': break with open(filename, 'a') as f: for response in responses: f.write(response + "\n")
filename = 'programming_poll.txt' responses = [] while True: response = input('\nWhy do you like programming? ') responses.append(response) continue_poll = input('Would you like to let someone else respond? (y/n) ') if continue_poll != 'y': break with open(filename, 'a') as f: for response in responses: f.write(response + '\n')
# # @lc app=leetcode id=1806 lang=python3 # # [1806] Minimum Number of Operations to Reinitialize a Permutation # # @lc code=start class Solution: def reinitializePermutation(self, n: int) -> int: i, cnt = 1, 0 while not cnt or i > 1: # i != 1 doesn't work i = i * 2 % (n - 1) cnt += 1 return cnt # @lc code=end
class Solution: def reinitialize_permutation(self, n: int) -> int: (i, cnt) = (1, 0) while not cnt or i > 1: i = i * 2 % (n - 1) cnt += 1 return cnt
class TestFunctionalTest(object): counter = 0 @classmethod def setup_class(cls): cls.counter += 1 @classmethod def teardown_class(cls): cls.counter -= 1 def _run(self): assert self.counter==1 def test1(self): self._run() def test2(self): self._run()
class Testfunctionaltest(object): counter = 0 @classmethod def setup_class(cls): cls.counter += 1 @classmethod def teardown_class(cls): cls.counter -= 1 def _run(self): assert self.counter == 1 def test1(self): self._run() def test2(self): self._run()
class Parameter: ''' Defines a sampled (or "free") parameter by spin, parity, channel, rank, and whether it's an energy or width (kind). kind : "energy" or "width" "width" can be the partial width or ANC (depending on how it was set up in AZURE2) channel : channel pair (defined in AZURE2; consistent with AZURE2, these are one-based) rank : Which spin^{parity} level is this? (There are frequently more than one. Consistent with AZURE2, these are one-based.) ''' def __init__(self, spin, parity, kind, channel, rank=1, is_anc=False): self.spin = spin self.parity = parity self.kind = kind self.channel = int(channel) self.rank = rank jpi_label = '+' if self.parity == 1 else '-' subscript = f'{rank:d},{channel:d}' superscript = f'({jpi_label:s}{spin:.1f})' if self.kind == 'energy': self.label = r'$E_{%s}^{%s}$' % (subscript, superscript) elif self.kind == 'width': if is_anc: self.label = r'$C_{%s}^{%s}$' % (subscript, superscript) else: self.label = r'$\Gamma_{%s}^{%s}$' % (subscript, superscript) else: print('"kind" attribute must be either "energy" or "width"') def string(self): parity = '+' if self.parity == 1 else '-' return f'{self.spin}{parity} {self.kind} (number {self.rank}) in \ particle pair {self.channel}, {self.label}' def print(self): print(self.string()) class NormFactor: ''' Defines a sampled normalization factor (n_i in the AZURE2 manual). ''' def __init__(self, dataset_index): self.index = dataset_index self.label = r'$n_{%d}$' % (self.index)
class Parameter: """ Defines a sampled (or "free") parameter by spin, parity, channel, rank, and whether it's an energy or width (kind). kind : "energy" or "width" "width" can be the partial width or ANC (depending on how it was set up in AZURE2) channel : channel pair (defined in AZURE2; consistent with AZURE2, these are one-based) rank : Which spin^{parity} level is this? (There are frequently more than one. Consistent with AZURE2, these are one-based.) """ def __init__(self, spin, parity, kind, channel, rank=1, is_anc=False): self.spin = spin self.parity = parity self.kind = kind self.channel = int(channel) self.rank = rank jpi_label = '+' if self.parity == 1 else '-' subscript = f'{rank:d},{channel:d}' superscript = f'({jpi_label:s}{spin:.1f})' if self.kind == 'energy': self.label = '$E_{%s}^{%s}$' % (subscript, superscript) elif self.kind == 'width': if is_anc: self.label = '$C_{%s}^{%s}$' % (subscript, superscript) else: self.label = '$\\Gamma_{%s}^{%s}$' % (subscript, superscript) else: print('"kind" attribute must be either "energy" or "width"') def string(self): parity = '+' if self.parity == 1 else '-' return f'{self.spin}{parity} {self.kind} (number {self.rank}) in particle pair {self.channel}, {self.label}' def print(self): print(self.string()) class Normfactor: """ Defines a sampled normalization factor (n_i in the AZURE2 manual). """ def __init__(self, dataset_index): self.index = dataset_index self.label = '$n_{%d}$' % self.index
config = { # these values are related to the user's environment 'env': { 'databases': { 'postgres_host': '127.0.0.1', 'postgres_name': 'jesse_db', 'postgres_port': 5432, 'postgres_username': 'jesse_user', 'postgres_password': 'password', }, 'caching': { 'driver': 'pickle' }, 'logging': { 'order_submission': True, 'order_cancellation': True, 'order_execution': True, 'position_opened': True, 'position_increased': True, 'position_reduced': True, 'position_closed': True, 'shorter_period_candles': False, 'trading_candles': True, 'balance_update': True, }, 'exchanges': { 'Sandbox': { 'fee': 0, 'type': 'spot', # used only in futures trading 'settlement_currency': 'USDT', # accepted values are: 'cross' and 'isolated' 'futures_leverage_mode': 'cross', # 1x, 2x, 10x, 50x, etc. Enter as integers 'futures_leverage': 1, 'assets': [ {'asset': 'USDT', 'balance': 10_000}, {'asset': 'BTC', 'balance': 0}, ], }, # https://www.bitfinex.com 'Bitfinex': { 'fee': 0.002, # backtest mode only: accepted are 'spot' and 'futures' 'type': 'futures', # futures mode only 'settlement_currency': 'USD', # accepted values are: 'cross' and 'isolated' 'futures_leverage_mode': 'cross', # 1x, 2x, 10x, 50x, etc. Enter as integers 'futures_leverage': 1, # used for spot exchange only 'assets': [ {'asset': 'USDT', 'balance': 10_000}, {'asset': 'USD', 'balance': 10_000}, {'asset': 'BTC', 'balance': 0}, ], }, # https://www.binance.com 'Binance': { 'fee': 0.001, # backtest mode only: accepted are 'spot' and 'futures' 'type': 'futures', # futures mode only 'settlement_currency': 'USDT', # accepted values are: 'cross' and 'isolated' 'futures_leverage_mode': 'cross', # 1x, 2x, 10x, 50x, etc. Enter as integers 'futures_leverage': 1, # used for spot exchange only 'assets': [ {'asset': 'USDT', 'balance': 10_000}, {'asset': 'BTC', 'balance': 0}, ], }, # https://www.binance.com 'Binance Futures': { 'fee': 0.0004, # backtest mode only: accepted are 'spot' and 'futures' 'type': 'futures', # futures mode only 'settlement_currency': 'USDT', # accepted values are: 'cross' and 'isolated' 'futures_leverage_mode': 'cross', # 1x, 2x, 10x, 50x, etc. Enter as integers 'futures_leverage': 1, # used for spot exchange only 'assets': [ {'asset': 'USDT', 'balance': 10_000}, ], }, # https://testnet.binancefuture.com 'Testnet Binance Futures': { 'fee': 0.0004, # backtest mode only: accepted are 'spot' and 'futures' 'type': 'futures', # futures mode only 'settlement_currency': 'USDT', # accepted values are: 'cross' and 'isolated' 'futures_leverage_mode': 'cross', # 1x, 2x, 10x, 50x, etc. Enter as integers 'futures_leverage': 1, # used for spot mode 'assets': [ {'asset': 'USDT', 'balance': 10_000}, ], }, # https://pro.coinbase.com 'Coinbase': { 'fee': 0.005, # backtest mode only: accepted are 'spot' and 'futures' 'type': 'futures', # futures mode only 'settlement_currency': 'USD', # accepted values are: 'cross' and 'isolated' 'futures_leverage_mode': 'cross', # 1x, 2x, 10x, 50x, etc. Enter as integers 'futures_leverage': 1, # used for spot exchange only 'assets': [ {'asset': 'USDT', 'balance': 10_000}, {'asset': 'USD', 'balance': 10_000}, {'asset': 'BTC', 'balance': 0}, ], }, }, # changes the metrics output of the backtest 'metrics': { 'sharpe_ratio': True, 'calmar_ratio': False, 'sortino_ratio': False, 'omega_ratio': False, 'winning_streak': False, 'losing_streak': False, 'largest_losing_trade': False, 'largest_winning_trade': False, 'total_winning_trades': False, 'total_losing_trades': False, }, # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Optimize mode # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Below configurations are related to the optimize mode # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 'optimization': { # sharpe, calmar, sortino, omega 'ratio': 'sharpe', }, # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Data # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Below configurations are related to the data # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 'data': { # The minimum number of warmup candles that is loaded before each session. 'warmup_candles_num': 210, } }, # These values are just placeholders used by Jesse at runtime 'app': { # list of currencies to consider 'considering_symbols': [], # The symbol to trade. 'trading_symbols': [], # list of time frames to consider 'considering_timeframes': [], # Which candle type do you intend trade on 'trading_timeframes': [], # list of exchanges to consider 'considering_exchanges': [], # list of exchanges to consider 'trading_exchanges': [], 'considering_candles': [], # dict of registered live trade drivers 'live_drivers': {}, # Accepted values are: 'backtest', 'livetrade', 'fitness'. 'trading_mode': '', # variable used for test-driving the livetrade mode 'is_test_driving': False, # this would enable many console.log()s in the code, which are helpful for debugging. 'debug_mode': False, }, } backup_config = config.copy() def set_config(c) -> None: global config config['env'] = c # add sandbox because it isn't in the local config file config['env']['exchanges']['Sandbox'] = { 'type': 'spot', # used only in futures trading 'settlement_currency': 'USDT', 'fee': 0, 'futures_leverage_mode': 'cross', 'futures_leverage': 1, 'assets': [ {'asset': 'USDT', 'balance': 10_000}, {'asset': 'BTC', 'balance': 0}, ], } def reset_config() -> None: global config config = backup_config.copy()
config = {'env': {'databases': {'postgres_host': '127.0.0.1', 'postgres_name': 'jesse_db', 'postgres_port': 5432, 'postgres_username': 'jesse_user', 'postgres_password': 'password'}, 'caching': {'driver': 'pickle'}, 'logging': {'order_submission': True, 'order_cancellation': True, 'order_execution': True, 'position_opened': True, 'position_increased': True, 'position_reduced': True, 'position_closed': True, 'shorter_period_candles': False, 'trading_candles': True, 'balance_update': True}, 'exchanges': {'Sandbox': {'fee': 0, 'type': 'spot', 'settlement_currency': 'USDT', 'futures_leverage_mode': 'cross', 'futures_leverage': 1, 'assets': [{'asset': 'USDT', 'balance': 10000}, {'asset': 'BTC', 'balance': 0}]}, 'Bitfinex': {'fee': 0.002, 'type': 'futures', 'settlement_currency': 'USD', 'futures_leverage_mode': 'cross', 'futures_leverage': 1, 'assets': [{'asset': 'USDT', 'balance': 10000}, {'asset': 'USD', 'balance': 10000}, {'asset': 'BTC', 'balance': 0}]}, 'Binance': {'fee': 0.001, 'type': 'futures', 'settlement_currency': 'USDT', 'futures_leverage_mode': 'cross', 'futures_leverage': 1, 'assets': [{'asset': 'USDT', 'balance': 10000}, {'asset': 'BTC', 'balance': 0}]}, 'Binance Futures': {'fee': 0.0004, 'type': 'futures', 'settlement_currency': 'USDT', 'futures_leverage_mode': 'cross', 'futures_leverage': 1, 'assets': [{'asset': 'USDT', 'balance': 10000}]}, 'Testnet Binance Futures': {'fee': 0.0004, 'type': 'futures', 'settlement_currency': 'USDT', 'futures_leverage_mode': 'cross', 'futures_leverage': 1, 'assets': [{'asset': 'USDT', 'balance': 10000}]}, 'Coinbase': {'fee': 0.005, 'type': 'futures', 'settlement_currency': 'USD', 'futures_leverage_mode': 'cross', 'futures_leverage': 1, 'assets': [{'asset': 'USDT', 'balance': 10000}, {'asset': 'USD', 'balance': 10000}, {'asset': 'BTC', 'balance': 0}]}}, 'metrics': {'sharpe_ratio': True, 'calmar_ratio': False, 'sortino_ratio': False, 'omega_ratio': False, 'winning_streak': False, 'losing_streak': False, 'largest_losing_trade': False, 'largest_winning_trade': False, 'total_winning_trades': False, 'total_losing_trades': False}, 'optimization': {'ratio': 'sharpe'}, 'data': {'warmup_candles_num': 210}}, 'app': {'considering_symbols': [], 'trading_symbols': [], 'considering_timeframes': [], 'trading_timeframes': [], 'considering_exchanges': [], 'trading_exchanges': [], 'considering_candles': [], 'live_drivers': {}, 'trading_mode': '', 'is_test_driving': False, 'debug_mode': False}} backup_config = config.copy() def set_config(c) -> None: global config config['env'] = c config['env']['exchanges']['Sandbox'] = {'type': 'spot', 'settlement_currency': 'USDT', 'fee': 0, 'futures_leverage_mode': 'cross', 'futures_leverage': 1, 'assets': [{'asset': 'USDT', 'balance': 10000}, {'asset': 'BTC', 'balance': 0}]} def reset_config() -> None: global config config = backup_config.copy()