content
stringlengths
7
1.05M
""" Downloads clang and configures the crosstool using bazel's autoconf.""" load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_autoconf_impl") load(":download_clang.bzl", "download_clang") _TF_DOWNLOAD_CLANG = "TF_DOWNLOAD_CLANG" _TF_NEED_CUDA = "TF_NEED_CUDA" def _cc_clang_autoconf(repo_ctx): if repo_ctx.os.environ.get(_TF_DOWNLOAD_CLANG) != "1": return if repo_ctx.os.environ.get(_TF_NEED_CUDA) == "1": # Clang is handled separately for CUDA configs. # See cuda_configure.bzl for more details. return download_clang(repo_ctx, out_folder = "extra_tools") overriden_tools = {"gcc": "extra_tools/bin/clang"} cc_autoconf_impl(repo_ctx, overriden_tools) cc_download_clang_toolchain = repository_rule( environ = [ _TF_DOWNLOAD_CLANG, _TF_NEED_CUDA, ], implementation = _cc_clang_autoconf, )
num1 = 100 #经理 num2 = 200 #zhangsan num3 = 300 #zhangsan
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Exceptions module ============================= """ class GPyPiException(Exception): """Core exception class, all exception inherit from this class.""" class GPyPiInvalidAtom(GPyPiException): """Raised when determining Portage Atom did not succeed.""" class GPyPiNoSetupFile(GPyPiException): """Raised if no setup.py was found.""" class GPyPiNoDistribution(GPyPiException): """Raised if unpacked directory could not be found.""" class GPyPiCouldNotUnpackEbuild(GPyPiException): """Raised if unpacking failed.""" class GPyPiInvalidParameter(GPyPiException): """Raised CLI parameter is not valid.""" class GPyPiCouldNotCreateEbuildPath(GPyPiException): """Raised when directory for an ebuild could not be created.""" class GPyPiOverlayDoesNotExist(GPyPiException): """""" class GPyPiConfigurationError(GPyPiException): """""" class GPyPiValidationError(GPyPiException): """"""
A, B = map(int, input().split()) if 6*A < B or A > B: print('No') else: print('Yes')
#!/usr/bin/env python def crearLista(): numero = int(input("Número de palabras de la lista:")) if numero < 1: print("Error. Debe ser un número >= 1") return -1 else: lista = [] for i in range(numero): print("Palabra ", str(i + 1) + ": ", end="") palabra = input() lista.append(palabra) return lista def eliminarRepetidos(lista): #Vamos a eliminar los elementos repetidos for i in range(len(lista)-1,-1,-1): #La recorremos de forma inversa porque eliminamos repetidos if lista[i] in lista[:i]: del(lista[i]) return lista def elementosComunes(lista1, lista2): comunes = [] for i in lista1: if i in lista2: comunes.append(i) return comunes def elementosSoloUnaLista(lista1,lista2): elementos = [] for i in lista1: if i not in lista2: elementos.append(i) return elementos primera = crearLista() primera = eliminarRepetidos(primera) print("Primera lista sin repetidos: ", primera) segunda = crearLista() segunda = eliminarRepetidos(segunda) print("Segunda lista sin repetidos: ", segunda) comunes = elementosComunes(primera,segunda) print("Palabras que aparecen en las dos listas: ", comunes) elementosSoloPrimera = elementosSoloUnaLista(primera, segunda) print("Palabras que aparecen sólo en la primera: ", primera) elementosSoloSegunda = elementosSoloUnaLista(segunda, primera) print("Palabras que aparecen sólo en la segunda: ", segunda)
# # PySNMP MIB module RAD-SONET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RAD-SONET-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:36:10 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") ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") PerfIntervalCount, PerfCurrentCount = mibBuilder.importSymbols("PerfHist-TC-MIB", "PerfIntervalCount", "PerfCurrentCount") diverseIfWanGen, = mibBuilder.importSymbols("RAD-MIB", "diverseIfWanGen") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") ModuleIdentity, Integer32, Gauge32, Counter32, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, TimeTicks, Unsigned32, IpAddress, iso, Bits, Counter64, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "Integer32", "Gauge32", "Counter32", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "TimeTicks", "Unsigned32", "IpAddress", "iso", "Bits", "Counter64", "ObjectIdentity") TextualConvention, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "DisplayString") sonetInterface = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2)) prtSonetPerfHistory = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1)) prtSonetMediumTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 1), ) if mibBuilder.loadTexts: prtSonetMediumTable.setStatus('current') prtSonetMediumEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex")) if mibBuilder.loadTexts: prtSonetMediumEntry.setStatus('current') prtSonetMediumTimeElapsed = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 899))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetMediumTimeElapsed.setStatus('current') prtSonetMediumValidIntervals = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 96))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetMediumValidIntervals.setStatus('current') prtSonetSectionLineCurrentTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2), ) if mibBuilder.loadTexts: prtSonetSectionLineCurrentTable.setStatus('current') prtSectionLineCurrentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex")) if mibBuilder.loadTexts: prtSectionLineCurrentEntry.setStatus('current') prtSonetCurrentLOS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLOS.setStatus('current') prtSonetCurrentLOF = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLOF.setStatus('current') prtSonetCurrentLineAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLineAIS.setStatus('current') prtSonetCurrentLineFERF = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLineFERF.setStatus('current') prtSonetCurrentSectionBIP = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 5), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentSectionBIP.setStatus('current') prtSonetCurrentLineBIP = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLineBIP.setStatus('current') prtSonetCurrentLineFEBE = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 7), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLineFEBE.setStatus('current') prtSonetCurrentUAS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 8), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentUAS.setStatus('current') prtSonetCurrentSES = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 9), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentSES.setStatus('current') prtSonetCurrentES = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 10), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentES.setStatus('current') prtSonetCurrentStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentStatus.setStatus('current') prtSonetCurrentLSV = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 2, 1, 12), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLSV.setStatus('current') prtSonetSectionLineIntervalTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3), ) if mibBuilder.loadTexts: prtSonetSectionLineIntervalTable.setStatus('current') prtSectionLineIntervalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex"), (0, "RAD-SONET-MIB", "prtSonetLineIntervalNumber")) if mibBuilder.loadTexts: prtSectionLineIntervalEntry.setStatus('current') prtSonetLineIntervalNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 96))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetLineIntervalNumber.setStatus('current') prtSonetIntervalLOS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLOS.setStatus('current') prtSonetIntervalLOF = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLOF.setStatus('current') prtSonetIntervalLineAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLineAIS.setStatus('current') prtSonetIntervalLineFERF = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 5), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLineFERF.setStatus('current') prtSonetIntervalSectionBIP = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalSectionBIP.setStatus('current') prtSonetIntervalLineBIP = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 7), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLineBIP.setStatus('current') prtSonetIntervalLineFEBE = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 8), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLineFEBE.setStatus('current') prtSonetIntervalUAS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 9), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalUAS.setStatus('current') prtSonetIntervalSES = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 10), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalSES.setStatus('current') prtSonetIntervalES = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 11), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalES.setStatus('current') prtSonetIntervalStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalStatus.setStatus('current') prtSonetIntervalLSV = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 3, 1, 13), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLSV.setStatus('current') prtSonetPathCurrentTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4), ) if mibBuilder.loadTexts: prtSonetPathCurrentTable.setStatus('current') prtPathCurrentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex")) if mibBuilder.loadTexts: prtPathCurrentEntry.setStatus('current') prtSonetCurrentPathAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4, 1, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentPathAIS.setStatus('current') prtSonetCurrentPathFERF = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4, 1, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentPathFERF.setStatus('current') prtSonetCurrentLOP = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLOP.setStatus('current') prtSonetCurrentSLM = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentSLM.setStatus('current') prtSonetCurrentLOC = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4, 1, 5), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentLOC.setStatus('current') prtSonetCurrentPathBIP = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentPathBIP.setStatus('current') prtSonetCurrentPathFEBE = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 4, 1, 7), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetCurrentPathFEBE.setStatus('current') prtSonetPathIntervalTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5), ) if mibBuilder.loadTexts: prtSonetPathIntervalTable.setStatus('current') prtPathIntervalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex"), (0, "RAD-SONET-MIB", "prtSonetPathIntervalNumber")) if mibBuilder.loadTexts: prtPathIntervalEntry.setStatus('current') prtSonetPathIntervalNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 96))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetPathIntervalNumber.setStatus('current') prtSonetIntervalPathAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalPathAIS.setStatus('current') prtSonetIntervalPathFERF = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalPathFERF.setStatus('current') prtSonetIntervalLOP = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLOP.setStatus('current') prtSonetIntervalSLM = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1, 5), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalSLM.setStatus('current') prtSonetIntervalLOC = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalLOC.setStatus('current') prtSonetIntervalPathBIP = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1, 7), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalPathBIP.setStatus('current') prtSonetIntervalPathFEBE = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 5, 1, 8), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetIntervalPathFEBE.setStatus('current') virtualIfStatistics = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6)) virtualIfCurrentTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1), ) if mibBuilder.loadTexts: virtualIfCurrentTable.setStatus('current') virtualIfCurrentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex")) if mibBuilder.loadTexts: virtualIfCurrentEntry.setStatus('current') virtualIfCurrentMinActiveVC = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 63))).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentMinActiveVC.setStatus('current') virtualIfCurrentMaxActiveVC = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 63))).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentMaxActiveVC.setStatus('current') virtualIfCurrentRxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentRxFrames.setStatus('current') virtualIfCurrentTxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentTxFrames.setStatus('current') virtualIfCurrentRxAbortFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 5), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentRxAbortFrames.setStatus('current') virtualIfCurrentTxAbortFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 6), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentTxAbortFrames.setStatus('current') virtualIfCurrentMinLengthViolation = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 7), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentMinLengthViolation.setStatus('current') virtualIfCurrentMaxLengthViolation = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 8), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentMaxLengthViolation.setStatus('current') virtualIfCurrentFcsError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 9), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentFcsError.setStatus('current') virtualIfCurrentByteDestuffingViolation = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 10), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentByteDestuffingViolation.setStatus('current') virtualIfCurrentAdressMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 11), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentAdressMismatch.setStatus('current') virtualIfCurrentControlMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 12), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentControlMismatch.setStatus('current') virtualIfCurrentActiveVC = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfCurrentActiveVC.setStatus('current') virtualIfIntervalTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2), ) if mibBuilder.loadTexts: virtualIfIntervalTable.setStatus('current') virtualIfIntervalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex"), (0, "RAD-SONET-MIB", "virtualIfIntervalNumber")) if mibBuilder.loadTexts: virtualIfIntervalEntry.setStatus('current') virtualIfIntervalNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 96))) if mibBuilder.loadTexts: virtualIfIntervalNumber.setStatus('current') virtualIfIntervalMinActiveVC = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalMinActiveVC.setStatus('current') virtualIfIntervalMaxActiveVC = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalMaxActiveVC.setStatus('current') virtualIfIntervalRxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalRxFrames.setStatus('current') virtualIfIntervalTxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalTxFrames.setStatus('current') virtualIfIntervalRxAbortFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 6), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalRxAbortFrames.setStatus('current') virtualIfIntervalTxAbortFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 7), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalTxAbortFrames.setStatus('current') virtualIfIntervalMinLengthViolation = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 8), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalMinLengthViolation.setStatus('current') virtualIfIntervalMaxLengthViolation = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 9), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalMaxLengthViolation.setStatus('current') virtualIfIntervalFcsError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 10), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalFcsError.setStatus('current') virtualIfIntervalByteDestuffingViolation = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 11), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalByteDestuffingViolation.setStatus('current') virtualIfIntervalAdressMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 12), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalAdressMismatch.setStatus('current') virtualIfIntervalControlMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 13), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalControlMismatch.setStatus('current') virtualIfIntervalBelowMinThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 2, 1, 14), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfIntervalBelowMinThreshold.setStatus('current') virtualIfLAPSCurrentTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 3), ) if mibBuilder.loadTexts: virtualIfLAPSCurrentTable.setStatus('current') virtualIfLAPSCurrentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 3, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex")) if mibBuilder.loadTexts: virtualIfLAPSCurrentEntry.setStatus('current') virtualIfLAPSCurrentSapiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 3, 1, 1), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPSCurrentSapiMismatch.setStatus('current') virtualIfLAPSIntervalTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 4), ) if mibBuilder.loadTexts: virtualIfLAPSIntervalTable.setStatus('current') virtualIfLAPSIntervalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 4, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex"), (0, "RAD-SONET-MIB", "virtualIfIntervalNumber")) if mibBuilder.loadTexts: virtualIfLAPSIntervalEntry.setStatus('current') virtualIfLAPSIntervalSapiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 4, 1, 1), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPSIntervalSapiMismatch.setStatus('current') virtualIfLAPFCurrentTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 5), ) if mibBuilder.loadTexts: virtualIfLAPFCurrentTable.setStatus('current') virtualIfLAPFCurrentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 5, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex")) if mibBuilder.loadTexts: virtualIfLAPFCurrentEntry.setStatus('current') virtualIfLAPFCurrentNlpidMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 5, 1, 1), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFCurrentNlpidMismatch.setStatus('current') virtualIfLAPFCurrentOuiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 5, 1, 2), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFCurrentOuiMismatch.setStatus('current') virtualIfLAPFCurrentPidMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 5, 1, 3), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFCurrentPidMismatch.setStatus('current') virtualIfLAPFCurrentDlciMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 5, 1, 4), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFCurrentDlciMismatch.setStatus('current') virtualIfLAPFCurrentMacRxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 5, 1, 5), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFCurrentMacRxFrames.setStatus('current') virtualIfLAPFCurrentMacTxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 5, 1, 6), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFCurrentMacTxFrames.setStatus('current') virtualIfLAPFIntervalTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 6), ) if mibBuilder.loadTexts: virtualIfLAPFIntervalTable.setStatus('current') virtualIfLAPFIntervalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 6, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex"), (0, "RAD-SONET-MIB", "virtualIfIntervalNumber")) if mibBuilder.loadTexts: virtualIfLAPFIntervalEntry.setStatus('current') virtualIfLAPFIntervalNlpidMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 6, 1, 1), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFIntervalNlpidMismatch.setStatus('current') virtualIfLAPFIntervalOuiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 6, 1, 2), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFIntervalOuiMismatch.setStatus('current') virtualIfLAPFIntervalPidMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 6, 1, 3), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFIntervalPidMismatch.setStatus('current') virtualIfLAPFIntervalDlciMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 6, 1, 4), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFIntervalDlciMismatch.setStatus('current') virtualIfLAPFIntervalMacRxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 6, 1, 5), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFIntervalMacRxFrames.setStatus('current') virtualIfLAPFIntervalMacTxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 6, 1, 6), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfLAPFIntervalMacTxFrames.setStatus('current') virtualIfGFPCurrentTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7), ) if mibBuilder.loadTexts: virtualIfGFPCurrentTable.setStatus('current') virtualIfGFPCurrentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex")) if mibBuilder.loadTexts: virtualIfGFPCurrentEntry.setStatus('current') virtualIfGFPCurrentIdleFrameError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 1), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentIdleFrameError.setStatus('current') virtualIfGFPCurrentCHecSbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 2), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentCHecSbError.setStatus('current') virtualIfGFPCurrentPtiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 3), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentPtiMismatch.setStatus('current') virtualIfGFPCurrentExiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 4), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentExiMismatch.setStatus('current') virtualIfGFPCurrentUpiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 5), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentUpiMismatch.setStatus('current') virtualIfGFPCurrentTHecSbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 6), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentTHecSbError.setStatus('current') virtualIfGFPCurrentTHecMbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 7), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentTHecMbError.setStatus('current') virtualIfGFPCurrentCidMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 8), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentCidMismatch.setStatus('current') virtualIfGFPCurrentEHecSbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 9), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentEHecSbError.setStatus('current') virtualIfGFPCurrentEHecMbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 7, 1, 10), PerfCurrentCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPCurrentEHecMbError.setStatus('current') virtualIfGFPIntervalTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8), ) if mibBuilder.loadTexts: virtualIfGFPIntervalTable.setStatus('current') virtualIfGFPIntervalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1), ).setIndexNames((0, "RAD-SONET-MIB", "ifIndex"), (0, "RAD-SONET-MIB", "virtualIfIntervalNumber")) if mibBuilder.loadTexts: virtualIfGFPIntervalEntry.setStatus('current') virtualIfGFPIntervalIdleFrameError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 1), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalIdleFrameError.setStatus('current') virtualIfGFPIntervalCHecSbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 2), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalCHecSbError.setStatus('current') virtualIfGFPIntervalPtiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 3), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalPtiMismatch.setStatus('current') virtualIfGFPIntervalExiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 4), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalExiMismatch.setStatus('current') virtualIfGFPIntervalUpiMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 5), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalUpiMismatch.setStatus('current') virtualIfGFPIntervalTHecSbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 6), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalTHecSbError.setStatus('current') virtualIfGFPIntervalTHecMbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 7), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalTHecMbError.setStatus('current') virtualIfGFPIntervalCidMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 8), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalCidMismatch.setStatus('current') virtualIfGFPIntervalEHecSbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 9), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalEHecSbError.setStatus('current') virtualIfGFPIntervalEHecMbError = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 1, 6, 8, 1, 10), PerfIntervalCount()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGFPIntervalEHecMbError.setStatus('current') prtSonetConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2)) prtSonetGen = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 1)) prtSonetGenTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 1, 1), ) if mibBuilder.loadTexts: prtSonetGenTable.setStatus('current') prtSonetGenEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 1, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "prtSonetGenCnfgIdx"), (0, "RAD-SONET-MIB", "prtSonetGenIdx")) if mibBuilder.loadTexts: prtSonetGenEntry.setStatus('current') prtSonetGenCnfgIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetGenCnfgIdx.setStatus('current') prtSonetGenIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 1, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetGenIdx.setStatus('current') prtSonetGenSdThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("notApplicable", 1), ("n3", 3), ("n4", 4), ("n5", 5), ("n6", 6), ("n7", 7), ("n8", 8), ("n9", 9)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetGenSdThreshold.setStatus('current') prtSonetGenEedThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("notApplicable", 1), ("n3", 3), ("n4", 4), ("n5", 5), ("n6", 6), ("n7", 7), ("n8", 8), ("n9", 9)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetGenEedThreshold.setStatus('current') prtSonetGenBerEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("disable", 2), ("enable", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetGenBerEnable.setStatus('current') prtSonetStm1 = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2)) prtSonetStm1Table = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1), ) if mibBuilder.loadTexts: prtSonetStm1Table.setStatus('current') prtSonetStm1Entry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "prtSonetStm1CnfgIdx"), (0, "RAD-SONET-MIB", "prtSonetStm1Idx")) if mibBuilder.loadTexts: prtSonetStm1Entry.setStatus('current') prtSonetStm1CnfgIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetStm1CnfgIdx.setStatus('current') prtSonetStm1Idx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetStm1Idx.setStatus('current') prtSonetStm1ClockSrc = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notApplicable", 1), ("internal", 2), ("lbt", 3), ("systemClk", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1ClockSrc.setStatus('current') prtSonetStm1DccMode = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16))).clone(namedValues=NamedValues(("notApplicable", 1), ("none", 2), ("d1ToD3", 3), ("d4ToD12", 4), ("d1", 5), ("d2", 6), ("d3", 7), ("d4", 8), ("d5", 9), ("d6", 10), ("d7", 11), ("d8", 12), ("d9", 13), ("d10", 14), ("d11", 15), ("d12", 16)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1DccMode.setStatus('current') prtSonetStm1RoutingProt = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notApplicable", 1), ("none", 2), ("proprietary", 3), ("rip2", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1RoutingProt.setStatus('current') prtSonetStm1MngProt = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 3, 5, 6, 7, 8))).clone(namedValues=NamedValues(("notApplicable", 1), ("proprietary", 3), ("ppp", 5), ("frameRelay", 6), ("hdlc", 7), ("lapdOverHdlc", 8)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1MngProt.setStatus('current') prtSonetStm1OperationalMode = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notApplicable", 1), ("terminal", 2), ("linear", 3), ("linearProtection", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1OperationalMode.setStatus('current') prtSonetStm1VoiceChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notApplicable", 1), ("none", 2), ("e1Byte", 3), ("e2Byte", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1VoiceChannel.setStatus('current') prtSonetStm1OutputRate = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1OutputRate.setStatus('current') prtSonetStm1S1ProtocolClock = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notApplicable", 1), ("disable", 2), ("enable", 3), ("transparent", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1S1ProtocolClock.setStatus('current') prtSonetStm1GatewayRingSubnetAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1GatewayRingSubnetAddress.setStatus('current') prtSonetStm1GatewayRingSubnetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 12), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1GatewayRingSubnetMask.setStatus('current') prtSonetStm1MngProtDeviationType = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 2, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("standard", 2), ("type1", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetStm1MngProtDeviationType.setStatus('current') prtSonetVc = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3)) prtSonetVcTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1), ) if mibBuilder.loadTexts: prtSonetVcTable.setStatus('current') prtSonetVcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "prtSonetVcCnfgIdx"), (0, "RAD-SONET-MIB", "prtSonetVcIdx")) if mibBuilder.loadTexts: prtSonetVcEntry.setStatus('current') prtSonetVcCnfgIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetVcCnfgIdx.setStatus('current') prtSonetVcIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetVcIdx.setStatus('current') prtSonetVcJTxPathTraceEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("disable", 2), ("enable", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetVcJTxPathTraceEnable.setStatus('current') prtSonetVcJRxPathTraceEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("disable", 2), ("enable", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetVcJRxPathTraceEnable.setStatus('current') prtSonetVcJPathTrace = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 62))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetVcJPathTrace.setStatus('current') prtSonetVcConnect = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("no", 2), ("yes", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetVcConnect.setStatus('current') prtSonetVcSignalLabel = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 1, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: prtSonetVcSignalLabel.setStatus('current') prtSonetTuTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2), ) if mibBuilder.loadTexts: prtSonetTuTable.setStatus('current') prtSonetTuEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2, 1), ).setIndexNames((0, "RAD-SONET-MIB", "prtSonetTuCnfgIdx"), (0, "RAD-SONET-MIB", "prtSonetTuPrtIdx"), (0, "RAD-SONET-MIB", "prtSonetTuIdx"), (0, "RAD-SONET-MIB", "prtSonetTuConPrtIdx")) if mibBuilder.loadTexts: prtSonetTuEntry.setStatus('current') prtSonetTuCnfgIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetTuCnfgIdx.setStatus('current') prtSonetTuPrtIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetTuPrtIdx.setStatus('current') prtSonetTuIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetTuIdx.setStatus('current') prtSonetTuConPrtIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetTuConPrtIdx.setStatus('current') prtSonetTuType = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 3))).clone(namedValues=NamedValues(("connect", 2), ("bypass", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: prtSonetTuType.setStatus('current') prtSonetTuMode = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("addAndDrop", 2), ("add", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: prtSonetTuMode.setStatus('current') prtSonetTuRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 3, 2, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: prtSonetTuRowStatus.setStatus('current') prtSonetXConnect = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3)) prtSonetXConnectTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1), ) if mibBuilder.loadTexts: prtSonetXConnectTable.setStatus('current') prtSonetXConnectEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "prtSonetXConnectCnfgIdx"), (0, "RAD-SONET-MIB", "prtSonetXConnectPrtIdx"), (0, "RAD-SONET-MIB", "prtSonetXConnectConPrtIdx"), (0, "RAD-SONET-MIB", "prtSonetXConnectAUGIdx"), (0, "RAD-SONET-MIB", "prtSonetXConnectTUG3Idx"), (0, "RAD-SONET-MIB", "prtSonetXConnectTUG2Idx"), (0, "RAD-SONET-MIB", "prtSonetXConnectTUnIdx")) if mibBuilder.loadTexts: prtSonetXConnectEntry.setStatus('current') prtSonetXConnectCnfgIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetXConnectCnfgIdx.setStatus('current') prtSonetXConnectPrtIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetXConnectPrtIdx.setStatus('current') prtSonetXConnectConPrtIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetXConnectConPrtIdx.setStatus('current') prtSonetXConnectAUGIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetXConnectAUGIdx.setStatus('current') prtSonetXConnectTUG3Idx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetXConnectTUG3Idx.setStatus('current') prtSonetXConnectTUG2Idx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetXConnectTUG2Idx.setStatus('current') prtSonetXConnectTUnIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetXConnectTUnIdx.setStatus('current') prtSonetXConnectRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: prtSonetXConnectRowStatus.setStatus('current') prtSonetXConnectDirection = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notApplicable", 1), ("rx", 2), ("tx", 3), ("both", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: prtSonetXConnectDirection.setStatus('current') prtSonetXConnectTuNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 3, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("notApplicable", 1), ("tu2", 2), ("tu3", 3), ("tu11", 4), ("tu12", 5)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: prtSonetXConnectTuNumber.setStatus('current') prtSonetStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 4)) prtSonetVcStatTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 4, 1), ) if mibBuilder.loadTexts: prtSonetVcStatTable.setStatus('current') prtSonetVcStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 4, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "prtSonetVcIdx")) if mibBuilder.loadTexts: prtSonetVcStatEntry.setStatus('current') prtSonetVcRxJPathTrace = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 4, 1, 1, 1), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 62))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetVcRxJPathTrace.setStatus('current') prtSonetVcRxSignalLabel = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 4, 1, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1)).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetVcRxSignalLabel.setStatus('current') prtSonetVcLcasSourceState = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 4, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("notApplicable", 1), ("fixed", 2), ("add", 3), ("norm", 4), ("eos", 5), ("idle", 6), ("dnu", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetVcLcasSourceState.setStatus('current') prtSonetVcLcasSinkState = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 4, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("notApplicable", 1), ("fixed", 2), ("add", 3), ("norm", 4), ("eos", 5), ("idle", 6), ("dnu", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: prtSonetVcLcasSinkState.setStatus('current') prtVcGroupCnfg = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4)) vcGroupCnfgTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1), ) if mibBuilder.loadTexts: vcGroupCnfgTable.setStatus('current') vcGroupCnfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "vcGroupCnfgIdx"), (0, "RAD-SONET-MIB", "vcGroupCnfgNumber")) if mibBuilder.loadTexts: vcGroupCnfgEntry.setStatus('current') vcGroupCnfgIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))) if mibBuilder.loadTexts: vcGroupCnfgIdx.setStatus('current') vcGroupCnfgNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 2), Integer32()) if mibBuilder.loadTexts: vcGroupCnfgNumber.setStatus('current') vcGroupCnfgRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgRowStatus.setStatus('current') vcGroupCnfgVcType = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("notApplicable", 1), ("vc12", 2), ("vc3", 3), ("vc4", 4), ("vt1dot5", 5), ("sts1", 6)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgVcType.setStatus('current') vcGroupCnfgNoOfVCs = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 84))).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgNoOfVCs.setStatus('current') vcGroupCnfgLCAS = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("lcasNotActive", 2), ("lcasActive", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgLCAS.setStatus('current') vcGroupCnfgEncapsulation = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notApplicable", 1), ("laps", 2), ("lapf", 3), ("gfp", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgEncapsulation.setStatus('current') vcGroupCnfgGroupIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 8), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: vcGroupCnfgGroupIfIndex.setStatus('current') vcGroupCnfgRip2 = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("no", 2), ("yes", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgRip2.setStatus('current') vcGroupCnfgGfpChId = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgGfpChId.setStatus('current') vcGroupCnfgK4 = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("no", 2), ("yes", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgK4.setStatus('current') vcGroupCnfgExSignalLabel = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1)).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgExSignalLabel.setStatus('current') vcGroupCnfgLcasMinNoOfVCs = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 83))).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcGroupCnfgLcasMinNoOfVCs.setStatus('current') vcGroupCnfgLcasStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 1, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notApplicable", 1), ("belowMinNoOfVCs", 2), ("withinRange", 3), ("allNorm", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: vcGroupCnfgLcasStatus.setStatus('current') vcgGfpMuxCnfgTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 2), ) if mibBuilder.loadTexts: vcgGfpMuxCnfgTable.setStatus('current') vcgGfpMuxCnfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 2, 1), ).setIndexNames((0, "RAD-SONET-MIB", "vcgGfpMuxCnfgIdx"), (0, "RAD-SONET-MIB", "vcgGfpMuxCnfgMuxNumber")) if mibBuilder.loadTexts: vcgGfpMuxCnfgEntry.setStatus('current') vcgGfpMuxCnfgIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))) if mibBuilder.loadTexts: vcgGfpMuxCnfgIdx.setStatus('current') vcgGfpMuxCnfgMuxNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 2, 1, 2), Integer32()) if mibBuilder.loadTexts: vcgGfpMuxCnfgMuxNumber.setStatus('current') vcgGfpMuxCnfgRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 2, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcgGfpMuxCnfgRowStatus.setStatus('current') vcgGfpMuxCnfgMuxName = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 2, 1, 4), SnmpAdminString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcgGfpMuxCnfgMuxName.setStatus('current') vcgGfpMuxCnfgPrimeGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 2, 1, 5), Integer32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcgGfpMuxCnfgPrimeGroup.setStatus('current') vcgGfpMuxCnfgGrpBwAlloc = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 4, 2, 1, 6), OctetString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: vcgGfpMuxCnfgGrpBwAlloc.setStatus('current') virtualIfConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 5)) virtualIfGenTable = MibTable((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 5, 1), ) if mibBuilder.loadTexts: virtualIfGenTable.setStatus('current') virtualIfGenEntry = MibTableRow((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 5, 1, 1), ).setIndexNames((0, "RAD-SONET-MIB", "virtualIfGenCnfgIdx"), (0, "RAD-SONET-MIB", "virtualIfGenIdx")) if mibBuilder.loadTexts: virtualIfGenEntry.setStatus('current') virtualIfGenCnfgIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 5, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGenCnfgIdx.setStatus('current') virtualIfGenIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 5, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: virtualIfGenIdx.setStatus('current') virtualIfGenFrameFormat = MibTableColumn((1, 3, 6, 1, 4, 1, 164, 3, 1, 6, 2, 2, 5, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notApplicable", 1), ("fcsEnable", 2), ("fcsDisable", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: virtualIfGenFrameFormat.setStatus('current') mibBuilder.exportSymbols("RAD-SONET-MIB", virtualIfIntervalByteDestuffingViolation=virtualIfIntervalByteDestuffingViolation, virtualIfGFPCurrentPtiMismatch=virtualIfGFPCurrentPtiMismatch, prtPathIntervalEntry=prtPathIntervalEntry, virtualIfLAPFCurrentEntry=virtualIfLAPFCurrentEntry, virtualIfGFPCurrentEHecSbError=virtualIfGFPCurrentEHecSbError, vcgGfpMuxCnfgPrimeGroup=vcgGfpMuxCnfgPrimeGroup, prtSonetTuRowStatus=prtSonetTuRowStatus, vcgGfpMuxCnfgMuxName=vcgGfpMuxCnfgMuxName, virtualIfGFPIntervalCHecSbError=virtualIfGFPIntervalCHecSbError, prtSonetXConnectTable=prtSonetXConnectTable, sonetInterface=sonetInterface, virtualIfCurrentTxAbortFrames=virtualIfCurrentTxAbortFrames, prtSonetCurrentLineBIP=prtSonetCurrentLineBIP, virtualIfIntervalAdressMismatch=virtualIfIntervalAdressMismatch, virtualIfGFPCurrentEHecMbError=virtualIfGFPCurrentEHecMbError, prtSonetPathIntervalNumber=prtSonetPathIntervalNumber, prtSonetCurrentLineAIS=prtSonetCurrentLineAIS, virtualIfGFPCurrentTable=virtualIfGFPCurrentTable, prtPathCurrentEntry=prtPathCurrentEntry, prtSonetCurrentPathFERF=prtSonetCurrentPathFERF, virtualIfGenCnfgIdx=virtualIfGenCnfgIdx, prtSonetCurrentUAS=prtSonetCurrentUAS, prtSonetIntervalPathAIS=prtSonetIntervalPathAIS, virtualIfGFPIntervalTable=virtualIfGFPIntervalTable, vcGroupCnfgLCAS=vcGroupCnfgLCAS, vcgGfpMuxCnfgIdx=vcgGfpMuxCnfgIdx, prtSonetIntervalLineAIS=prtSonetIntervalLineAIS, virtualIfIntervalNumber=virtualIfIntervalNumber, virtualIfStatistics=virtualIfStatistics, virtualIfLAPFIntervalMacRxFrames=virtualIfLAPFIntervalMacRxFrames, virtualIfIntervalTxFrames=virtualIfIntervalTxFrames, prtSonetCurrentPathAIS=prtSonetCurrentPathAIS, virtualIfGFPCurrentCHecSbError=virtualIfGFPCurrentCHecSbError, virtualIfLAPFCurrentMacTxFrames=virtualIfLAPFCurrentMacTxFrames, prtSonetStm1ClockSrc=prtSonetStm1ClockSrc, prtSonetXConnectDirection=prtSonetXConnectDirection, vcGroupCnfgGroupIfIndex=vcGroupCnfgGroupIfIndex, prtSonetVcLcasSourceState=prtSonetVcLcasSourceState, prtSonetCurrentPathFEBE=prtSonetCurrentPathFEBE, prtSonetIntervalLSV=prtSonetIntervalLSV, virtualIfGFPIntervalExiMismatch=virtualIfGFPIntervalExiMismatch, vcgGfpMuxCnfgMuxNumber=vcgGfpMuxCnfgMuxNumber, virtualIfCurrentActiveVC=virtualIfCurrentActiveVC, prtSonetCurrentLOS=prtSonetCurrentLOS, virtualIfIntervalMinLengthViolation=virtualIfIntervalMinLengthViolation, prtSonetStm1MngProt=prtSonetStm1MngProt, prtSonetVcCnfgIdx=prtSonetVcCnfgIdx, prtSonetStm1GatewayRingSubnetMask=prtSonetStm1GatewayRingSubnetMask, prtSonetCurrentLOF=prtSonetCurrentLOF, prtSonetIntervalLineFERF=prtSonetIntervalLineFERF, prtSonetCurrentLOP=prtSonetCurrentLOP, prtSonetVcJPathTrace=prtSonetVcJPathTrace, virtualIfGFPCurrentUpiMismatch=virtualIfGFPCurrentUpiMismatch, prtSonetVcIdx=prtSonetVcIdx, virtualIfCurrentRxAbortFrames=virtualIfCurrentRxAbortFrames, prtSonetCurrentLSV=prtSonetCurrentLSV, virtualIfLAPFCurrentDlciMismatch=virtualIfLAPFCurrentDlciMismatch, virtualIfLAPSCurrentSapiMismatch=virtualIfLAPSCurrentSapiMismatch, prtSonetIntervalSLM=prtSonetIntervalSLM, prtSonetIntervalLOC=prtSonetIntervalLOC, virtualIfCurrentAdressMismatch=virtualIfCurrentAdressMismatch, prtSectionLineIntervalEntry=prtSectionLineIntervalEntry, virtualIfGFPCurrentCidMismatch=virtualIfGFPCurrentCidMismatch, virtualIfIntervalMinActiveVC=virtualIfIntervalMinActiveVC, prtSonetCurrentStatus=prtSonetCurrentStatus, virtualIfLAPSCurrentTable=virtualIfLAPSCurrentTable, virtualIfLAPFCurrentPidMismatch=virtualIfLAPFCurrentPidMismatch, virtualIfCurrentMaxActiveVC=virtualIfCurrentMaxActiveVC, virtualIfGFPIntervalUpiMismatch=virtualIfGFPIntervalUpiMismatch, prtSonetTuTable=prtSonetTuTable, virtualIfCurrentMinActiveVC=virtualIfCurrentMinActiveVC, prtSonetXConnectConPrtIdx=prtSonetXConnectConPrtIdx, vcgGfpMuxCnfgGrpBwAlloc=vcgGfpMuxCnfgGrpBwAlloc, prtSonetPathIntervalTable=prtSonetPathIntervalTable, virtualIfLAPFCurrentOuiMismatch=virtualIfLAPFCurrentOuiMismatch, prtSonetStm1Entry=prtSonetStm1Entry, vcgGfpMuxCnfgTable=vcgGfpMuxCnfgTable, virtualIfIntervalTable=virtualIfIntervalTable, prtSonetXConnectTUG2Idx=prtSonetXConnectTUG2Idx, prtSonetStm1Idx=prtSonetStm1Idx, prtSonetIntervalLineBIP=prtSonetIntervalLineBIP, prtSonetCurrentSES=prtSonetCurrentSES, prtSonetCurrentPathBIP=prtSonetCurrentPathBIP, virtualIfIntervalRxAbortFrames=virtualIfIntervalRxAbortFrames, vcGroupCnfgEncapsulation=vcGroupCnfgEncapsulation, prtSonetXConnectTuNumber=prtSonetXConnectTuNumber, prtSonetVcRxSignalLabel=prtSonetVcRxSignalLabel, virtualIfLAPSCurrentEntry=virtualIfLAPSCurrentEntry, virtualIfConfiguration=virtualIfConfiguration, virtualIfGFPIntervalEHecMbError=virtualIfGFPIntervalEHecMbError, prtSonetIntervalSectionBIP=prtSonetIntervalSectionBIP, prtSonetCurrentLOC=prtSonetCurrentLOC, prtSonetGenEntry=prtSonetGenEntry, prtSonetPathCurrentTable=prtSonetPathCurrentTable, virtualIfLAPSIntervalSapiMismatch=virtualIfLAPSIntervalSapiMismatch, virtualIfLAPSIntervalEntry=virtualIfLAPSIntervalEntry, virtualIfLAPFIntervalEntry=virtualIfLAPFIntervalEntry, prtSonetVcEntry=prtSonetVcEntry, prtSonetStm1OutputRate=prtSonetStm1OutputRate, prtSonetTuPrtIdx=prtSonetTuPrtIdx, prtSonetVcStatTable=prtSonetVcStatTable, prtSonetSectionLineCurrentTable=prtSonetSectionLineCurrentTable, vcGroupCnfgLcasMinNoOfVCs=vcGroupCnfgLcasMinNoOfVCs, virtualIfLAPFIntervalNlpidMismatch=virtualIfLAPFIntervalNlpidMismatch, virtualIfCurrentEntry=virtualIfCurrentEntry, prtSonetVcTable=prtSonetVcTable, prtSonetTuEntry=prtSonetTuEntry, prtSonetXConnectPrtIdx=prtSonetXConnectPrtIdx, prtSonetXConnectEntry=prtSonetXConnectEntry, virtualIfGenTable=virtualIfGenTable, prtSonetGenBerEnable=prtSonetGenBerEnable, virtualIfIntervalMaxActiveVC=virtualIfIntervalMaxActiveVC, virtualIfLAPFCurrentTable=virtualIfLAPFCurrentTable, vcGroupCnfgLcasStatus=vcGroupCnfgLcasStatus, virtualIfGenFrameFormat=virtualIfGenFrameFormat, prtSonetIntervalLOS=prtSonetIntervalLOS, vcGroupCnfgNoOfVCs=vcGroupCnfgNoOfVCs, vcGroupCnfgK4=vcGroupCnfgK4, prtSonetIntervalLOF=prtSonetIntervalLOF, prtSonetVcConnect=prtSonetVcConnect, prtSonetStatus=prtSonetStatus, prtSonetStm1VoiceChannel=prtSonetStm1VoiceChannel, prtSonetCurrentSLM=prtSonetCurrentSLM, prtSonetStm1OperationalMode=prtSonetStm1OperationalMode, vcgGfpMuxCnfgEntry=vcgGfpMuxCnfgEntry, virtualIfGFPCurrentEntry=virtualIfGFPCurrentEntry, prtSonetXConnectTUnIdx=prtSonetXConnectTUnIdx, prtSonetMediumEntry=prtSonetMediumEntry, prtSonetStm1RoutingProt=prtSonetStm1RoutingProt, prtSonetSectionLineIntervalTable=prtSonetSectionLineIntervalTable, prtSonetTuType=prtSonetTuType, virtualIfGFPIntervalIdleFrameError=virtualIfGFPIntervalIdleFrameError, prtSonetIntervalLOP=prtSonetIntervalLOP, prtSonetStm1Table=prtSonetStm1Table, prtSonetVc=prtSonetVc, virtualIfCurrentRxFrames=virtualIfCurrentRxFrames, prtSonetVcLcasSinkState=prtSonetVcLcasSinkState, virtualIfGFPCurrentIdleFrameError=virtualIfGFPCurrentIdleFrameError, prtSonetIntervalPathFEBE=prtSonetIntervalPathFEBE, prtSonetCurrentLineFERF=prtSonetCurrentLineFERF, prtSonetVcSignalLabel=prtSonetVcSignalLabel, prtSonetVcJRxPathTraceEnable=prtSonetVcJRxPathTraceEnable, prtSonetLineIntervalNumber=prtSonetLineIntervalNumber, prtSonetIntervalPathBIP=prtSonetIntervalPathBIP, virtualIfGFPCurrentTHecSbError=virtualIfGFPCurrentTHecSbError, prtSonetStm1CnfgIdx=prtSonetStm1CnfgIdx, prtSonetStm1DccMode=prtSonetStm1DccMode, prtSonetStm1S1ProtocolClock=prtSonetStm1S1ProtocolClock, prtSonetTuConPrtIdx=prtSonetTuConPrtIdx, vcGroupCnfgVcType=vcGroupCnfgVcType, virtualIfLAPFIntervalMacTxFrames=virtualIfLAPFIntervalMacTxFrames, virtualIfCurrentTable=virtualIfCurrentTable, vcGroupCnfgEntry=vcGroupCnfgEntry, prtSonetGenSdThreshold=prtSonetGenSdThreshold, prtSonetIntervalUAS=prtSonetIntervalUAS, virtualIfGFPCurrentTHecMbError=virtualIfGFPCurrentTHecMbError, virtualIfCurrentTxFrames=virtualIfCurrentTxFrames, prtSonetIntervalSES=prtSonetIntervalSES, virtualIfLAPFIntervalTable=virtualIfLAPFIntervalTable, prtSonetXConnectCnfgIdx=prtSonetXConnectCnfgIdx, prtSonetCurrentLineFEBE=prtSonetCurrentLineFEBE, prtSonetVcStatEntry=prtSonetVcStatEntry, virtualIfIntervalBelowMinThreshold=virtualIfIntervalBelowMinThreshold, virtualIfCurrentFcsError=virtualIfCurrentFcsError, virtualIfLAPFCurrentMacRxFrames=virtualIfLAPFCurrentMacRxFrames, virtualIfGFPIntervalPtiMismatch=virtualIfGFPIntervalPtiMismatch, virtualIfIntervalRxFrames=virtualIfIntervalRxFrames, prtSonetGenTable=prtSonetGenTable, virtualIfGFPIntervalCidMismatch=virtualIfGFPIntervalCidMismatch, prtSonetXConnectTUG3Idx=prtSonetXConnectTUG3Idx, prtSonetStm1=prtSonetStm1, virtualIfIntervalControlMismatch=virtualIfIntervalControlMismatch, prtSonetIntervalES=prtSonetIntervalES, prtSonetConfig=prtSonetConfig, prtSonetXConnect=prtSonetXConnect, virtualIfGFPIntervalEHecSbError=virtualIfGFPIntervalEHecSbError, vcGroupCnfgIdx=vcGroupCnfgIdx, vcGroupCnfgExSignalLabel=vcGroupCnfgExSignalLabel, vcGroupCnfgNumber=vcGroupCnfgNumber, virtualIfIntervalMaxLengthViolation=virtualIfIntervalMaxLengthViolation, prtSonetMediumValidIntervals=prtSonetMediumValidIntervals, prtSonetTuMode=prtSonetTuMode, prtSonetCurrentSectionBIP=prtSonetCurrentSectionBIP, virtualIfIntervalFcsError=virtualIfIntervalFcsError, virtualIfCurrentMinLengthViolation=virtualIfCurrentMinLengthViolation, virtualIfCurrentControlMismatch=virtualIfCurrentControlMismatch, virtualIfGFPIntervalTHecSbError=virtualIfGFPIntervalTHecSbError, prtSonetXConnectAUGIdx=prtSonetXConnectAUGIdx, vcGroupCnfgGfpChId=vcGroupCnfgGfpChId, virtualIfGenEntry=virtualIfGenEntry, virtualIfLAPFCurrentNlpidMismatch=virtualIfLAPFCurrentNlpidMismatch, prtSonetStm1GatewayRingSubnetAddress=prtSonetStm1GatewayRingSubnetAddress, prtSonetIntervalPathFERF=prtSonetIntervalPathFERF, virtualIfCurrentByteDestuffingViolation=virtualIfCurrentByteDestuffingViolation, prtSonetGenCnfgIdx=prtSonetGenCnfgIdx, prtSonetPerfHistory=prtSonetPerfHistory, prtSonetMediumTimeElapsed=prtSonetMediumTimeElapsed, prtSonetVcJTxPathTraceEnable=prtSonetVcJTxPathTraceEnable, prtSonetIntervalLineFEBE=prtSonetIntervalLineFEBE, virtualIfGFPIntervalEntry=virtualIfGFPIntervalEntry, prtSonetVcRxJPathTrace=prtSonetVcRxJPathTrace, prtSonetCurrentES=prtSonetCurrentES, prtSonetStm1MngProtDeviationType=prtSonetStm1MngProtDeviationType, vcGroupCnfgRowStatus=vcGroupCnfgRowStatus, virtualIfLAPFIntervalDlciMismatch=virtualIfLAPFIntervalDlciMismatch, prtSonetGenIdx=prtSonetGenIdx, vcgGfpMuxCnfgRowStatus=vcgGfpMuxCnfgRowStatus, virtualIfLAPSIntervalTable=virtualIfLAPSIntervalTable, virtualIfGFPIntervalTHecMbError=virtualIfGFPIntervalTHecMbError, prtSonetGen=prtSonetGen, prtSectionLineCurrentEntry=prtSectionLineCurrentEntry, prtSonetIntervalStatus=prtSonetIntervalStatus, prtSonetMediumTable=prtSonetMediumTable, vcGroupCnfgRip2=vcGroupCnfgRip2, virtualIfLAPFIntervalPidMismatch=virtualIfLAPFIntervalPidMismatch, vcGroupCnfgTable=vcGroupCnfgTable, virtualIfLAPFIntervalOuiMismatch=virtualIfLAPFIntervalOuiMismatch, virtualIfCurrentMaxLengthViolation=virtualIfCurrentMaxLengthViolation, virtualIfGFPCurrentExiMismatch=virtualIfGFPCurrentExiMismatch, prtVcGroupCnfg=prtVcGroupCnfg, virtualIfIntervalEntry=virtualIfIntervalEntry, prtSonetTuCnfgIdx=prtSonetTuCnfgIdx, prtSonetXConnectRowStatus=prtSonetXConnectRowStatus, prtSonetGenEedThreshold=prtSonetGenEedThreshold, virtualIfIntervalTxAbortFrames=virtualIfIntervalTxAbortFrames, virtualIfGenIdx=virtualIfGenIdx, prtSonetTuIdx=prtSonetTuIdx)
# https://leetcode.com/problems/shortest-palindrome/description/ # # algorithms # Hard (26.25%) # Total Accepted: 63.7k # Total Submissions: 242.7k # beats 40.0% of python submissions class Solution(object): def shortestPalindrome(self, s): """ :type s: str :rtype: str """ length = len(s) if length < 2: return s reverse_s = s[::-1] for i in xrange(length): if s.startswith(reverse_s[i:]): return reverse_s[:i] + s return s # 比较好的做法 # 思想还是去找最左最长的回文串,通过遍历得到当次匹配的元素个数,然后缩小范围,再次遍历(回文串不可能比这个还长,只能更短) class Solution(object): def shortestPalindrome(self, s): """ :type s: str :rtype: str """ j, end = 0, len(s) while True: j = 0 for i in range(end - 1, -1, -1): if s[i] == s[j]: j += 1 if j == end: break end = j return s[end:][::-1] + s[:end] + s[end:]
def aumentar(preco=0, taxa=0, formato=False): p = preco + (preco * taxa/100) return p if formato == False else moeda(p) def diminuir(preco=0, taxa=0, formato=False): p = preco - (preco * taxa/100) return p if formato == False else moeda(p) def dobro(preco=0, formato=False): p = preco * 2 return p if formato == False else moeda(p) def metade(preco = 0, formato=False): p = preco / 2 return p if formato == False else moeda(p) def moeda(preco=0, moeda='R$'): return f'{moeda}{preco:>.2f}'.replace('.', ',') def resumo(preco=0, taxaa=10, taxar=5): print('=' * 30) print('RESUMO DO VALOR'.center(30)) print('=' * 30) print(f'preço analisado: \t{moeda(preco)}') print(f'dobro do preço: \t{dobro(preco, True)}') print(f'metade do preço: \t{metade(preco, True)}') print(f'{taxaa}% de aumento: \t{aumentar(preco, taxaa, True)}') print(f'{taxar}% de redução: \t{diminuir(preco, taxar, True)}') print('=' * 30)
#!/usr/bin/env python # Exercicio 3.9 - Escreva um programa que leia a quantidade de dias, horas, minutos e segundos do usuario. Calcule o total em segundos. print(' ') dia = int(input('Informe N° em dias: ')) hora = int(input('Informe N° em Horas: ')) minuto = int(input('Informe N° em Minutos: ')) segundos = int(input('Informe N° em Segundos: ')) # Convertendo dias = dia * 86400 horas = hora * 3600 minutos = minuto * 60 #Somando Total totals = dias + horas + minutos + segundos print(f'O total de {dia}dia, {hora}h, {minuto}min e {segundos}seg convertidos somente em segundos é igual á {totals}') print(' ')
'''Crie um programa que leia vários números inteiros pelo teclado, o programa só vai parar quando o usuário digitar o valor 777, que é a condição de parada No final mostre quantos números foram digitados e qual foi a soma entre eles (desconsiderando o flag). ''' print('{:=^37}'.format('Code-Save')) print('{:=^37}'.format('No Flags')) núm = cont = soma = 0 núm = int(input('Digite [777] para finalizar: ')) while núm != 777: soma += núm cont += 1 núm = int(input('Digite [777] para finalizar: ')) print('Você digitou {} números e a soma entre eles foi {} '.format(cont , soma))
# -*- coding: utf-8 -*- """ Created on Sun Aug 30 14:28:10 2020 @author: Abhishek Mukherjee """ class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: tempLst=[] tempDict=dict() tempDict=[dict() for i in range(len(strs))] for i in range(len(strs)): for j in strs[i]: if j in tempDict[i].keys(): tempDict[i][j]+=1 else: tempDict[i].update({j:1}) temp=[] for i in range(len(tempDict)): tempDict[i]=sorted(tempDict[i].items(),key=lambda i:i[0]) temp1=[] temp2=[] temp3=[] for i in range(len(tempDict)-1): temp1=[] for j in range(i+1,len(tempDict)): if tempDict[i]==tempDict[j]: if strs[j] not in temp3: temp1.append(strs[j]) if strs[i] not in temp3: temp1.append(strs[i]) temp2.append(temp1) temp3.extend(temp1) for i in strs: if i not in temp3: temp2.append([i]) return temp2
# -*- coding: utf-8 -*- """Top-level package for src.""" __author__ = """krishna bhogaonker""" __email__ = 'cyclotomiq@gmail.com' __version__ = '0.1.0'
class General(): ''' this class runs the experiments with given number of users of each category ''' def __init__(self, p_manager, c_manager, environment): self.person_manager = p_manager self.context_manager = c_manager self.environment = environment self.rewards_log = [] self.candidates_values = self.environment.arms_candidates self.expected_values = [[c * 0.5 for c in self.candidates_values] for cat in range(3)] def play_experiment(self, num_persons): ''' runs a pricing experiment with a given number of users ''' for t in range(num_persons): # nuova persona category_person = self.person_manager.new_person() features_person = self.person_manager.categories[category_person] # print("persona {}, category {}".format(t, features_person)) # candidates candidates_values = self.environment.arms_candidates # scelgo arm pulled_arm = self.context_manager.select_arm(features_person, t, candidates_values) # returns the expected value of this arm from the assigned context. valore_atteso_arm = self.context_manager.val_att_arm(features_person, pulled_arm, candidates_values) # receive positive or null reward reward_person = self.environment.round(category_person, pulled_arm) # update context_manager with reward self.context_manager.update_context(features_person, pulled_arm, reward_person) # update ethe experiment's rewads log, self.rewards_log.append([category_person, pulled_arm, reward_person, valore_atteso_arm]) # for i, c in self.context_manager.contexts_set.items(): # print("\ncontext {}".format(i)) # print("len(context.rewards_log) = {}".format(len(c.rewards_log))) # print("context.subspace = {}".format(c.subspace)) # print("context.learner.beta_parameters = \n{}".format(c.learner.beta_parameters.astype(int))) return self.rewards_log def run_pricing_experiment(self, n_categories_clicks): ''' runs a pricing experiment with a given number of users. this is called as a method inside the advertising modules ''' for index, clicks in enumerate(n_categories_clicks): features_person = self.person_manager.categories[index] for n in range(int(round(clicks))): pulled_arm = self.context_manager.select_arm(features_person, n, self.candidates_values) reward_person = self.environment.round(index, pulled_arm) self.context_manager.update_context(features_person, pulled_arm, reward_person) self.rewards_log.append([index, pulled_arm, reward_person]) idx = self.context_manager.features_context[features_person] for c in range(len(self.candidates_values)): self.expected_values[idx][c] = self.context_manager.contexts_set[idx].learner.expected_value(c, self.candidates_values[ c])
# usando generator, ele comsome menos memoria generator = (i ** 2 for i in range(10) if i % 2 == 0) #o next serve para extrair o valor do generator, importante o generator nbao e uma tupla print(next(generator)) print(next(generator)) print(next(generator)) print(next(generator)) print(next(generator)) # print(next(generator)) aqui vai dar um ERRO apartir do 64
# Definition for singly-linked list. class DbListNode(object): def __init__(self, x, y): self.key = x self.val = y self.next = None self.prev = None class LRUCache: ''' leet code: 146 运用你所掌握的数据结构,设计和实现一个 LRU (最近最少使用) 缓存机制。 它应该支持以下操作: 获取数据 get 和 写入数据 put 。 获取数据 get(key) - 如果密钥 (key) 存在于缓存中,则获取密钥的值(总是正数),否则返回 -1。 写入数据 put(key, value) - 如果密钥不存在,则写入其数据值。 当缓存容量达到上限时,它应该在写入新数据之前删除最近最少使用的数据值,从而为新的数据值留出空间 哈希表+双向链表 哈希表: 查询 O(1) 双向链表: 有序, 增删操作 O(1) Author: Ben ''' def __init__(self, capacity: int): self.cap = capacity self.hkeys = {} # self.top和self.tail作为哨兵节点, 避免越界 self.top = DbListNode(None, -1) self.tail = DbListNode(None, -1) self.top.next = self.tail self.tail.prev = self.top def get(self, key: int) -> int: if key in self.hkeys.keys(): # 更新结点顺序 cur = self.hkeys[key] # 跳出原位置 cur.next.prev = cur.prev cur.prev.next = cur.next # 最近用过的置于链表首部 top_node = self.top.next self.top.next = cur cur.prev = self.top cur.next = top_node top_node.prev = cur return self.hkeys[key].val return -1 def put(self, key: int, value: int) -> None: if key in self.hkeys.keys(): cur = self.hkeys[key] cur.val = value # 跳出原位置 cur.prev.next = cur.next cur.next.prev = cur.prev # 最近用过的置于链表首部 top_node = self.top.next self.top.next = cur cur.prev = self.top cur.next = top_node top_node.prev = cur else: # 增加新结点至首部 cur = DbListNode(key, value) self.hkeys[key] = cur # 最近用过的置于链表首部 top_node = self.top.next self.top.next = cur cur.prev = self.top cur.next = top_node top_node.prev = cur if len(self.hkeys.keys()) > self.cap: self.hkeys.pop(self.tail.prev.key) # 去掉原尾结点 self.tail.prev.prev.next = self.tail self.tail.prev = self.tail.prev.prev def __repr__(self): vals = [] p = self.top.next while p.next: vals.append(str(p.val)) p = p.next return '->'.join(vals) if __name__ == '__main__': cache = LRUCache(2) cache.put(1, 1) cache.put(2, 2) print(cache) cache.get(1) # 返回 1 cache.put(3, 3) # 该操作会使得密钥 2 作废 print(cache) cache.get(2) # 返回 -1 (未找到) cache.put(4, 4) # 该操作会使得密钥 1 作废 print(cache) cache.get(1) # 返回 -1 (未找到) cache.get(3) # 返回 3 print(cache) cache.get(4) # 返回 4 print(cache)
tm = 1 while tm <= 5: totalTm = 0 qt = int(input(f"Quantos alunos você possui na turma {tm}? ")) contTm1 = 1 ntotal = 0 while contTm1 <= qt: n = input("Digite o nome do aluno: ").capitalize() ntaAl = input("Digite a nota do aluno: ") ntaAl = float(ntaAl.replace(",",".")) ntotal = ntotal + ntaAl mNotasT1 = ntotal/qt contTm1 += 1 print("") print(f"A MÉDIA DA TURMA {tm} é: {mNotasT1}") print("-" * 25) tm = tm + 1
def reverse_string(string): reversed_list = [] string_as_list = list(string) while string_as_list: reversed_list.append(string_as_list.pop()) print(''.join(reversed_list)) reverse_string(input())
n, m = map(int, input().split()) for _ in range(n): k, v = input().split()
#entrada e, f, c = str(input()).split() e = int(e) f = int(f) c = int(c) #processamento totalGarrafasVazias = e + f totalRefri = 0 while totalGarrafasVazias >= c: aux = totalGarrafasVazias // c totalRefri += aux totalGarrafasVazias = aux + (totalGarrafasVazias % c) #saida print(totalRefri)
f1 = 10 print(f1) if f1: a1 = 1 a2 = 2 a3 = 3 a4 = 4 a5 = 5 a6 = 6 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) a1 = 1 a2 = 2 a3 = 3 a4 = 4 a5 = 5 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) a1 = 1 a2 = 2 a3 = 3 a4 = 4 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) a1 = 1 a2 = 2 a3 = 3 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) a1 = 1 a2 = 2 elif f1: print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) a1 = 1 else: print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1) print(f1)
def error_response(status:str, message:str): """ This function returns a dictionary of status and message :param status: The status code of the response :type status: str :param message: The message you want to display to the end user :type message: str :return: A dictionary of status and message """ payload = { "status": status, "message": message } return payload def success_response(status:str, message:str, data:dict): """ Custom success response :param status: The status code of the response :type status: str :param message: The message you want to show to the end user :type message: str :param data: dict :type data: dict :return: A dictionary of status, message, data of whatever object that was serialized """ payload = { "status": status, "message": message, "data": data } return payload
class ZException(Exception): ''' Exception when z0 is suboptimal. ''' def __init__(self, text, z, *args): super(ZException, self).__init__(text, z, *args) self.text = text self.z = z
# # PySNMP MIB module TUBS-PROC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TUBS-PROC-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:27:58 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") ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, NotificationType, MibIdentifier, ModuleIdentity, Counter64, ObjectIdentity, IpAddress, TimeTicks, Integer32, Counter32, Gauge32, iso, Unsigned32, enterprises = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "NotificationType", "MibIdentifier", "ModuleIdentity", "Counter64", "ObjectIdentity", "IpAddress", "TimeTicks", "Integer32", "Counter32", "Gauge32", "iso", "Unsigned32", "enterprises") DisplayString, TAddress, TextualConvention, TimeStamp, DateAndTime, RowStatus, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TAddress", "TextualConvention", "TimeStamp", "DateAndTime", "RowStatus", "TruthValue") procMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 1575, 1, 3)) if mibBuilder.loadTexts: procMIB.setLastUpdated('9411152024Z') if mibBuilder.loadTexts: procMIB.setOrganization('TU Braunschweig') if mibBuilder.loadTexts: procMIB.setContactInfo(' Juergen Schoenwaelder Postal: TU Braunschweig Bueltenweg 74/75 D-38108 Braunschweig GERMANY Tel: +49 531 391 3249 Fax: +49 531 391 5936 E-mail: schoenw@ibr.cs.tu-bs.de') if mibBuilder.loadTexts: procMIB.setDescription('Experimental MIB modules for process listings.') procReload = MibScalar((1, 3, 6, 1, 4, 1, 1575, 1, 3, 1), DateAndTime()).setMaxAccess("readwrite") if mibBuilder.loadTexts: procReload.setStatus('current') if mibBuilder.loadTexts: procReload.setDescription('Any set operation will reload the process table. It contains a time stamp when the proc table was reloaded the last time.') procTable = MibTable((1, 3, 6, 1, 4, 1, 1575, 1, 3, 2), ) if mibBuilder.loadTexts: procTable.setStatus('current') if mibBuilder.loadTexts: procTable.setDescription('The process table.') procEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1575, 1, 3, 2, 1), ).setIndexNames((0, "TUBS-PROC-MIB", "procID")) if mibBuilder.loadTexts: procEntry.setStatus('current') if mibBuilder.loadTexts: procEntry.setDescription('An entry for a process in the processes table.') procID = MibTableColumn((1, 3, 6, 1, 4, 1, 1575, 1, 3, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: procID.setStatus('current') if mibBuilder.loadTexts: procID.setDescription('The unique process ID.') procCmd = MibTableColumn((1, 3, 6, 1, 4, 1, 1575, 1, 3, 2, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: procCmd.setStatus('current') if mibBuilder.loadTexts: procCmd.setDescription('The command name used to start this process.') mibBuilder.exportSymbols("TUBS-PROC-MIB", procCmd=procCmd, procTable=procTable, procID=procID, procReload=procReload, procEntry=procEntry, procMIB=procMIB, PYSNMP_MODULE_ID=procMIB)
n = int(input('Digite um número: ')) if n % 2 == 0: print('O numero digitado é PAR!') else: print('O número digitado é ÍMPAR! ')
def operate(opcode, arg1, arg2): if (opcode==1): return arg1+arg2 elif (opcode==2): return arg1*arg2 elif (opcode==3): return arg1 elif (opcode==4): return arg1
class event(object): def __init__(self): self.__funcs = set() def invoke(self, *args): for f in self.__funcs: f.__call__(*args) def reg(self, func): self.__funcs.add(func)
#!/bin/zsh ''' Say you have a list of lists where each value in the inner lists is a one-character string, like this: grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['.', '.', '.', '.', '.', '.']] You can think of grid[x][y] as being the character at the x- and y-coordinates of a “picture” drawn with text characters. The (0, 0) origin will be in the upper-left corner, the x-coordinates increase going right, and w the y-coordinates increase going down. Copy the previous grid value, and write code that uses it to print the image. ..OO.OO.. .OOOOOOO. .OOOOOOO. ..OOOOO.. ...OOO... ....O.... Hint: You will need to use a loop in a loop in order to print grid[0][0] , then grid[1][0] , then grid[2][0] , and so on, up to grid[8][0]. This will finish the first row, so then print a newline. Then your program should print grid[0][1] , then grid[1][1] , then grid[2][1] , and so on. The last thing your program will print is grid[8][5] . Also, remember to pass the end keyword argument to print() if you don’t want a newline printed automatically after each print() call. ''' grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['.', '.', '.', '.', '.', '.']] # TODO: make algorithm for printing the shape. # TODO: make algorithm for printing the shape in the right angle.
cycle_info={} # populate some example cycle info cycle_info['cycle']=1 cycle_info['time']=1.0 print(cycle_info)
""" You are given a pointer to the root of a binary search tree and values to be inserted into the tree. Insert the values into their appropriate position in the binary search tree and return the root of the updated binary tree. You just have to complete the function Input: The value to be inserted is 6 on the tree below 4 / \ 2 7 / \ 1 3 Output: Return the root of the binary search tree after inserting the value into the tree 4 / \ 2 7 / \ / 1 3 6 """ class Node: def __init__(self, info): self.info = info self.left = None self.right = None self.level = None def __str__(self): return str(self.info) def preOrder(root): if root == None: return print(root.info, end=" ") preOrder(root.left) preOrder(root.right) class BinarySearchTree: def __init__(self): self.root = None # Node is defined as # self.left (the left child of the node) # self.right (the right child of the node) # self.info (the value of the node) def insert(self, val): if self.root is None: self.root = Node(val) return current = self.root while True: if current.info > val: if current.left: current = current.left else: current.left = Node(val) break else: if current.right: current = current.right else: current.right = Node(val) break tree = BinarySearchTree() t = int(input()) arr = list(map(int, input().split())) for i in range(t): tree.insert(arr[i]) preOrder(tree.root)
#!/usr/bin/env python3 def minimumBribes(q): bribes = 0 for i in range(len(q) - 1, -1, -1): if q[i] - (i + 1) > 2: print("Too chaotic") return for j in range(max(0, q[i] - 2), i): if q[j] > q[i]: bribes += 1 print(bribes) if __name__ == '__main__': t = int(input()) for t_itr in range(t): n = int(input()) q = list(map(int, input().rstrip().split())) minimumBribes(q)
file = open('./input.txt', 'r') string = file.read() lines = string.split() int_lines = list(map(lambda x: int(x), lines)) result = 0 last_value = 10000 for value in int_lines: if last_value < value: result += 1 last_value = value print(result)
words_splitted = input("Give me some words: ") words = words_splitted.split(",") counter = 0 for i in range(len(words)): if words[i-1].isalpha() == True: counter += 1 print(counter)
def test_vcf(filename): with open(filename, encoding='utf-8') as handle: for index, line in enumerate(handle): line = line.replace('\n', '') # Already read meta and header in self.__init__ if line.startswith('#'): continue list_line = line.split("\t") ref = list_line[3] alt = list_line[4] if len(ref) == 1 or len(alt) == 1: continue else: print(ref, alt) print("ERROR", line) # if len(ref) > 50 or len(alt) > 50: # print(ref, alt) # print("SV", line)
def gra(up, rundy, limit): boczne = { 1 : [3,4,2,5], 2 : [6,1,3,4], 3 : [6,1,2,5], 4 : [6,1,2,5], 5 : [6,1,3,4], 6 : [3,4,2,5] } punkty = [0 for k in range(len(rundy[0]))] wynik = punkty[:] for i in range(len(rundy)): runda = rundy[i] for j in range(len(runda)): if runda[j] == 'o': up = max(boczne[up]) elif runda[j] == 'r': up = min(boczne[up]) punkty[j] += up if punkty[j] >= limit and wynik[j] == 0: wynik[j] = i + 1 return wynik #gra(3, [['o', 'r'],['r', 'r'],['r', 'o']], 7) #gra(4, [['o'],['r'],['r']], 7) #gra(4, [['o', 'r', 'r'],['r', 'o', 'r']], 5)
def getRoadsPoints(sf, shapeval, show=False): fields = sf.fields if show: print("Fields -> {0}".format(fields)) itype=None iint=None if shapeval.startswith("Airport"): for i,val in enumerate(fields): if val[0] == "FAA_AIRPOR": itype = i-1 break if shapeval.startswith("RailFeature"): for i,val in enumerate(fields): if val[0] == "LENGTHKM": itype = i-1 break if shapeval.startswith("TrailSegment"): for i,val in enumerate(fields): if val[0] == "SOURCE_D00": itype = i-1 break if shapeval.startswith("RoadSegment"): for i,val in enumerate(fields): if val[0] == "PERMANENT_": itype = i-1 break iint=None for i,val in enumerate(fields): if val[0] == "INTERSTATE": iint = i-1 break return itype,iint def getRoadsData(shapeval, record, itype, iint, cntr): if shapeval.startswith("AirportPoint"): geoid = record[itype] name = record[itype+1] test = record[itype+2] try: int(test) except: return None return [geoid, name] elif shapeval.startswith("AirportRunway"): geoid = record[itype] name = record[itype+1] return [geoid, name] elif shapeval.startswith("RailFeature"): length = record[itype] name = record[itype+3] geoid = name return [geoid, name] elif shapeval.startswith("TrailSegment"): length = record[itype] name = record[itype+3] geoid = name return [geoid, name] elif shapeval.startswith("RoadSegment"): geoid = record[itype] name = record[itype+21] inter = "-".join(record[iint:iint+4]) usrte = "-".join(record[iint+4:iint+8]) strte = "-".join(record[iint+8:iint+12]) ctrte = record[iint+12] street = record[iint+15] cntr[street] += 1 extra = [inter, usrte, strte, ctrte, street] ## Interstate isInterstate = False if inter != '---': isInterstate = True ## USRte isUSRte = False if usrte != '---': isUSRte = True ## StateRte isStateRte = False if strte != '---': isStateRte = True ## Highway isHighway = False try: if any([street.find(" {0}".format(x)) != -1 for x in ['Hw ', 'Hwy', 'Pkwy', 'Hwy', 'Fwy', 'Tollway', 'Expy']]): isHighway = True except: pass ## Major Road isMajorRd = False try: if any([street.find(" {0}".format(x)) != -1 for x in ['Ave', 'Blvd']]): isMajorRd = True except: pass ## Connections isConnection = False try: if any([street.find(" {0}".format(x)) != -1 for x in ['Bridge ', ' Bdg']]): isConnection = True except: pass return [geoid, name, cntr, isInterstate, isUSRte, isStateRte, isHighway, isMajorRd, isConnection] else: print(record) 1/0 print("No data is returned!!!") return None
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorDebugInfo.msg;/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg/HectorIterData.msg" services_str = "" pkg_name = "hector_mapping" dependencies_str = "" langs = "gencpp;geneus;genlisp;gennodejs;genpy" dep_include_paths_str = "hector_mapping;/home/liudiyang1998/Git/ROS-Robotics-By-Example/Chapter_7_code/src/hector_slam/hector_mapping/msg" PYTHON_EXECUTABLE = "/usr/bin/python2" package_has_static_sources = '' == 'TRUE' genmsg_check_deps_script = "/opt/ros/melodic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py"
''' URL: https://leetcode.com/problems/powx-n Time complexity: O(logn) Space complexity: O(logn) ''' class Solution: def myPow(self, x, n): """ :type x: float :type n: int :rtype: float """ res = self._aux_pow(x, abs(n)) if n < 0: return 1 / res return res def _aux_pow(self, x, n): if n == 0: return 1 if n == 1: return x half_res = self._aux_pow(x, n//2) res = half_res * half_res if n % 2 == 1: return res * x return res
class GenericsException(Exception): """Base class for exceptions in generics package.""" class GenericsInterfaceFailed(GenericsException, TypeError): """When subject fails the interface of a generic function, and that generic has no callable 'default' to fall back to.""" class GenericsNoDispatch(GenericsException): """When no dispatch found.""" def get_name(obj): if hasattr(obj, '__name__'): name = obj.__name__ else: name = type(obj).__name__ + " instance" def get_abstracts(obj): return getattr(obj, '__abstractmethods__', [])
#!/usr/bin/env python # -*- coding=utf-8 -*- color={ "FG_BLAcK": "\033[30m", # 将字符的显示颜色改为黑色 "FG_RED" : "\033[31m", # 将字符的显示颜色改为红色 "FG_GREEN": "\033[32m", # 将字符的显示颜色改为绿色 "FG_YELLOW": "\033[33m", # 将字符的显示颜色改为黄色 "FG_BLUE" : "\033[34m", # 将字符的显示颜色改为蓝色 "FG_PINK" : "\033[35m", # 将字符的显示颜色改为紫色 "FG_LIGHT_BLUE": "\033[36m", # 将字符的显示颜色改为淡蓝色 "FG_WHITE": "\033[37m", # 将字符的显示颜色改为灰色 "BG_BLACK" : "\033[40m", # 将背景色设置为黑色 "BG_RED" : "\033[41m", # 将背景色设置为红色 "BG_GREEN" : "\033[42m", # 将背景色设置为绿色 "BG_YELLOW": "\033[43m", # 将背景色设置为黄色 "BG_BLUE" : "\033[44m", # 将背景色设置为蓝色 "BG_PINK" : "\033[45m", # 将背景色设置为紫色 "BG_LIGHT_BLUE": "\033[46m", # 将背景色设置为淡蓝色 "BG_WHITE" : "\033[47m", # 将背景色设置为灰色 "END" :"\033[0;00m", } if __name__ == '__main__': pass
""" __init__.py Author: Rob Cakebread <cakebread at gmail> License : BSD """ __docformat__ = 'restructuredtext' __version__ = '0.4.3'
# # @lc app=leetcode.cn id=103 lang=python3 # # [103] 二叉树的锯齿形层次遍历 # # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def zigzagLevelOrder(self, root: TreeNode) -> List[List[int]]: if not root: return [] stack = [] next_stack = [root] res = [] index = - 1 while next_stack: stack = next_stack next_stack = [] vals = [] index = 1 if index == - 1 else - 1 while stack: node = stack.pop(0) if node.left: next_stack.append(node.left) if node.right: next_stack.append(node.right) vals.append(node.val) res.append(vals[::index]) return res
""" Test that linear solver convergence with correct rate of convergence when applied to the problem with stable detonation. """ # class TestLinearStableConvergence: # def test_linear_stable_convergence(self): # pass
# 🚨 Don't change the code below 👇 height = input("enter your height in m: ") weight = input("enter your weight in kg: ") # 🚨 Don't change the code above 👆 #Write your code below this line 👇 bmi = int(weight) / float(height) ** 2 bmi_as_int = int(bmi) print(bmi_as_int) #!Or weight_as_int = int(weight) height_as_float = float(height) #TODO: Using the exponent operator bmi = weight_as_int / height_as_float ** 2 #TODO: or using multiplication and PEMDAS bmi = weight_as_int / (height_as_float * height_as_float)
"""stack.""" class Stack(object): def __init__(self, item): self._data = [item] def push(self, item): self._data.append(item) def pop(self): if len(self._data) == 0: raise ValueError('Your stack is empty') return self._data.pop() def getMin(self): if len(self._data) == 0: raise ValueError('Your stack is empty') return min(self._data)
# List of API keys ALPACA_API_KEY = "PKV6PG76ZRMOXUSLQMC6" ALPACA_SECRET_KEY = "YD22E2jiKZRfer69McRcQIJX0kxGpXy13I0oTIzN" ALPACA_BASE_URL = "https://paper-api.alpaca.markets" AMERITRADE_TOKEN = 'https://api.tdameritrade.com/v1/oauth2/token' AMERITRADE_KEY = '6JWAH9JYWA5CSCOG5WC6PAPLYIASBTTV'
REGION = "your_region_name" BUCKET = "your_bucket_name" DATABASE = "your_database_name" TABLE = "your_table_name" INDEX_COLUMN_NAME = "date"
class StatusLifecycle(): """ This class represents a lifecycle of statuses. """ class InvalidLifecycleException(Exception): """ raised if a lifecycle is invalid """ pass def __init__(self, *lifecycle_statuses): """ :param lifecycle_statuses: a set of unique statuses, in the correct order, in which they should reside in this lifecycle :raises StatusLifecycle.InvalidLifecycleException: if the provided statuses aren't unique """ if len(lifecycle_statuses) < 1: raise StatusLifecycle.InvalidLifecycleException('at least one status must be provided') if len(lifecycle_statuses) != len(set(lifecycle_statuses)): raise StatusLifecycle.InvalidLifecycleException('Lifecycle statuses need to be unique!') self.statuses = lifecycle_statuses self.index_lookup = {status: index for index, status in enumerate(self.statuses)} class ObjectStatusLifecycleManager(): """ This class manages the StatusLifecycle belonging to a specific object, to be able to provide additional functionality, like getting a next of previous status. """ class InvalidStatusException(Exception): """ raise if a status is invalid """ pass def __init__(self, status_lifecycle, object_with_status, status_attribute): """ :param status_lifecycle: the StatusLifecycle which should be managed :type status_lifecycle: StatusLifecycle :param object_with_status: the Object to manage the Lifecycle for :type object_with_status: Any :param status_attribute: the attribute of the status which contains the current status :type status_attribute: str """ self.status_lifecycle = status_lifecycle self._object_with_status = object_with_status self._status_attribute = status_attribute def get_status_by_offset(self, offset, raise_exception=True): """ gets a status by a given offset :param offset: the offset :type offset: int :param raise_exception: if False None will be returned in case the offset points to an invalid status, if True an InvalidStatusException will be thrown :type raise_exception: bool :raises ObjectStatusLifecycleManager.InvalidStatusException: in case raise_exception == True and offset is invalid :return: the status relative to the provided status, by the given offset """ return self._execute_method_and_handle_index_exceptions( raise_exception, self._get_status_by_offset, offset ) def get_next_status(self, raise_exception=True): """ gets the next status, relative to the given status :param raise_exception: if False None will be returned in case there is no next status, if True an InvalidStatusException will be thrown :type raise_exception: bool :raises ObjectStatusLifecycleManager.InvalidStatusException: in case raise_exception == True and offset is invalid :return: the next status, relative to the given status """ return self._execute_method_and_handle_index_exceptions( raise_exception, self._get_next_status ) def get_previous_status(self, raise_exception=True): """ gets the previous status, relative to the given status :param raise_exception: if False None will be returned in case there is no previous status, if True an InvalidStatusException will be thrown :type raise_exception: bool :raises ObjectStatusLifecycleManager.InvalidStatusException: in case raise_exception == True and offset is invalid :return: the previous status, relative to the given status """ return self._execute_method_and_handle_index_exceptions( raise_exception, self._get_previous_status ) def is_status_valid(self, status, raise_exception=False): """ evaluates whether a status is valid or not :param status: the status to check :type status: str :param raise_exception: if True an ObjectStatusLifecycleManager.InvalidStatusException will be raised in case the status is invalid :type raise_exception: bool :raises ObjectStatusLifecycleManager.InvalidStatusException: in case raise_exception == True and invalid :return: is the status valid :rtype: bool """ valid = status in self.status_lifecycle.statuses if not valid and raise_exception: raise ObjectStatusLifecycleManager.InvalidStatusException() else: return valid def compare_status_to(self, status_to_compare_to): """ compares the position of current status to another one, to evaluate whether a status is before or after another one in the lifecycle. :param status_to_compare_to: the status which the current one is compared to :type status: str :return: returns 1 -> status > status_to_compare_to -1 -> status < status_to_compare_to 0 -> status == status_to_compare_to :rtype int in (-1, 0, 1) """ status_index = self._get_position_of_current_status() status_to_compare_to_index = self._get_position_of_status(status_to_compare_to) if status_index > status_to_compare_to_index: return 1 if status_index < status_to_compare_to_index: return -1 return 0 def _get_current_status(self): return getattr(self._object_with_status, self._status_attribute) def _get_status_by_offset(self, offset): index = self._get_position_of_current_status() + offset if index < 0: raise ObjectStatusLifecycleManager.InvalidStatusException() return self.status_lifecycle.statuses[index] def _get_next_status(self): return self._get_status_by_offset(1) def _get_previous_status(self): return self._get_status_by_offset(-1) def _get_position_of_status(self, status): return self.status_lifecycle.index_lookup[status] def _get_position_of_current_status(self): return self._get_position_of_status(self._get_current_status()) def _execute_method_and_handle_index_exceptions(self, raise_exception, method, *args): try: return method(*args) except Exception as e: if raise_exception: raise ObjectStatusLifecycleManager.InvalidStatusException(str(e)) else: return None
class Math(object): """ Provides constants and static methods for trigonometric,logarithmic,and other common mathematical functions. """ @staticmethod def Abs(value): """ Abs(value: Single) -> Single Returns the absolute value of a single-precision floating-point number. value: A number that is greater than or equal to System.Single.MinValue,but less than or equal to System.Single.MaxValue. Abs(value: float) -> float Returns the absolute value of a double-precision floating-point number. value: A number that is greater than or equal to System.Double.MinValue,but less than or equal to System.Double.MaxValue. Abs(value: Decimal) -> Decimal Returns the absolute value of a System.Decimal number. value: A number that is greater than or equal to System.Decimal.MinValue,but less than or equal to System.Decimal.MaxValue. Abs(value: Int64) -> Int64 Returns the absolute value of a 64-bit signed integer. value: A number that is greater than System.Int64.MinValue,but less than or equal to System.Int64.MaxValue. Abs(value: SByte) -> SByte Returns the absolute value of an 8-bit signed integer. value: A number that is greater than System.SByte.MinValue,but less than or equal to System.SByte.MaxValue. Abs(value: Int16) -> Int16 Returns the absolute value of a 16-bit signed integer. value: A number that is greater than System.Int16.MinValue,but less than or equal to System.Int16.MaxValue. Abs(value: int) -> int Returns the absolute value of a 32-bit signed integer. value: A number that is greater than System.Int32.MinValue,but less than or equal to System.Int32.MaxValue. """ pass @staticmethod def Acos(d): """ Acos(d: float) -> float Returns the angle whose cosine is the specified number. d: A number representing a cosine,where d must be greater than or equal to -1, but less than or equal to 1. -1 or d > 1 or d equals System.Double.NaN. """ pass @staticmethod def Asin(d): """ Asin(d: float) -> float Returns the angle whose sine is the specified number. d: A number representing a sine,where d must be greater than or equal to -1,but less than or equal to 1. if d < -1 or d > 1 or d equals System.Double.NaN. """ pass @staticmethod def Atan(d): """ Atan(d: float) -> float Returns the angle whose tangent is the specified number. d: A number representing a tangent. to double precision (1.5707963267949) if d equals System.Double.PositiveInfinity. """ pass @staticmethod def Atan2(y,x): """ Atan2(y: float,x: float) -> float Returns the angle whose tangent is the quotient of two specified numbers. y: The y coordinate of a point. x: The x coordinate of a point. (x,y) is a point in the Cartesian plane. Observe the following: For (x,y) in the boundaries of the quadrants,the return value is the following:If y is 0 System.Double.NaN,or if x and y are either System.Double.PositiveInfinity or System.Double.NegativeInfinity,the method returns System.Double.NaN. """ pass @staticmethod def BigMul(a,b): """ BigMul(a: int,b: int) -> Int64 Produces the full product of two 32-bit numbers. a: The first number to multiply. b: The second number to multiply. Returns: The number containing the product of the specified numbers. """ pass @staticmethod def Ceiling(*__args): """ Ceiling(a: float) -> float Returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number. a: A double-precision floating-point number. Returns: The smallest integral value that is greater than or equal to a. If a is equal to System.Double.NaN,System.Double.NegativeInfinity,or System.Double.PositiveInfinity,that value is returned. Note that this method returns a System.Double instead of an integral type. Ceiling(d: Decimal) -> Decimal Returns the smallest integral value that is greater than or equal to the specified decimal number. d: A decimal number. Returns: The smallest integral value that is greater than or equal to d. Note that this method returns a System.Decimal instead of an integral type. """ pass @staticmethod def Cos(d): """ Cos(d: float) -> float Returns the cosine of the specified angle. d: An angle,measured in radians. Returns: The cosine of d. If d is equal to System.Double.NaN, System.Double.NegativeInfinity,or System.Double.PositiveInfinity,this method returns System.Double.NaN. """ pass @staticmethod def Cosh(value): """ Cosh(value: float) -> float Returns the hyperbolic cosine of the specified angle. value: An angle,measured in radians. Returns: The hyperbolic cosine of value. If value is equal to System.Double.NegativeInfinity or System.Double.PositiveInfinity, System.Double.PositiveInfinity is returned. If value is equal to System.Double.NaN,System.Double.NaN is returned. """ pass @staticmethod def DivRem(a,b,result): """ DivRem(a: Int64,b: Int64) -> (Int64,Int64) Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter. a: The dividend. b: The divisor. Returns: The quotient of the specified numbers. DivRem(a: int,b: int) -> (int,int) Calculates the quotient of two 32-bit signed integers and also returns the remainder in an output parameter. a: The dividend. b: The divisor. Returns: The quotient of the specified numbers. """ pass @staticmethod def Exp(d): """ Exp(d: float) -> float Returns e raised to the specified power. d: A number specifying a power. Returns: The number e raised to the power d. If d equals System.Double.NaN or System.Double.PositiveInfinity,that value is returned. If d equals System.Double.NegativeInfinity,0 is returned. """ pass @staticmethod def Floor(d): """ Floor(d: float) -> float Returns the largest integer less than or equal to the specified double-precision floating-point number. d: A double-precision floating-point number. Returns: The largest integer less than or equal to d. If d is equal to System.Double.NaN,System.Double.NegativeInfinity,or System.Double.PositiveInfinity,that value is returned. Floor(d: Decimal) -> Decimal Returns the largest integer less than or equal to the specified decimal number. d: A decimal number. Returns: The largest integer less than or equal to d. """ pass @staticmethod def IEEERemainder(x,y): """ IEEERemainder(x: float,y: float) -> float Returns the remainder resulting from the division of a specified number by another specified number. x: A dividend. y: A divisor. Returns: A number equal to x - (y Q),where Q is the quotient of x / y rounded to the nearest integer (if x / y falls halfway between two integers,the even integer is returned).If x - (y Q) is zero,the value +0 is returned if x is positive, or -0 if x is negative.If y=0,System.Double.NaN is returned. """ pass @staticmethod def Log(*__args): """ Log(a: float,newBase: float) -> float Returns the logarithm of a specified number in a specified base. a: A number whose logarithm is to be found. newBase: The base of the logarithm. Returns: One of the values in the following table. (+Infinity denotes System.Double.PositiveInfinity,-Infinity denotes System.Double.NegativeInfinity,and NaN denotes System.Double.NaN.)anewBaseReturn valuea> 0(0 <newBase< 1) -or-(newBase> 1)lognewBase(a)a< 0(any value)NaN(any value)newBase< 0NaNa != 1newBase=0NaNa != 1newBase=+InfinityNaNa=NaN(any value)NaN(any value)newBase=NaNNaN(any value)newBase=1NaNa=00 <newBase< 1 +Infinitya=0newBase> 1-Infinitya= +Infinity0 <newBase< 1-Infinitya= +InfinitynewBase> 1+Infinitya=1newBase= 00a=1newBase=+Infinity0 Log(d: float) -> float Returns the natural (base e) logarithm of a specified number. d: A number whose logarithm is to be found. Returns: One of the values in the following table. d parameterReturn value Positive The natural logarithm of d; that is,ln d,or log edZero System.Double.NegativeInfinityNegative System.Double.NaNEqual to System.Double.NaNSystem.Double.NaNEqual to System.Double.PositiveInfinitySystem.Double.PositiveInfinity """ pass @staticmethod def Log10(d): """ Log10(d: float) -> float Returns the base 10 logarithm of a specified number. d: A number whose logarithm is to be found. Returns: One of the values in the following table. d parameter Return value Positive The base 10 log of d; that is,log 10d. Zero System.Double.NegativeInfinityNegative System.Double.NaNEqual to System.Double.NaNSystem.Double.NaNEqual to System.Double.PositiveInfinitySystem.Double.PositiveInfinity """ pass @staticmethod def Max(val1,val2): """ Max(val1: UInt64,val2: UInt64) -> UInt64 Returns the larger of two 64-bit unsigned integers. val1: The first of two 64-bit unsigned integers to compare. val2: The second of two 64-bit unsigned integers to compare. Returns: Parameter val1 or val2,whichever is larger. Max(val1: Int64,val2: Int64) -> Int64 Returns the larger of two 64-bit signed integers. val1: The first of two 64-bit signed integers to compare. val2: The second of two 64-bit signed integers to compare. Returns: Parameter val1 or val2,whichever is larger. Max(val1: Single,val2: Single) -> Single Returns the larger of two single-precision floating-point numbers. val1: The first of two single-precision floating-point numbers to compare. val2: The second of two single-precision floating-point numbers to compare. Returns: Parameter val1 or val2,whichever is larger. If val1,or val2,or both val1 and val2 are equal to System.Single.NaN,System.Single.NaN is returned. Max(val1: Decimal,val2: Decimal) -> Decimal Returns the larger of two decimal numbers. val1: The first of two decimal numbers to compare. val2: The second of two decimal numbers to compare. Returns: Parameter val1 or val2,whichever is larger. Max(val1: float,val2: float) -> float Returns the larger of two double-precision floating-point numbers. val1: The first of two double-precision floating-point numbers to compare. val2: The second of two double-precision floating-point numbers to compare. Returns: Parameter val1 or val2,whichever is larger. If val1,val2,or both val1 and val2 are equal to System.Double.NaN,System.Double.NaN is returned. Max(val1: UInt32,val2: UInt32) -> UInt32 Returns the larger of two 32-bit unsigned integers. val1: The first of two 32-bit unsigned integers to compare. val2: The second of two 32-bit unsigned integers to compare. Returns: Parameter val1 or val2,whichever is larger. Max(val1: Byte,val2: Byte) -> Byte Returns the larger of two 8-bit unsigned integers. val1: The first of two 8-bit unsigned integers to compare. val2: The second of two 8-bit unsigned integers to compare. Returns: Parameter val1 or val2,whichever is larger. Max(val1: SByte,val2: SByte) -> SByte Returns the larger of two 8-bit signed integers. val1: The first of two 8-bit signed integers to compare. val2: The second of two 8-bit signed integers to compare. Returns: Parameter val1 or val2,whichever is larger. Max(val1: Int16,val2: Int16) -> Int16 Returns the larger of two 16-bit signed integers. val1: The first of two 16-bit signed integers to compare. val2: The second of two 16-bit signed integers to compare. Returns: Parameter val1 or val2,whichever is larger. Max(val1: int,val2: int) -> int Returns the larger of two 32-bit signed integers. val1: The first of two 32-bit signed integers to compare. val2: The second of two 32-bit signed integers to compare. Returns: Parameter val1 or val2,whichever is larger. Max(val1: UInt16,val2: UInt16) -> UInt16 Returns the larger of two 16-bit unsigned integers. val1: The first of two 16-bit unsigned integers to compare. val2: The second of two 16-bit unsigned integers to compare. Returns: Parameter val1 or val2,whichever is larger. """ pass @staticmethod def Min(val1,val2): """ Min(val1: UInt64,val2: UInt64) -> UInt64 Returns the smaller of two 64-bit unsigned integers. val1: The first of two 64-bit unsigned integers to compare. val2: The second of two 64-bit unsigned integers to compare. Returns: Parameter val1 or val2,whichever is smaller. Min(val1: Int64,val2: Int64) -> Int64 Returns the smaller of two 64-bit signed integers. val1: The first of two 64-bit signed integers to compare. val2: The second of two 64-bit signed integers to compare. Returns: Parameter val1 or val2,whichever is smaller. Min(val1: Single,val2: Single) -> Single Returns the smaller of two single-precision floating-point numbers. val1: The first of two single-precision floating-point numbers to compare. val2: The second of two single-precision floating-point numbers to compare. Returns: Parameter val1 or val2,whichever is smaller. If val1,val2,or both val1 and val2 are equal to System.Single.NaN,System.Single.NaN is returned. Min(val1: Decimal,val2: Decimal) -> Decimal Returns the smaller of two decimal numbers. val1: The first of two decimal numbers to compare. val2: The second of two decimal numbers to compare. Returns: Parameter val1 or val2,whichever is smaller. Min(val1: float,val2: float) -> float Returns the smaller of two double-precision floating-point numbers. val1: The first of two double-precision floating-point numbers to compare. val2: The second of two double-precision floating-point numbers to compare. Returns: Parameter val1 or val2,whichever is smaller. If val1,val2,or both val1 and val2 are equal to System.Double.NaN,System.Double.NaN is returned. Min(val1: UInt32,val2: UInt32) -> UInt32 Returns the smaller of two 32-bit unsigned integers. val1: The first of two 32-bit unsigned integers to compare. val2: The second of two 32-bit unsigned integers to compare. Returns: Parameter val1 or val2,whichever is smaller. Min(val1: Byte,val2: Byte) -> Byte Returns the smaller of two 8-bit unsigned integers. val1: The first of two 8-bit unsigned integers to compare. val2: The second of two 8-bit unsigned integers to compare. Returns: Parameter val1 or val2,whichever is smaller. Min(val1: SByte,val2: SByte) -> SByte Returns the smaller of two 8-bit signed integers. val1: The first of two 8-bit signed integers to compare. val2: The second of two 8-bit signed integers to compare. Returns: Parameter val1 or val2,whichever is smaller. Min(val1: Int16,val2: Int16) -> Int16 Returns the smaller of two 16-bit signed integers. val1: The first of two 16-bit signed integers to compare. val2: The second of two 16-bit signed integers to compare. Returns: Parameter val1 or val2,whichever is smaller. Min(val1: int,val2: int) -> int Returns the smaller of two 32-bit signed integers. val1: The first of two 32-bit signed integers to compare. val2: The second of two 32-bit signed integers to compare. Returns: Parameter val1 or val2,whichever is smaller. Min(val1: UInt16,val2: UInt16) -> UInt16 Returns the smaller of two 16-bit unsigned integers. val1: The first of two 16-bit unsigned integers to compare. val2: The second of two 16-bit unsigned integers to compare. Returns: Parameter val1 or val2,whichever is smaller. """ pass @staticmethod def Pow(x,y): """ Pow(x: float,y: float) -> float Returns a specified number raised to the specified power. x: A double-precision floating-point number to be raised to a power. y: A double-precision floating-point number that specifies a power. Returns: The number x raised to the power y. """ pass @staticmethod def Round(*__args): """ Round(d: Decimal,decimals: int) -> Decimal Rounds a decimal value to a specified number of fractional digits. d: A decimal number to be rounded. decimals: The number of decimal places in the return value. Returns: The number nearest to d that contains a number of fractional digits equal to decimals. Round(d: Decimal) -> Decimal Rounds a decimal value to the nearest integral value. d: A decimal number to be rounded. Returns: The integer nearest parameter d. If the fractional component of d is halfway between two integers,one of which is even and the other odd,the even number is returned. Note that this method returns a System.Decimal instead of an integral type. Round(d: Decimal,decimals: int,mode: MidpointRounding) -> Decimal Rounds a decimal value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two other numbers. d: A decimal number to be rounded. decimals: The number of decimal places in the return value. mode: Specification for how to round d if it is midway between two other numbers. Returns: The number nearest to d that contains a number of fractional digits equal to decimals. If d has fewer fractional digits than decimals,d is returned unchanged. Round(d: Decimal,mode: MidpointRounding) -> Decimal Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers. d: A decimal number to be rounded. mode: Specification for how to round d if it is midway between two other numbers. Returns: The integer nearest d. If d is halfway between two numbers,one of which is even and the other odd,then mode determines which of the two is returned. Round(value: float,digits: int) -> float Rounds a double-precision floating-point value to a specified number of fractional digits. value: A double-precision floating-point number to be rounded. digits: The number of fractional digits in the return value. Returns: The number nearest to value that contains a number of fractional digits equal to digits. Round(a: float) -> float Rounds a double-precision floating-point value to the nearest integral value. a: A double-precision floating-point number to be rounded. Returns: The integer nearest a. If the fractional component of a is halfway between two integers,one of which is even and the other odd,then the even number is returned. Note that this method returns a System.Double instead of an integral type. Round(value: float,digits: int,mode: MidpointRounding) -> float Rounds a double-precision floating-point value to the specified number of fractional digits. A parameter specifies how to round the value if it is midway between two other numbers. value: A double-precision floating-point number to be rounded. digits: The number of fractional digits in the return value. mode: Specification for how to round value if it is midway between two other numbers. Returns: The number nearest to value that has a number of fractional digits equal to digits. If value has fewer fractional digits than digits,value is returned unchanged. Round(value: float,mode: MidpointRounding) -> float Rounds a double-precision floating-point value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers. value: A double-precision floating-point number to be rounded. mode: Specification for how to round value if it is midway between two other numbers. Returns: The integer nearest value. If value is halfway between two integers,one of which is even and the other odd,then mode determines which of the two is returned. """ pass @staticmethod def Sign(value): """ Sign(value: Single) -> int Returns a value indicating the sign of a single-precision floating-point number. value: A signed number. Returns: A number that indicates the sign of value,as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero. Sign(value: float) -> int Returns a value indicating the sign of a double-precision floating-point number. value: A signed number. Returns: A number that indicates the sign of value,as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero. Sign(value: Decimal) -> int Returns a value indicating the sign of a decimal number. value: A signed decimal number. Returns: A number that indicates the sign of value,as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero. Sign(value: Int64) -> int Returns a value indicating the sign of a 64-bit signed integer. value: A signed number. Returns: A number that indicates the sign of value,as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero. Sign(value: SByte) -> int Returns a value indicating the sign of an 8-bit signed integer. value: A signed number. Returns: A number that indicates the sign of value,as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero. Sign(value: Int16) -> int Returns a value indicating the sign of a 16-bit signed integer. value: A signed number. Returns: A number that indicates the sign of value,as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero. Sign(value: int) -> int Returns a value indicating the sign of a 32-bit signed integer. value: A signed number. Returns: A number that indicates the sign of value,as shown in the following table.Return value Meaning -1 value is less than zero. 0 value is equal to zero. 1 value is greater than zero. """ pass @staticmethod def Sin(a): """ Sin(a: float) -> float Returns the sine of the specified angle. a: An angle,measured in radians. Returns: The sine of a. If a is equal to System.Double.NaN, System.Double.NegativeInfinity,or System.Double.PositiveInfinity,this method returns System.Double.NaN. """ pass @staticmethod def Sinh(value): """ Sinh(value: float) -> float Returns the hyperbolic sine of the specified angle. value: An angle,measured in radians. Returns: The hyperbolic sine of value. If value is equal to System.Double.NegativeInfinity,System.Double.PositiveInfinity,or System.Double.NaN,this method returns a System.Double equal to value. """ pass @staticmethod def Sqrt(d): """ Sqrt(d: float) -> float Returns the square root of a specified number. d: A number. Returns: One of the values in the following table. d parameter Return value Zero,or positive The positive square root of d. Negative System.Double.NaNEquals System.Double.NaNSystem.Double.NaNEquals System.Double.PositiveInfinitySystem.Double.PositiveInfinity """ pass @staticmethod def Tan(a): """ Tan(a: float) -> float Returns the tangent of the specified angle. a: An angle,measured in radians. Returns: The tangent of a. If a is equal to System.Double.NaN, System.Double.NegativeInfinity,or System.Double.PositiveInfinity,this method returns System.Double.NaN. """ pass @staticmethod def Tanh(value): """ Tanh(value: float) -> float Returns the hyperbolic tangent of the specified angle. value: An angle,measured in radians. Returns: The hyperbolic tangent of value. If value is equal to System.Double.NegativeInfinity,this method returns -1. If value is equal to System.Double.PositiveInfinity,this method returns 1. If value is equal to System.Double.NaN,this method returns System.Double.NaN. """ pass @staticmethod def Truncate(d): """ Truncate(d: float) -> float Calculates the integral part of a specified double-precision floating-point number. d: A number to truncate. Returns: The integral part of d; that is,the number that remains after any fractional digits have been discarded,or one of the values listed in the following table. dReturn valueSystem.Double.NaNSystem.Double.NaNSystem.Double.NegativeInfinitySystem.Doub le.NegativeInfinitySystem.Double.PositiveInfinitySystem.Double.PositiveInfinity Truncate(d: Decimal) -> Decimal Calculates the integral part of a specified decimal number. d: A number to truncate. Returns: The integral part of d; that is,the number that remains after any fractional digits have been discarded. """ pass E=2.7182818284590451 PI=3.1415926535897931 __all__=[ 'Abs', 'Acos', 'Asin', 'Atan', 'Atan2', 'BigMul', 'Ceiling', 'Cos', 'Cosh', 'DivRem', 'E', 'Exp', 'Floor', 'IEEERemainder', 'Log', 'Log10', 'Max', 'Min', 'PI', 'Pow', 'Round', 'Sign', 'Sin', 'Sinh', 'Sqrt', 'Tan', 'Tanh', 'Truncate', ]
# Copyright 2018 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Partial implementation for placing the messages support stub file in the archive.""" load( "@build_bazel_rules_apple//apple/internal:file_support.bzl", "file_support", ) load( "@build_bazel_rules_apple//apple/internal:intermediates.bzl", "intermediates", ) load( "@build_bazel_rules_apple//apple/internal:processor.bzl", "processor", ) load( "@bazel_skylib//lib:partial.bzl", "partial", ) _AppleMessagesStubInfo = provider( doc = """ Private provider to propagate the messages stub that needs to be package in the iOS archive. """, fields = { "binary": """ File artifact that contains a reference to the stub binary that needs to be packaged in the iOS archive. """, }, ) def _messages_stub_partial_impl(ctx, binary_artifact, package_messages_support): """Implementation for the messages support stub processing partial.""" bundle_files = [] providers = [] if package_messages_support: # TODO(kaipi): Make extensions a parameter of the partial, not a hardcoded lookup in the # partial. if hasattr(ctx.attr, "extensions"): extension_binaries = [ x[_AppleMessagesStubInfo].binary for x in ctx.attr.extensions if _AppleMessagesStubInfo in x ] elif hasattr(ctx.attr, "extension") and _AppleMessagesStubInfo in ctx.attr.extension: extension_binaries = [ctx.attr.extension[_AppleMessagesStubInfo].binary] else: extension_binaries = [] if extension_binaries: bundle_files.append( ( processor.location.archive, "MessagesApplicationExtensionSupport", depset([extension_binaries[0]]), ), ) if binary_artifact: intermediate_file = intermediates.file( ctx.actions, ctx.label.name, "MessagesApplicationSupportStub", ) file_support.symlink(ctx, binary_artifact, intermediate_file) bundle_files.append( ( processor.location.archive, "MessagesApplicationSupport", depset([intermediate_file]), ), ) elif binary_artifact: intermediate_file = intermediates.file( ctx.actions, ctx.label.name, "MessagesApplicationExtensionSupportStub", ) file_support.symlink(ctx, binary_artifact, intermediate_file) providers.append(_AppleMessagesStubInfo(binary = intermediate_file)) return struct( bundle_files = bundle_files, providers = providers, ) def messages_stub_partial(binary_artifact = None, package_messages_support = False): """Constructor for the messages support stub processing partial. This partial copies the messages support stubs into the expected location for iOS archives. Args: binary_artifact: The stub binary to copy. package_messages_support: Whether to package the messages stub binary in the archive root. Returns: A partial that returns the bundle location of the stub binaries. """ return partial.make( _messages_stub_partial_impl, binary_artifact = binary_artifact, package_messages_support = package_messages_support, )
numeros = [111, 7, 2, 1] print(len(numeros)) print(numeros) #Un nuevo elemento puede ser añadido al final de la lista existente: #Dicha operación se realiza mediante un método llamado "append()". #Toma el valor de su argumento y lo coloca al final de la lista que posee el método. #La longitud de la lista aumenta en uno. numeros.append(4) print(len(numeros)) print(numeros) #El método "insert()" es un poco más inteligente: #puede agregar un nuevo elemento en cualquier lugar de la lista, no solo al final. # - lista.insert(ubicación,valor) #Nota: todos los elementos existentes que ocupan ubicaciones a la derecha del nuevo elemento #(incluido el que está en la posición indicada) se desplazan a la derecha, #para hacer espacio para el nuevo elemento. numeros.insert(0,222) print(len(numeros)) print(numeros) numeros.insert(3,777) print(len(numeros)) print(numeros) #Extra: #Python ofrece una forma más conveniente de hacer el intercambio de variables, echa un vistazo: #Metodo tradicional variable1 = 1 variable2 = 2 auxiliar = variable1 variable1 = variable2 variable2 = auxiliar print(variable1, variable2) #forma de intercambio en Python variable1, variable2 = variable2, variable1 print(variable1, variable2)
def aumento(num=0, p=0, form=False): """ -> Calcula uma porcentagem e soma :param num: preço :param p: porcentagem à calcular :param form: (opcional) formatação (.2float e troca de ponto por virgula) :return: :var f : que é o resultado do calculo de porcentagem """ f = num + (num * p / 100) return f if form is False else moeda(f) def reduz(num=0, p=0, form=False): """ -> Calcula a porcentagem e reduz do valor ou preço :param num: preço (padrão=0) :param p: porcentagem(%) (padrão = 0) :param form: (opcional) formatação (.2Float trocando o ponto '.' por 'virgula') :return: """ f = num - (num * p / 100) return f if form is False else moeda(f) def dobro(num=0, form=False): """ -> Adiciona o dobro ao valor ou preço :param num: preço ou valor(padrão = 0) :param form: (opcional) formatação (.2Float e troca '.' por ','virgula) :return: :var f : dobro do preço ou valor. """ f = num * 2 return f if not form else moeda(f) def metade(num=0, form=False): """ -> Reduz a metade(/2) o preço ou valor :param num: preço ou valor(padrão=0) :param form: (opcional) formatação(.2Float e troca '.', ',') :return: :var f: produto da substraçÃO(-50%) """ f = num / 2 return f if not form else moeda(f) def moeda(num=0, moed='R$'): return f'{moed}{num:.2f}'.replace('.', ',') def resumo(num, aum, dim): """ -> Mostra um quadro analisando, preço(dobro, metade, +%, -%) :param num: preço ou valor :param aum: porcentagem de aumento (+%) :param dim: porcentagem de redução (-%) """ print('--' * 15) print(f'{"Resumo do valor":^30}'.upper()) print('--' * 15) print(f'{"Preço analisado":.<22}{moeda(num):<9}') print(f'{"Dobro do preço":.<22}{dobro(num,True):<9}') print(f'{"Metade do preço":.<22}{metade(num,True):<9}') print(f'{aum}% {"Aumento do preço":.<18}{aumento(num, aum, True):<9}') print(f'{dim}% {"Redução do preço":.<18}{reduz(num,dim, True):<9}')
## Error to exception # The intention is to return an error # from def withdraw(self, amount): if amount > self.balance: return -1 else: self.balance -= amount return 0 # to def withdraw(self, amount): if amount > self.balance: raise BalanceException() # or Exception self.balance -= amount # now wrap the caller with try/Except ## Exception to test # The intention is to test # from def getValueForPeriod(periodNumber): try: return values[periodNumber] except IndexError: return 0 # to def getValueForPeriod(self, periodNumber): if periodNumber >= len(self.values): return 0 return self.values[periodNumber]
# -*- coding: utf-8 -*- __version_info__ = '0.6.3' __version__ = '0.6.3' version = '0.6.3'
''' Building your own digit recognition model You've reached the final exercise of the course - you now know everything you need to build an accurate model to recognize handwritten digits! We've already done the basic manipulation of the MNIST dataset shown in the video, so you have X and y loaded and ready to model with. Sequential and Dense from keras are also pre-imported. To add an extra challenge, we've loaded only 2500 images, rather than 60000 which you will see in some published results. Deep learning models perform better with more data, however, they also take longer to train, especially when they start becoming more complex. If you have a computer with a CUDA compatible GPU, you can take advantage of it to improve computation time. If you don't have a GPU, no problem! You can set up a deep learning environment in the cloud that can run your models on a GPU. Here is a blog post by Dan that explains how to do this - check it out after completing this exercise! It is a great next step as you continue your deep learning journey. INSTRUCTIONS 100XP Create a Sequential object to start your model. Call this model. Add the first Dense hidden layer of 50 units to your model with 'relu' activation. For this data, the input_shape is (784,). Add a second Dense hidden layer with 50 units and a 'relu' activation function. Add the output layer. Your activation function should be 'softmax', and the number of nodes in this layer should be the same as the number of possible outputs in this case: 10. Compile model as you have done with previous models: Using 'adam' as the optimizer, 'categorical_crossentropy' for the loss, and metrics=['accuracy']. Fit the model using X and y using a validation_split of 0.3. ''' # Create the model: model model = Sequential() # Add the first hidden layer model.add(Dense(50, activation='relu', input_shape=(784,))) # Add the second hidden layer model.add(Dense(50, activation='relu', input_shape=(784,))) # Add the output layer model.add(Dense(10, activation='softmax')) # Compile the model model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy']) # Fit the model model.fit(X, y, validation_split=0.3)
''' Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are on vacation, return a string of the form "7:00" indicating when the alarm clock should ring. Weekdays, the alarm should be "7:00" and on the weekend it should be "10:00". Unless we are on vacation -- then on weekdays it should be "10:00" and weekends it should be "off". ''' def alarm_clock(day, vacation): if vacation: if day < 6 and day != 0: return "10:00" return "off" else: if day < 6 and day != 0: return "7:00" return "10:00"
""" Created on Jan 28 16:58 2020 @author: nishit """
def original(abreviada): out = '' # Concatenaremos la palabra original i = 0 # Para los indices del string while i < len(abreviada): # Recorremos los indices del string n = int(abreviada[i]) # Obtenemos el numero de repeticiones l = abreviada[i+1] # Obtenemos la letra out += l * n # Se concatena el texto con la repetición de cada letra i += 2 # Nos saltamos 2 indices, dada la estructura de los textos abreviados return out # Entrada y salida abr = input("Ingrese palabra abreviada: ") print("Original:", original(abr))
test = { 'name': 'remove', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (remove 3 nil) () """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (remove 2 '(1 3 2)) (1 3) """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (remove 1 '(1 3 2)) (3 2) """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (remove 42 '(1 3 2)) (1 3 2) """, 'hidden': False, 'locked': False }, { 'code': r""" scm> (remove 3 '(1 3 3 7)) (1 7) """, 'hidden': False, 'locked': False } ], 'scored': True, 'setup': r""" scm> (load-all ".") """, 'teardown': '', 'type': 'scheme' } ] }
# -*- coding: utf-8 -*- # # Author: Tomi Jylhä-Ollila, Finland 2016 # # This file is part of Kunquat. # # CC0 1.0 Universal, http://creativecommons.org/publicdomain/zero/1.0/ # # To the extent possible under law, Kunquat Affirmers have waived all # copyright and related or neighboring rights to Kunquat. # def get_proc_params(ui_model, au_id, proc_id): module = ui_model.get_module() au = module.get_audio_unit(au_id) proc = au.get_processor(proc_id) proc_params = proc.get_type_params() return proc_params
# -*- coding:utf-8 -*- # --------------------------------------------- # @file BubbleSort.py # @description Bubble Sort # @author WcJun # @date 2020/06/21 # --------------------------------------------- # 时间复杂度: 最好:O(n) 最坏:(n^2) # 稳定性: 稳定 # bubble_sort def bubble_sort(origin_list): length = len(origin_list) for i in range(length - 1): for j in range(length - 1 - i): if origin_list[j] > origin_list[j + 1]: origin_list[j], origin_list[j + 1] = origin_list[j + 1], origin_list[j] print(f"--------------------------------------{i}") array_sort = [75, 3, 6, 44, 22, 99, 11] print("原数组") print(array_sort) bubble_sort(array_sort) print("排序后数组") print(array_sort) # bubble_sort def bubble_sort2(origin_list): for i in range(len(origin_list) - 1, 0, -1): for j in range(i): if origin_list[j] > origin_list[j + 1]: origin_list[j], origin_list[j + 1] = origin_list[j + 1], origin_list[j] print(f"==============================={i}") array_sort2 = [75, 3, 6, 44, 22, 99, 11] print("原数组") print(array_sort2) bubble_sort2(array_sort2) print("排序后数组") print(array_sort2) # bubble_sort def bubble_sort3(origin_list): for i in range(len(origin_list) - 1, 0, -1): swap_count = 0 for j in range(i): if origin_list[j] > origin_list[j + 1]: origin_list[j], origin_list[j + 1] = origin_list[j + 1], origin_list[j] swap_count += 1 print(f"==============================={i}") if swap_count == 0: break array_sort3 = [3, 6, 11, 22, 44, 75, 99] print("原数组") print(array_sort3) bubble_sort3(array_sort3) print("排序后数组") print(array_sort3)
r = 'SIM' while r == 'SIM': n = int(input('Digite um valor: ')) r = str(input('Quer continuar? Sim/Não: ')).upper() print('Fim')
# # PySNMP MIB module ARISTA-QOS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ARISTA-QOS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:09:19 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) # aristaMibs, = mibBuilder.importSymbols("ARISTA-SMI-MIB", "aristaMibs") Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion") PhysicalIndexOrZero, = mibBuilder.importSymbols("ENTITY-MIB", "PhysicalIndexOrZero") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") iso, NotificationType, ObjectIdentity, Bits, MibIdentifier, ModuleIdentity, IpAddress, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, Gauge32, TimeTicks, Counter64, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "NotificationType", "ObjectIdentity", "Bits", "MibIdentifier", "ModuleIdentity", "IpAddress", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "Gauge32", "TimeTicks", "Counter64", "Integer32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") aristaQosMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 30065, 3, 13)) aristaQosMib.setRevisions(('2016-07-22 00:00', '2016-03-21 00:00', '2014-08-15 00:00', '2014-05-22 00:00', '2013-06-01 00:00',)) if mibBuilder.loadTexts: aristaQosMib.setLastUpdated('201607220000Z') if mibBuilder.loadTexts: aristaQosMib.setOrganization('Arista Networks, Inc.') class AristaQosMapType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("controlPlane", 1), ("dataPlane", 2)) class AristaQosShortId(TextualConvention, OctetString): status = 'current' displayHint = '255a' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 40) aristaQosMibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1)) aristaQosMibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2)) aristaClassMapTable = MibTable((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 1), ) if mibBuilder.loadTexts: aristaClassMapTable.setStatus('current') aristaClassMapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 1, 1), ).setIndexNames((0, "ARISTA-QOS-MIB", "aristaClassMapId"), (0, "ARISTA-QOS-MIB", "aristaClassMapType")) if mibBuilder.loadTexts: aristaClassMapEntry.setStatus('current') aristaClassMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 1, 1, 1), AristaQosShortId()) if mibBuilder.loadTexts: aristaClassMapId.setStatus('current') aristaClassMapType = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 1, 1, 2), AristaQosMapType()) if mibBuilder.loadTexts: aristaClassMapType.setStatus('current') aristaClassMapName = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaClassMapName.setStatus('current') aristaClassMapMatchCondition = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("matchConditionAny", 1), ("matchConditionAll", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaClassMapMatchCondition.setStatus('current') aristaClassMapMatchTable = MibTable((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 2), ) if mibBuilder.loadTexts: aristaClassMapMatchTable.setStatus('current') aristaClassMapMatchEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 2, 1), ).setIndexNames((0, "ARISTA-QOS-MIB", "aristaClassMapId"), (0, "ARISTA-QOS-MIB", "aristaClassMapType"), (0, "ARISTA-QOS-MIB", "aristaClassMapMatchIndex")) if mibBuilder.loadTexts: aristaClassMapMatchEntry.setStatus('current') aristaClassMapMatchIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))) if mibBuilder.loadTexts: aristaClassMapMatchIndex.setStatus('current') aristaClassMapMatchType = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("ipv4AccessGroup", 1), ("ipv6AccessGroup", 2), ("vlan", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaClassMapMatchType.setStatus('current') aristaClassMapMatchName = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 100))).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaClassMapMatchName.setStatus('current') aristaPolicyMapTable = MibTable((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 3), ) if mibBuilder.loadTexts: aristaPolicyMapTable.setStatus('current') aristaPolicyMapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 3, 1), ).setIndexNames((0, "ARISTA-QOS-MIB", "aristaPolicyMapId"), (0, "ARISTA-QOS-MIB", "aristaPolicyMapType")) if mibBuilder.loadTexts: aristaPolicyMapEntry.setStatus('current') aristaPolicyMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 3, 1, 1), AristaQosShortId()) if mibBuilder.loadTexts: aristaPolicyMapId.setStatus('current') aristaPolicyMapType = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 3, 1, 2), AristaQosMapType()) if mibBuilder.loadTexts: aristaPolicyMapType.setStatus('current') aristaPolicyMapName = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 3, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaPolicyMapName.setStatus('current') aristaPolicyMapClassTable = MibTable((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 4), ) if mibBuilder.loadTexts: aristaPolicyMapClassTable.setStatus('current') aristaPolicyMapClassEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 4, 1), ).setIndexNames((0, "ARISTA-QOS-MIB", "aristaPolicyMapId"), (0, "ARISTA-QOS-MIB", "aristaPolicyMapType"), (0, "ARISTA-QOS-MIB", "aristaPolicyMapClassIndex")) if mibBuilder.loadTexts: aristaPolicyMapClassEntry.setStatus('current') aristaPolicyMapClassIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: aristaPolicyMapClassIndex.setStatus('current') aristaPolicyMapClassId = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 4, 1, 2), AristaQosShortId()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaPolicyMapClassId.setStatus('current') aristaPolicyMapActionTable = MibTable((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 5), ) if mibBuilder.loadTexts: aristaPolicyMapActionTable.setStatus('current') aristaPolicyMapActionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 5, 1), ).setIndexNames((0, "ARISTA-QOS-MIB", "aristaPolicyMapId"), (0, "ARISTA-QOS-MIB", "aristaPolicyMapType"), (0, "ARISTA-QOS-MIB", "aristaClassMapId"), (0, "ARISTA-QOS-MIB", "aristaPolicyMapActionType")) if mibBuilder.loadTexts: aristaPolicyMapActionEntry.setStatus('current') aristaPolicyMapActionType = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("actionSetShape", 1), ("actionSetBandwidth", 2), ("actionSetCos", 3), ("actionSetDscp", 4), ("actionSetTc", 5)))) if mibBuilder.loadTexts: aristaPolicyMapActionType.setStatus('current') aristaPolicyMapActionRateUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("rateUnitNone", 0), ("rateUnitPps", 1), ("rateUnitKbps", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaPolicyMapActionRateUnit.setStatus('current') aristaPolicyMapActionValue = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 5, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaPolicyMapActionValue.setStatus('current') aristaServicePolicyTable = MibTable((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 6), ) if mibBuilder.loadTexts: aristaServicePolicyTable.setStatus('current') aristaServicePolicyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 6, 1), ).setIndexNames((0, "ARISTA-QOS-MIB", "aristaServicePolicyIfIndex"), (0, "ARISTA-QOS-MIB", "aristaServicePolicyDirection")) if mibBuilder.loadTexts: aristaServicePolicyEntry.setStatus('current') aristaServicePolicyIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 6, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: aristaServicePolicyIfIndex.setStatus('current') aristaServicePolicyDirection = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 6, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("input", 1), ("output", 2)))) if mibBuilder.loadTexts: aristaServicePolicyDirection.setStatus('current') aristaServicePolicyMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 6, 1, 3), AristaQosShortId()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaServicePolicyMapId.setStatus('current') aristaServicePolicyMapType = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 6, 1, 4), AristaQosMapType()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaServicePolicyMapType.setStatus('current') aristaQosStatsTable = MibTable((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 7), ) if mibBuilder.loadTexts: aristaQosStatsTable.setStatus('current') aristaQosStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 7, 1), ).setIndexNames((0, "ARISTA-QOS-MIB", "aristaPolicyMapId"), (0, "ARISTA-QOS-MIB", "aristaPolicyMapType"), (0, "ARISTA-QOS-MIB", "aristaClassMapId"), (0, "ARISTA-QOS-MIB", "aristaServicePolicyDirection")) if mibBuilder.loadTexts: aristaQosStatsEntry.setStatus('current') aristaQosPktsDropped = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 7, 1, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaQosPktsDropped.setStatus('current') aristaQosPktsSent = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 7, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaQosPktsSent.setStatus('current') aristaQosPktsMatched = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 7, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaQosPktsMatched.setStatus('current') aristaEcnCounterTable = MibTable((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 8), ) if mibBuilder.loadTexts: aristaEcnCounterTable.setStatus('current') aristaEcnCounterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 8, 1), ).setIndexNames((0, "ARISTA-QOS-MIB", "aristaEcnCounterDescriptor")) if mibBuilder.loadTexts: aristaEcnCounterEntry.setStatus('current') aristaEcnCounterDescriptor = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 8, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))) if mibBuilder.loadTexts: aristaEcnCounterDescriptor.setStatus('current') aristaEcnCounterValue = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 8, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaEcnCounterValue.setStatus('current') aristaEcnCounterEntity = MibTableColumn((1, 3, 6, 1, 4, 1, 30065, 3, 13, 1, 8, 1, 3), PhysicalIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: aristaEcnCounterEntity.setStatus('current') aristaQosMibCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2, 1)) aristaQosMibGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2, 2)) aristaQosMibCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2, 1, 1)).setObjects(("ARISTA-QOS-MIB", "aristaClassMapGroup"), ("ARISTA-QOS-MIB", "aristaPolicyMapGroup"), ("ARISTA-QOS-MIB", "aristaPolicyMapActionGroup"), ("ARISTA-QOS-MIB", "aristaServicePolicyGroup"), ("ARISTA-QOS-MIB", "aristaEcnCounterGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): aristaQosMibCompliance = aristaQosMibCompliance.setStatus('current') aristaClassMapGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2, 2, 1)).setObjects(("ARISTA-QOS-MIB", "aristaClassMapName"), ("ARISTA-QOS-MIB", "aristaClassMapMatchCondition"), ("ARISTA-QOS-MIB", "aristaClassMapMatchType"), ("ARISTA-QOS-MIB", "aristaClassMapMatchName"), ("ARISTA-QOS-MIB", "aristaPolicyMapClassId"), ("ARISTA-QOS-MIB", "aristaQosPktsDropped"), ("ARISTA-QOS-MIB", "aristaQosPktsMatched"), ("ARISTA-QOS-MIB", "aristaQosPktsSent")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): aristaClassMapGroup = aristaClassMapGroup.setStatus('current') aristaPolicyMapGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2, 2, 2)).setObjects(("ARISTA-QOS-MIB", "aristaPolicyMapName")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): aristaPolicyMapGroup = aristaPolicyMapGroup.setStatus('current') aristaPolicyMapActionGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2, 2, 3)).setObjects(("ARISTA-QOS-MIB", "aristaPolicyMapActionRateUnit"), ("ARISTA-QOS-MIB", "aristaPolicyMapActionValue")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): aristaPolicyMapActionGroup = aristaPolicyMapActionGroup.setStatus('current') aristaServicePolicyGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2, 2, 4)).setObjects(("ARISTA-QOS-MIB", "aristaServicePolicyMapId"), ("ARISTA-QOS-MIB", "aristaServicePolicyMapType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): aristaServicePolicyGroup = aristaServicePolicyGroup.setStatus('current') aristaEcnCounterGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 30065, 3, 13, 2, 2, 5)).setObjects(("ARISTA-QOS-MIB", "aristaEcnCounterValue"), ("ARISTA-QOS-MIB", "aristaEcnCounterEntity")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): aristaEcnCounterGroup = aristaEcnCounterGroup.setStatus('current') mibBuilder.exportSymbols("ARISTA-QOS-MIB", aristaQosStatsTable=aristaQosStatsTable, aristaQosMibConformance=aristaQosMibConformance, aristaClassMapTable=aristaClassMapTable, aristaEcnCounterValue=aristaEcnCounterValue, AristaQosMapType=AristaQosMapType, aristaEcnCounterEntity=aristaEcnCounterEntity, aristaClassMapMatchEntry=aristaClassMapMatchEntry, aristaClassMapName=aristaClassMapName, aristaClassMapId=aristaClassMapId, aristaPolicyMapClassEntry=aristaPolicyMapClassEntry, aristaServicePolicyIfIndex=aristaServicePolicyIfIndex, aristaServicePolicyMapId=aristaServicePolicyMapId, aristaClassMapType=aristaClassMapType, aristaEcnCounterGroup=aristaEcnCounterGroup, aristaClassMapMatchName=aristaClassMapMatchName, aristaPolicyMapClassIndex=aristaPolicyMapClassIndex, aristaPolicyMapActionTable=aristaPolicyMapActionTable, aristaQosStatsEntry=aristaQosStatsEntry, aristaQosPktsSent=aristaQosPktsSent, aristaClassMapMatchCondition=aristaClassMapMatchCondition, aristaPolicyMapTable=aristaPolicyMapTable, aristaClassMapMatchIndex=aristaClassMapMatchIndex, aristaPolicyMapName=aristaPolicyMapName, aristaPolicyMapGroup=aristaPolicyMapGroup, aristaEcnCounterEntry=aristaEcnCounterEntry, aristaPolicyMapId=aristaPolicyMapId, aristaPolicyMapClassTable=aristaPolicyMapClassTable, aristaQosMibObjects=aristaQosMibObjects, aristaClassMapEntry=aristaClassMapEntry, aristaPolicyMapActionRateUnit=aristaPolicyMapActionRateUnit, aristaPolicyMapActionGroup=aristaPolicyMapActionGroup, aristaEcnCounterTable=aristaEcnCounterTable, aristaQosMibCompliance=aristaQosMibCompliance, aristaServicePolicyGroup=aristaServicePolicyGroup, aristaPolicyMapActionEntry=aristaPolicyMapActionEntry, aristaServicePolicyMapType=aristaServicePolicyMapType, aristaServicePolicyDirection=aristaServicePolicyDirection, aristaQosPktsDropped=aristaQosPktsDropped, aristaQosPktsMatched=aristaQosPktsMatched, aristaPolicyMapEntry=aristaPolicyMapEntry, aristaPolicyMapType=aristaPolicyMapType, aristaServicePolicyTable=aristaServicePolicyTable, PYSNMP_MODULE_ID=aristaQosMib, aristaClassMapMatchType=aristaClassMapMatchType, aristaEcnCounterDescriptor=aristaEcnCounterDescriptor, aristaPolicyMapActionValue=aristaPolicyMapActionValue, AristaQosShortId=AristaQosShortId, aristaClassMapMatchTable=aristaClassMapMatchTable, aristaQosMibCompliances=aristaQosMibCompliances, aristaQosMibGroups=aristaQosMibGroups, aristaClassMapGroup=aristaClassMapGroup, aristaPolicyMapActionType=aristaPolicyMapActionType, aristaQosMib=aristaQosMib, aristaPolicyMapClassId=aristaPolicyMapClassId, aristaServicePolicyEntry=aristaServicePolicyEntry)
class Solution(object): def findErrorNums(self, nums): """ :type nums: List[int] :rtype: List[int] """ for i in range(len(nums)): if nums[i] != i + 1: cur = nums[i] while True: replace = nums[cur - 1] if replace == cur: break else: nums[cur - 1] = cur nums[i] = replace cur = replace for i in range(len(nums)): if nums[i] != i + 1: return (nums[i], i + 1)
# twonums_sum returns the index of the nums inside the list that can become n def twonums_sum(n, lst): d = {} for i in range(len(lst)): d[lst[i]] = i # create number-subscript pair for i in range(len(lst)): if n - lst[i] in d: return i, d[n-lst[i]] return -1 lst = [1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 18, 19, 20, 21, 29, 34, 54, 65] n = int(input()) result = twonums_sum(n, lst) if result == -1: print("not found") else: print(result)
class Solution: def longestPalindrome(self, s: str) -> str: if not s or len(s) <= 1: return s result = '' max_len = 0 n = len(s) dp = [[False] * n for _ in range(n)] for i in range(n): dp[i][i] = True if 1 > max_len: max_len = 1 result = s[i] for i in range(n-1): if s[i] == s[i+1]: dp[i][i+1] = True if 2 > max_len: max_len = 2 result = s[i:i+2] for j in range(2, n): for i in range(j-1): # detect s[i]..s[j] if s[i] == s[j] and dp[i+1][j-1]: dp[i][j] = True if j-i+1 > max_len: max_len = j-i+1 result = s[i:j+1] return result if __name__== '__main__': solution = Solution() result = solution.longestPalindrome('ababababababa') print(result == 'ababababababa') result = solution.longestPalindrome('bananas') print(result == 'anana')
# coding=utf-8 """ Track your life like a pro on Google Calendar via your terminal. """ __version__ = '0.2.2' __author__ = 'adamchainz' __license__ = 'MIT'
class Computer: def __init__(self,prog): if type(prog)==str: prog = [int(x.strip()) for x in prog.split(",") if x.strip()] self.memory = prog def evaluate(self): pc = 0 while pc<len(self.memory) and self.memory[pc]!=99: if self.memory[pc]==1: from_, to_, store = self.memory[pc+1:pc+4] self.memory[store] = self.memory[from_]+self.memory[to_] pc+=4 elif self.memory[pc]==2: from_, to_, store = self.memory[pc+1:pc+4] self.memory[store] = self.memory[from_]*self.memory[to_] pc+=4 else: raise Exception("Unknown opcode {:02d} at {:02d}".format(self.memory[pc],pc))
# # PySNMP MIB module INTEL-ES480-VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INTEL-ES480-VLAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:42:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection") es480tAgent, = mibBuilder.importSymbols("INTEL-ES480-MIB", "es480tAgent") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") TimeTicks, ObjectIdentity, Bits, iso, NotificationType, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Integer32, MibIdentifier, Gauge32, Counter32, IpAddress, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "ObjectIdentity", "Bits", "iso", "NotificationType", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Integer32", "MibIdentifier", "Gauge32", "Counter32", "IpAddress", "Counter64") DisplayString, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "RowStatus") es480tVlan = ModuleIdentity((1, 3, 6, 1, 4, 1, 343, 6, 60, 2)) if mibBuilder.loadTexts: es480tVlan.setLastUpdated('0003170000Z') if mibBuilder.loadTexts: es480tVlan.setOrganization('Intel Corp.') es480tVlanGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 1)) es480tVirtualGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 2)) es480tEncapsulationGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 3)) es480tProtocolGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5)) class Es480tSwitchVlanType(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1)) namedValues = NamedValues(("vlanLayer2", 1)) es480tVlanIfTable = MibTable((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 1, 2), ) if mibBuilder.loadTexts: es480tVlanIfTable.setStatus('mandatory') es480tVlanIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 1, 2, 1), ).setIndexNames((0, "INTEL-ES480-VLAN-MIB", "es480tVlanIfIndex")) if mibBuilder.loadTexts: es480tVlanIfEntry.setStatus('mandatory') es480tVlanIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 1, 2, 1, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanIfIndex.setStatus('mandatory') es480tVlanIfDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 1, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanIfDescr.setStatus('mandatory') es480tVlanIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 1, 2, 1, 3), Es480tSwitchVlanType()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanIfType.setStatus('mandatory') es480tVlanIfGlobalIdentifier = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanIfGlobalIdentifier.setStatus('mandatory') es480tVlanIfStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 1, 2, 1, 6), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanIfStatus.setStatus('mandatory') class Es480tSwitchVlanEncapsType(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(2)) namedValues = NamedValues(("vlanEncaps8021q", 2)) es480tVlanEncapsIfTable = MibTable((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 3, 1), ) if mibBuilder.loadTexts: es480tVlanEncapsIfTable.setStatus('mandatory') es480tVlanEncapsIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 3, 1, 1), ).setIndexNames((0, "INTEL-ES480-VLAN-MIB", "es480tVlanEncapsIfIndex")) if mibBuilder.loadTexts: es480tVlanEncapsIfEntry.setStatus('mandatory') es480tVlanEncapsIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 3, 1, 1, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanEncapsIfIndex.setStatus('mandatory') es480tVlanEncapsIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 3, 1, 1, 2), Es480tSwitchVlanEncapsType()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanEncapsIfType.setStatus('mandatory') es480tVlanEncapsIfTag = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 3, 1, 1, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanEncapsIfTag.setStatus('mandatory') es480tVlanEncapsIfStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 3, 1, 1, 4), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanEncapsIfStatus.setStatus('mandatory') es480tNextAvailableVirtIfIndex = MibScalar((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 2, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: es480tNextAvailableVirtIfIndex.setStatus('mandatory') es480tVlanProtocolTable = MibTable((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 1), ) if mibBuilder.loadTexts: es480tVlanProtocolTable.setStatus('mandatory') es480tVlanProtocolEntry = MibTableRow((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 1, 1), ).setIndexNames((0, "INTEL-ES480-VLAN-MIB", "es480tVlanProtocolIndex"), (0, "INTEL-ES480-VLAN-MIB", "es480tVlanProtocolIdIndex")) if mibBuilder.loadTexts: es480tVlanProtocolEntry.setStatus('mandatory') es480tVlanProtocolIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolIndex.setStatus('mandatory') es480tVlanProtocolIdIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 6))).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolIdIndex.setStatus('mandatory') es480tVlanProtocolName = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolName.setStatus('mandatory') es480tVlanProtocolDllEncapsType = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("any", 1), ("ethertype", 2), ("llc", 3), ("llcSnapEthertype", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolDllEncapsType.setStatus('mandatory') es480tVlanProtocolId = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolId.setStatus('mandatory') es480tVlanProtocolStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 1, 1, 6), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolStatus.setStatus('mandatory') es480tVlanProtocolVlanTable = MibTable((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 2), ) if mibBuilder.loadTexts: es480tVlanProtocolVlanTable.setStatus('mandatory') es480tVlanProtocolVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 2, 1), ).setIndexNames((0, "INTEL-ES480-VLAN-MIB", "es480tVlanProtocolVlanIfIndex"), (0, "INTEL-ES480-VLAN-MIB", "es480tVlanProtocolVlanProtocolIndex")) if mibBuilder.loadTexts: es480tVlanProtocolVlanEntry.setStatus('mandatory') es480tVlanProtocolVlanIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 2, 1, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolVlanIfIndex.setStatus('mandatory') es480tVlanProtocolVlanProtocolIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 2, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolVlanProtocolIndex.setStatus('mandatory') es480tVlanProtocolVlanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 343, 6, 60, 2, 5, 2, 1, 3), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: es480tVlanProtocolVlanStatus.setStatus('mandatory') mibBuilder.exportSymbols("INTEL-ES480-VLAN-MIB", es480tVlanIfStatus=es480tVlanIfStatus, es480tVlanProtocolTable=es480tVlanProtocolTable, es480tVlanIfIndex=es480tVlanIfIndex, es480tVlanEncapsIfStatus=es480tVlanEncapsIfStatus, Es480tSwitchVlanEncapsType=Es480tSwitchVlanEncapsType, es480tVlanIfEntry=es480tVlanIfEntry, es480tNextAvailableVirtIfIndex=es480tNextAvailableVirtIfIndex, es480tVlanEncapsIfTable=es480tVlanEncapsIfTable, es480tVlanProtocolName=es480tVlanProtocolName, PYSNMP_MODULE_ID=es480tVlan, es480tVlanProtocolVlanEntry=es480tVlanProtocolVlanEntry, Es480tSwitchVlanType=Es480tSwitchVlanType, es480tVlanIfDescr=es480tVlanIfDescr, es480tEncapsulationGroup=es480tEncapsulationGroup, es480tVlanProtocolVlanProtocolIndex=es480tVlanProtocolVlanProtocolIndex, es480tVlanProtocolVlanStatus=es480tVlanProtocolVlanStatus, es480tVlanGroup=es480tVlanGroup, es480tVlanIfTable=es480tVlanIfTable, es480tVlanProtocolVlanTable=es480tVlanProtocolVlanTable, es480tVlan=es480tVlan, es480tVlanProtocolDllEncapsType=es480tVlanProtocolDllEncapsType, es480tVlanEncapsIfTag=es480tVlanEncapsIfTag, es480tVlanProtocolIdIndex=es480tVlanProtocolIdIndex, es480tVlanProtocolIndex=es480tVlanProtocolIndex, es480tVlanIfGlobalIdentifier=es480tVlanIfGlobalIdentifier, es480tVlanProtocolEntry=es480tVlanProtocolEntry, es480tVlanProtocolVlanIfIndex=es480tVlanProtocolVlanIfIndex, es480tVlanProtocolStatus=es480tVlanProtocolStatus, es480tVlanEncapsIfIndex=es480tVlanEncapsIfIndex, es480tVlanEncapsIfEntry=es480tVlanEncapsIfEntry, es480tVlanIfType=es480tVlanIfType, es480tProtocolGroup=es480tProtocolGroup, es480tVlanEncapsIfType=es480tVlanEncapsIfType, es480tVlanProtocolId=es480tVlanProtocolId, es480tVirtualGroup=es480tVirtualGroup)
class BaseError(Exception): pass class AddQueryInvalid(Exception): def __init__(self, exception, message="Parameter Add condition is invalid"): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {self.exception}' class DataValueInvalid(BaseError): def __init__(self, exception, message="Invalid value data given"): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {self.exception}' class NoneTypeValue(BaseError): def __init__(self, exception, message="The value is empty or none"): self.message = message self.exception = exception super().__init__(self.message) def __str__(self): return f'{self.message}: {self.exception}'
""" Django Extras ~~~~~~~~~~~~~ Extensions for Django to solve common development situations not (or not yet) covered by the core Django framework. """ __version__ = '0.3'
lang1 = {'Hindi','Urdu'} lang2= {'Punjabi'} print("Original Set: ", lang2) lang2 = lang1.copy() print("Copied Set: ", lang2)
# Celcius to Fahrenheit Temperature Converter cel = int(input('Enter Cº ')) f = (9 / 5) * cel + 32 print(cel, "celcius equals to", f, "fahrenheit degrees.")
def datacfg(): datacfg = dict() datacfg['abalone'] = dict() datacfg['abalone']['filepath'] = '.\\data\\abalone.pkl' datacfg['abalone']['targets'] = ['rings'] datacfg['abalone']['probtype'] = ['regression', 'classification'] datacfg['autoMpg'] = dict() datacfg['autoMpg']['filepath'] = '.\\data\\autoMpg.pkl' datacfg['autoMpg']['targets'] = ['mpg'] datacfg['autoMpg']['probtype'] = ['regression'] datacfg['bankMarketing'] = dict() datacfg['bankMarketing']['filepath'] = '.\\data\\bankMarketing.pkl' datacfg['bankMarketing']['targets'] = ['y'] datacfg['bankMarketing']['probtype'] = ['classification'] datacfg['bostonHousing'] = dict() datacfg['bostonHousing']['filepath'] = '.\\data\\bostonHousing.pkl' datacfg['bostonHousing']['targets'] = ['PRICE'] datacfg['bostonHousing']['probtype'] = ['regression'] datacfg['heartDiseaseWisconsin'] = dict() datacfg['heartDiseaseWisconsin']['filepath'] = '.\\data\\heartDiseaseWisconsin.pkl' datacfg['heartDiseaseWisconsin']['targets'] = ['num'] datacfg['heartDiseaseWisconsin']['probtype'] = ['regression'] datacfg['wineCultivar'] = dict() datacfg['wineCultivar']['filepath'] = '.\\data\\wineCultivar.pkl' datacfg['wineCultivar']['targets'] = ['cultivar'] datacfg['wineCultivar']['probtype'] = ['classification'] datacfg['winequality-red'] = dict() datacfg['winequality-red']['filepath'] = '.\\data\\winequality-red.pkl' datacfg['winequality-red']['targets'] = ['quality'] datacfg['winequality-red']['probtype'] = ['regression', 'classification'] datacfg['winequality-white'] = dict() datacfg['winequality-white']['filepath'] = '.\\data\\winequality-white.pkl' datacfg['winequality-white']['targets'] = ['quality'] datacfg['winequality-white']['probtype'] = ['regression', 'classification'] datacfg['iris'] = dict() datacfg['iris']['filepath'] = '.\\data\\iris.pkl' datacfg['iris']['targets'] = ['class'] datacfg['iris']['probtype'] = ['classification'] datacfg['pima'] = dict() datacfg['pima']['filepath'] = '.\\data\\pima.pkl' datacfg['pima']['targets'] = ['class'] datacfg['pima']['probtype'] = ['classification'] datacfg['adult'] = dict() datacfg['adult']['filepath'] = '.\\data\\adult.pkl' datacfg['adult']['targets'] = ['class'] datacfg['adult']['probtype'] = ['classification'] return datacfg
# -*- coding: utf-8 -*- class Video(): """ 视频类(非番剧剧集) """ def __init__(self, aid = None, title = None): if aid: self.aid = aid # article id 即av号 json中的 'id' 与此相同 if title: self.title = title # 标题 或 番剧名 self.cid = None # chat id 即弹幕池号 self.copyright = None # 是否拥有版权 官方2 用户1 没有-1 self.desc = None # 视频描述 或 番剧集数 如 '#1' # self.description = None # 同样是视频描述 self.author = None # 作者 self.pic = None # 视频封面 或 番剧该集的封面 self.pubdate = None # 发布时间 有时是按秒计有时是时间字符串 新番上传时间在 json 'created_at' 里 self.coin = None # 硬币 self.danmaku = None # 弹幕总量 json中的 'vedio_review' 与此相同 self.dislike = None self.favorites = None # 收藏数 番剧的话是追番人数 self.share = None # 分享数 self.play = None # 播放量 json中的 'view' 与此相同 self.review = None # 评论数 json中的 'reply' 与此相同 self.tname = None # 投稿分区名 json中的 'typename' 与此相同 self.tid = None # 投稿分区的序号 self.videos = None # 猜测是 分p数 self.his_rank = None # 历史排名 self.now_rank = None # 当前排名 self.arcurl = None # 视频地址 self.tag = None # 视频标签 self.type = None # 稿件类型 如 'video' self.duration = None # 片长 按秒计 self.online_count = None # 在线观看人数 self.pid = None # 当前分p self.part = None # 集数 如'04' 或 分p标题 还有个 'partname' 与 part 相同 self.From = None # 从什么页面跳转来的 # 番剧剧集 self.season_type_name = None # 一级分区名 self.season_type = None # 一级分区序号 self.season_status = None self.season_id = None self.season_title = None # 某一季的标题 self.cover = None # 一个番剧的封面 self.page = None self.pages = None self.vid = None self.offsite = None # Flash播放调用地址 self.ep_id = None self.index = None # 集数 self.index_title = None # 番剧的子标题 self.episode_status = None self.area = None self.jp_title = None self.actors = None self.media_id = None self.style = None # 视频所有者 owner self.face = None # 用户头像url self.mid = None # 用户ID self.name = None # 用户名 # 意义不明 self.attribute = None self.ctime = None # 好像与pubtime是一样的 self.dynamic = None # 不明 有的是标签 但是与tag格式不同 有的不知道是什么信息 self.state = None self.arcrank = None self.like = None self.badgepay = None self.senddate = None self.allow_bp = None self.allow_feed = None self.allow_download = None self.allow_review = None self.arctype = None self.created = None self.credit = None self.instant_server = None self.has_alias = None self.src = None class Episode(): def __init__(self): self.title = None self.aid = None self.cid = None self.cover = None self.duration = None self.ep_id = None # 剧集号 self.episode_status = None self.From = None self.index = None # 第几话 self.index_title = None # 该话标题 self.pub_real_time = None # 发布时间 self.link = None # 观看地址 self.play = None self.danmaku = None self.review = None self.favorite = None self.coin = None self.share = None self.like = None self.now_rank = None self.his_rank = None self.copyright = None self.online_count = None # up self.mid = None # 不明 self.vid = None class Bangumi(): def __init__(self): # 番剧 self.cover = None self.actors = None self.alias = None # 番剧别名 self.areas_id = None self.areas_name = None self.evaluate = None # 简介 self.jp_title = None self.link = None # 番剧主页 self.media_id = None # 番剧号 season_id 与此相同 self.newest_ep = None # 最新一话 self.is_finish = None self.is_started = None self.pub_time = None # 开播时间 self.weekday = None # 更新礼拜 self.season_status = None self.season_title = None # 类型 如 TV self.season_type = None self.square_cover = None # 番剧方形封面 self.staff = None self.coins = None self.danmakus = None self.favorites = None self.views = None self.reply = None self.share = None self.style = None self.title = None self.total_ep = None self.pub_ep = None# 已经放送的话数 self.score = None # 评分 self.user_count = None # 评分人数 # 剧集列表 self.episodes = None # up self.avatar = None self.mid = None self.uname = None # 权限信息 self.allow_bp = None self.allow_download = None self.allow_review = None self.copyright = None # 版权信息 self.is_preview = None self.watch_platform = None # 不明 self.is_paster_ads = None # 贴广告? self.mode = None
# Define echo def echo(n): """Return the inner_echo function.""" # Define inner_echo def inner_echo(word1): """Concatenate n copies of word1.""" echo_word = word1 * n return echo_word # Return inner_echo return inner_echo # Call echo: twice twice = echo(2) # Call echo: thrice thrice = echo(3) # Call twice() and thrice() then print print(twice('hello'), thrice('hello'))
def my_function(function): function() print(my_function(lambda : 99))
class Tokenizer: def tokenize(self, text): # remove comments but keep empty lines instead # to preserve line numbers lines = text.splitlines() lines = [('' if line.strip().startswith(';') else line) for line in lines] t = '\n'.join(lines) # expand symbols for easier tokenization t = t.replace('(', ' ( ') t = t.replace(')', ' ) ') tokens = t.split() return tokens
#!/usr/bin/env python3 bicycles = ["trek", "cannondale", "redline", "specialized"] print("{}\n".format(bicycles)) print("{} Object type: {}".format("bicycles", type(bicycles))) print(bicycles[0]) for bike in bicycles: print(bike.title())
def merge(a: list, b: list) -> list: i = 0 j = 0 c = [0 for _ in range(len(a) + len(b))] while i < len(a) or j < len(b): if j == len(b) or i < len(a) and a[i] < b[j]: c[i + j] = a[i] i += 1 else: c[i + j] = b[j] j += 1 return c def sort(a: list) -> list: n = len(a) if n <= 1: return a l = a[:n//2] r = a[n//2:] l = sort(l) r = sort(r) return merge(l, r) a = [1, 4, 5, 7, 2, 3, 6] print(sort(a))
class CORSMiddleware: def process_response(self, request, response): response['Access-Control-Allow-Origin'] = "*" return response
#Exemplo de função em Python def ola(): print("Olá!") print("Olá!!!") print("Alguém aí?") ola() ola() ola() #Exemplo fç ola com mome def ola(name): print("\n\nOlá, " + name,"!\n") ola("Alice") ola("Carlos")
# Copyright 2019, Kay Hayen, mailto:kay.hayen@gmail.com # # Python test originally created or extracted from other peoples work. The # parts from me are licensed as below. It is at least Free Software where # it's copied from other people. In these cases, that will normally be # indicated. # # 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. # # This taken from CPython's pystone test, and is an extract of it I made to analyse the # differences between CPython and Nuitka performance. It was under PSF 2 license. It's not # very useful anymore, but it is under that license still. LOOPS = 50000 class Record: def __init__(self, PtrComp = None, Discr = 0, EnumComp = 0, IntComp = 0, StringComp = 0): self.PtrComp = PtrComp self.Discr = Discr self.EnumComp = EnumComp self.IntComp = IntComp self.StringComp = StringComp def copy(self): return Record(self.PtrComp, self.Discr, self.EnumComp, self.IntComp, self.StringComp) def Proc1(PtrParIn): PtrParIn.PtrComp = NextRecord = PtrGlb.copy() PtrParIn.IntComp = 5 NextRecord.IntComp = PtrParIn.IntComp NextRecord.PtrComp = PtrParIn.PtrComp if NextRecord.Discr == 17: NextRecord.IntComp = 6 NextRecord.EnumComp = Proc6(PtrParIn.EnumComp) NextRecord.PtrComp = PtrGlb.PtrComp NextRecord.IntComp = Proc7(NextRecord.IntComp, 10) else: PtrParIn = NextRecord.copy() NextRecord.PtrComp = None return PtrParIn def benchmark(loops): global PtrGlb global PtrGlbNext PtrGlb = Record() for i in xrange(loops): PtrGlb = Proc1(PtrGlb) if __name__ == "__main__": benchmark(LOOPS)
# Write a Python program to # input a string and change its # case to Sentence case using capitalize() # function. It will convert only the first # (beginning)lower case letter to upper case. # it will capitalize only first letter # of a Sentence. # The user will enter String # during program execution # Start of the Python program # display message to enter string # and get input string str1 = input("Enter a string to convert into Sentence case:") # use capitalize() method sentence_string = str1.capitalize() # now print UPPER CASE string print(str1, "In sentence case =", sentence_string)
# SPDX-License-Identifier: BSD-2-Clause QEMU_SPECIAL_KEYS = { " " : "spc", "!" : "shift-1", '"' : "shift-apostrophe", "#" : "shift-3", "$" : "shift-4", "%" : "shift-5", "&" : "shift-7", "'" : "apostrophe", "(" : "shift-9", ")" : "shift-0", "*" : "shift-8", "+" : "shift-equal", "," : "comma", "-" : "minus", "." : "dot", "/" : "slash", ":" : "shift-semicolon", ";" : "semicolon", "<" : "shift-comma", "=" : "equal", ">" : "shift-dot", "?" : "shift-slash", "@" : "shift-2", "[" : "bracket_left", "\\" : "backslash", "]" : "bracket_right", "^" : "shift-6", "_" : "shift-minus", "`" : "grave_accent", "{" : "shift-bracket_left", "|" : "shift-backslash", "}" : "shift-bracket_right", "~" : "shift-grave_accent" } KEYS_MAP = { chr(x): chr(x) if x in range(ord('a'), ord('z')+1) or x in range(ord('0'),ord('9')+1) else 'shift-' + chr(x).lower() if x in range(ord('A'), ord('Z')+1) else QEMU_SPECIAL_KEYS[chr(x)] if chr(x) in QEMU_SPECIAL_KEYS else None for x in range(27, 128) }
class XSDSimpleTypeFontSize(XSDSimpleType): """The font-size can be one of the CSS font sizes (xx-small, x-small, small, medium, large, x-large, xx-large) or a numeric point size. .. todo:: Better documentation. """ _UNION = [XSDSimpleTypeCssFontSize, XSDSimpleTypeDecimal] XSD_TREE = XSDTree(ET.fromstring(""" <xs:simpleType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="font-size"> <xs:annotation> <xs:documentation>The font-size can be one of the CSS font sizes (xx-small, x-small, small, medium, large, x-large, xx-large) or a numeric point size.</xs:documentation> </xs:annotation> <xs:union memberTypes="xs:decimal css-font-size" /> </xs:simpleType> """ )) class XSDSimpleTypeYesNoNumber(XSDSimpleType): """The yes-no-number type is used for attributes that can be either boolean or numeric values. .. todo:: Better documentation. """ _UNION = [XSDSimpleTypeYesNo, XSDSimpleTypeDecimal] XSD_TREE = XSDTree(ET.fromstring(""" <xs:simpleType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="yes-no-number"> <xs:annotation> <xs:documentation>The yes-no-number type is used for attributes that can be either boolean or numeric values.</xs:documentation> </xs:annotation> <xs:union memberTypes="yes-no xs:decimal" /> </xs:simpleType> """ )) class XSDSimpleTypePositiveIntegerOrEmpty(XSDSimpleTypePositiveInteger): """The positive-integer-or-empty values can be either a positive integer or an empty string. .. todo:: Better documentation. """ _FORCED_PERMITTED = [''] XSD_TREE = XSDTree(ET.fromstring(""" <xs:simpleType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="positive-integer-or-empty"> <xs:annotation> <xs:documentation>The positive-integer-or-empty values can be either a positive integer or an empty string.</xs:documentation> </xs:annotation> <xs:union memberTypes="xs:positiveInteger"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="" /> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> """ )) def __init__(self, value='', *args, **kwargs): super().__init__(value=value, *args, **kwargs) class XSDSimpleTypeNumberOrNormal(XSDSimpleTypeDecimal): """The number-or-normal values can be either a decimal number or the string "normal". This is used by the line-height and letter-spacing attributes. .. todo:: Better documentation. """ _FORCED_PERMITTED = ['normal'] XSD_TREE = XSDTree(ET.fromstring(""" <xs:simpleType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="number-or-normal"> <xs:annotation> <xs:documentation>The number-or-normal values can be either a decimal number or the string "normal". This is used by the line-height and letter-spacing attributes.</xs:documentation> </xs:annotation> <xs:union memberTypes="xs:decimal"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="normal" /> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> """ ))
#! Дан текст. Найти слова, состоящие из цифр, и сумму чисел, которые # образуют эти слова (не используя регулярных выражений). def find_sum(string): string = string + ' ' new_string, words, word_library, numbers_lib, sum_words = '', [], {}, {}, 0 for symbol in string: # Разделяем текст на слова. if symbol == ' ' and new_string != '': words.append(new_string) new_string = '' else: new_string += symbol for word in words: # Найдём слова с числами. word = '.' + word + '.' word_number = '' for symbol in word: try: number = int(symbol) word_number += symbol except Exception: if word_number != '': key = word + ' ' + str(symbol) word_library[key] = int(word_number) word_number = '' else: pass for key in word_library: if word_library[key] != '': numbers_lib[key] = int(word_library[key]) for word in numbers_lib: # Найдём сумму чисел. sum_words += int(numbers_lib[word]) return sum_words def test_find_sum(arg1, value): print(f'Аргумент 1: {arg1}, ' f'ожидание: {value} |-> ' f'результат: {find_sum(arg1)},') # Тесты test_find_sum('tty 53 saa or exept 2nite', 55) test_find_sum('Дан текст. Найти слова, состоящие из цифр', 0) test_find_sum('пусть ты и21з фу1нкц1ии1 return 3, 4', 31) # test_arithmetic("b", ValueError("Value Error"))
# You are given two arrays (no duplicates): arr1 and arr2 where arr1 is a subset of arr2. # For each item x in arr1 find the first proceeding number, y, in arr2 such that y > x and # is to the right hand side of x in arr2. If such number does not exist, return -1. # # Ex. # arr1 = [4, 1, 2] # arr2 = [1, 3, 4, 2] # output = [-1, 3, -1] # the first number in arr1, 4, all numbers to the right of 4 in arr2 are less than 4. Thus return -1 # the second number in arr1, 1, the first number greater than 1 in arr2 is 3 # the third number in arr1, 2, there are no more numbers to the right of 2 in arr2, so return -1 # the basic idea is to iterate through arr2 once while maintaining a stack # for the i'th iteration. If the last item placed on the stack is less than # arr2[i], then we know that arr[i] is the next largest element of arr2[i-1] # # once we have determined that arr2[i] is greater than the previous element, # map that previous element to arr2[i] by popping the stack. if the new top # value on the stack is still less than arr2[i], map that one too, etc. # if, however, arr2[i] is not greater than the last element on the stack, push # arr[2] onto the stack. # finally, iterate through arr1 and replace each element in arr1 with the key/value # counterpart in the map. If we never mapped it in map, then there is no next # greater element, return -1 # RUN TIME ANALYSIS # this algorithm takes two parses hence it is O(n) runtime. def nextGreaterElement(targetArr, numArr): dict = {} #hashmap stack = [] #stack using a list for num in numArr: while stack and stack[len(stack) - 1] < num: dict.update({stack.pop() : num}) stack.append(num) for i in range(len(targetArr)): targetArr[i] = dict.get(targetArr[i], -1) return targetArr #driver code arr1 = [4,1,2] arr2 = [1,3,4,2] print(nextGreaterElement(arr1,arr2))
def solve(floor, room): pass if __name__ == '__main__': num_tc = int(input()) for _ in range(num_tc): k = int(input()) n = int(input()) print(solve(k, n))
def getData(self, device): """ Returns a list of tuples like {controller, device, data} with data elements """ cam = self.Devices[device["id"]]['objOfCapture'] _, frame = cam.read() if frame is None: return [] height = np.size(frame, 0) width = np.size(frame, 1) deviceName = Misc.hasKey(device, 'name', device["id"]) dataReturn = [] auxData = '"t":"{}", "ext":"{}", "W":"{}", "H":"{}"' if self.getRGB: dataRgb = Data() dataRgb.source_type = self.ME_TYPE dataRgb.source_name = 'CamController' dataRgb.source_item = deviceName dataRgb.data = frame dataRgb.aux = '{' + auxData.format('image', 'png', width, height) + '}' dataReturn.append(dataRgb) return dataReturn
class Solution: def getSkyline(self, buildings: List[List[int]]) -> List[List[int]]: n = len(buildings) if n == 0: return [] if n == 1: xLeft,xRight,y = buildings[0] return [[xLeft,y],[xRight,0]] leftSky = self.getSkyline(buildings[: n//2]) rightSky = self.getSkyline(buildings[n//2 :]) print('left',leftSky,'rihgt',rightSky) return self.merge(leftSky,rightSky) def merge(self,left,right): leftLen = len(left) rightLen = len(right) pl,pr = 0,0 currY = leftY = rightY= 0 result = [] while pl < leftLen and pr < rightLen: leftPoint,rightPoint = left[pl],right[pr] if leftPoint[0] < rightPoint[0]: x,leftY = leftPoint pl += 1 else: x,rightY = rightPoint pr += 1 maxY = max(leftY,rightY) if currY != maxY: self.update(x,maxY,result) currY = maxY print('first merge',result) self.appendSky(pl,left,leftLen,leftY,currY,result) self.appendSky(pr,right,rightLen,rightY,currY,result) return result def update(self,x,y,result): if not result or result[-1][0] != x: result.append([x,y]) else: result[-1][1] = y def appendSky(self,p,num,n,y,currY,result): while p <n: x,y = num[p] p+=1 if currY != y: self.update(x,y,result) currY = y
for i in range(1, 100 + 1): text = '' if i % 3 == 0: text += 'Fizz' if i % 5 == 0: text += 'Buzz' if text == '': print(i) else: print(text)
def is_palindrome(n): if str(n) == str(n)[::-1]: return True return False # Examples: is_palindrome(101) # True is_palindrome(147) # False
def rest_error_response(Status,Message,Format = 'XML',TwilioCode = None,TwilioMessage = None): response = { "Status" : Status, "Message" : Message } if TwilioCode is not None: response['Code'] = TwilioCode if TwilioMessage is not None: response['MoreInfo'] = TwilioMessage if Format == '' or Format == 'XML' or Format == 'HTML': response = { 'TwilioResponse' : { 'RestException' : response } } return response
# -*- coding: utf-8 -*- # Copyright 2019 Cohesity Inc. class ObjectClassEnum(object): """Implementation of the 'ObjectClass' enum. Specifies the object class of the principal (either 'kGroup' or 'kUser'). 'kUser' specifies a user object class. 'kGroup' specifies a group object class. 'kComputer' specifies a computer object class. Attributes: KUSER: TODO: type description here. KGROUP: TODO: type description here. KCOMPUTER: TODO: type description here. """ KUSER = 'kUser' KGROUP = 'kGroup' KCOMPUTER = 'kComputer'
# Copyright 2020 AUI, Inc. Washington DC, USA # # 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. def shadow(vis_dataset, shadow_parms, storage_parms): """ .. todo:: This function is not yet implemented Flag all baselines for antennas that are shadowed beyond the specified tolerance. All antennas in the zarr-file metadata (and their corresponding diameters) will be considered for shadow-flag calculations. For a given timestep, an antenna is flagged if any of its baselines (projected onto the uv-plane) is shorter than radius_1 + radius_2 - tolerance. The value of 'w' is used to determine which antenna is behind the other. The phase-reference center is used for antenna-pointing direction. Antennas that are not part of the observation, but still physically present and shadowing other antennas that are being used, must be added to the meta-data list in the zarr prior to calling this method. Inputs : (1) shadowlimit or tolerance (in m) (2) array name for output flags. Default = FLAG Returns ------- vis_dataset : xarray.core.dataset.Dataset """
""" Simple BMW ConnectedDrive API. init file for backward compatibility """ # empty
# -*- coding:utf-8 -*- class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def deleteNode(self, listNode, toDeleteNode): if listNode == None or toDeleteNode == None: return listNode if listNode == toDeleteNode: return listNode.next if toDeleteNode.next == None: while(listNode.next != toDeleteNode): listNode = listNode.next listNode.next = None return listNode toDeleteNode.val = toDeleteNode.next.val toDeleteNode.next = toDeleteNode.next.next return listNode if __name__ == "__main__": listNode = ListNode(1) listNode.next = ListNode(2) listNode.next.next = ListNode(3) solution = Solution() headNode = ListNode(1) headNode.next = listNode.next toDeleteNode = listNode.next toDeleteNode.next = listNode.next.next result = solution.deleteNode(listNode, toDeleteNode) print(result)
# Write a program that reads in two floating­point numbers and tests whether they are # the same up to two decimal places. Here are two sample runs. # Enter a floating-point number: 2.0 # Enter a floating-point number: 1.99998 # They are the same up to two decimal places. # Enter a floating-point number: 2.0 # Enter a floating-point number: 1.98999 # They are different. number1 = float(input("Enter a floating-point number: ")) number2 = float(input("Enter a floating-point number: ")) if abs(number1 - number2) <= 0.01: print("They're the same") else: print("They're different.")
def build_filter(args): return Filter(args) class Filter: def __init__(self, args): if args == '': message = b'<empty commit message>' else: message = args.encode('utf8') self.message = message def commit_message_filter(self,commit_data): # Only write the commit message if the recorded commit # message is null. if commit_data['desc'] == b'\x00': commit_data['desc'] = self.message
# @Fábio C Nunes - 14.06.20 classe = {} n = str(input('Digite o nome do aluno : ')) m = float(input('Digite a média do aluno: ')) if m > 7: sit = 'Aprovado!' else: sit = 'Reprovado!' classe['nome'] = n classe['média'] = m classe['situação'] = sit print('*' * 30) print(f'O aluno(a) {classe["nome"]} tirou {classe["média"]} e sua sitação é: {classe["situação"]}')