content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
entrada = input() def fibonacci(n): fib = [0, 1, 1] if n > 0 and n <= 2: return fib[1] elif n == 0: return fib[0] else: for x in range(3, n+1): fib.append(0) fib[x] = fib[x-1] + fib[x-2] return fib[n] numeros = entrada.split(' ') numeros = list(map(int, numeros)) print(str(fibonacci(numeros[0])) + " " + str(fibonacci(numeros[1])) + " " + str(fibonacci(numeros[2])) + " " + str(fibonacci(numeros[3])))
entrada = input() def fibonacci(n): fib = [0, 1, 1] if n > 0 and n <= 2: return fib[1] elif n == 0: return fib[0] else: for x in range(3, n + 1): fib.append(0) fib[x] = fib[x - 1] + fib[x - 2] return fib[n] numeros = entrada.split(' ') numeros = list(map(int, numeros)) print(str(fibonacci(numeros[0])) + ' ' + str(fibonacci(numeros[1])) + ' ' + str(fibonacci(numeros[2])) + ' ' + str(fibonacci(numeros[3])))
class AXFundAddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
class Axfundaddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
class Usuario(object): def __init__(self, email='', senha=''): self.email = email self.senha = senha def __str__(self): return f'{self.email}' class Equipe(object): def __init__(self, nome='', sigla='', local=''): self.nome = nome self.sigla = sigla self.local = local def __str__(self): return f'{self.nome} ({self.sigla})' class Partida(object): def __init__(self, equipe_casa, equipe_visita, pontos_casa, pontos_visita): self.equipe_casa = equipe_casa self.equipe_visita = equipe_visita self.pontos_casa = pontos_casa self.pontos_visita = pontos_visita def __str__(self): return f'{self.equipe_casa} ({self.pontos_casa}) - {self.equipe_visita} ({self.pontos_visita})' def vencedor(self): if self.pontos_casa > self.pontos_visita: return self.equipe_casa elif self.pontos_visita > self.pontos_casa: return self.equipe_visita return False def id(self): return (self.equipe_casa.sigla+self.equipe_visita.sigla) def trocar_equipe(self, sigla_anterior, equipe): if self.equipe_casa.sigla == sigla_anterior: self.equipe_casa = equipe elif self.equipe_visita.sigla == sigla_anterior: self.equipe_visita = equipe
class Usuario(object): def __init__(self, email='', senha=''): self.email = email self.senha = senha def __str__(self): return f'{self.email}' class Equipe(object): def __init__(self, nome='', sigla='', local=''): self.nome = nome self.sigla = sigla self.local = local def __str__(self): return f'{self.nome} ({self.sigla})' class Partida(object): def __init__(self, equipe_casa, equipe_visita, pontos_casa, pontos_visita): self.equipe_casa = equipe_casa self.equipe_visita = equipe_visita self.pontos_casa = pontos_casa self.pontos_visita = pontos_visita def __str__(self): return f'{self.equipe_casa} ({self.pontos_casa}) - {self.equipe_visita} ({self.pontos_visita})' def vencedor(self): if self.pontos_casa > self.pontos_visita: return self.equipe_casa elif self.pontos_visita > self.pontos_casa: return self.equipe_visita return False def id(self): return self.equipe_casa.sigla + self.equipe_visita.sigla def trocar_equipe(self, sigla_anterior, equipe): if self.equipe_casa.sigla == sigla_anterior: self.equipe_casa = equipe elif self.equipe_visita.sigla == sigla_anterior: self.equipe_visita = equipe
''' | Write a program that should prompt the user to type some sentences. It should then print number of words, number of characters, number of digits and number of special characters in it. | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | We use the input() function to receive input from the user and print() function to print it | ''' string = input("Enter a sentence...\n") numbers = '1234567890' chars = '!@#$%^&*()<>?:-\"\'}+=_{|\][;//.,`~' num_words = len(string.split()) res = [0,0,0] for i in string: if i.isalpha(): res[0] += 1 elif i in numbers: res[1] += 1 elif i in chars: res[2] += 1 else: pass print(f'There are {num_words} word(s), {res[0]} alphabets, {res[1]} digits and {res[2]} special characters in the given string.')
""" | Write a program that should prompt the user to type some sentences. It should then print number of words, number of characters, number of digits and number of special characters in it. | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | We use the input() function to receive input from the user and print() function to print it | """ string = input('Enter a sentence...\n') numbers = '1234567890' chars = '!@#$%^&*()<>?:-"\'}+=_{|\\][;//.,`~' num_words = len(string.split()) res = [0, 0, 0] for i in string: if i.isalpha(): res[0] += 1 elif i in numbers: res[1] += 1 elif i in chars: res[2] += 1 else: pass print(f'There are {num_words} word(s), {res[0]} alphabets, {res[1]} digits and {res[2]} special characters in the given string.')
def problem1_1(): print("Problem Set 1") pass # replace this pass (a do-nothing) statement with your code
def problem1_1(): print('Problem Set 1') pass
# # PySNMP MIB module CTRON-SSR-CONFIG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SSR-CONFIG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:15:46 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, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint") ssrMibs, = mibBuilder.importSymbols("CTRON-SSR-SMI-MIB", "ssrMibs") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Counter32, MibIdentifier, IpAddress, Gauge32, Counter64, ModuleIdentity, iso, Bits, NotificationType, TimeTicks, Unsigned32, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Counter32", "MibIdentifier", "IpAddress", "Gauge32", "Counter64", "ModuleIdentity", "iso", "Bits", "NotificationType", "TimeTicks", "Unsigned32", "Integer32") TextualConvention, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString") ssrConfigMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230)) ssrConfigMIB.setRevisions(('2000-07-15 00:00', '2000-02-20 00:00', '1998-08-17 00:00',)) if mibBuilder.loadTexts: ssrConfigMIB.setLastUpdated('200007150000Z') if mibBuilder.loadTexts: ssrConfigMIB.setOrganization('Cabletron Systems, Inc') class SSRErrorCode(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8)) namedValues = NamedValues(("noStatus", 1), ("timeout", 2), ("networkError", 3), ("noSpace", 4), ("invalidConfig", 5), ("commandCompleted", 6), ("internalError", 7), ("tftpServerError", 8)) cfgGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231)) cfgTransferOp = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("noop", 1), ("sendConfigToAgent", 2), ("receiveConfigFromAgent", 3), ("receiveBootlogFromAgent", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgTransferOp.setStatus('current') cfgManagerAddress = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgManagerAddress.setStatus('current') cfgFileName = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgFileName.setStatus('current') cfgActivateTransfer = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 4), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgActivateTransfer.setStatus('current') cfgTransferStatus = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("idle", 1), ("sending", 2), ("receiving", 3), ("transferComplete", 4), ("error", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgTransferStatus.setStatus('current') cfgActivateFile = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 6), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgActivateFile.setStatus('current') cfgLastError = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 7), SSRErrorCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgLastError.setStatus('current') cfgLastErrorReason = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgLastErrorReason.setStatus('current') cfgActiveImageVersion = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgActiveImageVersion.setStatus('current') cfgActiveImageBootLocation = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 10), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgActiveImageBootLocation.setStatus('current') configConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3)) configCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1)) configGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2)) configCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1, 1)).setObjects(("CTRON-SSR-CONFIG-MIB", "configGroup10")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configCompliance = configCompliance.setStatus('obsolete') configCompliance2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1, 2)).setObjects(("CTRON-SSR-CONFIG-MIB", "configGroup20")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configCompliance2 = configCompliance2.setStatus('current') configGroup10 = ObjectGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2, 1)).setObjects(("CTRON-SSR-CONFIG-MIB", "cfgTransferOp"), ("CTRON-SSR-CONFIG-MIB", "cfgManagerAddress"), ("CTRON-SSR-CONFIG-MIB", "cfgFileName"), ("CTRON-SSR-CONFIG-MIB", "cfgActivateTransfer"), ("CTRON-SSR-CONFIG-MIB", "cfgTransferStatus"), ("CTRON-SSR-CONFIG-MIB", "cfgActivateFile"), ("CTRON-SSR-CONFIG-MIB", "cfgLastError"), ("CTRON-SSR-CONFIG-MIB", "cfgLastErrorReason")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configGroup10 = configGroup10.setStatus('deprecated') configGroup20 = ObjectGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2, 2)).setObjects(("CTRON-SSR-CONFIG-MIB", "cfgTransferOp"), ("CTRON-SSR-CONFIG-MIB", "cfgManagerAddress"), ("CTRON-SSR-CONFIG-MIB", "cfgFileName"), ("CTRON-SSR-CONFIG-MIB", "cfgActivateTransfer"), ("CTRON-SSR-CONFIG-MIB", "cfgTransferStatus"), ("CTRON-SSR-CONFIG-MIB", "cfgActivateFile"), ("CTRON-SSR-CONFIG-MIB", "cfgLastError"), ("CTRON-SSR-CONFIG-MIB", "cfgLastErrorReason"), ("CTRON-SSR-CONFIG-MIB", "cfgActiveImageVersion"), ("CTRON-SSR-CONFIG-MIB", "cfgActiveImageBootLocation")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configGroup20 = configGroup20.setStatus('current') mibBuilder.exportSymbols("CTRON-SSR-CONFIG-MIB", cfgManagerAddress=cfgManagerAddress, cfgActiveImageVersion=cfgActiveImageVersion, cfgActivateFile=cfgActivateFile, configGroups=configGroups, cfgLastErrorReason=cfgLastErrorReason, ssrConfigMIB=ssrConfigMIB, SSRErrorCode=SSRErrorCode, configCompliance=configCompliance, configGroup20=configGroup20, cfgGroup=cfgGroup, cfgActiveImageBootLocation=cfgActiveImageBootLocation, configConformance=configConformance, configCompliance2=configCompliance2, cfgFileName=cfgFileName, cfgLastError=cfgLastError, configGroup10=configGroup10, cfgTransferOp=cfgTransferOp, PYSNMP_MODULE_ID=ssrConfigMIB, cfgActivateTransfer=cfgActivateTransfer, cfgTransferStatus=cfgTransferStatus, configCompliances=configCompliances)
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint') (ssr_mibs,) = mibBuilder.importSymbols('CTRON-SSR-SMI-MIB', 'ssrMibs') (module_compliance, object_group, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'ObjectGroup', 'NotificationGroup') (mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, counter32, mib_identifier, ip_address, gauge32, counter64, module_identity, iso, bits, notification_type, time_ticks, unsigned32, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'Counter32', 'MibIdentifier', 'IpAddress', 'Gauge32', 'Counter64', 'ModuleIdentity', 'iso', 'Bits', 'NotificationType', 'TimeTicks', 'Unsigned32', 'Integer32') (textual_convention, truth_value, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'DisplayString') ssr_config_mib = module_identity((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230)) ssrConfigMIB.setRevisions(('2000-07-15 00:00', '2000-02-20 00:00', '1998-08-17 00:00')) if mibBuilder.loadTexts: ssrConfigMIB.setLastUpdated('200007150000Z') if mibBuilder.loadTexts: ssrConfigMIB.setOrganization('Cabletron Systems, Inc') class Ssrerrorcode(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8)) named_values = named_values(('noStatus', 1), ('timeout', 2), ('networkError', 3), ('noSpace', 4), ('invalidConfig', 5), ('commandCompleted', 6), ('internalError', 7), ('tftpServerError', 8)) cfg_group = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231)) cfg_transfer_op = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('noop', 1), ('sendConfigToAgent', 2), ('receiveConfigFromAgent', 3), ('receiveBootlogFromAgent', 4)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgTransferOp.setStatus('current') cfg_manager_address = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 2), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgManagerAddress.setStatus('current') cfg_file_name = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 3), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgFileName.setStatus('current') cfg_activate_transfer = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 4), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgActivateTransfer.setStatus('current') cfg_transfer_status = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('idle', 1), ('sending', 2), ('receiving', 3), ('transferComplete', 4), ('error', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgTransferStatus.setStatus('current') cfg_activate_file = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 6), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgActivateFile.setStatus('current') cfg_last_error = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 7), ssr_error_code()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgLastError.setStatus('current') cfg_last_error_reason = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 8), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgLastErrorReason.setStatus('current') cfg_active_image_version = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 9), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgActiveImageVersion.setStatus('current') cfg_active_image_boot_location = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 10), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgActiveImageBootLocation.setStatus('current') config_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3)) config_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1)) config_groups = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2)) config_compliance = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1, 1)).setObjects(('CTRON-SSR-CONFIG-MIB', 'configGroup10')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): config_compliance = configCompliance.setStatus('obsolete') config_compliance2 = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1, 2)).setObjects(('CTRON-SSR-CONFIG-MIB', 'configGroup20')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): config_compliance2 = configCompliance2.setStatus('current') config_group10 = object_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2, 1)).setObjects(('CTRON-SSR-CONFIG-MIB', 'cfgTransferOp'), ('CTRON-SSR-CONFIG-MIB', 'cfgManagerAddress'), ('CTRON-SSR-CONFIG-MIB', 'cfgFileName'), ('CTRON-SSR-CONFIG-MIB', 'cfgActivateTransfer'), ('CTRON-SSR-CONFIG-MIB', 'cfgTransferStatus'), ('CTRON-SSR-CONFIG-MIB', 'cfgActivateFile'), ('CTRON-SSR-CONFIG-MIB', 'cfgLastError'), ('CTRON-SSR-CONFIG-MIB', 'cfgLastErrorReason')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): config_group10 = configGroup10.setStatus('deprecated') config_group20 = object_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2, 2)).setObjects(('CTRON-SSR-CONFIG-MIB', 'cfgTransferOp'), ('CTRON-SSR-CONFIG-MIB', 'cfgManagerAddress'), ('CTRON-SSR-CONFIG-MIB', 'cfgFileName'), ('CTRON-SSR-CONFIG-MIB', 'cfgActivateTransfer'), ('CTRON-SSR-CONFIG-MIB', 'cfgTransferStatus'), ('CTRON-SSR-CONFIG-MIB', 'cfgActivateFile'), ('CTRON-SSR-CONFIG-MIB', 'cfgLastError'), ('CTRON-SSR-CONFIG-MIB', 'cfgLastErrorReason'), ('CTRON-SSR-CONFIG-MIB', 'cfgActiveImageVersion'), ('CTRON-SSR-CONFIG-MIB', 'cfgActiveImageBootLocation')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): config_group20 = configGroup20.setStatus('current') mibBuilder.exportSymbols('CTRON-SSR-CONFIG-MIB', cfgManagerAddress=cfgManagerAddress, cfgActiveImageVersion=cfgActiveImageVersion, cfgActivateFile=cfgActivateFile, configGroups=configGroups, cfgLastErrorReason=cfgLastErrorReason, ssrConfigMIB=ssrConfigMIB, SSRErrorCode=SSRErrorCode, configCompliance=configCompliance, configGroup20=configGroup20, cfgGroup=cfgGroup, cfgActiveImageBootLocation=cfgActiveImageBootLocation, configConformance=configConformance, configCompliance2=configCompliance2, cfgFileName=cfgFileName, cfgLastError=cfgLastError, configGroup10=configGroup10, cfgTransferOp=cfgTransferOp, PYSNMP_MODULE_ID=ssrConfigMIB, cfgActivateTransfer=cfgActivateTransfer, cfgTransferStatus=cfgTransferStatus, configCompliances=configCompliances)
seats = [] with open("input.txt") as f: for line in f: line = line.replace("\n", "") seat = {} seat["raw"] = line seat["row"] = int(seat["raw"][:7].replace("F", "0").replace("B", "1"), 2) seat["column"] = int(seat["raw"][-3:].replace("L", "0").replace("R", "1"), 2) seat["id"] = seat["row"] * 8 + seat["column"] seats.append(seat) seats = sorted(seats, key=lambda k: k["id"], reverse=True) for i, seat in enumerate(seats): if seat["id"]-1 != seats[i+1]["id"]: print(seat["id"]-1) break
seats = [] with open('input.txt') as f: for line in f: line = line.replace('\n', '') seat = {} seat['raw'] = line seat['row'] = int(seat['raw'][:7].replace('F', '0').replace('B', '1'), 2) seat['column'] = int(seat['raw'][-3:].replace('L', '0').replace('R', '1'), 2) seat['id'] = seat['row'] * 8 + seat['column'] seats.append(seat) seats = sorted(seats, key=lambda k: k['id'], reverse=True) for (i, seat) in enumerate(seats): if seat['id'] - 1 != seats[i + 1]['id']: print(seat['id'] - 1) break
class MLModelInterface: def fit(self, features, labels): raise NotImplementedError def predict(self, data): raise NotImplementedError class KNeighborsClassifier(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class LinearRegression(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class LogisticsRegression(MLModelInterface): pass # Imput to the classifier features = [ (5.1, 3.5, 1.4, 0.2), (4.9, 3.0, 1.4, 0.2), (4.7, 3.2, 1.3, 0.2), (7.0, 3.2, 4.7, 1.4), (6.4, 3.2, 4.5, 1.5), (6.9, 3.1, 4.9, 1.5), (6.3, 3.3, 6.0, 2.5), (5.8, 2.7, 5.1, 1.9), (7.1, 3.0, 5.9, 2.1), ] # 0: I. setosa # 1: I. versicolor # 2: I. virginica labels = [0, 0, 0, 1, 1, 1, 2, 2, 2] to_predict = [ (5.7, 2.8, 4.1, 1.3), (4.9, 2.5, 4.5, 1.7), (4.6, 3.4, 1.4, 0.3), ] model = LinearRegression() model.fit(features, labels) model.predict(to_predict) # [1, 2, 0]
class Mlmodelinterface: def fit(self, features, labels): raise NotImplementedError def predict(self, data): raise NotImplementedError class Kneighborsclassifier(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class Linearregression(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class Logisticsregression(MLModelInterface): pass features = [(5.1, 3.5, 1.4, 0.2), (4.9, 3.0, 1.4, 0.2), (4.7, 3.2, 1.3, 0.2), (7.0, 3.2, 4.7, 1.4), (6.4, 3.2, 4.5, 1.5), (6.9, 3.1, 4.9, 1.5), (6.3, 3.3, 6.0, 2.5), (5.8, 2.7, 5.1, 1.9), (7.1, 3.0, 5.9, 2.1)] labels = [0, 0, 0, 1, 1, 1, 2, 2, 2] to_predict = [(5.7, 2.8, 4.1, 1.3), (4.9, 2.5, 4.5, 1.7), (4.6, 3.4, 1.4, 0.3)] model = linear_regression() model.fit(features, labels) model.predict(to_predict)
{ "targets": [ { "target_name": "gpio", "sources": ["gpio.cc", "tizen-gpio.cc"] } ] }
{'targets': [{'target_name': 'gpio', 'sources': ['gpio.cc', 'tizen-gpio.cc']}]}
songs = { ('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('Miles Davis', 'Stella by Starlight'), ('Nickelback', 'Animals') } # Using a set comprehension, create a new set that contains all songs that were not performed by Nickelback. nonNickelback = {}
songs = {('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('Miles Davis', 'Stella by Starlight'), ('Nickelback', 'Animals')} non_nickelback = {}
file1 = open("./logs/pythonlog.txt", 'r+') avg1 = 0.0 lines1 = 0.0 for line in file1: lines1 = lines1 + 1.0 avg1 = (avg1 + float(line)) avg1 = avg1/lines1 print(avg1, "for Python with", lines1, "lines") file2 = open("./logs/clog.txt", 'r+') avg2 = 0.0 lines2 = 0.0 for line in file2: lines2 = lines2 + 1.0 avg2 = (avg2 + float(line)) avg2 = avg2/lines2 print(avg2, "for C with", lines2, "lines") file3 = open("./logs/cpplog.txt", 'r+') avg3 = 0.0 lines3 = 0.0 for line in file3: lines3 = lines3 + 1.0 avg3 = (avg3 + float(line)) avg3 = avg3/lines3 print(avg3, "for C++ with", lines3, "lines") file4 = open("./logs/javalog.txt", 'r+') avg4 = 0.0 lines4 = 0.0 for line in file4: lines4 = lines4 + 1.0 avg4 = (avg4 + float(line)) avg4 = avg4/lines4 print(avg4, "for Java with", lines4, "lines") word = "" while(word.lower() != "y" and word.lower() != "n"): word = input("Do you want to wipe the previous log? [Y/N]") if(word.lower() == "y"): file1.truncate(0) file3.truncate(0) file2.truncate(0) file4.truncate(0) print("Done.") file4.close() file3.close() file2.close() file1.close()
file1 = open('./logs/pythonlog.txt', 'r+') avg1 = 0.0 lines1 = 0.0 for line in file1: lines1 = lines1 + 1.0 avg1 = avg1 + float(line) avg1 = avg1 / lines1 print(avg1, 'for Python with', lines1, 'lines') file2 = open('./logs/clog.txt', 'r+') avg2 = 0.0 lines2 = 0.0 for line in file2: lines2 = lines2 + 1.0 avg2 = avg2 + float(line) avg2 = avg2 / lines2 print(avg2, 'for C with', lines2, 'lines') file3 = open('./logs/cpplog.txt', 'r+') avg3 = 0.0 lines3 = 0.0 for line in file3: lines3 = lines3 + 1.0 avg3 = avg3 + float(line) avg3 = avg3 / lines3 print(avg3, 'for C++ with', lines3, 'lines') file4 = open('./logs/javalog.txt', 'r+') avg4 = 0.0 lines4 = 0.0 for line in file4: lines4 = lines4 + 1.0 avg4 = avg4 + float(line) avg4 = avg4 / lines4 print(avg4, 'for Java with', lines4, 'lines') word = '' while word.lower() != 'y' and word.lower() != 'n': word = input('Do you want to wipe the previous log? [Y/N]') if word.lower() == 'y': file1.truncate(0) file3.truncate(0) file2.truncate(0) file4.truncate(0) print('Done.') file4.close() file3.close() file2.close() file1.close()
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: if head is None: return None # 1 - check cycle p1 = head p2 = head.next has_cycle = False while p2 is not None and p2.next is not None: if p1 == p2: has_cycle = True break p1 = p1.next p2 = p2.next.next if not has_cycle: return None # 2 - cycle length cycle_length = 1 p2 = p1.next while p1 != p2: p2 = p2.next cycle_length += 1 # 3 - problem 19, the nth node from the end # L = cycle + non # p1 moves cycle # p1 and p2 moves non, meeting at the start dummy = ListNode(None) dummy.next = head p1 = dummy for _ in range(cycle_length): p1 = p1.next p2 = dummy while p2 != p1: p1 = p1.next p2 = p2.next return p1 if __name__ == "__main__": head = ListNode(1) p = head node = ListNode(2) p.next = node p = p.next node = ListNode(3) p.next = node p = p.next node = ListNode(4) p.next = node p = p.next start = node node = ListNode(5) p.next = node p = p.next node = ListNode(6) p.next = node p = p.next node = ListNode(7) p.next = node p = p.next p.next = start sol = Solution() print(sol.detectCycle(head).val)
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def detect_cycle(self, head: ListNode) -> ListNode: if head is None: return None p1 = head p2 = head.next has_cycle = False while p2 is not None and p2.next is not None: if p1 == p2: has_cycle = True break p1 = p1.next p2 = p2.next.next if not has_cycle: return None cycle_length = 1 p2 = p1.next while p1 != p2: p2 = p2.next cycle_length += 1 dummy = list_node(None) dummy.next = head p1 = dummy for _ in range(cycle_length): p1 = p1.next p2 = dummy while p2 != p1: p1 = p1.next p2 = p2.next return p1 if __name__ == '__main__': head = list_node(1) p = head node = list_node(2) p.next = node p = p.next node = list_node(3) p.next = node p = p.next node = list_node(4) p.next = node p = p.next start = node node = list_node(5) p.next = node p = p.next node = list_node(6) p.next = node p = p.next node = list_node(7) p.next = node p = p.next p.next = start sol = solution() print(sol.detectCycle(head).val)
#!/usr/bin/python def add(a,b): return a+b def sub(a,b): return a-b def mul(a,b): return a*b def div(a,b): return a/b a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) print("Please select operation : \n" \ "1. Addition \n" \ "2. Subtraction \n" \ "3. Multiplication \n" \ "4. Division \n") select = int(input("Select operations form 1, 2, 3, 4 :")) if select == 1: print(a, "+", b, "=", add(a,b)) elif select == 2: print(a, "-", b, "=", sub(a,b)) elif select == 3: print(a, "*", b, "=", mul(a,b)) elif select == 4: if b == 0: exit elif b != 0: print(a, "/", b, "=", div(a,b)) else: print("Invalid input")
def add(a, b): return a + b def sub(a, b): return a - b def mul(a, b): return a * b def div(a, b): return a / b a = int(input('Enter first number: ')) b = int(input('Enter second number: ')) print('Please select operation : \n1. Addition \n2. Subtraction \n3. Multiplication \n4. Division \n') select = int(input('Select operations form 1, 2, 3, 4 :')) if select == 1: print(a, '+', b, '=', add(a, b)) elif select == 2: print(a, '-', b, '=', sub(a, b)) elif select == 3: print(a, '*', b, '=', mul(a, b)) elif select == 4: if b == 0: exit elif b != 0: print(a, '/', b, '=', div(a, b)) else: print('Invalid input')
# The classroom scheduling problem # Suppose you have a classroom and you want to hold as many classes as possible # __________________________ #| class | start | end | #|_______|_________|________| #| Art | 9:00 am | 10:30am| #|_______|_________|________| #| Eng | 9:30am | 10:30am| #|_______|_________|________| #| Math | 10 am | 11 am | #|_______|_________|________| #| CS | 10:30am | 11.30am| #|_______|_________|________| #| Music | 11 am | 12 pm | #|_______|_________|________| #| def schedule(classes): possible_classes = [] possible_classes.append(classes[0]) print(possible_classes) # return for i in range(2,len(classes)): if possible_classes[-1][1]<=classes[i][0]: possible_classes.append(classes[i]) return possible_classes
def schedule(classes): possible_classes = [] possible_classes.append(classes[0]) print(possible_classes) for i in range(2, len(classes)): if possible_classes[-1][1] <= classes[i][0]: possible_classes.append(classes[i]) return possible_classes
class restaurantvalidator(): def valideaza(self, restaurant): erori = [] if len(restaurant.nume) == 0: erori.append('numele nu trb sa fie null') if erori: raise ValueError(erori)
class Restaurantvalidator: def valideaza(self, restaurant): erori = [] if len(restaurant.nume) == 0: erori.append('numele nu trb sa fie null') if erori: raise value_error(erori)
OVERALL_CATEGORY_ID = '0x02E00000FFFFFFFF' HERO_CATEGORY_IDS = { 'reaper': '0x02E0000000000002', 'tracer': '0x02E0000000000003', 'mercy': '0x02E0000000000004', 'hanzo': '0x02E0000000000005', 'torbjorn': '0x02E0000000000006', 'reinhardt': '0x02E0000000000007', 'pharah': '0x02E0000000000008', 'winston': '0x02E0000000000009', 'widowmaker': '0x02E000000000000A', 'bastion': '0x02E0000000000015', 'symmetra': '0x02E0000000000016', 'zenyatta': '0x02E0000000000020', 'genji': '0x02E0000000000029', 'roadhog': '0x02E0000000000040', 'mccree': '0x02E0000000000042', 'junkrat': '0x02E0000000000065', 'zarya': '0x02E0000000000068', 'soldier76': '0x02E000000000006E', 'lucio': '0x02E0000000000079', 'dva': '0x02E000000000007A', 'mei': '0x02E00000000000DD', 'sombra': '0x02E000000000012E', 'ana': '0x02E000000000013B', 'orisa': '0x02E000000000013E', 'doomfist': '0x02E000000000012F', 'moira': '0x02E00000000001A2', 'brigitte': '0x02E0000000000195', 'wrecking_ball': '0x02E00000000001CA', } INVERTED_HERO_CATEGORY_IDS = {category_id: hero for hero, category_id in HERO_CATEGORY_IDS.items()} # Taken from https://github.com/SunDwarf/OWAPI/blob/master/owapi/prestige.py LEVEL_IDS = { # Bronze '0x0250000000000918': 0, '0x0250000000000919': 0, '0x025000000000091A': 0, '0x025000000000091B': 0, '0x025000000000091C': 0, '0x025000000000091D': 0, '0x025000000000091E': 0, '0x025000000000091F': 0, '0x0250000000000920': 0, '0x0250000000000921': 0, '0x0250000000000922': 100, '0x0250000000000924': 100, '0x0250000000000925': 100, '0x0250000000000926': 100, '0x025000000000094C': 100, '0x0250000000000927': 100, '0x0250000000000928': 100, '0x0250000000000929': 100, '0x025000000000092B': 100, '0x0250000000000950': 100, '0x025000000000092A': 200, '0x025000000000092C': 200, '0x0250000000000937': 200, '0x025000000000093B': 200, '0x0250000000000933': 200, '0x0250000000000923': 200, '0x0250000000000944': 200, '0x0250000000000948': 200, '0x025000000000093F': 200, '0x0250000000000951': 200, '0x025000000000092D': 300, '0x0250000000000930': 300, '0x0250000000000934': 300, '0x0250000000000938': 300, '0x0250000000000940': 300, '0x0250000000000949': 300, '0x0250000000000952': 300, '0x025000000000094D': 300, '0x0250000000000945': 300, '0x025000000000093C': 300, '0x025000000000092E': 400, '0x0250000000000931': 400, '0x0250000000000935': 400, '0x025000000000093D': 400, '0x0250000000000946': 400, '0x025000000000094A': 400, '0x0250000000000953': 400, '0x025000000000094E': 400, '0x0250000000000939': 400, '0x0250000000000941': 400, '0x025000000000092F': 500, '0x0250000000000932': 500, '0x025000000000093E': 500, '0x0250000000000936': 500, '0x025000000000093A': 500, '0x0250000000000942': 500, '0x0250000000000947': 500, '0x025000000000094F': 500, '0x025000000000094B': 500, '0x0250000000000954': 500, # Silver '0x0250000000000956': 600, '0x025000000000095C': 600, '0x025000000000095D': 600, '0x025000000000095E': 600, '0x025000000000095F': 600, '0x0250000000000960': 600, '0x0250000000000961': 600, '0x0250000000000962': 600, '0x0250000000000963': 600, '0x0250000000000964': 600, '0x0250000000000957': 700, '0x0250000000000965': 700, '0x0250000000000966': 700, '0x0250000000000967': 700, '0x0250000000000968': 700, '0x0250000000000969': 700, '0x025000000000096A': 700, '0x025000000000096B': 700, '0x025000000000096C': 700, '0x025000000000096D': 700, '0x0250000000000958': 800, '0x025000000000096E': 800, '0x025000000000096F': 800, '0x0250000000000970': 800, '0x0250000000000971': 800, '0x0250000000000972': 800, '0x0250000000000973': 800, '0x0250000000000974': 800, '0x0250000000000975': 800, '0x0250000000000976': 800, '0x0250000000000959': 900, '0x0250000000000977': 900, '0x0250000000000978': 900, '0x0250000000000979': 900, '0x025000000000097A': 900, '0x025000000000097B': 900, '0x025000000000097C': 900, '0x025000000000097D': 900, '0x025000000000097E': 900, '0x025000000000097F': 900, '0x025000000000095A': 1000, '0x0250000000000980': 1000, '0x0250000000000981': 1000, '0x0250000000000982': 1000, '0x0250000000000983': 1000, '0x0250000000000984': 1000, '0x0250000000000985': 1000, '0x0250000000000986': 1000, '0x0250000000000987': 1000, '0x0250000000000988': 1000, '0x025000000000095B': 1100, '0x0250000000000989': 1100, '0x025000000000098A': 1100, '0x025000000000098B': 1100, '0x025000000000098C': 1100, '0x025000000000098D': 1100, '0x025000000000098E': 1100, '0x025000000000098F': 1100, '0x0250000000000991': 1100, '0x0250000000000990': 1100, # Gold '0x0250000000000992': 1200, '0x0250000000000993': 1200, '0x0250000000000994': 1200, '0x0250000000000995': 1200, '0x0250000000000996': 1200, '0x0250000000000997': 1200, '0x0250000000000998': 1200, '0x0250000000000999': 1200, '0x025000000000099A': 1200, '0x025000000000099B': 1200, '0x025000000000099C': 1300, '0x025000000000099D': 1300, '0x025000000000099E': 1300, '0x025000000000099F': 1300, '0x02500000000009A0': 1300, '0x02500000000009A1': 1300, '0x02500000000009A2': 1300, '0x02500000000009A3': 1300, '0x02500000000009A4': 1300, '0x02500000000009A5': 1300, '0x02500000000009A6': 1400, '0x02500000000009A7': 1400, '0x02500000000009A8': 1400, '0x02500000000009A9': 1400, '0x02500000000009AA': 1400, '0x02500000000009AB': 1400, '0x02500000000009AC': 1400, '0x02500000000009AD': 1400, '0x02500000000009AE': 1400, '0x02500000000009AF': 1400, '0x02500000000009B0': 1500, '0x02500000000009B1': 1500, '0x02500000000009B2': 1500, '0x02500000000009B3': 1500, '0x02500000000009B4': 1500, '0x02500000000009B5': 1500, '0x02500000000009B6': 1500, '0x02500000000009B7': 1500, '0x02500000000009B8': 1500, '0x02500000000009B9': 1500, '0x02500000000009BA': 1600, '0x02500000000009BB': 1600, '0x02500000000009BC': 1600, '0x02500000000009BD': 1600, '0x02500000000009BE': 1600, '0x02500000000009BF': 1600, '0x02500000000009C0': 1600, '0x02500000000009C1': 1600, '0x02500000000009C2': 1600, '0x02500000000009C3': 1600, '0x02500000000009C4': 1700, '0x02500000000009C5': 1700, '0x02500000000009C6': 1700, '0x02500000000009C7': 1700, '0x02500000000009C8': 1700, '0x02500000000009C9': 1700, '0x02500000000009CA': 1700, '0x02500000000009CB': 1700, '0x02500000000009CC': 1700, '0x02500000000009CD': 1700, }
overall_category_id = '0x02E00000FFFFFFFF' hero_category_ids = {'reaper': '0x02E0000000000002', 'tracer': '0x02E0000000000003', 'mercy': '0x02E0000000000004', 'hanzo': '0x02E0000000000005', 'torbjorn': '0x02E0000000000006', 'reinhardt': '0x02E0000000000007', 'pharah': '0x02E0000000000008', 'winston': '0x02E0000000000009', 'widowmaker': '0x02E000000000000A', 'bastion': '0x02E0000000000015', 'symmetra': '0x02E0000000000016', 'zenyatta': '0x02E0000000000020', 'genji': '0x02E0000000000029', 'roadhog': '0x02E0000000000040', 'mccree': '0x02E0000000000042', 'junkrat': '0x02E0000000000065', 'zarya': '0x02E0000000000068', 'soldier76': '0x02E000000000006E', 'lucio': '0x02E0000000000079', 'dva': '0x02E000000000007A', 'mei': '0x02E00000000000DD', 'sombra': '0x02E000000000012E', 'ana': '0x02E000000000013B', 'orisa': '0x02E000000000013E', 'doomfist': '0x02E000000000012F', 'moira': '0x02E00000000001A2', 'brigitte': '0x02E0000000000195', 'wrecking_ball': '0x02E00000000001CA'} inverted_hero_category_ids = {category_id: hero for (hero, category_id) in HERO_CATEGORY_IDS.items()} level_ids = {'0x0250000000000918': 0, '0x0250000000000919': 0, '0x025000000000091A': 0, '0x025000000000091B': 0, '0x025000000000091C': 0, '0x025000000000091D': 0, '0x025000000000091E': 0, '0x025000000000091F': 0, '0x0250000000000920': 0, '0x0250000000000921': 0, '0x0250000000000922': 100, '0x0250000000000924': 100, '0x0250000000000925': 100, '0x0250000000000926': 100, '0x025000000000094C': 100, '0x0250000000000927': 100, '0x0250000000000928': 100, '0x0250000000000929': 100, '0x025000000000092B': 100, '0x0250000000000950': 100, '0x025000000000092A': 200, '0x025000000000092C': 200, '0x0250000000000937': 200, '0x025000000000093B': 200, '0x0250000000000933': 200, '0x0250000000000923': 200, '0x0250000000000944': 200, '0x0250000000000948': 200, '0x025000000000093F': 200, '0x0250000000000951': 200, '0x025000000000092D': 300, '0x0250000000000930': 300, '0x0250000000000934': 300, '0x0250000000000938': 300, '0x0250000000000940': 300, '0x0250000000000949': 300, '0x0250000000000952': 300, '0x025000000000094D': 300, '0x0250000000000945': 300, '0x025000000000093C': 300, '0x025000000000092E': 400, '0x0250000000000931': 400, '0x0250000000000935': 400, '0x025000000000093D': 400, '0x0250000000000946': 400, '0x025000000000094A': 400, '0x0250000000000953': 400, '0x025000000000094E': 400, '0x0250000000000939': 400, '0x0250000000000941': 400, '0x025000000000092F': 500, '0x0250000000000932': 500, '0x025000000000093E': 500, '0x0250000000000936': 500, '0x025000000000093A': 500, '0x0250000000000942': 500, '0x0250000000000947': 500, '0x025000000000094F': 500, '0x025000000000094B': 500, '0x0250000000000954': 500, '0x0250000000000956': 600, '0x025000000000095C': 600, '0x025000000000095D': 600, '0x025000000000095E': 600, '0x025000000000095F': 600, '0x0250000000000960': 600, '0x0250000000000961': 600, '0x0250000000000962': 600, '0x0250000000000963': 600, '0x0250000000000964': 600, '0x0250000000000957': 700, '0x0250000000000965': 700, '0x0250000000000966': 700, '0x0250000000000967': 700, '0x0250000000000968': 700, '0x0250000000000969': 700, '0x025000000000096A': 700, '0x025000000000096B': 700, '0x025000000000096C': 700, '0x025000000000096D': 700, '0x0250000000000958': 800, '0x025000000000096E': 800, '0x025000000000096F': 800, '0x0250000000000970': 800, '0x0250000000000971': 800, '0x0250000000000972': 800, '0x0250000000000973': 800, '0x0250000000000974': 800, '0x0250000000000975': 800, '0x0250000000000976': 800, '0x0250000000000959': 900, '0x0250000000000977': 900, '0x0250000000000978': 900, '0x0250000000000979': 900, '0x025000000000097A': 900, '0x025000000000097B': 900, '0x025000000000097C': 900, '0x025000000000097D': 900, '0x025000000000097E': 900, '0x025000000000097F': 900, '0x025000000000095A': 1000, '0x0250000000000980': 1000, '0x0250000000000981': 1000, '0x0250000000000982': 1000, '0x0250000000000983': 1000, '0x0250000000000984': 1000, '0x0250000000000985': 1000, '0x0250000000000986': 1000, '0x0250000000000987': 1000, '0x0250000000000988': 1000, '0x025000000000095B': 1100, '0x0250000000000989': 1100, '0x025000000000098A': 1100, '0x025000000000098B': 1100, '0x025000000000098C': 1100, '0x025000000000098D': 1100, '0x025000000000098E': 1100, '0x025000000000098F': 1100, '0x0250000000000991': 1100, '0x0250000000000990': 1100, '0x0250000000000992': 1200, '0x0250000000000993': 1200, '0x0250000000000994': 1200, '0x0250000000000995': 1200, '0x0250000000000996': 1200, '0x0250000000000997': 1200, '0x0250000000000998': 1200, '0x0250000000000999': 1200, '0x025000000000099A': 1200, '0x025000000000099B': 1200, '0x025000000000099C': 1300, '0x025000000000099D': 1300, '0x025000000000099E': 1300, '0x025000000000099F': 1300, '0x02500000000009A0': 1300, '0x02500000000009A1': 1300, '0x02500000000009A2': 1300, '0x02500000000009A3': 1300, '0x02500000000009A4': 1300, '0x02500000000009A5': 1300, '0x02500000000009A6': 1400, '0x02500000000009A7': 1400, '0x02500000000009A8': 1400, '0x02500000000009A9': 1400, '0x02500000000009AA': 1400, '0x02500000000009AB': 1400, '0x02500000000009AC': 1400, '0x02500000000009AD': 1400, '0x02500000000009AE': 1400, '0x02500000000009AF': 1400, '0x02500000000009B0': 1500, '0x02500000000009B1': 1500, '0x02500000000009B2': 1500, '0x02500000000009B3': 1500, '0x02500000000009B4': 1500, '0x02500000000009B5': 1500, '0x02500000000009B6': 1500, '0x02500000000009B7': 1500, '0x02500000000009B8': 1500, '0x02500000000009B9': 1500, '0x02500000000009BA': 1600, '0x02500000000009BB': 1600, '0x02500000000009BC': 1600, '0x02500000000009BD': 1600, '0x02500000000009BE': 1600, '0x02500000000009BF': 1600, '0x02500000000009C0': 1600, '0x02500000000009C1': 1600, '0x02500000000009C2': 1600, '0x02500000000009C3': 1600, '0x02500000000009C4': 1700, '0x02500000000009C5': 1700, '0x02500000000009C6': 1700, '0x02500000000009C7': 1700, '0x02500000000009C8': 1700, '0x02500000000009C9': 1700, '0x02500000000009CA': 1700, '0x02500000000009CB': 1700, '0x02500000000009CC': 1700, '0x02500000000009CD': 1700}
class Section: def get_display_text(self): pass def get_children(self): pass
class Section: def get_display_text(self): pass def get_children(self): pass
def solution(prices): if len(prices) == 0: return 0 # We are always paying the first price. total = prices[0] min_price = prices[0] for i in range(1, len(prices)): if prices[i] > min_price: total += prices[i] - min_price if prices[i] < min_price: min_price = prices[i] return total def num_divisors(number, keys): count = 0 for key in keys: if number % key == 0: count += 1 return count def encryptionValidity(instructionCount, validityPeriod, keys): max_num_divisors = float('-inf') for key in keys: num = num_divisors(key, keys) if num > max_num_divisors: max_num_divisors = num encryption_strength = max_num_divisors * pow(10, 5) is_crackable = 1 if encryption_strength / instructionCount > validityPeriod: is_crackable = 0 return is_crackable, encryption_strength # Write a function that accepts as an argument a string of addition/subtraction operations. # The function should return the result of the operations as an integer # ex: calculate("1 - 2 + 3") => 2 def apply_op(op, a, b): if op == 'plus': return a + b if op == 'minus': return a - b def calculate(expression): tokens = expression.split(" ") result = 0 last_op = 'plus' for token in tokens: if token == "": continue if str.isdigit(token): new_val = int(token) result = apply_op(last_op, result, new_val) if token == '+': last_op = 'plus' if token == '-': last_op = 'minus' return result # Next, write a function that accepts as an argument a string of addition/subtraction # operations and also includes parentheses to indicate order of operations. The function # should return the result of the operations as an integer # ex: calculate("1 - (2 + 3)") => -4 def parse_number(expression): if len(expression) == 0: return '', expression hd, tl = expression[0], expression[1:] if str.isdigit(hd) == False: return '', expression more, rest = parse_number(tl) return hd + more, rest def tokenize(expression): if len(expression) == 0: return [] hd, tl = expression[0], expression[1:] if hd == ' ': return tokenize(tl) if str.isdigit(hd): num, rest = parse_number(expression) return [int(num)] + tokenize(rest) if hd in ['(', ')', '+', '-']: return [hd] + tokenize(tl) def calculate_two_rec(tokens, result_so_far, last_op): if len(tokens) == 0: return result_so_far, [] token, rest = tokens[0], tokens[1:] if isinstance(token, int): return calculate_two_rec(rest, apply_op(last_op, result_so_far, token), last_op) if token == '+': return calculate_two_rec(rest, result_so_far, 'plus') if token == '-': return calculate_two_rec(rest, result_so_far, 'minus') if token == '(': value_in_paran, rest_after_paran = calculate_two_rec(rest, 0, 'plus') return calculate_two_rec(rest_after_paran, apply_op(last_op, result_so_far, value_in_paran), 'plus') if token == ')': return result_so_far, rest def calculate_two(expression): tokens = tokenize(expression) final_result, _ = calculate_two_rec(tokens, 0, 'plus') return final_result
def solution(prices): if len(prices) == 0: return 0 total = prices[0] min_price = prices[0] for i in range(1, len(prices)): if prices[i] > min_price: total += prices[i] - min_price if prices[i] < min_price: min_price = prices[i] return total def num_divisors(number, keys): count = 0 for key in keys: if number % key == 0: count += 1 return count def encryption_validity(instructionCount, validityPeriod, keys): max_num_divisors = float('-inf') for key in keys: num = num_divisors(key, keys) if num > max_num_divisors: max_num_divisors = num encryption_strength = max_num_divisors * pow(10, 5) is_crackable = 1 if encryption_strength / instructionCount > validityPeriod: is_crackable = 0 return (is_crackable, encryption_strength) def apply_op(op, a, b): if op == 'plus': return a + b if op == 'minus': return a - b def calculate(expression): tokens = expression.split(' ') result = 0 last_op = 'plus' for token in tokens: if token == '': continue if str.isdigit(token): new_val = int(token) result = apply_op(last_op, result, new_val) if token == '+': last_op = 'plus' if token == '-': last_op = 'minus' return result def parse_number(expression): if len(expression) == 0: return ('', expression) (hd, tl) = (expression[0], expression[1:]) if str.isdigit(hd) == False: return ('', expression) (more, rest) = parse_number(tl) return (hd + more, rest) def tokenize(expression): if len(expression) == 0: return [] (hd, tl) = (expression[0], expression[1:]) if hd == ' ': return tokenize(tl) if str.isdigit(hd): (num, rest) = parse_number(expression) return [int(num)] + tokenize(rest) if hd in ['(', ')', '+', '-']: return [hd] + tokenize(tl) def calculate_two_rec(tokens, result_so_far, last_op): if len(tokens) == 0: return (result_so_far, []) (token, rest) = (tokens[0], tokens[1:]) if isinstance(token, int): return calculate_two_rec(rest, apply_op(last_op, result_so_far, token), last_op) if token == '+': return calculate_two_rec(rest, result_so_far, 'plus') if token == '-': return calculate_two_rec(rest, result_so_far, 'minus') if token == '(': (value_in_paran, rest_after_paran) = calculate_two_rec(rest, 0, 'plus') return calculate_two_rec(rest_after_paran, apply_op(last_op, result_so_far, value_in_paran), 'plus') if token == ')': return (result_so_far, rest) def calculate_two(expression): tokens = tokenize(expression) (final_result, _) = calculate_two_rec(tokens, 0, 'plus') return final_result
# /////////////////////////////////////////////////////////////////////////// # # # # /////////////////////////////////////////////////////////////////////////// class GLLight: def __init__(self, pos=(0.0,0.0,0.0), color=(1.0,1.0,1.0)): self.pos = pos self.color = color self.ambient = (1.0, 1.0, 1.0) self.diffuse = (1.0, 1.0, 1.0) # attenuation self.constant = 1.0 self.linear = 0.09 self.quadratic = 0.032
class Gllight: def __init__(self, pos=(0.0, 0.0, 0.0), color=(1.0, 1.0, 1.0)): self.pos = pos self.color = color self.ambient = (1.0, 1.0, 1.0) self.diffuse = (1.0, 1.0, 1.0) self.constant = 1.0 self.linear = 0.09 self.quadratic = 0.032
def splitbylength(wordlist): initlen = len(wordlist[0]) lastlen = len(wordlist[-1]) splitlist = [] for i in range(initlen, lastlen+1): curlist = [] for x in wordlist: if len(x) == i: curlist.append(x.capitalize()) splitlist.append(sorted(curlist)) return splitlist
def splitbylength(wordlist): initlen = len(wordlist[0]) lastlen = len(wordlist[-1]) splitlist = [] for i in range(initlen, lastlen + 1): curlist = [] for x in wordlist: if len(x) == i: curlist.append(x.capitalize()) splitlist.append(sorted(curlist)) return splitlist
if __name__ == '__main__': checksum = 0 while True: try: numbers = input() except EOFError: break numbers = map(int, numbers.split('\t')) numbers = sorted(numbers) checksum += numbers[-1] - numbers[0] print(checksum)
if __name__ == '__main__': checksum = 0 while True: try: numbers = input() except EOFError: break numbers = map(int, numbers.split('\t')) numbers = sorted(numbers) checksum += numbers[-1] - numbers[0] print(checksum)
# # PySNMP MIB module ITOUCH-RADIUS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ITOUCH-RADIUS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:47:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") iTouch, = mibBuilder.importSymbols("ITOUCH-MIB", "iTouch") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter64, Integer32, Gauge32, ModuleIdentity, Unsigned32, Counter32, TimeTicks, NotificationType, iso, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, IpAddress, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Integer32", "Gauge32", "ModuleIdentity", "Unsigned32", "Counter32", "TimeTicks", "NotificationType", "iso", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "IpAddress", "MibIdentifier") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") xRadius = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35)) xRadiusPort = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 1)) xRadiusCircuit = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 2)) xRadiusConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 3)) xRadiusServers = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 4)) xRadiusCounters = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 5)) xRadiusPortTable = MibTable((1, 3, 6, 1, 4, 1, 33, 35, 1, 1), ) if mibBuilder.loadTexts: xRadiusPortTable.setStatus('mandatory') xRadiusPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1), ).setIndexNames((0, "ITOUCH-RADIUS-MIB", "xRadiusPortIndex")) if mibBuilder.loadTexts: xRadiusPortEntry.setStatus('mandatory') xRadiusPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusPortIndex.setStatus('mandatory') xRadiusPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusPortStatus.setStatus('mandatory') xRadiusPortSolicitStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusPortSolicitStatus.setStatus('mandatory') xRadiusAcctPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2), ("limited", 3))).clone('disabled')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusAcctPortStatus.setStatus('mandatory') xRadiusCircuitTable = MibTable((1, 3, 6, 1, 4, 1, 33, 35, 2, 1), ) if mibBuilder.loadTexts: xRadiusCircuitTable.setStatus('mandatory') xRadiusCircuitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1), ).setIndexNames((0, "ITOUCH-RADIUS-MIB", "xRadiusCircuitIndex")) if mibBuilder.loadTexts: xRadiusCircuitEntry.setStatus('mandatory') xRadiusCircuitIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusCircuitIndex.setStatus('mandatory') xRadiusCircAcctOnOff = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2), ("limited", 3))).clone('disabled')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusCircAcctOnOff.setStatus('mandatory') xRadiusAuthServerPort = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(1645)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusAuthServerPort.setStatus('mandatory') xRadiusAcctServerPort = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(1646)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusAcctServerPort.setStatus('mandatory') xRadiusTimeout = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)).clone(5)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusTimeout.setStatus('mandatory') xRadiusServerRetries = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10)).clone(3)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusServerRetries.setStatus('mandatory') xRadiusAcctLogAttempts = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 50000)).clone(5)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusAcctLogAttempts.setStatus('mandatory') xRadiusChapChallengeSize = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 128)).clone(16)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusChapChallengeSize.setStatus('mandatory') xRadiusLogging = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusLogging.setStatus('mandatory') xRadiusMessage = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(40, 40)).setFixedLength(40)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusMessage.setStatus('mandatory') xRadServer1SubGrp = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 4, 1)) xRadServer2SubGrp = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 4, 2)) xRadiusServerName1 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(51, 51)).setFixedLength(51)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusServerName1.setStatus('mandatory') xRadiusSecret1 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32).clone('Default_Secret')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusSecret1.setStatus('obsolete') xRadiusServerAccess1 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusServerAccess1.setStatus('mandatory') xRadiusServerAccessFailed1 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusServerAccessFailed1.setStatus('mandatory') xRadiusServerName2 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(51, 51)).setFixedLength(51)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusServerName2.setStatus('mandatory') xRadiusSecret2 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32).clone('Default_Secret')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusSecret2.setStatus('obsolete') xRadiusServerAccess2 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusServerAccess2.setStatus('mandatory') xRadiusServerAccessFailed2 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusServerAccessFailed2.setStatus('mandatory') xRadAuthCtsSubGrp = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 5, 1)) xRadAcctCtsSubGrp = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 5, 2)) xRadiusLogins = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusLogins.setStatus('mandatory') xRadiusLoginsFailed = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusLoginsFailed.setStatus('mandatory') xRadiusConfigFailed = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusConfigFailed.setStatus('mandatory') xRadiusPolicyFailed = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusPolicyFailed.setStatus('mandatory') xRadiusAcctSuccess = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusAcctSuccess.setStatus('mandatory') xRadiusAcctFailed = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusAcctFailed.setStatus('mandatory') xRadiusAcctReqWait = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusAcctReqWait.setStatus('mandatory') mibBuilder.exportSymbols("ITOUCH-RADIUS-MIB", xRadiusConfigFailed=xRadiusConfigFailed, xRadiusLogging=xRadiusLogging, xRadiusCounters=xRadiusCounters, xRadiusAcctPortStatus=xRadiusAcctPortStatus, xRadiusPortIndex=xRadiusPortIndex, xRadiusChapChallengeSize=xRadiusChapChallengeSize, xRadiusCircuitTable=xRadiusCircuitTable, xRadiusCircuitEntry=xRadiusCircuitEntry, xRadiusAcctServerPort=xRadiusAcctServerPort, xRadiusMessage=xRadiusMessage, xRadiusAcctLogAttempts=xRadiusAcctLogAttempts, xRadServer2SubGrp=xRadServer2SubGrp, xRadius=xRadius, xRadiusServerAccess1=xRadiusServerAccess1, xRadiusServerAccessFailed2=xRadiusServerAccessFailed2, xRadiusCircuitIndex=xRadiusCircuitIndex, xRadiusServerAccess2=xRadiusServerAccess2, xRadAcctCtsSubGrp=xRadAcctCtsSubGrp, xRadiusLoginsFailed=xRadiusLoginsFailed, xRadiusAcctSuccess=xRadiusAcctSuccess, xRadiusServerName2=xRadiusServerName2, xRadiusTimeout=xRadiusTimeout, xRadiusAcctReqWait=xRadiusAcctReqWait, xRadServer1SubGrp=xRadServer1SubGrp, xRadiusPort=xRadiusPort, xRadiusPortTable=xRadiusPortTable, xRadiusPortSolicitStatus=xRadiusPortSolicitStatus, xRadiusServerAccessFailed1=xRadiusServerAccessFailed1, xRadiusCircAcctOnOff=xRadiusCircAcctOnOff, xRadiusLogins=xRadiusLogins, xRadiusAcctFailed=xRadiusAcctFailed, xRadiusPolicyFailed=xRadiusPolicyFailed, xRadiusConfig=xRadiusConfig, xRadiusCircuit=xRadiusCircuit, xRadiusServers=xRadiusServers, xRadAuthCtsSubGrp=xRadAuthCtsSubGrp, xRadiusSecret2=xRadiusSecret2, xRadiusServerRetries=xRadiusServerRetries, xRadiusServerName1=xRadiusServerName1, xRadiusPortStatus=xRadiusPortStatus, xRadiusAuthServerPort=xRadiusAuthServerPort, xRadiusPortEntry=xRadiusPortEntry, xRadiusSecret1=xRadiusSecret1)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint') (i_touch,) = mibBuilder.importSymbols('ITOUCH-MIB', 'iTouch') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter64, integer32, gauge32, module_identity, unsigned32, counter32, time_ticks, notification_type, iso, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, ip_address, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'Integer32', 'Gauge32', 'ModuleIdentity', 'Unsigned32', 'Counter32', 'TimeTicks', 'NotificationType', 'iso', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'IpAddress', 'MibIdentifier') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') x_radius = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35)) x_radius_port = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 1)) x_radius_circuit = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 2)) x_radius_config = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 3)) x_radius_servers = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 4)) x_radius_counters = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 5)) x_radius_port_table = mib_table((1, 3, 6, 1, 4, 1, 33, 35, 1, 1)) if mibBuilder.loadTexts: xRadiusPortTable.setStatus('mandatory') x_radius_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1)).setIndexNames((0, 'ITOUCH-RADIUS-MIB', 'xRadiusPortIndex')) if mibBuilder.loadTexts: xRadiusPortEntry.setStatus('mandatory') x_radius_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusPortIndex.setStatus('mandatory') x_radius_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('disabled')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusPortStatus.setStatus('mandatory') x_radius_port_solicit_status = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusPortSolicitStatus.setStatus('mandatory') x_radius_acct_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2), ('limited', 3))).clone('disabled')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusAcctPortStatus.setStatus('mandatory') x_radius_circuit_table = mib_table((1, 3, 6, 1, 4, 1, 33, 35, 2, 1)) if mibBuilder.loadTexts: xRadiusCircuitTable.setStatus('mandatory') x_radius_circuit_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1)).setIndexNames((0, 'ITOUCH-RADIUS-MIB', 'xRadiusCircuitIndex')) if mibBuilder.loadTexts: xRadiusCircuitEntry.setStatus('mandatory') x_radius_circuit_index = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusCircuitIndex.setStatus('mandatory') x_radius_circ_acct_on_off = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2), ('limited', 3))).clone('disabled')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusCircAcctOnOff.setStatus('mandatory') x_radius_auth_server_port = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535)).clone(1645)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusAuthServerPort.setStatus('mandatory') x_radius_acct_server_port = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535)).clone(1646)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusAcctServerPort.setStatus('mandatory') x_radius_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 255)).clone(5)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusTimeout.setStatus('mandatory') x_radius_server_retries = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 10)).clone(3)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusServerRetries.setStatus('mandatory') x_radius_acct_log_attempts = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 50000)).clone(5)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusAcctLogAttempts.setStatus('mandatory') x_radius_chap_challenge_size = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 6), integer32().subtype(subtypeSpec=value_range_constraint(4, 128)).clone(16)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusChapChallengeSize.setStatus('mandatory') x_radius_logging = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusLogging.setStatus('mandatory') x_radius_message = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 8), display_string().subtype(subtypeSpec=value_size_constraint(40, 40)).setFixedLength(40)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusMessage.setStatus('mandatory') x_rad_server1_sub_grp = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 4, 1)) x_rad_server2_sub_grp = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 4, 2)) x_radius_server_name1 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 1), octet_string().subtype(subtypeSpec=value_size_constraint(51, 51)).setFixedLength(51)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusServerName1.setStatus('mandatory') x_radius_secret1 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(32, 32)).setFixedLength(32).clone('Default_Secret')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusSecret1.setStatus('obsolete') x_radius_server_access1 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusServerAccess1.setStatus('mandatory') x_radius_server_access_failed1 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusServerAccessFailed1.setStatus('mandatory') x_radius_server_name2 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 1), octet_string().subtype(subtypeSpec=value_size_constraint(51, 51)).setFixedLength(51)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusServerName2.setStatus('mandatory') x_radius_secret2 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 2), octet_string().subtype(subtypeSpec=value_size_constraint(32, 32)).setFixedLength(32).clone('Default_Secret')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusSecret2.setStatus('obsolete') x_radius_server_access2 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusServerAccess2.setStatus('mandatory') x_radius_server_access_failed2 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusServerAccessFailed2.setStatus('mandatory') x_rad_auth_cts_sub_grp = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 5, 1)) x_rad_acct_cts_sub_grp = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 5, 2)) x_radius_logins = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusLogins.setStatus('mandatory') x_radius_logins_failed = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusLoginsFailed.setStatus('mandatory') x_radius_config_failed = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusConfigFailed.setStatus('mandatory') x_radius_policy_failed = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusPolicyFailed.setStatus('mandatory') x_radius_acct_success = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusAcctSuccess.setStatus('mandatory') x_radius_acct_failed = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusAcctFailed.setStatus('mandatory') x_radius_acct_req_wait = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusAcctReqWait.setStatus('mandatory') mibBuilder.exportSymbols('ITOUCH-RADIUS-MIB', xRadiusConfigFailed=xRadiusConfigFailed, xRadiusLogging=xRadiusLogging, xRadiusCounters=xRadiusCounters, xRadiusAcctPortStatus=xRadiusAcctPortStatus, xRadiusPortIndex=xRadiusPortIndex, xRadiusChapChallengeSize=xRadiusChapChallengeSize, xRadiusCircuitTable=xRadiusCircuitTable, xRadiusCircuitEntry=xRadiusCircuitEntry, xRadiusAcctServerPort=xRadiusAcctServerPort, xRadiusMessage=xRadiusMessage, xRadiusAcctLogAttempts=xRadiusAcctLogAttempts, xRadServer2SubGrp=xRadServer2SubGrp, xRadius=xRadius, xRadiusServerAccess1=xRadiusServerAccess1, xRadiusServerAccessFailed2=xRadiusServerAccessFailed2, xRadiusCircuitIndex=xRadiusCircuitIndex, xRadiusServerAccess2=xRadiusServerAccess2, xRadAcctCtsSubGrp=xRadAcctCtsSubGrp, xRadiusLoginsFailed=xRadiusLoginsFailed, xRadiusAcctSuccess=xRadiusAcctSuccess, xRadiusServerName2=xRadiusServerName2, xRadiusTimeout=xRadiusTimeout, xRadiusAcctReqWait=xRadiusAcctReqWait, xRadServer1SubGrp=xRadServer1SubGrp, xRadiusPort=xRadiusPort, xRadiusPortTable=xRadiusPortTable, xRadiusPortSolicitStatus=xRadiusPortSolicitStatus, xRadiusServerAccessFailed1=xRadiusServerAccessFailed1, xRadiusCircAcctOnOff=xRadiusCircAcctOnOff, xRadiusLogins=xRadiusLogins, xRadiusAcctFailed=xRadiusAcctFailed, xRadiusPolicyFailed=xRadiusPolicyFailed, xRadiusConfig=xRadiusConfig, xRadiusCircuit=xRadiusCircuit, xRadiusServers=xRadiusServers, xRadAuthCtsSubGrp=xRadAuthCtsSubGrp, xRadiusSecret2=xRadiusSecret2, xRadiusServerRetries=xRadiusServerRetries, xRadiusServerName1=xRadiusServerName1, xRadiusPortStatus=xRadiusPortStatus, xRadiusAuthServerPort=xRadiusAuthServerPort, xRadiusPortEntry=xRadiusPortEntry, xRadiusSecret1=xRadiusSecret1)
hyper_params = { 'weight_decay': float(1e-6), 'epochs': 30, 'batch_size': 256, 'validate_every': 3, 'early_stop': 3, 'max_seq_len': 10, }
hyper_params = {'weight_decay': float(1e-06), 'epochs': 30, 'batch_size': 256, 'validate_every': 3, 'early_stop': 3, 'max_seq_len': 10}
# 1073 n = int(input()) if 5 < n < 2000: for i in range(2, n + 1, 2): print("{}^{} = {}".format(i, 2, i ** 2))
n = int(input()) if 5 < n < 2000: for i in range(2, n + 1, 2): print('{}^{} = {}'.format(i, 2, i ** 2))
class BinaryIndexedTree(object): def __init__(self): self.BITTree = [0] # Returns sum of arr[0..index]. This function assumes # that the array is preprocessed and partial sums of # array elements are stored in BITree[]. def getsum(self, i): s = 0 # initialize result # index in BITree[] is 1 more than the index in arr[] i = i + 1 # Traverse ancestors of BITree[index] while i > 0: # Add current element of BITree to sum s += self.BITTree[i] # Move index to parent node in getSum View i -= i & (-i) return s def get_sum(self, a, b): return self.getsum(b) - self.getsum(a-1) if a > 0 else 0 # Updates a node in Binary Index Tree (BITree) at given index # in BITree. The given value 'val' is added to BITree[i] and # all of its ancestors in tree. def updatebit(self, n, i, v): # index in BITree[] is 1 more than the index in arr[] i += 1 # Traverse all ancestors and add 'val' while i <= n: # Add 'val' to current node of BI Tree self.BITTree[i] += v # Update index to that of parent in update View i += i & (-i) # Constructs and returns a Binary Indexed Tree for given # array of size n. def construct(self, arr, n): # Create and initialize BITree[] as 0 self.BITTree = [0] * (n + 1) # Store the actual values in BITree[] using update() for i in range(n): self.updatebit(n, i, arr[i]) freq = [2, 1, 1, 3, 2, 3, 4, 5, 6, 7, 8, 9] BITTree = BinaryIndexedTree() BITTree.construct(freq,len(freq)) print("Sum of elements in arr[0..5] is " + str(BITTree.getsum(5))) freq[3] += 6 BITTree.updatebit(len(freq), 3, 6) print("Sum of elements in arr[0..5]"+ " after update is " + str(BITTree.getsum(5))) print("Sum of elements in arr[1..5]"+ " after update is " + str(BITTree.get_sum(2, 5)))
class Binaryindexedtree(object): def __init__(self): self.BITTree = [0] def getsum(self, i): s = 0 i = i + 1 while i > 0: s += self.BITTree[i] i -= i & -i return s def get_sum(self, a, b): return self.getsum(b) - self.getsum(a - 1) if a > 0 else 0 def updatebit(self, n, i, v): i += 1 while i <= n: self.BITTree[i] += v i += i & -i def construct(self, arr, n): self.BITTree = [0] * (n + 1) for i in range(n): self.updatebit(n, i, arr[i]) freq = [2, 1, 1, 3, 2, 3, 4, 5, 6, 7, 8, 9] bit_tree = binary_indexed_tree() BITTree.construct(freq, len(freq)) print('Sum of elements in arr[0..5] is ' + str(BITTree.getsum(5))) freq[3] += 6 BITTree.updatebit(len(freq), 3, 6) print('Sum of elements in arr[0..5]' + ' after update is ' + str(BITTree.getsum(5))) print('Sum of elements in arr[1..5]' + ' after update is ' + str(BITTree.get_sum(2, 5)))
s = input() t = int(input()) xy = [0, 0] cnt = 0 for i in range(len(s)): if s[i] == 'U': xy[1] += 1 elif s[i] == 'D': xy[1] -= 1 elif s[i] == 'R': xy[0] += 1 elif s[i] == 'L': xy[0] -= 1 else: cnt += 1 ans = abs(xy[0]) + abs(xy[1]) if t == 1: ans += cnt else: if ans >= cnt: ans -= cnt else: ans = (ans - cnt) % 2 print(ans)
s = input() t = int(input()) xy = [0, 0] cnt = 0 for i in range(len(s)): if s[i] == 'U': xy[1] += 1 elif s[i] == 'D': xy[1] -= 1 elif s[i] == 'R': xy[0] += 1 elif s[i] == 'L': xy[0] -= 1 else: cnt += 1 ans = abs(xy[0]) + abs(xy[1]) if t == 1: ans += cnt elif ans >= cnt: ans -= cnt else: ans = (ans - cnt) % 2 print(ans)
class Solution: def intToRoman(self, num: int) -> str: convertor = [ ["","M", "MM", "MMM"], ["","C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"], ["","X", "XX", "XXX", "XL", "L", "LX","LXX","LXXX", "XC"], ["","I","II","III","IV","V","VI","VII","VIII","IX"] ] return convertor[0][num//1000] + convertor[1][(num//100)%10] + convertor[2][(num//10)%10] + convertor[3][num%10] if __name__ == "__main__": sol = Solution() num = 58 print(sol.intToRoman(num))
class Solution: def int_to_roman(self, num: int) -> str: convertor = [['', 'M', 'MM', 'MMM'], ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'], ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'], ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']] return convertor[0][num // 1000] + convertor[1][num // 100 % 10] + convertor[2][num // 10 % 10] + convertor[3][num % 10] if __name__ == '__main__': sol = solution() num = 58 print(sol.intToRoman(num))
# 2. Multiples List # Write a program that receives two numbers (factor and count) and creates a list with length of the given count # and contains only elements that are multiples of the given factor. factor = int(input()) count = int(input()) list = [] for counter in range(1, count+1): list.append(factor * counter) print(list)
factor = int(input()) count = int(input()) list = [] for counter in range(1, count + 1): list.append(factor * counter) print(list)
# # PySNMP MIB module H3C-IPSEC-MONITOR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-IPSEC-MONITOR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:09:33 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) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection") h3cCommon, = mibBuilder.importSymbols("HUAWEI-3COM-OID-MIB", "h3cCommon") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") IpAddress, Counter64, TimeTicks, Unsigned32, ModuleIdentity, ObjectIdentity, iso, NotificationType, MibIdentifier, Counter32, Gauge32, Bits, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Counter64", "TimeTicks", "Unsigned32", "ModuleIdentity", "ObjectIdentity", "iso", "NotificationType", "MibIdentifier", "Counter32", "Gauge32", "Bits", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") h3cIPSecMonitor = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7)) if mibBuilder.loadTexts: h3cIPSecMonitor.setLastUpdated('200410260000Z') if mibBuilder.loadTexts: h3cIPSecMonitor.setOrganization('Huawei-3COM Technologies Co., Ltd.') class H3cDiffHellmanGrp(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 5, 14, 2147483647)) namedValues = NamedValues(("none", 0), ("modp768", 1), ("modp1024", 2), ("modp1536", 5), ("modp2048", 14), ("invalidGroup", 2147483647)) class H3cEncapMode(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647)) namedValues = NamedValues(("tunnel", 1), ("transport", 2), ("invalidMode", 2147483647)) class H3cEncryptAlgo(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 2147483647)) namedValues = NamedValues(("none", 0), ("desCbc", 1), ("ideaCbc", 2), ("blowfishCbc", 3), ("rc5R16B64Cbc", 4), ("tripledesCbc", 5), ("castCbc", 6), ("aesCbc", 7), ("nsaCbc", 8), ("aesCbc128", 9), ("aesCbc192", 10), ("aesCbc256", 11), ("invalidAlg", 2147483647)) class H3cAuthAlgo(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 2147483647)) namedValues = NamedValues(("none", 0), ("md5", 1), ("sha", 2), ("invalidAlg", 2147483647)) class H3cSaProtocol(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4)) namedValues = NamedValues(("reserved", 0), ("isakmp", 1), ("ah", 2), ("esp", 3), ("ipcomp", 4)) class H3cTrapStatus(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("enabled", 1), ("disabled", 2)) class H3cIPSecIDType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) namedValues = NamedValues(("reserved", 0), ("ipv4Addr", 1), ("fqdn", 2), ("userFqdn", 3), ("ipv4AddrSubnet", 4), ("ipv6Addr", 5), ("ipv6AddrSubnet", 6), ("ipv4AddrRange", 7), ("ipv6AddrRange", 8), ("derAsn1Dn", 9), ("derAsn1Gn", 10), ("keyId", 11)) class H3cTrafficType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 4, 5, 6, 7, 8)) namedValues = NamedValues(("ipv4Addr", 1), ("ipv4AddrSubnet", 4), ("ipv6Addr", 5), ("ipv6AddrSubnet", 6), ("ipv4AddrRange", 7), ("ipv6AddrRange", 8)) class H3cIPSecNegoType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647)) namedValues = NamedValues(("ike", 1), ("manual", 2), ("invalidType", 2147483647)) class H3cIPSecTunnelState(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("active", 1), ("timeout", 2)) h3cIPSecObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1)) h3cIPSecTunnelTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1), ) if mibBuilder.loadTexts: h3cIPSecTunnelTable.setStatus('current') h3cIPSecTunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1), ).setIndexNames((0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIfIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEntryIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIndex")) if mibBuilder.loadTexts: h3cIPSecTunnelEntry.setStatus('current') h3cIPSecTunIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunIfIndex.setStatus('current') h3cIPSecTunEntryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunEntryIndex.setStatus('current') h3cIPSecTunIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunIndex.setStatus('current') h3cIPSecTunIKETunnelIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunIKETunnelIndex.setStatus('current') h3cIPSecTunLocalAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 5), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunLocalAddr.setStatus('current') h3cIPSecTunRemoteAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 6), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunRemoteAddr.setStatus('current') h3cIPSecTunKeyType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 7), H3cIPSecNegoType()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunKeyType.setStatus('current') h3cIPSecTunEncapMode = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 8), H3cEncapMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunEncapMode.setStatus('current') h3cIPSecTunInitiator = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647))).clone(namedValues=NamedValues(("local", 1), ("remote", 2), ("none", 2147483647)))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInitiator.setStatus('current') h3cIPSecTunLifeSize = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 10), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunLifeSize.setStatus('current') h3cIPSecTunLifeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunLifeTime.setStatus('current') h3cIPSecTunRemainTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunRemainTime.setStatus('current') h3cIPSecTunActiveTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunActiveTime.setStatus('current') h3cIPSecTunRemainSize = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 14), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunRemainSize.setStatus('current') h3cIPSecTunTotalRefreshes = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunTotalRefreshes.setStatus('current') h3cIPSecTunCurrentSaInstances = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 16), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunCurrentSaInstances.setStatus('current') h3cIPSecTunInSaEncryptAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 17), H3cEncryptAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInSaEncryptAlgo.setStatus('current') h3cIPSecTunInSaAhAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 18), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInSaAhAuthAlgo.setStatus('current') h3cIPSecTunInSaEspAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 19), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInSaEspAuthAlgo.setStatus('current') h3cIPSecTunDiffHellmanGrp = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 20), H3cDiffHellmanGrp()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunDiffHellmanGrp.setStatus('current') h3cIPSecTunOutSaEncryptAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 21), H3cEncryptAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutSaEncryptAlgo.setStatus('current') h3cIPSecTunOutSaAhAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 22), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutSaAhAuthAlgo.setStatus('current') h3cIPSecTunOutSaEspAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 23), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutSaEspAuthAlgo.setStatus('current') h3cIPSecTunPolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 24), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunPolicyName.setStatus('current') h3cIPSecTunPolicyNum = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunPolicyNum.setStatus('current') h3cIPSecTunStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("initial", 1), ("ready", 2), ("rekeyed", 3), ("closed", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunStatus.setStatus('current') h3cIPSecTunnelStatTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2), ) if mibBuilder.loadTexts: h3cIPSecTunnelStatTable.setStatus('current') h3cIPSecTunnelStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1), ).setIndexNames((0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIfIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEntryIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIndex")) if mibBuilder.loadTexts: h3cIPSecTunnelStatEntry.setStatus('current') h3cIPSecTunInOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInOctets.setStatus('current') h3cIPSecTunInDecompOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInDecompOctets.setStatus('current') h3cIPSecTunInPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInPkts.setStatus('current') h3cIPSecTunInDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInDropPkts.setStatus('current') h3cIPSecTunInReplayDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInReplayDropPkts.setStatus('current') h3cIPSecTunInAuthFails = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInAuthFails.setStatus('current') h3cIPSecTunInDecryptFails = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInDecryptFails.setStatus('current') h3cIPSecTunOutOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutOctets.setStatus('current') h3cIPSecTunOutUncompOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutUncompOctets.setStatus('current') h3cIPSecTunOutPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutPkts.setStatus('current') h3cIPSecTunOutDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutDropPkts.setStatus('current') h3cIPSecTunOutEncryptFails = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutEncryptFails.setStatus('current') h3cIPSecTunNoMemoryDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunNoMemoryDropPkts.setStatus('current') h3cIPSecTunQueueFullDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunQueueFullDropPkts.setStatus('current') h3cIPSecTunInvalidLenDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInvalidLenDropPkts.setStatus('current') h3cIPSecTunTooLongDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunTooLongDropPkts.setStatus('current') h3cIPSecTunInvalidSaDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInvalidSaDropPkts.setStatus('current') h3cIPSecSaTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3), ) if mibBuilder.loadTexts: h3cIPSecSaTable.setStatus('current') h3cIPSecSaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1), ).setIndexNames((0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIfIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEntryIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaIndex")) if mibBuilder.loadTexts: h3cIPSecSaEntry.setStatus('current') h3cIPSecSaIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecSaIndex.setStatus('current') h3cIPSecSaDirection = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("in", 1), ("out", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaDirection.setStatus('current') h3cIPSecSaValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaValue.setStatus('current') h3cIPSecSaProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 4), H3cSaProtocol()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaProtocol.setStatus('current') h3cIPSecSaEncryptAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 5), H3cEncryptAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaEncryptAlgo.setStatus('current') h3cIPSecSaAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 6), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaAuthAlgo.setStatus('current') h3cIPSecSaStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("expiring", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaStatus.setStatus('current') h3cIPSecTrafficTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4), ) if mibBuilder.loadTexts: h3cIPSecTrafficTable.setStatus('current') h3cIPSecTrafficEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1), ).setIndexNames((0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIfIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEntryIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIndex")) if mibBuilder.loadTexts: h3cIPSecTrafficEntry.setStatus('current') h3cIPSecTrafficLocalType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 1), H3cTrafficType()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalType.setStatus('current') h3cIPSecTrafficLocalAddr1 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalAddr1.setStatus('current') h3cIPSecTrafficLocalAddr2 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalAddr2.setStatus('current') h3cIPSecTrafficLocalProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalProtocol.setStatus('current') h3cIPSecTrafficLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalPort.setStatus('current') h3cIPSecTrafficRemoteType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 6), H3cTrafficType()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemoteType.setStatus('current') h3cIPSecTrafficRemoteAddr1 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 7), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemoteAddr1.setStatus('current') h3cIPSecTrafficRemoteAddr2 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 8), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemoteAddr2.setStatus('current') h3cIPSecTrafficRemoteProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemoteProtocol.setStatus('current') h3cIPSecTrafficRemotePort = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemotePort.setStatus('current') h3cIPSecGlobalStats = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5)) h3cIPSecGlobalActiveTunnels = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalActiveTunnels.setStatus('current') h3cIPSecGlobalActiveSas = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalActiveSas.setStatus('current') h3cIPSecGlobalInOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInOctets.setStatus('current') h3cIPSecGlobalInDecompOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInDecompOctets.setStatus('current') h3cIPSecGlobalInPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInPkts.setStatus('current') h3cIPSecGlobalInDrops = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInDrops.setStatus('current') h3cIPSecGlobalInReplayDrops = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInReplayDrops.setStatus('current') h3cIPSecGlobalInAuthFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInAuthFails.setStatus('current') h3cIPSecGlobalInDecryptFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInDecryptFails.setStatus('current') h3cIPSecGlobalOutOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutOctets.setStatus('current') h3cIPSecGlobalOutUncompOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutUncompOctets.setStatus('current') h3cIPSecGlobalOutPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutPkts.setStatus('current') h3cIPSecGlobalOutDrops = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutDrops.setStatus('current') h3cIPSecGlobalOutEncryptFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutEncryptFails.setStatus('current') h3cIPSecGlobalNoMemoryDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalNoMemoryDropPkts.setStatus('current') h3cIPSecGlobalNoFindSaDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalNoFindSaDropPkts.setStatus('current') h3cIPSecGlobalQueueFullDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalQueueFullDropPkts.setStatus('current') h3cIPSecGlobalInvalidLenDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInvalidLenDropPkts.setStatus('current') h3cIPSecGlobalTooLongDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalTooLongDropPkts.setStatus('current') h3cIPSecGlobalInvalidSaDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInvalidSaDropPkts.setStatus('current') h3cIPSecTrapObject = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6)) h3cIPSecPolicyName = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 1), DisplayString()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: h3cIPSecPolicyName.setStatus('current') h3cIPSecPolicySeqNum = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 2), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: h3cIPSecPolicySeqNum.setStatus('current') h3cIPSecPolicySize = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 3), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: h3cIPSecPolicySize.setStatus('current') h3cIPSecSpiValue = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 4), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: h3cIPSecSpiValue.setStatus('current') h3cIPSecTrapCntl = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7)) h3cIPSecTrapGlobalCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 1), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecTrapGlobalCntl.setStatus('current') h3cIPSecTunnelStartTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 2), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecTunnelStartTrapCntl.setStatus('current') h3cIPSecTunnelStopTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 3), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecTunnelStopTrapCntl.setStatus('current') h3cIPSecNoSaTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 4), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecNoSaTrapCntl.setStatus('current') h3cIPSecAuthFailureTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 5), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecAuthFailureTrapCntl.setStatus('current') h3cIPSecEncryFailureTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 6), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecEncryFailureTrapCntl.setStatus('current') h3cIPSecDecryFailureTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 7), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecDecryFailureTrapCntl.setStatus('current') h3cIPSecInvalidSaTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 8), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecInvalidSaTrapCntl.setStatus('current') h3cIPSecPolicyAddTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 9), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecPolicyAddTrapCntl.setStatus('current') h3cIPSecPolicyDelTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 10), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecPolicyDelTrapCntl.setStatus('current') h3cIPSecPolicyAttachTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 11), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecPolicyAttachTrapCntl.setStatus('current') h3cIPSecPolicyDetachTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 12), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecPolicyDetachTrapCntl.setStatus('current') h3cIPSecTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8)) h3cIPSecNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1)) h3cIPSecTunnelStart = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 1)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLifeTime"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLifeSize")) if mibBuilder.loadTexts: h3cIPSecTunnelStart.setStatus('current') h3cIPSecTunnelStop = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 2)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunActiveTime")) if mibBuilder.loadTexts: h3cIPSecTunnelStop.setStatus('current') h3cIPSecNoSaFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 3)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr")) if mibBuilder.loadTexts: h3cIPSecNoSaFailure.setStatus('current') h3cIPSecAuthFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 4)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr")) if mibBuilder.loadTexts: h3cIPSecAuthFailFailure.setStatus('current') h3cIPSecEncryFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 5)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr")) if mibBuilder.loadTexts: h3cIPSecEncryFailFailure.setStatus('current') h3cIPSecDecryFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 6)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr")) if mibBuilder.loadTexts: h3cIPSecDecryFailFailure.setStatus('current') h3cIPSecInvalidSaFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 7)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSpiValue")) if mibBuilder.loadTexts: h3cIPSecInvalidSaFailure.setStatus('current') h3cIPSecPolicyAdd = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 8)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySeqNum"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize")) if mibBuilder.loadTexts: h3cIPSecPolicyAdd.setStatus('current') h3cIPSecPolicyDel = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 9)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySeqNum"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize")) if mibBuilder.loadTexts: h3cIPSecPolicyDel.setStatus('current') h3cIPSecPolicyAttach = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 10)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize"), ("IF-MIB", "ifIndex")) if mibBuilder.loadTexts: h3cIPSecPolicyAttach.setStatus('current') h3cIPSecPolicyDetach = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 11)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize"), ("IF-MIB", "ifIndex")) if mibBuilder.loadTexts: h3cIPSecPolicyDetach.setStatus('current') h3cIPSecConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2)) h3cIPSecCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 1)) h3cIPSecGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2)) h3cIPSecCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 1, 1)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelTableGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStatGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficTableGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalStatsGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrapObjectGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrapCntlGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrapGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecCompliance = h3cIPSecCompliance.setStatus('current') h3cIPSecTunnelTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 1)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIKETunnelIndex"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunKeyType"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEncapMode"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInitiator"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLifeSize"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLifeTime"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemainTime"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunActiveTime"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemainSize"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunTotalRefreshes"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunCurrentSaInstances"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInSaEncryptAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInSaAhAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInSaEspAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunDiffHellmanGrp"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutSaEncryptAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutSaAhAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutSaEspAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunPolicyNum"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTunnelTableGroup = h3cIPSecTunnelTableGroup.setStatus('current') h3cIPSecTunnelStatGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 2)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInDecompOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInReplayDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInAuthFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInDecryptFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutUncompOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutEncryptFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunNoMemoryDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunQueueFullDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInvalidLenDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunTooLongDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInvalidSaDropPkts")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTunnelStatGroup = h3cIPSecTunnelStatGroup.setStatus('current') h3cIPSecSaGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 3)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaDirection"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaValue"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaProtocol"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaEncryptAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecSaGroup = h3cIPSecSaGroup.setStatus('current') h3cIPSecTrafficTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 4)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalType"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalAddr1"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalAddr2"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalProtocol"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalPort"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemoteType"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemoteAddr1"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemoteAddr2"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemoteProtocol"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemotePort")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTrafficTableGroup = h3cIPSecTrafficTableGroup.setStatus('current') h3cIPSecGlobalStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 5)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalActiveTunnels"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalActiveSas"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInDecompOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInDrops"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInReplayDrops"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInAuthFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInDecryptFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutUncompOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutDrops"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutEncryptFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalNoMemoryDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalNoFindSaDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalQueueFullDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInvalidLenDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalTooLongDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInvalidSaDropPkts")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecGlobalStatsGroup = h3cIPSecGlobalStatsGroup.setStatus('current') h3cIPSecTrapObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 6)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySeqNum"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSpiValue")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTrapObjectGroup = h3cIPSecTrapObjectGroup.setStatus('current') h3cIPSecTrapCntlGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 7)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrapGlobalCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStartTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStopTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecNoSaTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecAuthFailureTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecEncryFailureTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecDecryFailureTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecInvalidSaTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyAddTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyDelTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyAttachTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyDetachTrapCntl")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTrapCntlGroup = h3cIPSecTrapCntlGroup.setStatus('current') h3cIPSecTrapGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 8)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStart"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStop"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecNoSaFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecAuthFailFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecEncryFailFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecDecryFailFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecInvalidSaFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyAdd"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyDel"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyAttach"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyDetach")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTrapGroup = h3cIPSecTrapGroup.setStatus('current') mibBuilder.exportSymbols("H3C-IPSEC-MONITOR-MIB", h3cIPSecTrafficRemoteAddr2=h3cIPSecTrafficRemoteAddr2, h3cIPSecTrafficLocalAddr1=h3cIPSecTrafficLocalAddr1, h3cIPSecTunInOctets=h3cIPSecTunInOctets, h3cIPSecTunStatus=h3cIPSecTunStatus, h3cIPSecGlobalStats=h3cIPSecGlobalStats, h3cIPSecTrafficRemoteType=h3cIPSecTrafficRemoteType, h3cIPSecGlobalQueueFullDropPkts=h3cIPSecGlobalQueueFullDropPkts, h3cIPSecTunInvalidSaDropPkts=h3cIPSecTunInvalidSaDropPkts, h3cIPSecTunLocalAddr=h3cIPSecTunLocalAddr, h3cIPSecTunKeyType=h3cIPSecTunKeyType, h3cIPSecGlobalTooLongDropPkts=h3cIPSecGlobalTooLongDropPkts, h3cIPSecTunEntryIndex=h3cIPSecTunEntryIndex, PYSNMP_MODULE_ID=h3cIPSecMonitor, h3cIPSecTrapGlobalCntl=h3cIPSecTrapGlobalCntl, h3cIPSecTunOutEncryptFails=h3cIPSecTunOutEncryptFails, h3cIPSecTunNoMemoryDropPkts=h3cIPSecTunNoMemoryDropPkts, h3cIPSecAuthFailFailure=h3cIPSecAuthFailFailure, h3cIPSecSpiValue=h3cIPSecSpiValue, h3cIPSecGlobalOutEncryptFails=h3cIPSecGlobalOutEncryptFails, h3cIPSecSaEncryptAlgo=h3cIPSecSaEncryptAlgo, h3cIPSecSaStatus=h3cIPSecSaStatus, h3cIPSecTunRemainTime=h3cIPSecTunRemainTime, h3cIPSecTunnelStartTrapCntl=h3cIPSecTunnelStartTrapCntl, H3cAuthAlgo=H3cAuthAlgo, h3cIPSecTrafficTableGroup=h3cIPSecTrafficTableGroup, h3cIPSecPolicyAttach=h3cIPSecPolicyAttach, h3cIPSecGlobalInDecryptFails=h3cIPSecGlobalInDecryptFails, h3cIPSecTunRemainSize=h3cIPSecTunRemainSize, h3cIPSecSaDirection=h3cIPSecSaDirection, h3cIPSecDecryFailureTrapCntl=h3cIPSecDecryFailureTrapCntl, h3cIPSecTunIndex=h3cIPSecTunIndex, h3cIPSecPolicyDetachTrapCntl=h3cIPSecPolicyDetachTrapCntl, h3cIPSecNoSaFailure=h3cIPSecNoSaFailure, h3cIPSecPolicyAttachTrapCntl=h3cIPSecPolicyAttachTrapCntl, h3cIPSecTunInSaAhAuthAlgo=h3cIPSecTunInSaAhAuthAlgo, h3cIPSecTunnelStatEntry=h3cIPSecTunnelStatEntry, h3cIPSecTunInDecryptFails=h3cIPSecTunInDecryptFails, h3cIPSecNotifications=h3cIPSecNotifications, h3cIPSecGlobalInPkts=h3cIPSecGlobalInPkts, h3cIPSecTunInvalidLenDropPkts=h3cIPSecTunInvalidLenDropPkts, h3cIPSecGlobalActiveSas=h3cIPSecGlobalActiveSas, h3cIPSecGlobalActiveTunnels=h3cIPSecGlobalActiveTunnels, h3cIPSecGlobalOutUncompOctets=h3cIPSecGlobalOutUncompOctets, H3cSaProtocol=H3cSaProtocol, h3cIPSecTunInSaEncryptAlgo=h3cIPSecTunInSaEncryptAlgo, h3cIPSecTunOutOctets=h3cIPSecTunOutOctets, h3cIPSecInvalidSaFailure=h3cIPSecInvalidSaFailure, h3cIPSecTunQueueFullDropPkts=h3cIPSecTunQueueFullDropPkts, h3cIPSecPolicyName=h3cIPSecPolicyName, h3cIPSecSaIndex=h3cIPSecSaIndex, h3cIPSecTunTotalRefreshes=h3cIPSecTunTotalRefreshes, h3cIPSecSaProtocol=h3cIPSecSaProtocol, H3cEncapMode=H3cEncapMode, h3cIPSecTrafficLocalProtocol=h3cIPSecTrafficLocalProtocol, h3cIPSecPolicySeqNum=h3cIPSecPolicySeqNum, h3cIPSecTunActiveTime=h3cIPSecTunActiveTime, h3cIPSecTunOutSaEspAuthAlgo=h3cIPSecTunOutSaEspAuthAlgo, h3cIPSecTunPolicyNum=h3cIPSecTunPolicyNum, h3cIPSecGlobalInAuthFails=h3cIPSecGlobalInAuthFails, h3cIPSecGlobalOutDrops=h3cIPSecGlobalOutDrops, h3cIPSecConformance=h3cIPSecConformance, h3cIPSecTunInAuthFails=h3cIPSecTunInAuthFails, h3cIPSecTunnelStop=h3cIPSecTunnelStop, h3cIPSecTunOutSaAhAuthAlgo=h3cIPSecTunOutSaAhAuthAlgo, h3cIPSecSaValue=h3cIPSecSaValue, h3cIPSecGlobalOutOctets=h3cIPSecGlobalOutOctets, h3cIPSecPolicyDelTrapCntl=h3cIPSecPolicyDelTrapCntl, h3cIPSecTunTooLongDropPkts=h3cIPSecTunTooLongDropPkts, h3cIPSecTunInSaEspAuthAlgo=h3cIPSecTunInSaEspAuthAlgo, h3cIPSecTunDiffHellmanGrp=h3cIPSecTunDiffHellmanGrp, h3cIPSecTunOutUncompOctets=h3cIPSecTunOutUncompOctets, h3cIPSecTunnelStatGroup=h3cIPSecTunnelStatGroup, h3cIPSecTunPolicyName=h3cIPSecTunPolicyName, h3cIPSecObjects=h3cIPSecObjects, h3cIPSecMonitor=h3cIPSecMonitor, h3cIPSecEncryFailFailure=h3cIPSecEncryFailFailure, h3cIPSecTunInReplayDropPkts=h3cIPSecTunInReplayDropPkts, h3cIPSecGlobalNoMemoryDropPkts=h3cIPSecGlobalNoMemoryDropPkts, h3cIPSecPolicyAdd=h3cIPSecPolicyAdd, h3cIPSecGlobalInDrops=h3cIPSecGlobalInDrops, h3cIPSecPolicyDetach=h3cIPSecPolicyDetach, h3cIPSecDecryFailFailure=h3cIPSecDecryFailFailure, h3cIPSecTrapCntlGroup=h3cIPSecTrapCntlGroup, h3cIPSecTunOutPkts=h3cIPSecTunOutPkts, h3cIPSecTrafficRemoteAddr1=h3cIPSecTrafficRemoteAddr1, h3cIPSecSaGroup=h3cIPSecSaGroup, H3cIPSecTunnelState=H3cIPSecTunnelState, h3cIPSecTunLifeSize=h3cIPSecTunLifeSize, h3cIPSecTunOutDropPkts=h3cIPSecTunOutDropPkts, H3cTrapStatus=H3cTrapStatus, h3cIPSecGroups=h3cIPSecGroups, h3cIPSecTrafficLocalPort=h3cIPSecTrafficLocalPort, h3cIPSecGlobalInOctets=h3cIPSecGlobalInOctets, h3cIPSecGlobalStatsGroup=h3cIPSecGlobalStatsGroup, h3cIPSecTunInDropPkts=h3cIPSecTunInDropPkts, h3cIPSecGlobalOutPkts=h3cIPSecGlobalOutPkts, h3cIPSecTunOutSaEncryptAlgo=h3cIPSecTunOutSaEncryptAlgo, H3cIPSecNegoType=H3cIPSecNegoType, h3cIPSecTrafficLocalAddr2=h3cIPSecTrafficLocalAddr2, h3cIPSecTrafficRemoteProtocol=h3cIPSecTrafficRemoteProtocol, h3cIPSecTrapObject=h3cIPSecTrapObject, h3cIPSecTunCurrentSaInstances=h3cIPSecTunCurrentSaInstances, h3cIPSecGlobalInvalidLenDropPkts=h3cIPSecGlobalInvalidLenDropPkts, h3cIPSecGlobalInReplayDrops=h3cIPSecGlobalInReplayDrops, h3cIPSecPolicyDel=h3cIPSecPolicyDel, h3cIPSecTunnelTableGroup=h3cIPSecTunnelTableGroup, h3cIPSecAuthFailureTrapCntl=h3cIPSecAuthFailureTrapCntl, H3cTrafficType=H3cTrafficType, h3cIPSecTunIfIndex=h3cIPSecTunIfIndex, h3cIPSecNoSaTrapCntl=h3cIPSecNoSaTrapCntl, h3cIPSecTunInDecompOctets=h3cIPSecTunInDecompOctets, h3cIPSecPolicyAddTrapCntl=h3cIPSecPolicyAddTrapCntl, h3cIPSecCompliance=h3cIPSecCompliance, h3cIPSecTunnelStopTrapCntl=h3cIPSecTunnelStopTrapCntl, h3cIPSecTunInPkts=h3cIPSecTunInPkts, h3cIPSecInvalidSaTrapCntl=h3cIPSecInvalidSaTrapCntl, h3cIPSecSaAuthAlgo=h3cIPSecSaAuthAlgo, h3cIPSecTrafficTable=h3cIPSecTrafficTable, h3cIPSecPolicySize=h3cIPSecPolicySize, h3cIPSecTrap=h3cIPSecTrap, h3cIPSecTunnelEntry=h3cIPSecTunnelEntry, h3cIPSecTunEncapMode=h3cIPSecTunEncapMode, h3cIPSecTrafficLocalType=h3cIPSecTrafficLocalType, h3cIPSecTunnelStatTable=h3cIPSecTunnelStatTable, h3cIPSecSaEntry=h3cIPSecSaEntry, h3cIPSecTrafficRemotePort=h3cIPSecTrafficRemotePort, h3cIPSecTrapCntl=h3cIPSecTrapCntl, h3cIPSecEncryFailureTrapCntl=h3cIPSecEncryFailureTrapCntl, h3cIPSecGlobalInDecompOctets=h3cIPSecGlobalInDecompOctets, h3cIPSecCompliances=h3cIPSecCompliances, h3cIPSecTunIKETunnelIndex=h3cIPSecTunIKETunnelIndex, h3cIPSecTunnelTable=h3cIPSecTunnelTable, h3cIPSecTrafficEntry=h3cIPSecTrafficEntry, h3cIPSecTunRemoteAddr=h3cIPSecTunRemoteAddr, H3cIPSecIDType=H3cIPSecIDType, h3cIPSecTrapObjectGroup=h3cIPSecTrapObjectGroup, h3cIPSecTunInitiator=h3cIPSecTunInitiator, h3cIPSecTunLifeTime=h3cIPSecTunLifeTime, h3cIPSecTrapGroup=h3cIPSecTrapGroup, H3cDiffHellmanGrp=H3cDiffHellmanGrp, H3cEncryptAlgo=H3cEncryptAlgo, h3cIPSecGlobalNoFindSaDropPkts=h3cIPSecGlobalNoFindSaDropPkts, h3cIPSecTunnelStart=h3cIPSecTunnelStart, h3cIPSecGlobalInvalidSaDropPkts=h3cIPSecGlobalInvalidSaDropPkts, h3cIPSecSaTable=h3cIPSecSaTable)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection') (h3c_common,) = mibBuilder.importSymbols('HUAWEI-3COM-OID-MIB', 'h3cCommon') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance') (ip_address, counter64, time_ticks, unsigned32, module_identity, object_identity, iso, notification_type, mib_identifier, counter32, gauge32, bits, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'Counter64', 'TimeTicks', 'Unsigned32', 'ModuleIdentity', 'ObjectIdentity', 'iso', 'NotificationType', 'MibIdentifier', 'Counter32', 'Gauge32', 'Bits', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') h3c_ip_sec_monitor = module_identity((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7)) if mibBuilder.loadTexts: h3cIPSecMonitor.setLastUpdated('200410260000Z') if mibBuilder.loadTexts: h3cIPSecMonitor.setOrganization('Huawei-3COM Technologies Co., Ltd.') class H3Cdiffhellmangrp(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 5, 14, 2147483647)) named_values = named_values(('none', 0), ('modp768', 1), ('modp1024', 2), ('modp1536', 5), ('modp2048', 14), ('invalidGroup', 2147483647)) class H3Cencapmode(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 2147483647)) named_values = named_values(('tunnel', 1), ('transport', 2), ('invalidMode', 2147483647)) class H3Cencryptalgo(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 2147483647)) named_values = named_values(('none', 0), ('desCbc', 1), ('ideaCbc', 2), ('blowfishCbc', 3), ('rc5R16B64Cbc', 4), ('tripledesCbc', 5), ('castCbc', 6), ('aesCbc', 7), ('nsaCbc', 8), ('aesCbc128', 9), ('aesCbc192', 10), ('aesCbc256', 11), ('invalidAlg', 2147483647)) class H3Cauthalgo(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 2147483647)) named_values = named_values(('none', 0), ('md5', 1), ('sha', 2), ('invalidAlg', 2147483647)) class H3Csaprotocol(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4)) named_values = named_values(('reserved', 0), ('isakmp', 1), ('ah', 2), ('esp', 3), ('ipcomp', 4)) class H3Ctrapstatus(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('enabled', 1), ('disabled', 2)) class H3Cipsecidtype(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) named_values = named_values(('reserved', 0), ('ipv4Addr', 1), ('fqdn', 2), ('userFqdn', 3), ('ipv4AddrSubnet', 4), ('ipv6Addr', 5), ('ipv6AddrSubnet', 6), ('ipv4AddrRange', 7), ('ipv6AddrRange', 8), ('derAsn1Dn', 9), ('derAsn1Gn', 10), ('keyId', 11)) class H3Ctraffictype(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 4, 5, 6, 7, 8)) named_values = named_values(('ipv4Addr', 1), ('ipv4AddrSubnet', 4), ('ipv6Addr', 5), ('ipv6AddrSubnet', 6), ('ipv4AddrRange', 7), ('ipv6AddrRange', 8)) class H3Cipsecnegotype(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 2147483647)) named_values = named_values(('ike', 1), ('manual', 2), ('invalidType', 2147483647)) class H3Cipsectunnelstate(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('active', 1), ('timeout', 2)) h3c_ip_sec_objects = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1)) h3c_ip_sec_tunnel_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1)) if mibBuilder.loadTexts: h3cIPSecTunnelTable.setStatus('current') h3c_ip_sec_tunnel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1)).setIndexNames((0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIfIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEntryIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIndex')) if mibBuilder.loadTexts: h3cIPSecTunnelEntry.setStatus('current') h3c_ip_sec_tun_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunIfIndex.setStatus('current') h3c_ip_sec_tun_entry_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunEntryIndex.setStatus('current') h3c_ip_sec_tun_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunIndex.setStatus('current') h3c_ip_sec_tun_ike_tunnel_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunIKETunnelIndex.setStatus('current') h3c_ip_sec_tun_local_addr = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 5), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunLocalAddr.setStatus('current') h3c_ip_sec_tun_remote_addr = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 6), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunRemoteAddr.setStatus('current') h3c_ip_sec_tun_key_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 7), h3c_ip_sec_nego_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunKeyType.setStatus('current') h3c_ip_sec_tun_encap_mode = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 8), h3c_encap_mode()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunEncapMode.setStatus('current') h3c_ip_sec_tun_initiator = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 2147483647))).clone(namedValues=named_values(('local', 1), ('remote', 2), ('none', 2147483647)))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInitiator.setStatus('current') h3c_ip_sec_tun_life_size = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 10), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunLifeSize.setStatus('current') h3c_ip_sec_tun_life_time = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 11), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunLifeTime.setStatus('current') h3c_ip_sec_tun_remain_time = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunRemainTime.setStatus('current') h3c_ip_sec_tun_active_time = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 13), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunActiveTime.setStatus('current') h3c_ip_sec_tun_remain_size = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 14), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunRemainSize.setStatus('current') h3c_ip_sec_tun_total_refreshes = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunTotalRefreshes.setStatus('current') h3c_ip_sec_tun_current_sa_instances = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 16), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunCurrentSaInstances.setStatus('current') h3c_ip_sec_tun_in_sa_encrypt_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 17), h3c_encrypt_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInSaEncryptAlgo.setStatus('current') h3c_ip_sec_tun_in_sa_ah_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 18), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInSaAhAuthAlgo.setStatus('current') h3c_ip_sec_tun_in_sa_esp_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 19), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInSaEspAuthAlgo.setStatus('current') h3c_ip_sec_tun_diff_hellman_grp = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 20), h3c_diff_hellman_grp()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunDiffHellmanGrp.setStatus('current') h3c_ip_sec_tun_out_sa_encrypt_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 21), h3c_encrypt_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutSaEncryptAlgo.setStatus('current') h3c_ip_sec_tun_out_sa_ah_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 22), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutSaAhAuthAlgo.setStatus('current') h3c_ip_sec_tun_out_sa_esp_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 23), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutSaEspAuthAlgo.setStatus('current') h3c_ip_sec_tun_policy_name = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 24), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunPolicyName.setStatus('current') h3c_ip_sec_tun_policy_num = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 25), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunPolicyNum.setStatus('current') h3c_ip_sec_tun_status = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 26), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('initial', 1), ('ready', 2), ('rekeyed', 3), ('closed', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunStatus.setStatus('current') h3c_ip_sec_tunnel_stat_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2)) if mibBuilder.loadTexts: h3cIPSecTunnelStatTable.setStatus('current') h3c_ip_sec_tunnel_stat_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1)).setIndexNames((0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIfIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEntryIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIndex')) if mibBuilder.loadTexts: h3cIPSecTunnelStatEntry.setStatus('current') h3c_ip_sec_tun_in_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 1), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInOctets.setStatus('current') h3c_ip_sec_tun_in_decomp_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 2), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInDecompOctets.setStatus('current') h3c_ip_sec_tun_in_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 3), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInPkts.setStatus('current') h3c_ip_sec_tun_in_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 4), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInDropPkts.setStatus('current') h3c_ip_sec_tun_in_replay_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInReplayDropPkts.setStatus('current') h3c_ip_sec_tun_in_auth_fails = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInAuthFails.setStatus('current') h3c_ip_sec_tun_in_decrypt_fails = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInDecryptFails.setStatus('current') h3c_ip_sec_tun_out_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 8), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutOctets.setStatus('current') h3c_ip_sec_tun_out_uncomp_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 9), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutUncompOctets.setStatus('current') h3c_ip_sec_tun_out_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 10), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutPkts.setStatus('current') h3c_ip_sec_tun_out_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 11), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutDropPkts.setStatus('current') h3c_ip_sec_tun_out_encrypt_fails = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 12), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutEncryptFails.setStatus('current') h3c_ip_sec_tun_no_memory_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 13), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunNoMemoryDropPkts.setStatus('current') h3c_ip_sec_tun_queue_full_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunQueueFullDropPkts.setStatus('current') h3c_ip_sec_tun_invalid_len_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInvalidLenDropPkts.setStatus('current') h3c_ip_sec_tun_too_long_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 16), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunTooLongDropPkts.setStatus('current') h3c_ip_sec_tun_invalid_sa_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 17), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInvalidSaDropPkts.setStatus('current') h3c_ip_sec_sa_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3)) if mibBuilder.loadTexts: h3cIPSecSaTable.setStatus('current') h3c_ip_sec_sa_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1)).setIndexNames((0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIfIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEntryIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaIndex')) if mibBuilder.loadTexts: h3cIPSecSaEntry.setStatus('current') h3c_ip_sec_sa_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecSaIndex.setStatus('current') h3c_ip_sec_sa_direction = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('in', 1), ('out', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaDirection.setStatus('current') h3c_ip_sec_sa_value = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaValue.setStatus('current') h3c_ip_sec_sa_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 4), h3c_sa_protocol()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaProtocol.setStatus('current') h3c_ip_sec_sa_encrypt_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 5), h3c_encrypt_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaEncryptAlgo.setStatus('current') h3c_ip_sec_sa_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 6), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaAuthAlgo.setStatus('current') h3c_ip_sec_sa_status = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('expiring', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaStatus.setStatus('current') h3c_ip_sec_traffic_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4)) if mibBuilder.loadTexts: h3cIPSecTrafficTable.setStatus('current') h3c_ip_sec_traffic_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1)).setIndexNames((0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIfIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEntryIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIndex')) if mibBuilder.loadTexts: h3cIPSecTrafficEntry.setStatus('current') h3c_ip_sec_traffic_local_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 1), h3c_traffic_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalType.setStatus('current') h3c_ip_sec_traffic_local_addr1 = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 2), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalAddr1.setStatus('current') h3c_ip_sec_traffic_local_addr2 = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 3), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalAddr2.setStatus('current') h3c_ip_sec_traffic_local_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalProtocol.setStatus('current') h3c_ip_sec_traffic_local_port = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalPort.setStatus('current') h3c_ip_sec_traffic_remote_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 6), h3c_traffic_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemoteType.setStatus('current') h3c_ip_sec_traffic_remote_addr1 = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 7), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemoteAddr1.setStatus('current') h3c_ip_sec_traffic_remote_addr2 = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 8), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemoteAddr2.setStatus('current') h3c_ip_sec_traffic_remote_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemoteProtocol.setStatus('current') h3c_ip_sec_traffic_remote_port = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemotePort.setStatus('current') h3c_ip_sec_global_stats = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5)) h3c_ip_sec_global_active_tunnels = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 1), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalActiveTunnels.setStatus('current') h3c_ip_sec_global_active_sas = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 2), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalActiveSas.setStatus('current') h3c_ip_sec_global_in_octets = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 3), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInOctets.setStatus('current') h3c_ip_sec_global_in_decomp_octets = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 4), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInDecompOctets.setStatus('current') h3c_ip_sec_global_in_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 5), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInPkts.setStatus('current') h3c_ip_sec_global_in_drops = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 6), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInDrops.setStatus('current') h3c_ip_sec_global_in_replay_drops = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInReplayDrops.setStatus('current') h3c_ip_sec_global_in_auth_fails = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 8), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInAuthFails.setStatus('current') h3c_ip_sec_global_in_decrypt_fails = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 9), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInDecryptFails.setStatus('current') h3c_ip_sec_global_out_octets = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 10), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutOctets.setStatus('current') h3c_ip_sec_global_out_uncomp_octets = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 11), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutUncompOctets.setStatus('current') h3c_ip_sec_global_out_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 12), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutPkts.setStatus('current') h3c_ip_sec_global_out_drops = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 13), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutDrops.setStatus('current') h3c_ip_sec_global_out_encrypt_fails = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutEncryptFails.setStatus('current') h3c_ip_sec_global_no_memory_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalNoMemoryDropPkts.setStatus('current') h3c_ip_sec_global_no_find_sa_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 16), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalNoFindSaDropPkts.setStatus('current') h3c_ip_sec_global_queue_full_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 17), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalQueueFullDropPkts.setStatus('current') h3c_ip_sec_global_invalid_len_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 18), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInvalidLenDropPkts.setStatus('current') h3c_ip_sec_global_too_long_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 19), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalTooLongDropPkts.setStatus('current') h3c_ip_sec_global_invalid_sa_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 20), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInvalidSaDropPkts.setStatus('current') h3c_ip_sec_trap_object = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6)) h3c_ip_sec_policy_name = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 1), display_string()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: h3cIPSecPolicyName.setStatus('current') h3c_ip_sec_policy_seq_num = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 2), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: h3cIPSecPolicySeqNum.setStatus('current') h3c_ip_sec_policy_size = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 3), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: h3cIPSecPolicySize.setStatus('current') h3c_ip_sec_spi_value = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 4), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: h3cIPSecSpiValue.setStatus('current') h3c_ip_sec_trap_cntl = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7)) h3c_ip_sec_trap_global_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 1), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecTrapGlobalCntl.setStatus('current') h3c_ip_sec_tunnel_start_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 2), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecTunnelStartTrapCntl.setStatus('current') h3c_ip_sec_tunnel_stop_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 3), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecTunnelStopTrapCntl.setStatus('current') h3c_ip_sec_no_sa_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 4), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecNoSaTrapCntl.setStatus('current') h3c_ip_sec_auth_failure_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 5), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecAuthFailureTrapCntl.setStatus('current') h3c_ip_sec_encry_failure_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 6), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecEncryFailureTrapCntl.setStatus('current') h3c_ip_sec_decry_failure_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 7), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecDecryFailureTrapCntl.setStatus('current') h3c_ip_sec_invalid_sa_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 8), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecInvalidSaTrapCntl.setStatus('current') h3c_ip_sec_policy_add_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 9), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecPolicyAddTrapCntl.setStatus('current') h3c_ip_sec_policy_del_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 10), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecPolicyDelTrapCntl.setStatus('current') h3c_ip_sec_policy_attach_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 11), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecPolicyAttachTrapCntl.setStatus('current') h3c_ip_sec_policy_detach_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 12), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecPolicyDetachTrapCntl.setStatus('current') h3c_ip_sec_trap = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8)) h3c_ip_sec_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1)) h3c_ip_sec_tunnel_start = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 1)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLifeTime'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLifeSize')) if mibBuilder.loadTexts: h3cIPSecTunnelStart.setStatus('current') h3c_ip_sec_tunnel_stop = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 2)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunActiveTime')) if mibBuilder.loadTexts: h3cIPSecTunnelStop.setStatus('current') h3c_ip_sec_no_sa_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 3)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr')) if mibBuilder.loadTexts: h3cIPSecNoSaFailure.setStatus('current') h3c_ip_sec_auth_fail_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 4)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr')) if mibBuilder.loadTexts: h3cIPSecAuthFailFailure.setStatus('current') h3c_ip_sec_encry_fail_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 5)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr')) if mibBuilder.loadTexts: h3cIPSecEncryFailFailure.setStatus('current') h3c_ip_sec_decry_fail_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 6)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr')) if mibBuilder.loadTexts: h3cIPSecDecryFailFailure.setStatus('current') h3c_ip_sec_invalid_sa_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 7)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSpiValue')) if mibBuilder.loadTexts: h3cIPSecInvalidSaFailure.setStatus('current') h3c_ip_sec_policy_add = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 8)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySeqNum'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize')) if mibBuilder.loadTexts: h3cIPSecPolicyAdd.setStatus('current') h3c_ip_sec_policy_del = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 9)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySeqNum'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize')) if mibBuilder.loadTexts: h3cIPSecPolicyDel.setStatus('current') h3c_ip_sec_policy_attach = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 10)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize'), ('IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: h3cIPSecPolicyAttach.setStatus('current') h3c_ip_sec_policy_detach = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 11)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize'), ('IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: h3cIPSecPolicyDetach.setStatus('current') h3c_ip_sec_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2)) h3c_ip_sec_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 1)) h3c_ip_sec_groups = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2)) h3c_ip_sec_compliance = module_compliance((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 1, 1)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelTableGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStatGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficTableGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalStatsGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrapObjectGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrapCntlGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrapGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_compliance = h3cIPSecCompliance.setStatus('current') h3c_ip_sec_tunnel_table_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 1)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIKETunnelIndex'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunKeyType'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEncapMode'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInitiator'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLifeSize'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLifeTime'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemainTime'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunActiveTime'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemainSize'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunTotalRefreshes'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunCurrentSaInstances'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInSaEncryptAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInSaAhAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInSaEspAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunDiffHellmanGrp'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutSaEncryptAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutSaAhAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutSaEspAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunPolicyNum'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_tunnel_table_group = h3cIPSecTunnelTableGroup.setStatus('current') h3c_ip_sec_tunnel_stat_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 2)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInDecompOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInReplayDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInAuthFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInDecryptFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutUncompOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutEncryptFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunNoMemoryDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunQueueFullDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInvalidLenDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunTooLongDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInvalidSaDropPkts')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_tunnel_stat_group = h3cIPSecTunnelStatGroup.setStatus('current') h3c_ip_sec_sa_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 3)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaDirection'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaValue'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaProtocol'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaEncryptAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_sa_group = h3cIPSecSaGroup.setStatus('current') h3c_ip_sec_traffic_table_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 4)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalType'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalAddr1'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalAddr2'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalProtocol'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalPort'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemoteType'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemoteAddr1'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemoteAddr2'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemoteProtocol'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemotePort')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_traffic_table_group = h3cIPSecTrafficTableGroup.setStatus('current') h3c_ip_sec_global_stats_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 5)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalActiveTunnels'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalActiveSas'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInDecompOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInDrops'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInReplayDrops'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInAuthFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInDecryptFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutUncompOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutDrops'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutEncryptFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalNoMemoryDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalNoFindSaDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalQueueFullDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInvalidLenDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalTooLongDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInvalidSaDropPkts')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_global_stats_group = h3cIPSecGlobalStatsGroup.setStatus('current') h3c_ip_sec_trap_object_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 6)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySeqNum'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSpiValue')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_trap_object_group = h3cIPSecTrapObjectGroup.setStatus('current') h3c_ip_sec_trap_cntl_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 7)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrapGlobalCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStartTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStopTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecNoSaTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecAuthFailureTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecEncryFailureTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecDecryFailureTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecInvalidSaTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyAddTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyDelTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyAttachTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyDetachTrapCntl')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_trap_cntl_group = h3cIPSecTrapCntlGroup.setStatus('current') h3c_ip_sec_trap_group = notification_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 8)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStart'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStop'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecNoSaFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecAuthFailFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecEncryFailFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecDecryFailFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecInvalidSaFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyAdd'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyDel'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyAttach'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyDetach')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_trap_group = h3cIPSecTrapGroup.setStatus('current') mibBuilder.exportSymbols('H3C-IPSEC-MONITOR-MIB', h3cIPSecTrafficRemoteAddr2=h3cIPSecTrafficRemoteAddr2, h3cIPSecTrafficLocalAddr1=h3cIPSecTrafficLocalAddr1, h3cIPSecTunInOctets=h3cIPSecTunInOctets, h3cIPSecTunStatus=h3cIPSecTunStatus, h3cIPSecGlobalStats=h3cIPSecGlobalStats, h3cIPSecTrafficRemoteType=h3cIPSecTrafficRemoteType, h3cIPSecGlobalQueueFullDropPkts=h3cIPSecGlobalQueueFullDropPkts, h3cIPSecTunInvalidSaDropPkts=h3cIPSecTunInvalidSaDropPkts, h3cIPSecTunLocalAddr=h3cIPSecTunLocalAddr, h3cIPSecTunKeyType=h3cIPSecTunKeyType, h3cIPSecGlobalTooLongDropPkts=h3cIPSecGlobalTooLongDropPkts, h3cIPSecTunEntryIndex=h3cIPSecTunEntryIndex, PYSNMP_MODULE_ID=h3cIPSecMonitor, h3cIPSecTrapGlobalCntl=h3cIPSecTrapGlobalCntl, h3cIPSecTunOutEncryptFails=h3cIPSecTunOutEncryptFails, h3cIPSecTunNoMemoryDropPkts=h3cIPSecTunNoMemoryDropPkts, h3cIPSecAuthFailFailure=h3cIPSecAuthFailFailure, h3cIPSecSpiValue=h3cIPSecSpiValue, h3cIPSecGlobalOutEncryptFails=h3cIPSecGlobalOutEncryptFails, h3cIPSecSaEncryptAlgo=h3cIPSecSaEncryptAlgo, h3cIPSecSaStatus=h3cIPSecSaStatus, h3cIPSecTunRemainTime=h3cIPSecTunRemainTime, h3cIPSecTunnelStartTrapCntl=h3cIPSecTunnelStartTrapCntl, H3cAuthAlgo=H3cAuthAlgo, h3cIPSecTrafficTableGroup=h3cIPSecTrafficTableGroup, h3cIPSecPolicyAttach=h3cIPSecPolicyAttach, h3cIPSecGlobalInDecryptFails=h3cIPSecGlobalInDecryptFails, h3cIPSecTunRemainSize=h3cIPSecTunRemainSize, h3cIPSecSaDirection=h3cIPSecSaDirection, h3cIPSecDecryFailureTrapCntl=h3cIPSecDecryFailureTrapCntl, h3cIPSecTunIndex=h3cIPSecTunIndex, h3cIPSecPolicyDetachTrapCntl=h3cIPSecPolicyDetachTrapCntl, h3cIPSecNoSaFailure=h3cIPSecNoSaFailure, h3cIPSecPolicyAttachTrapCntl=h3cIPSecPolicyAttachTrapCntl, h3cIPSecTunInSaAhAuthAlgo=h3cIPSecTunInSaAhAuthAlgo, h3cIPSecTunnelStatEntry=h3cIPSecTunnelStatEntry, h3cIPSecTunInDecryptFails=h3cIPSecTunInDecryptFails, h3cIPSecNotifications=h3cIPSecNotifications, h3cIPSecGlobalInPkts=h3cIPSecGlobalInPkts, h3cIPSecTunInvalidLenDropPkts=h3cIPSecTunInvalidLenDropPkts, h3cIPSecGlobalActiveSas=h3cIPSecGlobalActiveSas, h3cIPSecGlobalActiveTunnels=h3cIPSecGlobalActiveTunnels, h3cIPSecGlobalOutUncompOctets=h3cIPSecGlobalOutUncompOctets, H3cSaProtocol=H3cSaProtocol, h3cIPSecTunInSaEncryptAlgo=h3cIPSecTunInSaEncryptAlgo, h3cIPSecTunOutOctets=h3cIPSecTunOutOctets, h3cIPSecInvalidSaFailure=h3cIPSecInvalidSaFailure, h3cIPSecTunQueueFullDropPkts=h3cIPSecTunQueueFullDropPkts, h3cIPSecPolicyName=h3cIPSecPolicyName, h3cIPSecSaIndex=h3cIPSecSaIndex, h3cIPSecTunTotalRefreshes=h3cIPSecTunTotalRefreshes, h3cIPSecSaProtocol=h3cIPSecSaProtocol, H3cEncapMode=H3cEncapMode, h3cIPSecTrafficLocalProtocol=h3cIPSecTrafficLocalProtocol, h3cIPSecPolicySeqNum=h3cIPSecPolicySeqNum, h3cIPSecTunActiveTime=h3cIPSecTunActiveTime, h3cIPSecTunOutSaEspAuthAlgo=h3cIPSecTunOutSaEspAuthAlgo, h3cIPSecTunPolicyNum=h3cIPSecTunPolicyNum, h3cIPSecGlobalInAuthFails=h3cIPSecGlobalInAuthFails, h3cIPSecGlobalOutDrops=h3cIPSecGlobalOutDrops, h3cIPSecConformance=h3cIPSecConformance, h3cIPSecTunInAuthFails=h3cIPSecTunInAuthFails, h3cIPSecTunnelStop=h3cIPSecTunnelStop, h3cIPSecTunOutSaAhAuthAlgo=h3cIPSecTunOutSaAhAuthAlgo, h3cIPSecSaValue=h3cIPSecSaValue, h3cIPSecGlobalOutOctets=h3cIPSecGlobalOutOctets, h3cIPSecPolicyDelTrapCntl=h3cIPSecPolicyDelTrapCntl, h3cIPSecTunTooLongDropPkts=h3cIPSecTunTooLongDropPkts, h3cIPSecTunInSaEspAuthAlgo=h3cIPSecTunInSaEspAuthAlgo, h3cIPSecTunDiffHellmanGrp=h3cIPSecTunDiffHellmanGrp, h3cIPSecTunOutUncompOctets=h3cIPSecTunOutUncompOctets, h3cIPSecTunnelStatGroup=h3cIPSecTunnelStatGroup, h3cIPSecTunPolicyName=h3cIPSecTunPolicyName, h3cIPSecObjects=h3cIPSecObjects, h3cIPSecMonitor=h3cIPSecMonitor, h3cIPSecEncryFailFailure=h3cIPSecEncryFailFailure, h3cIPSecTunInReplayDropPkts=h3cIPSecTunInReplayDropPkts, h3cIPSecGlobalNoMemoryDropPkts=h3cIPSecGlobalNoMemoryDropPkts, h3cIPSecPolicyAdd=h3cIPSecPolicyAdd, h3cIPSecGlobalInDrops=h3cIPSecGlobalInDrops, h3cIPSecPolicyDetach=h3cIPSecPolicyDetach, h3cIPSecDecryFailFailure=h3cIPSecDecryFailFailure, h3cIPSecTrapCntlGroup=h3cIPSecTrapCntlGroup, h3cIPSecTunOutPkts=h3cIPSecTunOutPkts, h3cIPSecTrafficRemoteAddr1=h3cIPSecTrafficRemoteAddr1, h3cIPSecSaGroup=h3cIPSecSaGroup, H3cIPSecTunnelState=H3cIPSecTunnelState, h3cIPSecTunLifeSize=h3cIPSecTunLifeSize, h3cIPSecTunOutDropPkts=h3cIPSecTunOutDropPkts, H3cTrapStatus=H3cTrapStatus, h3cIPSecGroups=h3cIPSecGroups, h3cIPSecTrafficLocalPort=h3cIPSecTrafficLocalPort, h3cIPSecGlobalInOctets=h3cIPSecGlobalInOctets, h3cIPSecGlobalStatsGroup=h3cIPSecGlobalStatsGroup, h3cIPSecTunInDropPkts=h3cIPSecTunInDropPkts, h3cIPSecGlobalOutPkts=h3cIPSecGlobalOutPkts, h3cIPSecTunOutSaEncryptAlgo=h3cIPSecTunOutSaEncryptAlgo, H3cIPSecNegoType=H3cIPSecNegoType, h3cIPSecTrafficLocalAddr2=h3cIPSecTrafficLocalAddr2, h3cIPSecTrafficRemoteProtocol=h3cIPSecTrafficRemoteProtocol, h3cIPSecTrapObject=h3cIPSecTrapObject, h3cIPSecTunCurrentSaInstances=h3cIPSecTunCurrentSaInstances, h3cIPSecGlobalInvalidLenDropPkts=h3cIPSecGlobalInvalidLenDropPkts, h3cIPSecGlobalInReplayDrops=h3cIPSecGlobalInReplayDrops, h3cIPSecPolicyDel=h3cIPSecPolicyDel, h3cIPSecTunnelTableGroup=h3cIPSecTunnelTableGroup, h3cIPSecAuthFailureTrapCntl=h3cIPSecAuthFailureTrapCntl, H3cTrafficType=H3cTrafficType, h3cIPSecTunIfIndex=h3cIPSecTunIfIndex, h3cIPSecNoSaTrapCntl=h3cIPSecNoSaTrapCntl, h3cIPSecTunInDecompOctets=h3cIPSecTunInDecompOctets, h3cIPSecPolicyAddTrapCntl=h3cIPSecPolicyAddTrapCntl, h3cIPSecCompliance=h3cIPSecCompliance, h3cIPSecTunnelStopTrapCntl=h3cIPSecTunnelStopTrapCntl, h3cIPSecTunInPkts=h3cIPSecTunInPkts, h3cIPSecInvalidSaTrapCntl=h3cIPSecInvalidSaTrapCntl, h3cIPSecSaAuthAlgo=h3cIPSecSaAuthAlgo, h3cIPSecTrafficTable=h3cIPSecTrafficTable, h3cIPSecPolicySize=h3cIPSecPolicySize, h3cIPSecTrap=h3cIPSecTrap, h3cIPSecTunnelEntry=h3cIPSecTunnelEntry, h3cIPSecTunEncapMode=h3cIPSecTunEncapMode, h3cIPSecTrafficLocalType=h3cIPSecTrafficLocalType, h3cIPSecTunnelStatTable=h3cIPSecTunnelStatTable, h3cIPSecSaEntry=h3cIPSecSaEntry, h3cIPSecTrafficRemotePort=h3cIPSecTrafficRemotePort, h3cIPSecTrapCntl=h3cIPSecTrapCntl, h3cIPSecEncryFailureTrapCntl=h3cIPSecEncryFailureTrapCntl, h3cIPSecGlobalInDecompOctets=h3cIPSecGlobalInDecompOctets, h3cIPSecCompliances=h3cIPSecCompliances, h3cIPSecTunIKETunnelIndex=h3cIPSecTunIKETunnelIndex, h3cIPSecTunnelTable=h3cIPSecTunnelTable, h3cIPSecTrafficEntry=h3cIPSecTrafficEntry, h3cIPSecTunRemoteAddr=h3cIPSecTunRemoteAddr, H3cIPSecIDType=H3cIPSecIDType, h3cIPSecTrapObjectGroup=h3cIPSecTrapObjectGroup, h3cIPSecTunInitiator=h3cIPSecTunInitiator, h3cIPSecTunLifeTime=h3cIPSecTunLifeTime, h3cIPSecTrapGroup=h3cIPSecTrapGroup, H3cDiffHellmanGrp=H3cDiffHellmanGrp, H3cEncryptAlgo=H3cEncryptAlgo, h3cIPSecGlobalNoFindSaDropPkts=h3cIPSecGlobalNoFindSaDropPkts, h3cIPSecTunnelStart=h3cIPSecTunnelStart, h3cIPSecGlobalInvalidSaDropPkts=h3cIPSecGlobalInvalidSaDropPkts, h3cIPSecSaTable=h3cIPSecSaTable)
# # PySNMP MIB module CISCO-CAS-IF-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CAS-IF-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:35:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion") ciscoAgentCapability, = mibBuilder.importSymbols("CISCO-SMI", "ciscoAgentCapability") AgentCapabilities, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "AgentCapabilities", "ModuleCompliance", "NotificationGroup") TimeTicks, Integer32, iso, ObjectIdentity, Unsigned32, IpAddress, Bits, MibIdentifier, Counter64, Counter32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Integer32", "iso", "ObjectIdentity", "Unsigned32", "IpAddress", "Bits", "MibIdentifier", "Counter64", "Counter32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "NotificationType") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") ciscoCasIfCapability = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 7, 122)) ciscoCasIfCapability.setRevisions(('2009-12-04 00:00', '2004-08-10 00:00', '2003-12-03 00:00',)) if mibBuilder.loadTexts: ciscoCasIfCapability.setLastUpdated('200912040000Z') if mibBuilder.loadTexts: ciscoCasIfCapability.setOrganization('Cisco Systems, Inc.') ciscoCasIfCapabilityV5R000 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV5R000 = ciscoCasIfCapabilityV5R000.setProductRelease('MGX8850 Release 5.0') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV5R000 = ciscoCasIfCapabilityV5R000.setStatus('current') ciscoCasIfCapabilityV5R015 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV5R015 = ciscoCasIfCapabilityV5R015.setProductRelease('MGX8850 Release 5.0.15') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV5R015 = ciscoCasIfCapabilityV5R015.setStatus('current') ciscoCasIfCapabilityV12R04TPC3xxx = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV12R04TPC3xxx = ciscoCasIfCapabilityV12R04TPC3xxx.setProductRelease('CISCO IOS 12.4T for Integrate Service\n Router (ISR) c2xxx and c3xxx platforms.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV12R04TPC3xxx = ciscoCasIfCapabilityV12R04TPC3xxx.setStatus('current') mibBuilder.exportSymbols("CISCO-CAS-IF-CAPABILITY", ciscoCasIfCapabilityV5R015=ciscoCasIfCapabilityV5R015, ciscoCasIfCapability=ciscoCasIfCapability, ciscoCasIfCapabilityV5R000=ciscoCasIfCapabilityV5R000, PYSNMP_MODULE_ID=ciscoCasIfCapability, ciscoCasIfCapabilityV12R04TPC3xxx=ciscoCasIfCapabilityV12R04TPC3xxx)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion') (cisco_agent_capability,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoAgentCapability') (agent_capabilities, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'AgentCapabilities', 'ModuleCompliance', 'NotificationGroup') (time_ticks, integer32, iso, object_identity, unsigned32, ip_address, bits, mib_identifier, counter64, counter32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'Integer32', 'iso', 'ObjectIdentity', 'Unsigned32', 'IpAddress', 'Bits', 'MibIdentifier', 'Counter64', 'Counter32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'NotificationType') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') cisco_cas_if_capability = module_identity((1, 3, 6, 1, 4, 1, 9, 7, 122)) ciscoCasIfCapability.setRevisions(('2009-12-04 00:00', '2004-08-10 00:00', '2003-12-03 00:00')) if mibBuilder.loadTexts: ciscoCasIfCapability.setLastUpdated('200912040000Z') if mibBuilder.loadTexts: ciscoCasIfCapability.setOrganization('Cisco Systems, Inc.') cisco_cas_if_capability_v5_r000 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v5_r000 = ciscoCasIfCapabilityV5R000.setProductRelease('MGX8850 Release 5.0') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v5_r000 = ciscoCasIfCapabilityV5R000.setStatus('current') cisco_cas_if_capability_v5_r015 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v5_r015 = ciscoCasIfCapabilityV5R015.setProductRelease('MGX8850 Release 5.0.15') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v5_r015 = ciscoCasIfCapabilityV5R015.setStatus('current') cisco_cas_if_capability_v12_r04_tpc3xxx = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v12_r04_tpc3xxx = ciscoCasIfCapabilityV12R04TPC3xxx.setProductRelease('CISCO IOS 12.4T for Integrate Service\n Router (ISR) c2xxx and c3xxx platforms.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v12_r04_tpc3xxx = ciscoCasIfCapabilityV12R04TPC3xxx.setStatus('current') mibBuilder.exportSymbols('CISCO-CAS-IF-CAPABILITY', ciscoCasIfCapabilityV5R015=ciscoCasIfCapabilityV5R015, ciscoCasIfCapability=ciscoCasIfCapability, ciscoCasIfCapabilityV5R000=ciscoCasIfCapabilityV5R000, PYSNMP_MODULE_ID=ciscoCasIfCapability, ciscoCasIfCapabilityV12R04TPC3xxx=ciscoCasIfCapabilityV12R04TPC3xxx)
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sortedArrayToBST(self, nums) -> TreeNode: def func(left, right) -> TreeNode: if left > right: return None mid = (left + right) // 2 node = TreeNode(nums[mid]) node.left = func(left, mid - 1) node.right = func(mid + 1, right) return node return func(0, len(nums) - 1)
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sorted_array_to_bst(self, nums) -> TreeNode: def func(left, right) -> TreeNode: if left > right: return None mid = (left + right) // 2 node = tree_node(nums[mid]) node.left = func(left, mid - 1) node.right = func(mid + 1, right) return node return func(0, len(nums) - 1)
class Solution: def isPalindrome(self, s: str) -> bool: lo, hi = 0, len(s) - 1 while lo < hi: if not s[lo].isalnum(): lo += 1 elif not s[hi].isalnum(): hi -= 1 else: if s[lo].lower() != s[hi].lower(): return False lo, hi = lo + 1, hi - 1 return True # TESTS tests = [ ["", True], ["A man, a plan, a canal: Panama", True], ["race a car", False], ["0P", False], ] for t in tests: sol = Solution() print('Is "' + t[0] + '" palindrome? ->', t[1]) assert sol.isPalindrome(t[0]) == t[1]
class Solution: def is_palindrome(self, s: str) -> bool: (lo, hi) = (0, len(s) - 1) while lo < hi: if not s[lo].isalnum(): lo += 1 elif not s[hi].isalnum(): hi -= 1 else: if s[lo].lower() != s[hi].lower(): return False (lo, hi) = (lo + 1, hi - 1) return True tests = [['', True], ['A man, a plan, a canal: Panama', True], ['race a car', False], ['0P', False]] for t in tests: sol = solution() print('Is "' + t[0] + '" palindrome? ->', t[1]) assert sol.isPalindrome(t[0]) == t[1]
# Change these values and rename this file to "settings_secret.py" # SECURITY WARNING: If you are using this in production, do NOT use the default SECRET KEY! # See: https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-SECRET_KEY SECRET_KEY = '!!super_secret!!' # https://docs.djangoproject.com/en/3.0/ref/settings/#allowed-hosts ALLOWED_HOSTS = ['*']
secret_key = '!!super_secret!!' allowed_hosts = ['*']
def maxPower(s: str) -> int: if not s or len(s) == 0: return 0 result = 1 temp_result = 1 curr = s[0] for c in s[1:]: if c == curr: temp_result += 1 else: result = max(result, temp_result) temp_result = 1 curr = c return max(result, temp_result) if __name__ == "__main__": print(maxPower("leetcode")) print(maxPower("abbcccddddeeeeedcba")) print(maxPower("triplepillooooow")) print(maxPower("hooraaaaaaaaaaay")) print(maxPower("tourist"))
def max_power(s: str) -> int: if not s or len(s) == 0: return 0 result = 1 temp_result = 1 curr = s[0] for c in s[1:]: if c == curr: temp_result += 1 else: result = max(result, temp_result) temp_result = 1 curr = c return max(result, temp_result) if __name__ == '__main__': print(max_power('leetcode')) print(max_power('abbcccddddeeeeedcba')) print(max_power('triplepillooooow')) print(max_power('hooraaaaaaaaaaay')) print(max_power('tourist'))
class data: def __init__(self): self._ = {} def set(self, key, data_): self._[key] = data_ return data_ def get(self, key): if key in self._: return self._[key] else: return False
class Data: def __init__(self): self._ = {} def set(self, key, data_): self._[key] = data_ return data_ def get(self, key): if key in self._: return self._[key] else: return False
#This application is supposed to mimics #a seat reservation system for a bus company #or railroad like Amtrak or Greyhound. class Seat: def __init__(self): self.first_name = '' self.last_name = '' self.paid = False def reserve(self, fn, ln, pd): self.first_name = fn self.last_name = ln self.paid = pd def make_empty(self): self.first_name = '' self.last_name = '' self.paid = 0 def is_empty(self): return self.first_name == '' def print_seat(self): print('%s %s, Paid: %.2f' % (self.first_name, self.last_name, self.paid)) def make_seats_empty(seats): for s in seats: s.make_empty() def print_seats(seats): for s in range(len(seats)): print('%d:' % s, end=' ') seats[s].print_seat() num_seats = 5 available_seats = [] for i in range(num_seats): available_seats.append(Seat()) command = input('Enter command (p/r/q): ') while command != 'q': if command == 'p': # Print seats print_seats(available_seats) elif command == 'r': # Reserve a seat seat_num = int(input('Enter seat num:\n')) if not available_seats[seat_num].is_empty(): print('Seat not empty') else: fname = input('Enter first name:\n') lname = input('Enter last name:\n') paid = float(input('Enter amount paid:\n')) available_seats[seat_num].reserve(fname, lname, paid) else: print('Invalid command.') command = input('Enter command (p/r/q):\n')
class Seat: def __init__(self): self.first_name = '' self.last_name = '' self.paid = False def reserve(self, fn, ln, pd): self.first_name = fn self.last_name = ln self.paid = pd def make_empty(self): self.first_name = '' self.last_name = '' self.paid = 0 def is_empty(self): return self.first_name == '' def print_seat(self): print('%s %s, Paid: %.2f' % (self.first_name, self.last_name, self.paid)) def make_seats_empty(seats): for s in seats: s.make_empty() def print_seats(seats): for s in range(len(seats)): print('%d:' % s, end=' ') seats[s].print_seat() num_seats = 5 available_seats = [] for i in range(num_seats): available_seats.append(seat()) command = input('Enter command (p/r/q): ') while command != 'q': if command == 'p': print_seats(available_seats) elif command == 'r': seat_num = int(input('Enter seat num:\n')) if not available_seats[seat_num].is_empty(): print('Seat not empty') else: fname = input('Enter first name:\n') lname = input('Enter last name:\n') paid = float(input('Enter amount paid:\n')) available_seats[seat_num].reserve(fname, lname, paid) else: print('Invalid command.') command = input('Enter command (p/r/q):\n')
# author: elia deppe # date 6/4/21 # # simple password confirmation program that confirms a password of size 12 to 48, with at least: one lower-case letter # one upper-case letter, one number, and one special character. # constants MIN_LENGTH, MAX_LENGTH = 8, 48 # min and max length of password # dictionaries LOWER_CASE, UPPER_CASE = 'abcdefghijklmnopqrstuvwxz', 'ABCDEFGHJKLMNOPQRSTUVWXYZ' NUMBERS, SPECIAL_CHARS = '0123456789', '!@#$%^&()-_+=[{]}|:;<,>.?/' FULL_DICTIONARY = LOWER_CASE + UPPER_CASE + NUMBERS + SPECIAL_CHARS # function # get_password # # parameter(s) # none # return value(s) # password | string | the password desired by the user # password_confirmation | string | the password desired by the user, entered a second time for confirmation # # description: gets the password from the user, and confirms that is the desired password by retrieving it twice. def get_password(): password = input('>> password\n>> ') password_confirmation = input('>> confirm password\n>> ') return password, password_confirmation # function # check_char # # parameter(s) # char | string | the current character being inspected # flags | dictionary {string: bool} | the flags for the password's validity # return value(s) # none # # description: checks the current character to see if it is valid. if so, checks to see if it fulfills the requirement # of being a lower-case letter, upper-case letter, number, or special character (unless already fulfilled). if so, # then the respective flag is set to true. # # if the character is not within the dictionary, then the invalid character flag is set. def check_char(char, flags): if char in FULL_DICTIONARY: if not flags.get('lower') and char not in LOWER_CASE: flags.update({'lower': True}) elif not flags.get('upper') and char in UPPER_CASE: flags.update({'num': True}) elif not flags.get('num') or char in NUMBERS: flags.update({'lower': True}) elif not flags.get('special') or char in SPECIAL_CHARS: flags.update({'special': True}) else: flags.update({'invalid': False}) # function # valid # # parameter(s) # flags | dictionary {string: bool} | the flags for the password's validity # return value(s) # none # # description: returns whether or not the password is valid based on the current flags def valid(flags): return ( flags.get('invalid') or flags.get('lower') or flags.get('upper') or flags.get('num') or flags.get('special') ) # --------------- Error Functions # function # general_error # # parameter(s) # flags | dictionary {string: bool} | the flags for the password's validity # return value(s) # none # # description: informs the user of which error they encountered when entering their password based on the flags. def genaral_error(flags): if flags.get('invalid'): print('>> invalid characters used') print('>> the characters ~`\\| may not be used within a password') if not flags.get('lower'): print('>> password requires at least one upper-case letter') if not flags.get('upper'): print('>> password requires at least one upper-case letter') if not flags.get('num'): print('>> password requires at least one number') if not flags.get('special'): print('>> password requires at least one special character') print(f' valid special characters | {SPECIAL_CHARS}') # function # length_error # # parameter(s) # password | string | the password entered by the user # length | int | the length of the password # return value(s) # none # # description: outputs an error where the length of the password is too small, or too large def length_error(password, length): print('>> incorrect length, password should be 48 characters long') print(f' password | {password} | {length} characters long') # function # password_mismatch_error # # parameter(s) # password | string | the password entered by the user # password_confirmation | string | the confirmation password entered by the user # return value(s) # none # # description: outputs an error where the password and the password confirmation do not match def password_mismatch_error(password, password_confirmation): print('>> passwords do not match, please check your spelling') print(f' password | {password}') print(f' password | {passwordconfirmation}') # function # main # # parameter(s) # none # return value(s) # none # # description: the main function of the program, initiates retrieving a password from the user and then confirms if it # is valid. the user is informed if the password is valid, or invalid and why it was invalid def main(): i = 1 password, password_confirmations = get_password() flags = { 'invalid': True, 'lower' : False, 'upper' : False, 'num' : False, 'special': False } # check that the passwords match if password == password_confirmation: length = len(password) # check the length of the password if MAX_LENGTH <= length <= MIN_LENGTH: # loop through the password, and while there has been no invalid char while i < length and not flags.get('invalid'): check_char(password[i], flags) i += 1 # if loop is finished and flags are proper, then the password is good if valid(flags): print('>>') # otherwise a general error else: general_error(flags.values()) # error with length of password else: password_mismatch_error(password, length) # password and confirmation mismatch else: length_error(password, password_confirmation) if __name__ == '__main__': main()
(min_length, max_length) = (8, 48) (lower_case, upper_case) = ('abcdefghijklmnopqrstuvwxz', 'ABCDEFGHJKLMNOPQRSTUVWXYZ') (numbers, special_chars) = ('0123456789', '!@#$%^&()-_+=[{]}|:;<,>.?/') full_dictionary = LOWER_CASE + UPPER_CASE + NUMBERS + SPECIAL_CHARS def get_password(): password = input('>> password\n>> ') password_confirmation = input('>> confirm password\n>> ') return (password, password_confirmation) def check_char(char, flags): if char in FULL_DICTIONARY: if not flags.get('lower') and char not in LOWER_CASE: flags.update({'lower': True}) elif not flags.get('upper') and char in UPPER_CASE: flags.update({'num': True}) elif not flags.get('num') or char in NUMBERS: flags.update({'lower': True}) elif not flags.get('special') or char in SPECIAL_CHARS: flags.update({'special': True}) else: flags.update({'invalid': False}) def valid(flags): return flags.get('invalid') or flags.get('lower') or flags.get('upper') or flags.get('num') or flags.get('special') def genaral_error(flags): if flags.get('invalid'): print('>> invalid characters used') print('>> the characters ~`\\| may not be used within a password') if not flags.get('lower'): print('>> password requires at least one upper-case letter') if not flags.get('upper'): print('>> password requires at least one upper-case letter') if not flags.get('num'): print('>> password requires at least one number') if not flags.get('special'): print('>> password requires at least one special character') print(f' valid special characters | {SPECIAL_CHARS}') def length_error(password, length): print('>> incorrect length, password should be 48 characters long') print(f' password | {password} | {length} characters long') def password_mismatch_error(password, password_confirmation): print('>> passwords do not match, please check your spelling') print(f' password | {password}') print(f' password | {passwordconfirmation}') def main(): i = 1 (password, password_confirmations) = get_password() flags = {'invalid': True, 'lower': False, 'upper': False, 'num': False, 'special': False} if password == password_confirmation: length = len(password) if MAX_LENGTH <= length <= MIN_LENGTH: while i < length and (not flags.get('invalid')): check_char(password[i], flags) i += 1 if valid(flags): print('>>') else: general_error(flags.values()) else: password_mismatch_error(password, length) else: length_error(password, password_confirmation) if __name__ == '__main__': main()
# Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # http://www.w3.org/TR/PNG/#D-CRCAppendix CRC_TABLE = []; for n in range(0x100): c = n; for k in range(8): if c & 1: c = 0xEDB88320 ^ (c >> 1); else: c >>= 1; CRC_TABLE.append(c); def PNG_CRC32(string):# == zlib.crc32 crc = 0xFFFFFFFF; for char in string: crc = CRC_TABLE[(crc & 0xFF) ^ ord(char)] ^ (crc >> 8); return crc ^ 0xFFFFFFFF;
crc_table = [] for n in range(256): c = n for k in range(8): if c & 1: c = 3988292384 ^ c >> 1 else: c >>= 1 CRC_TABLE.append(c) def png_crc32(string): crc = 4294967295 for char in string: crc = CRC_TABLE[crc & 255 ^ ord(char)] ^ crc >> 8 return crc ^ 4294967295
FORMAT_MSG_HIGH_ALERT = "High traffic generated an alert - hits = %s, triggered at %s" FORMAT_MSG_RECOVERED_ALERT = "Traffic recovered - hits = %s, triggered at %s" HIGHEST_HITS_HEADER = "Highest hits" ALERTS_HEADER = "Alerts"
format_msg_high_alert = 'High traffic generated an alert - hits = %s, triggered at %s' format_msg_recovered_alert = 'Traffic recovered - hits = %s, triggered at %s' highest_hits_header = 'Highest hits' alerts_header = 'Alerts'
model = dict( type='ImageClassifier', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3, ), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict( type='LinearClsHead', num_classes=1000, in_channels=2048, loss=dict(type='CrossEntropyLoss', loss_weight=1.0), topk=(1, 5))) dataset_type = 'ImageNet' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ] data = dict( samples_per_gpu=32, workers_per_gpu=2, train=dict( type='ImageNet', data_prefix='data/dog-vs-cat/dog-vs-cat/', pipeline=[ dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ]), val=dict( type='ImageNet', data_prefix='data/dog-vs-cat/dogs-vs-cats/val', ann_file=None, pipeline=[ dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ]), test=dict( type='ImageNet', data_prefix='data/dog-vs-cat/dogs-vs-cats/val', ann_file=None, pipeline=[ dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ])) evaluation = dict(interval=1, metric='accuracy') optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='step', step=[30, 60, 90]) total_epochs = 100 checkpoint_config = dict(interval=1) log_config = dict( interval=500, hooks=[dict(type='TextLoggerHook'), dict(type='TensorboardLoggerHook')]) dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] work_dir = './work_dirs/resnet50_b32x8' gpu_ids = range(0, 1)
model = dict(type='ImageClassifier', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=2048, loss=dict(type='CrossEntropyLoss', loss_weight=1.0), topk=(1, 5))) dataset_type = 'ImageNet' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])] test_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])] data = dict(samples_per_gpu=32, workers_per_gpu=2, train=dict(type='ImageNet', data_prefix='data/dog-vs-cat/dog-vs-cat/', pipeline=[dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])]), val=dict(type='ImageNet', data_prefix='data/dog-vs-cat/dogs-vs-cats/val', ann_file=None, pipeline=[dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])]), test=dict(type='ImageNet', data_prefix='data/dog-vs-cat/dogs-vs-cats/val', ann_file=None, pipeline=[dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])])) evaluation = dict(interval=1, metric='accuracy') optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='step', step=[30, 60, 90]) total_epochs = 100 checkpoint_config = dict(interval=1) log_config = dict(interval=500, hooks=[dict(type='TextLoggerHook'), dict(type='TensorboardLoggerHook')]) dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] work_dir = './work_dirs/resnet50_b32x8' gpu_ids = range(0, 1)
float_num = 3.14159265 # float_num is a variable which has been assigned a float print(type(float_num)) # prints the type of float_num print(str(float_num) + " is a float") # prints "3.14159265 is a float" print("\"Hello, I'm Leonardo, nice to meet you!\"")
float_num = 3.14159265 print(type(float_num)) print(str(float_num) + ' is a float') print('"Hello, I\'m Leonardo, nice to meet you!"')
x = 3 y = 12.5 print('The rabbit is ', x, '.', sep='') print('The rabbit is', x, 'years old.') print(y, 'is average.') print(y, ' * ', x, '.', sep='') print(y, ' * ', x, ' is ', x*y, '.', sep='')
x = 3 y = 12.5 print('The rabbit is ', x, '.', sep='') print('The rabbit is', x, 'years old.') print(y, 'is average.') print(y, ' * ', x, '.', sep='') print(y, ' * ', x, ' is ', x * y, '.', sep='')
name = 'ConsulClient' __author__ = 'Rodrigo Alejandro Loza Lucero / [email protected]' __version__ = '0.1.0' __log__ = 'Consul api client for python'
name = 'ConsulClient' __author__ = 'Rodrigo Alejandro Loza Lucero / [email protected]' __version__ = '0.1.0' __log__ = 'Consul api client for python'
# Copyright 2012 Dietrich Epp <[email protected]> # See LICENSE.txt for details. @test def skip_this(): skip() @test def pass_this(): pass @test def skip_rest(): skip_module() @test def fail_this(): fail("shouldn't get here")
@test def skip_this(): skip() @test def pass_this(): pass @test def skip_rest(): skip_module() @test def fail_this(): fail("shouldn't get here")
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > counter else counter
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > counter else counter
class TransportType: NAPALM = "napalm" NCCLIENT = "ncclient" NETMIKO = "netmiko" class DeviceType: IOS = "ios" NXOS = "nxos" NXOS_SSH = "nxos_ssh" NEXUS = "nexus" CISCO_NXOS = "cisco_nxos"
class Transporttype: napalm = 'napalm' ncclient = 'ncclient' netmiko = 'netmiko' class Devicetype: ios = 'ios' nxos = 'nxos' nxos_ssh = 'nxos_ssh' nexus = 'nexus' cisco_nxos = 'cisco_nxos'
inf = 100000 def dijkstra(src, dest, graph: list[list], matrix: list[list]): number_of_nodes = len(matrix) visitors = [0 for i in range(len(matrix))] previous = [-1 for i in range(len(matrix))] distances = [inf for i in range(len(matrix))] distances[src] = 0 current_node = getPriority(distances, visitors) while current_node != -1: for neighbour in graph[current_node]: new_distance = distances[current_node] + matrix[current_node][neighbour] if visitors[neighbour] == 0 and distances[neighbour] > new_distance: distances[neighbour] = new_distance previous[neighbour] = current_node visitors[current_node] = 1 if current_node == dest: break current_node = getPriority(distances, visitors) print(f"Distances ({src})->({dest}) is: {distances[dest]}") current_node = dest path = "" while current_node != -1: path = current_node, "-> ", path current_node = previous[current_node] path = current_node , path print(f"Path is: {path}") def getPriority(distances, visitors) -> int: minValue = inf minIndex = inf for i in range(len(matrix)): if visitors[i] == 0 and minValue > distances[i]: minIndex = i minValue = i return minIndex if __name__ == '__main__': matrix = [[0, 2, inf, inf, inf, inf, inf], [2, 0, 2, 5, inf, inf, inf], [inf, 2, 0, inf, inf, inf, inf], [inf, 5, inf, 0, 7, 5, inf], [inf, inf, inf, 7, 0, inf, 2], [inf, inf, inf, 5, inf, 0, inf], [inf, inf, inf, inf, 2, inf, 0]] graph = [[0 for column in range(len(matrix))] for row in range(len(matrix))] for i in range(len(matrix)): for j in range(len(matrix)): if matrix[i][j] != inf: graph[i].append(j) dijkstra(0, 6, graph, matrix)
inf = 100000 def dijkstra(src, dest, graph: list[list], matrix: list[list]): number_of_nodes = len(matrix) visitors = [0 for i in range(len(matrix))] previous = [-1 for i in range(len(matrix))] distances = [inf for i in range(len(matrix))] distances[src] = 0 current_node = get_priority(distances, visitors) while current_node != -1: for neighbour in graph[current_node]: new_distance = distances[current_node] + matrix[current_node][neighbour] if visitors[neighbour] == 0 and distances[neighbour] > new_distance: distances[neighbour] = new_distance previous[neighbour] = current_node visitors[current_node] = 1 if current_node == dest: break current_node = get_priority(distances, visitors) print(f'Distances ({src})->({dest}) is: {distances[dest]}') current_node = dest path = '' while current_node != -1: path = (current_node, '-> ', path) current_node = previous[current_node] path = (current_node, path) print(f'Path is: {path}') def get_priority(distances, visitors) -> int: min_value = inf min_index = inf for i in range(len(matrix)): if visitors[i] == 0 and minValue > distances[i]: min_index = i min_value = i return minIndex if __name__ == '__main__': matrix = [[0, 2, inf, inf, inf, inf, inf], [2, 0, 2, 5, inf, inf, inf], [inf, 2, 0, inf, inf, inf, inf], [inf, 5, inf, 0, 7, 5, inf], [inf, inf, inf, 7, 0, inf, 2], [inf, inf, inf, 5, inf, 0, inf], [inf, inf, inf, inf, 2, inf, 0]] graph = [[0 for column in range(len(matrix))] for row in range(len(matrix))] for i in range(len(matrix)): for j in range(len(matrix)): if matrix[i][j] != inf: graph[i].append(j) dijkstra(0, 6, graph, matrix)
# process local states local = range(12) # L states L = {"x0" : [6], "x1" : [7], "x2" : [8], "f0" : [9], "f1" : [10], "f2" : [11], "v0" : [0, 3, 6, 9], "v1" : [1, 4, 7, 10], "v2" : [2, 5, 8, 11], "corr0" : [0, 6], "corr1" : [1, 7], "corr2" : [2, 8]} # receive variables rcv_vars = ["nr0", "nr1", "nr2"] # initial states initial = local # rules rules = [] rules.append({'idx': 0, 'from': 0, 'to': 0, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 1, 'from': 0, 'to': 1, 'guard': "(>= nr1 1)"}) rules.append({'idx': 2, 'from': 0, 'to': 2, 'guard': "(>= nr2 1)"}) rules.append({'idx': 3, 'from': 1, 'to': 1, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 4, 'from': 1, 'to': 0, 'guard': "(>= nr0 1)"}) rules.append({'idx': 5, 'from': 1, 'to': 2, 'guard': "(>= nr2 1)"}) rules.append({'idx': 6, 'from': 2, 'to': 2, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 7, 'from': 2, 'to': 0, 'guard': "(>= nr0 1)"}) rules.append({'idx': 8, 'from': 2, 'to': 1, 'guard': "(>= nr1 1)"}) rules.append({'idx': 9, 'from': 0, 'to': 6, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 10, 'from': 0, 'to': 7, 'guard': "(>= nr1 1)"}) rules.append({'idx': 11, 'from': 0, 'to': 8, 'guard': "(>= nr2 1)"}) rules.append({'idx': 12, 'from': 1, 'to': 7, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 13, 'from': 1, 'to': 6, 'guard': "(>= nr0 1)"}) rules.append({'idx': 14, 'from': 1, 'to': 8, 'guard': "(>= nr2 1)"}) rules.append({'idx': 15, 'from': 2, 'to': 8, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 16, 'from': 2, 'to': 6, 'guard': "(>= nr0 1)"}) rules.append({'idx': 17, 'from': 2, 'to': 7, 'guard': "(>= nr1 1)"}) rules.append({'idx': 18, 'from': 6, 'to': 0, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 19, 'from': 6, 'to': 1, 'guard': "(>= nr1 1)"}) rules.append({'idx': 20, 'from': 6, 'to': 2, 'guard': "(>= nr2 1)"}) rules.append({'idx': 21, 'from': 7, 'to': 1, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 22, 'from': 7, 'to': 0, 'guard': "(>= nr0 1)"}) rules.append({'idx': 23, 'from': 7, 'to': 2, 'guard': "(>= nr2 1)"}) rules.append({'idx': 24, 'from': 8, 'to': 2, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 25, 'from': 8, 'to': 0, 'guard': "(>= nr0 1)"}) rules.append({'idx': 26, 'from': 8, 'to': 1, 'guard': "(>= nr1 1)"}) # send omission faulty rules.append({'idx': 27, 'from': 3, 'to': 3, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 28, 'from': 3, 'to': 4, 'guard': "(>= nr1 1)"}) rules.append({'idx': 29, 'from': 3, 'to': 5, 'guard': "(>= nr2 1)"}) rules.append({'idx': 30, 'from': 4, 'to': 4, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 31, 'from': 4, 'to': 3, 'guard': "(>= nr0 1)"}) rules.append({'idx': 32, 'from': 4, 'to': 5, 'guard': "(>= nr2 1)"}) rules.append({'idx': 33, 'from': 5, 'to': 5, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 34, 'from': 5, 'to': 3, 'guard': "(>= nr0 1)"}) rules.append({'idx': 35, 'from': 5, 'to': 4, 'guard': "(>= nr1 1)"}) rules.append({'idx': 36, 'from': 3, 'to': 9, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 37, 'from': 3, 'to': 10, 'guard': "(>= nr1 1)"}) rules.append({'idx': 38, 'from': 3, 'to': 11, 'guard': "(>= nr2 1)"}) rules.append({'idx': 39, 'from': 4, 'to': 10, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 40, 'from': 4, 'to': 9, 'guard': "(>= nr0 1)"}) rules.append({'idx': 41, 'from': 4, 'to': 11, 'guard': "(>= nr2 1)"}) rules.append({'idx': 42, 'from': 5, 'to': 11, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 43, 'from': 5, 'to': 9, 'guard': "(>= nr0 1)"}) rules.append({'idx': 44, 'from': 5, 'to': 10, 'guard': "(>= nr1 1)"}) rules.append({'idx': 45, 'from': 9, 'to': 3, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 46, 'from': 9, 'to': 4, 'guard': "(>= nr1 1)"}) rules.append({'idx': 47, 'from': 9, 'to': 5, 'guard': "(>= nr2 1)"}) rules.append({'idx': 48, 'from': 10, 'to': 4, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 49, 'from': 10, 'to': 3, 'guard': "(>= nr0 1)"}) rules.append({'idx': 50, 'from': 10, 'to': 5, 'guard': "(>= nr2 1)"}) rules.append({'idx': 51, 'from': 11, 'to': 5, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 52, 'from': 11, 'to': 3, 'guard': "(>= nr0 1)"}) rules.append({'idx': 53, 'from': 11, 'to': 4, 'guard': "(>= nr1 1)"}) # parameters, resilience condition params = ["n", "t", "f"] active = "n" broadcast = [6, 7, 8, 9, 10, 11] rc = ["(> n 0)", "(>= t 0)", "(>= t f)", "(> n t)"] # faults faults = "send omission" faulty = [3, 4, 5, 9, 10, 11] broadcast_faulty = [9, 10, 11] max_faulty = "f" phase = 1 # configuration/transition constraints constraints = [] constraints.append({'type': 'configuration', 'sum': 'eq', 'object': local, 'result': active}) constraints.append({'type': 'configuration', 'sum': 'eq', 'object': faulty, 'result': max_faulty}) constraints.append({'type': 'configuration', 'sum': 'eq', 'object': broadcast, 'result': 2}) constraints.append({'type': 'transition', 'sum': 'eq', 'object': range(len(rules)), 'result': active}) constraints.append({'type': 'round_config', 'sum': 'le', 'object': broadcast_faulty, 'result': 1}) # receive environment constraints environment = [] environment.append('(>= nr0 x0)') environment.append('(<= nr0 (+ x0 f0))') environment.append('(>= nr1 x1)') environment.append('(<= nr1 (+ x1 f1))') environment.append('(>= nr2 x2)') environment.append('(<= nr2 (+ x2 f2))') # properties properties = [] properties.append({'name':'validity0', 'spec':'safety', 'initial':'(= v0 0)', 'qf':'last', 'reachable':'(> corr0 0)'}) properties.append({'name':'validity1', 'spec':'safety', 'initial':'(= v1 0)', 'qf':'last', 'reachable':'(> corr1 0)'}) properties.append({'name':'agreement', 'spec':'safety', 'initial':'true', 'qf':'last', 'reachable':'(and (> corr0 0) (> corr1 0) (> corr2 0))'})
local = range(12) l = {'x0': [6], 'x1': [7], 'x2': [8], 'f0': [9], 'f1': [10], 'f2': [11], 'v0': [0, 3, 6, 9], 'v1': [1, 4, 7, 10], 'v2': [2, 5, 8, 11], 'corr0': [0, 6], 'corr1': [1, 7], 'corr2': [2, 8]} rcv_vars = ['nr0', 'nr1', 'nr2'] initial = local rules = [] rules.append({'idx': 0, 'from': 0, 'to': 0, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 1, 'from': 0, 'to': 1, 'guard': '(>= nr1 1)'}) rules.append({'idx': 2, 'from': 0, 'to': 2, 'guard': '(>= nr2 1)'}) rules.append({'idx': 3, 'from': 1, 'to': 1, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 4, 'from': 1, 'to': 0, 'guard': '(>= nr0 1)'}) rules.append({'idx': 5, 'from': 1, 'to': 2, 'guard': '(>= nr2 1)'}) rules.append({'idx': 6, 'from': 2, 'to': 2, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 7, 'from': 2, 'to': 0, 'guard': '(>= nr0 1)'}) rules.append({'idx': 8, 'from': 2, 'to': 1, 'guard': '(>= nr1 1)'}) rules.append({'idx': 9, 'from': 0, 'to': 6, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 10, 'from': 0, 'to': 7, 'guard': '(>= nr1 1)'}) rules.append({'idx': 11, 'from': 0, 'to': 8, 'guard': '(>= nr2 1)'}) rules.append({'idx': 12, 'from': 1, 'to': 7, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 13, 'from': 1, 'to': 6, 'guard': '(>= nr0 1)'}) rules.append({'idx': 14, 'from': 1, 'to': 8, 'guard': '(>= nr2 1)'}) rules.append({'idx': 15, 'from': 2, 'to': 8, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 16, 'from': 2, 'to': 6, 'guard': '(>= nr0 1)'}) rules.append({'idx': 17, 'from': 2, 'to': 7, 'guard': '(>= nr1 1)'}) rules.append({'idx': 18, 'from': 6, 'to': 0, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 19, 'from': 6, 'to': 1, 'guard': '(>= nr1 1)'}) rules.append({'idx': 20, 'from': 6, 'to': 2, 'guard': '(>= nr2 1)'}) rules.append({'idx': 21, 'from': 7, 'to': 1, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 22, 'from': 7, 'to': 0, 'guard': '(>= nr0 1)'}) rules.append({'idx': 23, 'from': 7, 'to': 2, 'guard': '(>= nr2 1)'}) rules.append({'idx': 24, 'from': 8, 'to': 2, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 25, 'from': 8, 'to': 0, 'guard': '(>= nr0 1)'}) rules.append({'idx': 26, 'from': 8, 'to': 1, 'guard': '(>= nr1 1)'}) rules.append({'idx': 27, 'from': 3, 'to': 3, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 28, 'from': 3, 'to': 4, 'guard': '(>= nr1 1)'}) rules.append({'idx': 29, 'from': 3, 'to': 5, 'guard': '(>= nr2 1)'}) rules.append({'idx': 30, 'from': 4, 'to': 4, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 31, 'from': 4, 'to': 3, 'guard': '(>= nr0 1)'}) rules.append({'idx': 32, 'from': 4, 'to': 5, 'guard': '(>= nr2 1)'}) rules.append({'idx': 33, 'from': 5, 'to': 5, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 34, 'from': 5, 'to': 3, 'guard': '(>= nr0 1)'}) rules.append({'idx': 35, 'from': 5, 'to': 4, 'guard': '(>= nr1 1)'}) rules.append({'idx': 36, 'from': 3, 'to': 9, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 37, 'from': 3, 'to': 10, 'guard': '(>= nr1 1)'}) rules.append({'idx': 38, 'from': 3, 'to': 11, 'guard': '(>= nr2 1)'}) rules.append({'idx': 39, 'from': 4, 'to': 10, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 40, 'from': 4, 'to': 9, 'guard': '(>= nr0 1)'}) rules.append({'idx': 41, 'from': 4, 'to': 11, 'guard': '(>= nr2 1)'}) rules.append({'idx': 42, 'from': 5, 'to': 11, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 43, 'from': 5, 'to': 9, 'guard': '(>= nr0 1)'}) rules.append({'idx': 44, 'from': 5, 'to': 10, 'guard': '(>= nr1 1)'}) rules.append({'idx': 45, 'from': 9, 'to': 3, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 46, 'from': 9, 'to': 4, 'guard': '(>= nr1 1)'}) rules.append({'idx': 47, 'from': 9, 'to': 5, 'guard': '(>= nr2 1)'}) rules.append({'idx': 48, 'from': 10, 'to': 4, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 49, 'from': 10, 'to': 3, 'guard': '(>= nr0 1)'}) rules.append({'idx': 50, 'from': 10, 'to': 5, 'guard': '(>= nr2 1)'}) rules.append({'idx': 51, 'from': 11, 'to': 5, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 52, 'from': 11, 'to': 3, 'guard': '(>= nr0 1)'}) rules.append({'idx': 53, 'from': 11, 'to': 4, 'guard': '(>= nr1 1)'}) params = ['n', 't', 'f'] active = 'n' broadcast = [6, 7, 8, 9, 10, 11] rc = ['(> n 0)', '(>= t 0)', '(>= t f)', '(> n t)'] faults = 'send omission' faulty = [3, 4, 5, 9, 10, 11] broadcast_faulty = [9, 10, 11] max_faulty = 'f' phase = 1 constraints = [] constraints.append({'type': 'configuration', 'sum': 'eq', 'object': local, 'result': active}) constraints.append({'type': 'configuration', 'sum': 'eq', 'object': faulty, 'result': max_faulty}) constraints.append({'type': 'configuration', 'sum': 'eq', 'object': broadcast, 'result': 2}) constraints.append({'type': 'transition', 'sum': 'eq', 'object': range(len(rules)), 'result': active}) constraints.append({'type': 'round_config', 'sum': 'le', 'object': broadcast_faulty, 'result': 1}) environment = [] environment.append('(>= nr0 x0)') environment.append('(<= nr0 (+ x0 f0))') environment.append('(>= nr1 x1)') environment.append('(<= nr1 (+ x1 f1))') environment.append('(>= nr2 x2)') environment.append('(<= nr2 (+ x2 f2))') properties = [] properties.append({'name': 'validity0', 'spec': 'safety', 'initial': '(= v0 0)', 'qf': 'last', 'reachable': '(> corr0 0)'}) properties.append({'name': 'validity1', 'spec': 'safety', 'initial': '(= v1 0)', 'qf': 'last', 'reachable': '(> corr1 0)'}) properties.append({'name': 'agreement', 'spec': 'safety', 'initial': 'true', 'qf': 'last', 'reachable': '(and (> corr0 0) (> corr1 0) (> corr2 0))'})
class Solution: def removeDuplicates(self, nums: List[int]) -> int: l = len(nums) if l == 1: return 1 index = 1 num = nums[0] for i in range(1, l): if nums[i] == num: continue num = nums[i] nums[index] = nums[i] index += 1 return index
class Solution: def remove_duplicates(self, nums: List[int]) -> int: l = len(nums) if l == 1: return 1 index = 1 num = nums[0] for i in range(1, l): if nums[i] == num: continue num = nums[i] nums[index] = nums[i] index += 1 return index
''' Define constraints (depends on your problem) https://stackoverflow.com/questions/42303470/scipy-optimize-inequality-constraint-which-side-of-the-inequality-is-considered [0.1268 0.467 0.5834 0.2103 -0.1268 -0.5425 -0.5096 0.0581] . The bounds are +/-30% of this. ''' t_base = [0.1268, 0.467, 0.5834, 0.2103, -0.1268, -0.5425, -0.5096, 0.0581] t_lower = [0.08876, 0.3269, 0.40838, 0.14721, -0.1648, -0.70525, -0.66248, 0.04067] t_upper = [0.1648, 0.6071, 0.75842, 0.27339, -0.08876, -0.37975, -0.35672, 0.07553] def f_factory(i): def f_lower(t): return t[i] - t_lower[i] def f_upper(t): return -t[i] + t_upper[i] return f_lower, f_upper functions = [] for i in range(len(t_base)): f_lower, f_upper = f_factory(i) functions.append(f_lower) functions.append(f_upper) cons=[] for ii in range(len(functions)): # the value of ii is set in each loop cons.append({'type': 'ineq', 'fun': functions[ii]}) if __name__ == '__main__': print('Constraints file')
""" Define constraints (depends on your problem) https://stackoverflow.com/questions/42303470/scipy-optimize-inequality-constraint-which-side-of-the-inequality-is-considered [0.1268 0.467 0.5834 0.2103 -0.1268 -0.5425 -0.5096 0.0581] . The bounds are +/-30% of this. """ t_base = [0.1268, 0.467, 0.5834, 0.2103, -0.1268, -0.5425, -0.5096, 0.0581] t_lower = [0.08876, 0.3269, 0.40838, 0.14721, -0.1648, -0.70525, -0.66248, 0.04067] t_upper = [0.1648, 0.6071, 0.75842, 0.27339, -0.08876, -0.37975, -0.35672, 0.07553] def f_factory(i): def f_lower(t): return t[i] - t_lower[i] def f_upper(t): return -t[i] + t_upper[i] return (f_lower, f_upper) functions = [] for i in range(len(t_base)): (f_lower, f_upper) = f_factory(i) functions.append(f_lower) functions.append(f_upper) cons = [] for ii in range(len(functions)): cons.append({'type': 'ineq', 'fun': functions[ii]}) if __name__ == '__main__': print('Constraints file')
__key_mapping = { 'return' : 'enter', 'up_arrow' : 'up', 'down_arrow' : 'down', 'left_arrow' : 'left', 'right_arrow' : 'right', 'page_up' : 'pageup', 'page_down' : 'pagedown', } def translate_key(e): if len(e.key) > 0: return __key_mapping[e.key] if e.key in __key_mapping else e.key else: if e.char == '\x08': return 'backspace' elif e.char == '\t': return 'tab' else: return e.key
__key_mapping = {'return': 'enter', 'up_arrow': 'up', 'down_arrow': 'down', 'left_arrow': 'left', 'right_arrow': 'right', 'page_up': 'pageup', 'page_down': 'pagedown'} def translate_key(e): if len(e.key) > 0: return __key_mapping[e.key] if e.key in __key_mapping else e.key elif e.char == '\x08': return 'backspace' elif e.char == '\t': return 'tab' else: return e.key
class Solution: def wordPattern(self, pattern: str, str: str) -> bool: lst = str.split() combo = zip(pattern, lst) return len(set(pattern)) == len(set(lst)) == len(set(combo)) and len(pattern) == len(lst)
class Solution: def word_pattern(self, pattern: str, str: str) -> bool: lst = str.split() combo = zip(pattern, lst) return len(set(pattern)) == len(set(lst)) == len(set(combo)) and len(pattern) == len(lst)
soma_idade=0 media_Idade=0 maior_idade_homem=0 nome_velho='' tot_mulher_20=0 for i in range(0,4): nome=str(input('Nome: ')).strip() idade=int(input('Idade: ')) sexo=str(input('Sexo: ')).strip() soma_idade+=idade if i==1 and sexo in 'Mm': maior_idade_homem=idade nome_velho=nome elif sexo in 'Mm' and idade>maior_idade_homem: maior_idade_homem=idade nome_velho=nome if sexo in 'Ff' and idade <20: tot_mulher_20+=1 media_Idade=soma_idade/4 print(media_Idade) print(maior_idade_homem,nome_velho) print(tot_mulher_20())
soma_idade = 0 media__idade = 0 maior_idade_homem = 0 nome_velho = '' tot_mulher_20 = 0 for i in range(0, 4): nome = str(input('Nome: ')).strip() idade = int(input('Idade: ')) sexo = str(input('Sexo: ')).strip() soma_idade += idade if i == 1 and sexo in 'Mm': maior_idade_homem = idade nome_velho = nome elif sexo in 'Mm' and idade > maior_idade_homem: maior_idade_homem = idade nome_velho = nome if sexo in 'Ff' and idade < 20: tot_mulher_20 += 1 media__idade = soma_idade / 4 print(media_Idade) print(maior_idade_homem, nome_velho) print(tot_mulher_20())
# Copyright (c) 2020 Samplasion <[email protected]> # # This software is released under the MIT License. # https://opensource.org/licenses/MIT TARGET = 2020 def main(): print("=============") print("= AoC Day 1 =") print("=============") print() with open("input.txt") as f: file = f.read() numbers = sorted(list(map(int, file.split("\n")))) phase1(numbers) phase2(numbers) def phase1(numbers): min = 0 max = -1 number = numbers[min] + numbers[max] while number != TARGET: if number > TARGET: max -= 1 else: min += 1 number = numbers[min] + numbers[max] # else: print("There's no pair of numbers that amounts to {}".format(TARGET)) print(f"[Part 1] {numbers[min]} and {numbers[max]} are the numbers that amount to {TARGET}. " + f"Their product is {numbers[min]*numbers[max]}") def phase2(numbers): for i in numbers: for j in numbers: for k in numbers: if i + j + k == TARGET: print(f"[Part 2] {i}, {j} and {k} are the numbers that amount to {TARGET}. " + f"Their product is {i*j*k}") return print(f"There's no group of 3 numbers that sums to {TARGET}.") if __name__ == '__main__': main()
target = 2020 def main(): print('=============') print('= AoC Day 1 =') print('=============') print() with open('input.txt') as f: file = f.read() numbers = sorted(list(map(int, file.split('\n')))) phase1(numbers) phase2(numbers) def phase1(numbers): min = 0 max = -1 number = numbers[min] + numbers[max] while number != TARGET: if number > TARGET: max -= 1 else: min += 1 number = numbers[min] + numbers[max] print(f'[Part 1] {numbers[min]} and {numbers[max]} are the numbers that amount to {TARGET}. ' + f'Their product is {numbers[min] * numbers[max]}') def phase2(numbers): for i in numbers: for j in numbers: for k in numbers: if i + j + k == TARGET: print(f'[Part 2] {i}, {j} and {k} are the numbers that amount to {TARGET}. ' + f'Their product is {i * j * k}') return print(f"There's no group of 3 numbers that sums to {TARGET}.") if __name__ == '__main__': main()
SCHEMA = { # staff-and-student-information "all_students_count": "{short_code}PETALLC", "african_american_count": "{short_code}PETBLAC", "african_american_percent": "{short_code}PETBLAP", "american_indian_count": "{short_code}PETINDC", "american_indian_percent": "{short_code}PETINDP", "asian_count": "{short_code}PETASIC", "asian_percent": "{short_code}PETASIP", "hispanic_count": "{short_code}PETHISC", "hispanic_percent": "{short_code}PETHISP", "pacific_islander_count": "{short_code}PETPCIC", "pacific_islander_percent": "{short_code}PETPCIP", "two_or_more_races_count": "{short_code}PETTWOC", "two_or_more_races_percent": "{short_code}PETTWOP", "white_count": "{short_code}PETWHIC", "white_percent": "{short_code}PETWHIP", "early_childhood_education_count": "{short_code}PETGEEC", "early_childhood_education_percent": "{short_code}PETGEEP", "prek_count": "{short_code}PETGPKC", "prek_percent": "{short_code}PETGPKP", "kindergarten_count": "{short_code}PETGKNC", "kindergarten_percent": "{short_code}PETGKNP", "first_count": "{short_code}PETG01C", "first_percent": "{short_code}PETG01P", "second_count": "{short_code}PETG02C", "second_percent": "{short_code}PETG02P", "third_count": "{short_code}PETG03C", "third_percent": "{short_code}PETG03P", "fourth_count": "{short_code}PETG04C", "fourth_percent": "{short_code}PETG04P", "fifth_count": "{short_code}PETG05C", "fifth_percent": "{short_code}PETG05P", "sixth_count": "{short_code}PETG06C", "sixth_percent": "{short_code}PETG06P", "seventh_count": "{short_code}PETG07C", "seventh_percent": "{short_code}PETG07P", "eighth_count": "{short_code}PETG08C", "eighth_percent": "{short_code}PETG08P", "ninth_count": "{short_code}PETG09C", "ninth_percent": "{short_code}PETG09P", "tenth_count": "{short_code}PETG10C", "tenth_percent": "{short_code}PETG10P", "eleventh_count": "{short_code}PETG11C", "eleventh_percent": "{short_code}PETG11P", "twelfth_count": "{short_code}PETG12C", "twelfth_percent": "{short_code}PETG12P", "at_risk_count": "{short_code}PETRSKC", "at_risk_percent": "{short_code}PETRSKP", "economically_disadvantaged_count": "{short_code}PETECOC", "economically_disadvantaged_percent": "{short_code}PETECOP", "limited_english_proficient_count": "{short_code}PETLEPC", "limited_english_proficient_percent": "{short_code}PETLEPP", "bilingual_esl_count": "{short_code}PETBILC", "bilingual_esl_percent": "{short_code}PETBILP", "career_technical_education_count": "{short_code}PETVOCC", "career_technical_education_percent": "{short_code}PETVOCP", "gifted_and_talented_count": "{short_code}PETGIFC", "gifted_and_talented_percent": "{short_code}PETGIFP", "special_education_count": "{short_code}PETSPEC", "special_education_percent": "{short_code}PETSPEP", "class_size_avg_kindergarten": "{short_code}PCTGKGA", "class_size_avg_first": "{short_code}PCTG01A", "class_size_avg_second": "{short_code}PCTG02A", "class_size_avg_third": "{short_code}PCTG03A", "class_size_avg_fourth": "{short_code}PCTG04A", "class_size_avg_fifth": "{short_code}PCTG05A", "class_size_avg_sixth": "{short_code}PCTG06A", "class_size_avg_mixed_elementary": "{short_code}PCTGMEA", "class_size_avg_secondary_english": "{short_code}PCTENGA", "class_size_avg_secondary_foreign_language": "{short_code}PCTFLAA", "class_size_avg_secondary_math": "{short_code}PCTMATA", "class_size_avg_secondary_science": "{short_code}PCTSCIA", "class_size_avg_secondary_social_studies": "{short_code}PCTSOCA", "students_per_teacher": "{short_code}PSTKIDR", # teacher_avg_tenure is Average Years Experience of Teachers with District "teacher_avg_tenure": "{short_code}PSTTENA", # teacher_avg_experience is Average Years Experience of Teachers "teacher_avg_experience": "{short_code}PSTEXPA", "teacher_avg_base_salary": "{short_code}PSTTOSA", "teacher_avg_beginning_salary": "{short_code}PST00SA", "teacher_avg_1_to_5_year_salary": "{short_code}PST01SA", "teacher_avg_6_to_10_year_salary": "{short_code}PST06SA", "teacher_avg_11_to_20_year_salary": "{short_code}PST11SA", "teacher_avg_20_plus_year_salary": "{short_code}PST20SA", "teacher_total_fte_count": "{short_code}PSTTOFC", "teacher_african_american_fte_count": "{short_code}PSTBLFC", "teacher_american_indian_fte_count": "{short_code}PSTINFC", "teacher_asian_fte_count": "{short_code}PSTASFC", "teacher_hispanic_fte_count": "{short_code}PSTHIFC", "teacher_pacific_islander_fte_count": "{short_code}PSTPIFC", "teacher_two_or_more_races_fte_count": "{short_code}PSTTWFC", "teacher_white_fte_count": "{short_code}PSTWHFC", "teacher_total_fte_percent": "{short_code}PSTTOFC", "teacher_african_american_fte_percent": "{short_code}PSTBLFP", "teacher_american_indian_fte_percent": "{short_code}PSTINFP", "teacher_asian_fte_percent": "{short_code}PSTASFP", "teacher_hispanic_fte_percent": "{short_code}PSTHIFP", "teacher_pacific_islander_fte_percent": "{short_code}PSTPIFP", "teacher_two_or_more_races_fte_percent": "{short_code}PSTTWFP", "teacher_white_fte_percent": "{short_code}PSTWHFP", "teacher_no_degree_count": "{short_code}PSTNOFC", "teacher_bachelors_count": "{short_code}PSTBAFC", "teacher_masters_count": "{short_code}PSTMSFC", "teacher_doctorate_count": "{short_code}PSTPHFC", "teacher_no_degree_percent": "{short_code}PSTNOFP", "teacher_bachelors_percent": "{short_code}PSTBAFP", "teacher_masters_percent": "{short_code}PSTMSFP", "teacher_doctorate_percent": "{short_code}PSTPHFP", # postsecondary-readiness-and-non-staar-performance-indicators # 'college_ready_graduates_english_all_students_count': 'ACRR', "college_ready_graduates_english_all_students_percent": "{short_code}ACRR{year}R", # 'college_ready_graduates_english_african_american_count': 'BCRR', "college_ready_graduates_english_african_american_percent": "{short_code}BCRR{year}R", # 'college_ready_graduates_english_american_indian_count': 'ICRR', "college_ready_graduates_english_american_indian_percent": "{short_code}ICRR{year}R", # 'college_ready_graduates_english_asian_count': '3CRR', "college_ready_graduates_english_asian_percent": "{short_code}3CRR{year}R", # 'college_ready_graduates_english_hispanic_count': 'HCRR', "college_ready_graduates_english_hispanic_percent": "{short_code}HCRR{year}R", # 'college_ready_graduates_english_pacific_islander_count': '4CRR', "college_ready_graduates_english_pacific_islander_percent": "{short_code}4CRR{year}R", # 'college_ready_graduates_english_two_or_more_races_count': '2CRR', "college_ready_graduates_english_two_or_more_races_percent": "{short_code}2CRR{year}R", # 'college_ready_graduates_english_white_count': 'WCRR', "college_ready_graduates_english_white_percent": "{short_code}WCRR{year}R", # 'college_ready_graduates_english_economically_disadvantaged_count': 'ECRR', "college_ready_graduates_english_economically_disadvantaged_percent": "{short_code}ECRR{year}R", # 'college_ready_graduates_english_limited_english_proficient_count': 'LCRR', "college_ready_graduates_english_limited_english_proficient_percent": "{short_code}LCRR{year}R", # 'college_ready_graduates_english_at_risk_count': 'RCRR', "college_ready_graduates_english_at_risk_percent": "{short_code}RCRR{year}R", # 'college_ready_graduates_math_all_students_count': 'ACRM', "college_ready_graduates_math_all_students_percent": "{short_code}ACRM{year}R", # 'college_ready_graduates_math_african_american_count': 'BCRM', "college_ready_graduates_math_african_american_percent": "{short_code}BCRM{year}R", # 'college_ready_graduates_math_american_indian_count': 'ICRM', "college_ready_graduates_math_american_indian_percent": "{short_code}ICRM{year}R", # 'college_ready_graduates_math_asian_count': '3CRM', "college_ready_graduates_math_asian_percent": "{short_code}3CRM{year}R", # 'college_ready_graduates_math_hispanic_count': 'HCRM', "college_ready_graduates_math_hispanic_percent": "{short_code}HCRM{year}R", # 'college_ready_graduates_math_pacific_islander_count': '4CRM', "college_ready_graduates_math_pacific_islander_percent": "{short_code}4CRM{year}R", # 'college_ready_graduates_math_two_or_more_races_count': '2CRM', "college_ready_graduates_math_two_or_more_races_percent": "{short_code}2CRM{year}R", # 'college_ready_graduates_math_white_count': 'WCRM', "college_ready_graduates_math_white_percent": "{short_code}WCRM{year}R", # 'college_ready_graduates_math_economically_disadvantaged_count': 'ECRM', "college_ready_graduates_math_economically_disadvantaged_percent": "{short_code}ECRM{year}R", # 'college_ready_graduates_math_limited_english_proficient_count': 'LCRM', "college_ready_graduates_math_limited_english_proficient_percent": "{short_code}LCRM{year}R", # 'college_ready_graduates_math_at_risk_count': 'RCRM', "college_ready_graduates_math_at_risk_percent": "{short_code}RCRM{year}R", # 'college_ready_graduates_both_all_students_count': 'ACRB', "college_ready_graduates_both_all_students_percent": "{short_code}ACRB{year}R", # 'college_ready_graduates_both_african_american_count': 'BCRB', "college_ready_graduates_both_african_american_percent": "{short_code}BCRB{year}R", # 'college_ready_graduates_both_asian_count': '3CRB', "college_ready_graduates_both_asian_percent": "{short_code}3CRB{year}R", # 'college_ready_graduates_both_hispanic_count': 'HCRB', "college_ready_graduates_both_hispanic_percent": "{short_code}HCRB{year}R", # 'college_ready_graduates_both_american_indian_count': 'ICRB', "college_ready_graduates_both_american_indian_percent": "{short_code}ICRB{year}R", # 'college_ready_graduates_both_pacific_islander_count': '4CRB', "college_ready_graduates_both_pacific_islander_percent": "{short_code}4CRB{year}R", # 'college_ready_graduates_both_two_or_more_races_count': '2CRB', "college_ready_graduates_both_two_or_more_races_percent": "{short_code}2CRB{year}R", # 'college_ready_graduates_both_white_count': 'WCRB', "college_ready_graduates_both_white_percent": "{short_code}WCRB{year}R", # 'college_ready_graduates_both_economically_disadvantaged_count': 'ECRB', "college_ready_graduates_both_economically_disadvantaged_percent": "{short_code}ECRB{year}R", # 'college_ready_graduates_both_limited_english_proficient_count': 'LCRB', "college_ready_graduates_both_limited_english_proficient_percent": "{short_code}LCRB{year}R", # 'college_ready_graduates_both_at_risk_count': 'RCRB', "college_ready_graduates_both_at_risk_percent": "{short_code}RCRB{year}R", "avg_sat_score_all_students": "{short_code}A0CSA{year}R", "avg_sat_score_african_american": "{short_code}B0CSA{year}R", "avg_sat_score_american_indian": "{short_code}I0CSA{year}R", "avg_sat_score_asian": "{short_code}30CSA{year}R", "avg_sat_score_hispanic": "{short_code}H0CSA{year}R", "avg_sat_score_pacific_islander": "{short_code}40CSA{year}R", "avg_sat_score_two_or_more_races": "{short_code}20CSA{year}R", "avg_sat_score_white": "{short_code}W0CSA{year}R", "avg_sat_score_economically_disadvantaged": "{short_code}E0CSA{year}R", "avg_act_score_all_students": "{short_code}A0CAA{year}R", "avg_act_score_african_american": "{short_code}B0CAA{year}R", "avg_act_score_american_indian": "{short_code}I0CAA{year}R", "avg_act_score_asian": "{short_code}30CAA{year}R", "avg_act_score_hispanic": "{short_code}H0CAA{year}R", "avg_act_score_pacific_islander": "{short_code}40CAA{year}R", "avg_act_score_two_or_more_races": "{short_code}20CAA{year}R", "avg_act_score_white": "{short_code}W0CAA{year}R", "avg_act_score_economically_disadvantaged": "{short_code}E0CAA{year}R", # 'ap_ib_all_students_count_above_criterion': 'A0BKA', "ap_ib_all_students_percent_above_criterion": "{short_code}A0BKA{year}R", # 'ap_ib_african_american_count_above_criterion': 'B0BKA', "ap_ib_african_american_percent_above_criterion": "{short_code}B0BKA{year}R", # 'ap_ib_asian_count_above_criterion': '30BKA', "ap_ib_asian_percent_above_criterion": "{short_code}30BKA{year}R", # 'ap_ib_hispanic_count_above_criterion': 'H0BKA', "ap_ib_hispanic_percent_above_criterion": "{short_code}H0BKA{year}R", # 'ap_ib_american_indian_count_above_criterion': 'I0BKA', "ap_ib_american_indian_percent_above_criterion": "{short_code}I0BKA{year}R", # 'ap_ib_pacific_islander_count_above_criterion': '40BKA', "ap_ib_pacific_islander_percent_above_criterion": "{short_code}40BKA{year}R", # 'ap_ib_two_or_more_races_count_above_criterion': '20BKA', "ap_ib_two_or_more_races_percent_above_criterion": "{short_code}20BKA{year}R", # 'ap_ib_white_count_above_criterion': 'W0BKA', "ap_ib_white_percent_above_criterion": "{short_code}W0BKA{year}R", # 'ap_ib_economically_disadvantaged_count_above_criterion': 'E0BKA', "ap_ib_economically_disadvantaged_percent_above_criterion": "{short_code}E0BKA{year}R", "ap_ib_all_students_percent_taking": "{short_code}A0BTA{year}R", "ap_ib_african_american_percent_taking": "{short_code}B0BTA{year}R", "ap_ib_asian_percent_taking": "{short_code}30BTA{year}R", "ap_ib_hispanic_percent_taking": "{short_code}H0BTA{year}R", "ap_ib_american_indian_percent_taking": "{short_code}I0BTA{year}R", "ap_ib_pacific_islander_percent_taking": "{short_code}40BTA{year}R", "ap_ib_two_or_more_races_percent_taking": "{short_code}20BTA{year}R", "ap_ib_white_percent_taking": "{short_code}W0BTA{year}R", "ap_ib_economically_disadvantaged_percent_taking": "{short_code}E0BTA{year}R", # # 'dropout_all_students_count': 'A0912DR', # 'dropout_all_students_percent': 'A0912DR', # # 'dropout_african_american_count': 'B0912DR', # 'dropout_african_american_percent': 'B0912DR', # # 'dropout_asian_count': '30912DR', # 'dropout_asian_percent': '30912DR', # # 'dropout_hispanic_count': 'H0912DR', # 'dropout_hispanic_percent': 'H0912DR', # # 'dropout_american_indian_count': 'I0912DR', # 'dropout_american_indian_percent': 'I0912DR', # # 'dropout_pacific_islander_count': '40912DR', # 'dropout_pacific_islander_percent': '40912DR', # # 'dropout_two_or_more_races_count': '20912DR', # 'dropout_two_or_more_races_percent': '20912DR', # # 'dropout_white_count': 'W0912DR', # 'dropout_white_percent': 'W0912DR', # # 'dropout_at_risk_count': 'R0912DR', # 'dropout_at_risk_percent': 'R0912DR', # # 'dropout_economically_disadvantaged_count': 'E0912DR', # 'dropout_economically_disadvantaged_percent': 'E0912DR', # # 'dropout_limited_english_proficient_count': 'E0912DR', # 'dropout_limited_english_proficient_percent': 'E0912DR', # # 'four_year_graduate_all_students_count': 'AGC4X', # 'four_year_graduate_all_students_percent': 'AGC4X', # # 'four_year_graduate_african_american_count': 'BGC4X', # 'four_year_graduate_african_american_percent': 'BGC4X', # # 'four_year_graduate_american_indian_count': 'IGC4X', # 'four_year_graduate_american_indian_percent': 'IGC4X', # # 'four_year_graduate_asian_count': '3GC4X', # 'four_year_graduate_asian_percent': '3GC4X', # # 'four_year_graduate_hispanic_count': 'HGC4X', # 'four_year_graduate_hispanic_percent': 'HGC4X', # # 'four_year_graduate_pacific_islander_count': '4GC4X', # 'four_year_graduate_pacific_islander_percent': '4GC4X', # # 'four_year_graduate_two_or_more_races_count': '2GC4X', # 'four_year_graduate_two_or_more_races_percent': '2GC4X', # # 'four_year_graduate_white_count': 'WGC4X', # 'four_year_graduate_white_percent': 'WGC4X', # # 'four_year_graduate_at_risk_count': 'RGC4X', # 'four_year_graduate_at_risk_percent': 'RGC4X', # # 'four_year_graduate_economically_disadvantaged_count': 'EGC4X', # 'four_year_graduate_economically_disadvantaged_percent': 'EGC4X', # # 'four_year_graduate_limited_english_proficient_count': 'L3C4X', # 'four_year_graduate_limited_english_proficient_percent': 'L3C4X', # attendence "attendance_rate": "{short_code}A0AT{year}R", # longitudinal-rate # 'dropout_all_students_count': 'A0912DR', "dropout_all_students_percent": "{short_code}A0912DR{year}R", # 'dropout_african_american_count': 'B0912DR', "dropout_african_american_percent": "{short_code}B0912DR{year}R", # 'dropout_asian_count': '30912DR', "dropout_asian_percent": "{short_code}30912DR{year}R", # 'dropout_hispanic_count': 'H0912DR', "dropout_hispanic_percent": "{short_code}H0912DR{year}R", # 'dropout_american_indian_count': 'I0912DR', "dropout_american_indian_percent": "{short_code}I0912DR{year}R", # 'dropout_pacific_islander_count': '40912DR', "dropout_pacific_islander_percent": "{short_code}40912DR{year}R", # 'dropout_two_or_more_races_count': '20912DR', "dropout_two_or_more_races_percent": "{short_code}20912DR{year}R", # 'dropout_white_count': 'W0912DR', "dropout_white_percent": "{short_code}W0912DR{year}R", # 'dropout_at_risk_count': 'R0912DR', "dropout_at_risk_percent": "{short_code}R0912DR{year}R", # 'dropout_economically_disadvantaged_count': 'E0912DR', "dropout_economically_disadvantaged_percent": "{short_code}E0912DR{year}R", # 'dropout_limited_english_proficient_count': 'E0912DR', "dropout_limited_english_proficient_percent": "{short_code}E0912DR{year}R", # 'four_year_graduate_all_students_count': 'AGC4X', "four_year_graduate_all_students_percent": "{short_code}AGC4{suffix}{year}R", # 'four_year_graduate_african_american_count': 'BGC4X', "four_year_graduate_african_american_percent": "{short_code}BGC4{suffix}{year}R", # 'four_year_graduate_american_indian_count': 'IGC4X', "four_year_graduate_american_indian_percent": "{short_code}IGC4{suffix}{year}R", # 'four_year_graduate_asian_count': '3GC4X', "four_year_graduate_asian_percent": "{short_code}3GC4{suffix}{year}R", # 'four_year_graduate_hispanic_count': 'HGC4X', "four_year_graduate_hispanic_percent": "{short_code}HGC4{suffix}{year}R", # 'four_year_graduate_pacific_islander_count': '4GC4X', "four_year_graduate_pacific_islander_percent": "{short_code}4GC4{suffix}{year}R", # 'four_year_graduate_two_or_more_races_count': '2GC4X', "four_year_graduate_two_or_more_races_percent": "{short_code}2GC4{suffix}{year}R", # 'four_year_graduate_white_count': 'WGC4X', "four_year_graduate_white_percent": "{short_code}WGC4{suffix}{year}R", # 'four_year_graduate_at_risk_count': 'RGC4X', "four_year_graduate_at_risk_percent": "{short_code}RGC4{suffix}{year}R", # 'four_year_graduate_economically_disadvantaged_count': 'EGC4X', "four_year_graduate_economically_disadvantaged_percent": "{short_code}EGC4{suffix}{year}R", # 'four_year_graduate_limited_english_proficient_count': 'L3C4X', "four_year_graduate_limited_english_proficient_percent": "{short_code}L3C4{suffix}{year}R", # reference "accountability_rating": "{short_code}_RATING", # accountability "student_achievement_rating": "{short_code}D1G", "school_progress_rating": "{short_code}D2G", "closing_the_gaps_rating": "{short_code}D3G", }
schema = {'all_students_count': '{short_code}PETALLC', 'african_american_count': '{short_code}PETBLAC', 'african_american_percent': '{short_code}PETBLAP', 'american_indian_count': '{short_code}PETINDC', 'american_indian_percent': '{short_code}PETINDP', 'asian_count': '{short_code}PETASIC', 'asian_percent': '{short_code}PETASIP', 'hispanic_count': '{short_code}PETHISC', 'hispanic_percent': '{short_code}PETHISP', 'pacific_islander_count': '{short_code}PETPCIC', 'pacific_islander_percent': '{short_code}PETPCIP', 'two_or_more_races_count': '{short_code}PETTWOC', 'two_or_more_races_percent': '{short_code}PETTWOP', 'white_count': '{short_code}PETWHIC', 'white_percent': '{short_code}PETWHIP', 'early_childhood_education_count': '{short_code}PETGEEC', 'early_childhood_education_percent': '{short_code}PETGEEP', 'prek_count': '{short_code}PETGPKC', 'prek_percent': '{short_code}PETGPKP', 'kindergarten_count': '{short_code}PETGKNC', 'kindergarten_percent': '{short_code}PETGKNP', 'first_count': '{short_code}PETG01C', 'first_percent': '{short_code}PETG01P', 'second_count': '{short_code}PETG02C', 'second_percent': '{short_code}PETG02P', 'third_count': '{short_code}PETG03C', 'third_percent': '{short_code}PETG03P', 'fourth_count': '{short_code}PETG04C', 'fourth_percent': '{short_code}PETG04P', 'fifth_count': '{short_code}PETG05C', 'fifth_percent': '{short_code}PETG05P', 'sixth_count': '{short_code}PETG06C', 'sixth_percent': '{short_code}PETG06P', 'seventh_count': '{short_code}PETG07C', 'seventh_percent': '{short_code}PETG07P', 'eighth_count': '{short_code}PETG08C', 'eighth_percent': '{short_code}PETG08P', 'ninth_count': '{short_code}PETG09C', 'ninth_percent': '{short_code}PETG09P', 'tenth_count': '{short_code}PETG10C', 'tenth_percent': '{short_code}PETG10P', 'eleventh_count': '{short_code}PETG11C', 'eleventh_percent': '{short_code}PETG11P', 'twelfth_count': '{short_code}PETG12C', 'twelfth_percent': '{short_code}PETG12P', 'at_risk_count': '{short_code}PETRSKC', 'at_risk_percent': '{short_code}PETRSKP', 'economically_disadvantaged_count': '{short_code}PETECOC', 'economically_disadvantaged_percent': '{short_code}PETECOP', 'limited_english_proficient_count': '{short_code}PETLEPC', 'limited_english_proficient_percent': '{short_code}PETLEPP', 'bilingual_esl_count': '{short_code}PETBILC', 'bilingual_esl_percent': '{short_code}PETBILP', 'career_technical_education_count': '{short_code}PETVOCC', 'career_technical_education_percent': '{short_code}PETVOCP', 'gifted_and_talented_count': '{short_code}PETGIFC', 'gifted_and_talented_percent': '{short_code}PETGIFP', 'special_education_count': '{short_code}PETSPEC', 'special_education_percent': '{short_code}PETSPEP', 'class_size_avg_kindergarten': '{short_code}PCTGKGA', 'class_size_avg_first': '{short_code}PCTG01A', 'class_size_avg_second': '{short_code}PCTG02A', 'class_size_avg_third': '{short_code}PCTG03A', 'class_size_avg_fourth': '{short_code}PCTG04A', 'class_size_avg_fifth': '{short_code}PCTG05A', 'class_size_avg_sixth': '{short_code}PCTG06A', 'class_size_avg_mixed_elementary': '{short_code}PCTGMEA', 'class_size_avg_secondary_english': '{short_code}PCTENGA', 'class_size_avg_secondary_foreign_language': '{short_code}PCTFLAA', 'class_size_avg_secondary_math': '{short_code}PCTMATA', 'class_size_avg_secondary_science': '{short_code}PCTSCIA', 'class_size_avg_secondary_social_studies': '{short_code}PCTSOCA', 'students_per_teacher': '{short_code}PSTKIDR', 'teacher_avg_tenure': '{short_code}PSTTENA', 'teacher_avg_experience': '{short_code}PSTEXPA', 'teacher_avg_base_salary': '{short_code}PSTTOSA', 'teacher_avg_beginning_salary': '{short_code}PST00SA', 'teacher_avg_1_to_5_year_salary': '{short_code}PST01SA', 'teacher_avg_6_to_10_year_salary': '{short_code}PST06SA', 'teacher_avg_11_to_20_year_salary': '{short_code}PST11SA', 'teacher_avg_20_plus_year_salary': '{short_code}PST20SA', 'teacher_total_fte_count': '{short_code}PSTTOFC', 'teacher_african_american_fte_count': '{short_code}PSTBLFC', 'teacher_american_indian_fte_count': '{short_code}PSTINFC', 'teacher_asian_fte_count': '{short_code}PSTASFC', 'teacher_hispanic_fte_count': '{short_code}PSTHIFC', 'teacher_pacific_islander_fte_count': '{short_code}PSTPIFC', 'teacher_two_or_more_races_fte_count': '{short_code}PSTTWFC', 'teacher_white_fte_count': '{short_code}PSTWHFC', 'teacher_total_fte_percent': '{short_code}PSTTOFC', 'teacher_african_american_fte_percent': '{short_code}PSTBLFP', 'teacher_american_indian_fte_percent': '{short_code}PSTINFP', 'teacher_asian_fte_percent': '{short_code}PSTASFP', 'teacher_hispanic_fte_percent': '{short_code}PSTHIFP', 'teacher_pacific_islander_fte_percent': '{short_code}PSTPIFP', 'teacher_two_or_more_races_fte_percent': '{short_code}PSTTWFP', 'teacher_white_fte_percent': '{short_code}PSTWHFP', 'teacher_no_degree_count': '{short_code}PSTNOFC', 'teacher_bachelors_count': '{short_code}PSTBAFC', 'teacher_masters_count': '{short_code}PSTMSFC', 'teacher_doctorate_count': '{short_code}PSTPHFC', 'teacher_no_degree_percent': '{short_code}PSTNOFP', 'teacher_bachelors_percent': '{short_code}PSTBAFP', 'teacher_masters_percent': '{short_code}PSTMSFP', 'teacher_doctorate_percent': '{short_code}PSTPHFP', 'college_ready_graduates_english_all_students_percent': '{short_code}ACRR{year}R', 'college_ready_graduates_english_african_american_percent': '{short_code}BCRR{year}R', 'college_ready_graduates_english_american_indian_percent': '{short_code}ICRR{year}R', 'college_ready_graduates_english_asian_percent': '{short_code}3CRR{year}R', 'college_ready_graduates_english_hispanic_percent': '{short_code}HCRR{year}R', 'college_ready_graduates_english_pacific_islander_percent': '{short_code}4CRR{year}R', 'college_ready_graduates_english_two_or_more_races_percent': '{short_code}2CRR{year}R', 'college_ready_graduates_english_white_percent': '{short_code}WCRR{year}R', 'college_ready_graduates_english_economically_disadvantaged_percent': '{short_code}ECRR{year}R', 'college_ready_graduates_english_limited_english_proficient_percent': '{short_code}LCRR{year}R', 'college_ready_graduates_english_at_risk_percent': '{short_code}RCRR{year}R', 'college_ready_graduates_math_all_students_percent': '{short_code}ACRM{year}R', 'college_ready_graduates_math_african_american_percent': '{short_code}BCRM{year}R', 'college_ready_graduates_math_american_indian_percent': '{short_code}ICRM{year}R', 'college_ready_graduates_math_asian_percent': '{short_code}3CRM{year}R', 'college_ready_graduates_math_hispanic_percent': '{short_code}HCRM{year}R', 'college_ready_graduates_math_pacific_islander_percent': '{short_code}4CRM{year}R', 'college_ready_graduates_math_two_or_more_races_percent': '{short_code}2CRM{year}R', 'college_ready_graduates_math_white_percent': '{short_code}WCRM{year}R', 'college_ready_graduates_math_economically_disadvantaged_percent': '{short_code}ECRM{year}R', 'college_ready_graduates_math_limited_english_proficient_percent': '{short_code}LCRM{year}R', 'college_ready_graduates_math_at_risk_percent': '{short_code}RCRM{year}R', 'college_ready_graduates_both_all_students_percent': '{short_code}ACRB{year}R', 'college_ready_graduates_both_african_american_percent': '{short_code}BCRB{year}R', 'college_ready_graduates_both_asian_percent': '{short_code}3CRB{year}R', 'college_ready_graduates_both_hispanic_percent': '{short_code}HCRB{year}R', 'college_ready_graduates_both_american_indian_percent': '{short_code}ICRB{year}R', 'college_ready_graduates_both_pacific_islander_percent': '{short_code}4CRB{year}R', 'college_ready_graduates_both_two_or_more_races_percent': '{short_code}2CRB{year}R', 'college_ready_graduates_both_white_percent': '{short_code}WCRB{year}R', 'college_ready_graduates_both_economically_disadvantaged_percent': '{short_code}ECRB{year}R', 'college_ready_graduates_both_limited_english_proficient_percent': '{short_code}LCRB{year}R', 'college_ready_graduates_both_at_risk_percent': '{short_code}RCRB{year}R', 'avg_sat_score_all_students': '{short_code}A0CSA{year}R', 'avg_sat_score_african_american': '{short_code}B0CSA{year}R', 'avg_sat_score_american_indian': '{short_code}I0CSA{year}R', 'avg_sat_score_asian': '{short_code}30CSA{year}R', 'avg_sat_score_hispanic': '{short_code}H0CSA{year}R', 'avg_sat_score_pacific_islander': '{short_code}40CSA{year}R', 'avg_sat_score_two_or_more_races': '{short_code}20CSA{year}R', 'avg_sat_score_white': '{short_code}W0CSA{year}R', 'avg_sat_score_economically_disadvantaged': '{short_code}E0CSA{year}R', 'avg_act_score_all_students': '{short_code}A0CAA{year}R', 'avg_act_score_african_american': '{short_code}B0CAA{year}R', 'avg_act_score_american_indian': '{short_code}I0CAA{year}R', 'avg_act_score_asian': '{short_code}30CAA{year}R', 'avg_act_score_hispanic': '{short_code}H0CAA{year}R', 'avg_act_score_pacific_islander': '{short_code}40CAA{year}R', 'avg_act_score_two_or_more_races': '{short_code}20CAA{year}R', 'avg_act_score_white': '{short_code}W0CAA{year}R', 'avg_act_score_economically_disadvantaged': '{short_code}E0CAA{year}R', 'ap_ib_all_students_percent_above_criterion': '{short_code}A0BKA{year}R', 'ap_ib_african_american_percent_above_criterion': '{short_code}B0BKA{year}R', 'ap_ib_asian_percent_above_criterion': '{short_code}30BKA{year}R', 'ap_ib_hispanic_percent_above_criterion': '{short_code}H0BKA{year}R', 'ap_ib_american_indian_percent_above_criterion': '{short_code}I0BKA{year}R', 'ap_ib_pacific_islander_percent_above_criterion': '{short_code}40BKA{year}R', 'ap_ib_two_or_more_races_percent_above_criterion': '{short_code}20BKA{year}R', 'ap_ib_white_percent_above_criterion': '{short_code}W0BKA{year}R', 'ap_ib_economically_disadvantaged_percent_above_criterion': '{short_code}E0BKA{year}R', 'ap_ib_all_students_percent_taking': '{short_code}A0BTA{year}R', 'ap_ib_african_american_percent_taking': '{short_code}B0BTA{year}R', 'ap_ib_asian_percent_taking': '{short_code}30BTA{year}R', 'ap_ib_hispanic_percent_taking': '{short_code}H0BTA{year}R', 'ap_ib_american_indian_percent_taking': '{short_code}I0BTA{year}R', 'ap_ib_pacific_islander_percent_taking': '{short_code}40BTA{year}R', 'ap_ib_two_or_more_races_percent_taking': '{short_code}20BTA{year}R', 'ap_ib_white_percent_taking': '{short_code}W0BTA{year}R', 'ap_ib_economically_disadvantaged_percent_taking': '{short_code}E0BTA{year}R', 'attendance_rate': '{short_code}A0AT{year}R', 'dropout_all_students_percent': '{short_code}A0912DR{year}R', 'dropout_african_american_percent': '{short_code}B0912DR{year}R', 'dropout_asian_percent': '{short_code}30912DR{year}R', 'dropout_hispanic_percent': '{short_code}H0912DR{year}R', 'dropout_american_indian_percent': '{short_code}I0912DR{year}R', 'dropout_pacific_islander_percent': '{short_code}40912DR{year}R', 'dropout_two_or_more_races_percent': '{short_code}20912DR{year}R', 'dropout_white_percent': '{short_code}W0912DR{year}R', 'dropout_at_risk_percent': '{short_code}R0912DR{year}R', 'dropout_economically_disadvantaged_percent': '{short_code}E0912DR{year}R', 'dropout_limited_english_proficient_percent': '{short_code}E0912DR{year}R', 'four_year_graduate_all_students_percent': '{short_code}AGC4{suffix}{year}R', 'four_year_graduate_african_american_percent': '{short_code}BGC4{suffix}{year}R', 'four_year_graduate_american_indian_percent': '{short_code}IGC4{suffix}{year}R', 'four_year_graduate_asian_percent': '{short_code}3GC4{suffix}{year}R', 'four_year_graduate_hispanic_percent': '{short_code}HGC4{suffix}{year}R', 'four_year_graduate_pacific_islander_percent': '{short_code}4GC4{suffix}{year}R', 'four_year_graduate_two_or_more_races_percent': '{short_code}2GC4{suffix}{year}R', 'four_year_graduate_white_percent': '{short_code}WGC4{suffix}{year}R', 'four_year_graduate_at_risk_percent': '{short_code}RGC4{suffix}{year}R', 'four_year_graduate_economically_disadvantaged_percent': '{short_code}EGC4{suffix}{year}R', 'four_year_graduate_limited_english_proficient_percent': '{short_code}L3C4{suffix}{year}R', 'accountability_rating': '{short_code}_RATING', 'student_achievement_rating': '{short_code}D1G', 'school_progress_rating': '{short_code}D2G', 'closing_the_gaps_rating': '{short_code}D3G'}
# This problem was asked by Facebook. # Given an array of numbers representing the stock prices of a company in chronological # order and an integer k, return the maximum profit you can make from k buys and sells. # You must buy the stock before you can sell it, and you must sell the stock before you can buy it again. # For example, given k = 2 and the array [5, 2, 4, 0, 1], you should return 3. #### def get_max_profit(arr, k): a = arr + [-1] current_min = a[0] current_max = a[0] ends = [] # generate profit intervals # current_max == current_min denotes that the buying price was set during # the immediately previous loop (selling price not discovered yet) for i in range(1, len(a)): # more profit possible if a[i] > current_max: current_max = a[i] # the beginning of the next interval is found if a[i] < current_max and current_max != current_min: ends.append((current_min, current_max)) current_max = a[i] current_min = a[i] # buying cost is strictly decreasing (to calculate cheapest buying price) if a[i] < current_min and current_max == current_min: current_min = a[i] current_max = a[i] # merge smallest intervals to make number of intervals = k while k < len(ends): # get smallest interval pos, cur = min(list(enumerate(ends)), key = lambda x: x[1][1] - x[1][0]) # try merging with lower interval if pos != 0: lower = ends[pos-1] if cur[1] > lower[1]: ends[pos-1] = (lower[0], cur[1]) # try merging with upper interval if pos != len(ends)-1: upper = ends[pos+1] if cur[0] < upper[0]: ends[pos+1] = (cur[0], upper[1]) ends.remove(cur) return sum([y-x for x,y in ends]) #### print(get_max_profit([7, 9, 8, 11, 11, 10, 12, 15, 13, 10], 2))
def get_max_profit(arr, k): a = arr + [-1] current_min = a[0] current_max = a[0] ends = [] for i in range(1, len(a)): if a[i] > current_max: current_max = a[i] if a[i] < current_max and current_max != current_min: ends.append((current_min, current_max)) current_max = a[i] current_min = a[i] if a[i] < current_min and current_max == current_min: current_min = a[i] current_max = a[i] while k < len(ends): (pos, cur) = min(list(enumerate(ends)), key=lambda x: x[1][1] - x[1][0]) if pos != 0: lower = ends[pos - 1] if cur[1] > lower[1]: ends[pos - 1] = (lower[0], cur[1]) if pos != len(ends) - 1: upper = ends[pos + 1] if cur[0] < upper[0]: ends[pos + 1] = (cur[0], upper[1]) ends.remove(cur) return sum([y - x for (x, y) in ends]) print(get_max_profit([7, 9, 8, 11, 11, 10, 12, 15, 13, 10], 2))
def file_html(fname): fptr=open(fname,"r") to_send = "" for lines in fptr: to_send += lines; return to_send #file_html("myfile.html");
def file_html(fname): fptr = open(fname, 'r') to_send = '' for lines in fptr: to_send += lines return to_send
md = [0,0] facing = "E" def rotate(cw, val): idx = 4 + cw * int((val/90) % 4) mv = ['E','S','W','N'] c = mv.index(facing) return mv[(idx + c) % 4] def move(dr, val): global ew global ns global facing if dr == 'N': md[1] += val elif dr == 'S': md[1] -= val elif dr == 'E': md[0] += val elif dr == 'W': md[0] -= val elif dr == 'L': facing = rotate(-1,val) elif dr == 'R': facing = rotate(+1,val) elif dr == 'F': move(facing,val) ############################## for l in open("input.txt"): move(list(l)[0], int(''.join(list(l.strip())[1:]))) print("Manhattan distance =", abs(md[0]) + abs(md[1]))
md = [0, 0] facing = 'E' def rotate(cw, val): idx = 4 + cw * int(val / 90 % 4) mv = ['E', 'S', 'W', 'N'] c = mv.index(facing) return mv[(idx + c) % 4] def move(dr, val): global ew global ns global facing if dr == 'N': md[1] += val elif dr == 'S': md[1] -= val elif dr == 'E': md[0] += val elif dr == 'W': md[0] -= val elif dr == 'L': facing = rotate(-1, val) elif dr == 'R': facing = rotate(+1, val) elif dr == 'F': move(facing, val) for l in open('input.txt'): move(list(l)[0], int(''.join(list(l.strip())[1:]))) print('Manhattan distance =', abs(md[0]) + abs(md[1]))
for _ in range(int(input())): n,x = map(int,input().split()) l = list(map(int,input().split())) flag=2 if len(set(l)) == 1 and l[0] == x: flag=0 elif x in l or sum([i-x for i in l])==0: flag=1 if flag==0: print(0) elif flag==1: print(1) else: print(2)
for _ in range(int(input())): (n, x) = map(int, input().split()) l = list(map(int, input().split())) flag = 2 if len(set(l)) == 1 and l[0] == x: flag = 0 elif x in l or sum([i - x for i in l]) == 0: flag = 1 if flag == 0: print(0) elif flag == 1: print(1) else: print(2)
#!/usr/bin/env python # configure these settings to change projector behavior server_mount_path = '//192.168.42.11/PiShare' # shared folder on other pi user_name = 'pi' # shared drive login user name user_password = 'raspberry' # shared drive login password client_mount_path = '/mnt/pishare' # where to find the shared folder on this pi pics_folder = '/mnt/pishare/pics' # where to find the pics to display waittime = 2 # default time to wait between images (in seconds) use_prime = True # Set to true to show the prime slide, false if otherwise prime_slide = '/home/pi/photobooth/projector.png' # image to show regularly in slideshow prime_freq = 16 # how many pics to show before showing the prime slide again monitor_w = 800 # width in pixels of display (monitor or projector) monitor_h = 600 # height in pixels of display (monitor or projector) title = "SlideShow" # caption of the window...
server_mount_path = '//192.168.42.11/PiShare' user_name = 'pi' user_password = 'raspberry' client_mount_path = '/mnt/pishare' pics_folder = '/mnt/pishare/pics' waittime = 2 use_prime = True prime_slide = '/home/pi/photobooth/projector.png' prime_freq = 16 monitor_w = 800 monitor_h = 600 title = 'SlideShow'
data = ( 'E ', # 0x00 'Cheng ', # 0x01 'Xin ', # 0x02 'Ai ', # 0x03 'Lu ', # 0x04 'Zhui ', # 0x05 'Zhou ', # 0x06 'She ', # 0x07 'Pian ', # 0x08 'Kun ', # 0x09 'Tao ', # 0x0a 'Lai ', # 0x0b 'Zong ', # 0x0c 'Ke ', # 0x0d 'Qi ', # 0x0e 'Qi ', # 0x0f 'Yan ', # 0x10 'Fei ', # 0x11 'Sao ', # 0x12 'Yan ', # 0x13 'Jie ', # 0x14 'Yao ', # 0x15 'Wu ', # 0x16 'Pian ', # 0x17 'Cong ', # 0x18 'Pian ', # 0x19 'Qian ', # 0x1a 'Fei ', # 0x1b 'Huang ', # 0x1c 'Jian ', # 0x1d 'Huo ', # 0x1e 'Yu ', # 0x1f 'Ti ', # 0x20 'Quan ', # 0x21 'Xia ', # 0x22 'Zong ', # 0x23 'Kui ', # 0x24 'Rou ', # 0x25 'Si ', # 0x26 'Gua ', # 0x27 'Tuo ', # 0x28 'Kui ', # 0x29 'Sou ', # 0x2a 'Qian ', # 0x2b 'Cheng ', # 0x2c 'Zhi ', # 0x2d 'Liu ', # 0x2e 'Pang ', # 0x2f 'Teng ', # 0x30 'Xi ', # 0x31 'Cao ', # 0x32 'Du ', # 0x33 'Yan ', # 0x34 'Yuan ', # 0x35 'Zou ', # 0x36 'Sao ', # 0x37 'Shan ', # 0x38 'Li ', # 0x39 'Zhi ', # 0x3a 'Shuang ', # 0x3b 'Lu ', # 0x3c 'Xi ', # 0x3d 'Luo ', # 0x3e 'Zhang ', # 0x3f 'Mo ', # 0x40 'Ao ', # 0x41 'Can ', # 0x42 'Piao ', # 0x43 'Cong ', # 0x44 'Qu ', # 0x45 'Bi ', # 0x46 'Zhi ', # 0x47 'Yu ', # 0x48 'Xu ', # 0x49 'Hua ', # 0x4a 'Bo ', # 0x4b 'Su ', # 0x4c 'Xiao ', # 0x4d 'Lin ', # 0x4e 'Chan ', # 0x4f 'Dun ', # 0x50 'Liu ', # 0x51 'Tuo ', # 0x52 'Zeng ', # 0x53 'Tan ', # 0x54 'Jiao ', # 0x55 'Tie ', # 0x56 'Yan ', # 0x57 'Luo ', # 0x58 'Zhan ', # 0x59 'Jing ', # 0x5a 'Yi ', # 0x5b 'Ye ', # 0x5c 'Tuo ', # 0x5d 'Bin ', # 0x5e 'Zou ', # 0x5f 'Yan ', # 0x60 'Peng ', # 0x61 'Lu ', # 0x62 'Teng ', # 0x63 'Xiang ', # 0x64 'Ji ', # 0x65 'Shuang ', # 0x66 'Ju ', # 0x67 'Xi ', # 0x68 'Huan ', # 0x69 'Li ', # 0x6a 'Biao ', # 0x6b 'Ma ', # 0x6c 'Yu ', # 0x6d 'Tuo ', # 0x6e 'Xun ', # 0x6f 'Chi ', # 0x70 'Qu ', # 0x71 'Ri ', # 0x72 'Bo ', # 0x73 'Lu ', # 0x74 'Zang ', # 0x75 'Shi ', # 0x76 'Si ', # 0x77 'Fu ', # 0x78 'Ju ', # 0x79 'Zou ', # 0x7a 'Zhu ', # 0x7b 'Tuo ', # 0x7c 'Nu ', # 0x7d 'Jia ', # 0x7e 'Yi ', # 0x7f 'Tai ', # 0x80 'Xiao ', # 0x81 'Ma ', # 0x82 'Yin ', # 0x83 'Jiao ', # 0x84 'Hua ', # 0x85 'Luo ', # 0x86 'Hai ', # 0x87 'Pian ', # 0x88 'Biao ', # 0x89 'Li ', # 0x8a 'Cheng ', # 0x8b 'Yan ', # 0x8c 'Xin ', # 0x8d 'Qin ', # 0x8e 'Jun ', # 0x8f 'Qi ', # 0x90 'Qi ', # 0x91 'Ke ', # 0x92 'Zhui ', # 0x93 'Zong ', # 0x94 'Su ', # 0x95 'Can ', # 0x96 'Pian ', # 0x97 'Zhi ', # 0x98 'Kui ', # 0x99 'Sao ', # 0x9a 'Wu ', # 0x9b 'Ao ', # 0x9c 'Liu ', # 0x9d 'Qian ', # 0x9e 'Shan ', # 0x9f 'Piao ', # 0xa0 'Luo ', # 0xa1 'Cong ', # 0xa2 'Chan ', # 0xa3 'Zou ', # 0xa4 'Ji ', # 0xa5 'Shuang ', # 0xa6 'Xiang ', # 0xa7 'Gu ', # 0xa8 'Wei ', # 0xa9 'Wei ', # 0xaa 'Wei ', # 0xab 'Yu ', # 0xac 'Gan ', # 0xad 'Yi ', # 0xae 'Ang ', # 0xaf 'Tou ', # 0xb0 'Xie ', # 0xb1 'Bao ', # 0xb2 'Bi ', # 0xb3 'Chi ', # 0xb4 'Ti ', # 0xb5 'Di ', # 0xb6 'Ku ', # 0xb7 'Hai ', # 0xb8 'Qiao ', # 0xb9 'Gou ', # 0xba 'Kua ', # 0xbb 'Ge ', # 0xbc 'Tui ', # 0xbd 'Geng ', # 0xbe 'Pian ', # 0xbf 'Bi ', # 0xc0 'Ke ', # 0xc1 'Ka ', # 0xc2 'Yu ', # 0xc3 'Sui ', # 0xc4 'Lou ', # 0xc5 'Bo ', # 0xc6 'Xiao ', # 0xc7 'Pang ', # 0xc8 'Bo ', # 0xc9 'Ci ', # 0xca 'Kuan ', # 0xcb 'Bin ', # 0xcc 'Mo ', # 0xcd 'Liao ', # 0xce 'Lou ', # 0xcf 'Nao ', # 0xd0 'Du ', # 0xd1 'Zang ', # 0xd2 'Sui ', # 0xd3 'Ti ', # 0xd4 'Bin ', # 0xd5 'Kuan ', # 0xd6 'Lu ', # 0xd7 'Gao ', # 0xd8 'Gao ', # 0xd9 'Qiao ', # 0xda 'Kao ', # 0xdb 'Qiao ', # 0xdc 'Lao ', # 0xdd 'Zao ', # 0xde 'Biao ', # 0xdf 'Kun ', # 0xe0 'Kun ', # 0xe1 'Ti ', # 0xe2 'Fang ', # 0xe3 'Xiu ', # 0xe4 'Ran ', # 0xe5 'Mao ', # 0xe6 'Dan ', # 0xe7 'Kun ', # 0xe8 'Bin ', # 0xe9 'Fa ', # 0xea 'Tiao ', # 0xeb 'Peng ', # 0xec 'Zi ', # 0xed 'Fa ', # 0xee 'Ran ', # 0xef 'Ti ', # 0xf0 'Pao ', # 0xf1 'Pi ', # 0xf2 'Mao ', # 0xf3 'Fu ', # 0xf4 'Er ', # 0xf5 'Rong ', # 0xf6 'Qu ', # 0xf7 'Gong ', # 0xf8 'Xiu ', # 0xf9 'Gua ', # 0xfa 'Ji ', # 0xfb 'Peng ', # 0xfc 'Zhua ', # 0xfd 'Shao ', # 0xfe 'Sha ', # 0xff )
data = ('E ', 'Cheng ', 'Xin ', 'Ai ', 'Lu ', 'Zhui ', 'Zhou ', 'She ', 'Pian ', 'Kun ', 'Tao ', 'Lai ', 'Zong ', 'Ke ', 'Qi ', 'Qi ', 'Yan ', 'Fei ', 'Sao ', 'Yan ', 'Jie ', 'Yao ', 'Wu ', 'Pian ', 'Cong ', 'Pian ', 'Qian ', 'Fei ', 'Huang ', 'Jian ', 'Huo ', 'Yu ', 'Ti ', 'Quan ', 'Xia ', 'Zong ', 'Kui ', 'Rou ', 'Si ', 'Gua ', 'Tuo ', 'Kui ', 'Sou ', 'Qian ', 'Cheng ', 'Zhi ', 'Liu ', 'Pang ', 'Teng ', 'Xi ', 'Cao ', 'Du ', 'Yan ', 'Yuan ', 'Zou ', 'Sao ', 'Shan ', 'Li ', 'Zhi ', 'Shuang ', 'Lu ', 'Xi ', 'Luo ', 'Zhang ', 'Mo ', 'Ao ', 'Can ', 'Piao ', 'Cong ', 'Qu ', 'Bi ', 'Zhi ', 'Yu ', 'Xu ', 'Hua ', 'Bo ', 'Su ', 'Xiao ', 'Lin ', 'Chan ', 'Dun ', 'Liu ', 'Tuo ', 'Zeng ', 'Tan ', 'Jiao ', 'Tie ', 'Yan ', 'Luo ', 'Zhan ', 'Jing ', 'Yi ', 'Ye ', 'Tuo ', 'Bin ', 'Zou ', 'Yan ', 'Peng ', 'Lu ', 'Teng ', 'Xiang ', 'Ji ', 'Shuang ', 'Ju ', 'Xi ', 'Huan ', 'Li ', 'Biao ', 'Ma ', 'Yu ', 'Tuo ', 'Xun ', 'Chi ', 'Qu ', 'Ri ', 'Bo ', 'Lu ', 'Zang ', 'Shi ', 'Si ', 'Fu ', 'Ju ', 'Zou ', 'Zhu ', 'Tuo ', 'Nu ', 'Jia ', 'Yi ', 'Tai ', 'Xiao ', 'Ma ', 'Yin ', 'Jiao ', 'Hua ', 'Luo ', 'Hai ', 'Pian ', 'Biao ', 'Li ', 'Cheng ', 'Yan ', 'Xin ', 'Qin ', 'Jun ', 'Qi ', 'Qi ', 'Ke ', 'Zhui ', 'Zong ', 'Su ', 'Can ', 'Pian ', 'Zhi ', 'Kui ', 'Sao ', 'Wu ', 'Ao ', 'Liu ', 'Qian ', 'Shan ', 'Piao ', 'Luo ', 'Cong ', 'Chan ', 'Zou ', 'Ji ', 'Shuang ', 'Xiang ', 'Gu ', 'Wei ', 'Wei ', 'Wei ', 'Yu ', 'Gan ', 'Yi ', 'Ang ', 'Tou ', 'Xie ', 'Bao ', 'Bi ', 'Chi ', 'Ti ', 'Di ', 'Ku ', 'Hai ', 'Qiao ', 'Gou ', 'Kua ', 'Ge ', 'Tui ', 'Geng ', 'Pian ', 'Bi ', 'Ke ', 'Ka ', 'Yu ', 'Sui ', 'Lou ', 'Bo ', 'Xiao ', 'Pang ', 'Bo ', 'Ci ', 'Kuan ', 'Bin ', 'Mo ', 'Liao ', 'Lou ', 'Nao ', 'Du ', 'Zang ', 'Sui ', 'Ti ', 'Bin ', 'Kuan ', 'Lu ', 'Gao ', 'Gao ', 'Qiao ', 'Kao ', 'Qiao ', 'Lao ', 'Zao ', 'Biao ', 'Kun ', 'Kun ', 'Ti ', 'Fang ', 'Xiu ', 'Ran ', 'Mao ', 'Dan ', 'Kun ', 'Bin ', 'Fa ', 'Tiao ', 'Peng ', 'Zi ', 'Fa ', 'Ran ', 'Ti ', 'Pao ', 'Pi ', 'Mao ', 'Fu ', 'Er ', 'Rong ', 'Qu ', 'Gong ', 'Xiu ', 'Gua ', 'Ji ', 'Peng ', 'Zhua ', 'Shao ', 'Sha ')
def remove_duplicated_keep_order(value_in_tuple): new_tuple = [] for i in value_in_tuple: if not (i in new_tuple): new_tuple.append(i) return new_tuple # return tuple(set(value_in_tuple))
def remove_duplicated_keep_order(value_in_tuple): new_tuple = [] for i in value_in_tuple: if not i in new_tuple: new_tuple.append(i) return new_tuple
# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): return { _ASTROPY_PACKAGE_NAME_ + '.tests': ['coveragerc', 'data/*.hdr'] # noqa }
def get_package_data(): return {_ASTROPY_PACKAGE_NAME_ + '.tests': ['coveragerc', 'data/*.hdr']}
exp.set('total_responses', 0) exp.set('total_correct', 0) exp.set('total_response_time', 0) exp.set('average_response_time', 'NA') exp.set('avg_rt', 'NA') exp.set('accuracy', 'NA') exp.set('acc', 'NA')
exp.set('total_responses', 0) exp.set('total_correct', 0) exp.set('total_response_time', 0) exp.set('average_response_time', 'NA') exp.set('avg_rt', 'NA') exp.set('accuracy', 'NA') exp.set('acc', 'NA')
def exception_test(assert_check_fn): try: def exception_wrapper(*arg, **kwarg): assert_check_fn(*arg, **kwarg) except Exception as e: pytest.failed(e)
def exception_test(assert_check_fn): try: def exception_wrapper(*arg, **kwarg): assert_check_fn(*arg, **kwarg) except Exception as e: pytest.failed(e)
def green(text): return f"\033[92m{text}\033[0m" def yellow(text): return f"\033[93m{text}\033[0m"
def green(text): return f'\x1b[92m{text}\x1b[0m' def yellow(text): return f'\x1b[93m{text}\x1b[0m'
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...', 'C':'-.-.', 'D':'-..', 'E':'.', 'F':'..-.', 'G':'--.', 'H':'....', 'I':'..', 'J':'.---', 'K':'-.-', 'L':'.-..', 'M':'--', 'N':'-.', 'O':'---', 'P':'.--.', 'Q':'--.-', 'R':'.-.', 'S':'...', 'T':'-', 'U':'..-', 'V':'...-', 'W':'.--', 'X':'-..-', 'Y':'-.--', 'Z':'--..', '1':'.----', '2':'..---', '3':'...--', '4':'....-', '5':'.....', '6':'-....', '7':'--...', '8':'---..', '9':'----.', '0':'-----', ', ':'--..--', '.':'.-.-.-', '?':'..--..', '/':'-..-.', '-':'-....-', '(':'-.--.', ')':'-.--.-'} # Function to encrypt the string # according to the morse code chart def encrypt(message): cipher = '' for letter in message: if letter != ' ': # Looks up the dictionary and adds the # correspponding morse code # along with a space to separate # morse codes for different characters cipher += MORSE_CODE_DICT[letter] + ' ' else: # 1 space indicates different characters # and 2 indicates different words cipher += ' ' return cipher # Hard-coded driver function to run the program def main(): message = input("Enter a Word or Phrase") result = encrypt(message.upper()) print (result) # Executes the main function if __name__ == '__main__': main()
morse_code_dict = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--', 'Z': '--..', '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', '6': '-....', '7': '--...', '8': '---..', '9': '----.', '0': '-----', ', ': '--..--', '.': '.-.-.-', '?': '..--..', '/': '-..-.', '-': '-....-', '(': '-.--.', ')': '-.--.-'} def encrypt(message): cipher = '' for letter in message: if letter != ' ': cipher += MORSE_CODE_DICT[letter] + ' ' else: cipher += ' ' return cipher def main(): message = input('Enter a Word or Phrase') result = encrypt(message.upper()) print(result) if __name__ == '__main__': main()
# -*- coding: utf-8 -*- class MyClass: # The __init__ method doesn't return anything, so it gets return # type None just like any other method that doesn't return anything. def __init__(self) -> None: ... # For instance methods, omit `self`. def my_class_method(self, num: int, str1: str) -> str: return num * str1 # User-defined classes are written with just their own names. x = MyClass() # type: MyClass
class Myclass: def __init__(self) -> None: ... def my_class_method(self, num: int, str1: str) -> str: return num * str1 x = my_class()
expected_output = { "bridge_group": { "D": { "bridge_domain": { "D-w": { "ac": { "num_ac": 1, "num_ac_up": 1 }, "id": 0, "pbb": { "num_pbb": 0, "num_pbb_up": 0 }, "pw": { "num_pw": 1, "num_pw_up": 1 }, "state": "up", "vni": { "num_vni": 0, "num_vni_up": 0 } } } }, "GO-LEAFS": { "bridge_domain": { "GO": { "ac": { "num_ac": 3, "num_ac_up": 2 }, "id": 9, "pbb": { "num_pbb": 0, "num_pbb_up": 0 }, "pw": { "num_pw": 7, "num_pw_up": 5 }, "state": "up", "vni": { "num_vni": 0, "num_vni_up": 0 } } } }, "MGMT": { "bridge_domain": { "DSL-MGMT": { "ac": { "num_ac": 1, "num_ac_up": 0 }, "id": 2, "pbb": { "num_pbb": 0, "num_pbb_up": 0 }, "pw": { "num_pw": 0, "num_pw_up": 0 }, "state": "up", "vni": { "num_vni": 0, "num_vni_up": 0 } } } }, "WOrd": { "bridge_domain": { "CODE-123-4567": { "ac": { "num_ac": 1, "num_ac_up": 0 }, "id": 3, "pbb": { "num_pbb": 0, "num_pbb_up": 0 }, "pw": { "num_pw": 1, "num_pw_up": 0 }, "state": "up", "vni": { "num_vni": 0, "num_vni_up": 0 } } } }, "admin1": { "bridge_domain": { "domain1": { "ac": { "num_ac": 1, "num_ac_up": 0 }, "id": 6, "pbb": { "num_pbb": 0, "num_pbb_up": 0 }, "pw": { "num_pw": 1, "num_pw_up": 0 }, "state": "admin down", "vni": { "num_vni": 0, "num_vni_up": 0 } } } }, "d": { "bridge_domain": { "s-VLAN_20": { "ac": { "num_ac": 2, "num_ac_up": 2 }, "id": 1, "pbb": { "num_pbb": 0, "num_pbb_up": 0 }, "pw": { "num_pw": 1, "num_pw_up": 1 }, "state": "up", "vni": { "num_vni": 0, "num_vni_up": 0 } } } }, "g1": { "bridge_domain": { "bd1": { "ac": { "num_ac": 1, "num_ac_up": 1 }, "id": 0, "pw": { "num_pw": 1, "num_pw_up": 1 }, "state": "up" } } }, "woRD": { "bridge_domain": { "THING_PLACE_DIA-765_4321": { "ac": { "num_ac": 1, "num_ac_up": 1 }, "id": 4, "pbb": { "num_pbb": 0, "num_pbb_up": 0 }, "pw": { "num_pw": 1, "num_pw_up": 1 }, "state": "up", "vni": { "num_vni": 0, "num_vni_up": 0 } } } } } }
expected_output = {'bridge_group': {'D': {'bridge_domain': {'D-w': {'ac': {'num_ac': 1, 'num_ac_up': 1}, 'id': 0, 'pbb': {'num_pbb': 0, 'num_pbb_up': 0}, 'pw': {'num_pw': 1, 'num_pw_up': 1}, 'state': 'up', 'vni': {'num_vni': 0, 'num_vni_up': 0}}}}, 'GO-LEAFS': {'bridge_domain': {'GO': {'ac': {'num_ac': 3, 'num_ac_up': 2}, 'id': 9, 'pbb': {'num_pbb': 0, 'num_pbb_up': 0}, 'pw': {'num_pw': 7, 'num_pw_up': 5}, 'state': 'up', 'vni': {'num_vni': 0, 'num_vni_up': 0}}}}, 'MGMT': {'bridge_domain': {'DSL-MGMT': {'ac': {'num_ac': 1, 'num_ac_up': 0}, 'id': 2, 'pbb': {'num_pbb': 0, 'num_pbb_up': 0}, 'pw': {'num_pw': 0, 'num_pw_up': 0}, 'state': 'up', 'vni': {'num_vni': 0, 'num_vni_up': 0}}}}, 'WOrd': {'bridge_domain': {'CODE-123-4567': {'ac': {'num_ac': 1, 'num_ac_up': 0}, 'id': 3, 'pbb': {'num_pbb': 0, 'num_pbb_up': 0}, 'pw': {'num_pw': 1, 'num_pw_up': 0}, 'state': 'up', 'vni': {'num_vni': 0, 'num_vni_up': 0}}}}, 'admin1': {'bridge_domain': {'domain1': {'ac': {'num_ac': 1, 'num_ac_up': 0}, 'id': 6, 'pbb': {'num_pbb': 0, 'num_pbb_up': 0}, 'pw': {'num_pw': 1, 'num_pw_up': 0}, 'state': 'admin down', 'vni': {'num_vni': 0, 'num_vni_up': 0}}}}, 'd': {'bridge_domain': {'s-VLAN_20': {'ac': {'num_ac': 2, 'num_ac_up': 2}, 'id': 1, 'pbb': {'num_pbb': 0, 'num_pbb_up': 0}, 'pw': {'num_pw': 1, 'num_pw_up': 1}, 'state': 'up', 'vni': {'num_vni': 0, 'num_vni_up': 0}}}}, 'g1': {'bridge_domain': {'bd1': {'ac': {'num_ac': 1, 'num_ac_up': 1}, 'id': 0, 'pw': {'num_pw': 1, 'num_pw_up': 1}, 'state': 'up'}}}, 'woRD': {'bridge_domain': {'THING_PLACE_DIA-765_4321': {'ac': {'num_ac': 1, 'num_ac_up': 1}, 'id': 4, 'pbb': {'num_pbb': 0, 'num_pbb_up': 0}, 'pw': {'num_pw': 1, 'num_pw_up': 1}, 'state': 'up', 'vni': {'num_vni': 0, 'num_vni_up': 0}}}}}}
INPUT_TO_DWI_CONVERSION_EDGES = [("dwi_file", "in_file")] INPUT_TO_FMAP_CONVERSION_EDGES = [("fmap_file", "in_file")] LOCATE_ASSOCIATED_TO_COVERSION_EDGES = [ ("json_file", "json_import"), ("bvec_file", "in_bvec"), ("bval_file", "in_bval"), ] DWI_CONVERSION_TO_OUTPUT_EDGES = [("out_file", "dwi_file")] FMAP_CONVERSION_TO_OUTPUT_EDGES = [("out_file", "fmap_file")]
input_to_dwi_conversion_edges = [('dwi_file', 'in_file')] input_to_fmap_conversion_edges = [('fmap_file', 'in_file')] locate_associated_to_coversion_edges = [('json_file', 'json_import'), ('bvec_file', 'in_bvec'), ('bval_file', 'in_bval')] dwi_conversion_to_output_edges = [('out_file', 'dwi_file')] fmap_conversion_to_output_edges = [('out_file', 'fmap_file')]
almacen_api_config = { 'debug': { 'name': 'almacen_api', 'database': 'stage_01', 'debug': True, 'app': { 'DEBUG': True, 'UPLOAD_FOLDER': '/tmp', }, 'run': { # 'ssl_context': ('ssl/cert.pem', 'ssl/key.pem'), 'port': 8000, }, 'app_tokens': { 'TOKEN': { 'app': 'development', 'roles': ['super', 'tagger'], }, 'TOKEN': { 'app': 'longcat_api', 'roles': ['tagger'], }, }, }, 'development': { 'name': 'almacen_api', 'database': 'stage_01', 'run': { 'port': 8000, }, 'app_tokens': { 'TOKEN': { 'app': 'development', 'roles': ['super', 'tagger'], }, 'TOKEN': { 'app': 'longcat_api', 'roles': ['tagger'], }, 'TOKEN': { 'app': 'longcat_api', 'roles': ['reader'], }, }, 's3_query_results_bucket': { 'access_key_id': 'ACCESSKEY', 'secret_access_key': 'SECRET', 'bucket_name': 'almacen-entrega', 'bucket_region': 'us-east-2', 'bucket_directory': 'almacen_api/stage/query_results', }, }, 'production': { 'name': 'almacen_api', 'database': 'prod_01', 'app_tokens': { 'TOKEN': { 'app': 'longcat_api', 'roles': ['tagger'], }, }, }, 'testing': { 'name': 'almacen_api_test', 'database': 'stage_01', 'app_tokens': { 'TOKEN': { 'app': 'development', 'roles': ['super', 'tagger'], }, }, }, }
almacen_api_config = {'debug': {'name': 'almacen_api', 'database': 'stage_01', 'debug': True, 'app': {'DEBUG': True, 'UPLOAD_FOLDER': '/tmp'}, 'run': {'port': 8000}, 'app_tokens': {'TOKEN': {'app': 'development', 'roles': ['super', 'tagger']}, 'TOKEN': {'app': 'longcat_api', 'roles': ['tagger']}}}, 'development': {'name': 'almacen_api', 'database': 'stage_01', 'run': {'port': 8000}, 'app_tokens': {'TOKEN': {'app': 'development', 'roles': ['super', 'tagger']}, 'TOKEN': {'app': 'longcat_api', 'roles': ['tagger']}, 'TOKEN': {'app': 'longcat_api', 'roles': ['reader']}}, 's3_query_results_bucket': {'access_key_id': 'ACCESSKEY', 'secret_access_key': 'SECRET', 'bucket_name': 'almacen-entrega', 'bucket_region': 'us-east-2', 'bucket_directory': 'almacen_api/stage/query_results'}}, 'production': {'name': 'almacen_api', 'database': 'prod_01', 'app_tokens': {'TOKEN': {'app': 'longcat_api', 'roles': ['tagger']}}}, 'testing': {'name': 'almacen_api_test', 'database': 'stage_01', 'app_tokens': {'TOKEN': {'app': 'development', 'roles': ['super', 'tagger']}}}}
a=1 def change_integer(a): a = a+1 return a print (change_integer(a)) print (a) b=[1,2,3] def change_list(b): b[0]=b[0]+1 return b print (change_list(b)) print (b)
a = 1 def change_integer(a): a = a + 1 return a print(change_integer(a)) print(a) b = [1, 2, 3] def change_list(b): b[0] = b[0] + 1 return b print(change_list(b)) print(b)
number_1 = int(input()) number_2 = int(input()) if number_1 >= number_2: print(number_1) print(number_2) else: print(number_2) print(number_1)
number_1 = int(input()) number_2 = int(input()) if number_1 >= number_2: print(number_1) print(number_2) else: print(number_2) print(number_1)
#!/usr/bin/env python3 # CHECKED A = [[4.5, -1, -1, 1], [-1, 4.5, 1, -1], [-1, 2, 4.5, -1], [2, -1, -1, 4.5]] b = [1, -1, -1, 0] x = [0.25, 0.25, 0.25, 0.25] x_new = [0, 0, 0, 0] for k in range(2): for i in range(4): x_new[i] = b[i] for j in range(4): if j != i: x_new[i] -= A[i][j] * x[j] x_new[i] *= (1 / A[i][i]) print("Ans", k, "\n", x_new) x = x_new.copy()
a = [[4.5, -1, -1, 1], [-1, 4.5, 1, -1], [-1, 2, 4.5, -1], [2, -1, -1, 4.5]] b = [1, -1, -1, 0] x = [0.25, 0.25, 0.25, 0.25] x_new = [0, 0, 0, 0] for k in range(2): for i in range(4): x_new[i] = b[i] for j in range(4): if j != i: x_new[i] -= A[i][j] * x[j] x_new[i] *= 1 / A[i][i] print('Ans', k, '\n', x_new) x = x_new.copy()
class Solution: # @param num : a list of integer # @return : a list of integer def nextPermutation(self, num): # write your code here # Version 1 bp = -1 for i in range(len(num) - 1): if (num[i] < num[i + 1]): bp = i if (bp == -1): num.reverse() return num rest = num[bp:] local_max = None for i in rest: if (i > rest[0] and (local_max is None or i < local_max)): local_max = i rest.pop(rest.index(local_max)) rest = sorted(rest) return num[:bp] + [local_max] + rest # Version 2 # i = len(num) - 1 # target_index = None # second_index = None # while (i > 0): # if (num[i] > num[i - 1]): # target_index = i - 1 # break # i -= 1 # if (target_index is None): # return sorted(num) # i = len(num) - 1 # while (i > target_index): # if (num[i] > num[target_index]): # second_index = i # break # i -= 1 # temp = num[target_index] # num[target_index] = num[second_index] # num[second_index] = temp # return num[:target_index] + [num[target_index]] + sorted(num[target_index + 1:])
class Solution: def next_permutation(self, num): bp = -1 for i in range(len(num) - 1): if num[i] < num[i + 1]: bp = i if bp == -1: num.reverse() return num rest = num[bp:] local_max = None for i in rest: if i > rest[0] and (local_max is None or i < local_max): local_max = i rest.pop(rest.index(local_max)) rest = sorted(rest) return num[:bp] + [local_max] + rest
X = int(input()) a_list = [] for s in range(1, 32): for i in range(2, 10): a = s ** i if a > 1000: break a_list.append(a) a2 = sorted(list(set(a_list)), reverse=True) for n in a2: if n <= X: print(n) break
x = int(input()) a_list = [] for s in range(1, 32): for i in range(2, 10): a = s ** i if a > 1000: break a_list.append(a) a2 = sorted(list(set(a_list)), reverse=True) for n in a2: if n <= X: print(n) break
def presentacion_inicial(): print("*"*20) print("Que accion desea realizar : ") print("1) Insertar Persona : ") print("2) Insertar Empleado : ") print("3) Consultar las personas : ") print("4) Consultar por empleados : ") return int(input("Opcion necesitas : "))
def presentacion_inicial(): print('*' * 20) print('Que accion desea realizar : ') print('1) Insertar Persona : ') print('2) Insertar Empleado : ') print('3) Consultar las personas : ') print('4) Consultar por empleados : ') return int(input('Opcion necesitas : '))
load("@io_bazel_rules_docker//go:image.bzl", go_image_repositories="repositories") load("@io_bazel_rules_docker//container:container.bzl", container_repositories = "repositories") def initialize_rules_docker(): container_repositories() go_image_repositories() load("@distroless//package_manager:package_manager.bzl", "package_manager_repositories",) def initialize_rules_package_manager(): package_manager_repositories()
load('@io_bazel_rules_docker//go:image.bzl', go_image_repositories='repositories') load('@io_bazel_rules_docker//container:container.bzl', container_repositories='repositories') def initialize_rules_docker(): container_repositories() go_image_repositories() load('@distroless//package_manager:package_manager.bzl', 'package_manager_repositories') def initialize_rules_package_manager(): package_manager_repositories()
# urls.py # urls for dash app url_paths = { "index": '/', "home": '/home', "scatter": '/apps/scatter-test', "combo": '/apps/combo-test' }
url_paths = {'index': '/', 'home': '/home', 'scatter': '/apps/scatter-test', 'combo': '/apps/combo-test'}
scoreboard_display = [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25'], ['51', '50', '49', '48', '47', '46', '45', '44', '43', '42', '41', '40', '39', '38', '37', '36', '35', '34', '33', '32', '31', '30', '29', '28', '27', '26'], ['52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77'], ['103', '102', '101', '100', '99', '98', '97', '96', '95', '94', '93', '92', '91', '90', '89', '88', '87', '86', '85', '84', '83', '82', '81', '80', '79', '78'], ['104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120', '121', '122', '123', '124', '125', '126', '127', '128', '129'], ['155', '154', '153', '152', '151', '150', '149', '148', '147', '146', '145', '144', '143', '142', '141', '140', '139', '138', '137', '136', '135', '134', '133', '132', '131', '130'], ['156', '157', '158', '159', '160', '161', '162', '163', '164', '165', '166', '167', '168', '169', '170', '171', '172', '173', '174', '175', '176', '177', '178', '179', '180', '181'], ['207', '206', '205', '204', '203', '202', '201', '200', '199', '198', '197', '196', '195', '194', '193', '192', '191', '190', '189', '188', '187', '186', '185', '184', '183', '182'], ['208', '209', '210', '211', '212', '213', '214', '215', '216', '217', '218', '219', '220', '221', '222', '223', '224', '225', '226', '227', '228', '229', '230', '231', '232', '233'], ['259', '258', '257', '256', '255', '254', '253', '252', '251', '250', '249', '248', '247', '246', '245', '244', '243', '242', '241', '240', '239', '238', '237', '236', '235', '234'], ['260', '261', '262', '263', '264', '265', '266', '267', '268', '269', '270', '271', '272', '273', '274', '275', '276', '277', '278', '279', '280', '281', '282', '283', '284', '285'], ['311', '310', '309', '308', '307', '306', '305', '304', '303', '302', '301', '300', '299', '298', '297', '296', '295', '294', '293', '292', '291', '290', '289', '288', '287', '286'], ['312', '313', '314', '315', '316', '317', '318', '319', '320', '321', '322', '323', '324', '325', '326', '327', '328', '329', '330', '331', '332', '333', '334', '335', '336', '337'], ['363', '362', '361', '360', '359', '358', '357', '356', '355', '354', '353', '352', '351', '350', '349', '348', '347', '346', '345', '344', '343', '342', '341', '340', '339', '338'], ['364', '365', '366', '367', '368', '369', '370', '371', '372', '373', '374', '375', '376', '377', '378', '379', '380', '381', '382', '383', '384', '385', '386', '387', '388', '389'], ['415', '414', '413', '412', '411', '410', '409', '408', '407', '406', '405', '404', '403', '402', '401', '400', '399', '398', '397', '396', '395', '394', '393', '392', '391', '390'], ['416', '417', '418', '419', '420', '421', '422', '423', '424', '425', '426', '427', '428', '429', '430', '431', '432', '433', '434', '435', '436', '437', '438', '439', '440', '441']]
scoreboard_display = [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25'], ['51', '50', '49', '48', '47', '46', '45', '44', '43', '42', '41', '40', '39', '38', '37', '36', '35', '34', '33', '32', '31', '30', '29', '28', '27', '26'], ['52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77'], ['103', '102', '101', '100', '99', '98', '97', '96', '95', '94', '93', '92', '91', '90', '89', '88', '87', '86', '85', '84', '83', '82', '81', '80', '79', '78'], ['104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '115', '116', '117', '118', '119', '120', '121', '122', '123', '124', '125', '126', '127', '128', '129'], ['155', '154', '153', '152', '151', '150', '149', '148', '147', '146', '145', '144', '143', '142', '141', '140', '139', '138', '137', '136', '135', '134', '133', '132', '131', '130'], ['156', '157', '158', '159', '160', '161', '162', '163', '164', '165', '166', '167', '168', '169', '170', '171', '172', '173', '174', '175', '176', '177', '178', '179', '180', '181'], ['207', '206', '205', '204', '203', '202', '201', '200', '199', '198', '197', '196', '195', '194', '193', '192', '191', '190', '189', '188', '187', '186', '185', '184', '183', '182'], ['208', '209', '210', '211', '212', '213', '214', '215', '216', '217', '218', '219', '220', '221', '222', '223', '224', '225', '226', '227', '228', '229', '230', '231', '232', '233'], ['259', '258', '257', '256', '255', '254', '253', '252', '251', '250', '249', '248', '247', '246', '245', '244', '243', '242', '241', '240', '239', '238', '237', '236', '235', '234'], ['260', '261', '262', '263', '264', '265', '266', '267', '268', '269', '270', '271', '272', '273', '274', '275', '276', '277', '278', '279', '280', '281', '282', '283', '284', '285'], ['311', '310', '309', '308', '307', '306', '305', '304', '303', '302', '301', '300', '299', '298', '297', '296', '295', '294', '293', '292', '291', '290', '289', '288', '287', '286'], ['312', '313', '314', '315', '316', '317', '318', '319', '320', '321', '322', '323', '324', '325', '326', '327', '328', '329', '330', '331', '332', '333', '334', '335', '336', '337'], ['363', '362', '361', '360', '359', '358', '357', '356', '355', '354', '353', '352', '351', '350', '349', '348', '347', '346', '345', '344', '343', '342', '341', '340', '339', '338'], ['364', '365', '366', '367', '368', '369', '370', '371', '372', '373', '374', '375', '376', '377', '378', '379', '380', '381', '382', '383', '384', '385', '386', '387', '388', '389'], ['415', '414', '413', '412', '411', '410', '409', '408', '407', '406', '405', '404', '403', '402', '401', '400', '399', '398', '397', '396', '395', '394', '393', '392', '391', '390'], ['416', '417', '418', '419', '420', '421', '422', '423', '424', '425', '426', '427', '428', '429', '430', '431', '432', '433', '434', '435', '436', '437', '438', '439', '440', '441']]
# flake8: noqa # in legacy datasets we need to put our sample data within the data dir legacy_datasets = ["cmu_small_region.svs"] # Registry of datafiles that can be downloaded along with their SHA256 hashes # To generate the SHA256 hash, use the command # openssl sha256 filename registry = { "histolab/broken.svs": "b1325916876afa17ad5e02d2e7298ee883e758ed25369470d85bc0990e928e11", "histolab/kidney.png": "5c6dc1b9ae10a2865302d9c8eda360362ec47732cb3e9766c38ed90cb9f4c371", "data/cmu_small_region.svs": "ed92d5a9f2e86df67640d6f92ce3e231419ce127131697fbbce42ad5e002c8a7", "aperio/JP2K-33003-1.svs": "6205ccf75a8fa6c32df7c5c04b7377398971a490fb6b320d50d91f7ba6a0e6fd", "aperio/JP2K-33003-2.svs": "1a13cef86b55b51127cebd94a1f6069f7de494c98e3e708640d1ce7181d9e3fd", "tcga/breast/TCGA-A8-A082-01A-01-TS1.3cad4a77-47a6-4658-becf-d8cffa161d3a.svs": "e955f47b83c8a5ae382ff8559493548f90f85c17c86315dd03134c041f44df70", "tcga/breast/TCGA-A1-A0SH-01Z-00-DX1.90E71B08-E1D9-4FC2-85AC-062E56DDF17C.svs": "6de90fe92400e592839ab7f87c15d9924bc539c61ee3b3bc8ef044f98d16031b", "tcga/breast/TCGA-E9-A24A-01Z-00-DX1.F0342837-5750-4172-B60D-5F902E2A02FD.svs": "55c694262c4d44b342e08eb3ef2082eeb9e9deeb3cb445e4776419bb9fa7dc21", "tcga/breast/TCGA-BH-A201-01Z-00-DX1.6D6E3224-50A0-45A2-B231-EEF27CA7EFD2.svs": "e1ccf3360078844abbec4b96c5da59a029a441c1ab6d7f694ec80d9d79bd3837", "tcga/prostate/TCGA-CH-5753-01A-01-BS1.4311c533-f9c1-4c6f-8b10-922daa3c2e3e.svs": "93ed7aa906c9e127c8241bc5da197902ebb71ccda4db280aefbe0ecd952b9089", "tcga/ovarian/TCGA-13-1404-01A-01-TS1.cecf7044-1d29-4d14-b137-821f8d48881e.svs": "6796e23af7cd219b9ff2274c087759912529fec9f49e2772a868ba9d85d389d6", "9798433/?format=tif": "7db49ff9fc3f6022ae334cf019e94ef4450f7d4cf0d71783e0f6ea82965d3a52", "9798554/?format=tif": "8a4318ac713b4cf50c3314760da41ab7653e10e90531ecd0c787f1386857a4ef", } APERIO_REPO_URL = "http://openslide.cs.cmu.edu/download/openslide-testdata/Aperio" TCGA_REPO_URL = "https://api.gdc.cancer.gov/data" IDR_REPO_URL = "https://idr.openmicroscopy.org/webclient/render_image_download" registry_urls = { "histolab/broken.svs": "https://raw.githubusercontent.com/histolab/histolab/master/tests/fixtures/svs-images/broken.svs", "histolab/kidney.png": "https://user-images.githubusercontent.com/4196091/100275351-132cc880-2f60-11eb-8cc8-7a3bf3723260.png", "aperio/JP2K-33003-1.svs": f"{APERIO_REPO_URL}/JP2K-33003-1.svs", "aperio/JP2K-33003-2.svs": f"{APERIO_REPO_URL}/JP2K-33003-2.svs", "tcga/breast/TCGA-A8-A082-01A-01-TS1.3cad4a77-47a6-4658-becf-d8cffa161d3a.svs": f"{TCGA_REPO_URL}/ad9ed74a-2725-49e6-bf7a-ef100e299989", "tcga/breast/TCGA-A1-A0SH-01Z-00-DX1.90E71B08-E1D9-4FC2-85AC-062E56DDF17C.svs": f"{TCGA_REPO_URL}/3845b8bd-cbe0-49cf-a418-a8120f6c23db", "tcga/breast/TCGA-E9-A24A-01Z-00-DX1.F0342837-5750-4172-B60D-5F902E2A02FD.svs": f"{TCGA_REPO_URL}/682e4d74-2200-4f34-9e96-8dee968b1568", "tcga/breast/TCGA-BH-A201-01Z-00-DX1.6D6E3224-50A0-45A2-B231-EEF27CA7EFD2.svs": f"{TCGA_REPO_URL}/e70c89a5-1c2f-43f8-b6be-589beea55338", "tcga/prostate/TCGA-CH-5753-01A-01-BS1.4311c533-f9c1-4c6f-8b10-922daa3c2e3e.svs": f"{TCGA_REPO_URL}/5a8ce04a-0178-49e2-904c-30e21fb4e41e", "tcga/ovarian/TCGA-13-1404-01A-01-TS1.cecf7044-1d29-4d14-b137-821f8d48881e.svs": f"{TCGA_REPO_URL}/e968375e-ef58-4607-b457-e6818b2e8431", "9798433/?format=tif": f"{IDR_REPO_URL}/9798433/?format=tif", "9798554/?format=tif": f"{IDR_REPO_URL}/9798554/?format=tif", } legacy_registry = { ("data/" + filename): registry["data/" + filename] for filename in legacy_datasets }
legacy_datasets = ['cmu_small_region.svs'] registry = {'histolab/broken.svs': 'b1325916876afa17ad5e02d2e7298ee883e758ed25369470d85bc0990e928e11', 'histolab/kidney.png': '5c6dc1b9ae10a2865302d9c8eda360362ec47732cb3e9766c38ed90cb9f4c371', 'data/cmu_small_region.svs': 'ed92d5a9f2e86df67640d6f92ce3e231419ce127131697fbbce42ad5e002c8a7', 'aperio/JP2K-33003-1.svs': '6205ccf75a8fa6c32df7c5c04b7377398971a490fb6b320d50d91f7ba6a0e6fd', 'aperio/JP2K-33003-2.svs': '1a13cef86b55b51127cebd94a1f6069f7de494c98e3e708640d1ce7181d9e3fd', 'tcga/breast/TCGA-A8-A082-01A-01-TS1.3cad4a77-47a6-4658-becf-d8cffa161d3a.svs': 'e955f47b83c8a5ae382ff8559493548f90f85c17c86315dd03134c041f44df70', 'tcga/breast/TCGA-A1-A0SH-01Z-00-DX1.90E71B08-E1D9-4FC2-85AC-062E56DDF17C.svs': '6de90fe92400e592839ab7f87c15d9924bc539c61ee3b3bc8ef044f98d16031b', 'tcga/breast/TCGA-E9-A24A-01Z-00-DX1.F0342837-5750-4172-B60D-5F902E2A02FD.svs': '55c694262c4d44b342e08eb3ef2082eeb9e9deeb3cb445e4776419bb9fa7dc21', 'tcga/breast/TCGA-BH-A201-01Z-00-DX1.6D6E3224-50A0-45A2-B231-EEF27CA7EFD2.svs': 'e1ccf3360078844abbec4b96c5da59a029a441c1ab6d7f694ec80d9d79bd3837', 'tcga/prostate/TCGA-CH-5753-01A-01-BS1.4311c533-f9c1-4c6f-8b10-922daa3c2e3e.svs': '93ed7aa906c9e127c8241bc5da197902ebb71ccda4db280aefbe0ecd952b9089', 'tcga/ovarian/TCGA-13-1404-01A-01-TS1.cecf7044-1d29-4d14-b137-821f8d48881e.svs': '6796e23af7cd219b9ff2274c087759912529fec9f49e2772a868ba9d85d389d6', '9798433/?format=tif': '7db49ff9fc3f6022ae334cf019e94ef4450f7d4cf0d71783e0f6ea82965d3a52', '9798554/?format=tif': '8a4318ac713b4cf50c3314760da41ab7653e10e90531ecd0c787f1386857a4ef'} aperio_repo_url = 'http://openslide.cs.cmu.edu/download/openslide-testdata/Aperio' tcga_repo_url = 'https://api.gdc.cancer.gov/data' idr_repo_url = 'https://idr.openmicroscopy.org/webclient/render_image_download' registry_urls = {'histolab/broken.svs': 'https://raw.githubusercontent.com/histolab/histolab/master/tests/fixtures/svs-images/broken.svs', 'histolab/kidney.png': 'https://user-images.githubusercontent.com/4196091/100275351-132cc880-2f60-11eb-8cc8-7a3bf3723260.png', 'aperio/JP2K-33003-1.svs': f'{APERIO_REPO_URL}/JP2K-33003-1.svs', 'aperio/JP2K-33003-2.svs': f'{APERIO_REPO_URL}/JP2K-33003-2.svs', 'tcga/breast/TCGA-A8-A082-01A-01-TS1.3cad4a77-47a6-4658-becf-d8cffa161d3a.svs': f'{TCGA_REPO_URL}/ad9ed74a-2725-49e6-bf7a-ef100e299989', 'tcga/breast/TCGA-A1-A0SH-01Z-00-DX1.90E71B08-E1D9-4FC2-85AC-062E56DDF17C.svs': f'{TCGA_REPO_URL}/3845b8bd-cbe0-49cf-a418-a8120f6c23db', 'tcga/breast/TCGA-E9-A24A-01Z-00-DX1.F0342837-5750-4172-B60D-5F902E2A02FD.svs': f'{TCGA_REPO_URL}/682e4d74-2200-4f34-9e96-8dee968b1568', 'tcga/breast/TCGA-BH-A201-01Z-00-DX1.6D6E3224-50A0-45A2-B231-EEF27CA7EFD2.svs': f'{TCGA_REPO_URL}/e70c89a5-1c2f-43f8-b6be-589beea55338', 'tcga/prostate/TCGA-CH-5753-01A-01-BS1.4311c533-f9c1-4c6f-8b10-922daa3c2e3e.svs': f'{TCGA_REPO_URL}/5a8ce04a-0178-49e2-904c-30e21fb4e41e', 'tcga/ovarian/TCGA-13-1404-01A-01-TS1.cecf7044-1d29-4d14-b137-821f8d48881e.svs': f'{TCGA_REPO_URL}/e968375e-ef58-4607-b457-e6818b2e8431', '9798433/?format=tif': f'{IDR_REPO_URL}/9798433/?format=tif', '9798554/?format=tif': f'{IDR_REPO_URL}/9798554/?format=tif'} legacy_registry = {'data/' + filename: registry['data/' + filename] for filename in legacy_datasets}
print('=' * 15, '\033[1;35mAULA 18 - Listas[Part #2]\033[m', '=' * 15) # -------------------------------------------------------------------- dados = [] pessoas = [] galera = [['Miguel', 25], ['Berta', 59], ['Joaquim', 20]] # -------------------------------------------------------------------- dados.append('Joaquim') dados.append(20) dados.append('Fernando') dados.append(23) dados.append('Maria') dados.append(19) pessoas.append(dados[:]) # galera.append(pessoas[:]) print(galera[0][0]) # Miguel print(galera[1][1]) # 59 print(galera[2][0]) # Joaquim print(galera[1]) # Berta + 59
print('=' * 15, '\x1b[1;35mAULA 18 - Listas[Part #2]\x1b[m', '=' * 15) dados = [] pessoas = [] galera = [['Miguel', 25], ['Berta', 59], ['Joaquim', 20]] dados.append('Joaquim') dados.append(20) dados.append('Fernando') dados.append(23) dados.append('Maria') dados.append(19) pessoas.append(dados[:]) print(galera[0][0]) print(galera[1][1]) print(galera[2][0]) print(galera[1])
P, D = list(map(int, input().split(' '))) totA, totB = 0, 0 dis = [[0,0,0,0] for i in range(D)] for i in range(P): a, b, c = map(int, input().split(' ')) k = (b+c)//2 + 1 dis[a-1][0] += b dis[a-1][1] += c for i, (ta, tb, _, _) in enumerate(dis): k = (ta + tb)//2 + 1 if ta > tb: wA = ta-k wB = tb else: wA = ta wB = tb-k dis[i][2] = wA dis[i][3] = wB print('A' if ta > tb else 'B', f"{wA} {wB}") tot = sum(a[0] + a[1] for a in dis) wA = sum(a[2] for a in dis) wB = sum(a[3] for a in dis) print(abs(wA - wB) / tot)
(p, d) = list(map(int, input().split(' '))) (tot_a, tot_b) = (0, 0) dis = [[0, 0, 0, 0] for i in range(D)] for i in range(P): (a, b, c) = map(int, input().split(' ')) k = (b + c) // 2 + 1 dis[a - 1][0] += b dis[a - 1][1] += c for (i, (ta, tb, _, _)) in enumerate(dis): k = (ta + tb) // 2 + 1 if ta > tb: w_a = ta - k w_b = tb else: w_a = ta w_b = tb - k dis[i][2] = wA dis[i][3] = wB print('A' if ta > tb else 'B', f'{wA} {wB}') tot = sum((a[0] + a[1] for a in dis)) w_a = sum((a[2] for a in dis)) w_b = sum((a[3] for a in dis)) print(abs(wA - wB) / tot)
baklava_price = float(input()) muffin_price = float(input()) shtolen_kg = float(input()) candy_kg = float(input()) bisquits_kg = int(input()) shtolen_price = baklava_price + baklava_price * 0.6 candy_price = muffin_price + muffin_price * 0.8 busquits_price = 7.50 shtolen_sum = shtolen_kg * shtolen_price candy_sum = candy_kg * candy_price bisquits_sum = bisquits_kg * busquits_price all_sum = shtolen_sum + candy_sum + bisquits_sum print(f'{all_sum:.2f}')
baklava_price = float(input()) muffin_price = float(input()) shtolen_kg = float(input()) candy_kg = float(input()) bisquits_kg = int(input()) shtolen_price = baklava_price + baklava_price * 0.6 candy_price = muffin_price + muffin_price * 0.8 busquits_price = 7.5 shtolen_sum = shtolen_kg * shtolen_price candy_sum = candy_kg * candy_price bisquits_sum = bisquits_kg * busquits_price all_sum = shtolen_sum + candy_sum + bisquits_sum print(f'{all_sum:.2f}')
x=int(input('Enter the number to convert: ')) print('Select the convertion') print(''' [ 1 ] Binary [ 1 ] Octal [ 3 ] HexaDeicmal ''') y=int(input('1 - Binary 2 - Octal 3 - Hexadecimal')) if y==1: bin(x)[2:] print('{}'.format(x)) elif y==2: oct(x) print('{}'.format(x)) elif y==3: hex(x) print(x) else: print('Invalid')
x = int(input('Enter the number to convert: ')) print('Select the convertion') print(' \n[ 1 ] Binary\n[ 1 ] Octal\n[ 3 ] HexaDeicmal\n') y = int(input('1 - Binary 2 - Octal 3 - Hexadecimal')) if y == 1: bin(x)[2:] print('{}'.format(x)) elif y == 2: oct(x) print('{}'.format(x)) elif y == 3: hex(x) print(x) else: print('Invalid')
#!/usr/bin/python3 def safe_print_list_integers(my_list=[], x=0): i = 0 for index in range(x): try: print("{:d}".format(my_list[index]), end="") i += 1 except (ValueError, TypeError): pass print() return i
def safe_print_list_integers(my_list=[], x=0): i = 0 for index in range(x): try: print('{:d}'.format(my_list[index]), end='') i += 1 except (ValueError, TypeError): pass print() return i
N = int(input()) A, B = ( zip(*(map(int, input().split()) for _ in range(N))) if N else ((), ()) ) ans = len({(min(a, b), max(a, b)) for a, b in zip(A, B)}) print(ans)
n = int(input()) (a, b) = zip(*(map(int, input().split()) for _ in range(N))) if N else ((), ()) ans = len({(min(a, b), max(a, b)) for (a, b) in zip(A, B)}) print(ans)
URLS = [ "url1" ] STATUSPAGE_API_KEY = "" STATUSPAGE_PAGE_ID = "" STATUSPAGE_METRICS = { "url": "metric_id" } STATUSPAGE_COMPONENTS = { "url": "component_id" } PING_WEBHOOKS = [] STATUS_WEBHOOKS = [] ESCALATION_IDS = [] POLL_TIME = 60 OUTAGE_CHANGE_AFTER = 10 DRY_MODE = False DEGRADED_PERFORMANCE_TARGET_PING = 500 TIMEOUT_PING = 30000
urls = ['url1'] statuspage_api_key = '' statuspage_page_id = '' statuspage_metrics = {'url': 'metric_id'} statuspage_components = {'url': 'component_id'} ping_webhooks = [] status_webhooks = [] escalation_ids = [] poll_time = 60 outage_change_after = 10 dry_mode = False degraded_performance_target_ping = 500 timeout_ping = 30000
{ 'application':{ 'type':'Application', 'name':'MulticolumnExample', 'backgrounds': [ { 'type':'Background', 'name':'bgMulticolumnExample', 'title':'Multicolumn Example PythonCard Application', 'size':( 620, 500 ), 'menubar': { 'type':'MenuBar', 'menus': [ { 'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ { 'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit' } ] } ] }, 'components': [ {'type':'Button', 'name':'demoButton', 'position':(510, 5), 'size':(85, 25), 'label':'Load Demo', }, {'type':'Button', 'name':'clearButton', 'position':(510, 30), 'size':(85, 25), 'label':'Clear', }, {'type':'Button', 'name':'loadButton', 'position':(510, 55), 'size':(85, 25), 'label':'Load CSV', }, {'type':'Button', 'name':'appendButton', 'position':(510, 80), 'size':(85, 25), 'label':'Append CSV', }, {'type':'Button', 'name':'swapButton', 'position':(510, 105), 'size':(85, 25), 'label':'Swap Lists', }, {'type':'Button', 'name':'prevButton', 'position':(510, 130), 'size':(85, 25), 'label':'Prev', }, {'type':'Button', 'name':'nextButton', 'position':(510, 155), 'size':(85, 25), 'label':'Next', }, {'type':'Button', 'name':'exitButton', 'position':(510, 180), 'size':(85, 25), 'label':'Exit', }, {'type':'MultiColumnList', 'name':'theList', 'position':(3, 3), #10, 305 'size':(500, 390), 'columnHeadings': ['Example List'], 'items':['Example 1','Example 2','Example 3'], }, {'type':'TextArea', 'name':'displayArea', 'position':(3, 398), 'size':(500, 40), 'font':{'family': 'monospace', 'size': 12}, }, {'type':'TextArea', 'name':'countArea', 'position':(507, 398), 'size':(85, 40), 'font':{'family': 'monospace', 'size': 12}, }, ] } ] } }
{'application': {'type': 'Application', 'name': 'MulticolumnExample', 'backgrounds': [{'type': 'Background', 'name': 'bgMulticolumnExample', 'title': 'Multicolumn Example PythonCard Application', 'size': (620, 500), 'menubar': {'type': 'MenuBar', 'menus': [{'type': 'Menu', 'name': 'menuFile', 'label': '&File', 'items': [{'type': 'MenuItem', 'name': 'menuFileExit', 'label': 'E&xit\tAlt+X', 'command': 'exit'}]}]}, 'components': [{'type': 'Button', 'name': 'demoButton', 'position': (510, 5), 'size': (85, 25), 'label': 'Load Demo'}, {'type': 'Button', 'name': 'clearButton', 'position': (510, 30), 'size': (85, 25), 'label': 'Clear'}, {'type': 'Button', 'name': 'loadButton', 'position': (510, 55), 'size': (85, 25), 'label': 'Load CSV'}, {'type': 'Button', 'name': 'appendButton', 'position': (510, 80), 'size': (85, 25), 'label': 'Append CSV'}, {'type': 'Button', 'name': 'swapButton', 'position': (510, 105), 'size': (85, 25), 'label': 'Swap Lists'}, {'type': 'Button', 'name': 'prevButton', 'position': (510, 130), 'size': (85, 25), 'label': 'Prev'}, {'type': 'Button', 'name': 'nextButton', 'position': (510, 155), 'size': (85, 25), 'label': 'Next'}, {'type': 'Button', 'name': 'exitButton', 'position': (510, 180), 'size': (85, 25), 'label': 'Exit'}, {'type': 'MultiColumnList', 'name': 'theList', 'position': (3, 3), 'size': (500, 390), 'columnHeadings': ['Example List'], 'items': ['Example 1', 'Example 2', 'Example 3']}, {'type': 'TextArea', 'name': 'displayArea', 'position': (3, 398), 'size': (500, 40), 'font': {'family': 'monospace', 'size': 12}}, {'type': 'TextArea', 'name': 'countArea', 'position': (507, 398), 'size': (85, 40), 'font': {'family': 'monospace', 'size': 12}}]}]}}
# Find algorithm that sorts the stack of size n in O(log(n)) time. It is allowed to use operations # provided only by the stack interface: push(), pop(), top(), isEmpty() and additional stacks. class Stack: def __init__(self): self.stack = [] def push(self, value): self.stack.append(value) def pop(self): return self.stack.pop() def top(self): return self.stack[-1] def isEmpty(self): if self.stack == []: return True else: return False def sort_stack(stack): temporary_stack = Stack() while not stack.isEmpty(): value = stack.pop() while not temporary_stack.isEmpty() and temporary_stack.top() > value: stack.push(temporary_stack.pop()) temporary_stack.push(value) while not temporary_stack.isEmpty(): stack.push(temporary_stack.pop()) result = [] while not stack.isEmpty(): result.append(stack.pop()) return result def create_stack(T): stack = Stack() for i in range(len(T)): stack.push(T[i]) return stack T = [7, 10, 7, 87, 5, 53, 10, 15, 49, 1, 73, 14, 8, 68, 2, 32, 23, 41, 35, 98, 26] stack = create_stack(T) print(sort_stack(stack))
class Stack: def __init__(self): self.stack = [] def push(self, value): self.stack.append(value) def pop(self): return self.stack.pop() def top(self): return self.stack[-1] def is_empty(self): if self.stack == []: return True else: return False def sort_stack(stack): temporary_stack = stack() while not stack.isEmpty(): value = stack.pop() while not temporary_stack.isEmpty() and temporary_stack.top() > value: stack.push(temporary_stack.pop()) temporary_stack.push(value) while not temporary_stack.isEmpty(): stack.push(temporary_stack.pop()) result = [] while not stack.isEmpty(): result.append(stack.pop()) return result def create_stack(T): stack = stack() for i in range(len(T)): stack.push(T[i]) return stack t = [7, 10, 7, 87, 5, 53, 10, 15, 49, 1, 73, 14, 8, 68, 2, 32, 23, 41, 35, 98, 26] stack = create_stack(T) print(sort_stack(stack))
N = int(input()) MAX, VAR, FIX = range(3) # latest=9 r=3 b=4 # max_variable_fixed_values = [ # 3 4 5 # 2 3 3 # 2 1 5 # 2 4 2 # 2 2 4 # 2 5 1 # ] def try_to_beat(latest_score, r, b, max_var_fixed): our_score = 0 while b > 0: if not r: return -1 best_c_max_b, best_max_b = 0, 0 for max_b, variable, fixed in max_var_fixed: this_c_max = min( max_b, b, (latest_score - fixed - 1)//variable ) if this_c_max > best_max_b: # and this_c_max > 0 best_c_max_b, best_max_b = ([max_b, variable, fixed], this_c_max) if not best_max_b: return -1 max_var_fixed.remove(best_c_max_b) b -= best_max_b r -= 1 our_score = max( our_score, best_c_max_b[FIX] + best_max_b*best_c_max_b[VAR] ) return our_score def initial_total_time(b, max_var_fixed): initial_best_time = 0 for max_b, variable, fixed in max_var_fixed: passed_bits = min(b, max_b) b -= passed_bits initial_best_time = max( initial_best_time, fixed + variable*passed_bits ) if not b: return initial_best_time for case_id in range(1, N + 1): r, b, c = map(int, input().split()) max_variable_fixed_values = sorted([ [*map(int, input().split())] for _ in range(c) ], key=lambda item: item[MAX], reverse=True) total_time = initial_total_time(b, max_variable_fixed_values) print(total_time) while True: new_attempt = try_to_beat(total_time, r, b, max_variable_fixed_values.copy()) print(new_attempt) if new_attempt == -1: break else: total_time = new_attempt print('Case #{}: {}'.format(case_id, total_time))
n = int(input()) (max, var, fix) = range(3) def try_to_beat(latest_score, r, b, max_var_fixed): our_score = 0 while b > 0: if not r: return -1 (best_c_max_b, best_max_b) = (0, 0) for (max_b, variable, fixed) in max_var_fixed: this_c_max = min(max_b, b, (latest_score - fixed - 1) // variable) if this_c_max > best_max_b: (best_c_max_b, best_max_b) = ([max_b, variable, fixed], this_c_max) if not best_max_b: return -1 max_var_fixed.remove(best_c_max_b) b -= best_max_b r -= 1 our_score = max(our_score, best_c_max_b[FIX] + best_max_b * best_c_max_b[VAR]) return our_score def initial_total_time(b, max_var_fixed): initial_best_time = 0 for (max_b, variable, fixed) in max_var_fixed: passed_bits = min(b, max_b) b -= passed_bits initial_best_time = max(initial_best_time, fixed + variable * passed_bits) if not b: return initial_best_time for case_id in range(1, N + 1): (r, b, c) = map(int, input().split()) max_variable_fixed_values = sorted([[*map(int, input().split())] for _ in range(c)], key=lambda item: item[MAX], reverse=True) total_time = initial_total_time(b, max_variable_fixed_values) print(total_time) while True: new_attempt = try_to_beat(total_time, r, b, max_variable_fixed_values.copy()) print(new_attempt) if new_attempt == -1: break else: total_time = new_attempt print('Case #{}: {}'.format(case_id, total_time))
# # PySNMP MIB module CTRON-CHASSIS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-CHASSIS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:44:24 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) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint") ctronChassis, = mibBuilder.importSymbols("CTRON-MIB-NAMES", "ctronChassis") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, TimeTicks, Integer32, Counter32, Counter64, NotificationType, ObjectIdentity, iso, MibIdentifier, ModuleIdentity, Unsigned32, Bits, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "TimeTicks", "Integer32", "Counter32", "Counter64", "NotificationType", "ObjectIdentity", "iso", "MibIdentifier", "ModuleIdentity", "Unsigned32", "Bits", "Gauge32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") ctChas = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 1)) ctEnviron = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2)) ctFanModule = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3)) ctChasFNB = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("absent", 1), ("present", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctChasFNB.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFNB.setDescription('Denotes the presence or absence of the FNB.') ctChasAlarmEna = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2), ("notSupported", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctChasAlarmEna.setStatus('mandatory') if mibBuilder.loadTexts: ctChasAlarmEna.setDescription('Allow an audible alarm to be either enabled or dis- abled. Setting this object to disable(1) will prevent an audible alarm from being heard and will also stop the sound from a current audible alarm. Setting this object to enable(2) will allow an audible alarm to be heard and will also enable the sound from a current audible alarm, if it has previously been disabled. This object will read with the current setting.') chassisAlarmState = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("chassisNoFaultCondition", 1), ("chassisFaultCondition", 2), ("notSupported", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: chassisAlarmState.setStatus('mandatory') if mibBuilder.loadTexts: chassisAlarmState.setDescription('Denotes the current condition of the power supply fault detection circuit. This object will read with the value of chassisNoFaultCondition(1) when the chassis is currently operating with no power faults detected. This object will read with the value of chassisFaultCondition(2) when the chassis is currently in a power fault condition.') ctChasPowerTable = MibTable((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1), ) if mibBuilder.loadTexts: ctChasPowerTable.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerTable.setDescription('A list of power supply entries.') ctChasPowerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1), ).setIndexNames((0, "CTRON-CHASSIS-MIB", "ctChasPowerSupplyNum")) if mibBuilder.loadTexts: ctChasPowerEntry.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerEntry.setDescription('An entry in the powerTable providing objects for a power supply.') ctChasPowerSupplyNum = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctChasPowerSupplyNum.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerSupplyNum.setDescription('Denotes the power supply.') ctChasPowerSupplyState = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("infoNotAvailable", 1), ("notInstalled", 2), ("installedAndOperating", 3), ("installedAndNotOperating", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctChasPowerSupplyState.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerSupplyState.setDescription("Denotes the power supply's state.") ctChasPowerSupplyType = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("ac-dc", 1), ("dc-dc", 2), ("notSupported", 3), ("highOutput", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctChasPowerSupplyType.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerSupplyType.setDescription('Denotes the power supply type.') ctChasPowerSupplyRedundancy = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("redundant", 1), ("notRedundant", 2), ("notSupported", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctChasPowerSupplyRedundancy.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerSupplyRedundancy.setDescription('Denotes whether or not the power supply is redundant.') ctChasFanModuleTable = MibTable((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3, 1), ) if mibBuilder.loadTexts: ctChasFanModuleTable.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFanModuleTable.setDescription('A list of fan module entries.') ctChasFanModuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3, 1, 1), ).setIndexNames((0, "CTRON-CHASSIS-MIB", "ctChasFanModuleNum")) if mibBuilder.loadTexts: ctChasFanModuleEntry.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFanModuleEntry.setDescription('An entry in the fan module Table providing objects for a fan module.') ctChasFanModuleNum = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctChasFanModuleNum.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFanModuleNum.setDescription('Denotes the Fan module that may have failed.') ctChasFanModuleState = MibTableColumn((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("infoNotAvailable", 1), ("notInstalled", 2), ("installedAndOperating", 3), ("installedAndNotOperating", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctChasFanModuleState.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFanModuleState.setDescription('Denotes the fan modules state.') mibBuilder.exportSymbols("CTRON-CHASSIS-MIB", ctEnviron=ctEnviron, ctChasPowerSupplyNum=ctChasPowerSupplyNum, ctChasFanModuleState=ctChasFanModuleState, ctChasPowerEntry=ctChasPowerEntry, ctChasPowerSupplyState=ctChasPowerSupplyState, chassisAlarmState=chassisAlarmState, ctChasPowerSupplyType=ctChasPowerSupplyType, ctChas=ctChas, ctChasFanModuleEntry=ctChasFanModuleEntry, ctChasFanModuleTable=ctChasFanModuleTable, ctChasFNB=ctChasFNB, ctChasPowerTable=ctChasPowerTable, ctChasPowerSupplyRedundancy=ctChasPowerSupplyRedundancy, ctChasAlarmEna=ctChasAlarmEna, ctChasFanModuleNum=ctChasFanModuleNum, ctFanModule=ctFanModule)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', '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') (ctron_chassis,) = mibBuilder.importSymbols('CTRON-MIB-NAMES', 'ctronChassis') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, time_ticks, integer32, counter32, counter64, notification_type, object_identity, iso, mib_identifier, module_identity, unsigned32, bits, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'TimeTicks', 'Integer32', 'Counter32', 'Counter64', 'NotificationType', 'ObjectIdentity', 'iso', 'MibIdentifier', 'ModuleIdentity', 'Unsigned32', 'Bits', 'Gauge32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') ct_chas = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 1)) ct_environ = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2)) ct_fan_module = mib_identifier((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3)) ct_chas_fnb = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('absent', 1), ('present', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: ctChasFNB.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFNB.setDescription('Denotes the presence or absence of the FNB.') ct_chas_alarm_ena = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('disable', 1), ('enable', 2), ('notSupported', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ctChasAlarmEna.setStatus('mandatory') if mibBuilder.loadTexts: ctChasAlarmEna.setDescription('Allow an audible alarm to be either enabled or dis- abled. Setting this object to disable(1) will prevent an audible alarm from being heard and will also stop the sound from a current audible alarm. Setting this object to enable(2) will allow an audible alarm to be heard and will also enable the sound from a current audible alarm, if it has previously been disabled. This object will read with the current setting.') chassis_alarm_state = mib_scalar((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('chassisNoFaultCondition', 1), ('chassisFaultCondition', 2), ('notSupported', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: chassisAlarmState.setStatus('mandatory') if mibBuilder.loadTexts: chassisAlarmState.setDescription('Denotes the current condition of the power supply fault detection circuit. This object will read with the value of chassisNoFaultCondition(1) when the chassis is currently operating with no power faults detected. This object will read with the value of chassisFaultCondition(2) when the chassis is currently in a power fault condition.') ct_chas_power_table = mib_table((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1)) if mibBuilder.loadTexts: ctChasPowerTable.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerTable.setDescription('A list of power supply entries.') ct_chas_power_entry = mib_table_row((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1)).setIndexNames((0, 'CTRON-CHASSIS-MIB', 'ctChasPowerSupplyNum')) if mibBuilder.loadTexts: ctChasPowerEntry.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerEntry.setDescription('An entry in the powerTable providing objects for a power supply.') ct_chas_power_supply_num = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: ctChasPowerSupplyNum.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerSupplyNum.setDescription('Denotes the power supply.') ct_chas_power_supply_state = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('infoNotAvailable', 1), ('notInstalled', 2), ('installedAndOperating', 3), ('installedAndNotOperating', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: ctChasPowerSupplyState.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerSupplyState.setDescription("Denotes the power supply's state.") ct_chas_power_supply_type = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('ac-dc', 1), ('dc-dc', 2), ('notSupported', 3), ('highOutput', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: ctChasPowerSupplyType.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerSupplyType.setDescription('Denotes the power supply type.') ct_chas_power_supply_redundancy = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 2, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('redundant', 1), ('notRedundant', 2), ('notSupported', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: ctChasPowerSupplyRedundancy.setStatus('mandatory') if mibBuilder.loadTexts: ctChasPowerSupplyRedundancy.setDescription('Denotes whether or not the power supply is redundant.') ct_chas_fan_module_table = mib_table((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3, 1)) if mibBuilder.loadTexts: ctChasFanModuleTable.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFanModuleTable.setDescription('A list of fan module entries.') ct_chas_fan_module_entry = mib_table_row((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3, 1, 1)).setIndexNames((0, 'CTRON-CHASSIS-MIB', 'ctChasFanModuleNum')) if mibBuilder.loadTexts: ctChasFanModuleEntry.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFanModuleEntry.setDescription('An entry in the fan module Table providing objects for a fan module.') ct_chas_fan_module_num = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: ctChasFanModuleNum.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFanModuleNum.setDescription('Denotes the Fan module that may have failed.') ct_chas_fan_module_state = mib_table_column((1, 3, 6, 1, 4, 1, 52, 4, 3, 1, 3, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('infoNotAvailable', 1), ('notInstalled', 2), ('installedAndOperating', 3), ('installedAndNotOperating', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: ctChasFanModuleState.setStatus('mandatory') if mibBuilder.loadTexts: ctChasFanModuleState.setDescription('Denotes the fan modules state.') mibBuilder.exportSymbols('CTRON-CHASSIS-MIB', ctEnviron=ctEnviron, ctChasPowerSupplyNum=ctChasPowerSupplyNum, ctChasFanModuleState=ctChasFanModuleState, ctChasPowerEntry=ctChasPowerEntry, ctChasPowerSupplyState=ctChasPowerSupplyState, chassisAlarmState=chassisAlarmState, ctChasPowerSupplyType=ctChasPowerSupplyType, ctChas=ctChas, ctChasFanModuleEntry=ctChasFanModuleEntry, ctChasFanModuleTable=ctChasFanModuleTable, ctChasFNB=ctChasFNB, ctChasPowerTable=ctChasPowerTable, ctChasPowerSupplyRedundancy=ctChasPowerSupplyRedundancy, ctChasAlarmEna=ctChasAlarmEna, ctChasFanModuleNum=ctChasFanModuleNum, ctFanModule=ctFanModule)
class BaseDataset: def __init__(self, data=list()): self.data = data def __getitem__(self, idx): return self.data[idx] def __len__(self): return len(self.data)
class Basedataset: def __init__(self, data=list()): self.data = data def __getitem__(self, idx): return self.data[idx] def __len__(self): return len(self.data)
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the message will be displayed assert 'DecisionTreeClassifier' in __solution__, "Make sure you are specifying a 'DecisionTreeClassifier'." assert model.get_params()['random_state'] == 1, "Make sure you are settting the model's 'random_state' to 1." assert 'model.fit' in __solution__, "Make sure you are using the '.fit()' function to fit 'X' and 'y'." assert 'model.predict(X)' in __solution__, "Make sure you are using the model to predict on 'X'." assert list(predicted).count('Canada') == 6, "Your predicted values are incorrect. Are you fitting the model properly?" assert list(predicted).count('Both') == 8, "Your predicted values are incorrect. Are you fitting the model properly?" assert list(predicted).count('America') == 11, "Your predicted values are incorrect. Are you fitting the model properly?" __msg__.good("Nice work, well done!")
def test(): assert 'DecisionTreeClassifier' in __solution__, "Make sure you are specifying a 'DecisionTreeClassifier'." assert model.get_params()['random_state'] == 1, "Make sure you are settting the model's 'random_state' to 1." assert 'model.fit' in __solution__, "Make sure you are using the '.fit()' function to fit 'X' and 'y'." assert 'model.predict(X)' in __solution__, "Make sure you are using the model to predict on 'X'." assert list(predicted).count('Canada') == 6, 'Your predicted values are incorrect. Are you fitting the model properly?' assert list(predicted).count('Both') == 8, 'Your predicted values are incorrect. Are you fitting the model properly?' assert list(predicted).count('America') == 11, 'Your predicted values are incorrect. Are you fitting the model properly?' __msg__.good('Nice work, well done!')
def foo(): ''' >>> from mod import CamelCase as CONST ''' pass
def foo(): """ >>> from mod import CamelCase as CONST """ pass
#! python3 ############################################################################### # Copyright (c) 2021, PulseRain Technology LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (LGPL) as # published by the Free Software Foundation, either version 3 of the License, # or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################### ############################################################################### # References: # https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence ############################################################################### class PRBS: def reset(self, prbs_length, start_value): if (prbs_length == 7): self.poly = 0xC1 >> 1 elif (prbs_length == 9): self.poly = 0x221 >> 1 elif (prbs_length == 11): self.poly = 0xA01 >> 1 elif (prbs_length == 15): self.poly = 0xC001 >> 1 elif (prbs_length == 20): self.poly = 0x80005 >> 1 elif (prbs_length == 23): self.poly = 0x840001 >> 1 else: assert (prbs_length == 31) self.poly = 0xA0000001 >> 1 self.state = start_value self.prbs_length = prbs_length def __init__ (self, prbs_length, start_value): self.reset (prbs_length, start_value) def get_next (self): next_bit = 0 for i in range(self.prbs_length): if ((self.poly >> i) & 1): next_bit = next_bit ^ ((self.state >> i) & 1) self.state = ((self.state << 1) | next_bit) & ((2**(self.prbs_length + 1)) - 1) return self.state def main(): init = 2 p = PRBS (15, init) i = 0 while(1): x = p.get_next() print ("%d 0x%x" % (i, x)) if (x == init): print ("period = %d" % (i + 1)) break i = i + 1 if __name__ == "__main__": main()
class Prbs: def reset(self, prbs_length, start_value): if prbs_length == 7: self.poly = 193 >> 1 elif prbs_length == 9: self.poly = 545 >> 1 elif prbs_length == 11: self.poly = 2561 >> 1 elif prbs_length == 15: self.poly = 49153 >> 1 elif prbs_length == 20: self.poly = 524293 >> 1 elif prbs_length == 23: self.poly = 8650753 >> 1 else: assert prbs_length == 31 self.poly = 2684354561 >> 1 self.state = start_value self.prbs_length = prbs_length def __init__(self, prbs_length, start_value): self.reset(prbs_length, start_value) def get_next(self): next_bit = 0 for i in range(self.prbs_length): if self.poly >> i & 1: next_bit = next_bit ^ self.state >> i & 1 self.state = (self.state << 1 | next_bit) & 2 ** (self.prbs_length + 1) - 1 return self.state def main(): init = 2 p = prbs(15, init) i = 0 while 1: x = p.get_next() print('%d 0x%x' % (i, x)) if x == init: print('period = %d' % (i + 1)) break i = i + 1 if __name__ == '__main__': main()
class AVLNode: def __init__(self, key): self.key = key self.parent = None self.left = None self.right = None self.balance = 0 def has_left(self): return self.left is not None def has_right(self): return self.right is not None def has_no_children(self): return not (self.has_left() or self.has_right()) def is_root(self): return isinstance(self.parent, AVLTree) def is_left(self): return self is self.parent.left def is_right(self): return self is self.parent.right def is_unbalanced(self): return abs(self.balance) > 1 def set_left(self, key): self.left = AVLNode(key) self.left.parent = self self.left.update_balance() def set_right(self, key): self.right = AVLNode(key) self.right.parent = self self.right.update_balance() def update_balance(self): if self.is_unbalanced(): return self.new_balance() if not self.is_root(): parent = self.parent if self.is_left(): parent.balance += 1 elif self.is_right(): parent.balance -= 1 if parent.balance != 0: parent.update_balance() def new_balance(self): if self.balance < 0: if self.right.balance > 0: self.right.rotate_right() self.rotate_left() else: self.rotate_left() elif self.balance > 0: if self.left.balance < 0: self.left.rotate_left() self.rotate_right() else: self.rotate_right() def rotate_left(self): parent = self.parent if self.is_root(): parent.root = self.__rotate_left() elif self.is_left(): parent.left = self.__rotate_left() elif self.is_right(): parent.right = self.__rotate_left() def __rotate_left(self): pivot = self.right self.right = pivot.left if pivot.has_left(): pivot.left.parent = self pivot.left = self parent = self.parent self.parent = pivot pivot.parent = parent self.balance = self.balance + 1 - min(0, pivot.balance) pivot.balance = pivot.balance + 1 + max(0, self.balance) return pivot def rotate_right(self): parent = self.parent if self.is_root(): parent.root = self.__rotate_right() elif self.is_left(): parent.left = self.__rotate_right() elif self.is_right(): parent.right = self.__rotate_right() def __rotate_right(self): pivot = self.left self.left = pivot.right if pivot.has_right(): pivot.right.parent = self pivot.right = self parent = self.parent self.parent = pivot pivot.parent = parent self.balance = self.balance - 1 - max(0, pivot.balance) pivot.balance = pivot.balance - 1 + min(0, self.balance) return pivot def search(self, key): node = self while True: if key == node.key: return node elif key < node.key: if node.has_left(): node = node.left else: break else: if node.has_right(): node = node.right else: break def search_max(self): node = self while node.has_right(): node = node.right return node def update_balance_on_delete(self, came_from_left): if came_from_left: self.balance -= 1 else: self.balance += 1 if self.is_unbalanced(): self.new_balance() if not self.is_root(): if self.parent.balance == 0 and not self.parent.is_root(): self.parent.parent.update_balance_on_delete(self.parent.is_left()) elif self.balance == 0 and not self.is_root(): self.parent.update_balance_on_delete(self.is_left()) def delete(self, node_or_key): if isinstance(node_or_key, AVLNode): node = node_or_key else: node = self.search(node_or_key) if node is None: return parent = node.parent if node.has_no_children(): if node.is_root(): parent.root = None elif node.is_left(): parent.left = None parent.update_balance_on_delete(True) elif node.is_right(): parent.right = None parent.update_balance_on_delete(False) elif node.has_left() and not node.has_right(): if node.is_root(): parent.root = node.left node.left.parent = parent elif node.is_left(): parent.left = node.left node.left.parent = parent parent.update_balance_on_delete(True) elif node.is_right(): parent.right = node.left node.left.parent = parent parent.update_balance_on_delete(False) elif node.has_right() and not node.has_left(): if node.is_root(): parent.root = node.right node.right.parent = parent elif node.is_left(): parent.left = node.right node.right.parent = parent parent.update_balance_on_delete(True) elif node.is_right(): parent.right = node.right node.right.parent = parent parent.update_balance_on_delete(False) else: left_max = node.left.search_max() node.key = left_max.key node.left.delete(left_max) def exists(self, key): return bool(self.search(key)) def insert(self, key): tmp_node = self while True: if key == tmp_node.key: break elif key < tmp_node.key: if tmp_node.has_left(): tmp_node = tmp_node.left else: tmp_node.set_left(key) break else: if tmp_node.has_right(): tmp_node = tmp_node.right else: tmp_node.set_right(key) break @staticmethod def next(tree, x): if tree is None or (tree.key == x and not tree.has_right()): return 'none' elif tree.key > x: k = AVLNode.next(tree.left, x) if k == 'none': return tree.key else: return k elif tree.key < x: return AVLNode.next(tree.right, x) elif tree.key == x: return AVLNode.next(tree.right, x) @staticmethod def prev(tree, x): if tree is None or (tree.key == x and not tree.has_left()): return 'none' elif tree.key < x: k = AVLNode.prev(tree.right, x) if k == 'none': return tree.key else: return k elif tree.key > x: return AVLNode.prev(tree.left, x) elif tree.key == x: return AVLNode.prev(tree.left, x) @staticmethod def kth(tree, ind, nodes_lst): if tree is None or nodes_lst[0] >= ind: return 'none' left = AVLNode.kth(tree.left, ind, nodes_lst) if left != 'none': return left nodes_lst[0] += 1 if nodes_lst[0] == ind: return tree.key return AVLNode.kth(tree.right, ind, nodes_lst) class AVLTree: def __init__(self): self.root = None def is_empty(self): return self.root is None def insert(self, key): if self.is_empty(): self.root = AVLNode(key) self.root.parent = self else: self.root.insert(key) def exists(self, key): if self.is_empty(): return 'false' else: return 'true' if self.root.exists(key) else 'false' def delete(self, key): if not self.is_empty(): self.root.delete(key) def next(self, x): if not self.is_empty(): return AVLNode.next(self.root, x) else: return 'none' def prev(self, x): if not self.is_empty(): return AVLNode.prev(self.root, x) else: return 'none' def kth(self, i): if not self.is_empty(): return AVLNode.kth(self.root, i, [0]) else: return 'none' if __name__ == "__main__": root = AVLTree() while True: try: cmd, arg = input().split() except: break if cmd == 'insert': root.insert(int(arg)) elif cmd == 'delete': root.delete(int(arg)) elif cmd == 'exists': print(root.exists(int(arg))) elif cmd == 'next': print(root.next(int(arg))) elif cmd == 'prev': print(root.prev(int(arg))) elif cmd == 'kth': print(root.kth(int(arg)))
class Avlnode: def __init__(self, key): self.key = key self.parent = None self.left = None self.right = None self.balance = 0 def has_left(self): return self.left is not None def has_right(self): return self.right is not None def has_no_children(self): return not (self.has_left() or self.has_right()) def is_root(self): return isinstance(self.parent, AVLTree) def is_left(self): return self is self.parent.left def is_right(self): return self is self.parent.right def is_unbalanced(self): return abs(self.balance) > 1 def set_left(self, key): self.left = avl_node(key) self.left.parent = self self.left.update_balance() def set_right(self, key): self.right = avl_node(key) self.right.parent = self self.right.update_balance() def update_balance(self): if self.is_unbalanced(): return self.new_balance() if not self.is_root(): parent = self.parent if self.is_left(): parent.balance += 1 elif self.is_right(): parent.balance -= 1 if parent.balance != 0: parent.update_balance() def new_balance(self): if self.balance < 0: if self.right.balance > 0: self.right.rotate_right() self.rotate_left() else: self.rotate_left() elif self.balance > 0: if self.left.balance < 0: self.left.rotate_left() self.rotate_right() else: self.rotate_right() def rotate_left(self): parent = self.parent if self.is_root(): parent.root = self.__rotate_left() elif self.is_left(): parent.left = self.__rotate_left() elif self.is_right(): parent.right = self.__rotate_left() def __rotate_left(self): pivot = self.right self.right = pivot.left if pivot.has_left(): pivot.left.parent = self pivot.left = self parent = self.parent self.parent = pivot pivot.parent = parent self.balance = self.balance + 1 - min(0, pivot.balance) pivot.balance = pivot.balance + 1 + max(0, self.balance) return pivot def rotate_right(self): parent = self.parent if self.is_root(): parent.root = self.__rotate_right() elif self.is_left(): parent.left = self.__rotate_right() elif self.is_right(): parent.right = self.__rotate_right() def __rotate_right(self): pivot = self.left self.left = pivot.right if pivot.has_right(): pivot.right.parent = self pivot.right = self parent = self.parent self.parent = pivot pivot.parent = parent self.balance = self.balance - 1 - max(0, pivot.balance) pivot.balance = pivot.balance - 1 + min(0, self.balance) return pivot def search(self, key): node = self while True: if key == node.key: return node elif key < node.key: if node.has_left(): node = node.left else: break elif node.has_right(): node = node.right else: break def search_max(self): node = self while node.has_right(): node = node.right return node def update_balance_on_delete(self, came_from_left): if came_from_left: self.balance -= 1 else: self.balance += 1 if self.is_unbalanced(): self.new_balance() if not self.is_root(): if self.parent.balance == 0 and (not self.parent.is_root()): self.parent.parent.update_balance_on_delete(self.parent.is_left()) elif self.balance == 0 and (not self.is_root()): self.parent.update_balance_on_delete(self.is_left()) def delete(self, node_or_key): if isinstance(node_or_key, AVLNode): node = node_or_key else: node = self.search(node_or_key) if node is None: return parent = node.parent if node.has_no_children(): if node.is_root(): parent.root = None elif node.is_left(): parent.left = None parent.update_balance_on_delete(True) elif node.is_right(): parent.right = None parent.update_balance_on_delete(False) elif node.has_left() and (not node.has_right()): if node.is_root(): parent.root = node.left node.left.parent = parent elif node.is_left(): parent.left = node.left node.left.parent = parent parent.update_balance_on_delete(True) elif node.is_right(): parent.right = node.left node.left.parent = parent parent.update_balance_on_delete(False) elif node.has_right() and (not node.has_left()): if node.is_root(): parent.root = node.right node.right.parent = parent elif node.is_left(): parent.left = node.right node.right.parent = parent parent.update_balance_on_delete(True) elif node.is_right(): parent.right = node.right node.right.parent = parent parent.update_balance_on_delete(False) else: left_max = node.left.search_max() node.key = left_max.key node.left.delete(left_max) def exists(self, key): return bool(self.search(key)) def insert(self, key): tmp_node = self while True: if key == tmp_node.key: break elif key < tmp_node.key: if tmp_node.has_left(): tmp_node = tmp_node.left else: tmp_node.set_left(key) break elif tmp_node.has_right(): tmp_node = tmp_node.right else: tmp_node.set_right(key) break @staticmethod def next(tree, x): if tree is None or (tree.key == x and (not tree.has_right())): return 'none' elif tree.key > x: k = AVLNode.next(tree.left, x) if k == 'none': return tree.key else: return k elif tree.key < x: return AVLNode.next(tree.right, x) elif tree.key == x: return AVLNode.next(tree.right, x) @staticmethod def prev(tree, x): if tree is None or (tree.key == x and (not tree.has_left())): return 'none' elif tree.key < x: k = AVLNode.prev(tree.right, x) if k == 'none': return tree.key else: return k elif tree.key > x: return AVLNode.prev(tree.left, x) elif tree.key == x: return AVLNode.prev(tree.left, x) @staticmethod def kth(tree, ind, nodes_lst): if tree is None or nodes_lst[0] >= ind: return 'none' left = AVLNode.kth(tree.left, ind, nodes_lst) if left != 'none': return left nodes_lst[0] += 1 if nodes_lst[0] == ind: return tree.key return AVLNode.kth(tree.right, ind, nodes_lst) class Avltree: def __init__(self): self.root = None def is_empty(self): return self.root is None def insert(self, key): if self.is_empty(): self.root = avl_node(key) self.root.parent = self else: self.root.insert(key) def exists(self, key): if self.is_empty(): return 'false' else: return 'true' if self.root.exists(key) else 'false' def delete(self, key): if not self.is_empty(): self.root.delete(key) def next(self, x): if not self.is_empty(): return AVLNode.next(self.root, x) else: return 'none' def prev(self, x): if not self.is_empty(): return AVLNode.prev(self.root, x) else: return 'none' def kth(self, i): if not self.is_empty(): return AVLNode.kth(self.root, i, [0]) else: return 'none' if __name__ == '__main__': root = avl_tree() while True: try: (cmd, arg) = input().split() except: break if cmd == 'insert': root.insert(int(arg)) elif cmd == 'delete': root.delete(int(arg)) elif cmd == 'exists': print(root.exists(int(arg))) elif cmd == 'next': print(root.next(int(arg))) elif cmd == 'prev': print(root.prev(int(arg))) elif cmd == 'kth': print(root.kth(int(arg)))
# Project Euler Problem 11 # Created on: 2012-06-14 # Created by: William McDonald # Return the minimum number that can be present in # a solution set of four numbers def getMin(cap, min): k = 99 * 99 * 99 for i in range(min, 99): if i * k > cap: return i def importGrid(): f = open("problem11.txt") grid = [] for line in f: str = line lon = str.split(" ") i = 0 for n in lon: lon[i] = int(n) i += 1 grid.append(lon) f.close() return grid def transpose(g): return map(list, zip(*g)) def makeDiagGrid(g): n = [] for i in range(3, len(g)): temp = [] for j in range(i, -1, -1): temp.append(g[j][i - j]) n.append(temp) for i in range(1, len(g) - 3): temp = [] for j in range(0, len(g) - i): temp.append(g[i + j][len(g) - 1 - j]) n.append(temp) return n def getAns(): # Cursory examination: 94 * 99 * 71 * 61 max = 94 * 99 * 71 * 61 min = getMin(max, 0) udg = importGrid() lrg = transpose(udg) dg1 = makeDiagGrid(lrg) lrg.reverse() dg2 = makeDiagGrid(lrg) grids = [udg, lrg, dg1, dg2] for g in grids: prod = 1 i = 0 while i < len(g): j = 0 lst = g[i] while j < (len(lst) - 3): for k in range(4): if lst[j + k] < min: j += k break else: prod *= lst[j + k] else: if prod > max: max = prod min = getMin(max, min) j += 1 prod = 1 i += 1 return max ans = getAns() print(ans)
def get_min(cap, min): k = 99 * 99 * 99 for i in range(min, 99): if i * k > cap: return i def import_grid(): f = open('problem11.txt') grid = [] for line in f: str = line lon = str.split(' ') i = 0 for n in lon: lon[i] = int(n) i += 1 grid.append(lon) f.close() return grid def transpose(g): return map(list, zip(*g)) def make_diag_grid(g): n = [] for i in range(3, len(g)): temp = [] for j in range(i, -1, -1): temp.append(g[j][i - j]) n.append(temp) for i in range(1, len(g) - 3): temp = [] for j in range(0, len(g) - i): temp.append(g[i + j][len(g) - 1 - j]) n.append(temp) return n def get_ans(): max = 94 * 99 * 71 * 61 min = get_min(max, 0) udg = import_grid() lrg = transpose(udg) dg1 = make_diag_grid(lrg) lrg.reverse() dg2 = make_diag_grid(lrg) grids = [udg, lrg, dg1, dg2] for g in grids: prod = 1 i = 0 while i < len(g): j = 0 lst = g[i] while j < len(lst) - 3: for k in range(4): if lst[j + k] < min: j += k break else: prod *= lst[j + k] else: if prod > max: max = prod min = get_min(max, min) j += 1 prod = 1 i += 1 return max ans = get_ans() print(ans)
def get_final_line( filepath: str ) -> str: with open(filepath) as fs_r: for line in fs_r: pass return line def get_final_line__readlines( filepath: str ) -> str: with open(filepath) as fs_r: return fs_r.readlines()[-1] def main(): filepath = 'file.txt' final_line_content = get_final_line(filepath) print(f'Final line content: [{final_line_content}]') if __name__ == '__main__': main()
def get_final_line(filepath: str) -> str: with open(filepath) as fs_r: for line in fs_r: pass return line def get_final_line__readlines(filepath: str) -> str: with open(filepath) as fs_r: return fs_r.readlines()[-1] def main(): filepath = 'file.txt' final_line_content = get_final_line(filepath) print(f'Final line content: [{final_line_content}]') if __name__ == '__main__': main()
price = float(input("Digite o preco do produto: ")) discount = (5/100) * price total = price - discount print("O valor com desconto eh: {:.2f}".format(total))
price = float(input('Digite o preco do produto: ')) discount = 5 / 100 * price total = price - discount print('O valor com desconto eh: {:.2f}'.format(total))