content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
print("hola mundo") x=4 y=2 print(x+y) #suma=x+y #print(suma) #suma
print('hola mundo') x = 4 y = 2 print(x + y)
# -*- coding: latin-1 -*- generation = 8 def evolve(addressbook): """No longer needed."""
generation = 8 def evolve(addressbook): """No longer needed."""
# # PySNMP MIB module REDLINE-AN50-PMP-V2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/REDLINE-AN50-PMP-V2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:46:50 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") ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint") redlineMgmt, = mibBuilder.importSymbols("REDLINE-MIB", "redlineMgmt") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") TimeTicks, Gauge32, ModuleIdentity, Counter32, Integer32, iso, Bits, NotificationType, ObjectIdentity, Unsigned32, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Gauge32", "ModuleIdentity", "Counter32", "Integer32", "iso", "Bits", "NotificationType", "ObjectIdentity", "Unsigned32", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "Counter64") RowStatus, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention") redlineAN50PMPV2 = ModuleIdentity((1, 3, 6, 1, 4, 1, 10728, 2, 51)) if mibBuilder.loadTexts: redlineAN50PMPV2.setLastUpdated('200503160000Z') if mibBuilder.loadTexts: redlineAN50PMPV2.setOrganization('Redline Communications, Inc.') an50pmpLinkTable = MibTable((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1), ) if mibBuilder.loadTexts: an50pmpLinkTable.setStatus('current') an50pmpLinkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1), ).setIndexNames((0, "REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkID")) if mibBuilder.loadTexts: an50pmpLinkEntry.setStatus('current') an50pmpLinkID = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))) if mibBuilder.loadTexts: an50pmpLinkID.setStatus('current') an50pmpLinkName = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 15))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkName.setStatus('current') an50pmpLinkGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkGroupId.setStatus('obsolete') an50pmpLinkPeerMac = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 6))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkPeerMac.setStatus('current') an50pmpLinkMaxDLBurstRate = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkMaxDLBurstRate.setStatus('current') an50pmpLinkMaxULBurstRate = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkMaxULBurstRate.setStatus('current') an50pmpLinkMaxHost = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkMaxHost.setStatus('obsolete') an50pmpLinkCIDDLCIR = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkCIDDLCIR.setStatus('obsolete') an50pmpLinkCIDDLPIR = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkCIDDLPIR.setStatus('obsolete') an50pmpLinkCIDULCIR = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkCIDULCIR.setStatus('obsolete') an50pmpLinkCIDULPIR = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkCIDULPIR.setStatus('obsolete') an50pmpLinkDLQoS = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 54))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkDLQoS.setStatus('obsolete') an50pmpLinkULQoS = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 54))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkULQoS.setStatus('obsolete') an50pmpLinkEncryptionKey = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 15), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 16))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkEncryptionKey.setStatus('current') an50pmpLinkRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 14), RowStatus().clone('createAndWait')).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLinkRowStatus.setStatus('current') an50pmpLinkStatusTable = MibTable((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2), ) if mibBuilder.loadTexts: an50pmpLinkStatusTable.setStatus('current') an50pmpLinkStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1), ).setIndexNames((0, "REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkStatusID")) if mibBuilder.loadTexts: an50pmpLinkStatusEntry.setStatus('current') an50pmpLinkStatusID = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))) if mibBuilder.loadTexts: an50pmpLinkStatusID.setStatus('current') an50pmpLinkStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkStatus.setStatus('current') an50pmpLinkStatusCode = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkStatusCode.setStatus('current') an50pmpLinkRegConn = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkRegConn.setStatus('current') an50pmpLinkDLBurstRate = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("tx6Mbs", 1), ("tx9Mbs", 2), ("tx12Mbs", 3), ("tx18Mbs", 4), ("tx24Mbs", 5), ("tx36Mbs", 6), ("tx48Mbs", 7), ("tx54Mbs", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLBurstRate.setStatus('current') an50pmpLinkDLRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLRSSI.setStatus('current') an50pmpLinkDLSINADR = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLSINADR.setStatus('current') an50pmpLinkDLStatLostFrm = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLStatLostFrm.setStatus('current') an50pmpLinkDLStatBlksTot = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLStatBlksTot.setStatus('current') an50pmpLinkDLStatBlksRetr = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLStatBlksRetr.setStatus('current') an50pmpLinkDLStatBlksDisc = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLStatBlksDisc.setStatus('current') an50pmpLinkDLCIDStatPktDisc = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 12), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLCIDStatPktDisc.setStatus('current') an50pmpLinkDLCIDStatPktTran = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLCIDStatPktTran.setStatus('current') an50pmpLinkDLCIDStatPktRecv = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkDLCIDStatPktRecv.setStatus('current') an50pmpLinkULBurstRate = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("tx6Mbs", 1), ("tx9Mbs", 2), ("tx12Mbs", 3), ("tx18Mbs", 4), ("tx24Mbs", 5), ("tx36Mbs", 6), ("tx48Mbs", 7), ("tx54Mbs", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULBurstRate.setStatus('current') an50pmpLinkULRSSI = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 16), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULRSSI.setStatus('current') an50pmpLinkULSINADR = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 17), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULSINADR.setStatus('current') an50pmpLinkULStatLostFrm = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 18), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULStatLostFrm.setStatus('current') an50pmpLinkULStatBlksTot = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 19), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULStatBlksTot.setStatus('current') an50pmpLinkULStatBlksRetr = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 20), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULStatBlksRetr.setStatus('current') an50pmpLinkULStatBlksDisc = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 21), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULStatBlksDisc.setStatus('current') an50pmpLinkULCIDStatPktDisc = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 22), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULCIDStatPktDisc.setStatus('current') an50pmpLinkULCIDStatPktTran = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 23), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULCIDStatPktTran.setStatus('current') an50pmpLinkULCIDStatPktRecv = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 24), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkULCIDStatPktRecv.setStatus('current') an50pmpLinkUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 25), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkUpTime.setStatus('current') an50pmpLinkLostCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 26), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLinkLostCount.setStatus('current') an50pmpCIDSaveConfig = MibScalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("doNothing", 1), ("saveConfig", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpCIDSaveConfig.setStatus('current') an50pmpLastModifiedCID = MibScalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 1023))).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLastModifiedCID.setStatus('current') an50pmpLastMissedSsMacAddress = MibScalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 5), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLastMissedSsMacAddress.setStatus('current') an50pmpLastRegisteredSsMacAddress = MibScalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 6), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLastRegisteredSsMacAddress.setStatus('current') an50pmpLastSuccessfulID = MibScalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 1023))).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpLastSuccessfulID.setStatus('current') an50pmpLastDeniedSsMacAddress = MibScalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 8), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpLastDeniedSsMacAddress.setStatus('current') an50pmpGroupTable = MibTable((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9), ) if mibBuilder.loadTexts: an50pmpGroupTable.setStatus('current') an50pmpGroupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1), ).setIndexNames((0, "REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupId")) if mibBuilder.loadTexts: an50pmpGroupEntry.setStatus('current') an50pmpGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65536))) if mibBuilder.loadTexts: an50pmpGroupId.setStatus('current') an50pmpGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpGroupName.setStatus('current') an50pmpGroupBSPortTagging = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("passThrough", 1), ("tagged", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpGroupBSPortTagging.setStatus('current') an50pmpGroupVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpGroupVlanId.setStatus('current') an50pmpGroupDefaultPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpGroupDefaultPriority.setStatus('current') an50pmpGroupBSPortEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("off", 1), ("on", 2))).clone('off')).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpGroupBSPortEnabled.setStatus('current') an50pmpGroupQos = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpGroupQos.setStatus('current') an50pmpGroupRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 8), RowStatus().clone('createAndWait')).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpGroupRowStatus.setStatus('current') an50pmpConnectionTable = MibTable((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10), ) if mibBuilder.loadTexts: an50pmpConnectionTable.setStatus('current') an50pmpConnectionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1), ).setIndexNames((0, "REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionId")) if mibBuilder.loadTexts: an50pmpConnectionEntry.setStatus('current') an50pmpConnectionId = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65536))) if mibBuilder.loadTexts: an50pmpConnectionId.setStatus('current') an50pmpConnectionName = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionName.setStatus('current') an50pmpConnectionPortTagging = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("passThrough", 1), ("tagged", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionPortTagging.setStatus('current') an50pmpConnectionVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionVlanId.setStatus('current') an50pmpConnectionDefaultPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionDefaultPriority.setStatus('current') an50pmpConnectionParentLink = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionParentLink.setStatus('current') an50pmpConnectionParentGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionParentGroup.setStatus('current') an50pmpConnectionDLQoS = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionDLQoS.setStatus('current') an50pmpConnectionULQoS = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65536))).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionULQoS.setStatus('current') an50pmpConnectionRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 10), RowStatus().clone('createAndWait')).setMaxAccess("readwrite") if mibBuilder.loadTexts: an50pmpConnectionRowStatus.setStatus('current') an50pmpGroupStatusTable = MibTable((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11), ) if mibBuilder.loadTexts: an50pmpGroupStatusTable.setStatus('current') an50pmpGroupStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1), ).setIndexNames((0, "REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupStatusId")) if mibBuilder.loadTexts: an50pmpGroupStatusEntry.setStatus('current') an50pmpGroupStatusId = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65536))) if mibBuilder.loadTexts: an50pmpGroupStatusId.setStatus('current') an50pmpGroupStatusDLPacketsDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpGroupStatusDLPacketsDiscards.setStatus('current') an50pmpGroupStatusDLPacketsTx = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpGroupStatusDLPacketsTx.setStatus('current') an50pmpGroupStatusDLPacketsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpGroupStatusDLPacketsRx.setStatus('current') an50pmpGroupStatusULPacketsDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpGroupStatusULPacketsDiscards.setStatus('current') an50pmpGroupStatusULPacketsTx = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpGroupStatusULPacketsTx.setStatus('current') an50pmpGroupStatusULPacketsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpGroupStatusULPacketsRx.setStatus('current') an50pmpConnectionStatusTable = MibTable((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12), ) if mibBuilder.loadTexts: an50pmpConnectionStatusTable.setStatus('current') an50pmpConnectionStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1), ).setIndexNames((0, "REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionStatusId")) if mibBuilder.loadTexts: an50pmpConnectionStatusEntry.setStatus('current') an50pmpConnectionStatusId = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65536))) if mibBuilder.loadTexts: an50pmpConnectionStatusId.setStatus('current') an50pmpConnectionStatusDLPacketsDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpConnectionStatusDLPacketsDiscards.setStatus('current') an50pmpConnectionStatusDLPacketsTx = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpConnectionStatusDLPacketsTx.setStatus('current') an50pmpConnectionStatusDLPacketsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpConnectionStatusDLPacketsRx.setStatus('current') an50pmpConnectionStatusULPacketsDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpConnectionStatusULPacketsDiscards.setStatus('current') an50pmpConnectionStatusULPacketsTx = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpConnectionStatusULPacketsTx.setStatus('current') an50pmpConnectionStatusULPacketsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: an50pmpConnectionStatusULPacketsRx.setStatus('current') an50PMPObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 10728, 2, 51, 13)).setObjects(("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkName"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkPeerMac"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkMaxDLBurstRate"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkMaxULBurstRate"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkEncryptionKey"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkRowStatus"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkStatus"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkStatusCode"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkRegConn"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLBurstRate"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLRSSI"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLSINADR"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLStatLostFrm"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLStatBlksTot"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLStatBlksRetr"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLStatBlksDisc"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLCIDStatPktDisc"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLCIDStatPktTran"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLCIDStatPktRecv"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULBurstRate"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULRSSI"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULSINADR"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULStatLostFrm"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULStatBlksTot"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULStatBlksRetr"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULStatBlksDisc"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULCIDStatPktDisc"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULCIDStatPktTran"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULCIDStatPktRecv"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkUpTime"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkLostCount"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpCIDSaveConfig"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLastModifiedCID"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLastMissedSsMacAddress"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLastRegisteredSsMacAddress"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLastSuccessfulID"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLastDeniedSsMacAddress"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupName"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupBSPortTagging"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupVlanId"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupDefaultPriority"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupBSPortEnabled"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupQos"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupRowStatus"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionName"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionPortTagging"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionVlanId"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionDefaultPriority"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionParentLink"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionParentGroup"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionDLQoS"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionULQoS"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionRowStatus"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupStatusDLPacketsDiscards"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupStatusDLPacketsTx"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupStatusDLPacketsRx"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupStatusULPacketsDiscards"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupStatusULPacketsTx"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpGroupStatusULPacketsRx"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionStatusDLPacketsDiscards"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionStatusDLPacketsTx"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionStatusDLPacketsRx"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionStatusULPacketsDiscards"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionStatusULPacketsTx"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpConnectionStatusULPacketsRx")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): an50PMPObjectGroup = an50PMPObjectGroup.setStatus('current') an50PMPObsoleteObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 10728, 2, 51, 14)).setObjects(("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkGroupId"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkMaxHost"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkCIDDLCIR"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkCIDDLPIR"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkCIDULCIR"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkCIDULPIR"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkDLQoS"), ("REDLINE-AN50-PMP-V2-MIB", "an50pmpLinkULQoS")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): an50PMPObsoleteObjectGroup = an50PMPObsoleteObjectGroup.setStatus('obsolete') mibBuilder.exportSymbols("REDLINE-AN50-PMP-V2-MIB", an50pmpLinkULQoS=an50pmpLinkULQoS, an50pmpLinkULCIDStatPktRecv=an50pmpLinkULCIDStatPktRecv, an50pmpLinkRowStatus=an50pmpLinkRowStatus, an50pmpLinkDLStatBlksTot=an50pmpLinkDLStatBlksTot, an50pmpConnectionStatusId=an50pmpConnectionStatusId, an50pmpGroupTable=an50pmpGroupTable, an50pmpConnectionId=an50pmpConnectionId, an50pmpLinkLostCount=an50pmpLinkLostCount, an50pmpLastMissedSsMacAddress=an50pmpLastMissedSsMacAddress, an50pmpGroupStatusEntry=an50pmpGroupStatusEntry, an50pmpGroupStatusDLPacketsRx=an50pmpGroupStatusDLPacketsRx, an50pmpConnectionDefaultPriority=an50pmpConnectionDefaultPriority, an50pmpConnectionTable=an50pmpConnectionTable, an50pmpLastModifiedCID=an50pmpLastModifiedCID, an50pmpConnectionStatusULPacketsRx=an50pmpConnectionStatusULPacketsRx, an50PMPObsoleteObjectGroup=an50PMPObsoleteObjectGroup, an50pmpConnectionStatusDLPacketsDiscards=an50pmpConnectionStatusDLPacketsDiscards, an50pmpLinkDLRSSI=an50pmpLinkDLRSSI, an50pmpGroupEntry=an50pmpGroupEntry, an50pmpConnectionStatusULPacketsDiscards=an50pmpConnectionStatusULPacketsDiscards, an50pmpGroupStatusULPacketsDiscards=an50pmpGroupStatusULPacketsDiscards, an50pmpGroupQos=an50pmpGroupQos, an50pmpConnectionName=an50pmpConnectionName, an50pmpConnectionPortTagging=an50pmpConnectionPortTagging, redlineAN50PMPV2=redlineAN50PMPV2, an50pmpLinkCIDULCIR=an50pmpLinkCIDULCIR, an50pmpLinkDLCIDStatPktRecv=an50pmpLinkDLCIDStatPktRecv, an50pmpLinkMaxULBurstRate=an50pmpLinkMaxULBurstRate, an50pmpGroupBSPortEnabled=an50pmpGroupBSPortEnabled, an50pmpLinkName=an50pmpLinkName, an50pmpGroupRowStatus=an50pmpGroupRowStatus, an50pmpConnectionEntry=an50pmpConnectionEntry, an50pmpLinkCIDDLPIR=an50pmpLinkCIDDLPIR, an50pmpCIDSaveConfig=an50pmpCIDSaveConfig, an50pmpLinkDLStatLostFrm=an50pmpLinkDLStatLostFrm, an50pmpConnectionDLQoS=an50pmpConnectionDLQoS, an50pmpConnectionStatusULPacketsTx=an50pmpConnectionStatusULPacketsTx, an50pmpLinkEntry=an50pmpLinkEntry, an50pmpGroupStatusTable=an50pmpGroupStatusTable, an50pmpLinkPeerMac=an50pmpLinkPeerMac, an50pmpLinkID=an50pmpLinkID, an50pmpConnectionStatusDLPacketsTx=an50pmpConnectionStatusDLPacketsTx, an50pmpLinkDLCIDStatPktDisc=an50pmpLinkDLCIDStatPktDisc, an50pmpLinkStatusID=an50pmpLinkStatusID, an50pmpLinkMaxDLBurstRate=an50pmpLinkMaxDLBurstRate, an50pmpConnectionRowStatus=an50pmpConnectionRowStatus, an50pmpGroupStatusULPacketsTx=an50pmpGroupStatusULPacketsTx, an50pmpLinkULSINADR=an50pmpLinkULSINADR, an50pmpLinkULBurstRate=an50pmpLinkULBurstRate, an50pmpLinkULCIDStatPktTran=an50pmpLinkULCIDStatPktTran, an50pmpGroupVlanId=an50pmpGroupVlanId, an50pmpLinkTable=an50pmpLinkTable, PYSNMP_MODULE_ID=redlineAN50PMPV2, an50pmpLinkDLSINADR=an50pmpLinkDLSINADR, an50pmpConnectionParentLink=an50pmpConnectionParentLink, an50pmpConnectionStatusTable=an50pmpConnectionStatusTable, an50pmpLinkStatus=an50pmpLinkStatus, an50pmpLinkDLStatBlksRetr=an50pmpLinkDLStatBlksRetr, an50pmpLastSuccessfulID=an50pmpLastSuccessfulID, an50pmpGroupStatusDLPacketsDiscards=an50pmpGroupStatusDLPacketsDiscards, an50pmpLinkDLCIDStatPktTran=an50pmpLinkDLCIDStatPktTran, an50pmpConnectionParentGroup=an50pmpConnectionParentGroup, an50pmpGroupStatusULPacketsRx=an50pmpGroupStatusULPacketsRx, an50pmpLinkULStatBlksRetr=an50pmpLinkULStatBlksRetr, an50pmpConnectionStatusDLPacketsRx=an50pmpConnectionStatusDLPacketsRx, an50pmpLinkDLQoS=an50pmpLinkDLQoS, an50pmpLinkStatusEntry=an50pmpLinkStatusEntry, an50pmpLinkCIDULPIR=an50pmpLinkCIDULPIR, an50pmpLinkDLStatBlksDisc=an50pmpLinkDLStatBlksDisc, an50pmpLinkUpTime=an50pmpLinkUpTime, an50pmpLinkULStatLostFrm=an50pmpLinkULStatLostFrm, an50pmpLinkMaxHost=an50pmpLinkMaxHost, an50pmpConnectionStatusEntry=an50pmpConnectionStatusEntry, an50pmpConnectionVlanId=an50pmpConnectionVlanId, an50pmpLinkRegConn=an50pmpLinkRegConn, an50pmpLinkEncryptionKey=an50pmpLinkEncryptionKey, an50pmpLinkDLBurstRate=an50pmpLinkDLBurstRate, an50pmpLinkULCIDStatPktDisc=an50pmpLinkULCIDStatPktDisc, an50pmpGroupStatusId=an50pmpGroupStatusId, an50PMPObjectGroup=an50PMPObjectGroup, an50pmpLastDeniedSsMacAddress=an50pmpLastDeniedSsMacAddress, an50pmpGroupStatusDLPacketsTx=an50pmpGroupStatusDLPacketsTx, an50pmpLinkULStatBlksTot=an50pmpLinkULStatBlksTot, an50pmpLinkCIDDLCIR=an50pmpLinkCIDDLCIR, an50pmpLinkULStatBlksDisc=an50pmpLinkULStatBlksDisc, an50pmpGroupBSPortTagging=an50pmpGroupBSPortTagging, an50pmpLinkStatusTable=an50pmpLinkStatusTable, an50pmpGroupName=an50pmpGroupName, an50pmpLinkGroupId=an50pmpLinkGroupId, an50pmpConnectionULQoS=an50pmpConnectionULQoS, an50pmpLinkStatusCode=an50pmpLinkStatusCode, an50pmpGroupId=an50pmpGroupId, an50pmpGroupDefaultPriority=an50pmpGroupDefaultPriority, an50pmpLastRegisteredSsMacAddress=an50pmpLastRegisteredSsMacAddress, an50pmpLinkULRSSI=an50pmpLinkULRSSI)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint') (redline_mgmt,) = mibBuilder.importSymbols('REDLINE-MIB', 'redlineMgmt') (module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup') (time_ticks, gauge32, module_identity, counter32, integer32, iso, bits, notification_type, object_identity, unsigned32, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, mib_identifier, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'Gauge32', 'ModuleIdentity', 'Counter32', 'Integer32', 'iso', 'Bits', 'NotificationType', 'ObjectIdentity', 'Unsigned32', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'MibIdentifier', 'Counter64') (row_status, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'DisplayString', 'TextualConvention') redline_an50_pmpv2 = module_identity((1, 3, 6, 1, 4, 1, 10728, 2, 51)) if mibBuilder.loadTexts: redlineAN50PMPV2.setLastUpdated('200503160000Z') if mibBuilder.loadTexts: redlineAN50PMPV2.setOrganization('Redline Communications, Inc.') an50pmp_link_table = mib_table((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1)) if mibBuilder.loadTexts: an50pmpLinkTable.setStatus('current') an50pmp_link_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1)).setIndexNames((0, 'REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkID')) if mibBuilder.loadTexts: an50pmpLinkEntry.setStatus('current') an50pmp_link_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))) if mibBuilder.loadTexts: an50pmpLinkID.setStatus('current') an50pmp_link_name = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(1, 15))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkName.setStatus('current') an50pmp_link_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 1024))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkGroupId.setStatus('obsolete') an50pmp_link_peer_mac = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(0, 6))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkPeerMac.setStatus('current') an50pmp_link_max_dl_burst_rate = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 8))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkMaxDLBurstRate.setStatus('current') an50pmp_link_max_ul_burst_rate = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(1, 8))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkMaxULBurstRate.setStatus('current') an50pmp_link_max_host = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 7), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkMaxHost.setStatus('obsolete') an50pmp_link_ciddlcir = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkCIDDLCIR.setStatus('obsolete') an50pmp_link_ciddlpir = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkCIDDLPIR.setStatus('obsolete') an50pmp_link_cidulcir = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkCIDULCIR.setStatus('obsolete') an50pmp_link_cidulpir = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 11), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkCIDULPIR.setStatus('obsolete') an50pmp_link_dl_qo_s = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(1, 54))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkDLQoS.setStatus('obsolete') an50pmp_link_ul_qo_s = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 13), integer32().subtype(subtypeSpec=value_range_constraint(1, 54))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkULQoS.setStatus('obsolete') an50pmp_link_encryption_key = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 15), octet_string().subtype(subtypeSpec=value_size_constraint(0, 16))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkEncryptionKey.setStatus('current') an50pmp_link_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 1, 1, 14), row_status().clone('createAndWait')).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLinkRowStatus.setStatus('current') an50pmp_link_status_table = mib_table((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2)) if mibBuilder.loadTexts: an50pmpLinkStatusTable.setStatus('current') an50pmp_link_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1)).setIndexNames((0, 'REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkStatusID')) if mibBuilder.loadTexts: an50pmpLinkStatusEntry.setStatus('current') an50pmp_link_status_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 1024))) if mibBuilder.loadTexts: an50pmpLinkStatusID.setStatus('current') an50pmp_link_status = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('up', 1), ('down', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkStatus.setStatus('current') an50pmp_link_status_code = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkStatusCode.setStatus('current') an50pmp_link_reg_conn = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 1024))).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkRegConn.setStatus('current') an50pmp_link_dl_burst_rate = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('tx6Mbs', 1), ('tx9Mbs', 2), ('tx12Mbs', 3), ('tx18Mbs', 4), ('tx24Mbs', 5), ('tx36Mbs', 6), ('tx48Mbs', 7), ('tx54Mbs', 8)))).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLBurstRate.setStatus('current') an50pmp_link_dlrssi = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLRSSI.setStatus('current') an50pmp_link_dlsinadr = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 7), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLSINADR.setStatus('current') an50pmp_link_dl_stat_lost_frm = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 8), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLStatLostFrm.setStatus('current') an50pmp_link_dl_stat_blks_tot = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 9), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLStatBlksTot.setStatus('current') an50pmp_link_dl_stat_blks_retr = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 10), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLStatBlksRetr.setStatus('current') an50pmp_link_dl_stat_blks_disc = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 11), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLStatBlksDisc.setStatus('current') an50pmp_link_dlcid_stat_pkt_disc = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 12), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLCIDStatPktDisc.setStatus('current') an50pmp_link_dlcid_stat_pkt_tran = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 13), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLCIDStatPktTran.setStatus('current') an50pmp_link_dlcid_stat_pkt_recv = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 14), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkDLCIDStatPktRecv.setStatus('current') an50pmp_link_ul_burst_rate = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('tx6Mbs', 1), ('tx9Mbs', 2), ('tx12Mbs', 3), ('tx18Mbs', 4), ('tx24Mbs', 5), ('tx36Mbs', 6), ('tx48Mbs', 7), ('tx54Mbs', 8)))).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULBurstRate.setStatus('current') an50pmp_link_ulrssi = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 16), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULRSSI.setStatus('current') an50pmp_link_ulsinadr = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 17), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULSINADR.setStatus('current') an50pmp_link_ul_stat_lost_frm = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 18), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULStatLostFrm.setStatus('current') an50pmp_link_ul_stat_blks_tot = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 19), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULStatBlksTot.setStatus('current') an50pmp_link_ul_stat_blks_retr = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 20), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULStatBlksRetr.setStatus('current') an50pmp_link_ul_stat_blks_disc = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 21), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULStatBlksDisc.setStatus('current') an50pmp_link_ulcid_stat_pkt_disc = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 22), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULCIDStatPktDisc.setStatus('current') an50pmp_link_ulcid_stat_pkt_tran = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 23), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULCIDStatPktTran.setStatus('current') an50pmp_link_ulcid_stat_pkt_recv = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 24), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkULCIDStatPktRecv.setStatus('current') an50pmp_link_up_time = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 25), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkUpTime.setStatus('current') an50pmp_link_lost_count = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 2, 1, 26), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLinkLostCount.setStatus('current') an50pmp_cid_save_config = mib_scalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('doNothing', 1), ('saveConfig', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpCIDSaveConfig.setStatus('current') an50pmp_last_modified_cid = mib_scalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 4), integer32().subtype(subtypeSpec=value_range_constraint(4, 1023))).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLastModifiedCID.setStatus('current') an50pmp_last_missed_ss_mac_address = mib_scalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 5), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLastMissedSsMacAddress.setStatus('current') an50pmp_last_registered_ss_mac_address = mib_scalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 6), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLastRegisteredSsMacAddress.setStatus('current') an50pmp_last_successful_id = mib_scalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 7), integer32().subtype(subtypeSpec=value_range_constraint(4, 1023))).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpLastSuccessfulID.setStatus('current') an50pmp_last_denied_ss_mac_address = mib_scalar((1, 3, 6, 1, 4, 1, 10728, 2, 51, 8), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpLastDeniedSsMacAddress.setStatus('current') an50pmp_group_table = mib_table((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9)) if mibBuilder.loadTexts: an50pmpGroupTable.setStatus('current') an50pmp_group_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1)).setIndexNames((0, 'REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupId')) if mibBuilder.loadTexts: an50pmpGroupEntry.setStatus('current') an50pmp_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65536))) if mibBuilder.loadTexts: an50pmpGroupId.setStatus('current') an50pmp_group_name = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(0, 15))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpGroupName.setStatus('current') an50pmp_group_bs_port_tagging = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('passThrough', 1), ('tagged', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpGroupBSPortTagging.setStatus('current') an50pmp_group_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpGroupVlanId.setStatus('current') an50pmp_group_default_priority = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpGroupDefaultPriority.setStatus('current') an50pmp_group_bs_port_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('off', 1), ('on', 2))).clone('off')).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpGroupBSPortEnabled.setStatus('current') an50pmp_group_qos = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpGroupQos.setStatus('current') an50pmp_group_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 9, 1, 8), row_status().clone('createAndWait')).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpGroupRowStatus.setStatus('current') an50pmp_connection_table = mib_table((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10)) if mibBuilder.loadTexts: an50pmpConnectionTable.setStatus('current') an50pmp_connection_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1)).setIndexNames((0, 'REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionId')) if mibBuilder.loadTexts: an50pmpConnectionEntry.setStatus('current') an50pmp_connection_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65536))) if mibBuilder.loadTexts: an50pmpConnectionId.setStatus('current') an50pmp_connection_name = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(0, 15))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionName.setStatus('current') an50pmp_connection_port_tagging = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('passThrough', 1), ('tagged', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionPortTagging.setStatus('current') an50pmp_connection_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionVlanId.setStatus('current') an50pmp_connection_default_priority = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionDefaultPriority.setStatus('current') an50pmp_connection_parent_link = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionParentLink.setStatus('current') an50pmp_connection_parent_group = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionParentGroup.setStatus('current') an50pmp_connection_dl_qo_s = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionDLQoS.setStatus('current') an50pmp_connection_ul_qo_s = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 65536))).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionULQoS.setStatus('current') an50pmp_connection_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 10, 1, 10), row_status().clone('createAndWait')).setMaxAccess('readwrite') if mibBuilder.loadTexts: an50pmpConnectionRowStatus.setStatus('current') an50pmp_group_status_table = mib_table((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11)) if mibBuilder.loadTexts: an50pmpGroupStatusTable.setStatus('current') an50pmp_group_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1)).setIndexNames((0, 'REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupStatusId')) if mibBuilder.loadTexts: an50pmpGroupStatusEntry.setStatus('current') an50pmp_group_status_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65536))) if mibBuilder.loadTexts: an50pmpGroupStatusId.setStatus('current') an50pmp_group_status_dl_packets_discards = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpGroupStatusDLPacketsDiscards.setStatus('current') an50pmp_group_status_dl_packets_tx = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpGroupStatusDLPacketsTx.setStatus('current') an50pmp_group_status_dl_packets_rx = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpGroupStatusDLPacketsRx.setStatus('current') an50pmp_group_status_ul_packets_discards = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpGroupStatusULPacketsDiscards.setStatus('current') an50pmp_group_status_ul_packets_tx = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpGroupStatusULPacketsTx.setStatus('current') an50pmp_group_status_ul_packets_rx = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 11, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpGroupStatusULPacketsRx.setStatus('current') an50pmp_connection_status_table = mib_table((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12)) if mibBuilder.loadTexts: an50pmpConnectionStatusTable.setStatus('current') an50pmp_connection_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1)).setIndexNames((0, 'REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionStatusId')) if mibBuilder.loadTexts: an50pmpConnectionStatusEntry.setStatus('current') an50pmp_connection_status_id = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65536))) if mibBuilder.loadTexts: an50pmpConnectionStatusId.setStatus('current') an50pmp_connection_status_dl_packets_discards = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpConnectionStatusDLPacketsDiscards.setStatus('current') an50pmp_connection_status_dl_packets_tx = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpConnectionStatusDLPacketsTx.setStatus('current') an50pmp_connection_status_dl_packets_rx = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpConnectionStatusDLPacketsRx.setStatus('current') an50pmp_connection_status_ul_packets_discards = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpConnectionStatusULPacketsDiscards.setStatus('current') an50pmp_connection_status_ul_packets_tx = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpConnectionStatusULPacketsTx.setStatus('current') an50pmp_connection_status_ul_packets_rx = mib_table_column((1, 3, 6, 1, 4, 1, 10728, 2, 51, 12, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: an50pmpConnectionStatusULPacketsRx.setStatus('current') an50_pmp_object_group = object_group((1, 3, 6, 1, 4, 1, 10728, 2, 51, 13)).setObjects(('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkName'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkPeerMac'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkMaxDLBurstRate'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkMaxULBurstRate'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkEncryptionKey'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkRowStatus'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkStatus'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkStatusCode'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkRegConn'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLBurstRate'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLRSSI'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLSINADR'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLStatLostFrm'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLStatBlksTot'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLStatBlksRetr'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLStatBlksDisc'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLCIDStatPktDisc'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLCIDStatPktTran'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLCIDStatPktRecv'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULBurstRate'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULRSSI'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULSINADR'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULStatLostFrm'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULStatBlksTot'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULStatBlksRetr'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULStatBlksDisc'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULCIDStatPktDisc'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULCIDStatPktTran'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULCIDStatPktRecv'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkUpTime'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkLostCount'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpCIDSaveConfig'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLastModifiedCID'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLastMissedSsMacAddress'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLastRegisteredSsMacAddress'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLastSuccessfulID'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLastDeniedSsMacAddress'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupName'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupBSPortTagging'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupVlanId'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupDefaultPriority'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupBSPortEnabled'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupQos'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupRowStatus'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionName'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionPortTagging'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionVlanId'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionDefaultPriority'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionParentLink'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionParentGroup'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionDLQoS'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionULQoS'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionRowStatus'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupStatusDLPacketsDiscards'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupStatusDLPacketsTx'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupStatusDLPacketsRx'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupStatusULPacketsDiscards'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupStatusULPacketsTx'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpGroupStatusULPacketsRx'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionStatusDLPacketsDiscards'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionStatusDLPacketsTx'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionStatusDLPacketsRx'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionStatusULPacketsDiscards'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionStatusULPacketsTx'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpConnectionStatusULPacketsRx')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): an50_pmp_object_group = an50PMPObjectGroup.setStatus('current') an50_pmp_obsolete_object_group = object_group((1, 3, 6, 1, 4, 1, 10728, 2, 51, 14)).setObjects(('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkGroupId'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkMaxHost'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkCIDDLCIR'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkCIDDLPIR'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkCIDULCIR'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkCIDULPIR'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkDLQoS'), ('REDLINE-AN50-PMP-V2-MIB', 'an50pmpLinkULQoS')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): an50_pmp_obsolete_object_group = an50PMPObsoleteObjectGroup.setStatus('obsolete') mibBuilder.exportSymbols('REDLINE-AN50-PMP-V2-MIB', an50pmpLinkULQoS=an50pmpLinkULQoS, an50pmpLinkULCIDStatPktRecv=an50pmpLinkULCIDStatPktRecv, an50pmpLinkRowStatus=an50pmpLinkRowStatus, an50pmpLinkDLStatBlksTot=an50pmpLinkDLStatBlksTot, an50pmpConnectionStatusId=an50pmpConnectionStatusId, an50pmpGroupTable=an50pmpGroupTable, an50pmpConnectionId=an50pmpConnectionId, an50pmpLinkLostCount=an50pmpLinkLostCount, an50pmpLastMissedSsMacAddress=an50pmpLastMissedSsMacAddress, an50pmpGroupStatusEntry=an50pmpGroupStatusEntry, an50pmpGroupStatusDLPacketsRx=an50pmpGroupStatusDLPacketsRx, an50pmpConnectionDefaultPriority=an50pmpConnectionDefaultPriority, an50pmpConnectionTable=an50pmpConnectionTable, an50pmpLastModifiedCID=an50pmpLastModifiedCID, an50pmpConnectionStatusULPacketsRx=an50pmpConnectionStatusULPacketsRx, an50PMPObsoleteObjectGroup=an50PMPObsoleteObjectGroup, an50pmpConnectionStatusDLPacketsDiscards=an50pmpConnectionStatusDLPacketsDiscards, an50pmpLinkDLRSSI=an50pmpLinkDLRSSI, an50pmpGroupEntry=an50pmpGroupEntry, an50pmpConnectionStatusULPacketsDiscards=an50pmpConnectionStatusULPacketsDiscards, an50pmpGroupStatusULPacketsDiscards=an50pmpGroupStatusULPacketsDiscards, an50pmpGroupQos=an50pmpGroupQos, an50pmpConnectionName=an50pmpConnectionName, an50pmpConnectionPortTagging=an50pmpConnectionPortTagging, redlineAN50PMPV2=redlineAN50PMPV2, an50pmpLinkCIDULCIR=an50pmpLinkCIDULCIR, an50pmpLinkDLCIDStatPktRecv=an50pmpLinkDLCIDStatPktRecv, an50pmpLinkMaxULBurstRate=an50pmpLinkMaxULBurstRate, an50pmpGroupBSPortEnabled=an50pmpGroupBSPortEnabled, an50pmpLinkName=an50pmpLinkName, an50pmpGroupRowStatus=an50pmpGroupRowStatus, an50pmpConnectionEntry=an50pmpConnectionEntry, an50pmpLinkCIDDLPIR=an50pmpLinkCIDDLPIR, an50pmpCIDSaveConfig=an50pmpCIDSaveConfig, an50pmpLinkDLStatLostFrm=an50pmpLinkDLStatLostFrm, an50pmpConnectionDLQoS=an50pmpConnectionDLQoS, an50pmpConnectionStatusULPacketsTx=an50pmpConnectionStatusULPacketsTx, an50pmpLinkEntry=an50pmpLinkEntry, an50pmpGroupStatusTable=an50pmpGroupStatusTable, an50pmpLinkPeerMac=an50pmpLinkPeerMac, an50pmpLinkID=an50pmpLinkID, an50pmpConnectionStatusDLPacketsTx=an50pmpConnectionStatusDLPacketsTx, an50pmpLinkDLCIDStatPktDisc=an50pmpLinkDLCIDStatPktDisc, an50pmpLinkStatusID=an50pmpLinkStatusID, an50pmpLinkMaxDLBurstRate=an50pmpLinkMaxDLBurstRate, an50pmpConnectionRowStatus=an50pmpConnectionRowStatus, an50pmpGroupStatusULPacketsTx=an50pmpGroupStatusULPacketsTx, an50pmpLinkULSINADR=an50pmpLinkULSINADR, an50pmpLinkULBurstRate=an50pmpLinkULBurstRate, an50pmpLinkULCIDStatPktTran=an50pmpLinkULCIDStatPktTran, an50pmpGroupVlanId=an50pmpGroupVlanId, an50pmpLinkTable=an50pmpLinkTable, PYSNMP_MODULE_ID=redlineAN50PMPV2, an50pmpLinkDLSINADR=an50pmpLinkDLSINADR, an50pmpConnectionParentLink=an50pmpConnectionParentLink, an50pmpConnectionStatusTable=an50pmpConnectionStatusTable, an50pmpLinkStatus=an50pmpLinkStatus, an50pmpLinkDLStatBlksRetr=an50pmpLinkDLStatBlksRetr, an50pmpLastSuccessfulID=an50pmpLastSuccessfulID, an50pmpGroupStatusDLPacketsDiscards=an50pmpGroupStatusDLPacketsDiscards, an50pmpLinkDLCIDStatPktTran=an50pmpLinkDLCIDStatPktTran, an50pmpConnectionParentGroup=an50pmpConnectionParentGroup, an50pmpGroupStatusULPacketsRx=an50pmpGroupStatusULPacketsRx, an50pmpLinkULStatBlksRetr=an50pmpLinkULStatBlksRetr, an50pmpConnectionStatusDLPacketsRx=an50pmpConnectionStatusDLPacketsRx, an50pmpLinkDLQoS=an50pmpLinkDLQoS, an50pmpLinkStatusEntry=an50pmpLinkStatusEntry, an50pmpLinkCIDULPIR=an50pmpLinkCIDULPIR, an50pmpLinkDLStatBlksDisc=an50pmpLinkDLStatBlksDisc, an50pmpLinkUpTime=an50pmpLinkUpTime, an50pmpLinkULStatLostFrm=an50pmpLinkULStatLostFrm, an50pmpLinkMaxHost=an50pmpLinkMaxHost, an50pmpConnectionStatusEntry=an50pmpConnectionStatusEntry, an50pmpConnectionVlanId=an50pmpConnectionVlanId, an50pmpLinkRegConn=an50pmpLinkRegConn, an50pmpLinkEncryptionKey=an50pmpLinkEncryptionKey, an50pmpLinkDLBurstRate=an50pmpLinkDLBurstRate, an50pmpLinkULCIDStatPktDisc=an50pmpLinkULCIDStatPktDisc, an50pmpGroupStatusId=an50pmpGroupStatusId, an50PMPObjectGroup=an50PMPObjectGroup, an50pmpLastDeniedSsMacAddress=an50pmpLastDeniedSsMacAddress, an50pmpGroupStatusDLPacketsTx=an50pmpGroupStatusDLPacketsTx, an50pmpLinkULStatBlksTot=an50pmpLinkULStatBlksTot, an50pmpLinkCIDDLCIR=an50pmpLinkCIDDLCIR, an50pmpLinkULStatBlksDisc=an50pmpLinkULStatBlksDisc, an50pmpGroupBSPortTagging=an50pmpGroupBSPortTagging, an50pmpLinkStatusTable=an50pmpLinkStatusTable, an50pmpGroupName=an50pmpGroupName, an50pmpLinkGroupId=an50pmpLinkGroupId, an50pmpConnectionULQoS=an50pmpConnectionULQoS, an50pmpLinkStatusCode=an50pmpLinkStatusCode, an50pmpGroupId=an50pmpGroupId, an50pmpGroupDefaultPriority=an50pmpGroupDefaultPriority, an50pmpLastRegisteredSsMacAddress=an50pmpLastRegisteredSsMacAddress, an50pmpLinkULRSSI=an50pmpLinkULRSSI)
# -*- coding: utf-8 -*- # @Time: 2020/5/8 22:38 # @Author: GraceKoo # @File: interview_2.py # @Desc: https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/ class Solution: def replaceSpace(self, s: str) -> str: s_list = list() for s_value in s: if s_value == " ": s_list.append("%20") else: s_list.append(s_value) return "".join(s_list) so = Solution() print(so.replaceSpace("We are happy."))
class Solution: def replace_space(self, s: str) -> str: s_list = list() for s_value in s: if s_value == ' ': s_list.append('%20') else: s_list.append(s_value) return ''.join(s_list) so = solution() print(so.replaceSpace('We are happy.'))
class Statement: transactions = [] def append_transaction(self, transaction): self.transactions.append(transaction) def print(self): for transaction in self.transactions: print(str(transaction))
class Statement: transactions = [] def append_transaction(self, transaction): self.transactions.append(transaction) def print(self): for transaction in self.transactions: print(str(transaction))
lista = [] dados = [] oper = '' maior = menor = 0 nomeMaior = '' nomeMenor = '' while oper != 'sair': dados.append(str(input('Digite o seu nome: '))) dados.append(int(input('Digite o seu peso: '))) if len(lista) == 0: maior = menor = dados[1] else: if dados[1] > maior: maior = dados[1] nomeMaior = dados[0] if dados[1] < menor: menor = dados[1] nomeMenor = dados[0] lista.append(dados[:]) dados.clear() oper = str(input('Deseja continuar? [Sim/Sair] ')).strip().lower() if oper == 'sair': break print('-=' * 30) print(f'Foram cadastradas {len(lista)} pessoas no total.') print(f'O maior peso foi de {maior}Kg, da pessoa {nomeMaior}') print(f'O menor peso foi de {menor}Kg, da pessoa {nomeMenor}')
lista = [] dados = [] oper = '' maior = menor = 0 nome_maior = '' nome_menor = '' while oper != 'sair': dados.append(str(input('Digite o seu nome: '))) dados.append(int(input('Digite o seu peso: '))) if len(lista) == 0: maior = menor = dados[1] else: if dados[1] > maior: maior = dados[1] nome_maior = dados[0] if dados[1] < menor: menor = dados[1] nome_menor = dados[0] lista.append(dados[:]) dados.clear() oper = str(input('Deseja continuar? [Sim/Sair] ')).strip().lower() if oper == 'sair': break print('-=' * 30) print(f'Foram cadastradas {len(lista)} pessoas no total.') print(f'O maior peso foi de {maior}Kg, da pessoa {nomeMaior}') print(f'O menor peso foi de {menor}Kg, da pessoa {nomeMenor}')
"""Leetcode 3. Longest Substring Without Repeating Characters Medium URL: https://leetcode.com/problems/longest-substring-without-repeating-characters/ Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Input: "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3: Input: "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring. """ class SolutionCharPosDict(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int Time complexity: O(n). Space complexity: O(k), k is the number of characters. """ start = 0 max_len = 0 char_pos = {} for i, c in enumerate(s): if c in char_pos and start <= char_pos[c]: # When repeating char is visited. start = char_pos[c] + 1 else: # If not, update max length. max_len = max(max_len, i - start + 1) # Always update char dict for every char in s. char_pos[c] = i return max_len def main(): # Example 1: "abcabcbb" -> 3 ("abc") s = "abcabcbb" print('For {0}: {1}'.format(s, SolutionCharPosDict().lengthOfLongestSubstring(s))) # Example 2: "bbbbb" -> 1 ("b") s = "bbbbb" print('For {0}: {1}'.format(s, SolutionCharPosDict().lengthOfLongestSubstring(s))) # Example 3: "pwwkew" -> 3 ("wke") s = "pwwkew" print('For {0}: {1}'.format(s, SolutionCharPosDict().lengthOfLongestSubstring(s))) if __name__ == '__main__': main()
"""Leetcode 3. Longest Substring Without Repeating Characters Medium URL: https://leetcode.com/problems/longest-substring-without-repeating-characters/ Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Input: "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3: Input: "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring. """ class Solutioncharposdict(object): def length_of_longest_substring(self, s): """ :type s: str :rtype: int Time complexity: O(n). Space complexity: O(k), k is the number of characters. """ start = 0 max_len = 0 char_pos = {} for (i, c) in enumerate(s): if c in char_pos and start <= char_pos[c]: start = char_pos[c] + 1 else: max_len = max(max_len, i - start + 1) char_pos[c] = i return max_len def main(): s = 'abcabcbb' print('For {0}: {1}'.format(s, solution_char_pos_dict().lengthOfLongestSubstring(s))) s = 'bbbbb' print('For {0}: {1}'.format(s, solution_char_pos_dict().lengthOfLongestSubstring(s))) s = 'pwwkew' print('For {0}: {1}'.format(s, solution_char_pos_dict().lengthOfLongestSubstring(s))) if __name__ == '__main__': main()
""" Author: Stephen Thomas Date Created: 23 December 2017 Basic implementation of an undirected graph Github Link: https://github.com/Mewzyk/stephen_AI.git """ class Node: def __init__(self, key, neighbors = []): self.key = key self.neighbors = set(neighbors) class Graph: def __init__(self, graph_dict = None): if graph_dict == None: graph_dict = {} self.graph_dict = graph_dict def vertices(self): return list(self.graph_dict.keys()) def add_vertex(self, vertex): if vertex not in self.graph_dict: self.graph_dict[vertex] = Node(vertex) def add_edge(self, edge): edge = set(edge) if len(edge) == 2: left = edge.pop() right = edge.pop() if left in self.graph_dict and right in self.graph_dict: self.graph_dict[left].neighbors.add(self.graph_dict[right]) self.graph_dict[right].neighbors.add(self.graph_dict[left]) def print_graph(self): print('Printing Vertices: ') print(self.graph_dict.keys(), '\n') print('Printing Edges: ') for key in self.graph_dict.keys(): output = [] for edge in self.graph_dict[key].neighbors: output.append(edge.key) print(key, '<-->', output) if __name__ == "__main__": main_graph = Graph() vertices = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] edges = [['a', 'b'], ['b', 'c'], ['c', 'd'], ['d', 'e'], ['e', 'f'], ['f', 'g'], ['g', 'h']] for vertex in vertices: main_graph.add_vertex(vertex) for edge in edges: main_graph.add_edge(edge) main_graph.print_graph()
""" Author: Stephen Thomas Date Created: 23 December 2017 Basic implementation of an undirected graph Github Link: https://github.com/Mewzyk/stephen_AI.git """ class Node: def __init__(self, key, neighbors=[]): self.key = key self.neighbors = set(neighbors) class Graph: def __init__(self, graph_dict=None): if graph_dict == None: graph_dict = {} self.graph_dict = graph_dict def vertices(self): return list(self.graph_dict.keys()) def add_vertex(self, vertex): if vertex not in self.graph_dict: self.graph_dict[vertex] = node(vertex) def add_edge(self, edge): edge = set(edge) if len(edge) == 2: left = edge.pop() right = edge.pop() if left in self.graph_dict and right in self.graph_dict: self.graph_dict[left].neighbors.add(self.graph_dict[right]) self.graph_dict[right].neighbors.add(self.graph_dict[left]) def print_graph(self): print('Printing Vertices: ') print(self.graph_dict.keys(), '\n') print('Printing Edges: ') for key in self.graph_dict.keys(): output = [] for edge in self.graph_dict[key].neighbors: output.append(edge.key) print(key, '<-->', output) if __name__ == '__main__': main_graph = graph() vertices = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] edges = [['a', 'b'], ['b', 'c'], ['c', 'd'], ['d', 'e'], ['e', 'f'], ['f', 'g'], ['g', 'h']] for vertex in vertices: main_graph.add_vertex(vertex) for edge in edges: main_graph.add_edge(edge) main_graph.print_graph()
class FeedException(Exception): def __init__(self, *args, **kwargs): self.message = kwargs.pop('message')
class Feedexception(Exception): def __init__(self, *args, **kwargs): self.message = kwargs.pop('message')
# -*- coding: utf-8 -*- _name1 = [ 'Chikorita', 'Bayleef', 'Meganium', 'Cyndaquil', 'Quilava', 'Typhlosion', 'Totodile', 'Croconaw', 'Feraligatr', 'Sentret', 'Furret', 'Hoothoot', 'Noctowl', 'Ledyba', 'Ledian', 'Spinarak', 'Ariados', 'Crobat', 'Chinchou', 'Lanturn', 'Pichu', 'Cleffa', 'Igglybuff', 'Togepi', 'Togetic', 'Natu', 'Xatu', 'Mareep', 'Flaaffy', 'Ampharos', 'Bellossom', 'Marill', 'Azumarill', 'Sudowoodo', 'Politoed', 'Hoppip', 'Skiploom', 'Jumpluff', 'Aipom', 'Sunkern', 'Sunflora', 'Yanma', 'Wooper', 'Quagsire', 'Espeon', 'Umbreon', 'Murkrow', 'Slowking', 'Misdreavus', 'Unown', ] _name2 = [ 'Wobbuffet', 'Girafarig', 'Pineco', 'Forretress', 'Dunsparce', 'Gligar', 'Steelix', 'Snubbull', 'Granbull', 'Qwilfish', 'Scizor', 'Shuckle', 'Heracross', 'Sneasel', 'Teddiursa', 'Ursaring', 'Slugma', 'Magcargo', 'Swinub', 'Piloswine', 'Corsola', 'Remoraid', 'Octillery', 'Delibird', 'Mantine', 'Skarmory', 'Houndour', 'Houndoom', 'Kingdra', 'Phanpy', 'Donphan', 'Porygon2', 'Stantler', 'Smeargle', 'Tyrogue', 'Hitmontop', 'Smoochum', 'Elekid', 'Magby', 'Miltank', 'Blissey', 'Raikou', 'Entei', 'Suicune', 'Larvitar', 'Pupitar', 'Tyranitar', 'Lugia', 'Ho-Oh', 'Celebi', ]
_name1 = ['Chikorita', 'Bayleef', 'Meganium', 'Cyndaquil', 'Quilava', 'Typhlosion', 'Totodile', 'Croconaw', 'Feraligatr', 'Sentret', 'Furret', 'Hoothoot', 'Noctowl', 'Ledyba', 'Ledian', 'Spinarak', 'Ariados', 'Crobat', 'Chinchou', 'Lanturn', 'Pichu', 'Cleffa', 'Igglybuff', 'Togepi', 'Togetic', 'Natu', 'Xatu', 'Mareep', 'Flaaffy', 'Ampharos', 'Bellossom', 'Marill', 'Azumarill', 'Sudowoodo', 'Politoed', 'Hoppip', 'Skiploom', 'Jumpluff', 'Aipom', 'Sunkern', 'Sunflora', 'Yanma', 'Wooper', 'Quagsire', 'Espeon', 'Umbreon', 'Murkrow', 'Slowking', 'Misdreavus', 'Unown'] _name2 = ['Wobbuffet', 'Girafarig', 'Pineco', 'Forretress', 'Dunsparce', 'Gligar', 'Steelix', 'Snubbull', 'Granbull', 'Qwilfish', 'Scizor', 'Shuckle', 'Heracross', 'Sneasel', 'Teddiursa', 'Ursaring', 'Slugma', 'Magcargo', 'Swinub', 'Piloswine', 'Corsola', 'Remoraid', 'Octillery', 'Delibird', 'Mantine', 'Skarmory', 'Houndour', 'Houndoom', 'Kingdra', 'Phanpy', 'Donphan', 'Porygon2', 'Stantler', 'Smeargle', 'Tyrogue', 'Hitmontop', 'Smoochum', 'Elekid', 'Magby', 'Miltank', 'Blissey', 'Raikou', 'Entei', 'Suicune', 'Larvitar', 'Pupitar', 'Tyranitar', 'Lugia', 'Ho-Oh', 'Celebi']
# Solution to part 2 of day 14 of AOC 2015, Reindeer Olympics # https://adventofcode.com/2015/day/14 f = open('input.txt') whole_text = f.read() f.close() race = 2503 deers = {} all_deers = {} for line in whole_text.split('\n'): # print(line) # Example, # Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds. reindeer, _, _, speed_str, _, _, fly_str, _, _, _, _, _, _, rest_str, _ = line.split(' ') speed, fly, rest = int(speed_str), int(fly_str), int(rest_str) deers[reindeer] = 0 for second in range(1, race + 1): # print(second) complete_fly_rest_cycles = second // (fly + rest) final_flight_start_second = complete_fly_rest_cycles * (fly + rest) time_left_for_final_flight = second - final_flight_start_second final_flight_secs = min(fly, time_left_for_final_flight) fly_time = complete_fly_rest_cycles * fly + final_flight_secs dist = fly_time * speed all_deers[(reindeer, second)] = dist for second in range(1, race + 1): best_dist_this_sec = 0 best_deers_this_sec = [] for deer in deers: if all_deers[(deer, second)] > best_dist_this_sec: best_dist_this_sec = all_deers[(deer, second)] best_deers_this_sec = [deer] elif all_deers[(deer, second)] == best_dist_this_sec: best_deers_this_sec.append(deer) for deer in best_deers_this_sec: deers[deer] += 1 print() print(deers)
f = open('input.txt') whole_text = f.read() f.close() race = 2503 deers = {} all_deers = {} for line in whole_text.split('\n'): (reindeer, _, _, speed_str, _, _, fly_str, _, _, _, _, _, _, rest_str, _) = line.split(' ') (speed, fly, rest) = (int(speed_str), int(fly_str), int(rest_str)) deers[reindeer] = 0 for second in range(1, race + 1): complete_fly_rest_cycles = second // (fly + rest) final_flight_start_second = complete_fly_rest_cycles * (fly + rest) time_left_for_final_flight = second - final_flight_start_second final_flight_secs = min(fly, time_left_for_final_flight) fly_time = complete_fly_rest_cycles * fly + final_flight_secs dist = fly_time * speed all_deers[reindeer, second] = dist for second in range(1, race + 1): best_dist_this_sec = 0 best_deers_this_sec = [] for deer in deers: if all_deers[deer, second] > best_dist_this_sec: best_dist_this_sec = all_deers[deer, second] best_deers_this_sec = [deer] elif all_deers[deer, second] == best_dist_this_sec: best_deers_this_sec.append(deer) for deer in best_deers_this_sec: deers[deer] += 1 print() print(deers)
# Copyright (c) 2011-2014 Turbulenz Limited """HTTP exceptions Apps Provides API Level exceptions for webdevelopers (those exceptions get caught and passed back as error Callbacks to the client) """ class PostOnlyException(BaseException): def __init__(self, value): super(PostOnlyException, self).__init__() self.value = value def __str__(self): return self.value class GetOnlyException(BaseException): def __init__(self, value): super(GetOnlyException, self).__init__() self.value = value def __str__(self): return self.value class ApiException(BaseException): def __init__(self, value, status='500 Internal Server Error', json_data=None): super(ApiException, self).__init__() self.value = value self.status = status self.json_data = json_data def __str__(self): return self.value class InvalidGameSession(ApiException): def __init__(self, value): ApiException.__init__(self, value, '403 Forbidden', {'invalidGameSession': True}) class NotFound(ApiException): def __init__(self, value, json_data=None): ApiException.__init__(self, value, '404 Not Found', json_data) class BadRequest(ApiException): def __init__(self, value, json_data=None): ApiException.__init__(self, value, '400 Bad Request', json_data) class Unauthorized(ApiException): def __init__(self, value, json_data=None): ApiException.__init__(self, value, '401 Unauthorized', json_data) class Forbidden(ApiException): def __init__(self, value, json_data=None): ApiException.__init__(self, value, '403 Forbidden', json_data) class ApiUnavailable(ApiException): pass class ApiNotImplemented(ApiException): pass
"""HTTP exceptions Apps Provides API Level exceptions for webdevelopers (those exceptions get caught and passed back as error Callbacks to the client) """ class Postonlyexception(BaseException): def __init__(self, value): super(PostOnlyException, self).__init__() self.value = value def __str__(self): return self.value class Getonlyexception(BaseException): def __init__(self, value): super(GetOnlyException, self).__init__() self.value = value def __str__(self): return self.value class Apiexception(BaseException): def __init__(self, value, status='500 Internal Server Error', json_data=None): super(ApiException, self).__init__() self.value = value self.status = status self.json_data = json_data def __str__(self): return self.value class Invalidgamesession(ApiException): def __init__(self, value): ApiException.__init__(self, value, '403 Forbidden', {'invalidGameSession': True}) class Notfound(ApiException): def __init__(self, value, json_data=None): ApiException.__init__(self, value, '404 Not Found', json_data) class Badrequest(ApiException): def __init__(self, value, json_data=None): ApiException.__init__(self, value, '400 Bad Request', json_data) class Unauthorized(ApiException): def __init__(self, value, json_data=None): ApiException.__init__(self, value, '401 Unauthorized', json_data) class Forbidden(ApiException): def __init__(self, value, json_data=None): ApiException.__init__(self, value, '403 Forbidden', json_data) class Apiunavailable(ApiException): pass class Apinotimplemented(ApiException): pass
class Solution: def isPalindrome(self, x): """ :type x: int :rtype: bool """ self.x=x if x<0: return False x=str(x) length=len(x) i=0 j=length-1 for i in range(length//2): if x[i]!=x[length-i-1]: return False return True
class Solution: def is_palindrome(self, x): """ :type x: int :rtype: bool """ self.x = x if x < 0: return False x = str(x) length = len(x) i = 0 j = length - 1 for i in range(length // 2): if x[i] != x[length - i - 1]: return False return True
"""Metric base class for new user-defined metrics.""" class MetricBase(object): """Metric template class.""" def __init__( self, *args, **kwds ): pass def process_token(self, token): """Handle processing for each token.""" pass def display(self): """Display the metric for the processed file.""" pass def get_metrics(self): """Return the current metrics as a dict""" pass
"""Metric base class for new user-defined metrics.""" class Metricbase(object): """Metric template class.""" def __init__(self, *args, **kwds): pass def process_token(self, token): """Handle processing for each token.""" pass def display(self): """Display the metric for the processed file.""" pass def get_metrics(self): """Return the current metrics as a dict""" pass
word=input() n=int(input()) first_half=word[:n] second_half=word[n+1:] result=(first_half+second_half) print(result)
word = input() n = int(input()) first_half = word[:n] second_half = word[n + 1:] result = first_half + second_half print(result)
class Test: """ This is the class """ _prop = 1 @property def prop(self): """ This is the getter """ return self._prop @prop.setter def prop(self, val): """ This is the setter """ self._prop = val
class Test: """ This is the class """ _prop = 1 @property def prop(self): """ This is the getter """ return self._prop @prop.setter def prop(self, val): """ This is the setter """ self._prop = val
# pyre-ignore-all-errors # TODO: Change `pyre-ignore-all-errors` to `pyre-strict` on line 1, so we get # to see all type errors in this file. # We mentioned in the talk that consuming values of union type often requires a # case split. But there are also cases where the case split is not necessary. # This example demonstrates those cases. # Consider these two classes: class Dog: def bark(self) -> None: print("Whoof! Whoof!") def play(self) -> None: print("Dog playing!") def chase(self, dog: Dog) -> None: print("Dog is chasing another dog!") class Cat: def meow(self) -> None: print("Meow! Meow!") def play(self) -> None: print("Cat playing!") def chase(self, cat: Cat) -> None: print("Cat is chasing another cat!") # Now we have a function written like this: def make_sound(pet): if isinstance(pet, Dog): pet.bark() elif isinstance(pet, Cat): pet.meow() else: raise RuntimeError make_sound(Dog()) make_sound(Cat()) # TODO: Type-annotate the `make_sound` function. Is the case-split here # necessary or not? # ------------------------------------------------------------------------------ # Now consider the following function: def make_play(pet): if isinstance(pet, Dog): pet.play() elif isinstance(pet, Cat): pet.play() else: raise RuntimeError make_play(Dog()) make_play(Cat()) # TODO: Type-annotate the `make_sound` function. Is the case-split here # necessary or not? Try removing the isinstance check and see if the type # checker accepts the change. # ------------------------------------------------------------------------------ # Question: Is it possible to type-annotate the following function with union # type, without doing any case split in the function body? Why or why not? def make_chase(pet0, pet1): pet0.chase(pet1) pet1.chase(pet0) make_chase(Dog(), Dog()) make_chase(Cat(), Dog()) make_chase(Dog(), Cat()) make_chase(Cat(), Cat())
class Dog: def bark(self) -> None: print('Whoof! Whoof!') def play(self) -> None: print('Dog playing!') def chase(self, dog: Dog) -> None: print('Dog is chasing another dog!') class Cat: def meow(self) -> None: print('Meow! Meow!') def play(self) -> None: print('Cat playing!') def chase(self, cat: Cat) -> None: print('Cat is chasing another cat!') def make_sound(pet): if isinstance(pet, Dog): pet.bark() elif isinstance(pet, Cat): pet.meow() else: raise RuntimeError make_sound(dog()) make_sound(cat()) def make_play(pet): if isinstance(pet, Dog): pet.play() elif isinstance(pet, Cat): pet.play() else: raise RuntimeError make_play(dog()) make_play(cat()) def make_chase(pet0, pet1): pet0.chase(pet1) pet1.chase(pet0) make_chase(dog(), dog()) make_chase(cat(), dog()) make_chase(dog(), cat()) make_chase(cat(), cat())
def calculateWeight(name, allSupporters): summation = 0 if (len(allSupporters[name]) > 1): for e in allSupporters[name][1]: summation += calculateWeight(e, allSupporters) return allSupporters[name][0]+summation def findAppropriateTree(name, allSupporters): allWeights = [] for i in allSupporters[name][1]: allWeights.append( (calculateWeight(i, allSupporters), i) ) allWeights.sort() if (allWeights[0][0] == allWeights[-1][0]): return allSupporters[name][0] else: if (allWeights[0][0] == allWeights[1][0]): ret = findAppropriateTree(allWeights[-1][1], allSupporters) if (ret != None): print("The weight of", allWeights[-1][1], "needs to be changed by", allWeights[0][0]-allWeights[-1][0], \ "to", allSupporters[allWeights[-1][1]][0]+(allWeights[0][0]-allWeights[-1][0]) ) else: ret = findAppropriateTree(allWeights[0][1], allSupporters) file = open("Day7Input.txt") allSupporters = dict() for line in file: splitput = line.split() name = splitput[0] value = int(splitput[1][1:-1]) children = splitput[3:] for i in range(len(children)): children[i] = children[i].replace(',', '') allSupporters[name] = [value, children] copy = allSupporters.copy() while (len(copy) > 1): for e in allSupporters: if (len(allSupporters[e]) > 1): for oth in allSupporters[e][1]: copy.pop(oth, None) print("Root of tree =", list(copy)[0]) findAppropriateTree('mkxke', allSupporters)
def calculate_weight(name, allSupporters): summation = 0 if len(allSupporters[name]) > 1: for e in allSupporters[name][1]: summation += calculate_weight(e, allSupporters) return allSupporters[name][0] + summation def find_appropriate_tree(name, allSupporters): all_weights = [] for i in allSupporters[name][1]: allWeights.append((calculate_weight(i, allSupporters), i)) allWeights.sort() if allWeights[0][0] == allWeights[-1][0]: return allSupporters[name][0] elif allWeights[0][0] == allWeights[1][0]: ret = find_appropriate_tree(allWeights[-1][1], allSupporters) if ret != None: print('The weight of', allWeights[-1][1], 'needs to be changed by', allWeights[0][0] - allWeights[-1][0], 'to', allSupporters[allWeights[-1][1]][0] + (allWeights[0][0] - allWeights[-1][0])) else: ret = find_appropriate_tree(allWeights[0][1], allSupporters) file = open('Day7Input.txt') all_supporters = dict() for line in file: splitput = line.split() name = splitput[0] value = int(splitput[1][1:-1]) children = splitput[3:] for i in range(len(children)): children[i] = children[i].replace(',', '') allSupporters[name] = [value, children] copy = allSupporters.copy() while len(copy) > 1: for e in allSupporters: if len(allSupporters[e]) > 1: for oth in allSupporters[e][1]: copy.pop(oth, None) print('Root of tree =', list(copy)[0]) find_appropriate_tree('mkxke', allSupporters)
# Task 1 - Highest occurrence def highest_occurrence(array): """ Time: O(n) Space: O(n) :param array: strings, int or floats, can be mixed :return: array containing element(s) with the highest occurrences without type coercion. Returns an empty array if given array is empty. """ # hash table with a count of each item in the array counted = {} for item in array: if item in counted.keys(): counted[item] += 1 else: counted[item] = 1 frequencies = counted.values() highest_frequency = max(frequencies, default="") most_frequent = [item for item in counted if counted[item] == highest_frequency] return most_frequent print(highest_occurrence([2, 3, 2, 2, 2, 4, 2])) print(highest_occurrence([2, 3, 2, 3, 2, 3, 4])) print(highest_occurrence(['a', 'b', 'c', 'a', 'a', 'a', 'a'])) print(highest_occurrence(['a', 'a', 2, 2, 2, 'a', 4])) print(highest_occurrence(['123123', 4, '4', 4])) print(highest_occurrence(['123123', 4.3412, 4.3411])) print(highest_occurrence(['123123', -45, -2])) print(highest_occurrence([])) print(highest_occurrence(['a'])) # Task 2 - Maximum Sub Array Sum def max_sub_array_sum(array, number): """ Time: O(n) Space: O(1) Finds a the maximum sum of a 'number' consecutive elements in an array :param array: float or int :param number: float or int :return: float or int, highest sum """ if not array: return None maximum = 0 temp = 0 for index, integer in enumerate(array): temp += integer if index-number >= 0: temp -= array[index-number] if temp > maximum: maximum = temp return maximum print(max_sub_array_sum([1,2,5,2,8,1,5], 4)) print(max_sub_array_sum([1,2,5,2,8,1,5], 2)) print(max_sub_array_sum([4,2,1,6], 1)) print(max_sub_array_sum([4,2,1,6,2], 4)) print(max_sub_array_sum([-4,-2,-1,-6,-2], 4)) print(max_sub_array_sum([4.3451,2.5334,1.12,6,2], 4)) print(max_sub_array_sum([], 4)) # Task 3 - Average Pair def average_pair(array, target): """ Time: O(n) Space: O(n) Returns true if there is a pair of numbers in the array that when averaged are equal to the target. False otherwise :param array: positive or negative int or floats :param target: positive or negative int or float :return: Bool """ # hash table available_numbers = set() for item in array: temp = 2*target - item if temp in available_numbers: return True available_numbers.add(item) return False print(average_pair([1,2,3], 2.5)) print(average_pair([1,3,3,5,6,7,10,12,19], 8)) print(average_pair([-1,0,3,4,5,6], 4.1)) print(average_pair([], 4)) print(average_pair([-1,8,8,-4,5,6], 8))
def highest_occurrence(array): """ Time: O(n) Space: O(n) :param array: strings, int or floats, can be mixed :return: array containing element(s) with the highest occurrences without type coercion. Returns an empty array if given array is empty. """ counted = {} for item in array: if item in counted.keys(): counted[item] += 1 else: counted[item] = 1 frequencies = counted.values() highest_frequency = max(frequencies, default='') most_frequent = [item for item in counted if counted[item] == highest_frequency] return most_frequent print(highest_occurrence([2, 3, 2, 2, 2, 4, 2])) print(highest_occurrence([2, 3, 2, 3, 2, 3, 4])) print(highest_occurrence(['a', 'b', 'c', 'a', 'a', 'a', 'a'])) print(highest_occurrence(['a', 'a', 2, 2, 2, 'a', 4])) print(highest_occurrence(['123123', 4, '4', 4])) print(highest_occurrence(['123123', 4.3412, 4.3411])) print(highest_occurrence(['123123', -45, -2])) print(highest_occurrence([])) print(highest_occurrence(['a'])) def max_sub_array_sum(array, number): """ Time: O(n) Space: O(1) Finds a the maximum sum of a 'number' consecutive elements in an array :param array: float or int :param number: float or int :return: float or int, highest sum """ if not array: return None maximum = 0 temp = 0 for (index, integer) in enumerate(array): temp += integer if index - number >= 0: temp -= array[index - number] if temp > maximum: maximum = temp return maximum print(max_sub_array_sum([1, 2, 5, 2, 8, 1, 5], 4)) print(max_sub_array_sum([1, 2, 5, 2, 8, 1, 5], 2)) print(max_sub_array_sum([4, 2, 1, 6], 1)) print(max_sub_array_sum([4, 2, 1, 6, 2], 4)) print(max_sub_array_sum([-4, -2, -1, -6, -2], 4)) print(max_sub_array_sum([4.3451, 2.5334, 1.12, 6, 2], 4)) print(max_sub_array_sum([], 4)) def average_pair(array, target): """ Time: O(n) Space: O(n) Returns true if there is a pair of numbers in the array that when averaged are equal to the target. False otherwise :param array: positive or negative int or floats :param target: positive or negative int or float :return: Bool """ available_numbers = set() for item in array: temp = 2 * target - item if temp in available_numbers: return True available_numbers.add(item) return False print(average_pair([1, 2, 3], 2.5)) print(average_pair([1, 3, 3, 5, 6, 7, 10, 12, 19], 8)) print(average_pair([-1, 0, 3, 4, 5, 6], 4.1)) print(average_pair([], 4)) print(average_pair([-1, 8, 8, -4, 5, 6], 8))
# Performing operations on the DataFrame # DataFrame transformations # select() # filter() # groupby() # orderby() # dropDuplicates() # withColumnRenamed() # DataFrame actions # printSchema() # head() # show() # count() # columns # describe() # 1. Initial EDA # Print the first 10 observations people_df.show(10) # Count the number of rows print("There are {} rows in the people_df DataFrame.".format(people_df.count())) # Count the number of columns and their names print("There are {} columns in the people_df DataFrame and their names are {}".format(len(people_df.columns), people_df.columns)) # 2. Subsetting and cleaning # Select name, sex and date of birth columns people_df_sub = people_df.select('name', 'sex', 'date of birth') # Print the first 10 observations from people_df_sub people_df_sub.show(10) # Remove duplicate entries from people_df_sub people_df_sub_nodup = people_df_sub.dropDuplicates() # Count the number of rows print("There were {} rows before removing duplicates, and {} rows after removing duplicates".format(people_df_sub.count(), people_df_sub_nodup.count())) # 3. Filtering DataFrame # Filter people_df to select females people_df_female = people_df.filter(people_df.sex == "female") # Filter people_df to select males people_df_male = people_df.filter(people_df.sex == "male") # Count the number of rows print("There are {} rows in the people_df_female DataFrame and {} rows in the people_df_male DataFrame".format(people_df_female.count(), people_df_male.count()))
people_df.show(10) print('There are {} rows in the people_df DataFrame.'.format(people_df.count())) print('There are {} columns in the people_df DataFrame and their names are {}'.format(len(people_df.columns), people_df.columns)) people_df_sub = people_df.select('name', 'sex', 'date of birth') people_df_sub.show(10) people_df_sub_nodup = people_df_sub.dropDuplicates() print('There were {} rows before removing duplicates, and {} rows after removing duplicates'.format(people_df_sub.count(), people_df_sub_nodup.count())) people_df_female = people_df.filter(people_df.sex == 'female') people_df_male = people_df.filter(people_df.sex == 'male') print('There are {} rows in the people_df_female DataFrame and {} rows in the people_df_male DataFrame'.format(people_df_female.count(), people_df_male.count()))
# Headers copied directly from browser request static = { 'accept': 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8', 'referer': 'https://www.nowgatewayx.com/login', 'sec-ch-ua': '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36', 'x-csrf-token': 'disabled' } login = { 'authorization': 'Basic bnAtcHJvZC1ub3ctcGVuc2lvbnMtZ3dheXItYWM6amhrOTJuOHVTV015R2FxcHMzWVVUY0tYZTc1YnRkREY=', 'content-length': '102', 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', 'cookie': 'viewed_cookie_policy=', 'origin': 'https://www.nowgatewayx.com', }
static = {'accept': 'application/json, text/plain, */*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8', 'referer': 'https://www.nowgatewayx.com/login', 'sec-ch-ua': '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36', 'x-csrf-token': 'disabled'} login = {'authorization': 'Basic bnAtcHJvZC1ub3ctcGVuc2lvbnMtZ3dheXItYWM6amhrOTJuOHVTV015R2FxcHMzWVVUY0tYZTc1YnRkREY=', 'content-length': '102', 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', 'cookie': 'viewed_cookie_policy=', 'origin': 'https://www.nowgatewayx.com'}
def return_func(): pass def func(): return return_func a = func() a()
def return_func(): pass def func(): return return_func a = func() a()
n = int(input()) a = set(map(int, input().split())) m = int(input()) b = set(map(int, input().split())) d = list(a.union(b).difference(a.intersection(b))) d.sort() for i in d: print(i)
n = int(input()) a = set(map(int, input().split())) m = int(input()) b = set(map(int, input().split())) d = list(a.union(b).difference(a.intersection(b))) d.sort() for i in d: print(i)
# # @lc app=leetcode.cn id=43 lang=python3 # # [43] multiply-strings # None # @lc code=end
None
class AdbNoStartError(Exception): pass class NoSuchProcessNameError(Exception): pass class CommandError(Exception): pass class ConfigError(Exception): pass class PlatformNoSupport(Warning): """ Base class for warnings about deprecated features. """ pass
class Adbnostarterror(Exception): pass class Nosuchprocessnameerror(Exception): pass class Commanderror(Exception): pass class Configerror(Exception): pass class Platformnosupport(Warning): """ Base class for warnings about deprecated features. """ pass
"""Performance analysis of different implementations of 2d finite difference wave propagation. """ __version__ = '0.0.1'
"""Performance analysis of different implementations of 2d finite difference wave propagation. """ __version__ = '0.0.1'
class PortfolioFilter: def __init__(self, column, options=None, portfolio_options=None, values=None, industry_codes=None, inverted=False, include_null=False, domain=None): self.key = column + '-0' self.column = column self.options = options if options is not None else [] self.portfolio_options = portfolio_options if portfolio_options is not None else [] self.values = values if values is not None else [] self.include_null = include_null self.inverted = inverted self.naics = industry_codes if industry_codes is not None else [] self.domain = self.set_domain(*sorted(domain)) if domain else None def add_value(self, value): self.values.append(value) return self.values def add_industry(self, industry): self.naics.append(industry) return self.naics def set_domain(self, minimum, maximum, from_value=None, to_value=None): self.domain = {"min": minimum, "from": from_value, "to": to_value, "max": maximum} return self.domain def get(self): if self.column in ["inceptiondate", "expirationdate"]: return { "column": self.column, "key": self.key, "domain": self.domain, "includeNull": self.include_null, "naics": {"values": self.naics} } return { "column": self.column, "key": self.key, "filter": {"options": self.options, "values": self.values, "portfolioOptions": self.portfolio_options}, "includeNull": self.include_null, "inverted": self.inverted, "naics": {"values": self.naics} }
class Portfoliofilter: def __init__(self, column, options=None, portfolio_options=None, values=None, industry_codes=None, inverted=False, include_null=False, domain=None): self.key = column + '-0' self.column = column self.options = options if options is not None else [] self.portfolio_options = portfolio_options if portfolio_options is not None else [] self.values = values if values is not None else [] self.include_null = include_null self.inverted = inverted self.naics = industry_codes if industry_codes is not None else [] self.domain = self.set_domain(*sorted(domain)) if domain else None def add_value(self, value): self.values.append(value) return self.values def add_industry(self, industry): self.naics.append(industry) return self.naics def set_domain(self, minimum, maximum, from_value=None, to_value=None): self.domain = {'min': minimum, 'from': from_value, 'to': to_value, 'max': maximum} return self.domain def get(self): if self.column in ['inceptiondate', 'expirationdate']: return {'column': self.column, 'key': self.key, 'domain': self.domain, 'includeNull': self.include_null, 'naics': {'values': self.naics}} return {'column': self.column, 'key': self.key, 'filter': {'options': self.options, 'values': self.values, 'portfolioOptions': self.portfolio_options}, 'includeNull': self.include_null, 'inverted': self.inverted, 'naics': {'values': self.naics}}
"""Constants needed by ISAPI filters and extensions.""" # ====================================================================== # Copyright 2002-2003 by Blackdog Software Pty Ltd. # # All Rights Reserved # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose and without fee is hereby # granted, provided that the above copyright notice appear in all # copies and that both that copyright notice and this permission # notice appear in supporting documentation, and that the name of # Blackdog Software not be used in advertising or publicity pertaining to # distribution of the software without specific, written prior # permission. # # BLACKDOG SOFTWARE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN # NO EVENT SHALL BLACKDOG SOFTWARE BE LIABLE FOR ANY SPECIAL, INDIRECT OR # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ====================================================================== # HTTP reply codes HTTP_CONTINUE = 100 HTTP_SWITCHING_PROTOCOLS = 101 HTTP_PROCESSING = 102 HTTP_OK = 200 HTTP_CREATED = 201 HTTP_ACCEPTED = 202 HTTP_NON_AUTHORITATIVE = 203 HTTP_NO_CONTENT = 204 HTTP_RESET_CONTENT = 205 HTTP_PARTIAL_CONTENT = 206 HTTP_MULTI_STATUS = 207 HTTP_MULTIPLE_CHOICES = 300 HTTP_MOVED_PERMANENTLY = 301 HTTP_MOVED_TEMPORARILY = 302 HTTP_SEE_OTHER = 303 HTTP_NOT_MODIFIED = 304 HTTP_USE_PROXY = 305 HTTP_TEMPORARY_REDIRECT = 307 HTTP_BAD_REQUEST = 400 HTTP_UNAUTHORIZED = 401 HTTP_PAYMENT_REQUIRED = 402 HTTP_FORBIDDEN = 403 HTTP_NOT_FOUND = 404 HTTP_METHOD_NOT_ALLOWED = 405 HTTP_NOT_ACCEPTABLE = 406 HTTP_PROXY_AUTHENTICATION_REQUIRED= 407 HTTP_REQUEST_TIME_OUT = 408 HTTP_CONFLICT = 409 HTTP_GONE = 410 HTTP_LENGTH_REQUIRED = 411 HTTP_PRECONDITION_FAILED = 412 HTTP_REQUEST_ENTITY_TOO_LARGE = 413 HTTP_REQUEST_URI_TOO_LARGE = 414 HTTP_UNSUPPORTED_MEDIA_TYPE = 415 HTTP_RANGE_NOT_SATISFIABLE = 416 HTTP_EXPECTATION_FAILED = 417 HTTP_UNPROCESSABLE_ENTITY = 422 HTTP_INTERNAL_SERVER_ERROR = 500 HTTP_NOT_IMPLEMENTED = 501 HTTP_BAD_GATEWAY = 502 HTTP_SERVICE_UNAVAILABLE = 503 HTTP_GATEWAY_TIME_OUT = 504 HTTP_VERSION_NOT_SUPPORTED = 505 HTTP_VARIANT_ALSO_VARIES = 506 HSE_STATUS_SUCCESS = 1 HSE_STATUS_SUCCESS_AND_KEEP_CONN = 2 HSE_STATUS_PENDING = 3 HSE_STATUS_ERROR = 4 SF_NOTIFY_SECURE_PORT = 0x00000001 SF_NOTIFY_NONSECURE_PORT = 0x00000002 SF_NOTIFY_READ_RAW_DATA = 0x00008000 SF_NOTIFY_PREPROC_HEADERS = 0x00004000 SF_NOTIFY_AUTHENTICATION = 0x00002000 SF_NOTIFY_URL_MAP = 0x00001000 SF_NOTIFY_ACCESS_DENIED = 0x00000800 SF_NOTIFY_SEND_RESPONSE = 0x00000040 SF_NOTIFY_SEND_RAW_DATA = 0x00000400 SF_NOTIFY_LOG = 0x00000200 SF_NOTIFY_END_OF_REQUEST = 0x00000080 SF_NOTIFY_END_OF_NET_SESSION = 0x00000100 SF_NOTIFY_ORDER_HIGH = 0x00080000 SF_NOTIFY_ORDER_MEDIUM = 0x00040000 SF_NOTIFY_ORDER_LOW = 0x00020000 SF_NOTIFY_ORDER_DEFAULT = SF_NOTIFY_ORDER_LOW SF_NOTIFY_ORDER_MASK = (SF_NOTIFY_ORDER_HIGH | \ SF_NOTIFY_ORDER_MEDIUM | \ SF_NOTIFY_ORDER_LOW) SF_STATUS_REQ_FINISHED = 134217728 # 0x8000000 SF_STATUS_REQ_FINISHED_KEEP_CONN = 134217728 + 1 SF_STATUS_REQ_NEXT_NOTIFICATION = 134217728 + 2 SF_STATUS_REQ_HANDLED_NOTIFICATION = 134217728 + 3 SF_STATUS_REQ_ERROR = 134217728 + 4 SF_STATUS_REQ_READ_NEXT = 134217728 + 5 HSE_IO_SYNC = 0x00000001 # for WriteClient HSE_IO_ASYNC = 0x00000002 # for WriteClient/TF/EU HSE_IO_DISCONNECT_AFTER_SEND = 0x00000004 # for TF HSE_IO_SEND_HEADERS = 0x00000008 # for TF HSE_IO_NODELAY = 0x00001000 # turn off nagling # These two are only used by VectorSend HSE_IO_FINAL_SEND = 0x00000010 HSE_IO_CACHE_RESPONSE = 0x00000020 HSE_EXEC_URL_NO_HEADERS = 0x02 HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR = 0x04 HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE = 0x10 HSE_EXEC_URL_DISABLE_CUSTOM_ERROR = 0x20 HSE_EXEC_URL_SSI_CMD = 0x40 HSE_EXEC_URL_HTTP_CACHE_ELIGIBLE = 0x80
"""Constants needed by ISAPI filters and extensions.""" http_continue = 100 http_switching_protocols = 101 http_processing = 102 http_ok = 200 http_created = 201 http_accepted = 202 http_non_authoritative = 203 http_no_content = 204 http_reset_content = 205 http_partial_content = 206 http_multi_status = 207 http_multiple_choices = 300 http_moved_permanently = 301 http_moved_temporarily = 302 http_see_other = 303 http_not_modified = 304 http_use_proxy = 305 http_temporary_redirect = 307 http_bad_request = 400 http_unauthorized = 401 http_payment_required = 402 http_forbidden = 403 http_not_found = 404 http_method_not_allowed = 405 http_not_acceptable = 406 http_proxy_authentication_required = 407 http_request_time_out = 408 http_conflict = 409 http_gone = 410 http_length_required = 411 http_precondition_failed = 412 http_request_entity_too_large = 413 http_request_uri_too_large = 414 http_unsupported_media_type = 415 http_range_not_satisfiable = 416 http_expectation_failed = 417 http_unprocessable_entity = 422 http_internal_server_error = 500 http_not_implemented = 501 http_bad_gateway = 502 http_service_unavailable = 503 http_gateway_time_out = 504 http_version_not_supported = 505 http_variant_also_varies = 506 hse_status_success = 1 hse_status_success_and_keep_conn = 2 hse_status_pending = 3 hse_status_error = 4 sf_notify_secure_port = 1 sf_notify_nonsecure_port = 2 sf_notify_read_raw_data = 32768 sf_notify_preproc_headers = 16384 sf_notify_authentication = 8192 sf_notify_url_map = 4096 sf_notify_access_denied = 2048 sf_notify_send_response = 64 sf_notify_send_raw_data = 1024 sf_notify_log = 512 sf_notify_end_of_request = 128 sf_notify_end_of_net_session = 256 sf_notify_order_high = 524288 sf_notify_order_medium = 262144 sf_notify_order_low = 131072 sf_notify_order_default = SF_NOTIFY_ORDER_LOW sf_notify_order_mask = SF_NOTIFY_ORDER_HIGH | SF_NOTIFY_ORDER_MEDIUM | SF_NOTIFY_ORDER_LOW sf_status_req_finished = 134217728 sf_status_req_finished_keep_conn = 134217728 + 1 sf_status_req_next_notification = 134217728 + 2 sf_status_req_handled_notification = 134217728 + 3 sf_status_req_error = 134217728 + 4 sf_status_req_read_next = 134217728 + 5 hse_io_sync = 1 hse_io_async = 2 hse_io_disconnect_after_send = 4 hse_io_send_headers = 8 hse_io_nodelay = 4096 hse_io_final_send = 16 hse_io_cache_response = 32 hse_exec_url_no_headers = 2 hse_exec_url_ignore_current_interceptor = 4 hse_exec_url_ignore_validation_and_range = 16 hse_exec_url_disable_custom_error = 32 hse_exec_url_ssi_cmd = 64 hse_exec_url_http_cache_eligible = 128
# There's no logic or real code here... just data. You need to add some code to # the test! alice_name = "Alice" alice_age = 20 alice_is_drinking = True bob_name = "Bob" bob_age = 12 bob_is_drinking = False charles_name = "Charles" charles_age = 22 charles_is_drinking = True
alice_name = 'Alice' alice_age = 20 alice_is_drinking = True bob_name = 'Bob' bob_age = 12 bob_is_drinking = False charles_name = 'Charles' charles_age = 22 charles_is_drinking = True
def test_role_check(test_role): test_role = test_role.refresh() assert test_role.id assert test_role.slug == "test" def test_role_update(test_role): assert test_role.slug == "test" test_role.slug = "test1" test_role.save() assert test_role.refresh().slug == "test1"
def test_role_check(test_role): test_role = test_role.refresh() assert test_role.id assert test_role.slug == 'test' def test_role_update(test_role): assert test_role.slug == 'test' test_role.slug = 'test1' test_role.save() assert test_role.refresh().slug == 'test1'
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None # Solution 1 class Solution(object): def inorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ stack, result = [], [] currentNode = root while currentNode is not None or len(stack) > 0: while currentNode is not None: stack.append(currentNode) currentNode = currentNode.left currentNode = stack.pop() result.append(currentNode.val) currentNode = currentNode.right return result # Solution 2 class Solution(object): def inorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ stack, result = [], [] currentNode = root while currentNode is not None or len(stack) > 0: if currentNode is not None: stack.append(currentNode) currentNode = currentNode.left else: currentNode = stack.pop() result.append(currentNode.val) currentNode = currentNode.right return result
class Solution(object): def inorder_traversal(self, root): """ :type root: TreeNode :rtype: List[int] """ (stack, result) = ([], []) current_node = root while currentNode is not None or len(stack) > 0: while currentNode is not None: stack.append(currentNode) current_node = currentNode.left current_node = stack.pop() result.append(currentNode.val) current_node = currentNode.right return result class Solution(object): def inorder_traversal(self, root): """ :type root: TreeNode :rtype: List[int] """ (stack, result) = ([], []) current_node = root while currentNode is not None or len(stack) > 0: if currentNode is not None: stack.append(currentNode) current_node = currentNode.left else: current_node = stack.pop() result.append(currentNode.val) current_node = currentNode.right return result
# Couchbase metrics list couchbase_metrics = { 'cluster': { 'url': '/pools/default/', 'metrics': [ {'name':'storageTotals.ram.total','id':'storageTotals.ram.total','suffix':'bytes','labels':['name']}, {'name':'storageTotals.ram.used','id':'storageTotals.ram.used','suffix':'bytes','labels':['name']}, {'name':'storageTotals.ram.usedByData','id':'storageTotals.ram.usedByData','suffix':'bytes','labels':['name']}, {'name':'storageTotals.ram.quotaTotal','id':'storageTotals.ram.quotaTotal','suffix':'bytes','labels':['name']}, {'name':'storageTotals.ram.quotaUsed','id':'storageTotals.ram.quotaUsed','suffix':'bytes','labels':['name']}, {'name':'storageTotals.ram.quotaUsedPerNode','id':'storageTotals.ram.quotaUsedPerNode','suffix':'bytes','labels':['name']}, {'name':'storageTotals.ram.quotaTotalPerNode','id':'storageTotals.ram.quotaTotalPerNode','suffix':'bytes','labels':['name']}, {'name':'storageTotals.hdd.total','id':'storageTotals.hdd.total','suffix':'bytes','labels':['name']}, {'name':'storageTotals.hdd.used','id':'storageTotals.hdd.used','suffix':'bytes','labels':['name']}, {'name':'storageTotals.hdd.usedByData','id':'storageTotals.hdd.usedByData','suffix':'bytes','labels':['name']}, {'name':'storageTotals.hdd.quotaTotal','id':'storageTotals.hdd.quotaTotal','suffix':'bytes','labels':['name']}, {'name':'storageTotals.hdd.free','id':'storageTotals.hdd.free','suffix':'bytes','labels':['name']}, {'name':'storageTotals.hdd.quotaUsed','id':'storageTotals.hdd.quotaUsed','suffix':'bytes','labels':['name']}, {'name':'storageTotals.hdd.quotaUsedPerNode','id':'storageTotals.hdd.quotaUsedPerNode','suffix':'bytes','labels':['name']}, {'name':'storageTotals.hdd.quotaTotalPerNode','id':'storageTotals.hdd.quotaTotalPerNode','suffix':'bytes','labels':['name']}, {'name':'counters.rebalance_success','id':'counters.rebalance_success','suffix':'count','labels':['name']}, {'name':'counters.rebalance_start','id':'counters.rebalance_start','suffix':'count','labels':['name']}, {'name':'counters.rebalance_fail','id':'counters.rebalance_fail','suffix':'count','labels':['name']}, {'name':'counters.rebalance_node','id':'counters.rebalance_node','suffix':'count','labels':['name']} ] }, 'nodes': { 'url': '/pools/nodes/', 'metrics': [ {'name':'systemStats.cpu_utilization_rate','id':'systemStats.cpu_utilization_rate','suffix':'percent','labels':['name','hostname']}, {'name':'systemStats.swap_total','id':'systemStats.swap_total','suffix':'bytes','labels':['name','hostname']}, {'name':'systemStats.swap_used','id':'systemStats.swap_used','suffix':'bytes','labels':['name','hostname']}, {'name':'systemStats.mem_total','id':'systemStats.mem_total','suffix':'bytes','labels':['name','hostname']}, {'name':'systemStats.mem_free','id':'systemStats.mem_free','suffix':'bytes','labels':['name','hostname']}, {'name':'interestingStats.couch_docs_actual_disk_size','id':'interestingStats.couch_docs_actual_disk_size','suffix':'bytes','labels':['name','hostname']}, {'name':'interestingStats.couch_docs_data_size','id':'interestingStats.couch_docs_data_size','suffix':'bytes','labels':['name','hostname']}, {'name':'interestingStats.couch_views_actual_disk_size','id':'interestingStats.couch_views_actual_disk_size','suffix':'bytes','labels':['name','hostname']}, {'name':'interestingStats.couch_views_data_size','id':'interestingStats.couch_views_data_size','suffix':'bytes','labels':['name','hostname']}, {'name':'interestingStats.mem_used','id':'interestingStats.mem_used','suffix':'bytes','labels':['name','hostname']}, {'name':'interestingStats.ops','id':'interestingStats.ops','suffix':'count','labels':['name','hostname']}, {'name':'interestingStats.curr_items','id':'interestingStats.curr_items','suffix':'count','labels':['name','hostname']}, {'name':'interestingStats.curr_items_tot','id':'interestingStats.curr_items_tot','suffix':'count','labels':['name','hostname']}, {'name':'interestingStats.vb_replica_curr_items','id':'interestingStats.vb_replica_curr_items','suffix':'count','labels':['name','hostname']}, {'name':'interestingStats.couch_spatial_disk_size','id':'interestingStats.couch_spatial_disk_size','suffix':'bytes','labels':['name','hostname']}, {'name':'interestingStats.couch_spatial_data_size','id':'interestingStats.couch_spatial_data_size','suffix':'bytes','labels':['name','hostname']}, {'name':'interestingStats.cmd_get','id':'interestingStats.cmd_get','suffix':'count','labels':['name','hostname']}, {'name':'interestingStats.get_hits','id':'interestingStats.get_hits','suffix':'count','labels':['name','hostname']}, {'name':'interestingStats.ep_bg_fetched','id':'interestingStats.ep_bg_fetched','suffix':'count','labels':['name','hostname']} ] }, 'buckets': { 'url': '/pools/default/buckets/', 'metrics': [ {'name':'basicStats.quotaPercentUsed','id':'basicStats.quotaPercentUsed','suffix':'percent','labels':['name','bucket']}, {'name':'basicStats.opsPerSec','id':'basicStats.opsPerSec','suffix':'count','labels':['name','bucket']}, {'name':'basicStats.diskFetches','id':'basicStats.diskFetches','suffix':'percent','labels':['name','bucket']}, {'name':'basicStats.itemCount','id':'basicStats.itemCount','suffix':'percent','labels':['name','bucket']}, {'name':'basicStats.diskUsed','id':'basicStats.diskUsed','suffix':'bytes','labels':['name','bucket']}, {'name':'basicStats.dataUsed','id':'basicStats.dataUsed','suffix':'bytes','labels':['name','bucket']}, {'name':'basicStats.memUsed','id':'basicStats.memUsed','suffix':'bytes','labels':['name','bucket']} ], 'bucket_stats': [ {'name':'avg_bg_wait_time','id':'avg_bg_wait_time','suffix':'seconds','labels':['name','bucket']}, {'name':'avg_disk_commit_time','id':'avg_disk_commit_time','suffix':'seconds','labels':['name','bucket']}, {'name':'avg_disk_update_time','id':'avg_disk_update_time','suffix':'seconds','labels':['name','bucket']}, {'name':'bg_wait_count','id':'bg_wait_count','suffix':'count','labels':['name','bucket']}, {'name':'bg_wait_total','id':'bg_wait_total','suffix':'count','labels':['name','bucket']}, {'name':'bytes_read','id':'bytes_read','suffix':'bytes','labels':['name','bucket']}, {'name':'bytes_written','id':'bytes_written','suffix':'bytes','labels':['name','bucket']}, {'name':'cas_badval','id':'cas_badval','suffix':'count','labels':['name','bucket']}, {'name':'cas_hits','id':'cas_hits','suffix':'count','labels':['name','bucket']}, {'name':'cas_misses','id':'cas_misses','suffix':'count','labels':['name','bucket']}, {'name':'cmd_get','id':'cmd_get','suffix':'count','labels':['name','bucket']}, {'name':'cmd_set','id':'cmd_set','suffix':'count','labels':['name','bucket']}, {'name':'couch_docs_data_size','id':'couch_docs_data_size','suffix':'bytes','labels':['name','bucket']}, {'name':'couch_docs_disk_size','id':'couch_docs_disk_size','suffix':'bytes','labels':['name','bucket']}, {'name':'cpu_idle_ms','id':'cpu_idle_ms','suffix':'milliseconds','labels':['name','bucket']}, {'name':'cpu_local_ms','id':'cpu_local_ms','suffix':'milliseconds','labels':['name','bucket']}, {'name':'cpu_utilization_rate','id':'cpu_utilization_rate','suffix':'percent','labels':['name','bucket']}, {'name':'curr_connections','id':'curr_connections','suffix':'count','labels':['name','bucket']}, {'name':'curr_items','id':'curr_items','suffix':'count','labels':['name','bucket']}, {'name':'curr_items_tot','id':'curr_items_tot','suffix':'count','labels':['name','bucket']}, {'name':'decr_hits','id':'decr_hits','suffix':'count','labels':['name','bucket']}, {'name':'decr_misses','id':'decr_misses','suffix':'count','labels':['name','bucket']}, {'name':'delete_hits','id':'delete_hits','suffix':'count','labels':['name','bucket']}, {'name':'delete_misses','id':'delete_misses','suffix':'count','labels':['name','bucket']}, {'name':'disk_commit_count','id':'disk_commit_count','suffix':'count','labels':['name','bucket']}, {'name':'disk_commit_total','id':'disk_commit_total','suffix':'count','labels':['name','bucket']}, {'name':'disk_update_count','id':'disk_update_count','suffix':'count','labels':['name','bucket']}, {'name':'disk_update_total','id':'disk_update_total','suffix':'count','labels':['name','bucket']}, {'name':'disk_write_queue','id':'disk_write_queue','suffix':'count','labels':['name','bucket']}, {'name':'ep_bg_fetched','id':'ep_bg_fetched','suffix':'fetches/second','labels':['name','bucket']}, {'name':'ep_cache_miss_rate','id':'ep_cache_miss_rate','suffix':'percent','labels':['name','bucket']}, {'name':'ep_dcp_2i_backoff','id':'ep_dcp_2i_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_2i_count','id':'ep_dcp_2i_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_2i_items_remaining','id':'ep_dcp_2i_items_remaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_2i_items_sent','id':'ep_dcp_2i_items_sent','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_2i_producer_count','id':'ep_dcp_2i_producer_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_2i_total_backlog_size','id':'ep_dcp_2i_total_backlog_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_2i_total_bytes','id':'ep_dcp_2i_total_bytes','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_other_backoff','id':'ep_dcp_other_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_other_count','id':'ep_dcp_other_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_other_items_remaining','id':'ep_dcp_other_items_remaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_other_items_sent','id':'ep_dcp_other_items_sent','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_other_producer_count','id':'ep_dcp_other_producer_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_other_total_backlog_size','id':'ep_dcp_other_total_backlog_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_other_total_bytes','id':'ep_dcp_other_total_bytes','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_replica_backoff','id':'ep_dcp_replica_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_replica_count','id':'ep_dcp_replica_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_replica_items_remaining','id':'ep_dcp_replica_items_remaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_replica_items_sent','id':'ep_dcp_replica_items_sent','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_replica_producer_count','id':'ep_dcp_replica_producer_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_replica_total_backlog_size','id':'ep_dcp_replica_total_backlog_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_replica_total_bytes','id':'ep_dcp_replica_total_bytes','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_views_backoff','id':'ep_dcp_views_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_views_count','id':'ep_dcp_views_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_views_items_remaining','id':'ep_dcp_views_items_remaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_views_items_sent','id':'ep_dcp_views_items_sent','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_views_producer_count','id':'ep_dcp_views_producer_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_views_total_backlog_size','id':'ep_dcp_views_total_backlog_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_views_total_bytes','id':'ep_dcp_views_total_bytes','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_xdcr_backoff','id':'ep_dcp_xdcr_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_xdcr_count','id':'ep_dcp_xdcr_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_xdcr_items_remaining','id':'ep_dcp_xdcr_items_remaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_xdcr_items_sent','id':'ep_dcp_xdcr_items_sent','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_xdcr_producer_count','id':'ep_dcp_xdcr_producer_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_xdcr_total_backlog_size','id':'ep_dcp_xdcr_total_backlog_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_dcp_xdcr_total_bytes','id':'ep_dcp_xdcr_total_bytes','suffix':'NA','labels':['name','bucket']}, {'name':'ep_diskqueue_drain','id':'ep_diskqueue_drain','suffix':'count','labels':['name','bucket']}, {'name':'ep_diskqueue_fill','id':'ep_diskqueue_fill','suffix':'count','labels':['name','bucket']}, {'name':'ep_diskqueue_items','id':'ep_diskqueue_items','suffix':'NA','labels':['name','bucket']}, {'name':'ep_flusher_todo','id':'ep_flusher_todo','suffix':'count','labels':['name','bucket']}, {'name':'ep_item_commit_failed','id':'ep_item_commit_failed','suffix':'count','labels':['name','bucket']}, {'name':'ep_kv_size','id':'ep_kv_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_max_size','id':'ep_max_size','suffix':'bytes','labels':['name','bucket']}, {'name':'ep_mem_high_wat','id':'ep_mem_high_wat','suffix':'bytes','labels':['name','bucket']}, {'name':'ep_mem_low_wat','id':'ep_mem_low_wat','suffix':'bytes','labels':['name','bucket']}, {'name':'ep_meta_data_memory','id':'ep_meta_data_memory','suffix':'NA','labels':['name','bucket']}, {'name':'ep_num_non_resident','id':'ep_num_non_resident','suffix':'count','labels':['name','bucket']}, {'name':'ep_num_ops_del_meta','id':'ep_num_ops_del_meta','suffix':'NA','labels':['name','bucket']}, {'name':'ep_num_ops_del_ret_meta','id':'ep_num_ops_del_ret_meta','suffix':'NA','labels':['name','bucket']}, {'name':'ep_num_ops_get_meta','id':'ep_num_ops_get_meta','suffix':'NA','labels':['name','bucket']}, {'name':'ep_num_ops_set_meta','id':'ep_num_ops_set_meta','suffix':'NA','labels':['name','bucket']}, {'name':'ep_num_ops_set_ret_meta','id':'ep_num_ops_set_ret_meta','suffix':'NA','labels':['name','bucket']}, {'name':'ep_num_value_ejects','id':'ep_num_value_ejects','suffix':'count','labels':['name','bucket']}, {'name':'ep_oom_errors','id':'ep_oom_errors','suffix':'count','labels':['name','bucket']}, {'name':'ep_ops_create','id':'ep_ops_create','suffix':'count','labels':['name','bucket']}, {'name':'ep_ops_update','id':'ep_ops_update','suffix':'count','labels':['name','bucket']}, {'name':'ep_overhead','id':'ep_overhead','suffix':'bytes','labels':['name','bucket']}, {'name':'ep_queue_size','id':'ep_queue_size','suffix':'count','labels':['name','bucket']}, {'name':'ep_resident_items_rate','id':'ep_resident_items_rate','suffix':'count','labels':['name','bucket']}, {'name':'ep_tap_rebalance_count','id':'ep_tap_rebalance_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_rebalance_qlen','id':'ep_tap_rebalance_qlen','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_rebalance_queue_backfillremaining','id':'ep_tap_rebalance_queue_backfillremaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_rebalance_queue_backoff','id':'ep_tap_rebalance_queue_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_rebalance_queue_drain','id':'ep_tap_rebalance_queue_drain','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_rebalance_queue_fill','id':'ep_tap_rebalance_queue_fill','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_rebalance_queue_itemondisk','id':'ep_tap_rebalance_queue_itemondisk','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_rebalance_total_backlog_size','id':'ep_tap_rebalance_total_backlog_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_replica_count','id':'ep_tap_replica_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_replica_qlen','id':'ep_tap_replica_qlen','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_replica_queue_backfillremaining','id':'ep_tap_replica_queue_backfillremaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_replica_queue_backoff','id':'ep_tap_replica_queue_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_replica_queue_drain','id':'ep_tap_replica_queue_drain','suffix':'count','labels':['name','bucket']}, {'name':'ep_tap_replica_queue_fill','id':'ep_tap_replica_queue_fill','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_replica_queue_itemondisk','id':'ep_tap_replica_queue_itemondisk','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_replica_total_backlog_size','id':'ep_tap_replica_total_backlog_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_total_count','id':'ep_tap_total_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_total_qlen','id':'ep_tap_total_qlen','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_total_queue_backfillremaining','id':'ep_tap_total_queue_backfillremaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_total_queue_backoff','id':'ep_tap_total_queue_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_total_queue_drain','id':'ep_tap_total_queue_drain','suffix':'count','labels':['name','bucket']}, {'name':'ep_tap_total_queue_fill','id':'ep_tap_total_queue_fill','suffix':'count','labels':['name','bucket']}, {'name':'ep_tap_total_queue_itemondisk','id':'ep_tap_total_queue_itemondisk','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_total_total_backlog_size','id':'ep_tap_total_total_backlog_size','suffix':'count','labels':['name','bucket']}, {'name':'ep_tap_user_count','id':'ep_tap_user_count','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_user_qlen','id':'ep_tap_user_qlen','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_user_queue_backfillremaining','id':'ep_tap_user_queue_backfillremaining','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_user_queue_backoff','id':'ep_tap_user_queue_backoff','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_user_queue_drain','id':'ep_tap_user_queue_drain','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_user_queue_fill','id':'ep_tap_user_queue_fill','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_user_queue_itemondisk','id':'ep_tap_user_queue_itemondisk','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tap_user_total_backlog_size','id':'ep_tap_user_total_backlog_size','suffix':'NA','labels':['name','bucket']}, {'name':'ep_tmp_oom_errors','id':'ep_tmp_oom_errors','suffix':'count','labels':['name','bucket']}, {'name':'ep_vb_total','id':'ep_vb_total','suffix':'NA','labels':['name','bucket']}, {'name':'evictions','id':'evictions','suffix':'count','labels':['name','bucket']}, {'name':'get_hits','id':'get_hits','suffix':'count','labels':['name','bucket']}, {'name':'get_misses','id':'get_misses','suffix':'count','labels':['name','bucket']}, {'name':'hibernated_requests','id':'hibernated_requests','suffix':'NA','labels':['name','bucket']}, {'name':'hibernated_waked','id':'hibernated_waked','suffix':'NA','labels':['name','bucket']}, {'name':'hit_ratio','id':'hit_ratio','suffix':'percent','labels':['name','bucket']}, {'name':'incr_hits','id':'incr_hits','suffix':'count','labels':['name','bucket']}, {'name':'incr_misses','id':'incr_misses','suffix':'count','labels':['name','bucket']}, {'name':'mem_actual_free','id':'mem_actual_free','suffix':'NA','labels':['name','bucket']}, {'name':'mem_actual_used','id':'mem_actual_used','suffix':'NA','labels':['name','bucket']}, {'name':'mem_free','id':'mem_free','suffix':'bytes','labels':['name','bucket']}, {'name':'mem_total','id':'mem_total','suffix':'bytes','labels':['name','bucket']}, {'name':'mem_used','id':'mem_used','suffix':'bytes','labels':['name','bucket']}, {'name':'mem_used_sys','id':'mem_used_sys','suffix':'bytes','labels':['name','bucket']}, {'name':'misses','id':'misses','suffix':'count','labels':['name','bucket']}, {'name':'ops','id':'ops','suffix':'count','labels':['name','bucket']}, {'name':'rest_requests','id':'rest_requests','suffix':'NA','labels':['name','bucket']}, {'name':'swap_total','id':'swap_total','suffix':'NA','labels':['name','bucket']}, {'name':'swap_used','id':'swap_used','suffix':'NA','labels':['name','bucket']}, {'name':'timestamp','id':'timestamp','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_eject','id':'vb_active_eject','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_itm_memory','id':'vb_active_itm_memory','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_meta_data_memory','id':'vb_active_meta_data_memory','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_num','id':'vb_active_num','suffix':'count','labels':['name','bucket']}, {'name':'vb_active_num_non_resident','id':'vb_active_num_non_resident','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_ops_create','id':'vb_active_ops_create','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_ops_update','id':'vb_active_ops_update','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_queue_age','id':'vb_active_queue_age','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_queue_drain','id':'vb_active_queue_drain','suffix':'count','labels':['name','bucket']}, {'name':'vb_active_queue_fill','id':'vb_active_queue_fill','suffix':'NA','labels':['name','bucket']}, {'name':'vb_active_queue_size','id':'vb_active_queue_size','suffix':'count','labels':['name','bucket']}, {'name':'vb_active_resident_items_ratio','id':'vb_active_resident_items_ratio','suffix':'count','labels':['name','bucket']}, {'name':'vb_avg_active_queue_age','id':'vb_avg_active_queue_age','suffix':'NA','labels':['name','bucket']}, {'name':'vb_avg_pending_queue_age','id':'vb_avg_pending_queue_age','suffix':'NA','labels':['name','bucket']}, {'name':'vb_avg_replica_queue_age','id':'vb_avg_replica_queue_age','suffix':'NA','labels':['name','bucket']}, {'name':'vb_avg_total_queue_age','id':'vb_avg_total_queue_age','suffix':'seconds','labels':['name','bucket']}, {'name':'vb_pending_curr_items','id':'vb_pending_curr_items','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_eject','id':'vb_pending_eject','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_itm_memory','id':'vb_pending_itm_memory','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_meta_data_memory','id':'vb_pending_meta_data_memory','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_num','id':'vb_pending_num','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_num_non_resident','id':'vb_pending_num_non_resident','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_ops_create','id':'vb_pending_ops_create','suffix':'count','labels':['name','bucket']}, {'name':'vb_pending_ops_update','id':'vb_pending_ops_update','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_queue_age','id':'vb_pending_queue_age','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_queue_drain','id':'vb_pending_queue_drain','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_queue_fill','id':'vb_pending_queue_fill','suffix':'count','labels':['name','bucket']}, {'name':'vb_pending_queue_size','id':'vb_pending_queue_size','suffix':'NA','labels':['name','bucket']}, {'name':'vb_pending_resident_items_ratio','id':'vb_pending_resident_items_ratio','suffix':'count','labels':['name','bucket']}, {'name':'vb_replica_curr_items','id':'vb_replica_curr_items','suffix':'count','labels':['name','bucket']}, {'name':'vb_replica_eject','id':'vb_replica_eject','suffix':'NA','labels':['name','bucket']}, {'name':'vb_replica_itm_memory','id':'vb_replica_itm_memory','suffix':'NA','labels':['name','bucket']}, {'name':'vb_replica_meta_data_memory','id':'vb_replica_meta_data_memory','suffix':'bytes','labels':['name','bucket']}, {'name':'vb_replica_num','id':'vb_replica_num','suffix':'bytes','labels':['name','bucket']}, {'name':'vb_replica_num_non_resident','id':'vb_replica_num_non_resident','suffix':'bytes','labels':['name','bucket']}, {'name':'vb_replica_ops_create','id':'vb_replica_ops_create','suffix':'NA','labels':['name','bucket']}, {'name':'vb_replica_ops_update','id':'vb_replica_ops_update','suffix':'NA','labels':['name','bucket']}, {'name':'vb_replica_queue_age','id':'vb_replica_queue_age','suffix':'NA','labels':['name','bucket']}, {'name':'vb_replica_queue_drain','id':'vb_replica_queue_drain','suffix':'NA','labels':['name','bucket']}, {'name':'vb_replica_queue_fill','id':'vb_replica_queue_fill','suffix':'NA','labels':['name','bucket']}, {'name':'vb_replica_queue_size','id':'vb_replica_queue_size','suffix':'count','labels':['name','bucket']}, {'name':'vb_replica_resident_items_ratio','id':'vb_replica_resident_items_ratio','suffix':'count','labels':['name','bucket']}, {'name':'vb_total_queue_age','id':'vb_total_queue_age','suffix':'NA','labels':['name','bucket']}, {'name':'xdc_ops','id':'xdc_ops','suffix':'count','labels':['name','bucket']} ] } } """ Return available metrics :rtype: dictionary """ def get_metrics(): return couchbase_metrics
couchbase_metrics = {'cluster': {'url': '/pools/default/', 'metrics': [{'name': 'storageTotals.ram.total', 'id': 'storageTotals.ram.total', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.ram.used', 'id': 'storageTotals.ram.used', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.ram.usedByData', 'id': 'storageTotals.ram.usedByData', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.ram.quotaTotal', 'id': 'storageTotals.ram.quotaTotal', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.ram.quotaUsed', 'id': 'storageTotals.ram.quotaUsed', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.ram.quotaUsedPerNode', 'id': 'storageTotals.ram.quotaUsedPerNode', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.ram.quotaTotalPerNode', 'id': 'storageTotals.ram.quotaTotalPerNode', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.hdd.total', 'id': 'storageTotals.hdd.total', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.hdd.used', 'id': 'storageTotals.hdd.used', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.hdd.usedByData', 'id': 'storageTotals.hdd.usedByData', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.hdd.quotaTotal', 'id': 'storageTotals.hdd.quotaTotal', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.hdd.free', 'id': 'storageTotals.hdd.free', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.hdd.quotaUsed', 'id': 'storageTotals.hdd.quotaUsed', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.hdd.quotaUsedPerNode', 'id': 'storageTotals.hdd.quotaUsedPerNode', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'storageTotals.hdd.quotaTotalPerNode', 'id': 'storageTotals.hdd.quotaTotalPerNode', 'suffix': 'bytes', 'labels': ['name']}, {'name': 'counters.rebalance_success', 'id': 'counters.rebalance_success', 'suffix': 'count', 'labels': ['name']}, {'name': 'counters.rebalance_start', 'id': 'counters.rebalance_start', 'suffix': 'count', 'labels': ['name']}, {'name': 'counters.rebalance_fail', 'id': 'counters.rebalance_fail', 'suffix': 'count', 'labels': ['name']}, {'name': 'counters.rebalance_node', 'id': 'counters.rebalance_node', 'suffix': 'count', 'labels': ['name']}]}, 'nodes': {'url': '/pools/nodes/', 'metrics': [{'name': 'systemStats.cpu_utilization_rate', 'id': 'systemStats.cpu_utilization_rate', 'suffix': 'percent', 'labels': ['name', 'hostname']}, {'name': 'systemStats.swap_total', 'id': 'systemStats.swap_total', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'systemStats.swap_used', 'id': 'systemStats.swap_used', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'systemStats.mem_total', 'id': 'systemStats.mem_total', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'systemStats.mem_free', 'id': 'systemStats.mem_free', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.couch_docs_actual_disk_size', 'id': 'interestingStats.couch_docs_actual_disk_size', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.couch_docs_data_size', 'id': 'interestingStats.couch_docs_data_size', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.couch_views_actual_disk_size', 'id': 'interestingStats.couch_views_actual_disk_size', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.couch_views_data_size', 'id': 'interestingStats.couch_views_data_size', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.mem_used', 'id': 'interestingStats.mem_used', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.ops', 'id': 'interestingStats.ops', 'suffix': 'count', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.curr_items', 'id': 'interestingStats.curr_items', 'suffix': 'count', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.curr_items_tot', 'id': 'interestingStats.curr_items_tot', 'suffix': 'count', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.vb_replica_curr_items', 'id': 'interestingStats.vb_replica_curr_items', 'suffix': 'count', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.couch_spatial_disk_size', 'id': 'interestingStats.couch_spatial_disk_size', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.couch_spatial_data_size', 'id': 'interestingStats.couch_spatial_data_size', 'suffix': 'bytes', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.cmd_get', 'id': 'interestingStats.cmd_get', 'suffix': 'count', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.get_hits', 'id': 'interestingStats.get_hits', 'suffix': 'count', 'labels': ['name', 'hostname']}, {'name': 'interestingStats.ep_bg_fetched', 'id': 'interestingStats.ep_bg_fetched', 'suffix': 'count', 'labels': ['name', 'hostname']}]}, 'buckets': {'url': '/pools/default/buckets/', 'metrics': [{'name': 'basicStats.quotaPercentUsed', 'id': 'basicStats.quotaPercentUsed', 'suffix': 'percent', 'labels': ['name', 'bucket']}, {'name': 'basicStats.opsPerSec', 'id': 'basicStats.opsPerSec', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'basicStats.diskFetches', 'id': 'basicStats.diskFetches', 'suffix': 'percent', 'labels': ['name', 'bucket']}, {'name': 'basicStats.itemCount', 'id': 'basicStats.itemCount', 'suffix': 'percent', 'labels': ['name', 'bucket']}, {'name': 'basicStats.diskUsed', 'id': 'basicStats.diskUsed', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'basicStats.dataUsed', 'id': 'basicStats.dataUsed', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'basicStats.memUsed', 'id': 'basicStats.memUsed', 'suffix': 'bytes', 'labels': ['name', 'bucket']}], 'bucket_stats': [{'name': 'avg_bg_wait_time', 'id': 'avg_bg_wait_time', 'suffix': 'seconds', 'labels': ['name', 'bucket']}, {'name': 'avg_disk_commit_time', 'id': 'avg_disk_commit_time', 'suffix': 'seconds', 'labels': ['name', 'bucket']}, {'name': 'avg_disk_update_time', 'id': 'avg_disk_update_time', 'suffix': 'seconds', 'labels': ['name', 'bucket']}, {'name': 'bg_wait_count', 'id': 'bg_wait_count', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'bg_wait_total', 'id': 'bg_wait_total', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'bytes_read', 'id': 'bytes_read', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'bytes_written', 'id': 'bytes_written', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'cas_badval', 'id': 'cas_badval', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'cas_hits', 'id': 'cas_hits', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'cas_misses', 'id': 'cas_misses', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'cmd_get', 'id': 'cmd_get', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'cmd_set', 'id': 'cmd_set', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'couch_docs_data_size', 'id': 'couch_docs_data_size', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'couch_docs_disk_size', 'id': 'couch_docs_disk_size', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'cpu_idle_ms', 'id': 'cpu_idle_ms', 'suffix': 'milliseconds', 'labels': ['name', 'bucket']}, {'name': 'cpu_local_ms', 'id': 'cpu_local_ms', 'suffix': 'milliseconds', 'labels': ['name', 'bucket']}, {'name': 'cpu_utilization_rate', 'id': 'cpu_utilization_rate', 'suffix': 'percent', 'labels': ['name', 'bucket']}, {'name': 'curr_connections', 'id': 'curr_connections', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'curr_items', 'id': 'curr_items', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'curr_items_tot', 'id': 'curr_items_tot', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'decr_hits', 'id': 'decr_hits', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'decr_misses', 'id': 'decr_misses', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'delete_hits', 'id': 'delete_hits', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'delete_misses', 'id': 'delete_misses', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'disk_commit_count', 'id': 'disk_commit_count', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'disk_commit_total', 'id': 'disk_commit_total', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'disk_update_count', 'id': 'disk_update_count', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'disk_update_total', 'id': 'disk_update_total', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'disk_write_queue', 'id': 'disk_write_queue', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_bg_fetched', 'id': 'ep_bg_fetched', 'suffix': 'fetches/second', 'labels': ['name', 'bucket']}, {'name': 'ep_cache_miss_rate', 'id': 'ep_cache_miss_rate', 'suffix': 'percent', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_2i_backoff', 'id': 'ep_dcp_2i_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_2i_count', 'id': 'ep_dcp_2i_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_2i_items_remaining', 'id': 'ep_dcp_2i_items_remaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_2i_items_sent', 'id': 'ep_dcp_2i_items_sent', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_2i_producer_count', 'id': 'ep_dcp_2i_producer_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_2i_total_backlog_size', 'id': 'ep_dcp_2i_total_backlog_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_2i_total_bytes', 'id': 'ep_dcp_2i_total_bytes', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_other_backoff', 'id': 'ep_dcp_other_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_other_count', 'id': 'ep_dcp_other_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_other_items_remaining', 'id': 'ep_dcp_other_items_remaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_other_items_sent', 'id': 'ep_dcp_other_items_sent', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_other_producer_count', 'id': 'ep_dcp_other_producer_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_other_total_backlog_size', 'id': 'ep_dcp_other_total_backlog_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_other_total_bytes', 'id': 'ep_dcp_other_total_bytes', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_replica_backoff', 'id': 'ep_dcp_replica_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_replica_count', 'id': 'ep_dcp_replica_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_replica_items_remaining', 'id': 'ep_dcp_replica_items_remaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_replica_items_sent', 'id': 'ep_dcp_replica_items_sent', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_replica_producer_count', 'id': 'ep_dcp_replica_producer_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_replica_total_backlog_size', 'id': 'ep_dcp_replica_total_backlog_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_replica_total_bytes', 'id': 'ep_dcp_replica_total_bytes', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_views_backoff', 'id': 'ep_dcp_views_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_views_count', 'id': 'ep_dcp_views_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_views_items_remaining', 'id': 'ep_dcp_views_items_remaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_views_items_sent', 'id': 'ep_dcp_views_items_sent', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_views_producer_count', 'id': 'ep_dcp_views_producer_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_views_total_backlog_size', 'id': 'ep_dcp_views_total_backlog_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_views_total_bytes', 'id': 'ep_dcp_views_total_bytes', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_xdcr_backoff', 'id': 'ep_dcp_xdcr_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_xdcr_count', 'id': 'ep_dcp_xdcr_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_xdcr_items_remaining', 'id': 'ep_dcp_xdcr_items_remaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_xdcr_items_sent', 'id': 'ep_dcp_xdcr_items_sent', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_xdcr_producer_count', 'id': 'ep_dcp_xdcr_producer_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_xdcr_total_backlog_size', 'id': 'ep_dcp_xdcr_total_backlog_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_dcp_xdcr_total_bytes', 'id': 'ep_dcp_xdcr_total_bytes', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_diskqueue_drain', 'id': 'ep_diskqueue_drain', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_diskqueue_fill', 'id': 'ep_diskqueue_fill', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_diskqueue_items', 'id': 'ep_diskqueue_items', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_flusher_todo', 'id': 'ep_flusher_todo', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_item_commit_failed', 'id': 'ep_item_commit_failed', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_kv_size', 'id': 'ep_kv_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_max_size', 'id': 'ep_max_size', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'ep_mem_high_wat', 'id': 'ep_mem_high_wat', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'ep_mem_low_wat', 'id': 'ep_mem_low_wat', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'ep_meta_data_memory', 'id': 'ep_meta_data_memory', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_num_non_resident', 'id': 'ep_num_non_resident', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_num_ops_del_meta', 'id': 'ep_num_ops_del_meta', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_num_ops_del_ret_meta', 'id': 'ep_num_ops_del_ret_meta', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_num_ops_get_meta', 'id': 'ep_num_ops_get_meta', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_num_ops_set_meta', 'id': 'ep_num_ops_set_meta', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_num_ops_set_ret_meta', 'id': 'ep_num_ops_set_ret_meta', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_num_value_ejects', 'id': 'ep_num_value_ejects', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_oom_errors', 'id': 'ep_oom_errors', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_ops_create', 'id': 'ep_ops_create', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_ops_update', 'id': 'ep_ops_update', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_overhead', 'id': 'ep_overhead', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'ep_queue_size', 'id': 'ep_queue_size', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_resident_items_rate', 'id': 'ep_resident_items_rate', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_rebalance_count', 'id': 'ep_tap_rebalance_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_rebalance_qlen', 'id': 'ep_tap_rebalance_qlen', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_rebalance_queue_backfillremaining', 'id': 'ep_tap_rebalance_queue_backfillremaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_rebalance_queue_backoff', 'id': 'ep_tap_rebalance_queue_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_rebalance_queue_drain', 'id': 'ep_tap_rebalance_queue_drain', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_rebalance_queue_fill', 'id': 'ep_tap_rebalance_queue_fill', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_rebalance_queue_itemondisk', 'id': 'ep_tap_rebalance_queue_itemondisk', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_rebalance_total_backlog_size', 'id': 'ep_tap_rebalance_total_backlog_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_replica_count', 'id': 'ep_tap_replica_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_replica_qlen', 'id': 'ep_tap_replica_qlen', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_replica_queue_backfillremaining', 'id': 'ep_tap_replica_queue_backfillremaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_replica_queue_backoff', 'id': 'ep_tap_replica_queue_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_replica_queue_drain', 'id': 'ep_tap_replica_queue_drain', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_replica_queue_fill', 'id': 'ep_tap_replica_queue_fill', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_replica_queue_itemondisk', 'id': 'ep_tap_replica_queue_itemondisk', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_replica_total_backlog_size', 'id': 'ep_tap_replica_total_backlog_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_total_count', 'id': 'ep_tap_total_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_total_qlen', 'id': 'ep_tap_total_qlen', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_total_queue_backfillremaining', 'id': 'ep_tap_total_queue_backfillremaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_total_queue_backoff', 'id': 'ep_tap_total_queue_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_total_queue_drain', 'id': 'ep_tap_total_queue_drain', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_total_queue_fill', 'id': 'ep_tap_total_queue_fill', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_total_queue_itemondisk', 'id': 'ep_tap_total_queue_itemondisk', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_total_total_backlog_size', 'id': 'ep_tap_total_total_backlog_size', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_user_count', 'id': 'ep_tap_user_count', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_user_qlen', 'id': 'ep_tap_user_qlen', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_user_queue_backfillremaining', 'id': 'ep_tap_user_queue_backfillremaining', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_user_queue_backoff', 'id': 'ep_tap_user_queue_backoff', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_user_queue_drain', 'id': 'ep_tap_user_queue_drain', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_user_queue_fill', 'id': 'ep_tap_user_queue_fill', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_user_queue_itemondisk', 'id': 'ep_tap_user_queue_itemondisk', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tap_user_total_backlog_size', 'id': 'ep_tap_user_total_backlog_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'ep_tmp_oom_errors', 'id': 'ep_tmp_oom_errors', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ep_vb_total', 'id': 'ep_vb_total', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'evictions', 'id': 'evictions', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'get_hits', 'id': 'get_hits', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'get_misses', 'id': 'get_misses', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'hibernated_requests', 'id': 'hibernated_requests', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'hibernated_waked', 'id': 'hibernated_waked', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'hit_ratio', 'id': 'hit_ratio', 'suffix': 'percent', 'labels': ['name', 'bucket']}, {'name': 'incr_hits', 'id': 'incr_hits', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'incr_misses', 'id': 'incr_misses', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'mem_actual_free', 'id': 'mem_actual_free', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'mem_actual_used', 'id': 'mem_actual_used', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'mem_free', 'id': 'mem_free', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'mem_total', 'id': 'mem_total', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'mem_used', 'id': 'mem_used', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'mem_used_sys', 'id': 'mem_used_sys', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'misses', 'id': 'misses', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'ops', 'id': 'ops', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'rest_requests', 'id': 'rest_requests', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'swap_total', 'id': 'swap_total', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'swap_used', 'id': 'swap_used', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'timestamp', 'id': 'timestamp', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_eject', 'id': 'vb_active_eject', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_itm_memory', 'id': 'vb_active_itm_memory', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_meta_data_memory', 'id': 'vb_active_meta_data_memory', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_num', 'id': 'vb_active_num', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_active_num_non_resident', 'id': 'vb_active_num_non_resident', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_ops_create', 'id': 'vb_active_ops_create', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_ops_update', 'id': 'vb_active_ops_update', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_queue_age', 'id': 'vb_active_queue_age', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_queue_drain', 'id': 'vb_active_queue_drain', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_active_queue_fill', 'id': 'vb_active_queue_fill', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_active_queue_size', 'id': 'vb_active_queue_size', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_active_resident_items_ratio', 'id': 'vb_active_resident_items_ratio', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_avg_active_queue_age', 'id': 'vb_avg_active_queue_age', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_avg_pending_queue_age', 'id': 'vb_avg_pending_queue_age', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_avg_replica_queue_age', 'id': 'vb_avg_replica_queue_age', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_avg_total_queue_age', 'id': 'vb_avg_total_queue_age', 'suffix': 'seconds', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_curr_items', 'id': 'vb_pending_curr_items', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_eject', 'id': 'vb_pending_eject', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_itm_memory', 'id': 'vb_pending_itm_memory', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_meta_data_memory', 'id': 'vb_pending_meta_data_memory', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_num', 'id': 'vb_pending_num', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_num_non_resident', 'id': 'vb_pending_num_non_resident', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_ops_create', 'id': 'vb_pending_ops_create', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_ops_update', 'id': 'vb_pending_ops_update', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_queue_age', 'id': 'vb_pending_queue_age', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_queue_drain', 'id': 'vb_pending_queue_drain', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_queue_fill', 'id': 'vb_pending_queue_fill', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_queue_size', 'id': 'vb_pending_queue_size', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_pending_resident_items_ratio', 'id': 'vb_pending_resident_items_ratio', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_curr_items', 'id': 'vb_replica_curr_items', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_eject', 'id': 'vb_replica_eject', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_itm_memory', 'id': 'vb_replica_itm_memory', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_meta_data_memory', 'id': 'vb_replica_meta_data_memory', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_num', 'id': 'vb_replica_num', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_num_non_resident', 'id': 'vb_replica_num_non_resident', 'suffix': 'bytes', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_ops_create', 'id': 'vb_replica_ops_create', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_ops_update', 'id': 'vb_replica_ops_update', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_queue_age', 'id': 'vb_replica_queue_age', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_queue_drain', 'id': 'vb_replica_queue_drain', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_queue_fill', 'id': 'vb_replica_queue_fill', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_queue_size', 'id': 'vb_replica_queue_size', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_replica_resident_items_ratio', 'id': 'vb_replica_resident_items_ratio', 'suffix': 'count', 'labels': ['name', 'bucket']}, {'name': 'vb_total_queue_age', 'id': 'vb_total_queue_age', 'suffix': 'NA', 'labels': ['name', 'bucket']}, {'name': 'xdc_ops', 'id': 'xdc_ops', 'suffix': 'count', 'labels': ['name', 'bucket']}]}} '\n Return available metrics\n :rtype: dictionary\n' def get_metrics(): return couchbase_metrics
# # 12. Integer to Roman # # Roman numerals are represented by seven different symbols: I, V, X, L, C, D, M # # Symbols Value # # I 1 # V 5 # X 10 # L 50 # C 100 # D 500 # M 1000 # # For example, two is written as II in Roman numeral, just two one's added # together. Twelve is written as XII, which is simply X + II. The number twenty # seven is written as XXVII, which is XX + V + II. # # Roman numerals are usually written largest to smallest from left to right. # However, the one is before the five we subtract it making four. The same # principle applies to the number nine, which is written as IX. There are six # instances where substraction is used: # - I can be placed before V and X to make 4 and 9. # - X can be placed before L and C to make 40 and 90. # - C can be placed before D and M to make 400 and 900. # # Given an integer, convert it to a roman numeral. Input is guaranteed to be # within the range from 1 to 3999 # # Example 1: # Input: 3 # Output: "III" # # Example 2: # Input: 4 # Output: "IV" # # Example 3: # Input: 9 # Output: "IX" # # Example 4: # Input: 58 # Output: "LVIII" # # Example 5: # Input: 1994 # Output: "MCMXCIV" # class Solution(object): def intToRoman(self, num): """ :type num: int :rtype: str """ mapping = [ (1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I') ] nums = [] for integer, roman in mapping: while num >= integer: nums.append(roman) num -= integer return ''.join(nums)
class Solution(object): def int_to_roman(self, num): """ :type num: int :rtype: str """ mapping = [(1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I')] nums = [] for (integer, roman) in mapping: while num >= integer: nums.append(roman) num -= integer return ''.join(nums)
# for i in [0, 1, 2, 3, 4, 5]: # print(i) # for j in range(10): # print(j) names = ["Harry", "Ron", "Hermione", "Ginny"] for character in names: print(character)
names = ['Harry', 'Ron', 'Hermione', 'Ginny'] for character in names: print(character)
def _get_parent_index(child_index): if child_index == 0: return None return (child_index - 1) // 2 def _get_left_child_index(parent_index): return parent_index * 2 + 1 def _get_right_child_index(child_index): return child_index * 2 + 2 def _check_min_heap_invariant(min_heap): if min_heap.size == 0: return True storage = min_heap._storage def _check_index_invariant(index): parent_index = index child_index = _get_left_child_index(parent_index) if child_index < min_heap.size: if storage[parent_index] <= storage[child_index]: _check_index_invariant(child_index) else: raise Exception( "Left child ({child}) is smaller than its parent ({parent}) [{storage}]!".format( child=storage[child_index], parent=storage[parent_index], storage=storage )) child_index += 1 if child_index < min_heap.size: if storage[parent_index] <= storage[child_index]: _check_index_invariant(child_index) else: raise Exception( "Right child ({child}) is smaller than its parent ({parent})!".format( child=storage[child_index], parent=storage[parent_index] )) return True return _check_index_invariant(0) class MinHeap(object): def __init__(self, initialization_list=None): self._storage = [] initialization_list = initialization_list or [] for value in initialization_list: self.insert(value) def __str__(self): return str(self._storage) def insert(self, value): """Insert in the heap and return the heap. The value is appended at the end of the list, and then it's 'bubbled up' until it reach its final position.""" self._storage.append(value) current_index = len(self._storage) - 1 parent_index = _get_parent_index(current_index) # Bubble up value. while self._is_index_valid(parent_index) and self._is_less(current_index, parent_index): self._swap(parent_index, current_index) current_index = parent_index parent_index = _get_parent_index(current_index) return self def remove(self): """Remove the min value of the heap and return it. After the top value is removed, the last value of the list is put on its position. Then, the value at the top is pushed down until it finds its final position.""" if self.size == 0: return None # Swap last element with the top. self._swap(0, self.size - 1) removed = self._storage.pop() parent_index = 0 child_index = _get_left_child_index(parent_index) while child_index < self.size: if self._is_index_valid(_get_right_child_index(parent_index)) \ and (self._is_gte(child_index, parent_index) or self._is_less(child_index + 1, child_index)): child_index += 1 if self._is_less(child_index, parent_index): self._swap(child_index, parent_index) parent_index = child_index child_index = _get_left_child_index(parent_index) else: break return removed def peek(self): return self._storage[0] if self.size > 0 else None @property def size(self): return len(self._storage) def _swap(self, origin, source): self._storage[origin], self._storage[source] = self._storage[source], self._storage[origin] def _is_less(self, index1, index2): if index1 >= self.size or index2 >= self.size: raise Exception( "Trying to access an invalid index on the list. " "Index1: {}, index2: {}, list size: {}.".format( index1, index2, self.size ) ) return self._storage[index1] < self._storage[index2] def _is_index_valid(self, index): return False if index is None or index >= self.size else True def _is_gte(self, index1, index2): if index1 >= self.size or index2 >= self.size: raise Exception( "Trying to access an invalid index on the list. " "Index1: {}, index2: {}, list size: {}.".format( index1, index2, self.size ) ) return self._storage[index1] >= self._storage[index2] if __name__ == '__main__': heap = MinHeap([89, 82, -20, 200, 100, 1, 20]) ordered_list = [] while heap.size > 0: removed = heap.remove() ordered_list.append(removed)
def _get_parent_index(child_index): if child_index == 0: return None return (child_index - 1) // 2 def _get_left_child_index(parent_index): return parent_index * 2 + 1 def _get_right_child_index(child_index): return child_index * 2 + 2 def _check_min_heap_invariant(min_heap): if min_heap.size == 0: return True storage = min_heap._storage def _check_index_invariant(index): parent_index = index child_index = _get_left_child_index(parent_index) if child_index < min_heap.size: if storage[parent_index] <= storage[child_index]: _check_index_invariant(child_index) else: raise exception('Left child ({child}) is smaller than its parent ({parent}) [{storage}]!'.format(child=storage[child_index], parent=storage[parent_index], storage=storage)) child_index += 1 if child_index < min_heap.size: if storage[parent_index] <= storage[child_index]: _check_index_invariant(child_index) else: raise exception('Right child ({child}) is smaller than its parent ({parent})!'.format(child=storage[child_index], parent=storage[parent_index])) return True return _check_index_invariant(0) class Minheap(object): def __init__(self, initialization_list=None): self._storage = [] initialization_list = initialization_list or [] for value in initialization_list: self.insert(value) def __str__(self): return str(self._storage) def insert(self, value): """Insert in the heap and return the heap. The value is appended at the end of the list, and then it's 'bubbled up' until it reach its final position.""" self._storage.append(value) current_index = len(self._storage) - 1 parent_index = _get_parent_index(current_index) while self._is_index_valid(parent_index) and self._is_less(current_index, parent_index): self._swap(parent_index, current_index) current_index = parent_index parent_index = _get_parent_index(current_index) return self def remove(self): """Remove the min value of the heap and return it. After the top value is removed, the last value of the list is put on its position. Then, the value at the top is pushed down until it finds its final position.""" if self.size == 0: return None self._swap(0, self.size - 1) removed = self._storage.pop() parent_index = 0 child_index = _get_left_child_index(parent_index) while child_index < self.size: if self._is_index_valid(_get_right_child_index(parent_index)) and (self._is_gte(child_index, parent_index) or self._is_less(child_index + 1, child_index)): child_index += 1 if self._is_less(child_index, parent_index): self._swap(child_index, parent_index) parent_index = child_index child_index = _get_left_child_index(parent_index) else: break return removed def peek(self): return self._storage[0] if self.size > 0 else None @property def size(self): return len(self._storage) def _swap(self, origin, source): (self._storage[origin], self._storage[source]) = (self._storage[source], self._storage[origin]) def _is_less(self, index1, index2): if index1 >= self.size or index2 >= self.size: raise exception('Trying to access an invalid index on the list. Index1: {}, index2: {}, list size: {}.'.format(index1, index2, self.size)) return self._storage[index1] < self._storage[index2] def _is_index_valid(self, index): return False if index is None or index >= self.size else True def _is_gte(self, index1, index2): if index1 >= self.size or index2 >= self.size: raise exception('Trying to access an invalid index on the list. Index1: {}, index2: {}, list size: {}.'.format(index1, index2, self.size)) return self._storage[index1] >= self._storage[index2] if __name__ == '__main__': heap = min_heap([89, 82, -20, 200, 100, 1, 20]) ordered_list = [] while heap.size > 0: removed = heap.remove() ordered_list.append(removed)
class Product(): def __init__(self, requirements: list): self.requirements = [] for r in requirements: self.requirements.append(r.type) class Requirement(): def __init__(self, _type: str, name): self.name = name self.type = _type
class Product: def __init__(self, requirements: list): self.requirements = [] for r in requirements: self.requirements.append(r.type) class Requirement: def __init__(self, _type: str, name): self.name = name self.type = _type
p = 196732205348849427366498732223276547339 secret = 4919 # Solved through brute force that secret = 4919, see sageSecret def calc_root(num, mod, n): #Create a modular ring with mod as the modulus f = GF(mod) # temp = num mod Modulus temp = f(num) #Calculate the nth root temp on this modular field # AKA (returnValue)^n % mod = temp return temp.nth_root(n) def gen_v_list(primelist, p, secret): a = [] for prime in primelist: a.append(calc_root(prime, p, secret)) # A is an array of the secreth root of each prime, mod p return a def decodeInt(i, primelist): pl = sorted(primelist)[::-1] out = '' for j in pl: if i%j == 0: out += '1' else: out += '0' return out def bin2asc(b): return hex(int(b,2)).replace('0x','').decode('hex') primelist = [2,3,5,7,11,13,17,19,23,29,31,37,43,47,53,59] #Split message into 2 char chunks message = REDACTED chunks = [] for i in range(0,len(message),2): chunks += [message[i:i+2]] vlist = gen_v_list(primelist,p,secret) print(vlist) for chunk in chunks: # Encode the 2char chunk into hex # replace all 0b with null # make the thing 16 bits longs # reverse it binarized = bin(int(chunk.encode('hex'),16)).replace('0b','').zfill(16)[::-1] #lsb first enc = 1 for bit in range(len(binarized)): enc *= vlist[bit]**int(binarized[bit]) enc = enc%p print(enc)
p = 196732205348849427366498732223276547339 secret = 4919 def calc_root(num, mod, n): f = gf(mod) temp = f(num) return temp.nth_root(n) def gen_v_list(primelist, p, secret): a = [] for prime in primelist: a.append(calc_root(prime, p, secret)) return a def decode_int(i, primelist): pl = sorted(primelist)[::-1] out = '' for j in pl: if i % j == 0: out += '1' else: out += '0' return out def bin2asc(b): return hex(int(b, 2)).replace('0x', '').decode('hex') primelist = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 43, 47, 53, 59] message = REDACTED chunks = [] for i in range(0, len(message), 2): chunks += [message[i:i + 2]] vlist = gen_v_list(primelist, p, secret) print(vlist) for chunk in chunks: binarized = bin(int(chunk.encode('hex'), 16)).replace('0b', '').zfill(16)[::-1] enc = 1 for bit in range(len(binarized)): enc *= vlist[bit] ** int(binarized[bit]) enc = enc % p print(enc)
n = int(input()) a = list(map(int, input().split())) ss = sum(a) a.sort() if ss%2 == 1: for i in range(0, n): if a[i]%2 == 1: ss -= a[i] break print(ss)
n = int(input()) a = list(map(int, input().split())) ss = sum(a) a.sort() if ss % 2 == 1: for i in range(0, n): if a[i] % 2 == 1: ss -= a[i] break print(ss)
n = input("Enter a binary number to convert to decimal: ") bit_exp = 0 decimals = [] for bit in n[::-1]: if int(bit) == 1: decimals.append(2**bit_exp) bit_exp += 1 decimal = sum(decimals) print(decimals) print(decimal) '''Varigarble -- 2020'''
n = input('Enter a binary number to convert to decimal: ') bit_exp = 0 decimals = [] for bit in n[::-1]: if int(bit) == 1: decimals.append(2 ** bit_exp) bit_exp += 1 decimal = sum(decimals) print(decimals) print(decimal) 'Varigarble -- 2020'
def main(data,n): initial = n dict = {} for i in range(n): dict[data[i]] = True # Check for initial value if data[i]==initial: s = '' while initial in dict: s += str(initial) + ' ' initial -= 1 print(s) else: print(' ') # Function call if __name__=='__main__': n = int(input()) data = list(map(int, input().split())) main(data, n)
def main(data, n): initial = n dict = {} for i in range(n): dict[data[i]] = True if data[i] == initial: s = '' while initial in dict: s += str(initial) + ' ' initial -= 1 print(s) else: print(' ') if __name__ == '__main__': n = int(input()) data = list(map(int, input().split())) main(data, n)
# __init__.py # Version of the turtlefy package __version__ = "0.8.12"
__version__ = '0.8.12'
#enter the celcius temperature to be converted Celcius_temperature = float(input("Enter celcius temperature: ")) #formula for converting celcius temperature to fahrenheit temperature Fahrenheit = (Celcius_temperature * (9/5)) + 32 #printing the fahrenheit temperature print(Fahrenheit)
celcius_temperature = float(input('Enter celcius temperature: ')) fahrenheit = Celcius_temperature * (9 / 5) + 32 print(Fahrenheit)
n=int(input()) matrix=[0]*(n+1) dp=[[[0]*2 for j in range(n+1)] for i in range(n+1)] dp2=[[[0]*2 for j in range(n+1)] for i in range(n+1)] for i in range(1,n+1): matrix[i]=[0] matrix[i].extend([*map(int,input().split())]) ans=0 for i in range(1,n+1): for j in range(1,n+1): dp[i][j][1]=dp2[i][j][1]=matrix[i][j] for i in range(2,n+1): for j in range(i,n+1): for k in range(i,n+1): dp[j][k][i%2]=dp[j-1][k-1][(i-1)%2]+matrix[j][k] dp2[j][k][i%2]=dp2[j-1][k][(i-1)%2]+matrix[j][k-i+1] ans=max(ans,dp[j][k][i%2]-dp2[j][k][i%2]) print(ans)
n = int(input()) matrix = [0] * (n + 1) dp = [[[0] * 2 for j in range(n + 1)] for i in range(n + 1)] dp2 = [[[0] * 2 for j in range(n + 1)] for i in range(n + 1)] for i in range(1, n + 1): matrix[i] = [0] matrix[i].extend([*map(int, input().split())]) ans = 0 for i in range(1, n + 1): for j in range(1, n + 1): dp[i][j][1] = dp2[i][j][1] = matrix[i][j] for i in range(2, n + 1): for j in range(i, n + 1): for k in range(i, n + 1): dp[j][k][i % 2] = dp[j - 1][k - 1][(i - 1) % 2] + matrix[j][k] dp2[j][k][i % 2] = dp2[j - 1][k][(i - 1) % 2] + matrix[j][k - i + 1] ans = max(ans, dp[j][k][i % 2] - dp2[j][k][i % 2]) print(ans)
def readint(): while True: try: num = int(input('Insert a integer:')) if type(num) == int: return num except: print('\033[1;31mERROR: Please, insert a valid integer.\033[m')
def readint(): while True: try: num = int(input('Insert a integer:')) if type(num) == int: return num except: print('\x1b[1;31mERROR: Please, insert a valid integer.\x1b[m')
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Project information ----------------------------------------------------- project = "Fortran Programming Language" copyright = "" author = "" # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ "ablog", "myst_parser", "sphinx_panels", "sphinx.ext.intersphinx", ] # Add any paths that contain templates here, relative to this directory. templates_path = [ "_templates", ] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [ "_build", "Thumbs.db", ".DS_Store", ] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = "pydata_sphinx_theme" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = [ "_static", ] html_css_files = [ "css/custom.css", ] html_theme_options = { "favicons" : [ { "rel": "icon", "href": "images/favicon.ico", }, ], "show_prev_next": False, "page_sidebar_items": [], "nosidebar": True, "footer_items": ["copyright"], # "navbar_align": "left", "navbar_start": ["navbar-logo"], "navbar_center": ["navbar-nav"], "navbar_end": ["navbar-icon-links"], "icon_links": [ { "name": "Discourse", "url": "https://fortran-lang.discourse.group/", "icon": "fab fa-discourse", }, { "name": "Twitter", "url": "https://twitter.com/fortranlang", "icon": "fab fa-twitter", }, { "name": "GitHub", "url": "https://github.com/fortran-lang", "icon": "fab fa-github", }, { "name": "RSS", "url": "https://fortran-lang.org/news.xml", "icon": "fas fa-rss", }, ] } html_sidebars = { "*": [], "learn/**": [], "news/**": ['postcard.html', 'recentposts.html', 'archives.html'] } html_title = "Fortran Programming Language" html_logo = "_static/images/fortran-logo-256x256.png" html_baseurl = "https://awvwgk.github.io/fortran-lang.org/" master_doc = 'index' panels_add_bootstrap_css = False blog_path = "news" blog_post_pattern = "_posts/*/*" post_redirect_refresh = 1 post_auto_image = 1 post_auto_excerpt = 2 def hide_h1_on_index_pages(app, pagename, templatename, context, doctree): if pagename in ["index", "learn", "compilers", "community", "packages"]: app.add_css_file("css/hide_h1.css") def setup(app): app.connect('html-page-context', hide_h1_on_index_pages)
project = 'Fortran Programming Language' copyright = '' author = '' extensions = ['ablog', 'myst_parser', 'sphinx_panels', 'sphinx.ext.intersphinx'] templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] html_theme = 'pydata_sphinx_theme' html_static_path = ['_static'] html_css_files = ['css/custom.css'] html_theme_options = {'favicons': [{'rel': 'icon', 'href': 'images/favicon.ico'}], 'show_prev_next': False, 'page_sidebar_items': [], 'nosidebar': True, 'footer_items': ['copyright'], 'navbar_start': ['navbar-logo'], 'navbar_center': ['navbar-nav'], 'navbar_end': ['navbar-icon-links'], 'icon_links': [{'name': 'Discourse', 'url': 'https://fortran-lang.discourse.group/', 'icon': 'fab fa-discourse'}, {'name': 'Twitter', 'url': 'https://twitter.com/fortranlang', 'icon': 'fab fa-twitter'}, {'name': 'GitHub', 'url': 'https://github.com/fortran-lang', 'icon': 'fab fa-github'}, {'name': 'RSS', 'url': 'https://fortran-lang.org/news.xml', 'icon': 'fas fa-rss'}]} html_sidebars = {'*': [], 'learn/**': [], 'news/**': ['postcard.html', 'recentposts.html', 'archives.html']} html_title = 'Fortran Programming Language' html_logo = '_static/images/fortran-logo-256x256.png' html_baseurl = 'https://awvwgk.github.io/fortran-lang.org/' master_doc = 'index' panels_add_bootstrap_css = False blog_path = 'news' blog_post_pattern = '_posts/*/*' post_redirect_refresh = 1 post_auto_image = 1 post_auto_excerpt = 2 def hide_h1_on_index_pages(app, pagename, templatename, context, doctree): if pagename in ['index', 'learn', 'compilers', 'community', 'packages']: app.add_css_file('css/hide_h1.css') def setup(app): app.connect('html-page-context', hide_h1_on_index_pages)
def tem_bomba_direita(board, position): if position + 1 >= len(board): return False if board[position+1] == "*": return True return False def tem_bomba_esquerda(board, position): if position - 1 < 0: return False if board[position-1] == "*": return True return False def conta_bombas(board, position): cont = 0 if board[position] == "*": return -1 if tem_bomba_direita(board, position): cont += 1 if tem_bomba_esquerda(board, position): cont += 1 return cont def tem_bomba_acima(board, x, y): return True
def tem_bomba_direita(board, position): if position + 1 >= len(board): return False if board[position + 1] == '*': return True return False def tem_bomba_esquerda(board, position): if position - 1 < 0: return False if board[position - 1] == '*': return True return False def conta_bombas(board, position): cont = 0 if board[position] == '*': return -1 if tem_bomba_direita(board, position): cont += 1 if tem_bomba_esquerda(board, position): cont += 1 return cont def tem_bomba_acima(board, x, y): return True
class Error(Exception): """Base class for exceptions in this module.""" pass class UnknownError(Error): def __init__(self, text=''): message = 'An internal error has occurred. Please try your query again at a later time.' if text == '': log_message = 'Unknown error occurred. Perhaps the cause may be a code bug' else: log_message = text Exception.__init__(self, message) self.code = 'InternalError' self.log_message = log_message class StorageServiceError(Error): def __init__(self, param=''): if param == '': message = 'An internal error has occurred. Please try your query again at a later time.' log_message = 'Storage service error has occurred. Please confirm connection to object storage.' else: message = f'Failed to connect external service: {param}' log_message = f'Storage service error has occurred. Failed to connect object storage.: {param}' Exception.__init__(self, message) self.code = 'InternalError' self.log_message = log_message class MissingParameterError(Error): def __init__(self, param=''): if param == '': message = 'Missing parameter error occurred. Please confirm your request parameters.' else: message = f'Missing parameter error occurred. Please confirm your request parameters.: {param}' Exception.__init__(self, message) self.code = 'MissingParameterError' self.log_message = message class InvalidParameterError(Error): def __init__(self, param='', raw=''): if param == '': message = 'Request parameter is invalid. Please confirm your request parameter.' else: message = f'Request parameter is invalid. Please confirm your request parameter [{param}:{raw}]' Exception.__init__(self, message) self.code = 'InvalidParameterError' self.log_message = message class InvalidMethodError(Error): def __init__(self, method=''): if method == '': message = 'Request method is invalid. Please confirm request method.' else: message = f'Request method is invalid. Please confirm request method: {method}' Exception.__init__(self, message) self.code = 'InvalidMethodError' self.log_message = message class InvalidURIError(Error): def __init__(self, uri): message = f'URI is invalid. Please confirm request endpoint: {uri}' Exception.__init__(self, message) self.code = 'InvalidURIError' self.log_message = message class InvalidHeaderError(Error): def __init__(self, param=''): if param == '': message = 'Request headers are invalid. Please confirm your request header.' else: message = f'Request headers are invalid. Please confirm your request header: {param}' Exception.__init__(self, message) self.code = 'InvalidHeaderError' self.log_message = message class InvalidDataError(Error): def __init__(self, data_name=''): if data_name == '': message = 'Failed to execute the process which is used user data source.' else: message = f'Failed to execute the process which is used user data source: {data_name}' Exception.__init__(self, message) self.code = 'InvalidDataError' self.log_message = message class NotFoundError(Error): def __init__(self, param='', raw=''): if param == '': message = 'A resource with specified parameter has been not found.' else: message = f'A {param} with specified parameter = {raw} has been not found.' Exception.__init__(self, message) self.code = 'NotFoundError' self.log_message = message class ProcessTimeoutError(Error): def __init__(self): message = 'Time out error occurred.' Exception.__init__(self, message) self.code = 'TimeoutError' self.log_message = message
class Error(Exception): """Base class for exceptions in this module.""" pass class Unknownerror(Error): def __init__(self, text=''): message = 'An internal error has occurred. Please try your query again at a later time.' if text == '': log_message = 'Unknown error occurred. Perhaps the cause may be a code bug' else: log_message = text Exception.__init__(self, message) self.code = 'InternalError' self.log_message = log_message class Storageserviceerror(Error): def __init__(self, param=''): if param == '': message = 'An internal error has occurred. Please try your query again at a later time.' log_message = 'Storage service error has occurred. Please confirm connection to object storage.' else: message = f'Failed to connect external service: {param}' log_message = f'Storage service error has occurred. Failed to connect object storage.: {param}' Exception.__init__(self, message) self.code = 'InternalError' self.log_message = log_message class Missingparametererror(Error): def __init__(self, param=''): if param == '': message = 'Missing parameter error occurred. Please confirm your request parameters.' else: message = f'Missing parameter error occurred. Please confirm your request parameters.: {param}' Exception.__init__(self, message) self.code = 'MissingParameterError' self.log_message = message class Invalidparametererror(Error): def __init__(self, param='', raw=''): if param == '': message = 'Request parameter is invalid. Please confirm your request parameter.' else: message = f'Request parameter is invalid. Please confirm your request parameter [{param}:{raw}]' Exception.__init__(self, message) self.code = 'InvalidParameterError' self.log_message = message class Invalidmethoderror(Error): def __init__(self, method=''): if method == '': message = 'Request method is invalid. Please confirm request method.' else: message = f'Request method is invalid. Please confirm request method: {method}' Exception.__init__(self, message) self.code = 'InvalidMethodError' self.log_message = message class Invalidurierror(Error): def __init__(self, uri): message = f'URI is invalid. Please confirm request endpoint: {uri}' Exception.__init__(self, message) self.code = 'InvalidURIError' self.log_message = message class Invalidheadererror(Error): def __init__(self, param=''): if param == '': message = 'Request headers are invalid. Please confirm your request header.' else: message = f'Request headers are invalid. Please confirm your request header: {param}' Exception.__init__(self, message) self.code = 'InvalidHeaderError' self.log_message = message class Invaliddataerror(Error): def __init__(self, data_name=''): if data_name == '': message = 'Failed to execute the process which is used user data source.' else: message = f'Failed to execute the process which is used user data source: {data_name}' Exception.__init__(self, message) self.code = 'InvalidDataError' self.log_message = message class Notfounderror(Error): def __init__(self, param='', raw=''): if param == '': message = 'A resource with specified parameter has been not found.' else: message = f'A {param} with specified parameter = {raw} has been not found.' Exception.__init__(self, message) self.code = 'NotFoundError' self.log_message = message class Processtimeouterror(Error): def __init__(self): message = 'Time out error occurred.' Exception.__init__(self, message) self.code = 'TimeoutError' self.log_message = message
i01.integratedMovement.removeObject("pole") i01.integratedMovement.removeAi("kinect",i01.integratedMovement.Ai.AVOID_COLLISION) i01.rest() sleep(3) i01.integratedMovement.moveTo("rightArm",-300,500,400) mouth.speakBlocking("Hello, I am vinmoov") sleep(3) i01.rest() mouth.speakBlocking("I want to talk to you about a new myrobotlab service called Integrated Movement") mouth.speakBlocking("With this service, I can move my hand to a point in space by using inverse kinematics") i01.integratedMovement.moveTo("leftArm",500,500,600) mouth.speakBlocking("you don't have to specify how I move each of my joint. You just told me where to move") i01.rest() i01.integratedMovement.addObject(-200,500, -1000,-200,500,1000,"pole",30,True) mouth.speakBlocking("Look! Something appear in my field of view. It's a pole so I can do some pole dancing.") mouth.speakBlocking("But that's for another private video called Sexy Dancing Robots.") mouth.speakBlocking("The Integrated Movement service allow to add objects in my surrounding so I can interract with them") i01.integratedMovement.moveTo("rightArm","pole",i01.integratedMovement.ObjectPointLocation.CENTER_SIDE) mouth.speakBlocking("I can move my hand close to that item. I can also see objects in my surrounding using the kinect I have in my belly.") i01.integratedMovement.moveTo("rightArm",-600,600,400) sleep(3) i01.torso.midStom.setVelocity(3) i01.torso.midStom.moveTo(30) mouth.speakBlocking("I can also react if my arm enter in collision with an object I know of") sleep(10) i01.rest() mouth.speakBlocking("I can also try to control where my center of gravity is. When I am in this position, my center of gravity is right in the middle of my belly") mouth.speakBlocking("So I'm standing in a stable position. But if I raise my arm, my center of gravity will shift away and if it get too far from my center point") mouth.speakBlocking("I may tip over and fall if my base is not fixed strong enough") mouth.speakBlocking("If one of my arm is set to keep balance in integrated movement service, I can adjust my position to keep my center of gravity close to my center point") mouth.speakBlocking("that way, I will be able to stand in a more stable position") i01.integratedMovement.setAi("rightArm",i01.integratedMovement.Ai.KEEP_BALANCE) i01.leftArm.omoplate.moveTo(70) i01.leftArm.rotate.moveTo(180) i01.leftArm.bicep.moveTo(40) i01.torso.topStom.moveTo(80)
i01.integratedMovement.removeObject('pole') i01.integratedMovement.removeAi('kinect', i01.integratedMovement.Ai.AVOID_COLLISION) i01.rest() sleep(3) i01.integratedMovement.moveTo('rightArm', -300, 500, 400) mouth.speakBlocking('Hello, I am vinmoov') sleep(3) i01.rest() mouth.speakBlocking('I want to talk to you about a new myrobotlab service called Integrated Movement') mouth.speakBlocking('With this service, I can move my hand to a point in space by using inverse kinematics') i01.integratedMovement.moveTo('leftArm', 500, 500, 600) mouth.speakBlocking("you don't have to specify how I move each of my joint. You just told me where to move") i01.rest() i01.integratedMovement.addObject(-200, 500, -1000, -200, 500, 1000, 'pole', 30, True) mouth.speakBlocking("Look! Something appear in my field of view. It's a pole so I can do some pole dancing.") mouth.speakBlocking("But that's for another private video called Sexy Dancing Robots.") mouth.speakBlocking('The Integrated Movement service allow to add objects in my surrounding so I can interract with them') i01.integratedMovement.moveTo('rightArm', 'pole', i01.integratedMovement.ObjectPointLocation.CENTER_SIDE) mouth.speakBlocking('I can move my hand close to that item. I can also see objects in my surrounding using the kinect I have in my belly.') i01.integratedMovement.moveTo('rightArm', -600, 600, 400) sleep(3) i01.torso.midStom.setVelocity(3) i01.torso.midStom.moveTo(30) mouth.speakBlocking('I can also react if my arm enter in collision with an object I know of') sleep(10) i01.rest() mouth.speakBlocking('I can also try to control where my center of gravity is. When I am in this position, my center of gravity is right in the middle of my belly') mouth.speakBlocking("So I'm standing in a stable position. But if I raise my arm, my center of gravity will shift away and if it get too far from my center point") mouth.speakBlocking('I may tip over and fall if my base is not fixed strong enough') mouth.speakBlocking('If one of my arm is set to keep balance in integrated movement service, I can adjust my position to keep my center of gravity close to my center point') mouth.speakBlocking('that way, I will be able to stand in a more stable position') i01.integratedMovement.setAi('rightArm', i01.integratedMovement.Ai.KEEP_BALANCE) i01.leftArm.omoplate.moveTo(70) i01.leftArm.rotate.moveTo(180) i01.leftArm.bicep.moveTo(40) i01.torso.topStom.moveTo(80)
# Authors: David Mutchler, Dave Fisher, and many others before them. print('Hello, World') print('hi there') print('one', 'two', 'through my shoe') print(3 + 9) print('3 + 9', 'versus', 3 + 9) # done: After we talk together about the above, add PRINT statements that print: # done: 1. A Hello message to a friend. # done: 2. Two big numbers, followed by their sum. # done: 3. The result of 3,607 multiplied by 34,227. (Hint: the result is interesting.) # done: 4. Anything else you like! print('hi mommy') print('2345 + 3467 =', 2345+3467) print('3607 * 34227 =', 3607*34227) for x in range(10): print("I Love You Daddy!") for x in range(10): print("I love you", x + 2) # for x in range(10): # print(x)
print('Hello, World') print('hi there') print('one', 'two', 'through my shoe') print(3 + 9) print('3 + 9', 'versus', 3 + 9) print('hi mommy') print('2345 + 3467 =', 2345 + 3467) print('3607 * 34227 =', 3607 * 34227) for x in range(10): print('I Love You Daddy!') for x in range(10): print('I love you', x + 2)
def removeDuplicates(nums): n = len(nums) mp = {} for i in range(0 , n): if nums[i] not in mp: mp[nums[i]] = nums[i] op = mp.keys() return op op = removeDuplicates([0,0,1,1,1,2,2,3,3,4]) print(op)
def remove_duplicates(nums): n = len(nums) mp = {} for i in range(0, n): if nums[i] not in mp: mp[nums[i]] = nums[i] op = mp.keys() return op op = remove_duplicates([0, 0, 1, 1, 1, 2, 2, 3, 3, 4]) print(op)
c.NotebookApp.open_browser = False c.NotebookApp.ip='0.0.0.0' #'*' c.NotebookApp.port = 8192 c.NotebookApp.password = u'sha1:45f7d7ac038c:c36b98f22eac5921c435095af65a9a00b0e1eeb9' c.Authenticator.admin_users = {'jupyter'} c.LocalAuthenticator.create_system_users = True
c.NotebookApp.open_browser = False c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.port = 8192 c.NotebookApp.password = u'sha1:45f7d7ac038c:c36b98f22eac5921c435095af65a9a00b0e1eeb9' c.Authenticator.admin_users = {'jupyter'} c.LocalAuthenticator.create_system_users = True
#Actividad 7 Ejercicios For numeros = [1, 2, 3, 4, 5, 6, 7, 8 , 9, 10] numeros2 = [1, 2, 3, 4, 5, 6, 7, 8 , 9, 10] cadena="BIENVENIDOS" indice=0 for letra in "UNIVERSIDAD ESTATAL DE SONORA": print(letra) else: print("FIN DEL BUCLE") for i in numeros: print(i) print("") for x in numeros: x*=20 print(x) for x in numeros: numeros[indice]*=20 indice+=1 print(numeros) print("") print("") for indice, numero in enumerate(numeros2): numeros2[indice]*=40 print(numeros2) print("") for caracter in cadena: print(caracter)
numeros = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] numeros2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] cadena = 'BIENVENIDOS' indice = 0 for letra in 'UNIVERSIDAD ESTATAL DE SONORA': print(letra) else: print('FIN DEL BUCLE') for i in numeros: print(i) print('') for x in numeros: x *= 20 print(x) for x in numeros: numeros[indice] *= 20 indice += 1 print(numeros) print('') print('') for (indice, numero) in enumerate(numeros2): numeros2[indice] *= 40 print(numeros2) print('') for caracter in cadena: print(caracter)
sulfideToNitrileAddition = [ruleGMLString("""rule [ ruleID "Sulfide to Nitrile Addition" labelType "term" left [ edge [ source 2 target 3 label "#" ] edge [ source 4 target 5 label "-" ] ] context [ edge [ source 1 target 2 label "-" ] edge [ source 5 target 6 label "-" ] node [ id 1 label "*" ] node [ id 2 label "C" ] node [ id 3 label "N" ] node [ id 4 label "H" ] node [ id 5 label "S" ] node [ id 6 label "*" ] ] right [ edge [ source 2 target 5 label "-" ] edge [ source 2 target 3 label "=" ] edge [ source 3 target 4 label "-" ] ] ]""")]
sulfide_to_nitrile_addition = [rule_gml_string('rule [\n\truleID "Sulfide to Nitrile Addition" \n labelType "term"\n\tleft [\n\t\tedge [ source 2 target 3 label "#" ]\n\t\tedge [ source 4 target 5 label "-" ]\n\t] \n\tcontext [\n\t\tedge [ source 1 target 2 label "-" ]\n\t\tedge [ source 5 target 6 label "-" ]\n\t\tnode [ id 1 label "*" ]\n\t\tnode [ id 2 label "C" ]\n\t\tnode [ id 3 label "N" ]\n\t\tnode [ id 4 label "H" ]\n\t\tnode [ id 5 label "S" ]\n\t\tnode [ id 6 label "*" ]\n\t]\n\tright [\n\t\tedge [ source 2 target 5 label "-" ]\n\t\tedge [ source 2 target 3 label "=" ]\n\t\tedge [ source 3 target 4 label "-" ]\n\t] \n]')]
# Kalman filter | KalmanFilter(VAR, EST_VAR) STD_DEV = 0.075 VAR = 0.1 EST_VAR = STD_DEV ** 2 # PID P_ = 3.6 I_ = 0.02 D_ = 0.6 PID_MIN_VAL = -50 PID_MAX_VAL = 50
std_dev = 0.075 var = 0.1 est_var = STD_DEV ** 2 p_ = 3.6 i_ = 0.02 d_ = 0.6 pid_min_val = -50 pid_max_val = 50
class Solution: def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int: s1=0 x=len(arr) for i in range(x-2): for j in range(i+1,x-1): if abs(arr[i]-arr[j])<=a: for k in range(j+1,x): if abs(arr[j]-arr[k])<=b and abs(arr[i]-arr[k])<=c: s1+=1 return s1
class Solution: def count_good_triplets(self, arr: List[int], a: int, b: int, c: int) -> int: s1 = 0 x = len(arr) for i in range(x - 2): for j in range(i + 1, x - 1): if abs(arr[i] - arr[j]) <= a: for k in range(j + 1, x): if abs(arr[j] - arr[k]) <= b and abs(arr[i] - arr[k]) <= c: s1 += 1 return s1
for i in range(int(input())): x = list(map(int, input().split())) x.sort() print(x[-2])
for i in range(int(input())): x = list(map(int, input().split())) x.sort() print(x[-2])
# # PySNMP MIB module VPMT-OPT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VPMT-OPT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:28:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, enterprises, MibIdentifier, Bits, TimeTicks, NotificationType, IpAddress, Integer32, Unsigned32, Gauge32, Counter32, ObjectIdentity, Counter64, iso, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "enterprises", "MibIdentifier", "Bits", "TimeTicks", "NotificationType", "IpAddress", "Integer32", "Unsigned32", "Gauge32", "Counter32", "ObjectIdentity", "Counter64", "iso", "ModuleIdentity") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") codex = MibIdentifier((1, 3, 6, 1, 4, 1, 449)) cdxProductSpecific = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2)) cdx6500 = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1)) cdx6500Configuration = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 2)) cdx6500CfgGeneralGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2)) class DisplayString(OctetString): pass cdx6500VPMTCfgTable = MibTable((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26), ) if mibBuilder.loadTexts: cdx6500VPMTCfgTable.setStatus('mandatory') cdx6500VPMTCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1), ).setIndexNames((0, "VPMT-OPT-MIB", "cdx6500VPMTCfgEntryNum")) if mibBuilder.loadTexts: cdx6500VPMTCfgEntry.setStatus('mandatory') cdx6500VPMTCfgEntryNum = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgEntryNum.setStatus('mandatory') cdx6500VPMTCfgvpType = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))).clone(namedValues=NamedValues(("vpmt-ptype-null", 1), ("vpmt-ptype-voice", 2), ("vpmt-ptype-pri-voice", 3), ("vpmt-ptype-bypass-voice", 4), ("vpmt-ptype-tdm-data", 5), ("vpmt-ptype-pri-data", 6), ("vpmt-ptype-bypass-data", 7), ("vpmt-ptype-trans-ccs-voice", 8), ("vpmt-ptype-ccs-bypass", 9), ("vpmt-ptype-bri-voice", 10), ("vpmt-ptype-aam", 11), ("vpmt-ptype-num", 12)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgvpType.setStatus('mandatory') cdx6500VPMTCfgvpNum = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 254))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgvpNum.setStatus('mandatory') cdx6500VPMTCfgdslNum = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgdslNum.setStatus('mandatory') cdx6500VPMTCfgds0Rate = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("vpmt-rate-56k", 1), ("vpmt-rate-64k", 2), ("vpmt-rate-num", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgds0Rate.setStatus('mandatory') cdx6500VPMTCfgsrcTimeSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgsrcTimeSlot.setStatus('mandatory') cdx6500VPMTCfgdestTimeSlot = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgdestTimeSlot.setStatus('mandatory') cdx6500VPMTCfglocalDialNum = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 17))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfglocalDialNum.setStatus('mandatory') cdx6500VPMTCfgsubAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 17))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgsubAddress.setStatus('mandatory') cdx6500VPMTCfgcallPermission = MibTableColumn((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("out", 1), ("inc", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgcallPermission.setStatus('mandatory') cdx6500VPMTCfgnum_ccs_bypass_connections = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 11), Integer32()).setLabel("cdx6500VPMTCfgnum-ccs-bypass-connections").setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgnum_ccs_bypass_connections.setStatus('mandatory') cdx6500VPMTCfgPhysical_Port = MibScalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 12), Integer32()).setLabel("cdx6500VPMTCfgPhysical-Port").setMaxAccess("readonly") if mibBuilder.loadTexts: cdx6500VPMTCfgPhysical_Port.setStatus('mandatory') mibBuilder.exportSymbols("VPMT-OPT-MIB", cdx6500VPMTCfgdslNum=cdx6500VPMTCfgdslNum, codex=codex, cdx6500VPMTCfgsrcTimeSlot=cdx6500VPMTCfgsrcTimeSlot, cdx6500VPMTCfgsubAddress=cdx6500VPMTCfgsubAddress, cdx6500VPMTCfgds0Rate=cdx6500VPMTCfgds0Rate, cdx6500CfgGeneralGroup=cdx6500CfgGeneralGroup, cdx6500VPMTCfgEntryNum=cdx6500VPMTCfgEntryNum, cdx6500VPMTCfgcallPermission=cdx6500VPMTCfgcallPermission, cdx6500VPMTCfgTable=cdx6500VPMTCfgTable, cdxProductSpecific=cdxProductSpecific, cdx6500VPMTCfglocalDialNum=cdx6500VPMTCfglocalDialNum, cdx6500VPMTCfgvpNum=cdx6500VPMTCfgvpNum, cdx6500VPMTCfgdestTimeSlot=cdx6500VPMTCfgdestTimeSlot, cdx6500VPMTCfgnum_ccs_bypass_connections=cdx6500VPMTCfgnum_ccs_bypass_connections, cdx6500Configuration=cdx6500Configuration, cdx6500VPMTCfgvpType=cdx6500VPMTCfgvpType, cdx6500VPMTCfgPhysical_Port=cdx6500VPMTCfgPhysical_Port, cdx6500=cdx6500, cdx6500VPMTCfgEntry=cdx6500VPMTCfgEntry, DisplayString=DisplayString)
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mib_scalar, mib_table, mib_table_row, mib_table_column, enterprises, mib_identifier, bits, time_ticks, notification_type, ip_address, integer32, unsigned32, gauge32, counter32, object_identity, counter64, iso, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'enterprises', 'MibIdentifier', 'Bits', 'TimeTicks', 'NotificationType', 'IpAddress', 'Integer32', 'Unsigned32', 'Gauge32', 'Counter32', 'ObjectIdentity', 'Counter64', 'iso', 'ModuleIdentity') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') codex = mib_identifier((1, 3, 6, 1, 4, 1, 449)) cdx_product_specific = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2)) cdx6500 = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1)) cdx6500_configuration = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 2)) cdx6500_cfg_general_group = mib_identifier((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2)) class Displaystring(OctetString): pass cdx6500_vpmt_cfg_table = mib_table((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26)) if mibBuilder.loadTexts: cdx6500VPMTCfgTable.setStatus('mandatory') cdx6500_vpmt_cfg_entry = mib_table_row((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1)).setIndexNames((0, 'VPMT-OPT-MIB', 'cdx6500VPMTCfgEntryNum')) if mibBuilder.loadTexts: cdx6500VPMTCfgEntry.setStatus('mandatory') cdx6500_vpmt_cfg_entry_num = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgEntryNum.setStatus('mandatory') cdx6500_vpmt_cfgvp_type = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))).clone(namedValues=named_values(('vpmt-ptype-null', 1), ('vpmt-ptype-voice', 2), ('vpmt-ptype-pri-voice', 3), ('vpmt-ptype-bypass-voice', 4), ('vpmt-ptype-tdm-data', 5), ('vpmt-ptype-pri-data', 6), ('vpmt-ptype-bypass-data', 7), ('vpmt-ptype-trans-ccs-voice', 8), ('vpmt-ptype-ccs-bypass', 9), ('vpmt-ptype-bri-voice', 10), ('vpmt-ptype-aam', 11), ('vpmt-ptype-num', 12)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgvpType.setStatus('mandatory') cdx6500_vpmt_cfgvp_num = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(100, 254))).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgvpNum.setStatus('mandatory') cdx6500_vpmt_cfgdsl_num = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(4, 7))).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgdslNum.setStatus('mandatory') cdx6500_vpmt_cfgds0_rate = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('vpmt-rate-56k', 1), ('vpmt-rate-64k', 2), ('vpmt-rate-num', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgds0Rate.setStatus('mandatory') cdx6500_vpmt_cfgsrc_time_slot = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgsrcTimeSlot.setStatus('mandatory') cdx6500_vpmt_cfgdest_time_slot = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 7), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgdestTimeSlot.setStatus('mandatory') cdx6500_vpmt_cfglocal_dial_num = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 8), display_string().subtype(subtypeSpec=value_size_constraint(0, 17))).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfglocalDialNum.setStatus('mandatory') cdx6500_vpmt_cfgsub_address = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 9), display_string().subtype(subtypeSpec=value_size_constraint(0, 17))).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgsubAddress.setStatus('mandatory') cdx6500_vpmt_cfgcall_permission = mib_table_column((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('out', 1), ('inc', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgcallPermission.setStatus('mandatory') cdx6500_vpmt_cfgnum_ccs_bypass_connections = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 11), integer32()).setLabel('cdx6500VPMTCfgnum-ccs-bypass-connections').setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgnum_ccs_bypass_connections.setStatus('mandatory') cdx6500_vpmt_cfg_physical__port = mib_scalar((1, 3, 6, 1, 4, 1, 449, 2, 1, 2, 2, 26, 1, 12), integer32()).setLabel('cdx6500VPMTCfgPhysical-Port').setMaxAccess('readonly') if mibBuilder.loadTexts: cdx6500VPMTCfgPhysical_Port.setStatus('mandatory') mibBuilder.exportSymbols('VPMT-OPT-MIB', cdx6500VPMTCfgdslNum=cdx6500VPMTCfgdslNum, codex=codex, cdx6500VPMTCfgsrcTimeSlot=cdx6500VPMTCfgsrcTimeSlot, cdx6500VPMTCfgsubAddress=cdx6500VPMTCfgsubAddress, cdx6500VPMTCfgds0Rate=cdx6500VPMTCfgds0Rate, cdx6500CfgGeneralGroup=cdx6500CfgGeneralGroup, cdx6500VPMTCfgEntryNum=cdx6500VPMTCfgEntryNum, cdx6500VPMTCfgcallPermission=cdx6500VPMTCfgcallPermission, cdx6500VPMTCfgTable=cdx6500VPMTCfgTable, cdxProductSpecific=cdxProductSpecific, cdx6500VPMTCfglocalDialNum=cdx6500VPMTCfglocalDialNum, cdx6500VPMTCfgvpNum=cdx6500VPMTCfgvpNum, cdx6500VPMTCfgdestTimeSlot=cdx6500VPMTCfgdestTimeSlot, cdx6500VPMTCfgnum_ccs_bypass_connections=cdx6500VPMTCfgnum_ccs_bypass_connections, cdx6500Configuration=cdx6500Configuration, cdx6500VPMTCfgvpType=cdx6500VPMTCfgvpType, cdx6500VPMTCfgPhysical_Port=cdx6500VPMTCfgPhysical_Port, cdx6500=cdx6500, cdx6500VPMTCfgEntry=cdx6500VPMTCfgEntry, DisplayString=DisplayString)
# Define minimum distance threshold in map dist_thresh = 0.5 scaling_factor = int(1 / dist_thresh) # Define threshold around goal goal_thresh = int(scaling_factor * 1.5) # Define map size width, height = 300, 200 map_size = (scaling_factor * height), (scaling_factor * width) # Define all the possible no. of actions max_actions = 5 half_actions = max_actions // 2 # Define total angle of a complete circle total_angle = 360 # Define exploration constants no_parent = -1 node_generated = 1 start_parent = -99
dist_thresh = 0.5 scaling_factor = int(1 / dist_thresh) goal_thresh = int(scaling_factor * 1.5) (width, height) = (300, 200) map_size = (scaling_factor * height, scaling_factor * width) max_actions = 5 half_actions = max_actions // 2 total_angle = 360 no_parent = -1 node_generated = 1 start_parent = -99
def outside(r, c, size): if r < 0 or c < 0 or r >= size or c >= size: return True return False def get_next_pos(r, c, command): if command == 'up': return r - 1, c elif command == 'down': return r + 1, c elif command == 'left': return r, c - 1 elif command == 'right': return r, c + 1 def get_matrix(size): matrix, santa_row, santa_col = [], 0, 0 unhappy_nice_kids = 0 for _ in range(size): row = input().split() matrix.append(row) if 'S' in row: santa_row, santa_col = matrix.index(row), row.index('S') return matrix, santa_row, santa_col, unhappy_nice_kids happy_kids = 0 presents = int(input()) n = int(input()) matrix, santa_row, santa_col, unhappy_nice_kids = get_matrix(n) command = input() while command != 'Christmas morning': santa_next_row, santa_next_col = get_next_pos(santa_row, santa_col, command) if outside(santa_next_row, santa_next_col, n): command = input() continue if matrix[santa_next_row][santa_next_col] == 'V': matrix[santa_row][santa_col] = '-' matrix[santa_next_row][santa_next_col] = 'S' presents -= 1 happy_kids += 1 if presents <= 0: break elif matrix[santa_next_row][santa_next_col] == 'C': matrix[santa_row][santa_col] = '-' matrix[santa_next_row][santa_next_col] = 'S' if matrix[santa_next_row - 1][santa_next_col] == 'V' or matrix[santa_next_row - 1][santa_next_col] == 'X': # up if matrix[santa_next_row - 1][santa_next_col] == 'V': happy_kids += 1 matrix[santa_next_row - 1][santa_next_col] = '-' presents -= 1 if presents <= 0: break if matrix[santa_next_row + 1][santa_next_col] == 'V' or matrix[santa_next_row + 1][santa_next_col] == 'X': # down if matrix[santa_next_row + 1][santa_next_col] == 'V': happy_kids += 1 matrix[santa_next_row + 1][santa_next_col] = '-' presents -= 1 if presents <= 0: break if matrix[santa_next_row][santa_next_col - 1] == 'V' or matrix[santa_next_row][santa_next_col -1] == 'X': # left if matrix[santa_next_row][santa_next_col - 1] == 'V': happy_kids += 1 matrix[santa_next_row][santa_next_col - 1] = '-' presents -= 1 if presents <= 0: break if matrix[santa_next_row][santa_next_col + 1] == 'V' or matrix[santa_next_row][santa_next_col + 1] == 'X': if matrix[santa_next_row][santa_next_col + 1] == 'V': happy_kids += 1 matrix[santa_next_row][santa_next_col + 1] = '-' presents -= 1 if presents <= 0: break else: matrix[santa_row][santa_col] = '-' matrix[santa_next_row][santa_next_col] = 'S' santa_row, santa_col = santa_next_row, santa_next_col command = input() if presents == 0: for row in matrix: if 'V' in row: print('Santa ran out of presents!') break [print(' '.join(row)) for row in matrix] nice_kids_left = 0 for row in matrix: if 'V' in row: nice_kids_left += row.count('V') if nice_kids_left == 0: print(f'Good job, Santa! {happy_kids} happy nice kid/s.') else: print(f'No presents for {nice_kids_left} nice kid/s.')
def outside(r, c, size): if r < 0 or c < 0 or r >= size or (c >= size): return True return False def get_next_pos(r, c, command): if command == 'up': return (r - 1, c) elif command == 'down': return (r + 1, c) elif command == 'left': return (r, c - 1) elif command == 'right': return (r, c + 1) def get_matrix(size): (matrix, santa_row, santa_col) = ([], 0, 0) unhappy_nice_kids = 0 for _ in range(size): row = input().split() matrix.append(row) if 'S' in row: (santa_row, santa_col) = (matrix.index(row), row.index('S')) return (matrix, santa_row, santa_col, unhappy_nice_kids) happy_kids = 0 presents = int(input()) n = int(input()) (matrix, santa_row, santa_col, unhappy_nice_kids) = get_matrix(n) command = input() while command != 'Christmas morning': (santa_next_row, santa_next_col) = get_next_pos(santa_row, santa_col, command) if outside(santa_next_row, santa_next_col, n): command = input() continue if matrix[santa_next_row][santa_next_col] == 'V': matrix[santa_row][santa_col] = '-' matrix[santa_next_row][santa_next_col] = 'S' presents -= 1 happy_kids += 1 if presents <= 0: break elif matrix[santa_next_row][santa_next_col] == 'C': matrix[santa_row][santa_col] = '-' matrix[santa_next_row][santa_next_col] = 'S' if matrix[santa_next_row - 1][santa_next_col] == 'V' or matrix[santa_next_row - 1][santa_next_col] == 'X': if matrix[santa_next_row - 1][santa_next_col] == 'V': happy_kids += 1 matrix[santa_next_row - 1][santa_next_col] = '-' presents -= 1 if presents <= 0: break if matrix[santa_next_row + 1][santa_next_col] == 'V' or matrix[santa_next_row + 1][santa_next_col] == 'X': if matrix[santa_next_row + 1][santa_next_col] == 'V': happy_kids += 1 matrix[santa_next_row + 1][santa_next_col] = '-' presents -= 1 if presents <= 0: break if matrix[santa_next_row][santa_next_col - 1] == 'V' or matrix[santa_next_row][santa_next_col - 1] == 'X': if matrix[santa_next_row][santa_next_col - 1] == 'V': happy_kids += 1 matrix[santa_next_row][santa_next_col - 1] = '-' presents -= 1 if presents <= 0: break if matrix[santa_next_row][santa_next_col + 1] == 'V' or matrix[santa_next_row][santa_next_col + 1] == 'X': if matrix[santa_next_row][santa_next_col + 1] == 'V': happy_kids += 1 matrix[santa_next_row][santa_next_col + 1] = '-' presents -= 1 if presents <= 0: break else: matrix[santa_row][santa_col] = '-' matrix[santa_next_row][santa_next_col] = 'S' (santa_row, santa_col) = (santa_next_row, santa_next_col) command = input() if presents == 0: for row in matrix: if 'V' in row: print('Santa ran out of presents!') break [print(' '.join(row)) for row in matrix] nice_kids_left = 0 for row in matrix: if 'V' in row: nice_kids_left += row.count('V') if nice_kids_left == 0: print(f'Good job, Santa! {happy_kids} happy nice kid/s.') else: print(f'No presents for {nice_kids_left} nice kid/s.')
# eradicate a destroyed file system snapshot named myfs.mysnap client.delete_file_system_snapshots(names=["myfs.mysnap"]) # Other valid fields: ids # See section "Common Fields" for examples
client.delete_file_system_snapshots(names=['myfs.mysnap'])
''' The Olympic competitions between 1952 and 1988 took place during the height of the Cold War between the United States of America (USA) & the Union of Soviet Socialist Republics (USSR). Your goal in this exercise is to aggregate the number of distinct sports in which the USA and the USSR won medals during the Cold War years. The construction is mostly the same as in the preceding exercise. There is an additional filtering stage beforehand in which you reduce the original DataFrame medals by extracting data from the Cold War period that applies only to the US or to the USSR. The relevant country codes in the DataFrame, which has been pre-loaded as medals, are 'USA' & 'URS'. ''' # Extract all rows for which the 'Edition' is between 1952 & 1988: during_cold_war during_cold_war = (medals['Edition'] >= 1952) & (medals['Edition'] <= 1988) # Extract rows for which 'NOC' is either 'USA' or 'URS': is_usa_urs is_usa_urs = medals.NOC.isin(['USA', 'URS']) # Use during_cold_war and is_usa_urs to create the DataFrame: cold_war_medals cold_war_medals = medals.loc[during_cold_war & is_usa_urs] # Group cold_war_medals by 'NOC' country_grouped = cold_war_medals.groupby('NOC') # Create Nsports Nsports = country_grouped['Sport'].nunique().sort_values(ascending=False) # Print Nsports print(Nsports)
""" The Olympic competitions between 1952 and 1988 took place during the height of the Cold War between the United States of America (USA) & the Union of Soviet Socialist Republics (USSR). Your goal in this exercise is to aggregate the number of distinct sports in which the USA and the USSR won medals during the Cold War years. The construction is mostly the same as in the preceding exercise. There is an additional filtering stage beforehand in which you reduce the original DataFrame medals by extracting data from the Cold War period that applies only to the US or to the USSR. The relevant country codes in the DataFrame, which has been pre-loaded as medals, are 'USA' & 'URS'. """ during_cold_war = (medals['Edition'] >= 1952) & (medals['Edition'] <= 1988) is_usa_urs = medals.NOC.isin(['USA', 'URS']) cold_war_medals = medals.loc[during_cold_war & is_usa_urs] country_grouped = cold_war_medals.groupby('NOC') nsports = country_grouped['Sport'].nunique().sort_values(ascending=False) print(Nsports)
grades = int(input()) name_exam = str(input()) grade = int(input()) poor_grade = 0 pas = True average = 0 problems_solved = 0 last_name_exam = str() while name_exam != "Enough": if int(grade) <= 4: poor_grade += 1 if poor_grade == grades: pas = False break problems_solved += 1 average += int(grade) last_name_exam = name_exam name_exam = str(input()) grade = input() if pas: print(f"Average score: {average / problems_solved:.2f}") print(f"Number of problems: {problems_solved}") print(f"Last problem: {last_name_exam}") else: print(f"You need a break, {poor_grade} poor grades.")
grades = int(input()) name_exam = str(input()) grade = int(input()) poor_grade = 0 pas = True average = 0 problems_solved = 0 last_name_exam = str() while name_exam != 'Enough': if int(grade) <= 4: poor_grade += 1 if poor_grade == grades: pas = False break problems_solved += 1 average += int(grade) last_name_exam = name_exam name_exam = str(input()) grade = input() if pas: print(f'Average score: {average / problems_solved:.2f}') print(f'Number of problems: {problems_solved}') print(f'Last problem: {last_name_exam}') else: print(f'You need a break, {poor_grade} poor grades.')
# Coding is all about making things easier for ourselves. # Some times you will be writing the same code over and # over again. When this happens, it is often best to write # a function. # functions are defined with the def keyword: def paulsFunction(): # anything inside the function will execute when I call it print("Hello! Nice function!") # To run the code, just call the function paulsFunction()
def pauls_function(): print('Hello! Nice function!') pauls_function()
#! /usr/bin/env python """A package that implements HTTP 1.1""" __all__ = ['grammar', 'params', 'messages', 'auth', 'client']
"""A package that implements HTTP 1.1""" __all__ = ['grammar', 'params', 'messages', 'auth', 'client']
def narcissistic(num): sum = 0 iterableNum = str(num) for i in iterableNum: sum += int(i) ** len(iterableNum) return True if sum == num else False # One-liner: def narcissistic2(num): return num == sum(int(i) ** len(str(num)) for i in str(num))
def narcissistic(num): sum = 0 iterable_num = str(num) for i in iterableNum: sum += int(i) ** len(iterableNum) return True if sum == num else False def narcissistic2(num): return num == sum((int(i) ** len(str(num)) for i in str(num)))
def answer_type(request, json_list, nested): for question in json_list: if question['payload']['object_type'] == 'task_instance': question['answer_class'] = 'task_answer'
def answer_type(request, json_list, nested): for question in json_list: if question['payload']['object_type'] == 'task_instance': question['answer_class'] = 'task_answer'
def test_example_resource(example_resource): """Check that the example resource was loaded correctly.""" assert len(example_resource) == 4 assert example_resource[0]["average"] == 6.29
def test_example_resource(example_resource): """Check that the example resource was loaded correctly.""" assert len(example_resource) == 4 assert example_resource[0]['average'] == 6.29
#!/usr/bin/env python # Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org> # # This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details. """ Description here """ def getMingConfiguration(modules): config = {} for module in modules: urlstring = 'mongodb://' urlstring += dbhost urlstring += ":" urlstring += dbport urlstring += "/" key = '' key += 'ming.' key += module._get_dataobj_id() key += '.uri' collection = module._get_collection_id() urlstring += collection #log.debug("Configuring %s module as %s", module, urlstring) config[key] = urlstring return config def set_database_hostname(name): global dbhost dbhost = name def set_database_port(port): global dbport dbport = port def set_experiment_name(name): """ Takes the name of the experiment currently being run, for use as a prefix to database collection names :param name: :return: none """ global experiment_name experiment_name = name def generate_collection_id(suffix): collection_id = experiment_name collection_id += suffix return collection_id
""" Description here """ def get_ming_configuration(modules): config = {} for module in modules: urlstring = 'mongodb://' urlstring += dbhost urlstring += ':' urlstring += dbport urlstring += '/' key = '' key += 'ming.' key += module._get_dataobj_id() key += '.uri' collection = module._get_collection_id() urlstring += collection config[key] = urlstring return config def set_database_hostname(name): global dbhost dbhost = name def set_database_port(port): global dbport dbport = port def set_experiment_name(name): """ Takes the name of the experiment currently being run, for use as a prefix to database collection names :param name: :return: none """ global experiment_name experiment_name = name def generate_collection_id(suffix): collection_id = experiment_name collection_id += suffix return collection_id
# Solution 1 # def remove_duplicates(arr): # val_tracker = {} # for num in arr: # if num not in arr: # val_tracker[num] = 1 # else: # print('True') # return True # print('False') # return False # Solution 2 def remove_duplicates(arr): unique = set(arr) if len(unique) != len(arr): print('True') return True else: print('False') return False test_arr = [1, 1, 1, 1, 2, 3, 4, 5, 5, 5] answer_arr = set(test_arr) remove_duplicates(test_arr)
def remove_duplicates(arr): unique = set(arr) if len(unique) != len(arr): print('True') return True else: print('False') return False test_arr = [1, 1, 1, 1, 2, 3, 4, 5, 5, 5] answer_arr = set(test_arr) remove_duplicates(test_arr)
index = 1 result = 0 while index < 1000: if index % 3 ==0 or index % 5 == 0: result = result + index index = index + 1 print(result)
index = 1 result = 0 while index < 1000: if index % 3 == 0 or index % 5 == 0: result = result + index index = index + 1 print(result)
class NoticeModel: def __init__(self, dbRow): self.ID = dbRow["ID"] self.Message = dbRow["Message"] self.Timestamp = dbRow["Timestamp"]
class Noticemodel: def __init__(self, dbRow): self.ID = dbRow['ID'] self.Message = dbRow['Message'] self.Timestamp = dbRow['Timestamp']
def keep_one_mRNA_with_same_stop_codon_position(f): output = [] nameset = set() with open(f, 'r') as FILE: for line in FILE: if line[0] == '#': output.append(line.strip()) else: s = line.strip().split('\t') if s[6] == '+': # then stop codons are on the right name = s[8].split(';')[1] + '.' + s[4] if name in nameset: pass else: nameset.add(name) output.append(line.strip()) elif s[6] == '-': # then stop codons are on the left name = s[8].split(';')[1] + '.' + s[3] if name in nameset: pass else: nameset.add(name) output.append(line.strip()) outfile = '.'.join(f.split('.')[:-1] + ['onestop', 'gff3']) with open(outfile, 'w') as OUT: OUT.write('\n'.join(output)) print('Output file: %s' % outfile) def trim_to_mRNA_and_add_protein_id(f, feature='mRNA'): output = [] with open(f, 'r') as FILE: for line in FILE: if line[0] == '#': output.append(line.strip()) else: if line.strip().split('\t')[2] == feature: outline = line.strip() gate = 'open' # allow it to find the next CDS line, which should have protein ID elif (line.strip().split('\t')[2] == 'CDS') and (gate == 'open'): # extract: XP_011540840.1 # from: ID=cds4;Parent=rna43;Dbxref=GeneID:105378947,Genbank:XP_011540840.1;Name=XP_011540840.1; outline += ';%s' % (line.strip().split('\t')[8].split(';')[3][5:]) gate = 'closed' output.append(outline) outfile = '.'.join(f.split('.')[:-1] + [feature, 'wProtID', 'gff3']) with open(outfile, 'w') as OUT: OUT.write('\n'.join(output)) print('Output file: %s' % outfile) def trim_ensembl_gtf_to_3utrs_of_target_genes(f, feature='three_prime_utr', targetgenenames=[], minpeplength=5): # this is the worst piece of shit i have ever written <3 # f is full path to ensembl .gtf file # example ensembl .gtf 3' UTR feature: # 1 havana three_prime_utr 944154 944259 . + . gene_id "ENSG00000187634"; gene_version "13"; transcript_id "ENST00000455979"; transcript_version "1"; gene_name "SAMD11"; gene_source "ensembl_havana"; gene_biotype "protein_coding"; transcript_name "SAMD11-204"; transcript_source "havana"; transcript_biotype "protein_coding"; tag "cds_start_NF"; tag "mRNA_start_NF"; transcript_support_level "2"; collectedfeatures = [] stopcodons = [] with open(f, 'r') as FILE: for line in FILE: if line[0] == '#': collectedfeatures.append(line.strip()) else: if line.strip().split('\t')[2] == feature: orientation = line.strip().split('\t')[6] metadata = line.strip().split('\t')[8].split('"; ') genename = '' for meta in metadata: if meta[:len('gene_name "')] == 'gene_name "': genename = meta[len('gene_name "'):] if (genename != '') and (genename in targetgenenames): collectedfeatures.append(line.strip()) output = [] outputgenes = [] # enename_startposition value is line of longest 3'UTR for each unique start for line in collectedfeatures: if line[0] == '#': output.append(line) else: gate = 'open' if line.split('\t')[6] == '+': start = line.split('\t')[3] end = line.split('\t')[4] orientation = line.split('\t')[6] difference = int(end) - int(start) + 1 elif line.split('\t')[6] == '-': end = line.split('\t')[3] start = line.split('\t')[4] orientation = line.split('\t')[6] difference = int(start) - int(end) + 1 if difference >= minpeplength * 3: # it needs to be at least minpeplength AA long metadata = line.split('\t')[8].split('"; ') for meta in metadata: if meta[:len('gene_name "')] == 'gene_name "': genename = meta[len('gene_name "'):] for line2 in collectedfeatures: if line2[0] == '#': pass else: metadata2 = line2.split('\t')[8].split('"; ') for meta2 in metadata2: if meta2[:len('gene_name "')] == 'gene_name "': genename2 = meta2[len('gene_name "'):] if line2.split('\t')[6] == '+': start2 = line2.split('\t')[3] end2 = line2.split('\t')[4] if (genename == genename2) and (start == start2) and (int(end) <= int(end2)): if int(end) < int(end2): gate = 'closed' elif int(end) == int(end2): for out in output: if out[0] == '#': pass else: metadata3 = out.split('\t')[8].split('"; ') for meta3 in metadata3: if meta3[:len('gene_name "')] == 'gene_name "': genename3 = meta3[len('gene_name "'):] if line.split('\t')[6] == '+': start3 = out.split('\t')[3] end3 = out.split('\t')[4] # if the same gene with same 3'UTR start & end coordinates is already in output then # do not output a duplicate 3UTR feature with same start and end (close gate) # However if no gene with exact start and end is in output then output the first one if (genename == genename3) and (start == start3) and (end == end3): gate = 'closed' elif line2.split('\t')[6] == '-': end2 = line2.split('\t')[3] start2 = line2.split('\t')[4] if (genename == genename2) and (start == start2) and (int(end) >= int(end2)): if int(end) > int(end2): gate = 'closed' elif int(end) == int(end2): for out in output: if out[0] == '#': pass else: metadata3 = out.split('\t')[8].split('"; ') for meta3 in metadata3: if meta3[:len('gene_name "')] == 'gene_name "': genename3 = meta3[len('gene_name "'):] if line.split('\t')[6] == '-': end3 = out.split('\t')[3] start3 = out.split('\t')[4] # if the same gene with same 3'UTR start & end coordinates is already in output then # do not output a duplicate 3UTR feature with same start and end (close gate) # However if no gene with exact start and end is in output then output the first one if (genename == genename3) and (end == end3) and (start == start3): gate = 'closed' # if (genename == genename2) and (start == start2) and (x == ''): # int(end) <= int(end2) # if int(end) < int(end2): # gate = 'closed' # elif int(end) == int(end2): # for out in output: # if out[0] == '#': # pass # else: # start3 = out.split('\t')[3] # end3 = out.split('\t')[4] # metadata3 = out.split('\t')[8].split('"; ') # for meta3 in metadata3: # if meta3[:len('gene_name "')] == 'gene_name "': # genename3 = meta3[len('gene_name "'):] # # if the same gene with same 3'UTR start & end coordinates is already in output then # # do not output a duplicate 3UTR feature with same start and end (close gate) # # However if no gene with exact start and end is in output then output the first one # if (genename == genename3) and (start == start3) and (int(end) == int(end3)): # gate = 'closed' else: gate = 'closed' if (gate == 'open') and (line[0] != '#'): output.append(line) outputgenes.append(genename) print(f'Number of gene names entered and searched for {len(targetgenenames)}') print(f'Number of genes with a transcript in output: {len(set(outputgenes))}') print(f'Genes with a transcript in output: {set(outputgenes)}') outfile = '.'.join(f.split('.')[:-1] + [feature, 'all', 'gtf']) with open(outfile, 'w') as OUT: OUT.write('\n'.join(collectedfeatures)) print('Output file: %s' % outfile) outfile = '.'.join(f.split('.')[:-1] + [feature, 'longest', 'gtf']) with open(outfile, 'w') as OUT: OUT.write('\n'.join(output)) print('Output file: %s' % outfile) ##### broken ##### class GENE: def __init__(self, line): # line is line form annotation file if line.strip().split('\t')[2] == 'gene': self.genename = line.strip().split('\t')[8].split(';')[3][len('Name='):].upper() self.scaffold = line.strip().split('\t')[0] self.orientation = line.strip().split('\t')[6] self.biotype = line.strip().split('\t') elif line.strip().split('\t')[2] == 'mRNA': self.mrnafeaturelength = int(line.strip().split('\t')[4]) - int(line.strip().split('\t')[3]) self.start = int(line.strip().split('\t')[3]) self.end = int(line.strip().split('\t')[4]) self.length = len(line.strip().split('\t')[8].split(';')[-1][len('sequence='):]) self.sequence = line.strip().split('\t')[8].split(';')[-1][len('sequence='):] def main(f, feature='gene'): output = [] with open(f, 'r') as FILE: for line in FILE: if line[0] == '#': output.append(line.strip()) else: if line.strip().split('\t')[2] == feature: output.append(line.strip()) outfile = '.'.join(f.split('.')[:-1] + [feature, 'gff3']) with open(outfile, 'w') as OUT: OUT.write('\n'.join(output)) print('Output file: %s' % outfile)
def keep_one_m_rna_with_same_stop_codon_position(f): output = [] nameset = set() with open(f, 'r') as file: for line in FILE: if line[0] == '#': output.append(line.strip()) else: s = line.strip().split('\t') if s[6] == '+': name = s[8].split(';')[1] + '.' + s[4] if name in nameset: pass else: nameset.add(name) output.append(line.strip()) elif s[6] == '-': name = s[8].split(';')[1] + '.' + s[3] if name in nameset: pass else: nameset.add(name) output.append(line.strip()) outfile = '.'.join(f.split('.')[:-1] + ['onestop', 'gff3']) with open(outfile, 'w') as out: OUT.write('\n'.join(output)) print('Output file: %s' % outfile) def trim_to_m_rna_and_add_protein_id(f, feature='mRNA'): output = [] with open(f, 'r') as file: for line in FILE: if line[0] == '#': output.append(line.strip()) elif line.strip().split('\t')[2] == feature: outline = line.strip() gate = 'open' elif line.strip().split('\t')[2] == 'CDS' and gate == 'open': outline += ';%s' % line.strip().split('\t')[8].split(';')[3][5:] gate = 'closed' output.append(outline) outfile = '.'.join(f.split('.')[:-1] + [feature, 'wProtID', 'gff3']) with open(outfile, 'w') as out: OUT.write('\n'.join(output)) print('Output file: %s' % outfile) def trim_ensembl_gtf_to_3utrs_of_target_genes(f, feature='three_prime_utr', targetgenenames=[], minpeplength=5): collectedfeatures = [] stopcodons = [] with open(f, 'r') as file: for line in FILE: if line[0] == '#': collectedfeatures.append(line.strip()) elif line.strip().split('\t')[2] == feature: orientation = line.strip().split('\t')[6] metadata = line.strip().split('\t')[8].split('"; ') genename = '' for meta in metadata: if meta[:len('gene_name "')] == 'gene_name "': genename = meta[len('gene_name "'):] if genename != '' and genename in targetgenenames: collectedfeatures.append(line.strip()) output = [] outputgenes = [] for line in collectedfeatures: if line[0] == '#': output.append(line) else: gate = 'open' if line.split('\t')[6] == '+': start = line.split('\t')[3] end = line.split('\t')[4] orientation = line.split('\t')[6] difference = int(end) - int(start) + 1 elif line.split('\t')[6] == '-': end = line.split('\t')[3] start = line.split('\t')[4] orientation = line.split('\t')[6] difference = int(start) - int(end) + 1 if difference >= minpeplength * 3: metadata = line.split('\t')[8].split('"; ') for meta in metadata: if meta[:len('gene_name "')] == 'gene_name "': genename = meta[len('gene_name "'):] for line2 in collectedfeatures: if line2[0] == '#': pass else: metadata2 = line2.split('\t')[8].split('"; ') for meta2 in metadata2: if meta2[:len('gene_name "')] == 'gene_name "': genename2 = meta2[len('gene_name "'):] if line2.split('\t')[6] == '+': start2 = line2.split('\t')[3] end2 = line2.split('\t')[4] if genename == genename2 and start == start2 and (int(end) <= int(end2)): if int(end) < int(end2): gate = 'closed' elif int(end) == int(end2): for out in output: if out[0] == '#': pass else: metadata3 = out.split('\t')[8].split('"; ') for meta3 in metadata3: if meta3[:len('gene_name "')] == 'gene_name "': genename3 = meta3[len('gene_name "'):] if line.split('\t')[6] == '+': start3 = out.split('\t')[3] end3 = out.split('\t')[4] if genename == genename3 and start == start3 and (end == end3): gate = 'closed' elif line2.split('\t')[6] == '-': end2 = line2.split('\t')[3] start2 = line2.split('\t')[4] if genename == genename2 and start == start2 and (int(end) >= int(end2)): if int(end) > int(end2): gate = 'closed' elif int(end) == int(end2): for out in output: if out[0] == '#': pass else: metadata3 = out.split('\t')[8].split('"; ') for meta3 in metadata3: if meta3[:len('gene_name "')] == 'gene_name "': genename3 = meta3[len('gene_name "'):] if line.split('\t')[6] == '-': end3 = out.split('\t')[3] start3 = out.split('\t')[4] if genename == genename3 and end == end3 and (start == start3): gate = 'closed' else: gate = 'closed' if gate == 'open' and line[0] != '#': output.append(line) outputgenes.append(genename) print(f'Number of gene names entered and searched for {len(targetgenenames)}') print(f'Number of genes with a transcript in output: {len(set(outputgenes))}') print(f'Genes with a transcript in output: {set(outputgenes)}') outfile = '.'.join(f.split('.')[:-1] + [feature, 'all', 'gtf']) with open(outfile, 'w') as out: OUT.write('\n'.join(collectedfeatures)) print('Output file: %s' % outfile) outfile = '.'.join(f.split('.')[:-1] + [feature, 'longest', 'gtf']) with open(outfile, 'w') as out: OUT.write('\n'.join(output)) print('Output file: %s' % outfile) class Gene: def __init__(self, line): if line.strip().split('\t')[2] == 'gene': self.genename = line.strip().split('\t')[8].split(';')[3][len('Name='):].upper() self.scaffold = line.strip().split('\t')[0] self.orientation = line.strip().split('\t')[6] self.biotype = line.strip().split('\t') elif line.strip().split('\t')[2] == 'mRNA': self.mrnafeaturelength = int(line.strip().split('\t')[4]) - int(line.strip().split('\t')[3]) self.start = int(line.strip().split('\t')[3]) self.end = int(line.strip().split('\t')[4]) self.length = len(line.strip().split('\t')[8].split(';')[-1][len('sequence='):]) self.sequence = line.strip().split('\t')[8].split(';')[-1][len('sequence='):] def main(f, feature='gene'): output = [] with open(f, 'r') as file: for line in FILE: if line[0] == '#': output.append(line.strip()) elif line.strip().split('\t')[2] == feature: output.append(line.strip()) outfile = '.'.join(f.split('.')[:-1] + [feature, 'gff3']) with open(outfile, 'w') as out: OUT.write('\n'.join(output)) print('Output file: %s' % outfile)
class Building(object): def __init__(self, south, west, width_WE, width_NS, height=10): self.south = south self.west = west self.width_WE = width_WE self.width_NS = width_NS self.height = height def corners(self): north_west = [self.south+self.width_NS, self.west] north_east = [self.south+self.width_NS, self.west+self.width_WE] south_west = [self.south, self.west] south_east = [self.south, self.west+self.width_WE] corner = {"north-west": north_west, "north-east": north_east, "south-west": south_west, "south-east": south_east} return corner def area(self): return self.width_NS*self.width_WE def volume(self): return self.area()*self.height def __repr__(self): return "Building({0}, {1}, {2}, {3}, {4})".format(self.south, self.west, self.width_WE, self.width_NS, self.height)
class Building(object): def __init__(self, south, west, width_WE, width_NS, height=10): self.south = south self.west = west self.width_WE = width_WE self.width_NS = width_NS self.height = height def corners(self): north_west = [self.south + self.width_NS, self.west] north_east = [self.south + self.width_NS, self.west + self.width_WE] south_west = [self.south, self.west] south_east = [self.south, self.west + self.width_WE] corner = {'north-west': north_west, 'north-east': north_east, 'south-west': south_west, 'south-east': south_east} return corner def area(self): return self.width_NS * self.width_WE def volume(self): return self.area() * self.height def __repr__(self): return 'Building({0}, {1}, {2}, {3}, {4})'.format(self.south, self.west, self.width_WE, self.width_NS, self.height)
def bio(*args): header = ["Name", "Roll no.", "Regd no.", "Branch", "Stream", "Sem", "Phone no.", "Address"] for head, data in zip(header, args): print("%-10s: %s"%(head, data)) bio("Md.Azharuddin", "36725", "1701105431", "CSE", "B.Tech", "7th", "9078600498", "Arad Bazar, Balasore")
def bio(*args): header = ['Name', 'Roll no.', 'Regd no.', 'Branch', 'Stream', 'Sem', 'Phone no.', 'Address'] for (head, data) in zip(header, args): print('%-10s: %s' % (head, data)) bio('Md.Azharuddin', '36725', '1701105431', 'CSE', 'B.Tech', '7th', '9078600498', 'Arad Bazar, Balasore')
# -*- coding: utf-8 -*- """ HackerRank practice problems Companies: Dialpad, etc """ "print odd numbers between l and r" def oddNumbers(l, r): odd = [] while l<=r: if l%2!=0: odd.append(l) l+=2 elif l==0: l+=1 else: l+=1 return odd "print multiples of x and y but not z and <=n" def multiple(x, y, z, n): # Write your code here a = n//x if x!=0 else x b = n//y if y!=0 else y c = n//z if z!=0 else z mulx = [x*i for i in range(1, a+1)] muly = [y*i for i in range(1, b+1)] mulz = [z*i for i in range(1, c+1)] addxy = mulx + muly suby = list(set(addxy) - set(mulz)) return sorted(suby) "print reservations in second order not present in first order and " def missingReservations(firstReservationList, secondReservationList): # Write your code here dict1 = {i[0]:i[1] for i in firstReservationList} dict2 = {i[0]:i[1] for i in secondReservationList} di3 = {item: dict2[item] for item in dict2.keys() if item not in dict1.keys()} return sorted(di3, key=di3.get, reverse=True) #gives a sorted list of sorted keys ##reverse is ascending order [256, 458, 1231] if __name__ == '__main__': #print(oddNumbers(3,9)) #print(multiple(3, 5, 10, 0)) print(missingReservations([[1234,532632],[234,632633],[2354,732634],[1234,532632]],[[234,632633],[458,642633],[2354,732634],[256, 786545], [1231, 635468]]))
""" HackerRank practice problems Companies: Dialpad, etc """ 'print odd numbers between l and r' def odd_numbers(l, r): odd = [] while l <= r: if l % 2 != 0: odd.append(l) l += 2 elif l == 0: l += 1 else: l += 1 return odd 'print multiples of x and y but not z and <=n' def multiple(x, y, z, n): a = n // x if x != 0 else x b = n // y if y != 0 else y c = n // z if z != 0 else z mulx = [x * i for i in range(1, a + 1)] muly = [y * i for i in range(1, b + 1)] mulz = [z * i for i in range(1, c + 1)] addxy = mulx + muly suby = list(set(addxy) - set(mulz)) return sorted(suby) 'print reservations in second order not present in first order and ' def missing_reservations(firstReservationList, secondReservationList): dict1 = {i[0]: i[1] for i in firstReservationList} dict2 = {i[0]: i[1] for i in secondReservationList} di3 = {item: dict2[item] for item in dict2.keys() if item not in dict1.keys()} return sorted(di3, key=di3.get, reverse=True) if __name__ == '__main__': print(missing_reservations([[1234, 532632], [234, 632633], [2354, 732634], [1234, 532632]], [[234, 632633], [458, 642633], [2354, 732634], [256, 786545], [1231, 635468]]))
def sum_list(x): sum = 0 for i in x: sum += i return sum def str_cvt_lower(s): """konversi besar->kecil""" return s.lower() def str_cvt_upper(s): """konversi kecil->besar""" return s.upper()
def sum_list(x): sum = 0 for i in x: sum += i return sum def str_cvt_lower(s): """konversi besar->kecil""" return s.lower() def str_cvt_upper(s): """konversi kecil->besar""" return s.upper()
def sum_of_multiples(limit: int, factors: list) -> int: """Give sum of all the multiples of given numbers untill given limit""" set_of_multiples = {i for factor in factors if factor != 0 for i in range(factor, limit, factor) } return sum(set_of_multiples)
def sum_of_multiples(limit: int, factors: list) -> int: """Give sum of all the multiples of given numbers untill given limit""" set_of_multiples = {i for factor in factors if factor != 0 for i in range(factor, limit, factor)} return sum(set_of_multiples)
class Subscription(object): def __init__(self, sid, subject, queue, callback, connetion): self.sid = sid self.subject = subject self.queue = queue self.connetion = connetion self.callback = callback self.received = 0 self.delivered = 0 self.bytes = 0 self.max = 0 def handle_msg(self, msg): return self.callback(msg)
class Subscription(object): def __init__(self, sid, subject, queue, callback, connetion): self.sid = sid self.subject = subject self.queue = queue self.connetion = connetion self.callback = callback self.received = 0 self.delivered = 0 self.bytes = 0 self.max = 0 def handle_msg(self, msg): return self.callback(msg)
""" Global Django Town exception and warning classes. """ class SettingError(Exception): pass class ThirdPartyDependencyError(Exception): pass
""" Global Django Town exception and warning classes. """ class Settingerror(Exception): pass class Thirdpartydependencyerror(Exception): pass
class Animation(): def __init__(self): self.vertex_n = 0 self.verticies = [] def get_coord(self, V_kind): print("\n\t***\nFor vertex %s please enter:\n" % V_kind) x = input('X: ') y = input('Y: ') z = input('Z: ') pos = [x, y, z] return pos def add_Vertex(self): self.vertex_n +=1 self.verticies.append(Vertex()) self.verticies[self.vertex_n-1].p_zero = self.get_coord("position zero") self.verticies[self.vertex_n-1].name = "Vertex_"+ str(self.vertex_n) return class Vertex(object): def __init__(self, p_zero = None, position = None, rest = None, name = None): self.p_zero = p_zero #initial vertex position and this vertex's zero self.position = position #current vertex position self.rest = rest #set rest position for the vertex self.servos = [] #list of servo objects self.servo_n = 0 #servo count on vertex self.name = name #Vertex name def add_servo(self): self.servos.append(Servo(self.name)) return print("Not Done") class Servo(object): def __init__(self, vertex, vector = None, rate = None, track = None): self.vertex = Vertex #What vertex is this servo linked to self.vector = vector #Input for movement self.rate = rate #Acceleration self.track = track #axis and range of movement mouth = Animation() mouth.add_Vertex() for i, obj in enumerate(mouth.verticies): print ("Zero position for", obj.name, "is", obj.p_zero)
class Animation: def __init__(self): self.vertex_n = 0 self.verticies = [] def get_coord(self, V_kind): print('\n\t***\nFor vertex %s please enter:\n' % V_kind) x = input('X: ') y = input('Y: ') z = input('Z: ') pos = [x, y, z] return pos def add__vertex(self): self.vertex_n += 1 self.verticies.append(vertex()) self.verticies[self.vertex_n - 1].p_zero = self.get_coord('position zero') self.verticies[self.vertex_n - 1].name = 'Vertex_' + str(self.vertex_n) return class Vertex(object): def __init__(self, p_zero=None, position=None, rest=None, name=None): self.p_zero = p_zero self.position = position self.rest = rest self.servos = [] self.servo_n = 0 self.name = name def add_servo(self): self.servos.append(servo(self.name)) return print('Not Done') class Servo(object): def __init__(self, vertex, vector=None, rate=None, track=None): self.vertex = Vertex self.vector = vector self.rate = rate self.track = track mouth = animation() mouth.add_Vertex() for (i, obj) in enumerate(mouth.verticies): print('Zero position for', obj.name, 'is', obj.p_zero)
with open("input.txt", "r") as f: lines = [line.strip() for line in f.readlines()] gamma = "" epsilon = "" for i in range(0, len(lines[0])): zero = 0 one = 0 for line in lines: if line[i] == "0": zero += 1 else: one += 1 if(zero > one): gamma = gamma + str(0) epsilon = epsilon + str(1) else: gamma = gamma + str(1) epsilon = epsilon + str(0) gamma_rate = int(gamma, 2) epsilon_rate = int(epsilon, 2) print("gamma: ", gamma_rate) print("epsilon: ", epsilon_rate) print("power consumption: ", gamma_rate*epsilon_rate)
with open('input.txt', 'r') as f: lines = [line.strip() for line in f.readlines()] gamma = '' epsilon = '' for i in range(0, len(lines[0])): zero = 0 one = 0 for line in lines: if line[i] == '0': zero += 1 else: one += 1 if zero > one: gamma = gamma + str(0) epsilon = epsilon + str(1) else: gamma = gamma + str(1) epsilon = epsilon + str(0) gamma_rate = int(gamma, 2) epsilon_rate = int(epsilon, 2) print('gamma: ', gamma_rate) print('epsilon: ', epsilon_rate) print('power consumption: ', gamma_rate * epsilon_rate)
def comp_height(self): """Compute the height of the Hole (Rmax-Rmin) Parameters ---------- self : Hole A Hole object Returns ------- H : float Height of the hole """ (Rmin, Rmax) = self.comp_radius() return Rmax - Rmin
def comp_height(self): """Compute the height of the Hole (Rmax-Rmin) Parameters ---------- self : Hole A Hole object Returns ------- H : float Height of the hole """ (rmin, rmax) = self.comp_radius() return Rmax - Rmin
COLOUR_CHOICES = [ ('white', 'White'), ('grey', 'Grey'), ('blue', 'Blue'), ] COLUMN_CHOICES = [ ('12', 'Full Width'), ('11', '11/12'), ('10', '5/6'), ('9', 'Three Quarters'), ('8', 'Two Thirds'), ('7', '7/12'), ('6', 'Half Width'), ('5', '5/12'), ('4', 'One Third'), ('3', 'One Quarter'), ('2', '1/6'), ('1', '1/12'), ] LANGUAGE_CHOICES = [ ('python', 'python'), ('css', 'css'), ('sql', 'sql'), ('javascript', 'javascript'), ('clike', 'clike'), ('markup', 'markup'), ('java', 'java'), ]
colour_choices = [('white', 'White'), ('grey', 'Grey'), ('blue', 'Blue')] column_choices = [('12', 'Full Width'), ('11', '11/12'), ('10', '5/6'), ('9', 'Three Quarters'), ('8', 'Two Thirds'), ('7', '7/12'), ('6', 'Half Width'), ('5', '5/12'), ('4', 'One Third'), ('3', 'One Quarter'), ('2', '1/6'), ('1', '1/12')] language_choices = [('python', 'python'), ('css', 'css'), ('sql', 'sql'), ('javascript', 'javascript'), ('clike', 'clike'), ('markup', 'markup'), ('java', 'java')]
#$Id$# class ExchangeRateList: """This class is used to create object for Exchange Rate List.""" def __init__(self): """Initialize parameters for exchange rate list.""" self.exchange_rates = [] def set_exchange_rates(self, exchange_rate): """Set exchange rate. Args: exchange_rate(instance): Exchange rate. """ self.exchange_rates.append(exchange_rate) def get_exchange_rates(self): """Get exchange rate. Returns: list of instance: List of exchange rate object. """ return self.exchange_rates
class Exchangeratelist: """This class is used to create object for Exchange Rate List.""" def __init__(self): """Initialize parameters for exchange rate list.""" self.exchange_rates = [] def set_exchange_rates(self, exchange_rate): """Set exchange rate. Args: exchange_rate(instance): Exchange rate. """ self.exchange_rates.append(exchange_rate) def get_exchange_rates(self): """Get exchange rate. Returns: list of instance: List of exchange rate object. """ return self.exchange_rates
x = 1 # int y = 2.8 # float z = 1j # complex # convert from int to float a = float(x) # convert from float to int b = int(y) # convert from int to complex c = complex(x) print(a) print(b) print(c) print(type(a)) print(type(b)) print(type(c))
x = 1 y = 2.8 z = 1j a = float(x) b = int(y) c = complex(x) print(a) print(b) print(c) print(type(a)) print(type(b)) print(type(c))
"""Module containing the exception class for regexapp.""" class PatternError(Exception): """Use to capture error during pattern conversion.""" class EscapePatternError(PatternError): """Use to capture error during performing do_soft_regex_escape""" class PatternReferenceError(PatternError): """Use to capture error for PatternReference instance""" class TextPatternError(Exception): """Use to capture error during pattern conversion.""" class ElementPatternError(Exception): """Use to capture error during pattern conversion.""" class LinePatternError(PatternError): """Use to capture error during pattern conversion.""" class MultilinePatternError(PatternError): """Use to capture error during pattern conversion.""" class PatternBuilderError(PatternError): """Use to capture error during pattern conversion.""" class RegexBuilderError(Exception): """Use to capture error for RegexBuilder class."""
"""Module containing the exception class for regexapp.""" class Patternerror(Exception): """Use to capture error during pattern conversion.""" class Escapepatternerror(PatternError): """Use to capture error during performing do_soft_regex_escape""" class Patternreferenceerror(PatternError): """Use to capture error for PatternReference instance""" class Textpatternerror(Exception): """Use to capture error during pattern conversion.""" class Elementpatternerror(Exception): """Use to capture error during pattern conversion.""" class Linepatternerror(PatternError): """Use to capture error during pattern conversion.""" class Multilinepatternerror(PatternError): """Use to capture error during pattern conversion.""" class Patternbuildererror(PatternError): """Use to capture error during pattern conversion.""" class Regexbuildererror(Exception): """Use to capture error for RegexBuilder class."""
class Identifier: def __init__(self, id): self.id = id def eval(self, env): if self.id in env: return env[self.id] else: error("Referencing " + self.id + " before assignment") def __repr__(self): return "Identifier: {0}".format(self.id)
class Identifier: def __init__(self, id): self.id = id def eval(self, env): if self.id in env: return env[self.id] else: error('Referencing ' + self.id + ' before assignment') def __repr__(self): return 'Identifier: {0}'.format(self.id)
WORKERS = 50 RESULT_FILE = 'results.json' ZIP_CODE_FILE = './reference/zips.csv'
workers = 50 result_file = 'results.json' zip_code_file = './reference/zips.csv'
NAME = 'send_message.py' ORIGINAL_AUTHORS = [ 'Justin Walker' ] ABOUT = ''' Sends a message to another channel. ''' COMMANDS = ''' >>> .send #channel .u riceabove .m how are you? Sends a message to #channel like 'IronPenguin from #channel says to riceabove: how are you?' >>> .send #channel hi all Sends a message to #channel like 'IronPenguin from #channel says: hi all' Checks if user online first and says "User not online." ''' WEBSITE = ''
name = 'send_message.py' original_authors = ['Justin Walker'] about = '\nSends a message to another channel.\n' commands = '\n>>> .send #channel .u riceabove .m how are you?\nSends a message to #channel like\n\'IronPenguin from #channel says to riceabove: how are you?\'\n\n>>> .send #channel hi all\nSends a message to #channel like\n\'IronPenguin from #channel says: hi all\'\n\nChecks if user online first and says "User not online."\n' website = ''
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def printList(self): temp = self.head while temp : print(temp.data, end=" ") temp = temp.next def append(self, new_data): new_node = Node(new_data) if self.head is None: self.head = new_node return last = self.head while last.next: last = last.next last.next = new_node def mergeLists(head1, head2): temp = None if head1 == None: return head2 if head2 == None: return head1 if head1.data <= head2.data: temp = head1 temp.next = mergeLists(head1.next, head2) else: temp = head2 temp.next = mergeLists(head1, head2.next) return temp if __name__ == '__main__': list1 = LinkedList() list1.append(10) list1.append(20) list1.append(30) list1.append(40) list1.append(50) list1.append(60) list2 = LinkedList() list2.append(15) list2.append(25) list2.append(35) list2.append(45) list2.append(55) list2.append(65) list3 = LinkedList() list3.head = mergeLists(list1.head, list2.head) print(" Merged Linked List is : ", end="") list3.printList()
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def print_list(self): temp = self.head while temp: print(temp.data, end=' ') temp = temp.next def append(self, new_data): new_node = node(new_data) if self.head is None: self.head = new_node return last = self.head while last.next: last = last.next last.next = new_node def merge_lists(head1, head2): temp = None if head1 == None: return head2 if head2 == None: return head1 if head1.data <= head2.data: temp = head1 temp.next = merge_lists(head1.next, head2) else: temp = head2 temp.next = merge_lists(head1, head2.next) return temp if __name__ == '__main__': list1 = linked_list() list1.append(10) list1.append(20) list1.append(30) list1.append(40) list1.append(50) list1.append(60) list2 = linked_list() list2.append(15) list2.append(25) list2.append(35) list2.append(45) list2.append(55) list2.append(65) list3 = linked_list() list3.head = merge_lists(list1.head, list2.head) print(' Merged Linked List is : ', end='') list3.printList()
class IUserCommandRepository: def create_user(self, user): pass def update_user_auth_token(self, user_id, auth_token): pass def increment_user_score(self, user_id, score): pass
class Iusercommandrepository: def create_user(self, user): pass def update_user_auth_token(self, user_id, auth_token): pass def increment_user_score(self, user_id, score): pass
out = [] push = out.append concate = ' '.join while True: try: a, b = [int(x) for x in input().split()] except EOFError: break ans = [] ans_append = ans.append for num in range(a, b+1): num = str(num) length = len(num) check = str(sum(pow(int(x), length) for x in num)) if check == num: ans_append(num) if ans: push(concate(ans)) else: push("none") print(*out, sep='\n')
out = [] push = out.append concate = ' '.join while True: try: (a, b) = [int(x) for x in input().split()] except EOFError: break ans = [] ans_append = ans.append for num in range(a, b + 1): num = str(num) length = len(num) check = str(sum((pow(int(x), length) for x in num))) if check == num: ans_append(num) if ans: push(concate(ans)) else: push('none') print(*out, sep='\n')
def characters_between(start: str, end: str): start = ord(start) end = ord(end) if start < end: for letter in range(start + 1, end): print(chr(letter), end=' ') else: for i in range(end + 1, start, -1): print(chr(i), end=' ') a = input() b = input() characters_between(a, b)
def characters_between(start: str, end: str): start = ord(start) end = ord(end) if start < end: for letter in range(start + 1, end): print(chr(letter), end=' ') else: for i in range(end + 1, start, -1): print(chr(i), end=' ') a = input() b = input() characters_between(a, b)
def solve(sudoku): find = find_empty(sudoku) if not find: return True else: row, col = find for i in range(1,10): if valid(sudoku, i, (row, col)): sudoku[row][col] = i if solve(sudoku): return True sudoku[row][col] = 0 return False def valid(sudoku, num, pos): # Check row for i in range(len(sudoku[0])): if sudoku[pos[0]][i] == num and pos[1] != i: return False # Check column for i in range(len(sudoku)): if sudoku[i][pos[1]] == num and pos[0] != i: return False # Check box box_x = pos[1] // 3 box_y = pos[0] // 3 for i in range(box_y*3, box_y*3 + 3): for j in range(box_x * 3, box_x*3 + 3): if sudoku[i][j] == num and (i,j) != pos: return False return True def find_empty(sudoku): for i in range(len(sudoku)): for j in range(len(sudoku[0])): if sudoku[i][j] == 0: return (i, j) # row, col return None
def solve(sudoku): find = find_empty(sudoku) if not find: return True else: (row, col) = find for i in range(1, 10): if valid(sudoku, i, (row, col)): sudoku[row][col] = i if solve(sudoku): return True sudoku[row][col] = 0 return False def valid(sudoku, num, pos): for i in range(len(sudoku[0])): if sudoku[pos[0]][i] == num and pos[1] != i: return False for i in range(len(sudoku)): if sudoku[i][pos[1]] == num and pos[0] != i: return False box_x = pos[1] // 3 box_y = pos[0] // 3 for i in range(box_y * 3, box_y * 3 + 3): for j in range(box_x * 3, box_x * 3 + 3): if sudoku[i][j] == num and (i, j) != pos: return False return True def find_empty(sudoku): for i in range(len(sudoku)): for j in range(len(sudoku[0])): if sudoku[i][j] == 0: return (i, j) return None
MONGODB_URI = "mongodb://localhost:27017" MONGODB_DATABASE = 'Cose2' MONGODB_USER_COLLECTION = 'users' MONGODB_TOPIC_COLLECTION = 'topics' MONGODB_COMMENT_COLLECTION = 'comments'
mongodb_uri = 'mongodb://localhost:27017' mongodb_database = 'Cose2' mongodb_user_collection = 'users' mongodb_topic_collection = 'topics' mongodb_comment_collection = 'comments'
# # Copyright (c) 2010-2016, Fabric Software Inc. All rights reserved. # ext.add_cpp_quoted_include('Opaque.hpp') ty = ext.add_opaque_type('MyOpaque') ty = ext.add_opaque_type('MyOpaqueDer', extends='MyOpaque') ext.add_func('MyOpaque_New', 'MyOpaque *', ['int']) ext.add_func('MyOpaque_GetX', 'int', ['MyOpaque *']) ext.add_func('MyOpaque_SetX', None, ['MyOpaque *', 'int']) ext.add_func('MyOpaque_Delete', None, ['MyOpaque *']) ext.add_func('MyOpaqueDer_New', 'MyOpaqueDer *', ['int', 'float']) ext.add_func('MyOpaqueDer_GetY', 'float', ['MyOpaqueDer *']) ext.add_func('MyOpaqueDer_SetY', None, ['MyOpaqueDer *', 'float']) ext.add_func('MyOpaqueDer_Delete', None, ['MyOpaqueDer *']) ext.add_test(""" MyOpaqueDer o; report(o); o = MyOpaqueDer_New(17, 3.14); report(o); report(MyOpaque_GetX(o)); MyOpaque_SetX(o, 42); report(MyOpaque_GetX(o)); report(MyOpaqueDer_GetY(o)); MyOpaqueDer_SetY(o, 1.24); report(MyOpaqueDer_GetY(o)); MyOpaque oo; report(oo); oo = o; report(oo); MyOpaqueDer_Delete(o); """, """ MyOpaqueDer:OPAQUE (null) MyOpaqueDer:OPAQUE 17 42 +3.14 +1.24 MyOpaque:OPAQUE (null) MyOpaque:OPAQUE """)
ext.add_cpp_quoted_include('Opaque.hpp') ty = ext.add_opaque_type('MyOpaque') ty = ext.add_opaque_type('MyOpaqueDer', extends='MyOpaque') ext.add_func('MyOpaque_New', 'MyOpaque *', ['int']) ext.add_func('MyOpaque_GetX', 'int', ['MyOpaque *']) ext.add_func('MyOpaque_SetX', None, ['MyOpaque *', 'int']) ext.add_func('MyOpaque_Delete', None, ['MyOpaque *']) ext.add_func('MyOpaqueDer_New', 'MyOpaqueDer *', ['int', 'float']) ext.add_func('MyOpaqueDer_GetY', 'float', ['MyOpaqueDer *']) ext.add_func('MyOpaqueDer_SetY', None, ['MyOpaqueDer *', 'float']) ext.add_func('MyOpaqueDer_Delete', None, ['MyOpaqueDer *']) ext.add_test('\nMyOpaqueDer o;\nreport(o);\no = MyOpaqueDer_New(17, 3.14);\nreport(o);\nreport(MyOpaque_GetX(o));\nMyOpaque_SetX(o, 42);\nreport(MyOpaque_GetX(o));\nreport(MyOpaqueDer_GetY(o));\nMyOpaqueDer_SetY(o, 1.24);\nreport(MyOpaqueDer_GetY(o));\nMyOpaque oo;\nreport(oo);\noo = o;\nreport(oo);\nMyOpaqueDer_Delete(o);\n', '\nMyOpaqueDer:OPAQUE (null)\nMyOpaqueDer:OPAQUE\n17\n42\n+3.14\n+1.24\nMyOpaque:OPAQUE (null)\nMyOpaque:OPAQUE\n')
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/1/11 12:10 # @File : leetCode_459.py class Solution(object): def repeatedSubstringPattern(self, s): """ :type s: str :rtype: bool """ for i in range(len(s)): tmp = s[i: i+2] for j in range(1, len(tmp)-1): if s[j:2] == tmp: return True return False # size = len(s) # next = [0] * size # for i in range(1, size): # k = next[i - 1] # while s[i] != s[k] and k: # k = next[k - 1] # if s[i] == s[k]: # next[i] = k + 1 # p = next[-1] # return p > 0 and size % (size - p) == 0 print(Solution().repeatedSubstringPattern("bb")) print(Solution().repeatedSubstringPattern("aba"))
class Solution(object): def repeated_substring_pattern(self, s): """ :type s: str :rtype: bool """ for i in range(len(s)): tmp = s[i:i + 2] for j in range(1, len(tmp) - 1): if s[j:2] == tmp: return True return False print(solution().repeatedSubstringPattern('bb')) print(solution().repeatedSubstringPattern('aba'))
''' Created on Mar 31, 2018 @author: Burkhard A. Meier ''' # list with loop loop_numbers = [] # create an empty list for number in range(1, 101): # use for loop loop_numbers.append(number) # append 100 numbers to list print(loop_numbers) # list comprehension comp_numbers = [ number for number in range(1, 101) ] # create a new list print(comp_numbers) # list comprehension with added condition comp_numbers_three = [ number for number in range(1, 101) if number % 3 == 0 ] # multiples of three print(comp_numbers_three)
""" Created on Mar 31, 2018 @author: Burkhard A. Meier """ loop_numbers = [] for number in range(1, 101): loop_numbers.append(number) print(loop_numbers) comp_numbers = [number for number in range(1, 101)] print(comp_numbers) comp_numbers_three = [number for number in range(1, 101) if number % 3 == 0] print(comp_numbers_three)
Rt = [[1,2,3 ], [2, 4, 5], [3,6,7], [4,8,9],[5,10,11],[6,12,13],[7,14,15]] def findRoot(RT): S = set() for i in RT: for j in i: S.add( j ) print (S) for i in RT : for j in i[1:]: S.remove( j ) print (S) try : for i in S : retval = i break return retval except : print ("Not a tree") print ( findRoot (Rt)) def LocateNode(RT, nd): ret_tuple = None for i in RT: if ( i[0] == nd ): ret_tuple = i break #return i if (ret_tuple == None ): return False, () else: return True, ret_tuple def isLeaf (RT, nd): for i in RT: if ( i[0] == nd ): return False return True preordered_list = [] def walk(RT, root, path): flag, rootTuple = LocateNode(RT, root) if (flag == False ): pass else: dirs = [] files = [] for ch in rootTuple[1:]: if (isLeaf (RT, ch) ): files.append(ch) else: dirs.append(ch) #endif #endfor preordered_list.append((path , dirs, files)) for ch in rootTuple[1:]: walk(RT, ch, path + [ch]) #endfor #endif walk (Rt, 1, [1]) print (preordered_list)
rt = [[1, 2, 3], [2, 4, 5], [3, 6, 7], [4, 8, 9], [5, 10, 11], [6, 12, 13], [7, 14, 15]] def find_root(RT): s = set() for i in RT: for j in i: S.add(j) print(S) for i in RT: for j in i[1:]: S.remove(j) print(S) try: for i in S: retval = i break return retval except: print('Not a tree') print(find_root(Rt)) def locate_node(RT, nd): ret_tuple = None for i in RT: if i[0] == nd: ret_tuple = i break if ret_tuple == None: return (False, ()) else: return (True, ret_tuple) def is_leaf(RT, nd): for i in RT: if i[0] == nd: return False return True preordered_list = [] def walk(RT, root, path): (flag, root_tuple) = locate_node(RT, root) if flag == False: pass else: dirs = [] files = [] for ch in rootTuple[1:]: if is_leaf(RT, ch): files.append(ch) else: dirs.append(ch) preordered_list.append((path, dirs, files)) for ch in rootTuple[1:]: walk(RT, ch, path + [ch]) walk(Rt, 1, [1]) print(preordered_list)
def f(param): """ Args: param """
def f(param): """ Args: param """