content
stringlengths 7
1.05M
|
---|
#MAP
# def fahrenheit(T):
# return (9/5) * T + 32
temp = [9,22,40,90,120]
# for t in temp:
# print(fahrenheit(t))
# print(list(map(fahrenheit, temp)))
# print(list(map(lambda t:(9/5)*t+32,temp)))
#FILTER
pares = [1,2,3,4,8,10,11,15,16,28,24,20]
# print(list(filter(lambda x: x%2 == 0, pares)))
#ZIP
x = [1,2,3,4,87,65,84,87,96,258]
y = [4,5,6,256,245,635,85,96,256,485]
a = [1,2,3,5,5,2]
b = [2,3,25,2]
c = [2,4,2,5]
# print(list(zip(a,b,c)))
# for i in zip(x,y):
# print(max(i))
#enumerate
lista = ['a','b','c','d']
# for number, item in enumerate(lista):
# # print(number, ':', item)
teste = ('How long are the words in this phrase')
# quebrado = word_lengths.split()
# print(len(quebrado.split()))
def word_lengths(phrase):
return list(map(len, phrase.split()))
print(word_lengths(teste))
|
#
# PySNMP MIB module RSVP-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/RSVP-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:27:32 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( ObjectIdentifier, OctetString, Integer, ) = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
( ifIndex, InterfaceIndex, ) = mibBuilder.importSymbols("IF-MIB", "ifIndex", "InterfaceIndex")
( MessageSize, Port, Protocol, BurstSize, QosService, BitRate, SessionNumber, intSrvFlowStatus, SessionType, ) = mibBuilder.importSymbols("INTEGRATED-SERVICES-MIB", "MessageSize", "Port", "Protocol", "BurstSize", "QosService", "BitRate", "SessionNumber", "intSrvFlowStatus", "SessionType")
( NotificationGroup, ModuleCompliance, ObjectGroup, ) = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
( Unsigned32, TimeTicks, ObjectIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, Bits, Counter32, IpAddress, ModuleIdentity, iso, mib_2, Counter64, NotificationType, Integer32, ) = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "TimeTicks", "ObjectIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "Bits", "Counter32", "IpAddress", "ModuleIdentity", "iso", "mib-2", "Counter64", "NotificationType", "Integer32")
( TextualConvention, TestAndIncr, TimeInterval, DisplayString, TimeStamp, RowStatus, TruthValue, ) = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TestAndIncr", "TimeInterval", "DisplayString", "TimeStamp", "RowStatus", "TruthValue")
rsvp = ModuleIdentity((1, 3, 6, 1, 2, 1, 51))
if mibBuilder.loadTexts: rsvp.setLastUpdated('9511030500Z')
if mibBuilder.loadTexts: rsvp.setOrganization('IETF RSVP Working Group')
if mibBuilder.loadTexts: rsvp.setContactInfo(' Fred Baker\n Postal: Cisco Systems\n 519 Lado Drive\n Santa Barbara, California 93111\n Tel: +1 805 681 0115\n E-Mail: [email protected]\n\n John Krawczyk\n Postal: ArrowPoint Communications\n 235 Littleton Road\n Westford, Massachusetts 01886\n Tel: +1 508 692 5875\n E-Mail: [email protected]\n\n Arun Sastry\n Postal: Cisco Systems\n 210 W. Tasman Drive\n San Jose, California 95134\n Tel: +1 408 526 7685\n E-Mail: [email protected]')
if mibBuilder.loadTexts: rsvp.setDescription('The MIB module to describe the RSVP Protocol')
rsvpObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 51, 1))
rsvpGenObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 51, 2))
rsvpNotificationsPrefix = MibIdentifier((1, 3, 6, 1, 2, 1, 51, 3))
rsvpConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 51, 4))
class RsvpEncapsulation(Integer32, TextualConvention):
subtypeSpec = Integer32.subtypeSpec+ConstraintsUnion(SingleValueConstraint(1, 2, 3,))
namedValues = NamedValues(("ip", 1), ("udp", 2), ("both", 3),)
class RefreshInterval(Integer32, TextualConvention):
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,2147483647)
rsvpSessionTable = MibTable((1, 3, 6, 1, 2, 1, 51, 1, 1), )
if mibBuilder.loadTexts: rsvpSessionTable.setDescription('A table of all sessions seen by a given sys-\n tem.')
rsvpSessionEntry = MibTableRow((1, 3, 6, 1, 2, 1, 51, 1, 1, 1), ).setIndexNames((0, "RSVP-MIB", "rsvpSessionNumber"))
if mibBuilder.loadTexts: rsvpSessionEntry.setDescription('A single session seen by a given system.')
rsvpSessionNumber = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 1), SessionNumber())
if mibBuilder.loadTexts: rsvpSessionNumber.setDescription('The number of this session. This is for SNMP\n\n Indexing purposes only and has no relation to\n any protocol value.')
rsvpSessionType = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 2), SessionType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSessionType.setDescription('The type of session (IP4, IP6, IP6 with flow\n information, etc).')
rsvpSessionDestAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSessionDestAddr.setDescription("The destination address used by all senders in\n this session. This object may not be changed\n when the value of the RowStatus object is 'ac-\n tive'.")
rsvpSessionDestAddrLength = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSessionDestAddrLength.setDescription("The CIDR prefix length of the session address,\n which is 32 for IP4 host and multicast ad-\n dresses, and 128 for IP6 addresses. This ob-\n ject may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpSessionProtocol = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 5), Protocol()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSessionProtocol.setDescription("The IP Protocol used by this session. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpSessionPort = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 6), Port()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSessionPort.setDescription("The UDP or TCP port number used as a destina-\n tion port for all senders in this session. If\n the IP protocol in use, specified by rsvpSen-\n derProtocol, is 50 (ESP) or 51 (AH), this\n represents a virtual destination port number.\n A value of zero indicates that the IP protocol\n in use does not have ports. This object may\n not be changed when the value of the RowStatus\n object is 'active'.")
rsvpSessionSenders = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 7), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSessionSenders.setDescription('The number of distinct senders currently known\n to be part of this session.')
rsvpSessionReceivers = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 8), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSessionReceivers.setDescription('The number of reservations being requested of\n this system for this session.')
rsvpSessionRequests = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 1, 1, 9), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSessionRequests.setDescription('The number of reservation requests this system\n is sending upstream for this session.')
rsvpBadPackets = MibScalar((1, 3, 6, 1, 2, 1, 51, 2, 1), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpBadPackets.setDescription('This object keeps a count of the number of bad\n RSVP packets received.')
rsvpSenderNewIndex = MibScalar((1, 3, 6, 1, 2, 1, 51, 2, 2), TestAndIncr()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rsvpSenderNewIndex.setDescription("This object is used to assign values to\n rsvpSenderNumber as described in 'Textual Con-\n ventions for SNMPv2'. The network manager\n reads the object, and then writes the value\n back in the SET that creates a new instance of\n rsvpSenderEntry. If the SET fails with the\n code 'inconsistentValue', then the process must\n be repeated; If the SET succeeds, then the ob-\n ject is incremented, and the new instance is\n created according to the manager's directions.")
rsvpSenderTable = MibTable((1, 3, 6, 1, 2, 1, 51, 1, 2), )
if mibBuilder.loadTexts: rsvpSenderTable.setDescription('Information describing the state information\n displayed by senders in PATH messages.')
rsvpSenderEntry = MibTableRow((1, 3, 6, 1, 2, 1, 51, 1, 2, 1), ).setIndexNames((0, "RSVP-MIB", "rsvpSessionNumber"), (0, "RSVP-MIB", "rsvpSenderNumber"))
if mibBuilder.loadTexts: rsvpSenderEntry.setDescription("Information describing the state information\n displayed by a single sender's PATH message.")
rsvpSenderNumber = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 1), SessionNumber())
if mibBuilder.loadTexts: rsvpSenderNumber.setDescription('The number of this sender. This is for SNMP\n Indexing purposes only and has no relation to\n any protocol value.')
rsvpSenderType = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 2), SessionType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderType.setDescription('The type of session (IP4, IP6, IP6 with flow\n information, etc).')
rsvpSenderDestAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderDestAddr.setDescription("The destination address used by all senders in\n this session. This object may not be changed\n when the value of the RowStatus object is 'ac-\n tive'.")
rsvpSenderAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAddr.setDescription("The source address used by this sender in this\n session. This object may not be changed when\n the value of the RowStatus object is 'active'.")
rsvpSenderDestAddrLength = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,128))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderDestAddrLength.setDescription("The length of the destination address in bits.\n This is the CIDR Prefix Length, which for IP4\n hosts and multicast addresses is 32 bits. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpSenderAddrLength = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,128))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAddrLength.setDescription("The length of the sender's address in bits.\n This is the CIDR Prefix Length, which for IP4\n hosts and multicast addresses is 32 bits. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpSenderProtocol = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 7), Protocol()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderProtocol.setDescription("The IP Protocol used by this session. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpSenderDestPort = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 8), Port()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderDestPort.setDescription("The UDP or TCP port number used as a destina-\n tion port for all senders in this session. If\n the IP protocol in use, specified by rsvpSen-\n derProtocol, is 50 (ESP) or 51 (AH), this\n represents a virtual destination port number.\n A value of zero indicates that the IP protocol\n in use does not have ports. This object may\n not be changed when the value of the RowStatus\n object is 'active'.")
rsvpSenderPort = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 9), Port()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderPort.setDescription("The UDP or TCP port number used as a source\n port for this sender in this session. If the\n IP protocol in use, specified by rsvpSenderPro-\n tocol is 50 (ESP) or 51 (AH), this represents a\n generalized port identifier (GPI). A value of\n zero indicates that the IP protocol in use does\n not have ports. This object may not be changed\n when the value of the RowStatus object is 'ac-\n tive'.")
rsvpSenderFlowId = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,16777215))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSenderFlowId.setDescription('The flow ID that this sender is using, if\n this is an IPv6 session.')
rsvpSenderHopAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderHopAddr.setDescription('The address used by the previous RSVP hop\n (which may be the original sender).')
rsvpSenderHopLih = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 12), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderHopLih.setDescription('The Logical Interface Handle used by the pre-\n vious RSVP hop (which may be the original\n sender).')
rsvpSenderInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 13), InterfaceIndex()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderInterface.setDescription('The ifIndex value of the interface on which\n this PATH message was most recently received.')
rsvpSenderTSpecRate = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 14), BitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderTSpecRate.setDescription("The Average Bit Rate of the sender's data\n stream. Within a transmission burst, the ar-\n rival rate may be as fast as rsvpSenderTSpec-\n PeakRate (if supported by the service model);\n however, averaged across two or more burst in-\n tervals, the rate should not exceed rsvpSen-\n derTSpecRate.\n\n Note that this is a prediction, often based on\n the general capability of a type of codec or\n particular encoding; the measured average rate\n may be significantly lower.")
rsvpSenderTSpecPeakRate = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 15), BitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderTSpecPeakRate.setDescription("The Peak Bit Rate of the sender's data stream.\n Traffic arrival is not expected to exceed this\n rate at any time, apart from the effects of\n jitter in the network. If not specified in the\n TSpec, this returns zero or noSuchValue.")
rsvpSenderTSpecBurst = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 16), BurstSize()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderTSpecBurst.setDescription('The size of the largest burst expected from\n the sender at a time.')
rsvpSenderTSpecMinTU = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 17), MessageSize()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderTSpecMinTU.setDescription('The minimum message size for this flow. The\n policing algorithm will treat smaller messages\n as though they are this size.')
rsvpSenderTSpecMaxTU = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 18), MessageSize()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderTSpecMaxTU.setDescription('The maximum message size for this flow. The\n admission algorithm will reject TSpecs whose\n Maximum Transmission Unit, plus the interface\n headers, exceed the interface MTU.')
rsvpSenderInterval = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 19), RefreshInterval()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderInterval.setDescription('The interval between refresh messages as ad-\n\n vertised by the Previous Hop.')
rsvpSenderRSVPHop = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 20), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderRSVPHop.setDescription('If TRUE, the node believes that the previous\n IP hop is an RSVP hop. If FALSE, the node be-\n lieves that the previous IP hop may not be an\n RSVP hop.')
rsvpSenderLastChange = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 21), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSenderLastChange.setDescription('The time of the last change in this PATH mes-\n sage; This is either the first time it was re-\n ceived or the time of the most recent change in\n parameters.')
rsvpSenderPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 22), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,65536))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderPolicy.setDescription('The contents of the policy object, displayed\n as an uninterpreted string of octets, including\n the object header. In the absence of such an\n object, this should be of zero length.')
rsvpSenderAdspecBreak = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 23), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecBreak.setDescription('The global break bit general characterization\n parameter from the ADSPEC. If TRUE, at least\n one non-IS hop was detected in the path. If\n\n FALSE, no non-IS hops were detected.')
rsvpSenderAdspecHopCount = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecHopCount.setDescription('The hop count general characterization parame-\n ter from the ADSPEC. A return of zero or\n noSuchValue indicates one of the following con-\n ditions:\n\n the invalid bit was set\n the parameter was not present')
rsvpSenderAdspecPathBw = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 25), BitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecPathBw.setDescription('The path bandwidth estimate general character-\n ization parameter from the ADSPEC. A return of\n zero or noSuchValue indicates one of the fol-\n lowing conditions:\n\n the invalid bit was set\n the parameter was not present')
rsvpSenderAdspecMinLatency = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 26), Integer32()).setUnits('microseconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecMinLatency.setDescription('The minimum path latency general characteriza-\n tion parameter from the ADSPEC. A return of\n zero or noSuchValue indicates one of the fol-\n lowing conditions:\n\n the invalid bit was set\n the parameter was not present')
rsvpSenderAdspecMtu = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecMtu.setDescription('The composed Maximum Transmission Unit general\n characterization parameter from the ADSPEC. A\n return of zero or noSuchValue indicates one of\n the following conditions:\n\n the invalid bit was set\n the parameter was not present')
rsvpSenderAdspecGuaranteedSvc = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 28), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedSvc.setDescription('If TRUE, the ADSPEC contains a Guaranteed Ser-\n vice fragment. If FALSE, the ADSPEC does not\n contain a Guaranteed Service fragment.')
rsvpSenderAdspecGuaranteedBreak = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 29), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedBreak.setDescription("If TRUE, the Guaranteed Service fragment has\n its 'break' bit set, indicating that one or\n more nodes along the path do not support the\n guaranteed service. If FALSE, and rsvpSen-\n derAdspecGuaranteedSvc is TRUE, the 'break' bit\n is not set.\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n returns FALSE or noSuchValue.")
rsvpSenderAdspecGuaranteedCtot = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 30), Integer32()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedCtot.setDescription("If rsvpSenderAdspecGuaranteedSvc is TRUE, this\n is the end-to-end composed value for the\n guaranteed service 'C' parameter. A return of\n zero or noSuchValue indicates one of the fol-\n lowing conditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n returns zero or noSuchValue.")
rsvpSenderAdspecGuaranteedDtot = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 31), Integer32()).setUnits('microseconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedDtot.setDescription("If rsvpSenderAdspecGuaranteedSvc is TRUE, this\n is the end-to-end composed value for the\n guaranteed service 'D' parameter. A return of\n zero or noSuchValue indicates one of the fol-\n lowing conditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n returns zero or noSuchValue.")
rsvpSenderAdspecGuaranteedCsum = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 32), Integer32()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedCsum.setDescription("If rsvpSenderAdspecGuaranteedSvc is TRUE, this\n is the composed value for the guaranteed ser-\n\n vice 'C' parameter since the last reshaping\n point. A return of zero or noSuchValue indi-\n cates one of the following conditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n returns zero or noSuchValue.")
rsvpSenderAdspecGuaranteedDsum = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 33), Integer32()).setUnits('microseconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedDsum.setDescription("If rsvpSenderAdspecGuaranteedSvc is TRUE, this\n is the composed value for the guaranteed ser-\n vice 'D' parameter since the last reshaping\n point. A return of zero or noSuchValue indi-\n cates one of the following conditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n returns zero or noSuchValue.")
rsvpSenderAdspecGuaranteedHopCount = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 34), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedHopCount.setDescription('If rsvpSenderAdspecGuaranteedSvc is TRUE, this\n is the service-specific override of the hop\n count general characterization parameter from\n the ADSPEC. A return of zero or noSuchValue\n indicates one of the following conditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n\n returns zero or noSuchValue.')
rsvpSenderAdspecGuaranteedPathBw = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 35), BitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedPathBw.setDescription('If rsvpSenderAdspecGuaranteedSvc is TRUE, this\n is the service-specific override of the path\n bandwidth estimate general characterization\n parameter from the ADSPEC. A return of zero or\n noSuchValue indicates one of the following con-\n ditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n returns zero or noSuchValue.')
rsvpSenderAdspecGuaranteedMinLatency = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 36), Integer32()).setUnits('microseconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedMinLatency.setDescription('If rsvpSenderAdspecGuaranteedSvc is TRUE, this\n is the service-specific override of the minimum\n path latency general characterization parameter\n from the ADSPEC. A return of zero or noSuch-\n Value indicates one of the following condi-\n tions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n returns zero or noSuchValue.')
rsvpSenderAdspecGuaranteedMtu = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 37), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecGuaranteedMtu.setDescription('If rsvpSenderAdspecGuaranteedSvc is TRUE, this\n is the service-specific override of the com-\n posed Maximum Transmission Unit general charac-\n terization parameter from the ADSPEC. A return\n of zero or noSuchValue indicates one of the\n following conditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecGuaranteedSvc is FALSE, this\n returns zero or noSuchValue.')
rsvpSenderAdspecCtrlLoadSvc = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 38), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecCtrlLoadSvc.setDescription('If TRUE, the ADSPEC contains a Controlled Load\n Service fragment. If FALSE, the ADSPEC does\n not contain a Controlled Load Service frag-\n ment.')
rsvpSenderAdspecCtrlLoadBreak = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 39), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecCtrlLoadBreak.setDescription("If TRUE, the Controlled Load Service fragment\n has its 'break' bit set, indicating that one or\n more nodes along the path do not support the\n controlled load service. If FALSE, and\n rsvpSenderAdspecCtrlLoadSvc is TRUE, the\n 'break' bit is not set.\n\n If rsvpSenderAdspecCtrlLoadSvc is FALSE, this\n returns FALSE or noSuchValue.")
rsvpSenderAdspecCtrlLoadHopCount = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 40), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecCtrlLoadHopCount.setDescription('If rsvpSenderAdspecCtrlLoadSvc is TRUE, this\n is the service-specific override of the hop\n count general characterization parameter from\n the ADSPEC. A return of zero or noSuchValue\n indicates one of the following conditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecCtrlLoadSvc is FALSE, this\n returns zero or noSuchValue.')
rsvpSenderAdspecCtrlLoadPathBw = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 41), BitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecCtrlLoadPathBw.setDescription('If rsvpSenderAdspecCtrlLoadSvc is TRUE, this\n is the service-specific override of the path\n bandwidth estimate general characterization\n parameter from the ADSPEC. A return of zero or\n noSuchValue indicates one of the following con-\n ditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecCtrlLoadSvc is FALSE, this\n returns zero or noSuchValue.')
rsvpSenderAdspecCtrlLoadMinLatency = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 42), Integer32()).setUnits('microseconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecCtrlLoadMinLatency.setDescription('If rsvpSenderAdspecCtrlLoadSvc is TRUE, this\n\n is the service-specific override of the minimum\n path latency general characterization parameter\n from the ADSPEC. A return of zero or noSuch-\n Value indicates one of the following condi-\n tions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecCtrlLoadSvc is FALSE, this\n returns zero or noSuchValue.')
rsvpSenderAdspecCtrlLoadMtu = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 43), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderAdspecCtrlLoadMtu.setDescription('If rsvpSenderAdspecCtrlLoadSvc is TRUE, this\n is the service-specific override of the com-\n posed Maximum Transmission Unit general charac-\n terization parameter from the ADSPEC. A return\n of zero or noSuchValue indicates one of the\n following conditions:\n\n the invalid bit was set\n the parameter was not present\n\n If rsvpSenderAdspecCtrlLoadSvc is FALSE, this\n returns zero or noSuchValue.')
rsvpSenderStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 44), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpSenderStatus.setDescription("'active' for all active PATH messages. This\n object may be used to install static PATH in-\n formation or delete PATH information.")
rsvpSenderTTL = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 2, 1, 45), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSenderTTL.setDescription('The TTL value in the RSVP header that was last\n received.')
rsvpSenderOutInterfaceTable = MibTable((1, 3, 6, 1, 2, 1, 51, 1, 3), )
if mibBuilder.loadTexts: rsvpSenderOutInterfaceTable.setDescription('List of outgoing interfaces that PATH messages\n use. The ifIndex is the ifIndex value of the\n egress interface.')
rsvpSenderOutInterfaceEntry = MibTableRow((1, 3, 6, 1, 2, 1, 51, 1, 3, 1), ).setIndexNames((0, "RSVP-MIB", "rsvpSessionNumber"), (0, "RSVP-MIB", "rsvpSenderNumber"), (0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: rsvpSenderOutInterfaceEntry.setDescription('List of outgoing interfaces that a particular\n PATH message has.')
rsvpSenderOutInterfaceStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 3, 1, 1), RowStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpSenderOutInterfaceStatus.setDescription("'active' for all active PATH messages.")
rsvpResvNewIndex = MibScalar((1, 3, 6, 1, 2, 1, 51, 2, 3), TestAndIncr()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rsvpResvNewIndex.setDescription("This object is used to assign values to\n rsvpResvNumber as described in 'Textual Conven-\n tions for SNMPv2'. The network manager reads\n the object, and then writes the value back in\n the SET that creates a new instance of\n rsvpResvEntry. If the SET fails with the code\n 'inconsistentValue', then the process must be\n repeated; If the SET succeeds, then the object\n is incremented, and the new instance is created\n according to the manager's directions.")
rsvpResvTable = MibTable((1, 3, 6, 1, 2, 1, 51, 1, 4), )
if mibBuilder.loadTexts: rsvpResvTable.setDescription('Information describing the state information\n displayed by receivers in RESV messages.')
rsvpResvEntry = MibTableRow((1, 3, 6, 1, 2, 1, 51, 1, 4, 1), ).setIndexNames((0, "RSVP-MIB", "rsvpSessionNumber"), (0, "RSVP-MIB", "rsvpResvNumber"))
if mibBuilder.loadTexts: rsvpResvEntry.setDescription("Information describing the state information\n displayed by a single receiver's RESV message\n concerning a single sender.")
rsvpResvNumber = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 1), SessionNumber())
if mibBuilder.loadTexts: rsvpResvNumber.setDescription('The number of this reservation request. This\n is for SNMP Indexing purposes only and has no\n relation to any protocol value.')
rsvpResvType = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 2), SessionType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvType.setDescription('The type of session (IP4, IP6, IP6 with flow\n information, etc).')
rsvpResvDestAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvDestAddr.setDescription("The destination address used by all senders in\n this session. This object may not be changed\n when the value of the RowStatus object is 'ac-\n tive'.")
rsvpResvSenderAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvSenderAddr.setDescription("The source address of the sender selected by\n this reservation. The value of all zeroes in-\n dicates 'all senders'. This object may not be\n changed when the value of the RowStatus object\n is 'active'.")
rsvpResvDestAddrLength = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,128))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvDestAddrLength.setDescription("The length of the destination address in bits.\n This is the CIDR Prefix Length, which for IP4\n hosts and multicast addresses is 32 bits. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpResvSenderAddrLength = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,128))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvSenderAddrLength.setDescription("The length of the sender's address in bits.\n This is the CIDR Prefix Length, which for IP4\n hosts and multicast addresses is 32 bits. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpResvProtocol = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 7), Protocol()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvProtocol.setDescription("The IP Protocol used by this session. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpResvDestPort = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 8), Port()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvDestPort.setDescription("The UDP or TCP port number used as a destina-\n tion port for all senders in this session. If\n the IP protocol in use, specified by\n rsvpResvProtocol, is 50 (ESP) or 51 (AH), this\n represents a virtual destination port number.\n A value of zero indicates that the IP protocol\n in use does not have ports. This object may\n not be changed when the value of the RowStatus\n object is 'active'.")
rsvpResvPort = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 9), Port()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvPort.setDescription("The UDP or TCP port number used as a source\n port for this sender in this session. If the\n IP protocol in use, specified by rsvpResvProto-\n col is 50 (ESP) or 51 (AH), this represents a\n generalized port identifier (GPI). A value of\n zero indicates that the IP protocol in use does\n not have ports. This object may not be changed\n when the value of the RowStatus object is 'ac-\n tive'.")
rsvpResvHopAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvHopAddr.setDescription('The address used by the next RSVP hop (which\n may be the ultimate receiver).')
rsvpResvHopLih = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 11), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvHopLih.setDescription('The Logical Interface Handle received from the\n previous RSVP hop (which may be the ultimate\n receiver).')
rsvpResvInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 12), InterfaceIndex()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvInterface.setDescription('The ifIndex value of the interface on which\n this RESV message was most recently received.')
rsvpResvService = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 13), QosService()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvService.setDescription('The QoS Service classification requested by\n the receiver.')
rsvpResvTSpecRate = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 14), BitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvTSpecRate.setDescription("The Average Bit Rate of the sender's data\n\n stream. Within a transmission burst, the ar-\n rival rate may be as fast as rsvpResvTSpec-\n PeakRate (if supported by the service model);\n however, averaged across two or more burst in-\n tervals, the rate should not exceed\n rsvpResvTSpecRate.\n\n Note that this is a prediction, often based on\n the general capability of a type of codec or\n particular encoding; the measured average rate\n may be significantly lower.")
rsvpResvTSpecPeakRate = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 15), BitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvTSpecPeakRate.setDescription("The Peak Bit Rate of the sender's data stream.\n Traffic arrival is not expected to exceed this\n rate at any time, apart from the effects of\n jitter in the network. If not specified in the\n TSpec, this returns zero or noSuchValue.")
rsvpResvTSpecBurst = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 16), BurstSize()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvTSpecBurst.setDescription("The size of the largest burst expected from\n the sender at a time.\n\n If this is less than the sender's advertised\n burst size, the receiver is asking the network\n to provide flow pacing beyond what would be\n provided under normal circumstances. Such pac-\n ing is at the network's option.")
rsvpResvTSpecMinTU = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 17), MessageSize()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvTSpecMinTU.setDescription('The minimum message size for this flow. The\n policing algorithm will treat smaller messages\n as though they are this size.')
rsvpResvTSpecMaxTU = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 18), MessageSize()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvTSpecMaxTU.setDescription('The maximum message size for this flow. The\n admission algorithm will reject TSpecs whose\n Maximum Transmission Unit, plus the interface\n headers, exceed the interface MTU.')
rsvpResvRSpecRate = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 19), BitRate()).setUnits('bits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvRSpecRate.setDescription('If the requested service is Guaranteed, as\n specified by rsvpResvService, this is the\n clearing rate that is being requested. Other-\n wise, it is zero, or the agent may return\n noSuchValue.')
rsvpResvRSpecSlack = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 20), Integer32()).setUnits('microseconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvRSpecSlack.setDescription('If the requested service is Guaranteed, as\n specified by rsvpResvService, this is the delay\n slack. Otherwise, it is zero, or the agent may\n return noSuchValue.')
rsvpResvInterval = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 21), RefreshInterval()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvInterval.setDescription('The interval between refresh messages as ad-\n vertised by the Next Hop.')
rsvpResvScope = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 22), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0,65536))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvScope.setDescription('The contents of the scope object, displayed as\n an uninterpreted string of octets, including\n the object header. In the absence of such an\n object, this should be of zero length.\n\n If the length is non-zero, this contains a\n series of IP4 or IP6 addresses.')
rsvpResvShared = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 23), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvShared.setDescription('If TRUE, a reservation shared among senders is\n requested. If FALSE, a reservation specific to\n this sender is requested.')
rsvpResvExplicit = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 24), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvExplicit.setDescription('If TRUE, individual senders are listed using\n Filter Specifications. If FALSE, all senders\n are implicitly selected. The Scope Object will\n contain a list of senders that need to receive\n this reservation request for the purpose of\n routing the RESV message.')
rsvpResvRSVPHop = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 25), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvRSVPHop.setDescription('If TRUE, the node believes that the previous\n IP hop is an RSVP hop. If FALSE, the node be-\n lieves that the previous IP hop may not be an\n RSVP hop.')
rsvpResvLastChange = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 26), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvLastChange.setDescription('The time of the last change in this reserva-\n tion request; This is either the first time it\n was received or the time of the most recent\n change in parameters.')
rsvpResvPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 27), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0,65536))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvPolicy.setDescription('The contents of the policy object, displayed\n as an uninterpreted string of octets, including\n the object header. In the absence of such an\n object, this should be of zero length.')
rsvpResvStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 28), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpResvStatus.setDescription("'active' for all active RESV messages. This\n object may be used to install static RESV in-\n formation or delete RESV information.")
rsvpResvTTL = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 29), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvTTL.setDescription('The TTL value in the RSVP header that was last\n received.')
rsvpResvFlowId = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 4, 1, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,16777215))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFlowId.setDescription('The flow ID that this receiver is using, if\n this is an IPv6 session.')
rsvpResvFwdNewIndex = MibScalar((1, 3, 6, 1, 2, 1, 51, 2, 4), TestAndIncr()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rsvpResvFwdNewIndex.setDescription("This object is used to assign values to\n rsvpResvFwdNumber as described in 'Textual Con-\n ventions for SNMPv2'. The network manager\n reads the object, and then writes the value\n back in the SET that creates a new instance of\n rsvpResvFwdEntry. If the SET fails with the\n code 'inconsistentValue', then the process must\n be repeated; If the SET succeeds, then the ob-\n ject is incremented, and the new instance is\n created according to the manager's directions.")
rsvpResvFwdTable = MibTable((1, 3, 6, 1, 2, 1, 51, 1, 5), )
if mibBuilder.loadTexts: rsvpResvFwdTable.setDescription('Information describing the state information\n displayed upstream in RESV messages.')
rsvpResvFwdEntry = MibTableRow((1, 3, 6, 1, 2, 1, 51, 1, 5, 1), ).setIndexNames((0, "RSVP-MIB", "rsvpSessionNumber"), (0, "RSVP-MIB", "rsvpResvFwdNumber"))
if mibBuilder.loadTexts: rsvpResvFwdEntry.setDescription('Information describing the state information\n displayed upstream in an RESV message concern-\n ing a single sender.')
rsvpResvFwdNumber = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 1), SessionNumber())
if mibBuilder.loadTexts: rsvpResvFwdNumber.setDescription('The number of this reservation request. This\n is for SNMP Indexing purposes only and has no\n relation to any protocol value.')
rsvpResvFwdType = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 2), SessionType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdType.setDescription('The type of session (IP4, IP6, IP6 with flow\n information, etc).')
rsvpResvFwdDestAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdDestAddr.setDescription("The destination address used by all senders in\n this session. This object may not be changed\n when the value of the RowStatus object is 'ac-\n tive'.")
rsvpResvFwdSenderAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdSenderAddr.setDescription("The source address of the sender selected by\n this reservation. The value of all zeroes in-\n dicates 'all senders'. This object may not be\n changed when the value of the RowStatus object\n is 'active'.")
rsvpResvFwdDestAddrLength = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdDestAddrLength.setDescription("The length of the destination address in bits.\n This is the CIDR Prefix Length, which for IP4\n hosts and multicast addresses is 32 bits. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpResvFwdSenderAddrLength = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdSenderAddrLength.setDescription("The length of the sender's address in bits.\n This is the CIDR Prefix Length, which for IP4\n hosts and multicast addresses is 32 bits. This\n object may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpResvFwdProtocol = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 7), Protocol()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdProtocol.setDescription("The IP Protocol used by a session. for secure\n sessions, this indicates IP Security. This ob-\n ject may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpResvFwdDestPort = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 8), Port()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdDestPort.setDescription("The UDP or TCP port number used as a destina-\n tion port for all senders in this session. If\n\n the IP protocol in use, specified by\n rsvpResvFwdProtocol, is 50 (ESP) or 51 (AH),\n this represents a virtual destination port\n number. A value of zero indicates that the IP\n protocol in use does not have ports. This ob-\n ject may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpResvFwdPort = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 9), Port()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdPort.setDescription("The UDP or TCP port number used as a source\n port for this sender in this session. If the\n IP protocol in use, specified by\n rsvpResvFwdProtocol is 50 (ESP) or 51 (AH),\n this represents a generalized port identifier\n (GPI). A value of zero indicates that the IP\n protocol in use does not have ports. This ob-\n ject may not be changed when the value of the\n RowStatus object is 'active'.")
rsvpResvFwdHopAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdHopAddr.setDescription('The address of the (previous) RSVP that will\n receive this message.')
rsvpResvFwdHopLih = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdHopLih.setDescription('The Logical Interface Handle sent to the (pre-\n vious) RSVP that will receive this message.')
rsvpResvFwdInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 12), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdInterface.setDescription('The ifIndex value of the interface on which\n this RESV message was most recently sent.')
rsvpResvFwdService = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 13), QosService()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdService.setDescription('The QoS Service classification requested.')
rsvpResvFwdTSpecRate = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 14), BitRate()).setUnits('bits per second').setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdTSpecRate.setDescription("The Average Bit Rate of the sender's data\n stream. Within a transmission burst, the ar-\n rival rate may be as fast as rsvpResvFwdTSpec-\n PeakRate (if supported by the service model);\n however, averaged across two or more burst in-\n tervals, the rate should not exceed\n rsvpResvFwdTSpecRate.\n\n Note that this is a prediction, often based on\n the general capability of a type of codec or\n particular encoding; the measured average rate\n may be significantly lower.")
rsvpResvFwdTSpecPeakRate = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 15), BitRate()).setUnits('bits per second').setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdTSpecPeakRate.setDescription("The Peak Bit Rate of the sender's data stream\n Traffic arrival is not expected to exceed this\n rate at any time, apart from the effects of\n\n jitter in the network. If not specified in the\n TSpec, this returns zero or noSuchValue.")
rsvpResvFwdTSpecBurst = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 16), BurstSize()).setUnits('bytes').setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdTSpecBurst.setDescription("The size of the largest burst expected from\n the sender at a time.\n\n If this is less than the sender's advertised\n burst size, the receiver is asking the network\n to provide flow pacing beyond what would be\n provided under normal circumstances. Such pac-\n ing is at the network's option.")
rsvpResvFwdTSpecMinTU = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 17), MessageSize()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdTSpecMinTU.setDescription('The minimum message size for this flow. The\n policing algorithm will treat smaller messages\n as though they are this size.')
rsvpResvFwdTSpecMaxTU = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 18), MessageSize()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdTSpecMaxTU.setDescription('The maximum message size for this flow. The\n admission algorithm will reject TSpecs whose\n Maximum Transmission Unit, plus the interface\n headers, exceed the interface MTU.')
rsvpResvFwdRSpecRate = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 19), BitRate()).setUnits('bytes per second').setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdRSpecRate.setDescription('If the requested service is Guaranteed, as\n specified by rsvpResvService, this is the\n clearing rate that is being requested. Other-\n wise, it is zero, or the agent may return\n noSuchValue.')
rsvpResvFwdRSpecSlack = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 20), Integer32()).setUnits('microseconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdRSpecSlack.setDescription('If the requested service is Guaranteed, as\n specified by rsvpResvService, this is the delay\n slack. Otherwise, it is zero, or the agent may\n return noSuchValue.')
rsvpResvFwdInterval = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 21), RefreshInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdInterval.setDescription('The interval between refresh messages adver-\n tised to the Previous Hop.')
rsvpResvFwdScope = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 22), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0,65536))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdScope.setDescription('The contents of the scope object, displayed as\n an uninterpreted string of octets, including\n the object header. In the absence of such an\n object, this should be of zero length.')
rsvpResvFwdShared = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 23), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdShared.setDescription('If TRUE, a reservation shared among senders is\n requested. If FALSE, a reservation specific to\n this sender is requested.')
rsvpResvFwdExplicit = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 24), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdExplicit.setDescription('If TRUE, individual senders are listed using\n Filter Specifications. If FALSE, all senders\n are implicitly selected. The Scope Object will\n contain a list of senders that need to receive\n this reservation request for the purpose of\n routing the RESV message.')
rsvpResvFwdRSVPHop = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 25), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdRSVPHop.setDescription('If TRUE, the node believes that the next IP\n hop is an RSVP hop. If FALSE, the node be-\n lieves that the next IP hop may not be an RSVP\n hop.')
rsvpResvFwdLastChange = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 26), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdLastChange.setDescription('The time of the last change in this request;\n This is either the first time it was sent or\n the time of the most recent change in parame-\n ters.')
rsvpResvFwdPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 27), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0,65536))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdPolicy.setDescription('The contents of the policy object, displayed\n as an uninterpreted string of octets, including\n the object header. In the absence of such an\n object, this should be of zero length.')
rsvpResvFwdStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 28), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rsvpResvFwdStatus.setDescription("'active' for all active RESV messages. This\n object may be used to delete RESV information.")
rsvpResvFwdTTL = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 29), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdTTL.setDescription('The TTL value in the RSVP header that was last\n received.')
rsvpResvFwdFlowId = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 5, 1, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,16777215))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpResvFwdFlowId.setDescription('The flow ID that this receiver is using, if\n this is an IPv6 session.')
rsvpIfTable = MibTable((1, 3, 6, 1, 2, 1, 51, 1, 6), )
if mibBuilder.loadTexts: rsvpIfTable.setDescription("The RSVP-specific attributes of the system's\n interfaces.")
rsvpIfEntry = MibTableRow((1, 3, 6, 1, 2, 1, 51, 1, 6, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: rsvpIfEntry.setDescription('The RSVP-specific attributes of the a given\n interface.')
rsvpIfUdpNbrs = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 1), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpIfUdpNbrs.setDescription('The number of neighbors perceived to be using\n only the RSVP UDP Encapsulation.')
rsvpIfIpNbrs = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 2), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpIfIpNbrs.setDescription('The number of neighbors perceived to be using\n only the RSVP IP Encapsulation.')
rsvpIfNbrs = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 3), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rsvpIfNbrs.setDescription('The number of neighbors currently perceived;\n this will exceed rsvpIfIpNbrs + rsvpIfUdpNbrs\n by the number of neighbors using both encapsu-\n lations.')
rsvpIfRefreshBlockadeMultiple = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65536)).clone(4)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpIfRefreshBlockadeMultiple.setDescription("The value of the RSVP value 'Kb', Which is the\n minimum number of refresh intervals that\n blockade state will last once entered.")
rsvpIfRefreshMultiple = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65536)).clone(3)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpIfRefreshMultiple.setDescription("The value of the RSVP value 'K', which is the\n number of refresh intervals which must elapse\n (minimum) before a PATH or RESV message which\n is not being refreshed will be aged out.")
rsvpIfTTL = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpIfTTL.setDescription('The value of SEND_TTL used on this interface\n for messages this node originates. If set to\n zero, the node determines the TTL via other\n means.')
rsvpIfRefreshInterval = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 7), TimeInterval().clone(3000)).setUnits('milliseconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpIfRefreshInterval.setDescription("The value of the RSVP value 'R', which is the\n minimum period between refresh transmissions of\n a given PATH or RESV message on an interface.")
rsvpIfRouteDelay = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 8), TimeInterval().clone(200)).setUnits('hundredths of a second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpIfRouteDelay.setDescription('The approximate period from the time a route\n is changed to the time a resulting message ap-\n pears on the interface.')
rsvpIfEnabled = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 9), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpIfEnabled.setDescription('If TRUE, RSVP is enabled on this Interface.\n If FALSE, RSVP is not enabled on this inter-\n face.')
rsvpIfUdpRequired = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 10), TruthValue()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpIfUdpRequired.setDescription('If TRUE, manual configuration forces the use\n of UDP encapsulation on the interface. If\n FALSE, UDP encapsulation is only used if rsvpI-\n fUdpNbrs is not zero.')
rsvpIfStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 6, 1, 11), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpIfStatus.setDescription("'active' on interfaces that are configured for\n RSVP.")
rsvpNbrTable = MibTable((1, 3, 6, 1, 2, 1, 51, 1, 7), )
if mibBuilder.loadTexts: rsvpNbrTable.setDescription('Information describing the Neighbors of an\n RSVP system.')
rsvpNbrEntry = MibTableRow((1, 3, 6, 1, 2, 1, 51, 1, 7, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "RSVP-MIB", "rsvpNbrAddress"))
if mibBuilder.loadTexts: rsvpNbrEntry.setDescription('Information describing a single RSVP Neigh-\n bor.')
rsvpNbrAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 7, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4,16)))
if mibBuilder.loadTexts: rsvpNbrAddress.setDescription("The IP4 or IP6 Address used by this neighbor.\n This object may not be changed when the value\n of the RowStatus object is 'active'.")
rsvpNbrProtocol = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 7, 1, 2), RsvpEncapsulation()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpNbrProtocol.setDescription('The encapsulation being used by this neigh-\n bor.')
rsvpNbrStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 51, 1, 7, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rsvpNbrStatus.setDescription("'active' for all neighbors. This object may\n be used to configure neighbors. In the pres-\n ence of configured neighbors, the implementa-\n tion may (but is not required to) limit the set\n of valid neighbors to those configured.")
rsvpNotifications = MibIdentifier((1, 3, 6, 1, 2, 1, 51, 3, 0))
newFlow = NotificationType((1, 3, 6, 1, 2, 1, 51, 3, 0, 1)).setObjects(*(("RSVP-MIB", "intSrvFlowStatus"), ("RSVP-MIB", "rsvpSessionDestAddr"), ("RSVP-MIB", "rsvpResvFwdStatus"), ("RSVP-MIB", "rsvpResvStatus"), ("RSVP-MIB", "rsvpSenderStatus"),))
if mibBuilder.loadTexts: newFlow.setDescription('The newFlow trap indicates that the originat-\n ing system has installed a new flow in its\n classifier, or (when reservation authorization\n is in view) is prepared to install such a flow\n in the classifier and is requesting authoriza-\n tion. The objects included with the Notifica-\n tion may be used to read further information\n using the Integrated Services and RSVP MIBs.\n Authorization or non-authorization may be\n enacted by a write to the variable intSrvFlowS-\n tatus.')
lostFlow = NotificationType((1, 3, 6, 1, 2, 1, 51, 3, 0, 2)).setObjects(*(("RSVP-MIB", "intSrvFlowStatus"), ("RSVP-MIB", "rsvpSessionDestAddr"), ("RSVP-MIB", "rsvpResvFwdStatus"), ("RSVP-MIB", "rsvpResvStatus"), ("RSVP-MIB", "rsvpSenderStatus"),))
if mibBuilder.loadTexts: lostFlow.setDescription('The lostFlow trap indicates that the originat-\n ing system has removed a flow from its classif-\n ier.')
rsvpGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 51, 4, 1))
rsvpCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 51, 4, 2))
rsvpCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 51, 4, 2, 1)).setObjects(*(("RSVP-MIB", "rsvpSessionGroup"), ("RSVP-MIB", "rsvpSenderGroup"), ("RSVP-MIB", "rsvpResvGroup"), ("RSVP-MIB", "rsvpIfGroup"), ("RSVP-MIB", "rsvpNbrGroup"), ("RSVP-MIB", "rsvpResvFwdGroup"), ("RSVP-MIB", "rsvpNotificationGroup"),))
if mibBuilder.loadTexts: rsvpCompliance.setDescription('The compliance statement. Note that the im-\n plementation of this module requires implemen-\n tation of the Integrated Services MIB as well.')
rsvpSessionGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 51, 4, 1, 1)).setObjects(*(("RSVP-MIB", "rsvpSessionType"), ("RSVP-MIB", "rsvpSessionDestAddr"), ("RSVP-MIB", "rsvpSessionDestAddrLength"), ("RSVP-MIB", "rsvpSessionProtocol"), ("RSVP-MIB", "rsvpSessionPort"), ("RSVP-MIB", "rsvpSessionSenders"), ("RSVP-MIB", "rsvpSessionReceivers"), ("RSVP-MIB", "rsvpSessionRequests"),))
if mibBuilder.loadTexts: rsvpSessionGroup.setDescription('These objects are required for RSVP Systems.')
rsvpSenderGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 51, 4, 1, 2)).setObjects(*(("RSVP-MIB", "rsvpSenderType"), ("RSVP-MIB", "rsvpSenderDestAddr"), ("RSVP-MIB", "rsvpSenderAddr"), ("RSVP-MIB", "rsvpSenderDestAddrLength"), ("RSVP-MIB", "rsvpSenderAddrLength"), ("RSVP-MIB", "rsvpSenderProtocol"), ("RSVP-MIB", "rsvpSenderDestPort"), ("RSVP-MIB", "rsvpSenderPort"), ("RSVP-MIB", "rsvpSenderHopAddr"), ("RSVP-MIB", "rsvpSenderHopLih"), ("RSVP-MIB", "rsvpSenderInterface"), ("RSVP-MIB", "rsvpSenderTSpecRate"), ("RSVP-MIB", "rsvpSenderTSpecPeakRate"), ("RSVP-MIB", "rsvpSenderTSpecBurst"), ("RSVP-MIB", "rsvpSenderTSpecMinTU"), ("RSVP-MIB", "rsvpSenderTSpecMaxTU"), ("RSVP-MIB", "rsvpSenderInterval"), ("RSVP-MIB", "rsvpSenderLastChange"), ("RSVP-MIB", "rsvpSenderStatus"), ("RSVP-MIB", "rsvpSenderRSVPHop"), ("RSVP-MIB", "rsvpSenderPolicy"), ("RSVP-MIB", "rsvpSenderAdspecBreak"), ("RSVP-MIB", "rsvpSenderAdspecHopCount"), ("RSVP-MIB", "rsvpSenderAdspecPathBw"), ("RSVP-MIB", "rsvpSenderAdspecMinLatency"), ("RSVP-MIB", "rsvpSenderAdspecMtu"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedSvc"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedBreak"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedCtot"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedDtot"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedCsum"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedDsum"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedHopCount"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedPathBw"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedMinLatency"), ("RSVP-MIB", "rsvpSenderAdspecGuaranteedMtu"), ("RSVP-MIB", "rsvpSenderAdspecCtrlLoadSvc"), ("RSVP-MIB", "rsvpSenderAdspecCtrlLoadBreak"), ("RSVP-MIB", "rsvpSenderAdspecCtrlLoadHopCount"), ("RSVP-MIB", "rsvpSenderAdspecCtrlLoadPathBw"), ("RSVP-MIB", "rsvpSenderAdspecCtrlLoadMinLatency"), ("RSVP-MIB", "rsvpSenderAdspecCtrlLoadMtu"), ("RSVP-MIB", "rsvpSenderNewIndex"),))
if mibBuilder.loadTexts: rsvpSenderGroup.setDescription('These objects are required for RSVP Systems.')
rsvpResvGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 51, 4, 1, 3)).setObjects(*(("RSVP-MIB", "rsvpResvType"), ("RSVP-MIB", "rsvpResvDestAddr"), ("RSVP-MIB", "rsvpResvSenderAddr"), ("RSVP-MIB", "rsvpResvDestAddrLength"), ("RSVP-MIB", "rsvpResvSenderAddrLength"), ("RSVP-MIB", "rsvpResvProtocol"), ("RSVP-MIB", "rsvpResvDestPort"), ("RSVP-MIB", "rsvpResvPort"), ("RSVP-MIB", "rsvpResvHopAddr"), ("RSVP-MIB", "rsvpResvHopLih"), ("RSVP-MIB", "rsvpResvInterface"), ("RSVP-MIB", "rsvpResvService"), ("RSVP-MIB", "rsvpResvTSpecRate"), ("RSVP-MIB", "rsvpResvTSpecBurst"), ("RSVP-MIB", "rsvpResvTSpecPeakRate"), ("RSVP-MIB", "rsvpResvTSpecMinTU"), ("RSVP-MIB", "rsvpResvTSpecMaxTU"), ("RSVP-MIB", "rsvpResvRSpecRate"), ("RSVP-MIB", "rsvpResvRSpecSlack"), ("RSVP-MIB", "rsvpResvInterval"), ("RSVP-MIB", "rsvpResvScope"), ("RSVP-MIB", "rsvpResvShared"), ("RSVP-MIB", "rsvpResvExplicit"), ("RSVP-MIB", "rsvpResvRSVPHop"), ("RSVP-MIB", "rsvpResvLastChange"), ("RSVP-MIB", "rsvpResvPolicy"), ("RSVP-MIB", "rsvpResvStatus"), ("RSVP-MIB", "rsvpResvNewIndex"),))
if mibBuilder.loadTexts: rsvpResvGroup.setDescription('These objects are required for RSVP Systems.')
rsvpResvFwdGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 51, 4, 1, 4)).setObjects(*(("RSVP-MIB", "rsvpResvFwdType"), ("RSVP-MIB", "rsvpResvFwdDestAddr"), ("RSVP-MIB", "rsvpResvFwdSenderAddr"), ("RSVP-MIB", "rsvpResvFwdDestAddrLength"), ("RSVP-MIB", "rsvpResvFwdSenderAddrLength"), ("RSVP-MIB", "rsvpResvFwdProtocol"), ("RSVP-MIB", "rsvpResvFwdDestPort"), ("RSVP-MIB", "rsvpResvFwdPort"), ("RSVP-MIB", "rsvpResvFwdHopAddr"), ("RSVP-MIB", "rsvpResvFwdHopLih"), ("RSVP-MIB", "rsvpResvFwdInterface"), ("RSVP-MIB", "rsvpResvFwdNewIndex"), ("RSVP-MIB", "rsvpResvFwdService"), ("RSVP-MIB", "rsvpResvFwdTSpecPeakRate"), ("RSVP-MIB", "rsvpResvFwdTSpecMinTU"), ("RSVP-MIB", "rsvpResvFwdTSpecMaxTU"), ("RSVP-MIB", "rsvpResvFwdTSpecRate"), ("RSVP-MIB", "rsvpResvFwdTSpecBurst"), ("RSVP-MIB", "rsvpResvFwdRSpecRate"), ("RSVP-MIB", "rsvpResvFwdRSpecSlack"), ("RSVP-MIB", "rsvpResvFwdInterval"), ("RSVP-MIB", "rsvpResvFwdScope"), ("RSVP-MIB", "rsvpResvFwdShared"), ("RSVP-MIB", "rsvpResvFwdExplicit"), ("RSVP-MIB", "rsvpResvFwdRSVPHop"), ("RSVP-MIB", "rsvpResvFwdLastChange"), ("RSVP-MIB", "rsvpResvFwdPolicy"), ("RSVP-MIB", "rsvpResvFwdStatus"),))
if mibBuilder.loadTexts: rsvpResvFwdGroup.setDescription('These objects are optional, used for some RSVP\n Systems.')
rsvpIfGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 51, 4, 1, 6)).setObjects(*(("RSVP-MIB", "rsvpIfUdpNbrs"), ("RSVP-MIB", "rsvpIfIpNbrs"), ("RSVP-MIB", "rsvpIfNbrs"), ("RSVP-MIB", "rsvpIfEnabled"), ("RSVP-MIB", "rsvpIfUdpRequired"), ("RSVP-MIB", "rsvpIfRefreshBlockadeMultiple"), ("RSVP-MIB", "rsvpIfRefreshMultiple"), ("RSVP-MIB", "rsvpIfRefreshInterval"), ("RSVP-MIB", "rsvpIfTTL"), ("RSVP-MIB", "rsvpIfRouteDelay"), ("RSVP-MIB", "rsvpIfStatus"),))
if mibBuilder.loadTexts: rsvpIfGroup.setDescription('These objects are required for RSVP Systems.')
rsvpNbrGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 51, 4, 1, 7)).setObjects(*(("RSVP-MIB", "rsvpNbrProtocol"), ("RSVP-MIB", "rsvpNbrStatus"),))
if mibBuilder.loadTexts: rsvpNbrGroup.setDescription('These objects are required for RSVP Systems.')
rsvpNotificationGroup = NotificationGroup((1, 3, 6, 1, 2, 1, 51, 4, 1, 8)).setObjects(*(("RSVP-MIB", "newFlow"), ("RSVP-MIB", "lostFlow"),))
if mibBuilder.loadTexts: rsvpNotificationGroup.setDescription('This notification is required for Systems sup-\n porting the RSVP Policy Module using an SNMP\n interface to the Policy Manager.')
mibBuilder.exportSymbols("RSVP-MIB", rsvpCompliance=rsvpCompliance, rsvpSessionRequests=rsvpSessionRequests, rsvpSenderTSpecMaxTU=rsvpSenderTSpecMaxTU, rsvpNbrTable=rsvpNbrTable, rsvpNbrProtocol=rsvpNbrProtocol, rsvpResvSenderAddr=rsvpResvSenderAddr, lostFlow=lostFlow, rsvpResvFwdExplicit=rsvpResvFwdExplicit, rsvpNbrEntry=rsvpNbrEntry, rsvpResvType=rsvpResvType, rsvpResvRSpecRate=rsvpResvRSpecRate, rsvpNbrGroup=rsvpNbrGroup, rsvpSenderTable=rsvpSenderTable, rsvpResvNumber=rsvpResvNumber, rsvpResvFwdTSpecMinTU=rsvpResvFwdTSpecMinTU, rsvpResvFwdNewIndex=rsvpResvFwdNewIndex, rsvpSenderAdspecGuaranteedPathBw=rsvpSenderAdspecGuaranteedPathBw, rsvpConformance=rsvpConformance, rsvpSessionPort=rsvpSessionPort, rsvpResvFwdEntry=rsvpResvFwdEntry, rsvpSenderAdspecGuaranteedCtot=rsvpSenderAdspecGuaranteedCtot, rsvpResvFwdTSpecRate=rsvpResvFwdTSpecRate, rsvpSessionReceivers=rsvpSessionReceivers, rsvpSenderInterval=rsvpSenderInterval, rsvpIfRefreshBlockadeMultiple=rsvpIfRefreshBlockadeMultiple, rsvpResvFwdDestAddrLength=rsvpResvFwdDestAddrLength, rsvpResvPort=rsvpResvPort, rsvpSessionTable=rsvpSessionTable, rsvpResvTSpecMinTU=rsvpResvTSpecMinTU, rsvpResvFwdTTL=rsvpResvFwdTTL, rsvpResvFwdInterval=rsvpResvFwdInterval, rsvpSessionGroup=rsvpSessionGroup, rsvpIfTTL=rsvpIfTTL, rsvpIfStatus=rsvpIfStatus, rsvpNbrStatus=rsvpNbrStatus, rsvpSenderLastChange=rsvpSenderLastChange, rsvpResvExplicit=rsvpResvExplicit, rsvpResvFwdSenderAddrLength=rsvpResvFwdSenderAddrLength, rsvpResvFwdDestAddr=rsvpResvFwdDestAddr, rsvpResvStatus=rsvpResvStatus, rsvpResvFwdTSpecMaxTU=rsvpResvFwdTSpecMaxTU, rsvpIfRouteDelay=rsvpIfRouteDelay, rsvpResvScope=rsvpResvScope, rsvpGenObjects=rsvpGenObjects, rsvpSenderTSpecRate=rsvpSenderTSpecRate, rsvpSenderFlowId=rsvpSenderFlowId, rsvpResvDestPort=rsvpResvDestPort, rsvpResvDestAddrLength=rsvpResvDestAddrLength, rsvpResvFwdDestPort=rsvpResvFwdDestPort, rsvpResvFwdRSVPHop=rsvpResvFwdRSVPHop, rsvpSenderAdspecGuaranteedSvc=rsvpSenderAdspecGuaranteedSvc, rsvpResvFwdSenderAddr=rsvpResvFwdSenderAddr, rsvpSenderAdspecCtrlLoadSvc=rsvpSenderAdspecCtrlLoadSvc, rsvpResvFwdPolicy=rsvpResvFwdPolicy, rsvpIfUdpRequired=rsvpIfUdpRequired, rsvpSenderAddrLength=rsvpSenderAddrLength, rsvpGroups=rsvpGroups, rsvpSenderNewIndex=rsvpSenderNewIndex, rsvpSenderRSVPHop=rsvpSenderRSVPHop, rsvpResvFwdNumber=rsvpResvFwdNumber, rsvpResvFwdFlowId=rsvpResvFwdFlowId, rsvpBadPackets=rsvpBadPackets, rsvpSenderInterface=rsvpSenderInterface, rsvpSenderAdspecMtu=rsvpSenderAdspecMtu, rsvpNotifications=rsvpNotifications, rsvpSenderPolicy=rsvpSenderPolicy, rsvpSenderAdspecCtrlLoadPathBw=rsvpSenderAdspecCtrlLoadPathBw, rsvpCompliances=rsvpCompliances, rsvpSenderAdspecGuaranteedDsum=rsvpSenderAdspecGuaranteedDsum, rsvpResvFwdInterface=rsvpResvFwdInterface, rsvpSenderNumber=rsvpSenderNumber, rsvpSenderAdspecCtrlLoadHopCount=rsvpSenderAdspecCtrlLoadHopCount, rsvpSessionDestAddr=rsvpSessionDestAddr, PYSNMP_MODULE_ID=rsvp, rsvpResvFwdPort=rsvpResvFwdPort, rsvpSenderPort=rsvpSenderPort, rsvpResvFwdTable=rsvpResvFwdTable, rsvpResvFwdLastChange=rsvpResvFwdLastChange, rsvpSenderEntry=rsvpSenderEntry, rsvpSenderType=rsvpSenderType, rsvpSenderAdspecHopCount=rsvpSenderAdspecHopCount, rsvpResvFwdScope=rsvpResvFwdScope, rsvpResvTTL=rsvpResvTTL, rsvpResvFwdService=rsvpResvFwdService, rsvpNotificationGroup=rsvpNotificationGroup, rsvpResvDestAddr=rsvpResvDestAddr, rsvpSenderTSpecPeakRate=rsvpSenderTSpecPeakRate, rsvpSenderAdspecGuaranteedHopCount=rsvpSenderAdspecGuaranteedHopCount, rsvpIfTable=rsvpIfTable, rsvpIfEnabled=rsvpIfEnabled, rsvpResvService=rsvpResvService, rsvpSenderDestAddr=rsvpSenderDestAddr, rsvpSenderOutInterfaceTable=rsvpSenderOutInterfaceTable, rsvpSenderDestAddrLength=rsvpSenderDestAddrLength, rsvpSenderAdspecCtrlLoadBreak=rsvpSenderAdspecCtrlLoadBreak, rsvpSenderGroup=rsvpSenderGroup, rsvpResvTSpecRate=rsvpResvTSpecRate, rsvpResvFwdType=rsvpResvFwdType, rsvpResvEntry=rsvpResvEntry, rsvp=rsvp, rsvpSenderAdspecMinLatency=rsvpSenderAdspecMinLatency, rsvpResvFlowId=rsvpResvFlowId, rsvpResvTSpecPeakRate=rsvpResvTSpecPeakRate, rsvpResvTable=rsvpResvTable, rsvpResvLastChange=rsvpResvLastChange, rsvpResvFwdHopAddr=rsvpResvFwdHopAddr, rsvpSenderAdspecBreak=rsvpSenderAdspecBreak, rsvpSessionDestAddrLength=rsvpSessionDestAddrLength, rsvpResvGroup=rsvpResvGroup, rsvpSenderStatus=rsvpSenderStatus, rsvpIfIpNbrs=rsvpIfIpNbrs, rsvpSessionEntry=rsvpSessionEntry, newFlow=newFlow, rsvpNbrAddress=rsvpNbrAddress, rsvpResvFwdRSpecSlack=rsvpResvFwdRSpecSlack, rsvpIfRefreshMultiple=rsvpIfRefreshMultiple, RefreshInterval=RefreshInterval, rsvpResvNewIndex=rsvpResvNewIndex, rsvpSenderOutInterfaceStatus=rsvpSenderOutInterfaceStatus, rsvpResvSenderAddrLength=rsvpResvSenderAddrLength, rsvpSenderAdspecGuaranteedCsum=rsvpSenderAdspecGuaranteedCsum, rsvpResvTSpecBurst=rsvpResvTSpecBurst, rsvpResvFwdShared=rsvpResvFwdShared, rsvpIfUdpNbrs=rsvpIfUdpNbrs, rsvpResvShared=rsvpResvShared, rsvpSessionType=rsvpSessionType, rsvpSessionProtocol=rsvpSessionProtocol, rsvpObjects=rsvpObjects, rsvpSenderDestPort=rsvpSenderDestPort, rsvpIfGroup=rsvpIfGroup, rsvpSenderTSpecMinTU=rsvpSenderTSpecMinTU, rsvpSenderTSpecBurst=rsvpSenderTSpecBurst, rsvpResvFwdHopLih=rsvpResvFwdHopLih, rsvpIfRefreshInterval=rsvpIfRefreshInterval, RsvpEncapsulation=RsvpEncapsulation, rsvpResvFwdStatus=rsvpResvFwdStatus, rsvpResvFwdProtocol=rsvpResvFwdProtocol, rsvpResvRSpecSlack=rsvpResvRSpecSlack, rsvpSenderAdspecGuaranteedBreak=rsvpSenderAdspecGuaranteedBreak, rsvpResvProtocol=rsvpResvProtocol, rsvpSenderAdspecCtrlLoadMtu=rsvpSenderAdspecCtrlLoadMtu, rsvpSenderTTL=rsvpSenderTTL, rsvpResvHopLih=rsvpResvHopLih, rsvpResvPolicy=rsvpResvPolicy, rsvpSenderHopAddr=rsvpSenderHopAddr, rsvpResvRSVPHop=rsvpResvRSVPHop, rsvpSenderOutInterfaceEntry=rsvpSenderOutInterfaceEntry, rsvpNotificationsPrefix=rsvpNotificationsPrefix, rsvpResvFwdRSpecRate=rsvpResvFwdRSpecRate, rsvpSenderAdspecGuaranteedMtu=rsvpSenderAdspecGuaranteedMtu, rsvpSenderAdspecCtrlLoadMinLatency=rsvpSenderAdspecCtrlLoadMinLatency, rsvpSenderAdspecGuaranteedDtot=rsvpSenderAdspecGuaranteedDtot, rsvpSessionNumber=rsvpSessionNumber, rsvpSessionSenders=rsvpSessionSenders, rsvpSenderHopLih=rsvpSenderHopLih, rsvpSenderAdspecPathBw=rsvpSenderAdspecPathBw, rsvpResvFwdTSpecPeakRate=rsvpResvFwdTSpecPeakRate, rsvpIfEntry=rsvpIfEntry, rsvpResvFwdTSpecBurst=rsvpResvFwdTSpecBurst, rsvpSenderAdspecGuaranteedMinLatency=rsvpSenderAdspecGuaranteedMinLatency, rsvpResvTSpecMaxTU=rsvpResvTSpecMaxTU, rsvpResvFwdGroup=rsvpResvFwdGroup, rsvpResvInterval=rsvpResvInterval, rsvpIfNbrs=rsvpIfNbrs, rsvpResvInterface=rsvpResvInterface, rsvpSenderAddr=rsvpSenderAddr, rsvpSenderProtocol=rsvpSenderProtocol, rsvpResvHopAddr=rsvpResvHopAddr)
|
# Implemente uma nova classe que simule uma pilha usando apenas duas filas.
class Node:
def __init__(self, data, next=None):
self.data = data
self.next = next
class MyQueue:
def __init__(self):
self.head = None
self.tail = self.head
def enqueue(self, value):
if (self.head): # queue is not empty
newNode = Node(value)
self.tail.next = newNode
self.tail = newNode
else: # queue is empty
self.head = Node(value)
self.tail = self.head
def dequeue(self):
if (self.head):
toRemove = self.head.data
self.head = self.head.next
return toRemove
else:
return -1
def is_empty(self):
return self.head is None
class MyStack:
def __init__(self):
self.q1 = MyQueue()
self.q2 = MyQueue()
def push(self, value):
self.q2.enqueue(value)
while not self.q1.is_empty():
self.q2.enqueue(self.q1.dequeue())
temp = self.q1
self.q1 = self.q2
self.q2 = temp
def pop(self):
if self.q1.is_empty():
return -1
return self.q1.dequeue()
st = MyStack()
st.push(1)
st.push(2)
st.push(3)
st.push(4)
print(st.pop())
print(st.pop())
print(st.pop())
|
class card():
"""docstring for ."""
def __init__(self, name, type, cost, coins=0, vp=0):
'''
Parameters:
name: string
type: LIST OF STRINGS
cost: int
coins: int
vp: int
Returns:
None
'''
self.name = name
self.type = type
self.cost = cost
self.coins = coins
self.vp = vp
return
def __str__(self):
'''When you print card, return card name'''
return self.getName()
def getName(self): return self.name
def getType(self): return self.type
def getCost(self): return self.cost
def getCoins(self): return self.coins
def getVp(self): return self.vp
def isTreasure(self): return "treasure" in self.type
def isVictory(self): return "victory" in self.type
def isCurse(self): return "curse" in self.type
def kingdomCards():
''' Return a list of all cards in the kingdom
'''
kingdom = list()
kingdom.append(card("curse", ["curse"], 0, coins=0, vp=-1))
kingdom.append(card("estate", ["victory"], 2, coins=0, vp=1))
kingdom.append(card("duchy", ["victory"], 5, coins=0, vp=3))
kingdom.append(card("province", ["victory"], 8, coins=0, vp=6))
kingdom.append(card("copper", ["treasure"], 0, coins=1, vp=0))
kingdom.append(card("silver", ["treasure"], 3, coins=2, vp=0))
kingdom.append(card("gold", ["treasure"], 6, coins=3, vp=0))
return kingdom
def kingdomCardValues(kingdom):
kingdomAmounts = dict()
for card in kingdom:
if card.getName() == "curse": kingdomAmounts[card.getName()] = 10
elif card.getName() == "estate": kingdomAmounts[card.getName()] = 8
elif card.getName() == "duchy": kingdomAmounts[card.getName()] = 8
elif card.getName() == "province": kingdomAmounts[card.getName()] = 8
elif card.getName() == "copper": kingdomAmounts[card.getName()] = 46
elif card.getName() == "silver": kingdomAmounts[card.getName()] = 40
elif card.getName() == "gold": kingdomAmounts[card.getName()] = 30
return kingdomAmounts
def startingCards():
''' Return the cards the bot starts with
'''
deck = list()
for _ in range(7): deck.append(card("copper", "treasure", 0, coins=1, vp=0))
for _ in range(3): deck.append(card("estate", "victory", 2, coins=0, vp=1))
return deck
def allDeckCards(hand, deck, discard, play):
''' Start to get all the cards the bot owns into a single list
'''
content = list()
areas = [hand, deck, discard, play]
for area in areas:
for card in area: content.append(card.getName())
return deckContent(content)
def deckContent(deck):
''' Create a list of lists of all the elements in the deck
I.e. [... [copper, 7] ...] indicates there 7 coppers in the deck
THIS IS THE STATE OF THE BOT
'''
tmpSupplyCards = kingdomCards()
supplyCards = list()
for card in tmpSupplyCards: supplyCards.append( (card.getName(), 0) )
for card in deck:
for index in range(len(supplyCards)):
if card in supplyCards[index]:
count = supplyCards[index][1]
supplyCards[index] = (card, count+1)
# supplyCard[1] += 1
break
# print(supplyCards)
supplyCards = tuple(supplyCards)
return supplyCards
def newCard(deck, name):
if name == "curse":
deck.append(card("curse", ["curse"], 0, coins=0, vp=-1))
elif name == "estate":
deck.append(card("estate", ["victory"], 2, coins=0, vp=1))
elif name == "duchy":
deck.append(card("duchy", ["victory"], 5, coins=0, vp=3))
elif name == "province":
deck.append(card("province", ["victory"], 8, coins=0, vp=6))
elif name == "copper":
deck.append(card("copper", ["treasure"], 0, coins=1, vp=0))
elif name == "silver":
deck.append(card("silver", ["treasure"], 3, coins=2, vp=0))
elif name == "gold":
deck.append(card("gold", ["treasure"], 6, coins=3, vp=0))
elif name == "none":
pass
return deck
def testCards():
x = card("silver", ["treasure"], 3, coins=2)
# assertEqual(x.getName(), "silver", 'pass')
# print("name: {} \t type: {} \t cost: {} \t coins: {} \t vp: {}".format(
# x.getName(), x.getType(), x.getCost(), x.getCoins(), x.getVp()))
# print("is {} a treasure? {}".format(x.getName(), x.isTreasure()))
# print("is {} a victory? {}".format(x.getName(), x.isVictory()))
return
def main():
testCards()
return
if __name__ == '__main__':
main()
|
# 371. Sum of Two Integers
# [email protected]
# Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
class Solution:
def getSum(self, a, b):
"""
:type a: int
:type b: int
:rtype: int
"""
# sol 1:
# runtime: 40ms
return sum([a, b])
# sol 2:
# runtime:
def add(a, b):
if not a or not b:
return a or b
return add((a ^ b), (a & b) << 1)
if a * b < 0: # either one less than zero
if a > 0:
a, b = b, a
if -a == b: return 0
if -a < b: return -add(-a, -b)
return add(a, b)
|
'''
199. Binary Tree Right Side View Medium
Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
Example 1:
Input: root = [1,2,3,null,5,null,4]
Output: [1,3,4]
Example 2:
Input: root = [1,null,3]
Output: [1,3]
Example 3:
Input: root = []
Output: []
Constraints:
The number of nodes in the tree is in the range [0, 100].
-100 <= Node.val <= 100
'''
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def rightSideView(self, root: TreeNode) -> List[int]:
self.view = []
self.recursive(root, 0)
return self.view
def recursive(self, node: TreeNode, height) -> List[int]:
if node:
if height == len(self.view):
self.view.append(node.val)
self.recursive(node.right, height+1)
self.recursive(node.left, height+1)
|
class Content():
def __init__(self):
self.content_type = "video"
self.title = "sample title"
self.author = {"url": "", "name": "James"}
self.time_estimate = "(15 min)"
self.url = "http://mim-rec-engine.heroku.com"
self.thumbnail_url = "static/imgs/document.png"
self.thumbnail_width = 498
self.thumbnail_height = 354
self.duration = ""
self.description = "Bulbasaur Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ivysaur Lorem ipsum dolor sit amet, consectetur adipiscing elit. Venusaur Lorem ipsum dolor sit amet, consectetur adipiscing elit. Charmander Lorem ipsum dolor sit amet, consectetur adipiscing elit. Charmeleon Lorem ipsum dolor sit amet, consectetur adipiscing elit. Charizard Lorem ipsum dolor sit amet, consectetur adipiscing elit. Squirtle Lorem ipsum dolor sit amet, consectetur adipiscing elit. Wartortle Lorem ipsum dolor sit amet, consectetur adipiscing elit. Blastoise Lorem ipsum dolor sit amet, consectetur adipiscing elit. Caterpie Lorem ipsum dolor sit amet, consectetur adipiscing elit. Metapod Lorem ipsum dolor sit amet, consectetur adipiscing elit. Butterfree Lorem ipsum dolor sit amet, consectetur adipiscing elit. Weedle Lorem ipsum dolor sit amet, consectetur adipiscing elit. Kakuna Lorem ipsum dolor sit amet, consectetur adipiscing elit. Beedrill Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pidgey Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pidgeotto Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pidgeot Lorem ipsum dolor sit amet, consectetur adipiscing elit. Rattata Lorem ipsum dolor sit amet, consectetur adipiscing elit. Raticate Lorem ipsum dolor sit amet, consectetur adipiscing elit. Spearow Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fearow Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ekans Lorem ipsum dolor sit amet, consectetur adipiscing elit. Arbok Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pikachu Lorem ipsum dolor sit amet, consectetur adipiscing elit. Raichu Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sandshrew Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sandslash Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nidoran Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nidorina Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nidoqueen Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nidoran Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nidorino Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nidoking Lorem ipsum dolor sit amet, consectetur adipiscing elit. Clefairy Lorem ipsum dolor sit amet, consectetur adipiscing elit. Clefable Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vulpix Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ninetales Lorem ipsum dolor sit amet, consectetur adipiscing elit. Jigglypuff Lorem ipsum dolor sit amet, consectetur adipiscing elit. Wigglytuff Lorem ipsum dolor sit amet, consectetur adipiscing elit. Zubat Lorem ipsum dolor sit amet, consectetur adipiscing elit. Golbat Lorem ipsum dolor sit amet, consectetur adipiscing elit. Oddish Lorem ipsum dolor sit amet, consectetur adipiscing elit. Gloom Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vileplume Lorem ipsum dolor sit amet, consectetur adipiscing elit. Paras Lorem ipsum dolor sit amet, consectetur adipiscing elit."
def set(self, content_type, title, author, time_estimate, url, thumbnail_url, thumbnail_width, thumbnail_height, description):
self.content_type = content_type
self.title = title
self.author = author
self.time_estimate = time_estimate
self.url = url
self.thumbnail_url = thumbnail_url
self.thumbnail_width = thumbnail_width
self.thumbnail_height = thumbnail_height
self.description = description
def build(self, from_engine):
self.id = from_engine["id"]
self.content_type = from_engine["content_type"]
self.title = from_engine["title"]
self.author = from_engine["author"]["name"]
if "author_url" in from_engine["author"]:
self.author_url = from_engine["author"]["author_url"]
self.url = from_engine["url"]
self.description = from_engine["description"]
if "thumbnail" in from_engine:
self.thumbnail_url = from_engine["thumbnail"]["url"]
self.thumbnail_height = from_engine["thumbnail"]["height"]
self.thumbnail_width = from_engine["thumbnail"]["width"]
if "duration" in from_engine:
self.duration = from_engine["duration"]
def set_id(self, id):
self.id = id
|
"""
diamond.clauses
~~~~~~~~~~~~~~~
:copyright: (c) 2015 Jaco Ruit
:license: MIT, see LICENSE for more details
"""
class Node(object):
def __init__(self, inner = None, condition = None):
self.inner = inner
self.condition = condition
self.children = []
def __and__(self, other):
self.children.append(("and", other))
return self
def __or__(self, other):
self.children.append(("or", other))
return self
def parsable(node):
parsable_clause = []
nodes = node.children
nodes.insert(0, (None, node))
for op, node in nodes:
if node.inner != None: parsable_clause.append((op, parsable(node.inner)))
else:
field, comparer, value = node.condition
if not isinstance(value, field.type):
value = (value.table, value.name)
parsable_clause.append((op, ((field.table, field.name), comparer, value)))
return parsable_clause
def clause(node):
return Node(inner = node)
def condition(field, comparer, value):
return Node(condition = (field, comparer, value))
|
__author__ = 'hs634'
class Solution():
def __init__(self):
pass
def three_sum_zero(self, arr):
arr, solution, i = sorted(arr), [], 0
while i < len(arr) - 2:
j, k = i + 1, len(arr) - 1
while j < k:
three_sum = arr[i] + arr[j] + arr[k]
if three_sum < 0:
j += 1
elif three_sum > 0:
k -= 1
else:
solution.append([arr[i], arr[j], arr[k]])
j, k = j + 1, k - 1
while j < k and arr[j] == arr[j - 1]:
j += 1
while j < k and arr[k] == arr[k + 1]:
k -= 1
i += 1
while i < len(arr) - 2 and arr[i] == arr[i - 1]:
i += 1
return solution
if __name__ == "__main__":
solution = Solution().three_sum_zero([-1, 0, 1, 2, -1, -4])
|
print('this repo is belong to nbnitboy')
print('this line is added by tangcg !')
print('删除原始仓库,添加forked仓库后,提交代码 !')
print('this line is added by tangcg')
|
class Solution:
def merge(self, A, m, B, n):
sm, sn, i = m - 1, n - 1, m + n - 1
while sm >= 0 and sn >= 0:
if A[sm] > B[sn]:
A[i] = A[sm]
sm -= 1
else:
A[i] = B[sn]
sn -= 1
i -= 1
while sn >= 0:
A[i] = B[sn]
i -= 1
sn -= 1
|
class TasksService:
def __init__(self, site):
self.__site = site
self.__is_loaded = False
def load(self):
self.__is_loaded = True
|
class Recipe(object):
def __init__(self):
self.ingredients = [] # need to store lots of qty & unit & ingred per recipe. will be ordered triple
self.directions = "" # how to make this food
self.notes = "" # personal annotations re: this recipe
self.recipe_name = "" # what's in a name?
self.synopsis = "" # prep time, cook time, bake temp, etc. also short note for easy ref if you want
self.uses = 0 # track how many times a recipe has been used
self.source = "" # where did the recipe come from?
self.labels = [] # used in searching for recipes
def add_ingredient(self, qty, unit, name):
self.ingredients.append((qty, unit, name))
return
# needs ... reformatting. Not very nice to look at while running
def get_recipe_content(self):
again = "y"
self.recipe_name = input("Please enter recipe name: ")
while again != "n":
# get ingredient input, split it, store it
split_input = input("\nPlease enter ingredient quantity, unit, and name. For example,"
"'2 cups flour': ").split(" ")
if len(split_input) == 3:
self.add_ingredient(split_input[0], split_input[1], split_input[2])
again = input("\nAre there more ingredients? Y/N: ").lower()
self.directions = input("\nPlease enter all recipe directions: ")
self.notes = input("\nPlease enter any notes for this recipe. If there are none, just press Enter: \n")
self.synopsis = input("\nPlease enter any recipe synopsis you would like to have. This may include"
" prep time, cook time, baking \ntemperature, or more. If there is none, "
"just press Enter: \n")
self.source = input(
"\nPlease enter the recipe source. If you don't want to add one, just press Enter: \n")
more_labels = "y"
while more_labels != "n":
self.labels.append(input("\nEnter a label to tag this recipe with. "
"If you don't want to add one, just press Enter: \n"))
more_labels = input("\nIs there another label to add? Y/N: ").lower()
return
def display_recipe(self):
print(self.recipe_name + "\n")
print("Ingredients: \n")
for i in self.ingredients:
print(i[0] + " " + i[1] + " " + i[2] + "\n")
print("Directions: \n" + self.directions + "\n")
print("Notes: \n" + self.notes + "\n")
if self.source:
print("Recipe obtained from " + self.source)
return
def recipe_to_dict(self):
recipe_dict = dict([('ingredients', self.ingredients), ('directions', self.directions),
('notes', self.notes), ('recipe_name', self.recipe_name),
('synopsis', self.synopsis), ('uses', self.uses), ('source', self.source),
('labels', self.labels)])
return recipe_dict
|
# Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre quantos Dólares ela pode comprar.
# Considere US$1,00 = R$3,27
real = float(input('Digite quanto voçê possui na carteira e descubra quantos Dólares voçê conseguiria comprar: R$'))
dolar = real / 3.27
print('Com R${:.2f} que voçê possui na carteira, conseguiria comprar US${:.2f}'.format(real, dolar))
|
CITIES = {
'ADAMAOUA' : 1,
'CENTRE' : 2 ,
'EST' : 3,
'EXTREME-NORD' : 4,
'LITTORAL' : 5,
'OUEST' : 6,
'NORD' : 7,
'NORD-OUEST' : 8,
'SUD' : 9,
'SUD-OUEST' : 10,
'DOUALA' : 'X-22',
'YAOUNDE' : 'X-1'
}
MESSAGE = """
Bonjour, je suis zlight-bot (by landryjohn -> </lnjohn>)\n
Je suis l'activité d'ENEO en temps réel et je te donne\n
le programme prévisionnel de coupure en raison des
travaux de maintenance sur le réseau élétrique.
Comment ca marche : \n
--> /coupures [region ou ville]\n
[region] : C'est la region du cameroun dans laquelle tu te trouves,
il faudra préciser comme ci-dessous. ce paramètre est optionnel
Exemples :\n
/coupures centre\n
/coupures littoral\n
--> /aide : pour avoir de l'aide\n
--> /auteur : pour avoir les informations sur mon concepteur\n
Auteur : Landry John, [email protected]\n
"""
HELP = """
Comment ca marche : \n
--> /coupures [region ou ville]\n
[region] : C'est la region du cameroun dans laquelle tu te trouves,
il faudra préciser comme ci-dessous. ce paramètre est optionnel
Exemples :\n
/coupures centre\n
/coupures littoral\n
--> /aide : pour avoir de l'aide\n
--> /auteur : pour avoir les informations sur mon concepteur\n
"""
|
class User:
"""
Class that generates new instances of users.
"""
list_of_users = []
def __init__(self, user_name,gender, password):
self.user_name = user_name
self.gender = gender
self.password = password
def save_user(self):
'''
function that saves User objects into list_of_users
'''
self.list_of_users.append(self)
|
class GetTableInteractor(object):
def __init__(self, repo):
self.repo = repo
def set_params(self, user, year, month, before, after):
self.user = user
self.year = year
self.month = month
self.before = before
self.after = after
return self
def execute(self):
return self.repo.get_table(
self.user,
self.year,
self.month,
self.before,
self.after
)
|
# AUTOGENERATED! DO NOT EDIT! File to edit: 13_dataproc.ipynb (unless otherwise specified).
__all__ = ['dataproc_test']
# Cell
def dataproc_test(test_msg):
"Function dataproc"
return test_msg
|
def parse_config(path):
"""
This method parses a config file and constructs a list of blocks.
Each block is a singular unit in the architecture as explained in
the paper. Blocks are represented as a dictionary in the list.
Input:
- path: path to the config file.
Returns:
- a list containing a dictionary of individual block information.
"""
cfg_file = open(path, "r")
lines = cfg_file.read().split("\n")
lines = [line for line in lines if len(line) > 0]
lines = [line for line in lines if line[0] != '#']
lines = [line.strip() for line in lines]
block = {}
blocks_list = []
for line in lines:
if line[0] == "[":
if len(block) != 0:
blocks_list.append(block)
block = {}
block["type"] = line[1:-1].rstrip()
else:
idx, value = line.split("=")
block[idx.rstrip()] = value.lstrip()
blocks_list.append(block)
return blocks_list
|
todos = [
{
'id': 1,
'title': 'Workout tomorrow',
'body': 'I intend to go through some rigorous exercise targetting my abs and my lower stomach',
'completed': False,
'date': '08/12/2019'
},
{
'id': 2,
'title': 'Chefs Quaters',
'body': 'I intend to cook Rice with vegetables and also garnish it with some fried chicken',
'completed': False,
'date': '02/11/2019'
}
]
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 递归函数
# 计算阶乘
def fact(n):
if n == 1:
return 1
else:
return n * fact(n - 1)
print(fact(6))
# 尾递归形式: 尾递归是指,在函数返回的时候,调用自身本身,并且,return语句不能包含表达式。
# 如果尾递归做了优化是可以解决递归调用栈溢出的
# 但是 Python标准的解释器没有针对尾递归做优化,任何递归函数都存在栈溢出的问题。
def fact1(n):
return fact_item(n, 1)
pass
def fact_item(num, product):
if num == 1:
return product
return fact_item(num - 1, num * product)
# exercise 汉诺塔的移动
# 请编写move(n, a, b, c)函数,它接收参数n,表示3个柱子A、B、C中第1个柱子A的盘子数量,然后打印出把所有盘子从A借助B移动到C的方法
# https://www.zhihu.com/question/37152936
def move(n, a='A', b='B', c='C'):
if n == 1:
print(a, '--->', c)
else:
move(n-1, a, c, b)
move(1, a, b, c)
move(n-1, b, a, c)
pass
move(3)
|
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
ans = []
def dfs(n: int, k: int, s: int, path: List[int]) -> None:
if k == 0:
ans.append(path.copy())
return
for i in range(s, n + 1):
path.append(i)
dfs(n, k - 1, i + 1, path)
path.pop()
dfs(n, k, 1, [])
return ans
|
# -----------
# User Instructions:
#
# Modify the the search function so that it returns
# a shortest path as follows:
#
# [['>', 'v', ' ', ' ', ' ', ' '],
# [' ', '>', '>', '>', '>', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', 'v'],
# [' ', ' ', ' ', ' ', ' ', '*']]
#
# Where '>', '<', '^', and 'v' refer to right, left,
# up, and down motions. Note that the 'v' should be
# lowercase. '*' should mark the goal cell.
#
# You may assume that all test cases for this function
# will have a path from init to goal.
# ----------
grid = [[0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 1, 0],
[0, 0, 1, 0, 1, 0],
[0, 0, 1, 0, 1, 0]]
init = [0, 0]
goal = [len(grid)-1, len(grid[0])-1]
cost = 1
delta = [[-1, 0], # go up
[0, -1], # go left
[1, 0], # go down
[0, 1]] # go right
delta_name = ['^', '<', 'v', '>']
def search(grid, init, goal, cost):
# ----------------------------------------
# modify code below
# ----------------------------------------
closed = [[-1 for row in range(len(grid[0]))] for col in range(len(grid))]
closed[init[0]][init[1]] = 1
expand = [[' ' for row in range(len(grid[0]))] for col in range(len(grid))]
x = init[0]
y = init[1]
g = 0
closed[x][y] = 0
current_action = delta_name[0]
open = [[g, x, y]]
found = False # flag that is set when search is complete
resign = False # flag set if we can't find expand
while not found and not resign:
if len(open) == 0:
resign = True
return 'fail'
else:
open.sort()
open.reverse()
next = open.pop()
#expand[x][y] = current_action
x = next[1]
y = next[2]
g = next[0]
if x == goal[0] and y == goal[1]:
found = True
expand[x][y] = "*"
else:
for i in range(len(delta)):
x2 = x + delta[i][0]
y2 = y + delta[i][1]
if x2 >= 0 and x2 < len(grid) and y2 >= 0 and y2 < len(grid[0]):
if closed[x2][y2] == -1 and grid[x2][y2] == 0:
g2 = g + cost
open.append([g2, x2, y2])
closed[x2][y2] = g2
# current_action = delta_name[i]
path = []
print("closed")
for line in closed:
print(line)
print()
if found:
path.append(next)
print(path)
closest_points = []
actions = []
last_cost = path[0][0]
while last_cost != 0:
closest_points.clear()
actions.clear()
for i in range(len(delta)):
x2 = x + delta[i][0]
y2 = y + delta[i][1]
if x2 >= 0 and x2 < len(grid) and y2 >= 0 and y2 < len(grid[0]):
closest_cost = closed[x2][y2]
if closest_cost >= 0:
closest_points.append([closest_cost, x2, y2])
actions.append(delta_name[(i + 2) % len(delta_name)])
prev_cost = closed[x][y]
min_ind = 0
for i in range(len(closest_points)):
if closest_points[i][0] < prev_cost:
prev_cost = closest_points[i][0]
min_ind = i
last_cost = closest_points[min_ind][0]
x = closest_points[min_ind][1]
y = closest_points[min_ind][2]
current_action = actions[min_ind]
expand[x][y] = current_action
path.append([last_cost, x, y])
print("path")
for line in path:
print(line)
print()
return expand # make sure you return the shortest path
result = search(grid, init, goal, cost)
print("result")
for line in result:
print(line)
|
class PID:
"""
Discrete PID control
"""
def __init__(self, P=2.0, I=0.0, D=1.0, Derivator=0, Integrator=0, Integrator_windup_max=100, Integrator_windup_min=-100):
self.Kp=P
self.Ki=I
self.Kd=D
self.Derivator=Derivator
self.Integrator=Integrator
self.Integrator_max=Integrator_windup_max
self.Integrator_min=Integrator_windup_min
self.set_point=0.0
self.error=0.0
def update(self,current_value):
"""
Calculate PID output value for given reference input and feedback
"""
self.error = self.set_point - current_value # vel_setpoint - vel_atual
self.P_value = self.Kp * self.error
self.D_value = self.Kd * ( self.error - self.Derivator)
self.Derivator = self.error
self.Integrator = self.Integrator + self.error
if self.Integrator > self.Integrator_max:
self.Integrator = self.Integrator_max
elif self.Integrator < self.Integrator_min:
self.Integrator = self.Integrator_min
self.I_value = self.Integrator * self.Ki
PID = self.P_value + self.I_value + self.D_value
return PID
def setPoint(self,set_point):
"""
Initilize the setpoint of PID
"""
self.set_point = set_point
self.Integrator=0
self.Derivator=0
def getSetPoint(self):
return self.set_point
def getError(self):
self.set_point = 1e-6 if self.set_point == 0 else self.set_point
error_percentage = (self.error/self.set_point)*100
return error_percentage
def getIntegrator(self):
return self.Integrator
def getDerivator(self):
return self.Derivator
def setWindup(self, windup_max, windup_min):
self.Integrator_max = windup_max
self.Integrator_min = windup_min
|
def add_numbers(start,end):
c = 0
for number in range(start,end+1):
print(number)
c = c + number
return(c)
answer = add_numbers(333,777)
#print(answer)
#print(add_numbers())
#add_numbers()
|
# CELERY
CELERY_BROKER_URL = 'redis://10.16.78.86:6380'
CELERY_RESULT_BACKEND = 'redis://10.16.78.86:6380'
# NGINX STATIC HOME
DOC_HOME = '/opt/data'
# Flask-Log Settings
LOG_LEVEL = 'debug'
LOG_FILENAME = "/var/archives/error.log"
LOG_ENABLE_CONSOLE = False
# REDIS Settings
REDIS_HOST = '10.16.78.86'
REDIS_PORT = 6383
|
X = [[12,7,3],
[4,5,6],
[7,8,9]]
Y = [[5,8,1],
[6,7,3],
[4,5,9]]
result = [[0,0,0],
[0,0,0],
[0,0,0]]
print(len(X),len(Y))
# iterate through rows
for i in range(0,3):
# iterate through columns
for j in range(0,3):
result[i][j] = X[i][j] + Y[i][j]
for r in result:
print(r)
|
#!/bin/python3
annee_naissance = input('t ne ou ')
annee = 2025 - int(annee_naissance)
print(annee)
print(f'voila : {str(annee)} pewepw')
|
# Python program to demonstrate in-built poly-
# morphic functions
# len() being used for a string
print(len("geeks"))
# len() being used for a list
print(len([10, 20, 30]))
|
""" PayloadGroup type/prototype containing multiple Payload objects """
class PayloadGroup(object):
""" PayloadGroup Class: groups of individual Payload objects. """
def __init__(self, payloads, check_type_list=[]):
""" Initialize a PayloadGroup
This interface is kept similar to the interface for the Payload class.
payloads list of Payload objects.
check_type_list list of types of checks to run using these Payloads. Default [].
"""
self.payloads = payloads
def add_payload(self, payload):
""" Add a Payloadobject to this group.
payload Payload object
"""
self.payloads.append(payload)
|
class Solution:
def isOneBitCharacter(self, bits):
if len(bits) == 1:
return True
idx = 0
while True:
if idx == len(bits) - 3 or idx == len(bits) - 2:
break
if bits[idx] == 1:
idx += 2
else:
idx += 1
if idx == len(bits) - 3:
if bits[idx] == 1:
return True
if bits[idx + 1] == 0:
return True
return False
if idx == len(bits) - 2:
if bits[idx] == 1:
return False
return True
class Solution2:
def isOneBitCharacter(self, bits):
idx = 0
ans = False
while idx < len(bits):
if bits[idx] == 1:
idx += 2
ans = False
else:
idx += 1
ans = True
return ans
|
# S E
# array = [8, 5, 2, 8, 5, 6, 3]
# P L R
# if s >= e : r
# assigning p, l, r -variables
# while r >= e
# if l >= p & r <= p
# swap
# l <= p - l+
# r >= p - r-
# leftsubarrayissmaller = r - 1 - s < e - (r + 1)
# (p , s, r - 1)
# (p, r + 1, e)
# Worst : time - O(n^2),Space- O(log(n)) # in input - swap all positions
# Best: time - O(nlog(n)),Space- O(log(n)) # in input - swap postions for left and right subarray
# Avg: time - O(nlog(n)),Space- O(log(n))
def quickSort(array):
quickSortHelper(array, 0, len(array) - 1)
return array
def quickSortHelper(array, startIdx, endIdx):
if startIdx >= endIdx:
return
pivotIdx = startIdx # assuming far left of the array
leftIdx = startIdx + 1
rightIdx = endIdx
while rightIdx >= leftIdx:
if array[leftIdx] > array[pivotIdx] and array[rightIdx] < array[pivotIdx]:
swap(leftIdx, rightIdx, array)
if array[leftIdx] <= array[pivotIdx]:
leftIdx += 1
if array[rightIdx] >= array[pivotIdx]:
rightIdx -= 1
swap(pivotIdx, rightIdx, array) # R < L
# leftSubarray = (rightIdx - 1) -> pivot is located here
# rightSubarray = endIdx - (rightIdx + 1)
leftSubarrayIsSmaller = rightIdx - 1 - startIdx < endIdx - (rightIdx + 1)
if leftSubarrayIsSmaller:
quickSortHelper(array, startIdx, rightIdx - 1) # leftSubarray
quickSortHelper(array, rightIdx + 1, endIdx) # rightSubarray
else:
quickSortHelper(array, rightIdx + 1, endIdx) # rightSubarray
quickSortHelper(array, startIdx, rightIdx - 1) # leftSubarray
def swap(i, j, array):
array[i], array[j] = array[j], array[i]
|
def palindrome(n):
a0=n
s=0
while a0>0:
d=a0%10
s=s*10+d
a0=a0//10
if s==n:
return 1
else:
return 0
n=int(input("Enter a number "))
if palindrome(n)==1:
print("palindrome ...")
else:
print("Not palindrome..")
|
# coding=utf-8
# 定义类
# 定义列属性
class DataConfig():
# 用例属性:
case_id = "用例ID"
case_model = "模块"
case_name = "接口名称"
url = "请求URL"
pre_exec = "前置条件"
method = "请求类型"
params_type = "请求参数类型"
params = "请求参数"
expect_result = "预期结果"
actual_result = "实际结果"
beizhu = "备注"
is_run = "是否运行"
headers = "headers"
cookies = "cookies"
code = "status_code"
db_verify = "数据库验证"
|
class Bicycle:
def __init__(self, name, wheel_numbers, brake_type, gear_number):
self.name = name
self.wheel_numbers = wheel_numbers
self.brake_type = brake_type
self.gear_number = gear_number
bicycle = Bicycle('single speed', '2', 'rim brake', 'free wheel')
print(bicycle.name)
print(bicycle.brake_type)
class Motorcycle(Bicycle):
accelerate = "throttle"
motor = "gas"
class Outdoor_Elliptical(Bicycle):
position = "standing"
pedals = "elliptical"
|
CELERY_IMPORTS=("app", )
CELERY_BROKER_URL="amqp://saket:fedora13@localhost//"
CELERY_RESULT_BACKEND="amqp://saket:fedora13@localhost//"
SQLALCHEMY_DATABASE_URI="mysql://saket:fedora13@localhost/moca"
CELERYD_MAX_TASKS_PER_CHILD=10
|
"""
File: largest_digit.py
Name: Johsuan
----------------------------------
This file recursively prints the biggest digit in
5 different integers, 12345, 281, 6, -111, -9453
If your implementation is correct, you should see
5, 8, 6, 1, 9 on Console.
"""
def main():
print(find_largest_digit(12345)) # 5
print(find_largest_digit(281)) # 8
print(find_largest_digit(6)) # 6
print(find_largest_digit(-111)) # 1
print(find_largest_digit(-9453)) # 9
def find_largest_digit(n):
"""
:param n: int, the number that was entered.
:return: int, the digit with biggest value in n.
"""
max = 0
if n < 0:
n = -n
return find_max(n, max)
def find_max(n, max):
k = n % 10
if n//10 == 0:
if k > max:
max = k
return max
else:
if k > max:
max = k
return find_max(n//10, max)
if __name__ == '__main__':
main()
|
def ficha(nome, gols):
if not gols.isnumeric():
gols = '0'
if nome == '':
nome = '<desconhecido>'
print('O jogador {} marcou {} gol(s) no campeonato.'.format(nome, gols))
print('-' * 50)
nome = str(input('Nome do jogador: '))
gols = str(input('Número de gols: '))
ficha(nome, gols)
|
class Restaurant:
def __init__(self):
self.restaurant = []
def update_location(self):
pass
def add(self, restaurant):
self.restaurant.append(restaurant)
|
t = int(input())
for i in range(t):
count = 0
n = int(input())
l = list(map(int, input().split()))
for j in range(1,len(l)-1):
if l[j-1]<l[j] and l[j+1]<l[j]:
count += 1
print(f'Case #{i+1}: {count}')
|
def linear_search(arr, x):
for i in range(len(arr)):
if arr[i] == x:
return i
return -1
def binary_search(arr, low, high, x):
if high >= 1:
mid = (high + low) // 2
if arr[mid] == x:
return mid
elif arr[mid] > x:
return binary_search(arr, low, mid - 1, x)
else:
return binary_search(arr, mid + 1, high, x)
else:
return -1
def insertion_sort(arr):
for i in range(1, len(arr)):
key = arr[i]
j = i - 1
while j >= 0 and key < arr[j]:
arr[j + 1] = arr[j]
j -= 1
arr[j + 1] = key
print(arr)
def bubble_sort(arr):
n = len(arr)
for i in range(n - 1):
for j in range(0, n - i - 1):
if arr[j] > arr[j + 1]:
arr[j], arr[j + 1] = arr[j + 1], arr[j]
print(arr)
arr = [11, 13, 12, 5, 6]
print(arr)
print('''
--------------------
| SEARCH OPTIONS |
--------------------
| 1. Linear Search |
| 2. Binary Search |
--------------------
''')
ans = 'y'
while ans == 'y' or ans == 'Y':
ch = int(input("Enter your choice(1/2): "))
if ch == 1:
x = int(input("Enter your search element: "))
pos = linear_search(arr, x)
if pos == -1:
print("The search element not found!")
else:
print("The element was found at the position: ", pos + 1)
elif ch == 2:
x = int(input("Enter your search element: "))
print("Sort the elements:-")
print("1. Insertion sort")
print("2. Bubble sort")
ans = 'y'
while ans == 'y' or ans == 'Y':
ch = int(input("Enter your choice(1/2): "))
if ch == 1:
insertion_sort(arr)
elif ch == 2:
bubble_sort(arr)
else:
print("Wrong choice!!!")
break
pos = binary_search(arr, 0, len(arr) - 1, x)
if pos != -1:
print("Element is present at position:", pos + 1, "of sorted array")
else:
print("Element is not present in array !")
else:
print("Wrong choice!!!")
ans = str(input("Do you want to continue?(y/n): "))
################################################################################
|
# Exercício Python 19: Crie um programa que leia duas notas de um aluno e calcule sua média, mostrando uma mensagem no final, de acordo com a média atingida:
#Média abaixo de 5.0: REPROVADO
#Média entre 5.0 e 6.9: RECUPERAÇÃO
#Média 7.0 ou superior: APROVADO
n1 = float(input('Insira sua nota 1: '))
n2 = float(input('Insira sua nota 2: '))
media = (n1+n2)/2
print(f'\nMédia do Aluno: {media}')
if media < 5.0:
print('\033[1;31mREPROVADO\033[m\n')
elif media >= 5.0 or media <= 6.9:
print('\033[1;34mRECUPERAÇÃO\033[m\n')
elif media >= 7.0:
print('\033[1;32APROVADO\033[m\n')
|
emptyForm = """
{"form": [
{
"type": "message",
"name": "note",
"description": "Connect to graphql"
},
{
"name": "url",
"description": "Graphql URL",
"type": "string",
"required": true
}
]}
"""
|
"""
List of image ids for the validation split of the
full training set of the MPII Pose dataset.
The image file ids have been randomly generated and are set to
have a split of 70-30 w.r.t. all available person detections
with all pose detections for the custom training and validation
splits.
"""
val_images_ids = [4, 7, 13, 14, 17, 18, 21, 23, 28, 31, 38, 40, 42, 46, 56, 70, 72, 88, 89, 94, 104, 106, 107, 116, 118, 120, 122, 124, 127, 130, 136, 138, 140, 144, 147, 150, 153, 155, 167, 168, 172, 176, 179, 181, 189, 190, 193, 206, 207, 208, 223, 227, 229, 230, 231, 232, 234, 239, 240, 257, 270, 273, 277, 286, 290, 302, 305, 311, 313, 328, 333, 338, 342, 347, 354, 356, 358, 359, 368, 373, 374, 375, 376, 378, 379, 381, 382, 386, 387, 391, 394, 398, 409, 420, 422, 427, 429, 430, 437, 447, 455, 460, 461, 463, 464, 475, 477, 479, 482, 486, 487, 488, 491, 496, 498, 500, 502, 503, 508, 512, 513, 530, 531, 533, 544, 545, 559, 561, 562, 563, 565, 571, 572, 579, 589, 593, 595, 596, 597, 608, 610, 612, 617, 618, 622, 631, 635, 638, 642, 647, 648, 656, 660, 661, 665, 672, 680, 685, 701, 704, 705, 711, 727, 760, 767, 769, 771, 775, 777, 780, 784, 785, 787, 788, 789, 793, 796, 798, 814, 817, 822, 823, 827, 833, 842, 850, 854, 858, 865, 869, 873, 874, 882, 888, 891, 898, 906, 913, 924, 938, 942, 950, 952, 960, 962, 965, 969, 970, 973, 977, 981, 982, 984, 986, 992, 993, 997, 1024, 1033, 1036, 1053, 1059, 1060, 1061, 1070, 1092, 1095, 1097, 1098, 1101, 1102, 1104, 1107, 1116, 1118, 1121, 1124, 1135, 1136, 1140, 1141, 1142, 1145, 1148, 1149, 1150, 1151, 1152, 1159, 1164, 1166, 1168, 1170, 1171, 1172, 1175, 1177, 1204, 1210, 1212, 1213, 1215, 1217, 1237, 1242, 1246, 1247, 1252, 1254, 1258, 1259, 1262, 1266, 1267, 1272, 1287, 1292, 1294, 1298, 1299, 1300, 1306, 1309, 1313, 1314, 1315, 1319, 1328, 1329, 1333, 1337, 1338, 1340, 1341, 1347, 1352, 1353, 1367, 1370, 1374, 1378, 1396, 1403, 1409, 1414, 1417, 1425, 1429, 1436, 1450, 1453, 1458, 1462, 1469, 1472, 1476, 1478, 1482, 1483, 1492, 1493, 1499, 1500, 1504, 1507, 1510, 1512, 1513, 1515, 1517, 1520, 1524, 1526, 1540, 1551, 1553, 1554, 1558, 1560, 1562, 1567, 1579, 1581, 1593, 1595, 1598, 1602, 1610, 1620, 1622, 1639, 1647, 1655, 1659, 1665, 1666, 1668, 1672, 1679, 1694, 1696, 1703, 1705, 1706, 1709, 1722, 1725, 1738, 1749, 1753, 1755, 1770, 1777, 1782, 1784, 1793, 1794, 1796, 1803, 1805, 1808, 1810, 1814, 1816, 1817, 1818, 1820, 1839, 1843, 1860, 1863, 1872, 1877, 1887, 1890, 1891, 1893, 1895, 1898, 1924, 1926, 1948, 1949, 1957, 1971, 1976, 1983, 1989, 1990, 1993, 1994, 1996, 1997, 2002, 2003, 2005, 2006, 2008, 2009, 2016, 2019, 2028, 2029, 2030, 2034, 2040, 2041, 2044, 2048, 2051, 2054, 2055, 2056, 2061, 2063, 2064, 2065, 2066, 2085, 2091, 2093, 2098, 2100, 2121, 2122, 2125, 2129, 2149, 2157, 2161, 2164, 2166, 2168, 2171, 2174, 2180, 2184, 2185, 2189, 2190, 2215, 2228, 2230, 2231, 2234, 2239, 2256, 2257, 2258, 2259, 2261, 2262, 2296, 2316, 2318, 2320, 2326, 2332, 2340, 2341, 2343, 2348, 2350, 2358, 2381, 2384, 2389, 2391, 2393, 2399, 2407, 2415, 2419, 2427, 2428, 2440, 2441, 2442, 2463, 2467, 2468, 2486, 2489, 2491, 2496, 2497, 2500, 2524, 2526, 2543, 2553, 2554, 2562, 2564, 2567, 2568, 2570, 2571, 2580, 2581, 2585, 2590, 2591, 2598, 2599, 2600, 2601, 2605, 2609, 2612, 2613, 2618, 2626, 2630, 2633, 2638, 2640, 2641, 2642, 2648, 2650, 2655, 2662, 2666, 2670, 2673, 2674, 2691, 2692, 2695, 2696, 2699, 2701, 2702, 2703, 2708, 2711, 2712, 2713, 2715, 2724, 2726, 2733, 2746, 2749, 2753, 2756, 2757, 2765, 2770, 2777, 2784, 2796, 2797, 2799, 2800, 2801, 2802, 2803, 2821, 2822, 2825, 2838, 2840, 2842, 2843, 2859, 2860, 2861, 2863, 2869, 2874, 2881, 2882, 2884, 2887, 2900, 2902, 2905, 2912, 2914, 2923, 2925, 2930, 2932, 2933, 2941, 2947, 2955, 2965, 2969, 2974, 2977, 2978, 2979, 2991, 3004, 3007, 3009, 3010, 3011, 3012, 3016, 3018, 3021, 3027, 3028, 3030, 3035, 3039, 3041, 3045, 3047, 3048, 3050, 3062, 3067, 3071, 3084, 3086, 3087, 3088, 3091, 3092, 3100, 3101, 3114, 3115, 3119, 3120, 3128, 3130, 3139, 3146, 3149, 3151, 3155, 3162, 3169, 3171, 3172, 3176, 3177, 3178, 3179, 3182, 3183, 3185, 3187, 3190, 3192, 3193, 3194, 3199, 3238, 3240, 3243, 3249, 3250, 3252, 3256, 3262, 3263, 3273, 3274, 3276, 3278, 3282, 3284, 3288, 3303, 3304, 3305, 3315, 3316, 3317, 3323, 3325, 3327, 3330, 3339, 3343, 3344, 3357, 3359, 3366, 3368, 3370, 3371, 3382, 3383, 3386, 3403, 3414, 3422, 3433, 3439, 3446, 3451, 3454, 3458, 3464, 3468, 3471, 3475, 3482, 3487, 3492, 3493, 3519, 3520, 3529, 3530, 3537, 3538, 3539, 3552, 3577, 3580, 3583, 3584, 3592, 3593, 3594, 3595, 3596, 3598, 3599, 3616, 3620, 3621, 3623, 3624, 3625, 3628, 3631, 3636, 3637, 3641, 3642, 3643, 3645, 3647, 3648, 3653, 3655, 3656, 3658, 3662, 3663, 3665, 3666, 3676, 3681, 3684, 3689, 3690, 3696, 3699, 3702, 3703, 3705, 3706, 3716, 3719, 3726, 3727, 3728, 3749, 3754, 3757, 3758, 3760, 3761, 3763, 3768, 3778, 3779, 3783, 3784, 3785, 3791, 3792, 3793, 3796, 3801, 3805, 3811, 3813, 3815, 3816, 3818, 3833, 3834, 3836, 3838, 3841, 3846, 3848, 3855, 3856, 3861, 3866, 3869, 3873, 3883, 3887, 3891, 3892, 3893, 3906, 3916, 3917, 3924, 3928, 3929, 3930, 3931, 3940, 3941, 3952, 3954, 3955, 3956, 3970, 3973, 3980, 3981, 3983, 3996, 3997, 4002, 4004, 4006, 4007, 4015, 4018, 4020, 4029, 4031, 4033, 4034, 4044, 4048, 4063, 4064, 4067, 4072, 4074, 4077, 4079, 4103, 4104, 4131, 4133, 4137, 4139, 4144, 4146, 4154, 4158, 4160, 4162, 4165, 4166, 4180, 4187, 4196, 4197, 4198, 4200, 4201, 4209, 4212, 4216, 4217, 4218, 4222, 4228, 4231, 4234, 4237, 4241, 4242, 4248, 4263, 4265, 4269, 4274, 4278, 4298, 4303, 4306, 4308, 4314, 4321, 4323, 4324, 4326, 4328, 4330, 4335, 4343, 4361, 4362, 4368, 4375, 4377, 4379, 4398, 4405, 4407, 4409, 4416, 4419, 4422, 4424, 4426, 4427, 4431, 4432, 4434, 4435, 4436, 4439, 4442, 4443, 4445, 4450, 4453, 4465, 4472, 4477, 4481, 4483, 4485, 4496, 4498, 4502, 4504, 4509, 4533, 4559, 4562, 4568, 4571, 4572, 4574, 4581, 4591, 4592, 4604, 4610, 4611, 4615, 4617, 4629, 4631, 4633, 4636, 4639, 4640, 4641, 4654, 4656, 4657, 4658, 4661, 4664, 4668, 4669, 4670, 4674, 4675, 4690, 4693, 4717, 4719, 4724, 4725, 4726, 4728, 4729, 4750, 4757, 4758, 4772, 4779, 4791, 4799, 4802, 4819, 4822, 4823, 4824, 4825, 4827, 4828, 4833, 4834, 4840, 4842, 4846, 4864, 4868, 4871, 4872, 4874, 4878, 4879, 4885, 4887, 4893, 4895, 4900, 4905, 4916, 4917, 4918, 4930, 4939, 4940, 4962, 4969, 4970, 4986, 4990, 4993, 4996, 5012, 5014, 5025, 5026, 5030, 5034, 5035, 5043, 5049, 5050, 5051, 5061, 5071, 5072, 5079, 5100, 5101, 5104, 5112, 5113, 5118, 5124, 5126, 5128, 5136, 5138, 5146, 5149, 5151, 5152, 5159, 5162, 5164, 5165, 5168, 5169, 5171, 5173, 5185, 5187, 5190, 5191, 5195, 5203, 5205, 5206, 5211, 5214, 5217, 5221, 5231, 5246, 5251, 5253, 5261, 5307, 5313, 5338, 5343, 5347, 5348, 5349, 5351, 5353, 5357, 5363, 5386, 5387, 5391, 5398, 5405, 5406, 5408, 5415, 5421, 5422, 5423, 5424, 5425, 5428, 5432, 5441, 5447, 5451, 5452, 5455, 5459, 5463, 5466, 5468, 5469, 5470, 5477, 5478, 5483, 5485, 5486, 5487, 5496, 5498, 5504, 5506, 5530, 5532, 5534, 5539, 5562, 5563, 5564, 5574, 5575, 5576, 5577, 5580, 5592, 5593, 5596, 5599, 5607, 5608, 5609, 5610, 5621, 5624, 5625, 5637, 5642, 5643, 5644, 5645, 5646, 5650, 5652, 5654, 5655, 5657, 5660, 5663, 5666, 5673, 5675, 5676, 5680, 5681, 5683, 5684, 5687, 5688, 5689, 5690, 5692, 5698, 5699, 5700, 5703, 5705, 5708, 5709, 5711, 5729, 5736, 5741, 5743, 5744, 5746, 5752, 5753, 5754, 5756, 5763, 5766, 5767, 5769, 5770, 5773, 5775, 5777, 5782, 5783, 5791, 5792, 5794, 5812, 5814, 5817, 5821, 5823, 5833, 5836, 5837, 5840, 5842, 5843, 5847, 5849, 5852, 5853, 5855, 5859, 5863, 5864, 5865, 5869, 5871, 5872, 5873, 5879, 5880, 5884, 5887, 5891, 5892, 5893, 5894, 5896, 5897, 5915, 5918, 5919, 5926, 5932, 5934, 5935, 5942, 5944, 5960, 5961, 5962, 5965, 5969, 5970, 5978, 5979, 5986, 5987, 5988, 5990, 5997, 5998, 6008, 6010, 6014, 6018, 6022, 6030, 6031, 6045, 6047, 6049, 6051, 6052, 6054, 6062, 6063, 6065, 6068, 6083, 6086, 6093, 6095, 6096, 6097, 6105, 6113, 6115, 6139, 6141, 6147, 6156, 6157, 6159, 6162, 6164, 6166, 6174, 6177, 6179, 6180, 6182, 6184, 6186, 6188, 6189, 6192, 6196, 6198, 6200, 6203, 6204, 6209, 6217, 6218, 6227, 6229, 6234, 6239, 6241, 6248, 6250, 6254, 6265, 6267, 6276, 6285, 6297, 6302, 6313, 6326, 6329, 6332, 6345, 6347, 6353, 6362, 6365, 6366, 6367, 6368, 6377, 6381, 6382, 6404, 6407, 6411, 6412, 6427, 6430, 6431, 6434, 6436, 6442, 6444, 6447, 6448, 6452, 6455, 6463, 6465, 6466, 6482, 6487, 6488, 6489, 6497, 6528, 6530, 6531, 6533, 6549, 6551, 6555, 6560, 6564, 6565, 6567, 6568, 6569, 6574, 6578, 6579, 6580, 6581, 6583, 6593, 6596, 6597, 6600, 6605, 6620, 6621, 6643, 6652, 6659, 6660, 6664, 6665, 6666, 6672, 6683, 6684, 6687, 6688, 6720, 6723, 6724, 6725, 6727, 6729, 6744, 6745, 6746, 6751, 6752, 6753, 6758, 6759, 6761, 6764, 6767, 6768, 6769, 6782, 6784, 6785, 6786, 6792, 6800, 6801, 6804, 6814, 6826, 6828, 6835, 6842, 6843, 6857, 6862, 6865, 6872, 6891, 6896, 6899, 6901, 6904, 6910, 6915, 6916, 6917, 6920, 6922, 6924, 6927, 6932, 6933, 6936, 6939, 6940, 6942, 6944, 6957, 6961, 6973, 6976, 6981, 7006, 7007, 7009, 7010, 7011, 7029, 7032, 7033, 7054, 7058, 7064, 7065, 7071, 7083, 7094, 7098, 7099, 7100, 7101, 7108, 7109, 7110, 7111, 7113, 7122, 7123, 7124, 7139, 7141, 7144, 7151, 7152, 7155, 7158, 7182, 7185, 7186, 7188, 7189, 7197, 7202, 7204, 7207, 7210, 7211, 7222, 7226, 7227, 7228, 7241, 7244, 7246, 7254, 7257, 7258, 7261, 7262, 7266, 7275, 7279, 7281, 7283, 7284, 7287, 7294, 7296, 7300, 7302, 7304, 7305, 7316, 7317, 7319, 7320, 7332, 7336, 7339, 7342, 7343, 7351, 7352, 7356, 7357, 7360, 7363, 7364, 7366, 7368, 7373, 7381, 7385, 7388, 7394, 7397, 7401, 7402, 7405, 7408, 7416, 7417, 7420, 7426, 7428, 7430, 7431, 7433, 7435, 7438, 7440, 7444, 7446, 7449, 7455, 7456, 7459, 7460, 7461, 7473, 7474, 7477, 7486, 7488, 7506, 7507, 7513, 7515, 7529, 7535, 7537, 7541, 7544, 7546, 7554, 7567, 7575, 7579, 7580, 7588, 7591, 7597, 7600, 7601, 7602, 7605, 7606, 7609, 7622, 7623, 7624, 7625, 7627, 7646, 7648, 7658, 7660, 7663, 7664, 7669, 7670, 7692, 7694, 7698, 7699, 7704, 7715, 7716, 7717, 7720, 7723, 7744, 7746, 7751, 7754, 7759, 7766, 7770, 7771, 7774, 7775, 7776, 7777, 7783, 7786, 7788, 7823, 7840, 7844, 7849, 7852, 7855, 7856, 7857, 7859, 7861, 7862, 7863, 7864, 7870, 7873, 7874, 7875, 7876, 7879, 7880, 7886, 7887, 7890, 7894, 7901, 7915, 7917, 7918, 7921, 7924, 7941, 7943, 7947, 7954, 7955, 7969, 7970, 7994, 8008, 8012, 8014, 8015, 8017, 8019, 8020, 8024, 8039, 8040, 8045, 8047, 8050, 8054, 8058, 8065, 8067, 8068, 8069, 8076, 8077, 8079, 8080, 8082, 8088, 8090, 8098, 8102, 8105, 8111, 8113, 8128, 8133, 8140, 8143, 8165, 8172, 8176, 8185, 8186, 8188, 8189, 8191, 8192, 8194, 8195, 8211, 8212, 8214, 8226, 8229, 8245, 8251, 8253, 8262, 8264, 8266, 8268, 8273, 8276, 8277, 8279, 8283, 8284, 8285, 8286, 8288, 8293, 8295, 8298, 8303, 8305, 8307, 8309, 8312, 8328, 8332, 8334, 8337, 8338, 8342, 8346, 8349, 8353, 8369, 8370, 8379, 8380, 8382, 8384, 8388, 8389, 8390, 8393, 8395, 8404, 8405, 8407, 8408, 8414, 8415, 8418, 8421, 8423, 8424, 8446, 8447, 8456, 8459, 8461, 8465, 8467, 8468, 8470, 8472, 8475, 8478, 8485, 8487, 8488, 8495, 8503, 8504, 8507, 8510, 8515, 8519, 8524, 8525, 8529, 8532, 8534, 8536, 8551, 8561, 8571, 8572, 8573, 8578, 8579, 8580, 8585, 8587, 8589, 8607, 8608, 8613, 8637, 8638, 8640, 8648, 8651, 8653, 8655, 8656, 8659, 8662, 8663, 8665, 8681, 8683, 8686, 8689, 8691, 8706, 8710, 8713, 8714, 8716, 8717, 8718, 8719, 8722, 8725, 8726, 8737, 8740, 8741, 8747, 8751, 8752, 8768, 8773, 8774, 8777, 8782, 8783, 8784, 8793, 8796, 8797, 8804, 8807, 8810, 8814, 8817, 8818, 8820, 8827, 8829, 8830, 8832, 8835, 8838, 8853, 8857, 8862, 8865, 8873, 8876, 8882, 8904, 8907, 8908, 8911, 8912, 8914, 8925, 8927, 8931, 8937, 8938, 8961, 8962, 8964, 8966, 8968, 8973, 8974, 8977, 8983, 8999, 9000, 9005, 9012, 9013, 9014, 9016, 9020, 9030, 9044, 9056, 9059, 9066, 9070, 9071, 9072, 9077, 9107, 9111, 9119, 9121, 9123, 9127, 9128, 9130, 9133, 9134, 9138, 9143, 9152, 9156, 9159, 9178, 9179, 9180, 9185, 9207, 9209, 9213, 9215, 9219, 9221, 9229, 9230, 9241, 9244, 9252, 9253, 9255, 9256, 9257, 9260, 9262, 9270, 9271, 9275, 9278, 9279, 9280, 9283, 9286, 9303, 9305, 9309, 9314, 9320, 9324, 9327, 9332, 9335, 9336, 9341, 9368, 9369, 9370, 9378, 9384, 9390, 9396, 9400, 9401, 9406, 9407, 9411, 9418, 9423, 9428, 9429, 9431, 9442, 9443, 9444, 9445, 9447, 9448, 9450, 9482, 9489, 9492, 9497, 9499, 9504, 9505, 9509, 9510, 9512, 9513, 9535, 9536, 9537, 9540, 9541, 9543, 9544, 9548, 9551, 9552, 9553, 9560, 9568, 9583, 9586, 9589, 9611, 9613, 9614, 9619, 9620, 9622, 9623, 9626, 9628, 9630, 9632, 9633, 9634, 9657, 9664, 9676, 9688, 9690, 9692, 9694, 9697, 9699, 9704, 9705, 9708, 9714, 9724, 9725, 9728, 9743, 9744, 9747, 9755, 9758, 9765, 9768, 9770, 9773, 9780, 9785, 9789, 9792, 9793, 9799, 9800, 9804, 9805, 9808, 9809, 9810, 9815, 9816, 9821, 9827, 9834, 9836, 9838, 9839, 9842, 9843, 9844, 9848, 9852, 9853, 9856, 9857, 9862, 9863, 9869, 9879, 9880, 9886, 9888, 9901, 9902, 9929, 9930, 9932, 9934, 9936, 9938, 9961, 9969, 9971, 9974, 9975, 9978, 9979, 9993, 9994, 9997, 9998, 10000, 10003, 10004, 10007, 10008, 10021, 10036, 10038, 10040, 10042, 10050, 10062, 10063, 10066, 10076, 10078, 10081, 10083, 10097, 10098, 10102, 10103, 10104, 10105, 10106, 10107, 10110, 10114, 10119, 10121, 10139, 10141, 10147, 10150, 10151, 10153, 10158, 10159, 10162, 10164, 10172, 10175, 10177, 10180, 10191, 10192, 10195, 10200, 10203, 10207, 10208, 10209, 10210, 10211, 10213, 10216, 10218, 10219, 10220, 10222, 10224, 10255, 10278, 10280, 10283, 10288, 10289, 10297, 10310, 10314, 10315, 10320, 10327, 10330, 10333, 10336, 10358, 10374, 10376, 10377, 10378, 10383, 10385, 10386, 10391, 10394, 10401, 10404, 10407, 10432, 10433, 10437, 10440, 10441, 10456, 10457, 10477, 10478, 10479, 10481, 10482, 10490, 10494, 10496, 10504, 10505, 10509, 10510, 10536, 10539, 10540, 10546, 10547, 10548, 10571, 10573, 10579, 10580, 10581, 10592, 10594, 10601, 10602, 10603, 10611, 10613, 10619, 10626, 10631, 10632, 10637, 10639, 10643, 10644, 10646, 10649, 10650, 10652, 10654, 10655, 10657, 10659, 10663, 10665, 10677, 10678, 10679, 10681, 10685, 10686, 10688, 10690, 10691, 10695, 10709, 10710, 10711, 10713, 10724, 10725, 10732, 10733, 10734, 10742, 10747, 10754, 10757, 10758, 10767, 10769, 10770, 10773, 10774, 10775, 10776, 10778, 10779, 10780, 10786, 10789, 10797, 10800, 10801, 10802, 10807, 10808, 10810, 10811, 10823, 10824, 10837, 10838, 10842, 10846, 10847, 10848, 10852, 10856, 10865, 10866, 10867, 10869, 10878, 10880, 10887, 10908, 10910, 10915, 10916, 10930, 10935, 10937, 10940, 10941, 10947, 10948, 10950, 10951, 10956, 10963, 10970, 10972, 10973, 10979, 10981, 10983, 10984, 10998, 10999, 11008, 11011, 11013, 11016, 11017, 11021, 11025, 11030, 11031, 11047, 11048, 11051, 11059, 11061, 11062, 11063, 11064, 11067, 11070, 11072, 11073, 11078, 11083, 11093, 11098, 11099, 11100, 11101, 11102, 11105, 11107, 11112, 11113, 11115, 11118, 11120, 11123, 11128, 11137, 11138, 11147, 11148, 11154, 11156, 11199, 11202, 11206, 11210, 11211, 11214, 11215, 11218, 11230, 11234, 11238, 11242, 11243, 11250, 11252, 11259, 11262, 11265, 11269, 11276, 11297, 11300, 11304, 11306, 11313, 11314, 11315, 11320, 11323, 11328, 11329, 11332, 11333, 11334, 11349, 11357, 11359, 11371, 11373, 11375, 11377, 11383, 11389, 11390, 11396, 11398, 11399, 11400, 11403, 11404, 11406, 11407, 11428, 11436, 11439, 11444, 11448, 11454, 11455, 11459, 11462, 11467, 11474, 11482, 11486, 11488, 11489, 11494, 11496, 11497, 11498, 11513, 11516, 11517, 11526, 11528, 11532, 11537, 11547, 11550, 11552, 11555, 11556, 11558, 11561, 11573, 11583, 11588, 11601, 11603, 11604, 11609, 11617, 11629, 11638, 11640, 11641, 11642, 11655, 11656, 11661, 11664, 11665, 11667, 11670, 11682, 11687, 11688, 11689, 11690, 11691, 11693, 11713, 11725, 11737, 11738, 11742, 11745, 11746, 11756, 11757, 11758, 11760, 11763, 11764, 11775, 11785, 11789, 11793, 11796, 11798, 11800, 11801, 11803, 11806, 11815, 11817, 11826, 11829, 11830, 11833, 11834, 11838, 11839, 11841, 11842, 11845, 11847, 11848, 11862, 11864, 11899, 11900, 11902, 11906, 11914, 11917, 11919, 11926, 11928, 11932, 11935, 11939, 11960, 11961, 11964, 11977, 11978, 11985, 11988, 11991, 11992, 11994, 11995, 12000, 12002, 12003, 12011, 12020, 12023, 12024, 12028, 12049, 12052, 12056, 12067, 12070, 12075, 12077, 12079, 12082, 12090, 12095, 12097, 12098, 12100, 12102, 12104, 12109, 12113, 12122, 12124, 12126, 12130, 12137, 12138, 12141, 12172, 12175, 12181, 12190, 12193, 12207, 12209, 12210, 12217, 12218, 12231, 12237, 12238, 12252, 12253, 12255, 12267, 12272, 12273, 12280, 12281, 12282, 12284, 12292, 12311, 12316, 12317, 12319, 12332, 12335, 12345, 12353, 12355, 12356, 12360, 12383, 12384, 12386, 12388, 12389, 12390, 12404, 12405, 12407, 12408, 12411, 12415, 12417, 12418, 12420, 12421, 12426, 12430, 12431, 12432, 12442, 12443, 12444, 12445, 12448, 12450, 12455, 12456, 12458, 12459, 12466, 12467, 12468, 12470, 12477, 12481, 12483, 12493, 12494, 12496, 12499, 12502, 12503, 12504, 12506, 12507, 12510, 12516, 12517, 12520, 12529, 12530, 12536, 12540, 12541, 12543, 12557, 12558, 12562, 12567, 12575, 12578, 12579, 12581, 12585, 12588, 12589, 12590, 12593, 12594, 12595, 12601, 12603, 12604, 12616, 12617, 12633, 12637, 12638, 12639, 12642, 12644, 12649, 12653, 12654, 12656, 12659, 12660, 12662, 12670, 12675, 12676, 12679, 12681, 12711, 12712, 12714, 12720, 12721, 12724, 12726, 12729, 12730, 12732, 12738, 12740, 12743, 12746, 12757, 12764, 12765, 12770, 12776, 12779, 12781, 12783, 12790, 12791, 12795, 12796, 12797, 12806, 12807, 12810, 12813, 12815, 12824, 12826, 12827, 12829, 12838, 12843, 12848, 12849, 12851, 12859, 12860, 12862, 12868, 12870, 12887, 12889, 12891, 12892, 12898, 12902, 12909, 12912, 12913, 12918, 12919, 12934, 12939, 12942, 12946, 12950, 12951, 12956, 12957, 12958, 12980, 12987, 12989, 12991, 12995, 12996, 12998, 13008, 13009, 13011, 13013, 13035, 13038, 13039, 13045, 13049, 13050, 13058, 13060, 13061, 13068, 13069, 13082, 13083, 13086, 13090, 13091, 13098, 13106, 13109, 13111, 13137, 13148, 13152, 13158, 13159, 13160, 13161, 13164, 13171, 13180, 13181, 13185, 13186, 13190, 13193, 13200, 13205, 13217, 13228, 13231, 13235, 13236, 13253, 13258, 13260, 13261, 13264, 13268, 13270, 13274, 13277, 13279, 13281, 13285, 13296, 13300, 13302, 13309, 13311, 13313, 13317, 13319, 13339, 13341, 13343, 13347, 13348, 13352, 13355, 13358, 13368, 13370, 13389, 13394, 13395, 13397, 13409, 13414, 13417, 13422, 13426, 13428, 13430, 13434, 13437, 13438, 13440, 13441, 13445, 13452, 13453, 13475, 13498, 13499, 13503, 13505, 13507, 13509, 13510, 13511, 13516, 13523, 13524, 13550, 13553, 13560, 13562, 13566, 13570, 13571, 13574, 13575, 13578, 13585, 13587, 13588, 13589, 13608, 13609, 13618, 13620, 13622, 13623, 13625, 13627, 13629, 13631, 13632, 13634, 13639, 13640, 13644, 13661, 13668, 13670, 13673, 13677, 13681, 13682, 13689, 13690, 13691, 13697, 13698, 13699, 13710, 13716, 13717, 13739, 13744, 13745, 13748, 13751, 13753, 13754, 13757, 13758, 13761, 13765, 13777, 13779, 13787, 13793, 13794, 13796, 13804, 13808, 13815, 13819, 13820, 13821, 13830, 13831, 13836, 13852, 13854, 13856, 13857, 13858, 13860, 13862, 13863, 13866, 13868, 13880, 13885, 13886, 13898, 13899, 13900, 13907, 13908, 13910, 13916, 13918, 13921, 13928, 13930, 13935, 13936, 13944, 13947, 13949, 13951, 13954, 13955, 13957, 13960, 13963, 13966, 13990, 13993, 13999, 14006, 14009, 14010, 14013, 14014, 14017, 14020, 14024, 14035, 14037, 14048, 14049, 14052, 14055, 14058, 14060, 14063, 14065, 14067, 14070, 14073, 14074, 14075, 14080, 14083, 14084, 14087, 14088, 14095, 14096, 14106, 14115, 14118, 14119, 14120, 14123, 14126, 14127, 14128, 14130, 14135, 14136, 14148, 14152, 14157, 14159, 14163, 14174, 14180, 14185, 14189, 14191, 14192, 14194, 14220, 14225, 14228, 14230, 14231, 14244, 14245, 14257, 14259, 14270, 14277, 14281, 14284, 14285, 14287, 14288, 14318, 14322, 14334, 14339, 14344, 14347, 14349, 14352, 14356, 14363, 14365, 14366, 14371, 14373, 14374, 14400, 14401, 14405, 14406, 14409, 14410, 14414, 14415, 14417, 14418, 14419, 14422, 14423, 14426, 14475, 14477, 14478, 14483, 14484, 14485, 14490, 14499, 14502, 14508, 14510, 14511, 14512, 14517, 14539, 14543, 14549, 14553, 14555, 14556, 14567, 14588, 14590, 14591, 14596, 14600, 14615, 14616, 14617, 14618, 14619, 14628, 14632, 14635, 14638, 14639, 14674, 14677, 14682, 14684, 14687, 14688, 14690, 14692, 14695, 14705, 14707, 14716, 14720, 14721, 14723, 14736, 14737, 14739, 14744, 14747, 14748, 14749, 14752, 14766, 14768, 14800, 14802, 14806, 14811, 14815, 14818, 14822, 14823, 14824, 14827, 14831, 14837, 14840, 14842, 14846, 14847, 14849, 14850, 14851, 14857, 14865, 14868, 14870, 14873, 14889, 14908, 14913, 14924, 14925, 14927, 14931, 14933, 14950, 14952, 14954, 14966, 14971, 14974, 14979, 14984, 14996, 15000, 15001, 15002, 15010, 15013, 15016, 15018, 15020, 15023, 15026, 15047, 15048, 15051, 15054, 15055, 15056, 15059, 15062, 15070, 15074, 15075, 15080, 15098, 15100, 15101, 15102, 15103, 15110, 15116, 15117, 15119, 15121, 15122, 15124, 15128, 15129, 15131, 15132, 15133, 15137, 15138, 15140, 15141, 15142, 15144, 15145, 15147, 15158, 15160, 15176, 15181, 15182, 15183, 15186, 15188, 15191, 15192, 15195, 15197, 15201, 15203, 15206, 15209, 15221, 15228, 15243, 15251, 15266, 15269, 15273, 15275, 15276, 15288, 15289, 15291, 15292, 15303, 15308, 15311, 15312, 15314, 15315, 15318, 15320, 15322, 15323, 15329, 15332, 15335, 15337, 15341, 15342, 15354, 15355, 15357, 15360, 15368, 15370, 15378, 15379, 15380, 15394, 15403, 15405, 15408, 15409, 15411, 15412, 15413, 15414, 15415, 15420, 15421, 15422, 15424, 15426, 15427, 15441, 15446, 15449, 15452, 15454, 15460, 15462, 15463, 15464, 15466, 15468, 15473, 15474, 15478, 15480, 15482, 15485, 15486, 15488, 15489, 15490, 15494, 15503, 15505, 15508, 15516, 15517, 15518, 15519, 15530, 15535, 15540, 15541, 15543, 15544, 15545, 15546, 15547, 15556, 15557, 15564, 15568, 15577, 15580, 15588, 15589, 15594, 15595, 15597, 15609, 15610, 15613, 15616, 15620, 15622, 15625, 15627, 15630, 15632, 15636, 15652, 15655, 15658, 15665, 15666, 15669, 15682, 15702, 15707, 15714, 15726, 15728, 15731, 15758, 15769, 15770, 15771, 15775, 15783, 15785, 15792, 15794, 15795, 15796, 15798, 15800, 15801, 15803, 15806, 15818, 15819, 15825, 15826, 15833, 15835, 15837, 15838, 15846, 15847, 15849, 15872, 15883, 15885, 15888, 15889, 15899, 15901, 15911, 15912, 15913, 15915, 15917, 15918, 15919, 15926, 15927, 15929, 15947, 15950, 15951, 15966, 15967, 15974, 15975, 15978, 15981, 15982, 15986, 15995, 15996, 15997, 15998, 16001, 16003, 16009, 16011, 16042, 16045, 16046, 16048, 16052, 16071, 16072, 16074, 16078, 16091, 16092, 16093, 16095, 16096, 16106, 16109, 16126, 16128, 16129, 16136, 16137, 16138, 16147, 16148, 16149, 16158, 16165, 16168, 16170, 16173, 16210, 16213, 16219, 16220, 16226, 16230, 16246, 16249, 16250, 16253, 16255, 16257, 16263, 16265, 16268, 16269, 16285, 16287, 16289, 16309, 16310, 16316, 16317, 16319, 16320, 16326, 16327, 16328, 16333, 16341, 16345, 16349, 16350, 16361, 16389, 16391, 16392, 16395, 16396, 16405, 16408, 16410, 16426, 16430, 16431, 16437, 16441, 16459, 16461, 16462, 16464, 16465, 16471, 16476, 16492, 16494, 16496, 16499, 16501, 16504, 16509, 16529, 16530, 16539, 16540, 16542, 16543, 16544, 16545, 16558, 16561, 16562, 16565, 16591, 16592, 16594, 16595, 16603, 16606, 16621, 16623, 16625, 16628, 16631, 16637, 16639, 16645, 16648, 16655, 16669, 16673, 16674, 16675, 16686, 16687, 16688, 16692, 16698, 16699, 16700, 16703, 16710, 16715, 16720, 16722, 16727, 16728, 16729, 16730, 16733, 16736, 16737, 16739, 16742, 16745, 16747, 16756, 16757, 16758, 16759, 16764, 16765, 16766, 16772, 16775, 16779, 16781, 16801, 16807, 16809, 16810, 16824, 16829, 16830, 16832, 16836, 16852, 16854, 16856, 16863, 16866, 16872, 16874, 16877, 16878, 16884, 16887, 16897, 16898, 16905, 16907, 16915, 16917, 16918, 16923, 16924, 16925, 16927, 16930, 16948, 16949, 16951, 16953, 16955, 16959, 16973, 17001, 17004, 17005, 17007, 17008, 17009, 17012, 17018, 17020, 17021, 17024, 17026, 17029, 17033, 17034, 17042, 17050, 17054, 17055, 17059, 17061, 17062, 17071, 17081, 17082, 17083, 17084, 17085, 17098, 17101, 17102, 17107, 17108, 17109, 17110, 17114, 17117, 17125, 17126, 17128, 17130, 17131, 17132, 17147, 17150, 17154, 17156, 17158, 17159, 17160, 17163, 17164, 17169, 17172, 17173, 17177, 17180, 17183, 17188, 17191, 17193, 17195, 17200, 17201, 17202, 17210, 17224, 17227, 17228, 17236, 17241, 17242, 17249, 17252, 17256, 17257, 17258, 17260, 17262, 17263, 17267, 17268, 17275, 17277, 17280, 17281, 17284, 17289, 17290, 17293, 17304, 17305, 17307, 17309, 17317, 17333, 17340, 17345, 17350, 17351, 17353, 17357, 17368, 17371, 17383, 17384, 17386, 17398, 17401, 17402, 17424, 17425, 17427, 17428, 17462, 17470, 17471, 17477, 17478, 17479, 17480, 17483, 17484, 17492, 17499, 17503, 17505, 17509, 17513, 17516, 17518, 17524, 17526, 17528, 17556, 17557, 17560, 17566, 17568, 17571, 17572, 17576, 17577, 17579, 17580, 17583, 17585, 17593, 17614, 17619, 17628, 17631, 17632, 17633, 17641, 17643, 17647, 17652, 17656, 17658, 17659, 17660, 17662, 17664, 17665, 17668, 17670, 17671, 17673, 17675, 17676, 17677, 17699, 17704, 17707, 17708, 17709, 17721, 17727, 17728, 17729, 17740, 17748, 17752, 17755, 17757, 17761, 17763, 17764, 17766, 17768, 17779, 17796, 17798, 17805, 17813, 17827, 17839, 17840, 17842, 17843, 17847, 17848, 17850, 17866, 17871, 17872, 17875, 17876, 17880, 17885, 17886, 17887, 17888, 17892, 17897, 17900, 17902, 17903, 17910, 17911, 17913, 17914, 17917, 17922, 17926, 17937, 17940, 17978, 17990, 17992, 17994, 17996, 18001, 18004, 18007, 18008, 18009, 18013, 18016, 18017, 18018, 18022, 18027, 18028, 18033, 18034, 18035, 18036, 18044, 18051, 18053, 18070, 18076, 18077, 18079, 18085, 18092, 18093, 18097, 18098, 18101, 18102, 18103, 18104, 18105, 18106, 18109, 18110, 18118, 18134, 18143, 18147, 18149, 18164, 18166, 18167, 18170, 18178, 18179, 18180, 18183, 18190, 18193, 18197, 18198, 18201, 18203, 18205, 18212, 18213, 18214, 18215, 18218, 18224, 18225, 18233, 18237, 18238, 18260, 18261, 18262, 18271, 18273, 18280, 18283, 18290, 18305, 18308, 18313, 18315, 18317, 18319, 18322, 18323, 18343, 18344, 18357, 18362, 18366, 18367, 18371, 18373, 18389, 18392, 18393, 18400, 18401, 18404, 18408, 18419, 18424, 18433, 18435, 18437, 18438, 18446, 18448, 18452, 18453, 18461, 18464, 18470, 18487, 18489, 18495, 18501, 18503, 18504, 18506, 18507, 18511, 18514, 18530, 18533, 18534, 18535, 18536, 18540, 18552, 18553, 18558, 18560, 18563, 18564, 18597, 18598, 18607, 18611, 18613, 18615, 18616, 18618, 18620, 18650, 18652, 18664, 18667, 18668, 18729, 18731, 18732, 18736, 18742, 18746, 18750, 18757, 18760, 18761, 18767, 18769, 18783, 18788, 18790, 18814, 18817, 18818, 18823, 18824, 18829, 18837, 18838, 18844, 18846, 18850, 18861, 18863, 18883, 18887, 18890, 18892, 18893, 18894, 18916, 18917, 18923, 18924, 18927, 18928, 18935, 18937, 18938, 18944, 18946, 18954, 18955, 18970, 18972, 18973, 18974, 18984, 18985, 18987, 18990, 18993, 18994, 18996, 18997, 19012, 19014, 19015, 19018, 19022, 19034, 19036, 19037, 19038, 19043, 19046, 19052, 19056, 19059, 19061, 19066, 19067, 19069, 19078, 19079, 19080, 19081, 19083, 19086, 19091, 19094, 19098, 19109, 19129, 19130, 19134, 19135, 19142, 19144, 19145, 19152, 19155, 19156, 19159, 19162, 19164, 19165, 19176, 19177, 19178, 19185, 19186, 19188, 19193, 19202, 19206, 19208, 19209, 19210, 19212, 19214, 19217, 19218, 19221, 19222, 19224, 19227, 19229, 19231, 19235, 19237, 19240, 19241, 19254, 19256, 19259, 19262, 19264, 19269, 19276, 19278, 19280, 19285, 19288, 19303, 19326, 19327, 19335, 19337, 19338, 19342, 19345, 19348, 19351, 19354, 19355, 19362, 19364, 19376, 19377, 19379, 19382, 19389, 19392, 19399, 19402, 19412, 19436, 19442, 19444, 19446, 19450, 19452, 19455, 19456, 19457, 19475, 19483, 19496, 19501, 19504, 19529, 19532, 19538, 19539, 19542, 19545, 19547, 19549, 19551, 19561, 19562, 19570, 19574, 19575, 19578, 19591, 19592, 19596, 19597, 19598, 19599, 19603, 19604, 19605, 19617, 19620, 19624, 19626, 19630, 19662, 19672, 19673, 19674, 19675, 19676, 19677, 19681, 19686, 19687, 19688, 19692, 19695, 19698, 19699, 19700, 19701, 19704, 19712, 19713, 19715, 19721, 19722, 19733, 19735, 19736, 19742, 19745, 19747, 19751, 19752, 19754, 19757, 19759, 19778, 19780, 19781, 19782, 19785, 19786, 19787, 19793, 19795, 19809, 19814, 19817, 19818, 19825, 19827, 19830, 19853, 19857, 19858, 19860, 19867, 19870, 19873, 19880, 19882, 19884, 19886, 19889, 19895, 19912, 19914, 19917, 19919, 19923, 19924, 19926, 19927, 19928, 19929, 19930, 19940, 19941, 19946, 19953, 19969, 20005, 20006, 20009, 20011, 20014, 20015, 20022, 20025, 20036, 20058, 20059, 20065, 20067, 20076, 20084, 20085, 20086, 20087, 20091, 20095, 20099, 20109, 20117, 20118, 20122, 20124, 20133, 20134, 20145, 20146, 20148, 20149, 20162, 20165, 20167, 20172, 20178, 20185, 20191, 20207, 20216, 20217, 20222, 20223, 20229, 20231, 20234, 20239, 20242, 20243, 20248, 20250, 20257, 20262, 20271, 20272, 20274, 20276, 20280, 20283, 20285, 20286, 20287, 20288, 20290, 20308, 20311, 20313, 20328, 20333, 20334, 20341, 20342, 20343, 20345, 20359, 20363, 20369, 20383, 20386, 20387, 20394, 20404, 20405, 20412, 20414, 20418, 20424, 20436, 20438, 20442, 20443, 20445, 20447, 20452, 20455, 20460, 20463, 20469, 20470, 20472, 20473, 20474, 20475, 20478, 20482, 20483, 20492, 20502, 20504, 20506, 20507, 20508, 20510, 20511, 20515, 20517, 20524, 20525, 20531, 20532, 20544, 20546, 20548, 20549, 20557, 20558, 20559, 20562, 20569, 20570, 20576, 20581, 20582, 20587, 20588, 20589, 20594, 20613, 20628, 20629, 20633, 20637, 20639, 20647, 20651, 20652, 20655, 20656, 20657, 20658, 20659, 20661, 20666, 20669, 20670, 20672, 20673, 20675, 20687, 20688, 20721, 20722, 20723, 20727, 20729, 20738, 20739, 20743, 20744, 20746, 20754, 20755, 20756, 20758, 20761, 20769, 20772, 20778, 20781, 20782, 20794, 20795, 20797, 20821, 20824, 20826, 20828, 20832, 20833, 20835, 20837, 20843, 20844, 20865, 20870, 20871, 20883, 20888, 20897, 20899, 20905, 20906, 20922, 20923, 20924, 20926, 20934, 20939, 20944, 20953, 20977, 20981, 20984, 20985, 20987, 20994, 20999, 21000, 21016, 21034, 21035, 21036, 21037, 21040, 21046, 21051, 21055, 21066, 21069, 21074, 21075, 21076, 21077, 21086, 21091, 21094, 21096, 21098, 21105, 21109, 21110, 21112, 21132, 21136, 21137, 21139, 21140, 21141, 21150, 21152, 21162, 21163, 21169, 21170, 21172, 21178, 21180, 21184, 21188, 21190, 21192, 21199, 21206, 21210, 21212, 21221, 21226, 21228, 21233, 21235, 21237, 21242, 21253, 21277, 21282, 21283, 21297, 21298, 21299, 21303, 21304, 21307, 21309, 21310, 21311, 21329, 21337, 21338, 21341, 21351, 21353, 21357, 21360, 21361, 21379, 21383, 21384, 21390, 21392, 21399, 21406, 21410, 21411, 21412, 21413, 21427, 21428, 21431, 21433, 21438, 21460, 21461, 21462, 21463, 21464, 21467, 21468, 21475, 21476, 21478, 21488, 21491, 21495, 21501, 21502, 21512, 21514, 21518, 21524, 21527, 21540, 21541, 21542, 21544, 21548, 21550, 21568, 21572, 21577, 21585, 21590, 21591, 21593, 21595, 21600, 21610, 21613, 21617, 21623, 21624, 21628, 21629, 21636, 21640, 21656, 21661, 21663, 21672, 21686, 21694, 21700, 21702, 21703, 21705, 21708, 21709, 21712, 21715, 21716, 21717, 21729, 21731, 21753, 21757, 21758, 21759, 21764, 21768, 21769, 21773, 21781, 21808, 21809, 21812, 21813, 21818, 21823, 21824, 21827, 21843, 21846, 21856, 21863, 21864, 21868, 21876, 21877, 21878, 21895, 21902, 21907, 21910, 21912, 21914, 21925, 21930, 21942, 21945, 21949, 21952, 21956, 21959, 21960, 21970, 21974, 21978, 21980, 21983, 21997, 22001, 22008, 22010, 22011, 22012, 22013, 22014, 22015, 22019, 22021, 22025, 22027, 22044, 22054, 22055, 22058, 22066, 22069, 22075, 22084, 22086, 22087, 22096, 22097, 22101, 22105, 22109, 22125, 22127, 22140, 22141, 22143, 22145, 22146, 22147, 22150, 22151, 22170, 22171, 22174, 22179, 22186, 22188, 22189, 22190, 22191, 22199, 22201, 22202, 22218, 22222, 22229, 22232, 22235, 22239, 22242, 22243, 22253, 22254, 22259, 22268, 22278, 22279, 22286, 22289, 22290, 22293, 22305, 22308, 22311, 22316, 22317, 22320, 22321, 22337, 22339, 22340, 22342, 22344, 22345, 22346, 22347, 22348, 22351, 22377, 22391, 22393, 22396, 22397, 22409, 22410, 22411, 22417, 22418, 22447, 22448, 22460, 22462, 22480, 22484, 22488, 22495, 22496, 22499, 22500, 22513, 22516, 22523, 22526, 22553, 22554, 22560, 22561, 22562, 22570, 22573, 22575, 22578, 22583, 22585, 22592, 22593, 22594, 22596, 22597, 22598, 22614, 22617, 22619, 22625, 22627, 22628, 22637, 22639, 22640, 22642, 22658, 22661, 22666, 22667, 22671, 22672, 22673, 22674, 22677, 22681, 22685, 22702, 22709, 22710, 22719, 22723, 22724, 22725, 22731, 22743, 22748, 22749, 22753, 22757, 22770, 22771, 22772, 22776, 22777, 22795, 22801, 22860, 22862, 22863, 22867, 22870, 22871, 22886, 22887, 22900, 22903, 22906, 22908, 22910, 22913, 22922, 22923, 22924, 22926, 22927, 22931, 22946, 22948, 22950, 22952, 22953, 22958, 22960, 22961, 22965, 22967, 22974, 22975, 22976, 22979, 22981, 22994, 22996, 23004, 23010, 23013, 23014, 23016, 23018, 23019, 23020, 23022, 23024, 23031, 23032, 23037, 23038, 23041, 23046, 23047, 23061, 23065, 23066, 23068, 23096, 23101, 23104, 23111, 23117, 23121, 23125, 23139, 23141, 23144, 23145, 23159, 23162, 23166, 23169, 23171, 23198, 23200, 23202, 23215, 23217, 23219, 23230, 23245, 23246, 23250, 23251, 23252, 23254, 23268, 23272, 23282, 23283, 23287, 23289, 23311, 23312, 23318, 23320, 23321, 23324, 23327, 23344, 23346, 23347, 23355, 23359, 23360, 23362, 23369, 23373, 23374, 23378, 23379, 23392, 23393, 23394, 23395, 23397, 23400, 23401, 23402, 23404, 23411, 23421, 23423, 23429, 23430, 23444, 23450, 23451, 23453, 23456, 23463, 23468, 23470, 23472, 23473, 23496, 23497, 23498, 23499, 23501, 23502, 23508, 23512, 23513, 23514, 23522, 23537, 23538, 23539, 23542, 23559, 23565, 23566, 23570, 23573, 23599, 23603, 23606, 23609, 23611, 23613, 23617, 23619, 23620, 23623, 23627, 23628, 23631, 23634, 23635, 23636, 23638, 23654, 23660, 23661, 23665, 23670, 23675, 23677, 23678, 23680, 23681, 23682, 23684, 23697, 23702, 23703, 23704, 23706, 23708, 23709, 23711, 23715, 23724, 23726, 23727, 23738, 23739, 23742, 23763, 23764, 23765, 23768, 23769, 23774, 23798, 23801, 23805, 23808, 23811, 23814, 23817, 23818, 23819, 23821, 23822, 23823, 23842, 23844, 23848, 23851, 23853, 23858, 23862, 23863, 23864, 23869, 23874, 23875, 23876, 23878, 23880, 23889, 23890, 23894, 23901, 23909, 23914, 23916, 23925, 23936, 23937, 23940, 23946, 23950, 23951, 23953, 23954, 23969, 23971, 23973, 23974, 23975, 23978, 23982, 23987, 23989, 23990, 23994, 23995, 24008, 24012, 24014, 24016, 24021, 24023, 24025, 24026, 24036, 24041, 24042, 24053, 24054, 24058, 24060, 24066, 24067, 24070, 24075, 24081, 24082, 24083, 24084, 24085, 24086, 24087, 24105, 24108, 24110, 24112, 24128, 24129, 24139, 24141, 24143, 24144, 24145, 24169, 24170, 24178, 24179, 24181, 24182, 24186, 24191, 24202, 24203, 24204, 24209, 24213, 24215, 24218, 24222, 24224, 24225, 24235, 24253, 24256, 24257, 24260, 24263, 24267, 24270, 24271, 24274, 24275, 24278, 24279, 24280, 24285, 24286, 24300, 24315, 24316, 24318, 24319, 24320, 24324, 24325, 24327, 24355, 24356, 24359, 24365, 24366, 24369, 24373, 24374, 24377, 24383, 24385, 24387, 24391, 24393, 24395, 24398, 24425, 24427, 24434, 24443, 24445, 24455, 24458, 24460, 24461, 24463, 24472, 24473, 24475, 24479, 24482, 24487, 24505, 24508, 24509, 24523, 24526, 24530, 24533, 24541, 24546, 24549, 24552, 24559, 24582, 24584, 24585, 24586, 24606, 24612, 24630, 24639, 24645, 24648, 24650, 24666, 24667, 24687, 24694, 24697, 24699, 24700, 24702, 24707, 24709, 24716, 24721, 24741, 24742, 24744, 24747, 24749, 24752, 24754, 24755, 24767, 24768, 24773, 24775, 24787, 24798, 24799, 24801, 24803, 24805, 24818, 24826, 24829, 24830, 24834, 24849, 24850, 24853, 24857, 24858, 24859, 24860, 24878, 24882, 24883, 24886, 24887, 24890, 24891, 24894, 24896, 24900, 24901, 24903, 24920, 24927, 24928, 24931, 24937, 24938, 24941, 24944, 24948, 24949, 24951, 24961, 24975, 24980]
|
# Used for import directories into other modules. Good for setting
# project wide parameters, such as the location of the database.
class settings():
db = "C:\\Users\\Andrew\\lab_project\\database\\frontiers_corpus.db"
d2v = "C:\\Users\\Andrew\\lab_project\\models\\doc2vecmodels\\"
d2v500 = "C:\\Users\\Andrew\\lab_project\\models\\doc2vecmodels\\500model"
d2v300 = "C:\\Users\\Andrew\\lab_project\\models\\doc2vecmodels\\300model"
d2v100 = "C:\\Users\\Andrew\\lab_project\\models\\doc2vecmodels\\100model"
bowmodel = "C:\\Users\\Andrew\\lab_project\\models\\bagofwordsmodels"
xml = "C:\\Users\\Andrew\\Desktop\\frontiers_data\\article_xml"
|
i18 = {
"en": {"title": "What's this?",
"read_more": "Read more",
"upload_image": "Upload your image",
"try_again": "Try again"},
"pt": {"title": "O que é isso?",
"read_more": "Leia mais",
"upload_image": "Envie sua imagem",
"try_again": "Tente novamente"},
}
|
class OverrideRootError(Exception):
def __init__(self):
super().__init__(self, "Cannot override Tree root node")
class TreeHeightError(Exception):
def __init__(self):
super().__init__(self, "Cannot add node lower than tree height")
|
CROCKFORD_MODIFIED = (
b"ahm6a81a59rqaub3dcn2m832e9qqevh0ctqqg83aenpq0wt0dxv6awh0ehm6a818dhgqmy994"
b"1j6ytt1"
)
CROCKFORD = (
b"AHM6A81A59RQATB3DCN2M832E9QQEVH0CSQQG83AENPQ0WS0DXV6AWH0EHM6A818DHGQMY994"
b"1J6YSS1"
)
ZBASE32 = (
b"ktwgkebkfjazk4mdpcinwednqjzzq5tyc3zzoedkqiszyh3yp75gkhtyqtwgkebeptozw6jjr"
b"b1g633b"
)
RFC_3548 = (
b"KRUGKIBKFJYXK2LDNMVCUIDCOJXXO3RAMZXXQIDKOVWXA4ZAN53GK4RAORUGKIBINRQXU6JJE"
b"BSG6ZZB"
)
RFC_2938 = (
b"AHK6A81A59ONAQB3DCL2K832E9NNERH0CPNNG83AELMN0SP0DTR6ASH0EHK6A818DHGNKV994"
b"1I6VPP1"
)
RFC_4648 = (
b"KRUGKIBKFJYXK2LDNMVCUIDCOJXXO3RAMZXXQIDKOVWXA4ZAN53GK4RAORUGKIBINRQXU6JJE"
b"BSG6ZZB"
)
NIGHTMARE = (
b"6vNI6LD61lZm62b08BnONL0OUlmmUSvdBzmmVL06UnMmd5zd8sSI65vdUvNI6LDL8vVmN7llo"
b"DWI7zzD"
)
ARBITRARY = (
b"`^(6`81`59=_`[~3@!)2(832#9__#]^0!+__%83`#)-_0{+0@}]6`{^0#^(6`818@^%_(\994"
b"1&6\++1"
)
ICON_ZBASE32 = (
b"tferhtapbepywyyyyygw11nrkeyyyyyoyyyyyryeyayyyyy96x9snyyyyyrzy1n3qcyyynauy"
b"yyysrabynpjagyyyyfr64kdepefy4dxqtzzg4dxqyor1o4drba8r55gpfsgkyyyxdpj4w58kt"
b"j61ft769xxeo1mtnyje15xkekooen1ekfayfrtrainnneojkrndeq3niehnrkfewnbz1fytyb"
b"a7dwytokinmyctefpob9rrgte7y7dtnfci69bxqtsziih69uc59ii4h9qxm8uus3h6b6ybygj"
b"c1bukr4aydfjeexbdarda9ncpaxrf3yenntrqyybynfucooz89jdyryxo9th8oi1foy8zayyn"
b"6gubcrybonpuxydy8r89h86wow3moyabbybab4jnqnmbnybeynyxk8rfjoyebdydyr7uyufgy"
b"fyyoygb15dcmtoywbpybonq99g4cyeb8xauf7onyn51ootkypy1rynyr5ftbnyy4b5ynsc6iw"
b"kewyfocyynturztb3ydcn4ybojfmsc1yysn5obogqnyf5ryyeboydywceowwoybd5ybocoe3d"
b"xyyejgeyntdxri3h6ri4hr88feyyy6r3se6m1jb3esyisnbpqrdiqi3qdawch1ezfckdcaenc"
b"gprymsnxgct1cwbgo86bh6cyyykbrein8oe8h97xd8y7msq3a5e7poqmhs6ixag9htgrazd95"
b"1h9k5oeyyybamwx5e9hmbxscpeyqagobs97etf7angozomwb49xn5gse8wbpeywdw7wi9uqdh"
b"8hxbheso3bqq35816j3gajmnrrs5b3jmz59u8ajxhyi97puhzhx8h6946bxznr1yurzcbehnx"
b"tagn3u4r3jeh36jyubdn5uue6t9hshf999y74ctce1mnzfcnwf8dkrj8dd1rukgxgcifrkrwf"
b"rtjaw17f95rhmx136ad85xukyfope9yn6htfswf4aad63f1qrnaquyqf7ayyd3ms56b4owyoy"
b"hypnb6du5z99zu99k8wy1obydgjgj8nyyym3nnem1w3k3u9taeyyyrjerbfkarng9warcn3oy"
b"gduyomzgbbx6gypwree1cjo1nnbbyw3rydt3gykpcojbntbspsyq1wabx4tyb4pgykfwepr5o"
b"bazcripaba6zyd94crrj7ojez1yo1bnb3yrbgajb5krynawkmytahnyzugn9oeqbjynbfn3rr"
b"draofntrjf3npkegfjewibykirb5ht7qebdub4he47jnq6eyy3ef9rgztdudfrbsjeu5iycsi"
b"b5ukbzdknrpeom4b18ecc4thmkbg6oqk4bwxccg4o6xwfmpy87id36exdubo8edydu8tdcgyz"
b"cpo4nsrhnancucxf5neicb1ihcgiok4sy8qhj6ith9cmzyojentqybr5ye74nrbothokembgf"
b"ousajnwny8brgoe7wnjzbrbaewqnrhtj8knmsoumwrx3aocgrctto7crombd4aje6r3xnb7ao"
b"o6rgh1bfnkdgeu5urynjga4eig1nmjrpwuqket61mfjuc4rogtd1xr7w3dmseduufbcryihtb"
b"xruz1c83buhop6eex1mcfj4a1yqg1xow9nfbjcw41kd81tb3jwhwdgmgb1efk48g115swkniy"
b"tgs8iwoipwg5ffm4to6wbgpdiuehh5yasjff4mmpn1zjtw4yzpd5sum9eq17bdzcid38jxwnz"
b"4mf61t9e19wy87dzbogacfcda6rgqky3uccyqgd8df5ttmhaj1ubuwhmd8diecbzg8i3t3h3b"
b"6cs6ikafk5nw9yi18fyifkk1wujkg3kf7kkukigimxkwn4i6pkhsirxifxfg9pqe3kugw9dir"
b"r7jfimksij4w8mkcpig37j8qwexku8ibziex7rx3c95negm8bw3o4xeq1fdeftm9t53ttybpt"
b"tuc5afoossdpmo34anpqrr4ah5smhqaimzg87ds7asxpkigou1o3uje3ixc416qkgcxa8hqc8"
b"d6rhqt8yu33ew6m9g9wk5akq6kxnfrp4cpnczraskzdmikmjxf1aiprkswpme9i54piq7su35"
b"ji7es7iu6hbb3yhq1t8mouwq3hx3an3534u5fj75jakwhmr4xj46szn7kumwwp4dq4rq69s7j"
b"9qunxmhzwyu3gg9j66xg66x6ohxwz94i87pz7kx7k8btcypcacrodpsdgqdy6ckpmtph6b4m6"
b"85xaino47apyr8jmb1io3xacr1gh7nxfd4ide4toxttwhcz8druts5tupa4t1cbtgrrursuxk"
b"jzzjww1pzgunujt5jo7w3t6p3ug4fuqsur43sxjt4h3qxg98uxm3zz7zcbp8ostcs4wmpqdfj"
b"g3qesigm8zmpxdqoipd1spfmbkiwzpue4s35mjf44745q78ngu51uwuj4i37iu8aqaxdpsjs4"
b"w5qgpohzcyps7qs3s5c9mbc7tbq37zaszc85wuzsjz5qu7tz6u4bapo9co7ka7meqzhh7wqek"
b"dwit454pc788q876hm7rs7rzsqsgxnd87oc9dsajhskqrpgqi8g6ue7utq373qqb98nrmtffa"
b"f13q1h9n7ga5a5qhtxxrjj4xkhk7hf7pf7c7uq33zozpidp495ts73w67b6hu9gdj83ju3cug"
b"h6oaxrr8anthzeu6nh91wagzz7cx38wguhbc646qe3xccz3ni7p46amxjmzim5sd5az855dhh"
b"w9hc9qgxbz5a3phsk93o5hbp6es9fw9o5xu3xamz4dxht96389xm97nyf8oy1on3adtgywdyk"
b"5ym79o6uhrg9ahx345p19pcs37iya3ef3erkwddhnisbqmopprfwct5roiwo9x3ha34ehh4eq"
b"oie874gs4ydsd3ubtxbzhdb8osdakihg8688bnnadmeudf3iq9e7ao5u57nxwtrseuxjs33tj"
b"hh46mkkgwid7ktqpe6pwp74g17d9ttqc3ch3ikauicr15nmdoh1hkiqg3zg3xs99us98b9nuz"
b"tyza55n6cn91n7qbh4dusn61n4qfijfajnaqwsebgeouta1uarnrbkiymeajx1np51mdokx8b"
b"b5ou8rez7npsttdcrgzbkd38xr1bkji7jf5rtzo4z1jgfgq1133p3oou4urfhjogw3zc58kxb"
b"pgusrbsurxj4zwaa8rwt1bawfktbjsj5c39kc9ugc7smit1amcz6aizezp3xd4kox1mmsqeka"
b"bk3fwfmcoig7bkfwkgzfed5r35fk7um9ucj3eh3pkh6fxg65ufu3mp3yphh76x995e1aejqdr"
b"iswsdrsi3pdicqpxpcpeh5rxdtx8poiaaiywiaciogio6mtnisfjs7ku7m7im3xmu6zwu8wum"
b"mofxcd1wnag4on49mbpkoi3cfxzi73i9pmi8iom43564sd6wguwpuhfcjtkzbjsaz1hkz9sbe"
b"5thqkgh8p9fm9gqh114kuk6rzf1c63s1c5w6pztpu3po7fik19ujqduqbzc7ipyp57mmj5xi6"
b"3n7smhz3wwpzqhds3b5ue7981hma3p8388c4q39k11fj7nw9jkdp5s15s4sdi9ap5e6hg55zu"
b"5dj5gi5pp5379785r57s4iyfkw5img4i19s1x5sx5u9mwjimw9tfz5piq44uupq8shqy61yx6"
b"oqeaqs5m5uigidzjd4in1t9mnz448b5dt9xz6uzzzqmepgagimdcha5tnghnrx81qu7aj595t"
b"hdj45j5ea67chrd7g85sdiut4m5kekpxfg1gupj3i645cjp5wu6c85e7p4s6xm6rxsa9b6qde"
b"xn3xffxgigjp8pquysu1pu9fuhcusk349m6f5h7aag5wk58z35d35xswd5x767by78b4jn99n"
b"988q6dzu1h6kh8jhi15x1tgi7ak6pk6q19pzi8j4th94j7gu68zqqmzgiqzfqgzqxqxk65k65"
b"g69wtz8tz35q9jxm36rmx9isiuahu5zp76p7g976f69476fs7x33nx9qq3q77173874s5au7h"
b"m94rb5kb5fb75b6i87p97zga79q864syq6ox8wqhe95opbcd399jd7cxb7bomdh3t9facdcg7"
b"qxdoxt388td6hz7786kqo6xcu81p8oz94tx717qnhmn69za4zi7xustude4df9116j565mhwz"
b"66io8mdgz7ztsnaaxm71magcai77ns9xshn76hqhq69e69b786e9byxhwx6483s84i8wf89qj"
b"turhu9hny8g8u9ttugmq5yyyyyeddjbjr4yyyxe1oyyryocyyb6x9yyyeb4eyyb4uyyyy7joy"
b"yyb4uyyyyf5x1jxhktoyyybe41krefk8tsir4xpwswabynyxd59cq45muuuwsxg7jb1apbnfc"
b"b1bw3ysysnaf7q4e6ajkfe1s16r3bgmdpf1foacocuh3bnrdn54irdt9mnyrcfq11ozfnfqoa"
b"w7hw14xq5xh94bfxkweuhx4yp9s78iyicitr1qo8dymwrsoorcyhe3yq4yfpbcen6syiojoyq"
b"db9y9qrirnzudrtkwjzt5qyui8muz6yn99pymbcz4ktqz443onak1suoh54yw343xrnuebgyy"
b"c5s69y8kye4sjsnimpmpzqdj9ezegbtpjz8tzkmkidxnz4bgophokjfabu1zin7nb8fpdr6dm"
b"sodkouayunpurfsmkinwmpc81pjzqyhm9ee9etkst6s3aznhz5xzyuyeqjiu81a7pxqkxownx"
b"6f34t3q93cmrqyegbotaeazjsmx9qcu3s9s161gzcoeetbeka1bi36m9ogiu67inzozp9y5dr"
b"9djq56cijpsqzcxke19nod9j7uiq66ks8m7na7a9qxcepezntsr4npgnkraph1rozwt347n69"
b"47zckc35zfjb5kn31pxw8efio3ntkxrjjc1ess1qgp5axdtzu3r31qjqqcnghxawcbo3ta8xy"
b"pxwtjd75czh6e4cmwmxqttoxocwe5y5ay4hq5uyo1p6unfrmidngxc5dgh1nfkaueb1o3m95y"
b"o4kph8w5xcmi9z4an7q1r87ujrkdtryyyodzgc9k31qiubc1zjrxfnydi7bqmznf1siwqin55"
b"ngusqn6s5uwuz5jhg47dd3xyssoojo9ande61orjojwosghcf4145ykdui418gckiu9yue1as"
b"qmad4ja435x87wbqp7mcqgee3darxorhyo7eu3rhfz5mpai7ezh58jena4bdf3ci4im9igi97"
b"s4kpht7heb99379ynmfecgra8wnxazujps14s4mbmmujiqhzbaq99deirwbncifedcxsd4ysu"
b"bxotae9qr58umr38edg5okyeaun8wcjf9onjuhhpnen8adybz8af9wxefca1yyyyyyy1kfj3n"
b"khouyoe"
)
SAMPLE_TEXT = b"The **quick** brown fox jumps over the (lazy) dog!"
TOO_SHORT_ALPHABET = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ23456"
TOO_LONG_ALPHABET = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ2345678"
REPEAT_CHARACTER_ALPHABET = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ234566"
ARBITRARY_ALPHABET = b"0123456789`~!@#$%^&*()-_=+[]{}\/"
|
# Script to help automation of converting a cpu/layoutX/CpuConstraintPoly.sol contract to Rust
# Parses out "mload(0xDEADBEEF)" (Solidity EVM Assembley Command) from the file and replaces it with the proper Rust equivalent
# Note: replace file_name.txt appropriately
# file_name.txt should contain Solidity Assembly from CpuConstraintPoly.sol
# Further Reductions example: You can reduce addmod(x, y, PRIME) to prime_field::fadd(x.clone(), y.clone());
# by using Find and Replace in an IDE. eg. Find: ", PRIME)" Replace with: ")"
f = open("file_name.txt", "r")
text = f.read()
parsedNum = ""
startParsing = False
i = 5
mloadStartIdx = -1
# Searches for "mload(" and reads the hex address until it reaches the closing bracket, ")"
# Once the hex address is parsed the mload(0xDEADBEEF) is replaced with a proper eqivalent
# derived from the memory mapping at the top of CpuConstraintPoly.sol
# The new read is placed in mload(0xDEADBEEF)'s spot in the file
while i < len(text):
if text[i] == ')' and startParsing:
addr = int(parsedNum, 0)
newText = ""
if addr == 0 :
newText += "ctx[map::MM_PERIODIC_COLUMN__PEDERSEN__POINTS__X].clone()"
elif addr == 32 :
newText += "ctx[map::MM_PERIODIC_COLUMN__PEDERSEN__POINTS__Y].clone()"
elif addr == 64 :
newText += "ctx[map::MM_PERIODIC_COLUMN__ECDSA__GENERATOR_POINTS__X].clone()"
elif addr == 96 :
newText += "ctx[map::MM_PERIODIC_COLUMN__ECDSA__GENERATOR_POINTS__Y].clone()"
elif addr == 128 :
newText += "ctx[map::MM_TRACE_LENGTH].clone()"
elif addr == 160 :
newText += "ctx[map::MM_OFFSET_SIZE].clone()"
elif addr == 192 :
newText += "ctx[map::MM_HALF_OFFSET_SIZE].clone()"
elif addr == 224 :
newText += "ctx[map::MM_INITIAL_AP].clone()"
elif addr == 256 :
newText += "ctx[map::MM_INITIAL_PC].clone()"
elif addr == 288 :
newText += "ctx[map::MM_FINAL_AP].clone()"
elif addr == 320 :
newText += "ctx[map::MM_FINAL_PC].clone()"
elif addr == 352 :
newText += "ctx[map::MM_MEMORY__MULTI_COLUMN_PERM__PERM__INTERACTION_ELM].clone()"
elif addr == 384 :
newText += "ctx[map::MM_MEMORY__MULTI_COLUMN_PERM__HASH_INTERACTION_ELM0].clone()"
elif addr == 416 :
newText += "ctx[map::MM_MEMORY__MULTI_COLUMN_PERM__PERM__PUBLIC_MEMORY_PROD].clone()"
elif addr == 448 :
newText += "ctx[map::MM_RC16__PERM__INTERACTION_ELM].clone()"
elif addr == 480 :
newText += "ctx[map::MM_RC16__PERM__PUBLIC_MEMORY_PROD].clone()"
elif addr == 512 :
newText += "ctx[map::MM_RC_MIN].clone()"
elif addr == 544 :
newText += "ctx[map::MM_RC_MAX].clone()"
elif addr == 576 :
newText += "ctx[map::MM_PEDERSEN__SHIFT_POINT_X].clone()"
elif addr == 608 :
newText += "ctx[map::MM_PEDERSEN__SHIFT_POINT_Y].clone()"
elif addr == 640 :
newText += "ctx[map::MM_INITIAL_PEDERSEN_ADDR].clone()"
elif addr == 672 :
newText += "ctx[map::MM_INITIAL_RC_ADDR].clone()"
elif addr == 704 :
newText += "ctx[map::MM_ECDSA__SIG_CONFIG_ALPHA].clone()"
elif addr == 736 :
newText += "ctx[map::MM_ECDSA__SIG_CONFIG_SHIFT_POINT_X].clone()"
elif addr == 768 :
newText += "ctx[map::MM_ECDSA__SIG_CONFIG_SHIFT_POINT_Y].clone()"
elif addr == 800 :
newText += "ctx[map::MM_ECDSA__SIG_CONFIG_BETA].clone()"
elif addr == 832 :
newText += "ctx[map::MM_INITIAL_ECDSA_ADDR].clone()"
elif addr == 864 :
newText += "ctx[map::MM_TRACE_GENERATOR].clone()"
elif addr == 896 :
newText += "ctx[map::MM_OODS_POINT].clone()"
elif addr == 928 :
newText += "ctx[map::MM_INTERACTION_ELEMENTS+0].clone()"
elif addr == 960 :
newText += "ctx[map::MM_INTERACTION_ELEMENTS+1].clone()"
elif addr == 992 :
newText += "ctx[map::MM_INTERACTION_ELEMENTS+2].clone()"
elif addr < 12480 and addr >= 1024 :
newText += "ctx[map::MM_COEFFICIENTS+" + str( int((addr-1024)/32) ) + "].clone()"
elif addr < 18880 and addr >= 12480 :
newText += "ctx[map::MM_OODS_VALUES+" + str( int((addr-12480)/32) ) + "].clone()"
elif addr < 20256 and addr >= 18880 :
newText += "intermediate_vals[" + str( int((addr-18880)/32) ) + "].clone()"
elif addr < 20928 and addr >= 20256 :
newText += "exp_mods[" + str( int((addr-20256)/32) ) + "].clone()"
elif addr < 21632 and addr >= 20928 :
newText += "denominator_inv[" + str( int((addr-20928)/32) ) + "].clone()"
elif addr < 22336 and addr >= 21632 :
newText += "denominators[" + str( int((addr-21632)/32) ) + "].clone()"
elif addr < 22656 and addr >= 22336 :
newText += "numerators[" + str( int((addr-22336)/32) ) + "].clone()"
else :
# Reset
parsedNum = ""
startParsing = False
mloadStartIdx = -1
i += 1
continue
text = text[:mloadStartIdx] + newText + text[i+1:]
# Reset
parsedNum = ""
startParsing = False
mloadStartIdx = -1
i += 1
continue
if startParsing :
parsedNum += str(text[i])
i += 1
continue
if text[i] == '(' and text[i-1] == 'd' and text[i-2] == 'a' and text[i-3] == 'o' and text[i-4] == 'l' and text[i-5] == 'm':
startParsing = True
mloadStartIdx =i-5
i += 1
f.close()
f = open("file_name.txt", "w")
f.write(text)
f.close()
print(text)
|
del_items(0x80137B7C)
SetType(0x80137B7C, "void EA_cd_seek(int secnum)")
del_items(0x80137BA4)
SetType(0x80137BA4, "void MY_CdGetSector(unsigned long *src, unsigned long *dst, int size)")
del_items(0x80137BD8)
SetType(0x80137BD8, "void init_cdstream(int chunksize, unsigned char *buf, int bufsize)")
del_items(0x80137BE8)
SetType(0x80137BE8, "void flush_cdstream()")
del_items(0x80137C0C)
SetType(0x80137C0C, "int check_complete_frame(struct strheader *h)")
del_items(0x80137C8C)
SetType(0x80137C8C, "void reset_cdstream()")
del_items(0x80137CB4)
SetType(0x80137CB4, "void kill_stream_handlers()")
del_items(0x80137D24)
SetType(0x80137D24, "void stream_cdready_handler(unsigned long *addr, int idx, int i, int sec)")
del_items(0x80137F18)
SetType(0x80137F18, "void CD_stream_handler(struct TASK *T)")
del_items(0x80138004)
SetType(0x80138004, "void install_stream_handlers()")
del_items(0x80138074)
SetType(0x80138074, "void cdstream_service()")
del_items(0x8013810C)
SetType(0x8013810C, "int cdstream_get_chunk(unsigned char **data, struct strheader **h)")
del_items(0x80138230)
SetType(0x80138230, "int cdstream_is_last_chunk()")
del_items(0x80138248)
SetType(0x80138248, "void cdstream_discard_chunk()")
del_items(0x80138348)
SetType(0x80138348, "void close_cdstream()")
del_items(0x801383C0)
SetType(0x801383C0, "int open_cdstream(char *fname, int secoffs, int seclen)")
del_items(0x80138530)
SetType(0x80138530, "int set_mdec_img_buffer(unsigned char *p)")
del_items(0x80138564)
SetType(0x80138564, "void start_mdec_decode(unsigned char *data, int x, int y, int w, int h)")
del_items(0x801386E8)
SetType(0x801386E8, "void DCT_out_handler()")
del_items(0x80138784)
SetType(0x80138784, "void init_mdec(unsigned char *vlc_buffer, unsigned char *vlc_table)")
del_items(0x801387F4)
SetType(0x801387F4, "void init_mdec_buffer(char *buf, int size)")
del_items(0x80138810)
SetType(0x80138810, "int split_poly_area(struct POLY_FT4 *p, struct POLY_FT4 *bp, int offs, struct RECT *r, int sx, int sy, int correct)")
del_items(0x80138C00)
SetType(0x80138C00, "void rebuild_mdec_polys(int x, int y)")
del_items(0x80138DD4)
SetType(0x80138DD4, "void clear_mdec_frame()")
del_items(0x80138DE0)
SetType(0x80138DE0, "void draw_mdec_polys()")
del_items(0x8013912C)
SetType(0x8013912C, "void invalidate_mdec_frame()")
del_items(0x80139140)
SetType(0x80139140, "int is_frame_decoded()")
del_items(0x8013914C)
SetType(0x8013914C, "void init_mdec_polys(int x, int y, int w, int h, int bx1, int by1, int bx2, int by2, int correct)")
del_items(0x801394DC)
SetType(0x801394DC, "void set_mdec_poly_bright(int br)")
del_items(0x80139544)
SetType(0x80139544, "int init_mdec_stream(unsigned char *buftop, int sectors_per_frame, int mdec_frames_per_buffer)")
del_items(0x80139594)
SetType(0x80139594, "void init_mdec_audio(int rate)")
del_items(0x8013964C)
SetType(0x8013964C, "void kill_mdec_audio()")
del_items(0x8013967C)
SetType(0x8013967C, "void stop_mdec_audio()")
del_items(0x801396A0)
SetType(0x801396A0, "void play_mdec_audio(unsigned char *data, struct asec *h)")
del_items(0x8013993C)
SetType(0x8013993C, "void set_mdec_audio_volume(short vol, struct SpuVoiceAttr voice_attr)")
del_items(0x80139A08)
SetType(0x80139A08, "void resync_audio()")
del_items(0x80139A38)
SetType(0x80139A38, "void stop_mdec_stream()")
del_items(0x80139A84)
SetType(0x80139A84, "void dequeue_stream()")
del_items(0x80139B70)
SetType(0x80139B70, "void dequeue_animation()")
del_items(0x80139D20)
SetType(0x80139D20, "void decode_mdec_stream(int frames_elapsed)")
del_items(0x80139F0C)
SetType(0x80139F0C, "void play_mdec_stream(char *filename, int speed, int start, int end)")
del_items(0x80139FC0)
SetType(0x80139FC0, "void clear_mdec_queue()")
del_items(0x80139FEC)
SetType(0x80139FEC, "void StrClearVRAM()")
del_items(0x8013A0AC)
SetType(0x8013A0AC, "short PlayFMVOverLay(char *filename, int w, int h)")
del_items(0x8013A4B4)
SetType(0x8013A4B4, "unsigned short GetDown__C4CPad(struct CPad *this)")
|
MONOBANK_API_TOKEN = None
MONOBANK_API_BASE_URL = 'https://api.monobank.ua'
MONOBANK_API_CURRENCY_ENDPOINT = MONOBANK_API_BASE_URL + '/bank/currency'
MONOBANK_API_CLIENT_INFO_ENDPOINT = MONOBANK_API_BASE_URL + '/personal/client-info'
MONOBANK_API_WEBHOOK_ENDPOINT = MONOBANK_API_BASE_URL + '/personal/webhook'
MONOBANK_API_STATEMENTS_ENDPOINT = MONOBANK_API_BASE_URL + '/personal/statement/{account}/{from_timestamp}/{to_timestamp}'
|
arquivo = open('numeros.txt', 'w')
for linha in range(1, 101):
arquivo.write('%d\n' % linha)
arquivo.close()
|
"""
Copyright 2017 Timothy Laskoski
tree.py handles all code related to the parse tree
"""
def tree_append(parent, sub):
"tree_append appends a sub tree to the parent tree"
parent["Sub"].append(sub)
# print("TREE APPEND", parent)
def add_subtree(parent, token):
"add_subtree adds a subtree with a token to the parent"
new_sub = create_tree_with_token(token, parent)
tree_append(parent, new_sub)
return parent, new_sub
def create_tree(parent):
"create_tree creates a tree with the parent being the parent"
return {"Tok": None, "Sub": [], "Par": parent}
def create_tree_with_token(token, parent):
"create_tree_with_token creates a tree with a parent and a value"
return {"Tok": token, "Sub": [], "Par": parent}
|
def getMessage(content):
firstCarrot = content.index('<')
secondCarrot = content.index('>')
return content[firstCarrot+3:secondCarrot]
y = getMessage('GG <@!799778925936246804>, you just advanced to level 5')
print(y)
|
# Bubble sort
def sort_bubble(my_list):
for i in range(len(my_list) - 1, 0, -1):
for j in range(i):
if my_list[j] > my_list[j + 1]:
my_list[j], my_list[j + 1] = my_list[j + 1], my_list[j]
return my_list
print(sort_bubble([1,4,2,6,5,3,1]))
|
#program to enter number followed by commas and the storing those numbers in a list
arr=[];r=0;
a=input("ENter numbers followed by commas :")
l=a.split(",")
m=''
for c in a:
if(c!=','):
m=m+c;
else:
arr.append(int(m));
m='';
arr.append(int(m));
print(arr);
|
file = open ("employees.txt" , "r")
if(file.readable()):
print("Success")
else:
print("Error")
print()
#read the whole file
print(file.read())
#rewind file pointer
file.seek(0)
print()
#read individual line
print(file.readline())
#rewind file pointer
file.seek(0)
print()
#read the whole file and set as lists
print(file.readlines())
#rewind file pointer
file.seek(0)
print()
#access specific list set
print(file.readlines()[1])
#rewind file pointer
file.seek(0)
print()
#read the lists using a for loop
for employee in file.readlines():
print(employee)
file.close()
|
red_flags = {
'strony wyłączają uprawnienia [\w]+ do dochodzenia roszczeń z tytułu wad [\w]+ ujawnionych po dniu zakupu.': 'Nielegalny zapis. Sprzedawca nie może odmówić reklamacji z powodu ukrytych wad.',
'[\w]+ zastrzega sobie [\w\s]*prawo do zmiany zakresu usług określonych w Regulaminie oraz możliwość zaprzestania ich świadczenia.': 'Nielegalny zapis. Nie można zmieniać regulaminu bez zgody obydwu stron.'
}
|
class UserOutputVariables:
"""The UserOutputVariables object specifies the number of user-defined output variables.
Notes
-----
This object can be accessed by:
.. code-block:: python
import material
mdb.models[name].materials[name].userOutputVariables
import odbMaterial
session.odbs[name].materials[name].userOutputVariables
The corresponding analysis keywords are:
- USER OUTPUT VARIABLES
"""
def __init__(self, n: int = 0):
"""This method creates a UserOutputVariables object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].materials[name].UserOutputVariables
session.odbs[name].materials[name].UserOutputVariables
Parameters
----------
n
An Int specifying the number of user-defined variables required at each material point.
The default value is 0.
Returns
-------
A UserOutputVariables object.
Raises
------
RangeError
"""
pass
def setValues(self):
"""This method modifies the UserOutputVariables object.
Raises
------
RangeError
"""
pass
|
'''
Script converts data from newline seperated values to comma seperated values
'''
fName = input('Enter File Name:')
with open(fName,'r') as f:
lines = f.read()
f.close()
values = lines.splitlines()
s = 'time\n'
for val in values:
s = s + val.strip() + '\n'
print(s)
with open(fName,'w') as f:
f.write(s)
f.close()
print('Done')
|
# Spiritual Release (57462)
sakuno = 9130021
sm.setSpeakerID(sakuno)
sm.sendNext("Kanna, please come to Momijigaoka. We have news.")
sm.setPlayerAsSpeaker()
sm.sendSay("I wonder what's going on? I hope Oda's Army isn't on the move.")
sm.startQuest(parentID)
|
# 登录界面标题
LOGIN_TITLE = 'Xadmin管理后台'
# 登录页面背景图序号
BACKGROUND_INDEX = 1
|
Theatre_1 = {"Name":'Lviv',
"Seats_Number":120,
"Actors_1":["Andrew Kigan","Jhon Speelberg","Alan Mask","Neil Bambino"],
"Play_1":["25/03/2018","Aida",80,"Andrew Kigan","Jhon Speelberg",60,"OK"],
"Play_2":["26/03/2018","War",220,"Jhon Speelberg","Jhon Speelberg","Alan Mask","Neil Bambino",100,"OK"]
}
Theatre_2 = {"Name":'Sokil',
"Seats_Number":110,
"Actors_2":["Julia Portman","Mary Lewis","Carla Mask","Neil Bambino","Natalie Queen"],
"Play_3":["26/03/2018","Rigoletto",120,"Mary Lewis","Carla Mask","Neil Bambino","Natalie Queen",80,"OK"],
"Play_4":["27/03/2018","Night Warriors",90,"Andrew Kigan","Julia Portman","Mary Lewis","Carla Mask",75,"NO"]
}
print('Plays are: ' + str(Theatre_1["Play_1"][1:2]) + ' ' + str(Theatre_1["Play_2"][1:2]) + ' ' + str(Theatre_2["Play_3"][1:2]) + ' ' + str(Theatre_2["Play_4"][1:2]))
print('Number of actors of Lviv Theatre is : ' + str(len(Theatre_1["Actors_1"])))
Other_play = {"Play_5":["29/03/2018","SomethingNew",90,"Andrew Kigan","Julia Portman","Carla Mask",74,"YES"]}
Theatre_2.update(Other_play)
free_tickets = Theatre_1.get("Play_1")[2] - Theatre_1.get("Play_1")[5]
print('Play ' + str(Theatre_1["Play_1"][1:2]) + ', availiable tickets num = ' + str(free_tickets))
profit = Theatre_2.get("Play_3")[2] * Theatre_2.get("Play_3")[7]
print('Play ' + str(Theatre_2["Play_3"][1:2]) + ', profit = ' + str(profit))
One_more_ticket = {"Play_4":["27/03/2018","Night Warriors",90,"Andrew Kigan","Julia Portman","Mary Lewis","Carla Mask",76,"NO"]}
Theatre_2.update(One_more_ticket)
print(Theatre_2)
|
'''
Subgraphs II
In the previous exercise, we gave you a list of nodes whose neighbors we asked you to extract.
Let's try one more exercise in which you extract nodes that have a particular metadata property and their neighbors. This should hark back to what you've learned about using list comprehensions to find nodes. The exercise will also build your capacity to compose functions that you've already written before.
INSTRUCTIONS
0XP
Using a list comprehension, extract nodes that have the metadata 'occupation' as 'celebrity' alongside their neighbors:
The output expression of the list comprehension is n, and there are two iterator variables: n and d. The iterable is the list of nodes of T (including the metadata, which you can specify using data=True) and the conditional expression is if the 'occupation' key of the metadata dictionary d equals 'celebrity'.
Place them in a new subgraph called T_sub. To do this:
Iterate over the nodes, compute the neighbors of each node, and add them to the set of nodes nodeset by using the .union() method. This last part has been done for you.
Use nodeset along with the T.subgraph() method to calculate T_sub.
Draw T_sub to the screen.
'''
# Extract the nodes of interest: nodes
nodes = [n for n, d in T.nodes(data=True) if d['occupation'] == 'celebrity']
# Create the set of nodes: nodeset
nodeset = set(nodes)
# Iterate over nodes
for n in nodes:
# Compute the neighbors of n: nbrs
nbrs = T.neighbors(n)
# Compute the union of nodeset and nbrs: nodeset
nodeset = nodeset.union(nbrs)
# Compute the subgraph using nodeset: T_sub
T_sub = T.subgraph(nodeset)
# Draw T_sub to the screen
nx.draw(T_sub)
plt.show()
|
"""
This module contain functions which are cheking whether the given board
fits the rules.
Git repository: https://github.com/msharsh/puzzle.git
"""
def check_rows(board: list) -> bool:
"""
Checks if there are identical numbers in every row in the board.
Returns True if not, else False.
>>> check_rows(["**** ****","***1 ****","** 3****","* 4 1****",\
" 9 5 "," 6 83 *","3 1 **"," 8 2***"," 2 ****"])
True
"""
for i in range(len(board)):
row_temp = []
for j in range(len(board[i])):
if board[i][j] != '*' and board[i][j] != ' ':
if board[i][j] in row_temp:
return False
else:
row_temp.append(board[i][j])
return True
def check_columns(board: list) -> bool:
"""
Checks if there are identical numbers in every column in the board.
Returns True if not, else False.
>>> check_columns(["**** ****","***1 ****","** 3****","* 4 1****",\
" 9 5 "," 6 83 *","3 1 **"," 8 2***"," 2 ****"])
False
"""
for i in range(len(board[0])):
column_temp = []
for j in range(len(board)):
if board[j][i] != '*' and board[j][i] != ' ':
if board[j][i] in column_temp:
return False
else:
column_temp.append(board[j][i])
return True
def check_color(board: list) -> bool:
"""
Checks if there are identical numbers in every color row in the board.
Returns True if not, else False.
>>> check_color(["**** ****","***1 ****","** 3****","* 4 1****",\
" 9 5 "," 6 83 *","3 1 **"," 8 2***"," 2 ****"])
True
"""
starting_row = 0
starting_column = 4
for i in range(5):
i = starting_row
j = starting_column
color_temp = []
while i + j != 8:
if board[i][j] != ' ':
if board[i][j] in color_temp:
return False
else:
color_temp.append(board[i][j])
i += 1
while i + j != 13:
if board[i][j] != ' ':
if board[i][j] in color_temp:
return False
else:
color_temp.append(board[i][j])
j += 1
starting_row += 1
starting_column -= 1
return True
def validate_board(board: list) -> bool:
"""
Checks if board fits the rules. If fits returns True, else False.
>>> validate_board(["**** ****","***1 ****","** 3****","* 4 1****",\
" 9 5 "," 6 83 *","3 1 **"," 8 2***"," 2 ****"])
False
"""
if check_rows(board) and\
check_columns(board) and\
check_color(board):
return True
return False
|
# program description
# :: python
# :: allows user to enter initial height of ball before dropped
# :: outputs total distance traveled by ball based on number of bounces
# constants
bounceIndex = float(0.6)
# input variables
height = int(input("Enter Ball Height: "))
numberOfBounces = float(input("Enter Number Of Ball Bounces: "))
# calculation
distance = 0
while numberOfBounces > 0:
distance += height
height *= bounceIndex
distance += height
numberOfBounces -= 1
# output
print("Total Distance Traveled: " + str(distance) + " Units.")
|
"""Top-level package for EnviroBot."""
__author__ = """Chris Last"""
__email__ = '[email protected]'
__version__ = '0.1.0'
|
class Stack:
def __init__(self):
self.items = []
def push(self, e):
self.items = [e] + self.items
def pop(self):
return self.items.pop()
s = Stack()
s.push(5) # [5]
s.push(7) # [7, 5]
s.push(11) # [11, 7, 5]
print(s.pop()) # returns 11, left is [7, 5]
print(s.pop()) # returns 7, left is [5]
|
i=map(int, raw_input())
c=0
for m in i:
c = c+1 if m==4 or m==7 else c
print("YES" if c==4 or c==7 else "NO")
|
class Solution:
def tribonacci(self, n: int) -> int:
if n <= 1:
return n
arr = [0 for i in range(n+1)]
arr[1], arr[2] = 1, 1
for i in range(3, len(arr)):
arr[i] = arr[i-1] + arr[i-2] + arr[i-3]
return arr[n]
s = Solution()
print(s.tribonacci(5))
|
class Yo():
def __init__(self, name):
self.name = name
def say_name(self):
print('Yo {}!'.format(self.name))
|
"""
1. Clarification
2. Possible solutions
- dfs, bottom-up
- dfs, top-down
- bfs
3. Coding
4. Tests
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# T=O(n), S=O(n)
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if not root: return 0
if not root.left and not root.right: return 1
return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))
# T=O(n), S=O(n)
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if not root: return 0
self.MaxDep = 0
self.dfs(root, 1)
return self.MaxDep
def dfs(self, root, depth):
if not root: return
if not root.left and not root.right:
self.MaxDep = max(self.MaxDep, depth)
return
self.dfs(root.left, depth + 1)
self.dfs(root.right, depth + 1)
# T=O(n), S=O(n)
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if not root: return 0
Q = collections.deque([root])
ret = 0
while Q:
level_size = len(Q)
for _ in range(level_size):
node = Q.popleft()
if node.left: Q.append(node.left)
if node.right: Q.append(node.right)
ret += 1
return ret
|
# coding: utf8
""""""
VOICES = {
"mei-jia": "com.apple.speech.synthesis.voice.mei-jia",
"ting-ting": "com.apple.speech.synthesis.voice.ting-ting",
}
|
class AlreadyFiredError(RuntimeError):
pass
class InvalidBoardError(RuntimeError):
pass
class InvalidMoveError(RuntimeError):
pass
|
class Solution:
def canPermutePalindrome(self, s: str) -> bool:
x={}
k=0
for i in set(s):
x[i]=s.count(i)
for i,j in x.items():
if j%2!=0:
k=k+1
if k>1:
return False
return True
|
# Задача №292. Максимум из двух чисел
#
# Входные данные
# Даны два целых числа, каждое число записано в отдельной строке.
#
# Выходные данные
# Выведите наибольшее из данных чисел.
#
# Примеры
# входные данные
# 1
# 2
# выходные данные
# 2
a = int(input())
b = int(input())
if a > b :
print(a)
else:
print(b)
|
def test_user_creation(faunadb_client):
username = "burgerbob"
created_user = faunadb_client.create_user(
username=username, password="password1234"
)
assert created_user["username"] == username
all_users = faunadb_client.all_users()
assert len(all_users) == 1
|
'''
## Questions
### 154. [Find Minimum in Rotated Sorted Array II](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/)
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
Find the minimum element.
The array may contain duplicates.
Example 1:
Input: [1,3,5]
Output: 1
Example 2:
Input: [2,2,2,0,1]
Output: 0
Note:
- This is a follow up problem to Find Minimum in Rotated Sorted Array.
- Would allow duplicates affect the run-time complexity? How and why?
'''
## Solutions
class Solution:
def findMin(self, nums: List[int]) -> int:
if not nums:
return nums
nums.sort()
return nums[0]
# Runtime: 60 ms
# Memory Usage: 14.2 MB
|
"""
Demonstrates prompting a user to enter input using the keyboard.
This demonstrates two different ways to get the user's input
as a string and converts the input to an int-type.
The same thing can be done for floats by using the float function
instead of the int function.
"""
number1 = input("Enter the first number: ") #Gets the user's first number as a string.
number1 = int(number1) #The number1 variable is typecast from a string to an int, and is assigned back to itself.
#This replaces the string-type value of the number1 variable with the int-type value.
number2 = int(input("Enter the second number: ")) #Gets the user's second number and the value they typed will be returned (as a string-type)
#and immediately typecast as an int.
print("The sum of the two numbers is", number1 + number2) #Prints the sum of the two numbers.
|
numero = int(input('\nDigite um número inteiro: '))
if numero%2 == 0:
print('\033[1;33mO número {} é PAR! \33[m \n' .format(numero))
else:
print('\033[1;32mO número {} é IMPAR! \33[m \n' .format(numero))
|
class Base(object):
"""
Basic Session Entity is the base entity representing the data in thte session.
"""
def __init__(self, session_id, key, content):
self._session_id = session_id
self.key = key
self.content = content
@property
def session_id(self):
return self._session_id
|
# "Unit GCD"
# Alec Dewulf
# April Long 2020
# Difficulty: Simple
# Concepts: Pigeonhole principle
"""
EXPLANATION
This problem becomes very simple if you notice that there are n//2 even numbers
and by pigeonhole principle each must be on a different day (they all share a
factor of two). Therefore there must be n//2 days.
- If n is even each day will have two numbers a at i and a at i + 1.
- If n is odd each day will have two numbers except for the last day
which will have a at n-2 a at n-1 and a at n.
- If n is one there will be one day with just one.
"""
num_tests = int(input())
solutions = []
for y in range(num_tests):
num_pages = int(input())
# handle one page
if num_pages == 1:
min_days = 1
# more than one page
else:
min_days = num_pages//2
# odd means the last day will have three pages
odd = num_pages % 2 != 0
all_days, start = [], 1
for x in range(1, min_days + 1):
# odd and the last day means there should be three pages
if odd and x == min_days:
# go to end
day = list(range(start, num_pages + 1))
# still pages before end or even
else:
day = [start, x * 2]
start += 2
all_days.append(day)
solutions.append(all_days)
# output results
for sol in solutions:
print(len(sol))
for day in sol:
print(len(day), *day)
|
#
# PySNMP MIB module CISCO-ATM-SERVICE-REGISTRY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ATM-SERVICE-REGISTRY-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:33:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
Gauge32, TimeTicks, Integer32, iso, Counter32, Counter64, IpAddress, Bits, ObjectIdentity, ModuleIdentity, Unsigned32, NotificationType, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "TimeTicks", "Integer32", "iso", "Counter32", "Counter64", "IpAddress", "Bits", "ObjectIdentity", "ModuleIdentity", "Unsigned32", "NotificationType", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
TextualConvention, DisplayString, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "RowStatus")
ciscoAtmServiceRegistryMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 50))
ciscoAtmServiceRegistryMIB.setRevisions(('1996-02-04 00:00',))
if mibBuilder.loadTexts: ciscoAtmServiceRegistryMIB.setLastUpdated('9602210000Z')
if mibBuilder.loadTexts: ciscoAtmServiceRegistryMIB.setOrganization('Cisco Systems, Inc.')
ciscoAtmServiceRegistryMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 50, 1))
class AtmAddr(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(8, 8), ValueSizeConstraint(13, 13), ValueSizeConstraint(20, 20), )
class InterfaceIndexOrZero(TextualConvention, Integer32):
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647)
asrSrvcRegTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 50, 1, 1), )
if mibBuilder.loadTexts: asrSrvcRegTable.setStatus('current')
asrSrvcRegEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 50, 1, 1, 1), ).setIndexNames((0, "CISCO-ATM-SERVICE-REGISTRY-MIB", "asrSrvcRegPort"), (0, "CISCO-ATM-SERVICE-REGISTRY-MIB", "asrSrvcRegServiceID"), (0, "CISCO-ATM-SERVICE-REGISTRY-MIB", "asrSrvcRegAddressIndex"))
if mibBuilder.loadTexts: asrSrvcRegEntry.setStatus('current')
asrSrvcRegPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 50, 1, 1, 1, 1), InterfaceIndexOrZero())
if mibBuilder.loadTexts: asrSrvcRegPort.setStatus('current')
asrSrvcRegServiceID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 50, 1, 1, 1, 2), ObjectIdentifier())
if mibBuilder.loadTexts: asrSrvcRegServiceID.setStatus('current')
asrSrvcRegATMAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 50, 1, 1, 1, 3), AtmAddr()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: asrSrvcRegATMAddress.setStatus('current')
asrSrvcRegAddressIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 50, 1, 1, 1, 4), Integer32())
if mibBuilder.loadTexts: asrSrvcRegAddressIndex.setStatus('current')
asrSrvcRegParm1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 50, 1, 1, 1, 5), OctetString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: asrSrvcRegParm1.setStatus('current')
asrSrvcRegRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 50, 1, 1, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: asrSrvcRegRowStatus.setStatus('current')
asrSrvcRegMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 50, 3))
asrSrvcRegMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 50, 3, 1))
asrSrvcRegMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 50, 3, 2))
asrSrvcRegMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 50, 3, 1, 1)).setObjects(("CISCO-ATM-SERVICE-REGISTRY-MIB", "asrSrvcRegMIBGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
asrSrvcRegMIBCompliance = asrSrvcRegMIBCompliance.setStatus('current')
asrSrvcRegMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 50, 3, 2, 1)).setObjects(("CISCO-ATM-SERVICE-REGISTRY-MIB", "asrSrvcRegATMAddress"), ("CISCO-ATM-SERVICE-REGISTRY-MIB", "asrSrvcRegParm1"), ("CISCO-ATM-SERVICE-REGISTRY-MIB", "asrSrvcRegRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
asrSrvcRegMIBGroup = asrSrvcRegMIBGroup.setStatus('current')
mibBuilder.exportSymbols("CISCO-ATM-SERVICE-REGISTRY-MIB", asrSrvcRegServiceID=asrSrvcRegServiceID, asrSrvcRegRowStatus=asrSrvcRegRowStatus, asrSrvcRegMIBGroups=asrSrvcRegMIBGroups, ciscoAtmServiceRegistryMIB=ciscoAtmServiceRegistryMIB, InterfaceIndexOrZero=InterfaceIndexOrZero, ciscoAtmServiceRegistryMIBObjects=ciscoAtmServiceRegistryMIBObjects, asrSrvcRegTable=asrSrvcRegTable, asrSrvcRegMIBConformance=asrSrvcRegMIBConformance, asrSrvcRegMIBCompliance=asrSrvcRegMIBCompliance, asrSrvcRegEntry=asrSrvcRegEntry, asrSrvcRegMIBCompliances=asrSrvcRegMIBCompliances, PYSNMP_MODULE_ID=ciscoAtmServiceRegistryMIB, asrSrvcRegATMAddress=asrSrvcRegATMAddress, asrSrvcRegParm1=asrSrvcRegParm1, asrSrvcRegMIBGroup=asrSrvcRegMIBGroup, asrSrvcRegPort=asrSrvcRegPort, AtmAddr=AtmAddr, asrSrvcRegAddressIndex=asrSrvcRegAddressIndex)
|
API_TOKEN = "465633546:AAGQNVuoqn5gouyOieqCj1yQbo2riAyebSM"
WEBHOOK_HOST = '104.131.96.14'
WEBHOOK_PORT = 8443 # 443, 80, 88 or 8443 (port need to be 'open')
WEBHOOK_LISTEN = '0.0.0.0' # In some VPS you may need to put here the IP addr
WEBHOOK_SSL_CERT = '/home/gorec/Shefflera/db_and_certs/webhook_cert.pem' # Path to the ssl certificate
WEBHOOK_SSL_PRIV = '/home/gorec/Shefflera/db_and_certs/webhook_pkey.pem' # Path to the ssl private key
WEBHOOK_URL_BASE = "https://%s:%s" % (WEBHOOK_HOST, WEBHOOK_PORT)
WEBHOOK_URL_PATH = "/%s/" % (API_TOKEN)
DB = "/home/gorec/Shefflera/db_and_certs/Shefflera.db"
CONTACTS_MAPPING = {
'VK': 'Мы в VK: https://vk.com/shefflera_organic',
'Instagram': 'Мы в Instagram: https://instagram.com/shefflera_',
'Телефон': 'Наш телефон: 8 999 120 02 90',
'Адрес': 'ул. Новая 51, ТЦ «НОВАЯ 51», цокольный этаж'
}
MAIN_MENU = ('Наши бренды', 'Органическая косметика', 'Красота изнутри', 'Контакты')
PRODUCT_MENU = ('Описание', 'Состав', 'Применение', 'Изготовитель')
|
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
class StopCondition:
def __init__(self, agent):
self.agent = agent
def check(self) -> bool:
raise NotImplementedError("Implemented by subclass")
class NeverStopCondition(StopCondition):
def __init__(self, agent):
super().__init__(agent)
self.name = "never"
def check(self):
return False
|
# ------------------------------
# 144. Binary Tree Preorder Traversal
#
# Description:
# Given a binary tree, return the preorder traversal of its nodes' values.
# Example:
# Input: [1,null,2,3]
# 1
# \
# 2
# /
# 3
# Output: [1,2,3]
#
# Follow up: Recursive solution is trivial, could you do it iteratively?
#
# Version: 1.0
# 08/23/18 by Jianfa
# ------------------------------
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def preorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
if not root:
return []
res = []
traverse = [root]
while traverse:
node = traverse.pop()
res.append(node.val)
if node.right:
traverse.append(node.right)
if node.left:
traverse.append(node.left)
return res
# Used for testing
if __name__ == "__main__":
test = Solution()
# ------------------------------
# Summary:
# Iterative solution.
# Maintain a traverse list to decide the visiting order of nodes.
|
salir="s"
while salir!="Salir":
try:
seguir_ordenando="s"
cantidad_total_producto=[0,0,0]
cantidad_producto=[0,0,0]
producto=["Papas","Hamburguesas","Tacos"]
total=0
print("Bienvenido al Restaurante Rapi-Comidas\nEl menú de hoy es: \n\t1. Papas \t\tValor: 600 colones\n\t2. Hamburguesas \tValor: 1200 colones\n\t3. Tacos \t\tValor: 800")
while seguir_ordenando=="s":
opcion=int(input("\nPor favor digite el número de platillo: "))
if opcion==1:
cantidad_producto[0]=int(input("Cuantas papas desea: "))
cantidad_total_producto[0]+=cantidad_producto[0]
total+=(cantidad_producto[0]*600)
elif opcion==2:
cantidad_producto[1]=int(input("Cuantas hamburguesas desea: "))
cantidad_total_producto[1]+=cantidad_producto[1]
total+=(cantidad_producto[1]*1200)
elif opcion==3:
cantidad_producto[2]=int(input("Cuantos tacos desea: "))
cantidad_total_producto[2]+=cantidad_producto[2]
total+=(cantidad_producto[2]*800)
elif opcion < 1 or opcion > 3:
print("Esa opcion no está dentro del menú")
break
seguir_ordenando=input("\nDesea ordenar otro platillo (s/n): ")
print("\n")
for i in range(0,3,1):
if cantidad_producto[i] != 0:
print("\tCantidad de ",producto[i],"es de: ",cantidad_total_producto[i])
print("\tTotal a pagar: ",total)
salir=input("\nDigite 'Salir' para finalizar o presione 'enter' para una nueva orden: ")
except ValueError:
print("\nSolo se aceptan valores enteros")
salir=input("\nDigite 'Salir' para finalizar o presione 'enter' para una nueva orden: ")
|
# 函数名作为变量名
a, b, c = 3, 7, 5
max = max(a, b, c) # 第一次执行:OK (max = 7)
print('a、b和c中的最大值是', max, '。')
max = max(a, b, c) # 第二次执行:错误(max = 7(a, b, c))
|
def set_partitions(iterable, k=None):
"""
Yield the set partitions of *iterable* into *k* parts. Set partitions are
not order-preserving.
>>> iterable = 'abc'
>>> for part in set_partitions(iterable, 2):
... print([''.join(p) for p in part])
['a', 'bc']
['ab', 'c']
['b', 'ac']
If *k* is not given, every set partition is generated.
>>> iterable = 'abc'
>>> for part in set_partitions(iterable):
... print([''.join(p) for p in part])
['abc']
['a', 'bc']
['ab', 'c']
['b', 'ac']
['a', 'b', 'c']
"""
L = list(iterable)
n = len(L)
if k is not None:
if k < 1:
raise ValueError(
"Can't partition in a negative or zero number of groups"
)
elif k > n:
return
def set_partitions_helper(L, k):
n = len(L)
if k == 1:
yield [L]
elif n == k:
yield [[s] for s in L]
else:
e, *M = L
for p in set_partitions_helper(M, k - 1):
yield [[e], *p]
for p in set_partitions_helper(M, k):
for i in range(len(p)):
yield p[:i] + [[e] + p[i]] + p[i + 1 :]
if k is None:
for k in range(1, n + 1):
yield from set_partitions_helper(L, k)
else:
yield from set_partitions_helper(L, k)
def get_groups_column_from_partitions(partitions, data_length):
"""
Transforms the partitions returned by set_partitions into vectors containing the group numbers
Parameters
----------
partitions : list
list of partition values returned by the set_partitions function
data_length : int
Number of lines in the input dataframe
Returns
-------
list
A list containing all the groups column values corresponding to each partition
"""
permutations_values = [[i for i in range(data_length)] for elem in partitions]
for i in range(len(partitions)):
for j in permutations_values[i]:
value = permutations_values[i][j]
for k in range(len(partitions[i])):
team = partitions[i][k]
if value in team:
permutations_values[i][j] = k
return permutations_values
|
def is_anagram(first, second):
return sorted(list(first)) == sorted(list(second))
def main():
valid = 0
with open('day_4.in', 'r') as f:
for l in f.readlines():
split = l.strip().split(' ')
valid_passphrase = True
for start in range(0, len(split) - 1):
for cur in range(start + 1, len(split)):
if is_anagram(split[start], split[cur]):
valid_passphrase = False
break
if not valid_passphrase:
break
if valid_passphrase:
valid += 1
print(valid)
if __name__ == '__main__':
main()
|
# joint class definitions
class TripleJoint(object):
"""
Describing the relations and dowel placement between 3 beams.
"""
def ___init___(self, beam_set, type_def, loc_para = 0):
"""
Initialization of a triple-joint isinstance
:param beam_set: Which beams to consider
:param type_def: Type and functions that controle the hole locs.
:param loc_para: Where to consider them to be connected (0 or 1)
"""
self.beam_set = beam_set
self.joint_type = joint_type
self.loc_para = loc_para
self.__location_setting()
def __location_setting(self):
""" Internal Method that set's up the location parameters of the beam """
a = (0 + self.loc_para) % 2
b = (1 + self.loc_para) % 2
c = (0 + self.loc_para) % 2
self.type_loc_para = self.type_def.Triple.locations[a, b, c]
def get_connections(self):
""" Internal Method that uses the functions defined in the joint types """
pt0, pt1, pt2 = self.joint_type.triple_dowel_execution()
class DoubleJoint(object):
"""
Describing the relations and dowel placement between 2 beams, according
to the Triple-Dowel-Beam logic.
"""
def __init__(self, beam_set, joint_type, loc_para = 0, left_or_right = 0):
"""
Initialization of a double-joint isinstance
:param beam_set: Which beams to consider
:param joint_type: Type and functions that controle the hole locs.
:param loc_para: Where to consider them to be connected (0 or 1)
:param left_or_right: Left or right set (0 or 1)
"""
self.beam_set = beam_set
self.joint_type = joint_type
self.loc_para = loc_para
self.left_or_right = left_or_right
def __location_setting(self):
"""
Internal Method that set's up the location parameters of the beam
"""
# double only logic
if self.left_or_right:
# which locations to consider from the type
self.rel_locations = [(0 + self.loc_para) % 2, (1 + self.loc_para) % 2]
self.type_loc_para = self.type_def.Triple.locations()
elif not(self.left_or_right):
self.rel_locations = [(1 + self.loc_para) % 2, (0 + self.loc_para) % 2]
self.type_loc_para = self.type_def.Triple.locations(self)
class EndSeams(object):
""" Class defining the joints at the v-ends of the system """
def __init__(self, beam_set, location_parameters, joint_type):
self.left_beam = beam_set[0]
self.middle_beam = beam_set[1]
self.right_beam = beam_set[2]
self.loc_para = location_parameters
self.joint_type = joint_type
class Foundation(object):
""" Class defining the joints connecting with the floor """
def __init__(self, beam_set, location_parameters, joint_type):
self.left_beam = beam_set[0]
self.middle_beam = beam_set[1]
self.right_beam = beam_set[2]
self.loc_para = location_parameters
self.joint_type = joint_type
|
#!/usr/bin/env python
"""
Desafio do vídeo "Entrada de Dados": Reescreva o programa conta
Segundos para imprimir também a quantidade de dias,
ou seja, faça um programa em Python que dada a quantidade de segundos,
o programa "quebra" esse valor em dias, horas, minutos e segundos.
A saída deve estar no formato: a dias, b horas, c minutos e d segundos.
Abaixo um exemplo de como deve ser a entrada e saída de dados do programa:
Exemplo:
Entrada de Dados:
Por favor, entre com o número de segundos que deseja converter: 178615
Saída de Dados:
2 dias, 1 horas, 36 minutos e 55 segundos.
"""
if __name__ == "__main__":
second = float(input('Por favor, entre com o número de segundos que deseja converter:'))
day = second // 86400
if(day - second/86400) != 0:
hour = day - second/86400
if hour < 0:
hour = -1 * hour
hour = hour * 24
hour = hour//1
if (hour - (day - (second / 86400)) * 24) != 0:
if ((day - (second / 86400)) * 24) < 0:
minute = (hour + (day - (second / 86400)) * 24)
else:
minute = (hour - (day - (second / 86400)) * 24)
if minute < 0:
minute = (-1 * minute) *60
temp = minute
minute = minute//1
temp = minute - temp
if temp < 0 :
temp = -1 * temp
if temp != 0 :
temp = (temp * 60) // 1
print(int(day),"dias,",int(hour),"horas,",int(minute),"minutos e",int(temp),"segundos.")
|
APP_KEY = 'u5lo5mX6IzAyv9TQJZG5tErDP'
APP_SECRET = 'pJ294qcsbwcEty3ePPbGYVbD9sTL2J7dgC7BDdQ4KyoupmAxHS'
OAUTH_TOKEN = '1285969065996095488-WqwqIQPP69TovfaCISoY6DkWWgwajY'
OAUTH_TOKEN_SECRET = 'PIC1rTAs9Q9HD8zpGV7dMC5FMXpWmM5yn5WFhpJHt3li5'
## Your Telegram Channel Name ##
channel_name = 'uchihacommunity'
## Telegram Access Token ##
telegram_token = '1395164117:AAGmUsXuvPng9mwyWti_hTtfFzVtH075Wtc'
## Twitter User Name to get Timeline ##
user_name = 'uchihahimself'
|
'''
62-Melhore o desafio 061,perguntando para o usuário se ele quer mostrar mais alguns termos.O programa encerrará quando ele disser que quer mostrar 0 termos.
'''
primeirotermo=int(input('Digite o primeiro termo: '))
razao=int(input('Digite a razao: '))
i=1
termo=10
total=0
while termo != 0:
total=total+termo
while i <= total:
pa=primeirotermo+(i-1)*razao
print('{} ->'.format(pa),end=' ')
ultimotermo = pa
i=i+1
print('PAUSA!!!')
termo=int(input('Quantos termos você quer?'))
print('P.A com {} números mostrados'.format(total))
|
n1 = int(input('Digite um numero: '))
n2 = int(input('Digite um numero: '))
if n1 > n2:
print('{} é maior que o {}.'.format(n1, n2))
elif n1 < n2:
print('{} é maior que o {}.'.format(n2, n1))
else:
print('Os numeros são iguais!!')
|
"""
cmd.do('stereo walleye; ')
cmd.do('set ray_shadow, off; ')
cmd.do('#draw 3200,2000;')
cmd.do('draw ${1:1600,1000}; ')
cmd.do('png ${2:aaa}.png')
cmd.do('${0}')
"""
cmd.do('stereo walleye; ')
cmd.do('set ray_shadow, off; ')
cmd.do('#draw 3200,2000;')
cmd.do('draw 1600,1000; ')
cmd.do('png aaa.png')
# Description: Stereo draw.
# Source: placeHolder
|
"""
闭包:
闭包指延伸了作用域的函数,其中包含函数定义体中引用、但是不在定义体中定义的非全局变量。
函数是不是匿名的没关系,关键是它能访问定义体之外定义的非全局变量。
"""
def make_averager():
"""
闭包
"""
# 局部变量(非全局变量)(自由变量)
series = []
def averager(new_value):
series.append(new_value)
total = sum(series)
return total / len(series)
return averager
def use_make_averager():
avg = make_averager()
print(avg(10))
print(avg(12))
# 输出结果:
"""
10.0
11.0
"""
if __name__ == '__main__':
use_make_averager()
|
#Programa analisador
#Dado um certo tipo de informação, o programa analisa e mostra na tela algumas informações sobre ela.
dado = input("Digite aqui uma informação para ela ser analisada: ")
print(f'O tipo primitivo Dessa informação é: {type(dado)}')
print("A informação é Numerico? {}".format(dado.isnumeric()))
print("A informação é Alfabetico? {}".format(dado.isalpha()))
print("A informação é Capitalizada? {}".format(dado.istitle()))
#Percebi agora que a partir do python 3.7 dá pra formatar sem o .format, só colocar o f e dentro do placeholder o onjeto/metodo etc
|
"""
Lecture 10: Dynamic Programming
Alternating Coin Game
---------------------
Consider a game where you have a list
with an even number of coins with
positive integer values
v_0, v_1, ..., v_i, ..., v_(n - 1)
Each player alternates picking either the
leftmost or rightmost coin until there are
no coins left. Whichever player picks coins
that add to the highest value wins.
It can be easily shown that the player who
moves first can always force a win.
This program contains a function which given a
list of coins, returns the most the first player
can win assuming his opponent is also playing
optimally.
"""
def dp_max_coin_value(dp, coins, i, j):
"""
Recursive function which computes the maximum
possible value assuming the opponent also plays
optimally
It uses memoization to speed up performance
with a Python dictionary named dp "dynamic programming"
"""
if (i, j) in dp:
return dp[(i, j)]
if i > j:
return 0
elif i == j:
dp[(i, j)] = coins[i]
else:
dp[(i, j)] = max(
coins[i] + min(
dp_max_coin_value(dp, coins, i + 1, j - 1),
dp_max_coin_value(dp, coins, i + 2, j),
),
coins[j] + min(
dp_max_coin_value(dp, coins, i + 1, j - 1),
dp_max_coin_value(dp, coins, i, j - 2),
),
)
return dp[(i, j)]
def max_possible_value(coins):
"""
Get the maximum possible value the first
player can accumulate given a list
of coins
"""
return dp_max_coin_value(
dict(), coins, 0, len(coins) - 1)
|
"""
author : @akash kumar
github : https://github/Akash671
string fun:
string.replace(sub_old_string,new_sub_string,count)
string.count(your_string)
"""
def solve():
#n,m=map(int,input().split())
#n=int(input())
#a=list(map(int,input().split()[:n]))
#s=str(input())
#a,b=input().split()
s=str(input())
a=""
n=len(s)
for i in range(2):
a+=s[i]
if a=="</" and s[n-1]==">" and s[2]!="/":
print("Success")
else:
print("Error")
for _ in range(int(input())):
solve()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.