content
stringlengths
7
1.05M
ternary = [0, 1, 2] ternary[0] = "true" ternary[1] = "maybe" ternary[2] = "false" x = 34 y = 34 if x > y: print(ternary[0]) elif x < y: print(ternary[2]) else: print(ternary[1])
# # PySNMP MIB module FDDI-SMT73-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/FDDI-SMT73-MIB # Produced by pysmi-0.0.7 at Sun Feb 14 00:12: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) # ( OctetString, Integer, ObjectIdentifier, ) = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") ( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ( ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ConstraintsUnion, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsUnion") ( NotificationGroup, ModuleCompliance, ) = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") ( MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, Gauge32, Bits, Unsigned32, Counter64, TimeTicks, NotificationType, ModuleIdentity, ObjectIdentity, mib_2, MibIdentifier, iso, Counter32, IpAddress, ) = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "Gauge32", "Bits", "Unsigned32", "Counter64", "TimeTicks", "NotificationType", "ModuleIdentity", "ObjectIdentity", "mib-2", "MibIdentifier", "iso", "Counter32", "IpAddress") ( DisplayString, TextualConvention, ) = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") transmission = MibIdentifier((1, 3, 6, 1, 2, 1, 10)) fddi = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15)) fddimib = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73)) class FddiTimeNano(Integer32): subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,2147483647) class FddiTimeMilli(Integer32): subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,2147483647) class FddiResourceId(Integer32): subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535) class FddiSMTStationIdType(OctetString): subtypeSpec = OctetString.subtypeSpec+ValueSizeConstraint(8,8) fixedLength = 8 class FddiMACLongAddressType(OctetString): subtypeSpec = OctetString.subtypeSpec+ValueSizeConstraint(6,6) fixedLength = 6 fddimibSMT = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 1)) fddimibMAC = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 2)) fddimibMACCounters = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 3)) fddimibPATH = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 4)) fddimibPORT = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 5)) fddimibSMTNumber = MibScalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTNumber.setDescription("The number of SMT implementations (regardless of \n their current state) on this network management \n application entity. The value for this variable \n must remain constant at least from one re- \n initialization of the entity's network management \n system to the next re-initialization.") fddimibSMTTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2), ) if mibBuilder.loadTexts: fddimibSMTTable.setDescription('A list of SMT entries. The number of entries \n shall not exceed the value of fddimibSMTNumber.') fddimibSMTEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibSMTIndex")) if mibBuilder.loadTexts: fddimibSMTEntry.setDescription('An SMT entry containing information common to a \n given SMT.') fddimibSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTIndex.setDescription("A unique value for each SMT. The value for each \n SMT must remain constant at least from one re- \n initialization of the entity's network management \n system to the next re-initialization.") fddimibSMTStationId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 2), FddiSMTStationIdType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTStationId.setDescription('Used to uniquely identify an FDDI station.') fddimibSMTOpVersionId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTOpVersionId.setDescription('The version that this station is using for its \n operation (refer to ANSI 7.1.2.2). The value of \n this variable is 2 for this SMT revision.') fddimibSMTHiVersionId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTHiVersionId.setDescription('The highest version of SMT that this station \n supports (refer to ANSI 7.1.2.2).') fddimibSMTLoVersionId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTLoVersionId.setDescription('The lowest version of SMT that this station \n supports (refer to ANSI 7.1.2.2).') fddimibSMTUserData = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32,32)).setFixedLength(32)).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTUserData.setDescription('This variable contains 32 octets of user defined \n information. The information shall be an ASCII \n string.') fddimibSMTMIBVersionId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTMIBVersionId.setDescription('The version of the FDDI MIB of this station. The \n value of this variable is 1 for this SMT \n revision.') fddimibSMTMACCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,255))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTMACCts.setDescription('The number of MACs in this station or \n concentrator.') fddimibSMTNonMasterCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,2))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTNonMasterCts.setDescription('The value of this variable is the number of A, B, \n and S ports in this station or concentrator.') fddimibSMTMasterCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,255))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTMasterCts.setDescription('The number of M Ports in a node. If the node is \n not a concentrator, the value of the variable is \n zero.') fddimibSMTAvailablePaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,7))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTAvailablePaths.setDescription('A value that indicates the PATH types available \n in the station. \n \n The value is a sum. This value initially takes \n the value zero, then for each type of PATH that \n this node has available, 2 raised to a power is \n added to the sum. The powers are according to the \n following table: \n \n Path Power \n Primary 0 \n Secondary 1 \n Local 2 \n \n For example, a station having Primary and Local \n PATHs available would have a value of 5 (2**0 + \n 2**2).') fddimibSMTConfigCapabilities = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,3))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTConfigCapabilities.setDescription("A value that indicates the configuration \n capabilities of a node. The 'Hold Available' bit \n indicates the support of the optional Hold \n Function, which is controlled by \n fddiSMTConfigPolicy. The 'CF-Wrap-AB' bit \n indicates that the station has the capability of \n performing a wrap_ab (refer to ANSI SMT 9.7.2.2). \n \n The value is a sum. This value initially takes \n the value zero, then for each of the configuration \n policies currently enforced on the node, 2 raised \n to a power is added to the sum. The powers are \n according to the following table: \n \n Policy Power \n holdAvailable 0 \n CF-Wrap-AB 1 ") fddimibSMTConfigPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,1))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTConfigPolicy.setDescription("A value that indicates the configuration policies \n currently desired in a node. 'Hold' is one of the \n terms used for the Hold Flag, an optional ECM flag \n used to enable the optional Hold policy. \n \n The value is a sum. This value initially takes \n the value zero, then for each of the configuration \n policies currently enforced on the node, 2 raised \n to a power is added to the sum. The powers are \n according to the following table: \n \n Policy Power \n configurationhold 0 ") fddimibSMTConnectionPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(32768,65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTConnectionPolicy.setDescription("A value representing the connection policies in \n effect in a node. A station sets the corresponding \n bit for each of the connection types that it \n rejects. The letter designations, X and Y, in the \n 'rejectX-Y' names have the following significance: \n X represents the PC-Type of the local PORT and Y \n represents the PC_Type of the adjacent PORT \n (PC_Neighbor). The evaluation of Connection- \n Policy (PC-Type, PC-Neighbor) is done to determine \n the setting of T- Val(3) in the PC-Signalling \n sequence (refer to ANSI 9.6.3). Note that Bit 15, \n (rejectM-M), is always set and cannot be cleared. \n \n The value is a sum. This value initially takes \n the value zero, then for each of the connection \n policies currently enforced on the node, 2 raised \n to a power is added to the sum. The powers are \n according to the following table: \n \n Policy Power \n rejectA-A 0 \n rejectA-B 1 \n rejectA-S 2 \n rejectA-M 3 \n rejectB-A 4 \n rejectB-B 5 \n rejectB-S 6 \n rejectB-M 7 \n rejectS-A 8 \n rejectS-B 9 \n rejectS-S 10 \n rejectS-M 11 \n rejectM-A 12 \n rejectM-B 13 \n rejectM-S 14 \n rejectM-M 15 ") fddimibSMTTNotify = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(2,30))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTTNotify.setDescription('The timer, expressed in seconds, used in the \n Neighbor Notification protocol. It has a range of \n 2 seconds to 30 seconds, and its default value is \n 30 seconds (refer to ANSI SMT 8.2).') fddimibSMTStatRptPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTStatRptPolicy.setDescription('If true, indicates that the node will generate \n Status Reporting Frames for its implemented events \n and conditions. It has an initial value of true. \n This variable determines the value of the \n SR_Enable Flag (refer to ANSI SMT 8.3.2.1).') fddimibSMTTraceMaxExpiration = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 17), FddiTimeMilli()).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTTraceMaxExpiration.setDescription('Reference Trace_Max (refer to ANSI SMT \n 9.4.4.2.2).') fddimibSMTBypassPresent = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTBypassPresent.setDescription('A flag indicating if the station has a bypass on \n its AB port pair.') fddimibSMTECMState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8,))).clone(namedValues=NamedValues(("ec0", 1), ("ec1", 2), ("ec2", 3), ("ec3", 4), ("ec4", 5), ("ec5", 6), ("ec6", 7), ("ec7", 8),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTECMState.setDescription('Indicates the current state of the ECM state \n machine (refer to ANSI SMT 9.5.2).') fddimibSMTCFState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,))).clone(namedValues=NamedValues(("cf0", 1), ("cf1", 2), ("cf2", 3), ("cf3", 4), ("cf4", 5), ("cf5", 6), ("cf6", 7), ("cf7", 8), ("cf8", 9), ("cf9", 10), ("cf10", 11), ("cf11", 12), ("cf12", 13),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTCFState.setDescription('The attachment configuration for the station or \n concentrator (refer to ANSI SMT 9.7.2.2).') fddimibSMTRemoteDisconnectFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTRemoteDisconnectFlag.setDescription('A flag indicating that the station was remotely \n disconnected from the network as a result of \n receiving an fddiSMTAction, disconnect (refer to \n ANSI SMT 6.4.5.3) in a Parameter Management Frame. \n A station requires a Connect Action to rejoin and \n clear the flag (refer to ANSI SMT 6.4.5.2).') fddimibSMTStationStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("concatenated", 1), ("separated", 2), ("thru", 3),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTStationStatus.setDescription('The current status of the primary and secondary \n paths within this station.') fddimibSMTPeerWrapFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTPeerWrapFlag.setDescription('This variable assumes the value of the \n PeerWrapFlag in CFM (refer to ANSI SMT \n 9.7.2.4.4).') fddimibSMTTimeStamp = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 24), FddiTimeMilli()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTTimeStamp.setDescription('This variable assumes the value of TimeStamp \n (refer to ANSI SMT 8.3.2.1).') fddimibSMTTransitionTimeStamp = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 25), FddiTimeMilli()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTTransitionTimeStamp.setDescription('This variable assumes the value of \n TransitionTimeStamp (refer to ANSI SMT 8.3.2.1).') fddimibSMTStationAction = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8,))).clone(namedValues=NamedValues(("other", 1), ("connect", 2), ("disconnect", 3), ("path-Test", 4), ("self-Test", 5), ("disable-a", 6), ("disable-b", 7), ("disable-m", 8),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTStationAction.setDescription("This object, when read, always returns a value of \n other(1). The behavior of setting this variable \n to each of the acceptable values is as follows: \n \n other(1): Results in an appropriate error. \n connect(2): Generates a Connect signal to ECM \n to begin a connection sequence. See ANSI \n Ref 9.4.2. \n disconnect(3): Generates a Disconnect signal \n to ECM. see ANSI Ref 9.4.2. \n path-Test(4): Initiates a station Path_Test. \n The Path_Test variable (see ANSI Ref \n 9.4.1) is set to 'Testing'. The results \n of this action are not specified in this \n standard. \n self-Test(5): Initiates a station Self_Test. \n The results of this action are not \n specified in this standard. \n disable-a(6): Causes a PC_Disable on the A \n port if the A port mode is peer. \n disable-b(7): Causes a PC_Disable on the B \n port if the B port mode is peer. \n disable-m(8): Causes a PC_Disable on all M \n ports. \n \n Attempts to set this object to all other values \n results in an appropriate error. The result of \n setting this variable to path-Test(4) or self- \n Test(5) is implementation-specific.") fddimibMACNumber = MibScalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACNumber.setDescription("The total number of MAC implementations (across \n all SMTs) on this network management application \n entity. The value for this variable must remain \n constant at least from one re-initialization of \n the entity's network management system to the next \n re-initialization.") fddimibMACTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2), ) if mibBuilder.loadTexts: fddimibMACTable.setDescription('A list of MAC entries. The number of entries \n shall not exceed the value of fddimibMACNumber.') fddimibMACEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibMACSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibMACIndex")) if mibBuilder.loadTexts: fddimibMACEntry.setDescription('A MAC entry containing information common to a \n given MAC.') fddimibMACSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACSMTIndex.setDescription('The value of the SMT index associated with this \n MAC.') fddimibMACIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACIndex.setDescription('Index variable for uniquely identifying the MAC \n object instances, which is the same as the \n corresponding resource index in SMT.') fddimibMACIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACIfIndex.setDescription('The value of the MIB-II ifIndex corresponding to \n this MAC. If none is applicable, 0 is returned.') fddimibMACFrameStatusFunctions = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,7))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACFrameStatusFunctions.setDescription("Indicates the MAC's optional Frame Status \n processing functions. \n \n The value is a sum. This value initially takes \n the value zero, then for each function present, 2 \n raised to a power is added to the sum. The powers \n are according to the following table: \n \n function Power \n fs-repeating 0 \n fs-setting 1 \n fs-clearing 2 ") fddimibMACTMaxCapability = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 5), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTMaxCapability.setDescription('Indicates the maximum time value of fddiMACTMax \n that this MAC can support.') fddimibMACTVXCapability = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 6), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTVXCapability.setDescription('Indicates the maximum time value of \n fddiMACTvxValue that this MAC can support.') fddimibMACAvailablePaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,7))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACAvailablePaths.setDescription('Indicates the paths available for this MAC (refer \n to ANSI SMT 9.7.7). \n \n The value is a sum. This value initially takes \n the value zero, then for each type of PATH that \n this MAC has available, 2 raised to a power is \n added to the sum. The powers are according to the \n following table: \n \n Path Power \n Primary 0 \n Secondary 1 \n Local 2 ') fddimibMACCurrentPath = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6,))).clone(namedValues=NamedValues(("isolated", 1), ("local", 2), ("secondary", 3), ("primary", 4), ("concatenated", 5), ("thru", 6),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACCurrentPath.setDescription('Indicates the Path into which this MAC is \n currently inserted (refer to ANSI 9.7.7).') fddimibMACUpstreamNbr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 9), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACUpstreamNbr.setDescription("The MAC's upstream neighbor's long individual MAC \n address. It has an initial value of the SMT- \n Unknown-MAC Address and is only modified as \n specified by the Neighbor Information Frame \n protocol (refer to ANSI SMT 7.2.1 and 8.2).") fddimibMACDownstreamNbr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 10), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACDownstreamNbr.setDescription("The MAC's downstream neighbor's long individual \n MAC address. It has an initial value of the SMT- \n Unknown-MAC Address and is only modified as \n specified by the Neighbor Information Frame \n protocol (refer to ANSI SMT 7.2.1 and 8.2).") fddimibMACOldUpstreamNbr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 11), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACOldUpstreamNbr.setDescription("The previous value of the MAC's upstream \n neighbor's long individual MAC address. It has an \n initial value of the SMT-Unknown- MAC Address and \n is only modified as specified by the Neighbor \n Information Frame protocol (refer to ANSI SMT \n 7.2.1 and 8.2).") fddimibMACOldDownstreamNbr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 12), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACOldDownstreamNbr.setDescription("The previous value of the MAC's downstream \n neighbor's long individual MAC address. It has an \n initial value of the SMT- Unknown-MAC Address and \n is only modified as specified by the Neighbor \n Information Frame protocol (refer to ANSI SMT \n 7.2.1 and 8.2).") fddimibMACDupAddressTest = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("none", 1), ("pass", 2), ("fail", 3),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACDupAddressTest.setDescription('The Duplicate Address Test flag, Dup_Addr_Test \n (refer to ANSI 8.2).') fddimibMACRequestedPaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibMACRequestedPaths.setDescription('List of permitted Paths which specifies the \n Path(s) into which the MAC may be inserted (refer \n to ansi SMT 9.7). \n \n The value is a sum which represents the individual \n paths that are desired. This value initially \n takes the value zero, then for each type of PATH \n that this node is, 2 raised to a power is added to \n the sum. The powers are according to the \n following table: \n \n Path Power \n local 0 \n secondary-alternate 1 \n primary-alternate 2 \n concatenated-alternate 3 \n secondary-preferred 4 \n primary-preferred 5 \n concatenated-preferred 6 \n thru 7 ') fddimibMACDownstreamPORTType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5,))).clone(namedValues=NamedValues(("a", 1), ("b", 2), ("s", 3), ("m", 4), ("none", 5),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACDownstreamPORTType.setDescription('Indicates the PC-Type of the first port that is \n downstream of this MAC (the exit port).') fddimibMACSMTAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 16), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACSMTAddress.setDescription('The 48-bit individual address of the MAC used for \n SMT frames.') fddimibMACTReq = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 17), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTReq.setDescription('This variable is the T_Req_value passed to the \n MAC. Without having detected a duplicate, the \n time value of this variable shall assume the \n maximum supported time value which is less than or \n equal to the time value of fddiPATHMaxT-Req. When \n a MAC has an address detected as a duplicate, it \n may use a time value for this variable greater \n than the time value of fddiPATHTMaxLowerBound. A \n station shall cause claim when the new T_Req may \n cause the value of T_Neg to change in the claim \n process, (i.e., time value new T_Req < T_Neg, or \n old T_Req = T_Neg).') fddimibMACTNeg = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 18), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTNeg.setDescription('It is reported as a FddiTimeNano number.') fddimibMACTMax = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 19), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTMax.setDescription('This variable is the T_Max_value passed to the \n MAC. The time value of this variable shall assume \n the minimum suported time value which is greater \n than or equal to the time value of fddiPATHT- \n MaxLowerBound') fddimibMACTvxValue = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 20), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTvxValue.setDescription('This variable is the TVX_value passed to the MAC. \n The time value of this variable shall assume the \n minimum suported time value which is greater than \n or equal to the time value of \n fddiPATHTVXLowerBound.') fddimibMACFrameCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACFrameCts.setDescription('A count of the number of frames received by this \n MAC (refer to ANSI MAC 7.5.1).') fddimibMACCopiedCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACCopiedCts.setDescription("A count that should as closely as possible match \n the number of frames addressed to (A bit set) and \n successfully copied into the station's receive \n buffers (C bit set) by this MAC (refer to ANSI MAC \n 7.5). Note that this count does not include MAC \n frames.") fddimibMACTransmitCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTransmitCts.setDescription('A count that should as closely as possible match \n the number of frames transmitted by this MAC \n (refer to ANSI MAC 7.5). Note that this count \n does not include MAC frames.') fddimibMACErrorCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACErrorCts.setDescription('A count of the number of frames that were \n detected in error by this MAC that had not been \n detected in error by another MAC (refer to ANSI \n MAC 7.5.2).') fddimibMACLostCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACLostCts.setDescription('A count of the number of instances that this MAC \n detected a format error during frame reception \n such that the frame was stripped (refer to ANSI \n MAC 7.5.3).') fddimibMACFrameErrorThreshold = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 26), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibMACFrameErrorThreshold.setDescription('A threshold for determining when a MAC Condition \n report (see ANSI 8.3.1.1) shall be generated. \n Stations not supporting variable thresholds shall \n have a value of 0 and a range of (0..0).') fddimibMACFrameErrorRatio = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACFrameErrorRatio.setDescription('This variable is the value of the ratio, \n \n ((delta fddiMACLostCts + delta fddiMACErrorCts) / \n (delta fddiMACFrameCts + delta fddiMACLostCts )) \n * 2**16 ') fddimibMACRMTState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 28), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8,))).clone(namedValues=NamedValues(("rm0", 1), ("rm1", 2), ("rm2", 3), ("rm3", 4), ("rm4", 5), ("rm5", 6), ("rm6", 7), ("rm7", 8),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACRMTState.setDescription('Indicates the current state of the RMT State \n Machine (refer to ANSI 10.3.2).') fddimibMACDaFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 29), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACDaFlag.setDescription('The RMT flag Duplicate Address Flag, DA_Flag \n (refer to ANSI 10.2.1.2).') fddimibMACUnaDaFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACUnaDaFlag.setDescription('A flag, UNDA_Flag (refer to ANSI 8.2.2.1), set \n when the upstream neighbor reports a duplicate \n address condition. Cleared when the condition \n clears.') fddimibMACFrameErrorFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACFrameErrorFlag.setDescription('Indicates the MAC Frame Error Condition is \n present when set. Cleared when the condition \n clears and on station initialization.') fddimibMACMAUnitdataAvailable = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACMAUnitdataAvailable.setDescription('This variable shall take on the value of the \n MAC_Avail flag defined in RMT.') fddimibMACHardwarePresent = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACHardwarePresent.setDescription('This variable indicates the presence of \n underlying hardware support for this MAC object. \n If the value of this object is false(2), the \n reporting of the objects in this entry may be \n handled in an implementation-specific manner.') fddimibMACMAUnitdataEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibMACMAUnitdataEnable.setDescription('This variable determines the value of the \n MA_UNITDATA_Enable flag in RMT. The default and \n initial value of this flag is true(1).') fddimibMACCountersTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1), ) if mibBuilder.loadTexts: fddimibMACCountersTable.setDescription('A list of MAC Counters entries. The number of \n entries shall not exceed the value of \n fddimibMACNumber.') fddimibMACCountersEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibMACSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibMACIndex")) if mibBuilder.loadTexts: fddimibMACCountersEntry.setDescription('A MAC Counters entry containing information \n common to a given MAC.') fddimibMACTokenCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTokenCts.setDescription('A count that should as closely as possible match \n the number of times the station has received a \n token (total of non-restricted and restricted) on \n this MAC (see ANSI MAC 7.4). This count is \n valuable for determination of network load.') fddimibMACTvxExpiredCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTvxExpiredCts.setDescription('A count that should as closely as possible match \n the number of times that TVX has expired.') fddimibMACNotCopiedCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACNotCopiedCts.setDescription('A count that should as closely as possible match \n the number of frames that were addressed to this \n MAC but were not copied into its receive buffers \n (see ANSI MAC 7.5). For example, this might occur \n due to local buffer congestion. Because of \n implementation considerations, this count may not \n match the actual number of frames not copied. It \n is not a requirement that this count be exact. \n Note that this count does not include MAC frames.') fddimibMACLateCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACLateCts.setDescription('A count that should as closely as possible match \n the number of TRT expirations since this MAC was \n reset or a token was received (refer to ANSI MAC \n 7.4.5).') fddimibMACRingOpCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACRingOpCts.setDescription("The count of the number of times the ring has \n entered the 'Ring_Operational' state from the \n 'Ring Not Operational' state. This count is \n updated when a SM_MA_STATUS.Indication of a change \n in the Ring_Operational status occurs (refer to \n ANSI 6.1.4). Because of implementation \n considerations, this count may be less than the \n actual RingOp_Ct. It is not a requirement that \n this count be exact.") fddimibMACNotCopiedRatio = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACNotCopiedRatio.setDescription('This variable is the value of the ratio: \n \n (delta fddiMACNotCopiedCts / \n (delta fddiMACCopiedCts + \n delta fddiMACNotCopiedCts )) * 2**16 ') fddimibMACNotCopiedFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACNotCopiedFlag.setDescription('Indicates that the Not Copied condition is \n present when read as true(1). Set to false(2) \n when the condition clears and on station \n initialization.') fddimibMACNotCopiedThreshold = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibMACNotCopiedThreshold.setDescription('A threshold for determining when a MAC condition \n report shall be generated. Stations not \n supporting variable thresholds shall have a value \n of 0 and a range of (0..0).') fddimibPATHNumber = MibScalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHNumber.setDescription("The total number of PATHs possible (across all \n SMTs) on this network management application \n entity. The value for this variable must remain \n constant at least from one re-initialization of \n the entity's network management system to the next \n re-initialization.") fddimibPATHTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2), ) if mibBuilder.loadTexts: fddimibPATHTable.setDescription('A list of PATH entries. The number of entries \n shall not exceed the value of fddimibPATHNumber.') fddimibPATHEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibPATHSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibPATHIndex")) if mibBuilder.loadTexts: fddimibPATHEntry.setDescription('A PATH entry containing information common to a \n given PATH.') fddimibPATHSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHSMTIndex.setDescription('The value of the SMT index associated with this \n PATH.') fddimibPATHIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHIndex.setDescription('Index variable for uniquely identifying the \n primary, secondary and local PATH object \n instances. Local PATH object instances are \n represented with integer values 3 to 255.') fddimibPATHTVXLowerBound = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 3), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPATHTVXLowerBound.setDescription('Specifies the minimum time value of \n fddiMACTvxValue that shall be used by any MAC that \n is configured in this path. The operational value \n of fddiMACTvxValue is managed by settting this \n variable. This variable has the time value range \n of: \n \n 0 < fddimibPATHTVXLowerBound < fddimibPATHMaxTReq \n Changes to this variable shall either satisfy the \n time value relationship: \n \n fddimibPATHTVXLowerBound <= \n fddimibMACTVXCapability \n \n of each of the MACs currently on the path, or be \n considered out of range. The initial value of \n fddimibPATHTVXLowerBound shall be 2500 nsec (2.5 \n ms).') fddimibPATHTMaxLowerBound = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 4), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPATHTMaxLowerBound.setDescription('Specifies the minimum time value of fddiMACTMax \n that shall be used by any MAC that is configured \n in this path. The operational value of \n fddiMACTMax is managed by setting this variable. \n This variable has the time value range of: \n \n fddimibPATHMaxTReq <= fddimibPATHTMaxLowerBound \n \n and an absolute time value range of: \n \n 10000nsec (10 msec) <= fddimibPATHTMaxLowerBound \n \n Changes to this variable shall either satisfy the \n time value relationship: \n \n fddimibPATHTMaxLowerBound < \n fddimibMACTMaxCapability \n \n of each of the MACs currently on the path, or be \n considered out of range. The initial value of \n fddimibPATHTMaxLowerBound shall be 165000 nsec \n (165 msec).') fddimibPATHMaxTReq = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 5), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPATHMaxTReq.setDescription('Specifies the maximum time value of fddiMACT-Req \n that shall be used by any MAC that is configured \n in this path. The operational value of fddiMACT- \n Req is managed by setting this variable. This \n variable has the time value range of: \n \n fddimibPATHTVXLowerBound < fddimibPATHMaxTReq <= \n fddimibPATHTMaxLowerBound. \n \n The default value of fddimibPATHMaxTReq is 165000 \n nsec (165 msec).') fddimibPATHConfigTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3), ) if mibBuilder.loadTexts: fddimibPATHConfigTable.setDescription('A table of Path configuration entries. This \n table lists all the resources that may be in this \n Path.') fddimibPATHConfigEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibPATHConfigSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibPATHConfigPATHIndex"), (0, "FDDI-SMT73-MIB", "fddimibPATHConfigTokenOrder")) if mibBuilder.loadTexts: fddimibPATHConfigEntry.setDescription('A collection of objects containing information \n for a given PATH Configuration entry.') fddimibPATHConfigSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigSMTIndex.setDescription('The value of the SMT index associated with this \n configuration entry.') fddimibPATHConfigPATHIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigPATHIndex.setDescription('The value of the PATH resource index associated \n with this configuration entry.') fddimibPATHConfigTokenOrder = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigTokenOrder.setDescription('An object associated with Token order for this \n entry. Thus if the token passes resources a, b, c \n and d, in that order, then the value of this \n object for these resources would be 1, 2, 3 and 4 \n respectively.') fddimibPATHConfigResourceType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 4,))).clone(namedValues=NamedValues(("mac", 2), ("port", 4),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigResourceType.setDescription('The type of resource associated with this \n configuration entry.') fddimibPATHConfigResourceIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigResourceIndex.setDescription('The value of the SMT resource index used to refer \n to the instance of this MAC or Port resource.') fddimibPATHConfigCurrentPath = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6,))).clone(namedValues=NamedValues(("isolated", 1), ("local", 2), ("secondary", 3), ("primary", 4), ("concatenated", 5), ("thru", 6),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigCurrentPath.setDescription('The current insertion status for this resource on \n this Path.') fddimibPORTNumber = MibScalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTNumber.setDescription("The total number of PORT implementations (across \n all SMTs) on this network management application \n entity. The value for this variable must remain \n constant at least from one re-initialization of \n the entity's network management system to the next \n re-initialization.") fddimibPORTTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2), ) if mibBuilder.loadTexts: fddimibPORTTable.setDescription('A list of PORT entries. The number of entries \n shall not exceed the value of fddimibPORTNumber.') fddimibPORTEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibPORTSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibPORTIndex")) if mibBuilder.loadTexts: fddimibPORTEntry.setDescription('A PORT entry containing information common to a \n given PORT.') fddimibPORTSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTSMTIndex.setDescription('The value of the SMT index associated with this \n PORT.') fddimibPORTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTIndex.setDescription("A unique value for each PORT within a given SMT, \n which is the same as the corresponding resource \n index in SMT. The value for each PORT must remain \n constant at least from one re-initialization of \n the entity's network management system to the next \n re-initialization.") fddimibPORTMyType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5,))).clone(namedValues=NamedValues(("a", 1), ("b", 2), ("s", 3), ("m", 4), ("none", 5),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTMyType.setDescription("The value of the PORT's PC_Type (refer to ANSI \n 9.4.1, and 9.6.3.2).") fddimibPORTNeighborType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5,))).clone(namedValues=NamedValues(("a", 1), ("b", 2), ("s", 3), ("m", 4), ("none", 5),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTNeighborType.setDescription('The type of the remote PORT as determined in PCM. \n This variable has an initial value of none, and is \n only modified in PC_RCode(3)_Actions (refer to \n ANSI SMT 9.6.3.2).') fddimibPORTConnectionPolicies = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,3))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTConnectionPolicies.setDescription("A value representing the PORT's connection \n policies desired in the node. The value of pc- \n mac-lct is a term used in the PC_MAC_LCT Flag (see \n 9.4.3.2). The value of pc-mac-loop is a term used \n in the PC_MAC_Loop Flag. \n \n The value is a sum. This value initially takes \n the value zero, then for each PORT policy, 2 \n raised to a power is added to the sum. The powers \n are according to the following table: \n \n Policy Power \n pc-mac-lct 0 \n pc-mac-loop 1 ") fddimibPORTMACIndicated = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("tVal9FalseRVal9False", 1), ("tVal9FalseRVal9True", 2), ("tVal9TrueRVal9False", 3), ("tVal9TrueRVal9True", 4),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTMACIndicated.setDescription('The indications (T_Val(9), R_Val(9)) in PC- \n Signalling, of the intent to place a MAC in the \n output token path to a PORT (refer to ANSI SMT \n 9.6.3.2.).') fddimibPORTCurrentPath = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6,))).clone(namedValues=NamedValues(("ce0", 1), ("ce1", 2), ("ce2", 3), ("ce3", 4), ("ce4", 5), ("ce5", 6),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTCurrentPath.setDescription('Indicates the Path(s) into which this PORT is \n currently inserted.') fddimibPORTRequestedPaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(3,3)).setFixedLength(3)).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTRequestedPaths.setDescription("This variable is a list of permitted Paths where \n each list element defines the Port's permitted \n Paths. The first octet corresponds to 'none', the \n second octet to 'tree', and the third octet to \n 'peer'.") fddimibPORTMACPlacement = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 9), FddiResourceId()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTMACPlacement.setDescription('Indicates the MAC, if any, whose transmit path \n exits the station via this PORT. The value shall \n be zero if there is no MAC associated with the \n PORT. Otherwise, the MACIndex of the MAC will be \n the value of the variable.') fddimibPORTAvailablePaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,7))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTAvailablePaths.setDescription('Indicates the Paths which are available to this \n Port. In the absence of faults, the A and B Ports \n will always have both the Primary and Secondary \n Paths available. \n \n The value is a sum. This value initially takes \n the value zero, then for each type of PATH that \n this port has available, 2 raised to a power is \n added to the sum. The powers are according to the \n following table: \n \n Path Power \n Primary 0 \n Secondary 1 \n Local 2 ') fddimibPORTPMDClass = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8,))).clone(namedValues=NamedValues(("multimode", 1), ("single-mode1", 2), ("single-mode2", 3), ("sonet", 4), ("low-cost-fiber", 5), ("twisted-pair", 6), ("unknown", 7), ("unspecified", 8),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTPMDClass.setDescription('This variable indicates the type of PMD entity \n associated with this port.') fddimibPORTConnectionCapabilities = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0,3))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTConnectionCapabilities.setDescription('A value that indicates the connection \n capabilities of the port. The pc-mac-lct bit \n indicates that the station has the capability of \n setting the PC_MAC_LCT Flag. The pc-mac-loop bit \n indicates that the station has the capability of \n setting the PC_MAC_Loop Flag (refer to ANSI \n 9.4.3.2). \n \n The value is a sum. This value initially takes \n the value zero, then for each capability that this \n port has, 2 raised to a power is added to the sum. \n The powers are according to the following table: \n \n capability Power \n pc-mac-lct 0 \n pc-mac-loop 1 ') fddimibPORTBSFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTBSFlag.setDescription('This variable assumes the value of the BS_Flag \n (refer to ANSI SMT 9.4.3.3).') fddimibPORTLCTFailCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLCTFailCts.setDescription('The count of the consecutive times the link \n confidence test (LCT) has failed during connection \n management (refer to ANSI 9.4.1).') fddimibPORTLerEstimate = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4,15))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLerEstimate.setDescription('A long term average link error rate. It ranges \n from 10**-4 to 10**-15 and is reported as the \n absolute value of the base 10 logarithm (refer to \n ANSI SMT 9.4.7.5.).') fddimibPORTLemRejectCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLemRejectCts.setDescription('A link error monitoring count of the times that a \n link has been rejected.') fddimibPORTLemCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLemCts.setDescription('The aggregate link error monitor error count, set \n to zero only on station initialization.') fddimibPORTLerCutoff = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4,15))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTLerCutoff.setDescription('The link error rate estimate at which a link \n connection will be broken. It ranges from 10**-4 \n to 10**-15 and is reported as the absolute value \n of the base 10 logarithm (default of 7).') fddimibPORTLerAlarm = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4,15))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTLerAlarm.setDescription('The link error rate estimate at which a link \n connection will generate an alarm. It ranges from \n 10**-4 to 10**-15 and is reported as the absolute \n value of the base 10 logarithm of the estimate \n (default of 8).') fddimibPORTConnectState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("disabled", 1), ("connecting", 2), ("standby", 3), ("active", 4),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTConnectState.setDescription('An indication of the connect state of this PORT \n and is equal to the value of Connect_State (refer \n to ANSI 9.4.1)') fddimibPORTPCMState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10,))).clone(namedValues=NamedValues(("pc0", 1), ("pc1", 2), ("pc2", 3), ("pc3", 4), ("pc4", 5), ("pc5", 6), ("pc6", 7), ("pc7", 8), ("pc8", 9), ("pc9", 10),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTPCMState.setDescription("The state of this Port's PCM state machine refer \n to ANSI SMT 9.6.2).") fddimibPORTPCWithhold = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("none", 1), ("m-m", 2), ("otherincompatible", 3), ("pathnotavailable", 4),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTPCWithhold.setDescription('The value of PC_Withhold (refer to ANSI SMT \n 9.4.1).') fddimibPORTLerFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLerFlag.setDescription('The condition becomes active when the value of \n fddiPORTLerEstimate is less than or equal to \n fddiPORTLerAlarm. This will be reported with the \n Status Report Frames (SRF) (refer to ANSI SMT \n 7.2.7 and 8.3).') fddimibPORTHardwarePresent = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 24), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2,))).clone(namedValues=NamedValues(("true", 1), ("false", 2),))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTHardwarePresent.setDescription('This variable indicates the presence of \n underlying hardware support for this Port object. \n If the value of this object is false(2), the \n reporting of the objects in this entry may be \n handled in an implementation-specific manner.') fddimibPORTAction = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6,))).clone(namedValues=NamedValues(("other", 1), ("maintPORT", 2), ("enablePORT", 3), ("disablePORT", 4), ("startPORT", 5), ("stopPORT", 6),))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTAction.setDescription("Causes a Control signal to be generated with a \n control_action of 'Signal' and the 'variable' \n parameter set with the appropriate value (i.e., \n PC_Maint, PC_Enable, PC_Disable, PC_Start, or \n PC_Stop) (refer to ANSI 9.4.2).") mibBuilder.exportSymbols("FDDI-SMT73-MIB", fddimibPATHConfigSMTIndex=fddimibPATHConfigSMTIndex, fddimibMACAvailablePaths=fddimibMACAvailablePaths, fddimibSMTTransitionTimeStamp=fddimibSMTTransitionTimeStamp, fddimibPORTHardwarePresent=fddimibPORTHardwarePresent, fddimibMACRequestedPaths=fddimibMACRequestedPaths, fddimibPATHConfigTable=fddimibPATHConfigTable, fddimibMACMAUnitdataAvailable=fddimibMACMAUnitdataAvailable, fddimibMACFrameStatusFunctions=fddimibMACFrameStatusFunctions, fddimibSMTConfigCapabilities=fddimibSMTConfigCapabilities, fddimibMACNumber=fddimibMACNumber, fddimibMACSMTIndex=fddimibMACSMTIndex, fddimibSMTECMState=fddimibSMTECMState, FddiResourceId=FddiResourceId, fddimibPATHSMTIndex=fddimibPATHSMTIndex, fddimibMACTMaxCapability=fddimibMACTMaxCapability, fddimibMAC=fddimibMAC, fddimibPORTLemRejectCts=fddimibPORTLemRejectCts, fddimibMACSMTAddress=fddimibMACSMTAddress, fddimibMACRMTState=fddimibMACRMTState, fddimibPORTEntry=fddimibPORTEntry, fddimibSMTTNotify=fddimibSMTTNotify, fddimibPORTLerAlarm=fddimibPORTLerAlarm, FddiTimeNano=FddiTimeNano, fddimibMACFrameErrorRatio=fddimibMACFrameErrorRatio, fddimibPORTSMTIndex=fddimibPORTSMTIndex, fddimibSMTStationAction=fddimibSMTStationAction, fddimibMACCopiedCts=fddimibMACCopiedCts, fddimibSMTNumber=fddimibSMTNumber, fddimib=fddimib, FddiMACLongAddressType=FddiMACLongAddressType, fddimibSMTLoVersionId=fddimibSMTLoVersionId, fddimibMACTransmitCts=fddimibMACTransmitCts, fddimibMACHardwarePresent=fddimibMACHardwarePresent, fddimibSMTBypassPresent=fddimibSMTBypassPresent, fddimibPORTIndex=fddimibPORTIndex, fddimibSMTTable=fddimibSMTTable, fddimibMACDownstreamNbr=fddimibMACDownstreamNbr, fddimibSMTOpVersionId=fddimibSMTOpVersionId, fddimibPORTConnectionCapabilities=fddimibPORTConnectionCapabilities, fddimibPATHConfigResourceIndex=fddimibPATHConfigResourceIndex, fddimibPORTCurrentPath=fddimibPORTCurrentPath, fddimibMACIndex=fddimibMACIndex, fddimibMACOldDownstreamNbr=fddimibMACOldDownstreamNbr, fddimibSMTTraceMaxExpiration=fddimibSMTTraceMaxExpiration, fddimibPORTPCWithhold=fddimibPORTPCWithhold, fddimibPORTTable=fddimibPORTTable, fddimibMACNotCopiedFlag=fddimibMACNotCopiedFlag, FddiSMTStationIdType=FddiSMTStationIdType, fddimibMACTvxValue=fddimibMACTvxValue, fddimibSMTRemoteDisconnectFlag=fddimibSMTRemoteDisconnectFlag, fddimibMACTokenCts=fddimibMACTokenCts, fddimibMACCountersTable=fddimibMACCountersTable, fddimibPORTNumber=fddimibPORTNumber, fddimibMACNotCopiedCts=fddimibMACNotCopiedCts, fddimibPORTConnectState=fddimibPORTConnectState, fddimibPORTAction=fddimibPORTAction, fddimibSMTStationStatus=fddimibSMTStationStatus, fddimibPORTNeighborType=fddimibPORTNeighborType, fddimibPORTLerEstimate=fddimibPORTLerEstimate, fddimibPORTPMDClass=fddimibPORTPMDClass, fddimibMACTVXCapability=fddimibMACTVXCapability, FddiTimeMilli=FddiTimeMilli, fddimibPATHTVXLowerBound=fddimibPATHTVXLowerBound, fddimibSMTHiVersionId=fddimibSMTHiVersionId, fddimibMACTReq=fddimibMACTReq, fddimibPATHNumber=fddimibPATHNumber, fddimibSMTUserData=fddimibSMTUserData, fddimibMACFrameCts=fddimibMACFrameCts, fddimibPATHConfigTokenOrder=fddimibPATHConfigTokenOrder, transmission=transmission, fddimibMACLostCts=fddimibMACLostCts, fddimibMACFrameErrorThreshold=fddimibMACFrameErrorThreshold, fddimibSMTConnectionPolicy=fddimibSMTConnectionPolicy, fddimibMACErrorCts=fddimibMACErrorCts, fddimibPORT=fddimibPORT, fddimibPORTLCTFailCts=fddimibPORTLCTFailCts, fddi=fddi, fddimibPORTMACPlacement=fddimibPORTMACPlacement, fddimibSMTEntry=fddimibSMTEntry, fddimibPORTLerFlag=fddimibPORTLerFlag, fddimibPORTLemCts=fddimibPORTLemCts, fddimibMACIfIndex=fddimibMACIfIndex, fddimibSMTCFState=fddimibSMTCFState, fddimibPATHConfigEntry=fddimibPATHConfigEntry, fddimibPORTAvailablePaths=fddimibPORTAvailablePaths, fddimibPATHTMaxLowerBound=fddimibPATHTMaxLowerBound, fddimibPORTMyType=fddimibPORTMyType, fddimibMACTvxExpiredCts=fddimibMACTvxExpiredCts, fddimibPATHConfigCurrentPath=fddimibPATHConfigCurrentPath, fddimibSMTIndex=fddimibSMTIndex, fddimibPATHConfigResourceType=fddimibPATHConfigResourceType, fddimibSMTPeerWrapFlag=fddimibSMTPeerWrapFlag, fddimibSMTStationId=fddimibSMTStationId, fddimibPATH=fddimibPATH, fddimibMACDownstreamPORTType=fddimibMACDownstreamPORTType, fddimibMACOldUpstreamNbr=fddimibMACOldUpstreamNbr, fddimibPORTRequestedPaths=fddimibPORTRequestedPaths, fddimibSMT=fddimibSMT, fddimibMACFrameErrorFlag=fddimibMACFrameErrorFlag, fddimibPATHConfigPATHIndex=fddimibPATHConfigPATHIndex, fddimibPATHMaxTReq=fddimibPATHMaxTReq, fddimibMACUnaDaFlag=fddimibMACUnaDaFlag, fddimibPORTBSFlag=fddimibPORTBSFlag, fddimibPORTConnectionPolicies=fddimibPORTConnectionPolicies, fddimibMACCurrentPath=fddimibMACCurrentPath, fddimibMACRingOpCts=fddimibMACRingOpCts, fddimibSMTMACCts=fddimibSMTMACCts, fddimibSMTTimeStamp=fddimibSMTTimeStamp, fddimibMACNotCopiedRatio=fddimibMACNotCopiedRatio, fddimibMACDupAddressTest=fddimibMACDupAddressTest, fddimibPORTLerCutoff=fddimibPORTLerCutoff, fddimibSMTConfigPolicy=fddimibSMTConfigPolicy, fddimibMACTMax=fddimibMACTMax, fddimibPATHIndex=fddimibPATHIndex, fddimibMACLateCts=fddimibMACLateCts, fddimibSMTNonMasterCts=fddimibSMTNonMasterCts, fddimibMACCountersEntry=fddimibMACCountersEntry, fddimibMACUpstreamNbr=fddimibMACUpstreamNbr, fddimibPATHEntry=fddimibPATHEntry, fddimibPATHTable=fddimibPATHTable, fddimibMACMAUnitdataEnable=fddimibMACMAUnitdataEnable, fddimibPORTPCMState=fddimibPORTPCMState, fddimibMACTNeg=fddimibMACTNeg, fddimibSMTMIBVersionId=fddimibSMTMIBVersionId, fddimibSMTMasterCts=fddimibSMTMasterCts, fddimibSMTStatRptPolicy=fddimibSMTStatRptPolicy, fddimibPORTMACIndicated=fddimibPORTMACIndicated, fddimibMACNotCopiedThreshold=fddimibMACNotCopiedThreshold, fddimibMACCounters=fddimibMACCounters, fddimibSMTAvailablePaths=fddimibSMTAvailablePaths, fddimibMACEntry=fddimibMACEntry, fddimibMACDaFlag=fddimibMACDaFlag, fddimibMACTable=fddimibMACTable)
class BeforeAutorizationHelper: def __init__(self,app): self.app = app # выбор предмета по порядку, возвращает кол-во уроков/тестов def Test_list_of_all_items(self, TEXT): driver = self.app.driver Items = driver.find_elements_by_class_name('subject-card') # кнопка списка предметов lenght_Items = len(Items) number_all_tests = 0 # общее кол-во тестов по всем предметам number_all_tests_access = 0 # общее кол-во тестов по всем предметам, которые имеют доступ for i in range(0, lenght_Items): Items[i].click() # нажимаем на предмет по порядку Lenght_Objects = len(driver.find_elements_by_class_name( 'subject-number')) # длина списка уроков и тестов, нет атрибута текст if Lenght_Objects != 0: number_tests = self.Test_list_of_tests_and_lessons(TEXT) # функция выбор теста по порядку number_all_tests = number_all_tests + number_tests[0] number_all_tests_access = number_all_tests_access + number_tests[1] Button_courses = driver.find_element_by_partial_link_text('курсы') # кнопка "<- курсы" Button_courses.click() # после нажатия возвращает на список предметов Items = driver.find_elements_by_class_name('subject-card') # кнопка списка предметов lenght_Items = len(Items) return number_all_tests, number_all_tests_access # выбор предмета по порядку для ТТ, возвращает кол-во ТТ def Test_list_of_all_items_for_TT (self, TEXT): driver = self.app.driver Items = driver.find_elements_by_class_name('subject-card') # кнопка списка предметов lenght_Items = len(Items) number_all_tests = 0 # общее кол-во тестов по всем предметам number_all_tests_access = 0 # общее кол-во тестов по всем предметам, которые имеют доступ for i in range(0, lenght_Items): Items[i].click() # нажимаем на предмет по порядку Buttons = driver.find_elements_by_class_name( 'subject-number') # список уроков и тестов, нет атрибута текст Lenght_Objects = len(Buttons) if Lenght_Objects != 0: number_tests = self.Test_list_of_TT(TEXT) # функция выбор теста по порядку number_all_tests = number_all_tests + number_tests[0] number_all_tests_access = number_all_tests_access + number_tests[1] Button_courses = driver.find_element_by_partial_link_text('курсы') # кнопка "<- курсы" Button_courses.click() # после нажатия возвращает на список предметов driver.implicitly_wait(1) Items = driver.find_elements_by_class_name('subject-card') # кнопка списка предметов return number_all_tests, number_all_tests_access # доступ к уроку/тесту, возвращает кол-во уроков/тестов в предмете def Test_list_of_tests_and_lessons(self,TEXT): driver = self.app.driver Text_sub = driver.find_element_by_tag_name('h1').text # название предмета на списке тестов/уроков Lenght_buttons_objects = len(driver.find_elements_by_class_name('info')) k = 0 # Кол-во всех разработанных уроков/тестов на странице n = 0 # Кол-во всех доступных уроков/тестов на странице for i in range(4, Lenght_buttons_objects): Buttons_objects = driver.find_elements_by_class_name('info') # кнопка список уроков и тестов и еще 4 кпоки, есть атрибут текст Text_buttons_objects = Buttons_objects[i].text Lesson_or_test = Text_buttons_objects.split() if TEXT == Lesson_or_test[0] and TEXT == "ТЕСТ": Buttons_objects[i].click() k = k + 1 message = self.Test_messаge() #функция, которая возварщает текст "Зарегистрируйся и тренируйся без ограничений!" if message == "Зарегистрируйся и тренируйся без ограничений!": n = n + 1 Button_close = driver.find_elements_by_class_name('icon_close')[4] # кнопка "Х" Button_close.click() else: print("Ошибка в доступе к тесту") print("Предмет:", Text_sub) print(Text_buttons_objects) elif TEXT == Lesson_or_test[0] and TEXT == "УРОК": Buttons_objects[i].click() driver.implicitly_wait(1) if len(driver.find_elements_by_class_name('test-button')) != 0 or len(driver.find_element_by_tag_name('iframe').get_attribute("src")) != 0: k = k + 1 if len(driver.find_elements_by_class_name('test-button')) != 0 and len(driver.find_element_by_tag_name('iframe').get_attribute("src")) != 0: n = n + 1 Button_back = driver.find_element_by_class_name('icon_back') # кнопка <- АДУКАР Button_back.click() else: print("Ошибка в доступе к уроку") print("Предмет:", Text_sub) print(Text_buttons_objects) else: pass Lenght_buttons_objects = len(driver.find_elements_by_class_name('info')) return k, n # доступ к ТТ1/ТТ2 def Test_list_of_TT(self, TEXT): driver = self.app.driver Buttons_objects = driver.find_elements_by_class_name( 'info') # кнопка список уроков и тестов и еще 4 кпоки, есть атрибут текст Lenght_buttons_objects = len(Buttons_objects) kTT = 0 # Кол-во всех разработанных тренировочных тестов в уроках nTT = 0 # Кол-во всех доступных тренировочных тестов в уроках for i in range(4, Lenght_buttons_objects): Text_sub = driver.find_element_by_tag_name('h1').text # название предмета на списке тестов/уроков Text_buttons_objects = Buttons_objects[i].text Lesson_or_test = Text_buttons_objects.split() if Lesson_or_test[0] == 'УРОК': Buttons_objects[i].click() driver.implicitly_wait(1) if len(driver.find_elements_by_class_name('test-button')) != 0 and len(driver.find_element_by_tag_name('iframe').get_attribute("src")): Button_TT = driver.find_elements_by_class_name('test-button') # ТТ1/ТТ2 Lenght_buttons_TT = len(Button_TT) for j in range(0, Lenght_buttons_TT): Button_TT[j].click() kTT = kTT + 1 message = self.Test_messаge() # функция, которая возварщает текст "Зарегистрируйся и тренируйся без ограничений!" if message == "Зарегистрируйся и тренируйся без ограничений!": nTT = nTT + 1 driver.back() Buttons_objects = driver.find_elements_by_class_name('info') # кнопка список уроков Buttons_objects[i].click() else: print("Ошибка в доступе") print("Предмет:", Text_sub) print(Text_buttons_objects) print(Button_TT[j].text) Button_TT = driver.find_elements_by_class_name('test-button') Lenght_buttons_TT = len(Button_TT) Button_back = driver.find_element_by_class_name('icon_back') # кнопка <- АДУКАР Button_back.click() Buttons_objects = driver.find_elements_by_class_name('info') # кнопка список уроков/тестов и еще 4 кнопки Lenght_buttons_objects = len(Buttons_objects) return kTT, nTT # возвращение сообщения "Зарегистрируйся и тренируйся без ограничений!" def Test_messаge(self): driver = self.app.driver alert = driver.find_elements_by_tag_name('h2')[-2] alert_text = alert.text return alert_text
#/usr/bin/env python """ globifest/globitest/__init__.py - globifest Library Package Copyright 2018, Daniel Kristensen, Garmin Ltd, or its subsidiaries. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ __author__ = "Daniel Kristensen" __license__ = "BSD" __copyright__ = "Copyright 2018 Daniel Kristensen, Garmin Ltd. or its subsidiaries." __all__ = [ "BoundedStatefulParser", "Builder", "Config", "ConfigParser", "DefinitionParser", "DefTree", "Generators", "Importer", "LineInfo", "LineReader", "Log", "Manifest", "ManifestParser", "Matcher", "ProjectParser", "Project", "Settings", "StatefulParser", "StateMachine", "Util" ]
# Division print(5 / 8) # Addition print(7 + 10)
# import os # import pytest def pytest_runtest_setup(item): pass """ if "1" != os.environ.get("PKG_NSF_FACTORY_INSTALL_IN_ENV"): pytest.skip( "Should be run only from build environement. " "See `PKG_NSF_FACTORY_INSTALL_IN_ENV`.") """
# Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators AUTH_USER_MODEL = 'users.User' AUTHENTICATION_BACKENDS = [ 'pg_rest_api.backends.PGBackend', 'django.contrib.auth.backends.ModelBackend' ] AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ]
def get_fp_addsub(f): return f["addpd"] + f["addsd"] + f["addss"] + f["addps"] + f["subpd"] + f["subsd"] + f["subss"] + f["subps"] def get_fp_muldiv(f): return f["mulpd"] + f["mulsd"] + f["mulss"] + f["mulps"] + f["divpd"] + f["divsd"] + f["divss"] + f["divps"]
#!/usr/bin/python3 ## author: jinchoiseoul@gmail.com def parse_io(inp, out): ''' io means input/output for testcases; It splitlines them and strip the elements @param inp: multi-lined str @param out: multi-lined str @return (inp::[str], out::[str]) ''' inp = [i.strip() for i in inp.splitlines() if i.strip()] out = [o.strip() for o in out.splitlines() if o.strip()] return inp, out def joiner(iterable, sep=' '): ''' @return e.g. [1, 2] -> "1 2" ''' return sep.join(map(str, iterable)) def strips(doc): ''' @return strip each line of doc ''' return '\n'.join(line.strip() for line in doc.splitlines()) def lstrips(doc): ''' @return lstrip each line of doc ''' return '\n'.join(line.lstrip() for line in doc.splitlines()) def rstrips(doc): ''' @return rstrip each line of doc ''' return '\n'.join(line.rstrip() for line in doc.splitlines())
def blue(_str): return f"\033[0;33m{_str}\033[0m" print(f""" Hello 😁 ! Use the terminal to code! 1. Start the dev server by running {blue("$ npm run start")} 2. You can find a video tutorial and explanation on the README.md file. 3. Always read the terminal output, it's your best tool for debugging! """)
N = int(input()) A = [0]*N for i in N: A[i] = int(input())
class BaseMeta(type): def __new__(cls, name, bases, namespace): return super().__new__(cls, name, bases, namespace) class MyMeta(BaseMeta): def __new__(cls, name, bases, namespace): return super().__new__(cls, name, bases, namespace)
f = open("Writetofile.txt", "a") f.write("Lipika\n") f.write("Ugain\n") f.write("Shivam\n") f.write("Sanjeev\n") print("Data written to the file using append mode") f.close()
class Solution: def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ p1 = 0 p2 = 0 cnt = 0 ret = 0 zeros = 0 while p1 <= p2 and p1 < len(nums) and p2 < len(nums): while zeros < 2 and p2 < len(nums): if nums[p2] == 0: zeros += 1 p2 += 1 if p2 >= len(nums): if zeros == 2: cnt = p2 - p1 - 1 else: cnt = p2 - p1 ret = max(cnt, ret) break cnt = p2 - p1 - 1 ret = max(cnt, ret) while zeros == 2: if nums[p1] == 0: zeros -= 1 p1 += 1 return ret # last_zero = -1 # cur = 0 # ret = 0 # for i in range(len(nums)): # if nums[i] == 1: # cur += 1 # else: # ret = max(ret, cur) # cur = i - last_zero # last_zero = i # return max(ret, cur)
T = int(input()) def calc_op(l): cnt = 0 for i in range(len(l)): if l[i] % 2 == 0: cnt += l[i]//2 else: cnt += l[i]//2+1 return cnt for _ in range(T): N = int(input()) l = list(map(int, input().split()))[1:-1] if len(l) == 1: if l[0]%2 == 0: print(calc_op(l)) else: print(-1) else: is_2_over_exists = False for i in l: if i >= 2: is_2_over_exists = True break if is_2_over_exists: print(calc_op(l)) else: print(-1)
''' Represents a single filter on a column. ''' class DrawRequestColumnFilter: ''' Initialize the filter with the column name, filter text, and operation (must be "=", "<=", ">=", "<", ">", or "!="). ''' def __init__(self, column_name, filter_text, operation): self.name = column_name self.text = filter_text self.operation = operation def __repr__(self): return "ColFilter(name=%s, text=%s, op=%s)" % (self.name, self.text, self.operation) __str__ = __repr__
# -*- coding: utf-8 -*- __author__ = 'Jonathan Moore' __email__ = 'firstnamelastnamephd@gmail.com' __version__ = '0.1.0'
# md5 : b27c56d844ab064547d40bf4f0a96eae # sha1 : c314e447018b0d8711347ee26a5795480837b2d3 # sha256 : c045615fe1b44a6409610e4e94e70f1559325eb55ab1f805b0452e852771c0ae ord_names = { 1: b'SQLAllocConnect', 2: b'SQLAllocEnv', 3: b'SQLAllocStmt', 4: b'SQLBindCol', 5: b'SQLCancel', 6: b'SQLColAttributes', 7: b'SQLConnect', 8: b'SQLDescribeCol', 9: b'SQLDisconnect', 10: b'SQLError', 11: b'SQLExecDirect', 12: b'SQLExecute', 13: b'SQLFetch', 14: b'SQLFreeConnect', 15: b'SQLFreeEnv', 16: b'SQLFreeStmt', 17: b'SQLGetCursorName', 18: b'SQLNumResultCols', 19: b'SQLPrepare', 20: b'SQLRowCount', 21: b'SQLSetCursorName', 22: b'SQLSetParam', 23: b'SQLTransact', 24: b'SQLAllocHandle', 25: b'SQLBindParam', 26: b'SQLCloseCursor', 27: b'SQLColAttribute', 28: b'SQLCopyDesc', 29: b'SQLEndTran', 30: b'SQLFetchScroll', 31: b'SQLFreeHandle', 32: b'SQLGetConnectAttr', 33: b'SQLGetDescField', 34: b'SQLGetDescRec', 35: b'SQLGetDiagField', 36: b'SQLGetDiagRec', 37: b'SQLGetEnvAttr', 38: b'SQLGetStmtAttr', 39: b'SQLSetConnectAttr', 40: b'SQLColumns', 41: b'SQLDriverConnect', 42: b'SQLGetConnectOption', 43: b'SQLGetData', 44: b'SQLGetFunctions', 45: b'SQLGetInfo', 46: b'SQLGetStmtOption', 47: b'SQLGetTypeInfo', 48: b'SQLParamData', 49: b'SQLPutData', 50: b'SQLSetConnectOption', 51: b'SQLSetStmtOption', 52: b'SQLSpecialColumns', 53: b'SQLStatistics', 54: b'SQLTables', 55: b'SQLBrowseConnect', 56: b'SQLColumnPrivileges', 57: b'SQLDataSources', 58: b'SQLDescribeParam', 59: b'SQLExtendedFetch', 60: b'SQLForeignKeys', 61: b'SQLMoreResults', 62: b'SQLNativeSql', 63: b'SQLNumParams', 64: b'SQLParamOptions', 65: b'SQLPrimaryKeys', 66: b'SQLProcedureColumns', 67: b'SQLProcedures', 68: b'SQLSetPos', 69: b'SQLSetScrollOptions', 70: b'SQLTablePrivileges', 71: b'SQLDrivers', 72: b'SQLBindParameter', 73: b'SQLSetDescField', 74: b'SQLSetDescRec', 75: b'SQLSetEnvAttr', 76: b'SQLSetStmtAttr', 77: b'SQLAllocHandleStd', 78: b'SQLBulkOperations', 79: b'CloseODBCPerfData', 80: b'CollectODBCPerfData', 81: b'CursorLibLockDbc', 82: b'CursorLibLockDesc', 83: b'CursorLibLockStmt', 84: b'ODBCGetTryWaitValue', 85: b'CursorLibTransact', 86: b'ODBCSetTryWaitValue', 87: b'DllBidEntryPoint', 88: b'GetODBCSharedData', 89: b'LockHandle', 90: b'ODBCInternalConnectW', 91: b'OpenODBCPerfData', 92: b'PostComponentError', 93: b'PostODBCComponentError', 94: b'PostODBCError', 95: b'SQLCancelHandle', 96: b'SQLCompleteAsync', 97: b'SearchStatusCode', 98: b'VFreeErrors', 99: b'VRetrieveDriverErrorsRowCol', 100: b'ValidateErrorQueue', 101: b'g_hHeapMalloc', 106: b'SQLColAttributesW', 107: b'SQLConnectW', 108: b'SQLDescribeColW', 110: b'SQLErrorW', 111: b'SQLExecDirectW', 117: b'SQLGetCursorNameW', 119: b'SQLPrepareW', 121: b'SQLSetCursorNameW', 127: b'SQLColAttributeW', 132: b'SQLGetConnectAttrW', 133: b'SQLGetDescFieldW', 134: b'SQLGetDescRecW', 135: b'SQLGetDiagFieldW', 136: b'SQLGetDiagRecW', 138: b'SQLGetStmtAttrW', 139: b'SQLSetConnectAttrW', 140: b'SQLColumnsW', 141: b'SQLDriverConnectW', 142: b'SQLGetConnectOptionW', 145: b'SQLGetInfoW', 147: b'SQLGetTypeInfoW', 150: b'SQLSetConnectOptionW', 152: b'SQLSpecialColumnsW', 153: b'SQLStatisticsW', 154: b'SQLTablesW', 155: b'SQLBrowseConnectW', 156: b'SQLColumnPrivilegesW', 157: b'SQLDataSourcesW', 160: b'SQLForeignKeysW', 162: b'SQLNativeSqlW', 165: b'SQLPrimaryKeysW', 166: b'SQLProcedureColumnsW', 167: b'SQLProceduresW', 170: b'SQLTablePrivilegesW', 171: b'SQLDriversW', 173: b'SQLSetDescFieldW', 176: b'SQLSetStmtAttrW', 206: b'SQLColAttributesA', 207: b'SQLConnectA', 208: b'SQLDescribeColA', 210: b'SQLErrorA', 211: b'SQLExecDirectA', 217: b'SQLGetCursorNameA', 219: b'SQLPrepareA', 221: b'SQLSetCursorNameA', 227: b'SQLColAttributeA', 232: b'SQLGetConnectAttrA', 233: b'SQLGetDescFieldA', 234: b'SQLGetDescRecA', 235: b'SQLGetDiagFieldA', 236: b'SQLGetDiagRecA', 238: b'SQLGetStmtAttrA', 239: b'SQLSetConnectAttrA', 240: b'SQLColumnsA', 241: b'SQLDriverConnectA', 242: b'SQLGetConnectOptionA', 245: b'SQLGetInfoA', 247: b'SQLGetTypeInfoA', 250: b'SQLSetConnectOptionA', 252: b'SQLSpecialColumnsA', 253: b'SQLStatisticsA', 254: b'SQLTablesA', 255: b'SQLBrowseConnectA', 256: b'SQLColumnPrivilegesA', 257: b'SQLDataSourcesA', 260: b'SQLForeignKeysA', 262: b'SQLNativeSqlA', 265: b'SQLPrimaryKeysA', 266: b'SQLProcedureColumnsA', 267: b'SQLProceduresA', 270: b'SQLTablePrivilegesA', 271: b'SQLDriversA', 273: b'SQLSetDescFieldA', 276: b'SQLSetStmtAttrA', 301: b'ODBCQualifyFileDSNW', }
"""Constants for Cloudflare.""" DOMAIN = "cloudflare" # Config CONF_RECORDS = "records" # Defaults DEFAULT_UPDATE_INTERVAL = 60 # in minutes # Services SERVICE_UPDATE_RECORDS = "update_records"
# part 1 def check_numbers(a,b): print (a+b) check_numbers(2,6) # part 2 def check_numbers_list(a,b): i=0 if len(a)==len(b): while i<len(a): check_numbers(a[i],b[i]) i +=1 else: print ("lists ki len barabar nahi hai") check_numbers_list([10,30,40],[40,20,21])
num = int(input()) soma2 = 0 soma3 = 0 soma4 = 0 soma5 = 0 lista = [int(i) for i in input().split()] for i in range(num): if(lista[i] % 2 == 0): soma2 = soma2 + 1 if(lista[i] % 3 == 0): soma3 = soma3 + 1 if(lista[i] % 4 == 0): soma4 = soma4 + 1 if(lista[i] % 5 == 0): soma5 = soma5 + 1 print("{} Multiplo(s) de 2".format(soma2)) print("{} Multiplo(s) de 3".format(soma3)) print("{} Multiplo(s) de 4".format(soma4)) print("{} Multiplo(s) de 5".format(soma5))
def lambda_handler(event, context): name = event.get("name") if not name: name = "person who does not want to give their name" return { "hello": f"hello {name}"}
# print_squares_upto_limit(30) # //For limit = 30, output would be 1 4 9 16 25 # # print_cubes_upto_limit(30) # //For limit = 30, output would be 1 8 27 def print_squares_upto_limit(limit): i = 1 while i * i < limit: print(i*i, end = " ") i = i + 1 def print_cubes_upto_limit(limit): i = 1 while i * i * i < limit: print(i*i*i, end = " ") i = i + 1 print_cubes_upto_limit(80)
#!/usr/bin/env python print("test1 -- > 1") print("test1 -- > 2") print("test1 -- > 3")
MX_ROBOT_MAX_NB_ACCELEROMETERS = 1 MX_DEFAULT_ROBOT_IP = "192.168.0.100" MX_ROBOT_TCP_PORT_CONTROL = 10000 MX_ROBOT_TCP_PORT_FEED = 10001 MX_ROBOT_UDP_PORT_TRACE = 10002 MX_ROBOT_UDP_PORT_RT_CTRL = 10003 MX_CHECKPOINT_ID_MIN = 1 MX_CHECKPOINT_ID_MAX = 8000 MX_ACCELEROMETER_UNIT_PER_G = 16000 MX_GRAVITY_MPS2 = 9.8067 MX_ACCELEROMETER_JOINT_M500 = 5 MX_EXT_TOOL_MPM500_NB_VALVES = 2 MX_EXT_TOOL_VBOX_MAX_VALVES = 6 MX_EIP_MAJOR_VERSION = 2 MX_EIP_MINOR_VERSION = 1 MX_NB_DYNAMIC_PDOS = 4 MX_ROBOT_MODEL_UNKNOWN = 0 MX_ROBOT_MODEL_M500_R1 = 1 MX_ROBOT_MODEL_M500_R2 = 2 MX_ROBOT_MODEL_M500_R3 = 3 MX_ROBOT_MODEL_M1000_R1 = 10 MX_ROBOT_MODEL_SCARA_R1 = 20 MX_EXT_TOOL_NONE = 0 MX_EXT_TOOL_MEGP25_SHORT = 1 MX_EXT_TOOL_MEGP25_LONG = 2 MX_EXT_TOOL_VBOX_2VALVES = 3 MX_EXT_TOOL_TYPE_INVALID = 0xFFFFFFFF MX_EXT_TOOL_COMPLEMENTARY = 0 MX_EXT_TOOL_INDEPENDENT = 1 MX_EXT_TOOL_POSITION = 2 MX_EXT_TOOL_MODE_INVALID = 0xFFFFFFFF MX_VALVE_STATE_STAY = -1 MX_VALVE_STATE_CLOSE = 0 MX_VALVE_STATE_OPEN = 1 MX_EVENT_SEVERITY_SILENT = 0 MX_EVENT_SEVERITY_WARNING = 1 MX_EVENT_SEVERITY_PAUSE_MOTION = 2 MX_EVENT_SEVERITY_CLEAR_MOTION = 3 MX_EVENT_SEVERITY_ERROR = 4 MX_EVENT_SEVERITY_INVALID = 0xFFFFFFFF MX_TORQUE_LIMITS_DETECT_ALL = 0 MX_TORQUE_LIMITS_DETECT_SKIP_ACCEL = 1 MX_TORQUE_LIMITS_INVALID = 0xFFFFFFFF MX_MOTION_CMD_TYPE_NO_MOVE = 0 MX_MOTION_CMD_TYPE_MOVEJOINTS = 1 MX_MOTION_CMD_TYPE_MOVEPOSE = 2 MX_MOTION_CMD_TYPE_MOVELIN = 3 MX_MOTION_CMD_TYPE_MOVELINRELTRF = 4 MX_MOTION_CMD_TYPE_MOVELINRELWRF = 5 MX_MOTION_CMD_TYPE_DELAY = 6 MX_MOTION_CMD_TYPE_SETBLENDING = 7 MX_MOTION_CMD_TYPE_SETJOINTVEL = 8 MX_MOTION_CMD_TYPE_SETJOINTACC = 9 MX_MOTION_CMD_TYPE_SETCARTANGVEL = 10 MX_MOTION_CMD_TYPE_SETCARTLINVEL = 11 MX_MOTION_CMD_TYPE_SETCARTACC = 12 MX_MOTION_CMD_TYPE_SETTRF = 13 MX_MOTION_CMD_TYPE_SETWRF = 14 MX_MOTION_CMD_TYPE_SETCONF = 15 MX_MOTION_CMD_TYPE_SETAUTOCONF = 16 MX_MOTION_CMD_TYPE_SETCHECKPOINT = 17 MX_MOTION_CMD_TYPE_GRIPPER = 18 MX_MOTION_CMD_TYPE_GRIPPERVEL = 19 MX_MOTION_CMD_TYPE_GRIPPERFORCE = 20 MX_MOTION_CMD_TYPE_MOVEJOINTSVEL = 21 MX_MOTION_CMD_TYPE_MOVELINVELWRF = 22 MX_MOTION_CMD_TYPE_MOVELINVELTRF = 23 MX_MOTION_CMD_TYPE_VELCTRLTIMEOUT = 24 MX_MOTION_CMD_TYPE_SETCONFTURN = 25 MX_MOTION_CMD_TYPE_SETAUTOCONFTURN = 26 MX_MOTION_CMD_TYPE_SETTORQUELIMITS = 27 MX_MOTION_CMD_TYPE_SETTORQUELIMITSCFG = 28 MX_MOTION_CMD_TYPE_MOVEJOINTSREL = 29 MX_MOTION_CMD_TYPE_SETVALVESTATE = 30 MX_MOTION_CMD_TYPE_START_OFFLINE_PROGRAM = 100 MX_MOTION_CMD_TYPE_SETDBG = 1000 MX_EIP_DYNAMIC_AUTO = 0 MX_EIP_DYNAMIC_CFG_FW_VERSION = 1 MX_EIP_DYNAMIC_CFG_PRODUCT_TYPE = 2 MX_EIP_DYNAMIC_CFG_ROBOT_SERIAL = 3 MX_EIP_DYNAMIC_CFG_JOINT_OFFSET = 4 MX_EIP_DYNAMIC_CFG_ROBOT_DH_MODEL_1 = 5 MX_EIP_DYNAMIC_CFG_ROBOT_DH_MODEL_2 = 6 MX_EIP_DYNAMIC_CFG_ROBOT_DH_MODEL_3 = 7 MX_EIP_DYNAMIC_CFG_ROBOT_DH_MODEL_4 = 8 MX_EIP_DYNAMIC_CFG_ROBOT_DH_MODEL_5 = 9 MX_EIP_DYNAMIC_CFG_ROBOT_DH_MODEL_6 = 10 MX_EIP_DYNAMIC_CFG_JOINT_LIMITS_CFG = 11 MX_EIP_DYNAMIC_CFG_MODEL_JOINT_LIMITS_1_2_3 = 12 MX_EIP_DYNAMIC_CFG_MODEL_JOINT_LIMITS_4_5_6 = 13 MX_EIP_DYNAMIC_CFG_JOINT_LIMITS_1_2_3 = 14 MX_EIP_DYNAMIC_CFG_JOINT_LIMITS_4_5_6 = 15 MX_EIP_DYNAMIC_MQ_CONF = 20 MX_EIP_DYNAMIC_MQ_PARAMS = 21 MX_EIP_DYNAMIC_MQ_VEL_ACCEL = 22 MX_EIP_DYNAMIC_MQ_GRIPPER_CFG = 23 MX_EIP_DYNAMIC_MQ_TORQUE_LIMITS_CFG = 24 MX_EIP_DYNAMIC_MQ_TORQUE_LIMITS = 25 MX_EIP_DYNAMIC_RT_TARGET_JOINT_POS = 30 MX_EIP_DYNAMIC_RT_TARGET_CART_POS = 31 MX_EIP_DYNAMIC_RT_TARGET_JOINT_VEL = 32 MX_EIP_DYNAMIC_RT_TARGET_JOINT_TORQ = 33 MX_EIP_DYNAMIC_RT_TARGET_CART_VEL = 34 MX_EIP_DYNAMIC_RT_TARGET_CONF = 35 MX_EIP_DYNAMIC_RT_JOINT_POS = 40 MX_EIP_DYNAMIC_RT_CART_POS = 41 MX_EIP_DYNAMIC_RT_JOINT_VEL = 42 MX_EIP_DYNAMIC_RT_JOINT_TORQ = 43 MX_EIP_DYNAMIC_RT_CART_VEL = 44 MX_EIP_DYNAMIC_RT_CONF = 45 MX_EIP_DYNAMIC_RT_ACCELEROMETER_5 = 46 MX_EIP_DYNAMIC_RT_WRF = 50 MX_EIP_DYNAMIC_RT_TRF = 51 MX_EIP_DYNAMIC_RT_EXTTOOL_STATUS = 52 MX_EIP_DYNAMIC_RT_GRIPPER_VALVE_STATE = 53 MX_EIP_DYNAMIC_FORCE_32_BITS = 0xFFFFFFFF MX_ST_BUFFER_FULL = 1000 MX_ST_UNKNOWN_CMD = 1001 MX_ST_SYNTAX_ERR = 1002 MX_ST_ARG_ERR = 1003 MX_ST_NOT_ACTIVATED = 1005 MX_ST_NOT_HOMED = 1006 MX_ST_JOINT_OVER_LIMIT = 1007 MX_ST_VEL_OVER_LIMIT = 1008 MX_ST_ACCEL_OVER_LIMIT = 1009 MX_ST_BLOCKED_BY_180_DEG_PROT = 1010 MX_ST_ALREADY_ERR = 1011 MX_ST_SINGULARITY_ERR = 1012 MX_ST_ACTIVATION_ERR = 1013 MX_ST_HOMING_ERR = 1014 MX_ST_MASTER_ERR = 1015 MX_ST_OUT_OF_REACH = 1016 MX_ST_COMM_ERR = 1017 MX_ST_EOS_MISSING = 1018 MX_ST_ROBOT_NOT_LEVELED = 1019 MX_ST_BRAKES_ERR = 1020 MX_ST_DEACTIVATION_ERR = 1021 MX_ST_OFFLINE_SAVE_ERR = 1022 MX_ST_IGNORE_CMD_OFFLINE = 1023 MX_ST_MASTERING_NEEDED = 1024 MX_ST_IMPOSSIBLE_RESET_ERR = 1025 MX_ST_MUST_BE_DEACTIVATED = 1026 MX_ST_SIM_MUST_DEACTIVATED = 1027 MX_ST_NETWORK_ERR = 1028 MX_ST_OFFLINE_FULL = 1029 MX_ST_ALREADY_SAVING = 1030 MX_ST_ILLEGAL_WHILE_SAVING = 1031 MX_ST_GRIPPER_FORCE_OVER_LIMIT = 1035 MX_ST_GRIPPER_VEL_OVER_LIMIT = 1036 MX_ST_GRIPPER_RANGE_OVER_LIMIT = 1037 MX_ST_NO_GRIPPER = 1038 MX_ST_GRIPPER_TEMP_OVER_LIMIT = 1039 MX_ST_CMD_FAILED = 1040 MX_ST_NO_VBOX = 1041 MX_ST_ACTIVATED = 2000 MX_ST_ALREADY_ACTIVATED = 2001 MX_ST_HOME_DONE = 2002 MX_ST_HOME_ALREADY = 2003 MX_ST_DEACTIVATED = 2004 MX_ST_ERROR_RESET = 2005 MX_ST_NO_ERROR_RESET = 2006 MX_ST_GET_STATUS_ROBOT = 2007 MX_ST_BRAKES_OFF = 2008 MX_ST_MASTER_DONE = 2009 MX_ST_BRAKES_ON = 2010 MX_ST_GET_WRF = 2013 MX_ST_GET_TRF = 2014 MX_ST_SET_CART_VEL = 2020 MX_ST_SET_CART_ACC = 2021 MX_ST_SET_JOINT_VEL = 2022 MX_ST_SET_JOINT_ACC = 2023 MX_ST_SET_TOOL_DEF = 2024 MX_ST_SET_WRF = 2025 MX_ST_GET_JOINTS = 2026 MX_ST_GET_POSE = 2027 MX_ST_GET_AUTO_CONF = 2028 MX_ST_GET_CONF = 2029 MX_ST_GET_PHYS_CONF = 2030 MX_ST_GET_AUTO_CONF_TURN = 2031 MX_ST_SET_CORNERING = 2032 MX_ST_CLR_CORNERING = 2033 MX_ST_AUTOCONF_ON = 2034 MX_ST_AUTOCONF_OFF = 2035 MX_ST_GET_CONF_TURN = 2036 MX_ST_ACT_POS_FEED = 2038 MX_ST_DEACT_POS_FEED = 2039 MX_ST_ACT_JOINTS_FEED = 2040 MX_ST_DEACT_JOINTS_FEED = 2041 MX_ST_PAUSE_MOTION = 2042 MX_ST_RESUME_MOTION = 2043 MX_ST_CLEAR_MOTION = 2044 MX_ST_SIM_ON = 2045 MX_ST_SIM_OFF = 2046 MX_ST_EXTTOOL_SIM = 2047 MX_ST_EXTTOOL_SIM_OFF = 2048 MX_ST_RECOVERY_MODE_ON = 2049 MX_ST_RECOVERY_MODE_OFF = 2050 MX_ST_RECOVERY_VEL_CAP = 2051 MX_ST_EOM_ON = 2052 MX_ST_EOM_OFF = 2053 MX_ST_EOB_ON = 2054 MX_ST_EOB_OFF = 2055 MX_ST_START_SAVING = 2060 MX_ST_N_CMD_SAVED = 2061 MX_ST_OFFLINE_ALREADY_SAVING = 2062 MX_ST_OFFLINE_START = 2063 MX_ST_OFFLINE_LOOP_ON = 2064 MX_ST_OFFLINE_LOOP_OFF = 2065 MX_ST_START_PROGRAM_ARDY = 2066 MX_ST_SET_CART_DELTAREF_WRF = 2067 MX_ST_SET_CART_DELTAREF_TRF = 2068 MX_ST_ACTIVATION_IN_PROGRESS = 2070 MX_ST_HOMING_IN_PROGRESS = 2071 MX_ST_MASTER_IN_PROGRESS = 2072 MX_ST_GRIP_HOME = 2075 MX_ST_GRIP_ARD_HOME = 2076 MX_ST_SET_GRIP_FORCE = 2077 MX_ST_SET_GRIP_VEL = 2078 MX_ST_GET_STATUS_GRIPPER = 2079 MX_ST_GET_CMD_PENDING_COUNT = 2080 MX_ST_GET_FW_VERSION = 2081 MX_ST_GET_FW_VERSION_FULL = 2082 MX_ST_GET_ROBOT_SERIAL = 2083 MX_ST_GET_PRODUCT_TYPE = 2084 MX_ST_CMD_SUCCESSFUL = 2085 MX_ST_GET_JOINT_LIMITS = 2090 MX_ST_SET_JOINT_LIMITS = 2092 MX_ST_SET_JOINT_LIMITS_CFG = 2093 MX_ST_GET_JOINT_LIMITS_CFG = 2094 MX_ST_GET_ROBOT_NAME = 2095 MX_ST_SET_CTRL_PORT_MONIT = 2096 MX_ST_SYNC_CMD_QUEUE = 2097 MX_ST_JOINT_TORQUE = 2100 MX_ST_JOINT_SPEED = 2101 MX_ST_JOINT_POS = 2102 MX_ST_CART_POSE = 2103 MX_ST_TEMPERATURE = 2104 MX_ST_GET_ROBOT_KIN_MODEL = 2110 MX_ST_GET_ROBOT_DH_MODEL = 2111 MX_ST_GET_JOINT_OFFSET = 2112 MX_ST_GET_MODEL_JOINT_LIMITS = 2113 MX_ST_GET_MOTION_OPTIONS = 2115 MX_ST_GET_MONITORING_INTERVAL = 2116 MX_ST_GET_REAL_TIME_MONITORING = 2117 MX_ST_GET_STATUS_EVENTS = 2118 MX_ST_GET_NETWORK_OPTIONS = 2119 MX_ST_GET_RTC = 2140 MX_ST_GET_BLENDING = 2150 MX_ST_GET_VEL_TIMEOUT = 2151 MX_ST_GET_JOINT_VEL = 2152 MX_ST_GET_JOINT_ACC = 2153 MX_ST_GET_CART_LIN_VEL = 2154 MX_ST_GET_CART_ANG_VEL = 2155 MX_ST_GET_CART_ACC = 2156 MX_ST_GET_CHECKPOINT = 2157 MX_ST_GET_GRIPPER_FORCE = 2158 MX_ST_GET_GRIPPER_VEL = 2159 MX_ST_GET_TORQUE_LIMITS_CFG = 2160 MX_ST_GET_TORQUE_LIMITS = 2161 MX_ST_RT_TARGET_JOINT_POS = 2200 MX_ST_RT_TARGET_CART_POS = 2201 MX_ST_RT_TARGET_JOINT_VEL = 2202 MX_ST_RT_TARGET_JOINT_TORQ = 2203 MX_ST_RT_TARGET_CART_VEL = 2204 MX_ST_RT_TARGET_CONF = 2208 MX_ST_RT_TARGET_CONF_TURN = 2209 MX_ST_RT_JOINT_POS = 2210 MX_ST_RT_CART_POS = 2211 MX_ST_RT_JOINT_VEL = 2212 MX_ST_RT_JOINT_TORQ = 2213 MX_ST_RT_CART_VEL = 2214 MX_ST_RT_CONF = 2218 MX_ST_RT_CONF_TURN = 2219 MX_ST_RT_ACCELEROMETER = 2220 MX_ST_RT_CHECKPOINT = 2227 MX_ST_RT_WRF = 2228 MX_ST_RT_TRF = 2229 MX_ST_RT_CYCLE_END = 2230 MX_ST_RT_EXTTOOL_STATUS = 2300 MX_ST_RT_VALVE_STATE = 2310 MX_ST_RT_GRIPPER_STATE = 2320 MX_ST_RT_GRIPPER_FORCE = 2321 MX_ST_RT_GRIPPER_POS = 2322 MX_ST_CONNECTED = 3000 MX_ST_USER_ALREADY = 3001 MX_ST_UPGRADE_IN_PROGRESS = 3002 MX_ST_CMD_TOO_LONG = 3003 MX_ST_EOM = 3004 MX_ST_ERROR_MOTION = 3005 MX_ST_SEND_JOINT_RT = 3007 MX_ST_COLLISION = 3008 MX_ST_INIT_FAILED = 3009 MX_ST_SEND_POS_RT = 3010 MX_ST_CANNOT_MOVE = 3011 MX_ST_EOB = 3012 MX_ST_END_OFFLINE = 3013 MX_ST_CANT_SAVE_OFFLINE = 3014 MX_ST_OFFLINE_TIMEOUT = 3015 MX_ST_IGNORING_CMD = 3016 MX_ST_NO_OFFLINE_SAVED = 3017 MX_ST_OFFLINE_LOOP = 3018 MX_ST_JOGGING_STOPPED = 3019 MX_ST_ERROR_GRIPPER = 3025 MX_ST_MAINTENANCE_CHECK = 3026 MX_ST_INTERNAL_ERROR = 3027 MX_ST_EXCESSIVE_TRQ = 3028 MX_ST_CHECKPOINT_REACHED = 3030 MX_ST_TEXT_API_ERROR = 3031 MX_ST_PSTOP = 3032 MX_ST_NO_VALID_CFG = 3033 MX_ST_TRACE_LVL_CHANGED = 3034 MX_ST_TCP_DUMP_STARTED = 3035 MX_ST_TCP_DUMP_DONE = 3036 MX_ST_ERROR_VBOX = 3037 MX_ST_INVALID = 0xFFFFFFFF class RobotStatusCodeInfo: def __init__(self, code, name, is_error): """This class contains information bout a robot status codes above (ex: MX_ST_BUFFER_FULL) Parameters ---------- code : integer The integer value (ex: 1001) name : string The code name (ex: "MX_ST_BUFFER_FULL" is_error : bool True if this is an error code """ self.code = code self.name = name self.is_error = is_error robot_status_code_info = { MX_ST_BUFFER_FULL: RobotStatusCodeInfo(MX_ST_BUFFER_FULL, "MX_ST_BUFFER_FULL", is_error=True), MX_ST_UNKNOWN_CMD: RobotStatusCodeInfo(MX_ST_UNKNOWN_CMD, "MX_ST_UNKNOWN_CMD", is_error=True), MX_ST_SYNTAX_ERR: RobotStatusCodeInfo(MX_ST_SYNTAX_ERR, "MX_ST_SYNTAX_ERR", is_error=True), MX_ST_ARG_ERR: RobotStatusCodeInfo(MX_ST_ARG_ERR, "MX_ST_ARG_ERR", is_error=True), MX_ST_NOT_ACTIVATED: RobotStatusCodeInfo(MX_ST_NOT_ACTIVATED, "MX_ST_NOT_ACTIVATED", is_error=True), MX_ST_NOT_HOMED: RobotStatusCodeInfo(MX_ST_NOT_HOMED, "MX_ST_NOT_HOMED", is_error=True), MX_ST_JOINT_OVER_LIMIT: RobotStatusCodeInfo(MX_ST_JOINT_OVER_LIMIT, "MX_ST_JOINT_OVER_LIMIT", is_error=True), MX_ST_BLOCKED_BY_180_DEG_PROT: RobotStatusCodeInfo(MX_ST_BLOCKED_BY_180_DEG_PROT, "MX_ST_BLOCKED_BY_180_DEG_PROT", is_error=True), MX_ST_ALREADY_ERR: RobotStatusCodeInfo(MX_ST_ALREADY_ERR, "MX_ST_ALREADY_ERR", is_error=True), MX_ST_SINGULARITY_ERR: RobotStatusCodeInfo(MX_ST_SINGULARITY_ERR, "MX_ST_SINGULARITY_ERR", is_error=True), MX_ST_ACTIVATION_ERR: RobotStatusCodeInfo(MX_ST_ACTIVATION_ERR, "MX_ST_ACTIVATION_ERR", is_error=True), MX_ST_HOMING_ERR: RobotStatusCodeInfo(MX_ST_HOMING_ERR, "MX_ST_HOMING_ERR", is_error=True), MX_ST_MASTER_ERR: RobotStatusCodeInfo(MX_ST_MASTER_ERR, "MX_ST_MASTER_ERR", is_error=True), MX_ST_OUT_OF_REACH: RobotStatusCodeInfo(MX_ST_OUT_OF_REACH, "MX_ST_OUT_OF_REACH", is_error=True), MX_ST_OFFLINE_SAVE_ERR: RobotStatusCodeInfo(MX_ST_OFFLINE_SAVE_ERR, "MX_ST_OFFLINE_SAVE_ERR", is_error=True), MX_ST_IGNORE_CMD_OFFLINE: RobotStatusCodeInfo(MX_ST_IGNORE_CMD_OFFLINE, "MX_ST_IGNORE_CMD_OFFLINE", is_error=True), MX_ST_MASTERING_NEEDED: RobotStatusCodeInfo(MX_ST_MASTERING_NEEDED, "MX_ST_MASTERING_NEEDED", is_error=True), MX_ST_IMPOSSIBLE_RESET_ERR: RobotStatusCodeInfo(MX_ST_IMPOSSIBLE_RESET_ERR, "MX_ST_IMPOSSIBLE_RESET_ERR", is_error=True), MX_ST_MUST_BE_DEACTIVATED: RobotStatusCodeInfo(MX_ST_MUST_BE_DEACTIVATED, "MX_ST_MUST_BE_DEACTIVATED", is_error=True), MX_ST_SIM_MUST_DEACTIVATED: RobotStatusCodeInfo(MX_ST_SIM_MUST_DEACTIVATED, "MX_ST_SIM_MUST_DEACTIVATED", is_error=True), MX_ST_OFFLINE_FULL: RobotStatusCodeInfo(MX_ST_OFFLINE_FULL, "MX_ST_OFFLINE_FULL", is_error=True), MX_ST_ALREADY_SAVING: RobotStatusCodeInfo(MX_ST_ALREADY_SAVING, "MX_ST_ALREADY_SAVING", is_error=True), MX_ST_ILLEGAL_WHILE_SAVING: RobotStatusCodeInfo(MX_ST_ILLEGAL_WHILE_SAVING, "MX_ST_ILLEGAL_WHILE_SAVING", is_error=True), MX_ST_NO_GRIPPER: RobotStatusCodeInfo(MX_ST_NO_GRIPPER, "MX_ST_NO_GRIPPER", is_error=True), MX_ST_NO_VBOX: RobotStatusCodeInfo(MX_ST_NO_VBOX, "MX_ST_NO_VBOX", is_error=True), MX_ST_CMD_FAILED: RobotStatusCodeInfo(MX_ST_CMD_FAILED, "MX_ST_CMD_FAILED", is_error=True), MX_ST_ACTIVATED: RobotStatusCodeInfo(MX_ST_ACTIVATED, "MX_ST_ACTIVATED", is_error=False), MX_ST_ALREADY_ACTIVATED: RobotStatusCodeInfo(MX_ST_ALREADY_ACTIVATED, "MX_ST_ALREADY_ACTIVATED", is_error=False), MX_ST_HOME_DONE: RobotStatusCodeInfo(MX_ST_HOME_DONE, "MX_ST_HOME_DONE", is_error=False), MX_ST_HOME_ALREADY: RobotStatusCodeInfo(MX_ST_HOME_ALREADY, "MX_ST_HOME_ALREADY", is_error=False), MX_ST_DEACTIVATED: RobotStatusCodeInfo(MX_ST_DEACTIVATED, "MX_ST_DEACTIVATED", is_error=False), MX_ST_ERROR_RESET: RobotStatusCodeInfo(MX_ST_ERROR_RESET, "MX_ST_ERROR_RESET", is_error=False), MX_ST_NO_ERROR_RESET: RobotStatusCodeInfo(MX_ST_NO_ERROR_RESET, "MX_ST_NO_ERROR_RESET", is_error=False), MX_ST_GET_STATUS_ROBOT: RobotStatusCodeInfo(MX_ST_GET_STATUS_ROBOT, "MX_ST_GET_STATUS_ROBOT", is_error=False), MX_ST_BRAKES_OFF: RobotStatusCodeInfo(MX_ST_BRAKES_OFF, "MX_ST_BRAKES_OFF", is_error=False), MX_ST_MASTER_DONE: RobotStatusCodeInfo(MX_ST_MASTER_DONE, "MX_ST_MASTER_DONE", is_error=False), MX_ST_BRAKES_ON: RobotStatusCodeInfo(MX_ST_BRAKES_ON, "MX_ST_BRAKES_ON", is_error=False), MX_ST_GET_WRF: RobotStatusCodeInfo(MX_ST_GET_WRF, "MX_ST_GET_WRF", is_error=False), MX_ST_GET_TRF: RobotStatusCodeInfo(MX_ST_GET_TRF, "MX_ST_GET_TRF", is_error=False), MX_ST_GET_JOINTS: RobotStatusCodeInfo(MX_ST_GET_JOINTS, "MX_ST_GET_JOINTS", is_error=False), MX_ST_GET_POSE: RobotStatusCodeInfo(MX_ST_GET_POSE, "MX_ST_GET_POSE", is_error=False), MX_ST_GET_AUTO_CONF: RobotStatusCodeInfo(MX_ST_GET_AUTO_CONF, "MX_ST_GET_AUTO_CONF", is_error=False), MX_ST_GET_CONF: RobotStatusCodeInfo(MX_ST_GET_CONF, "MX_ST_GET_CONF", is_error=False), MX_ST_GET_AUTO_CONF_TURN: RobotStatusCodeInfo(MX_ST_GET_AUTO_CONF_TURN, "MX_ST_GET_AUTO_CONF_TURN", is_error=False), MX_ST_GET_CONF_TURN: RobotStatusCodeInfo(MX_ST_GET_CONF_TURN, "MX_ST_GET_CONF_TURN", is_error=False), MX_ST_PAUSE_MOTION: RobotStatusCodeInfo(MX_ST_PAUSE_MOTION, "MX_ST_PAUSE_MOTION", is_error=False), MX_ST_RESUME_MOTION: RobotStatusCodeInfo(MX_ST_RESUME_MOTION, "MX_ST_RESUME_MOTION", is_error=False), MX_ST_CLEAR_MOTION: RobotStatusCodeInfo(MX_ST_CLEAR_MOTION, "MX_ST_CLEAR_MOTION", is_error=False), MX_ST_SIM_ON: RobotStatusCodeInfo(MX_ST_SIM_ON, "MX_ST_SIM_ON", is_error=False), MX_ST_SIM_OFF: RobotStatusCodeInfo(MX_ST_SIM_OFF, "MX_ST_SIM_OFF", is_error=False), MX_ST_EXTTOOL_SIM: RobotStatusCodeInfo(MX_ST_EXTTOOL_SIM, "MX_ST_EXTTOOL_SIM", is_error=False), MX_ST_EOM_ON: RobotStatusCodeInfo(MX_ST_EOM_ON, "MX_ST_EOM_ON", is_error=False), MX_ST_EOM_OFF: RobotStatusCodeInfo(MX_ST_EOM_OFF, "MX_ST_EOM_OFF", is_error=False), MX_ST_EOB_ON: RobotStatusCodeInfo(MX_ST_EOB_ON, "MX_ST_EOB_ON", is_error=False), MX_ST_EOB_OFF: RobotStatusCodeInfo(MX_ST_EOB_OFF, "MX_ST_EOB_OFF", is_error=False), MX_ST_START_SAVING: RobotStatusCodeInfo(MX_ST_START_SAVING, "MX_ST_START_SAVING", is_error=False), MX_ST_N_CMD_SAVED: RobotStatusCodeInfo(MX_ST_N_CMD_SAVED, "MX_ST_N_CMD_SAVED", is_error=False), MX_ST_OFFLINE_START: RobotStatusCodeInfo(MX_ST_OFFLINE_START, "MX_ST_OFFLINE_START", is_error=False), MX_ST_OFFLINE_LOOP_ON: RobotStatusCodeInfo(MX_ST_OFFLINE_LOOP_ON, "MX_ST_OFFLINE_LOOP_ON", is_error=False), MX_ST_OFFLINE_LOOP_OFF: RobotStatusCodeInfo(MX_ST_OFFLINE_LOOP_OFF, "MX_ST_OFFLINE_LOOP_OFF", is_error=False), MX_ST_GET_STATUS_GRIPPER: RobotStatusCodeInfo(MX_ST_GET_STATUS_GRIPPER, "MX_ST_GET_STATUS_GRIPPER", is_error=False), MX_ST_GET_CMD_PENDING_COUNT: RobotStatusCodeInfo(MX_ST_GET_CMD_PENDING_COUNT, "MX_ST_GET_CMD_PENDING_COUNT", is_error=False), MX_ST_GET_FW_VERSION: RobotStatusCodeInfo(MX_ST_GET_FW_VERSION, "MX_ST_GET_FW_VERSION", is_error=False), MX_ST_GET_FW_VERSION_FULL: RobotStatusCodeInfo(MX_ST_GET_FW_VERSION_FULL, "MX_ST_GET_FW_VERSION_FULL", is_error=False), MX_ST_GET_ROBOT_SERIAL: RobotStatusCodeInfo(MX_ST_GET_ROBOT_SERIAL, "MX_ST_GET_ROBOT_SERIAL", is_error=False), MX_ST_GET_PRODUCT_TYPE: RobotStatusCodeInfo(MX_ST_GET_PRODUCT_TYPE, "MX_ST_GET_PRODUCT_TYPE", is_error=False), MX_ST_CMD_SUCCESSFUL: RobotStatusCodeInfo(MX_ST_CMD_SUCCESSFUL, "MX_ST_CMD_SUCCESSFUL", is_error=False), MX_ST_SET_CTRL_PORT_MONIT: RobotStatusCodeInfo(MX_ST_SET_CTRL_PORT_MONIT, "MX_ST_SET_CTRL_PORT_MONIT", is_error=False), MX_ST_SYNC_CMD_QUEUE: RobotStatusCodeInfo(MX_ST_SYNC_CMD_QUEUE, "MX_ST_SYNC_CMD_QUEUE", is_error=False), MX_ST_GET_JOINT_LIMITS: RobotStatusCodeInfo(MX_ST_GET_JOINT_LIMITS, "MX_ST_GET_JOINT_LIMITS", is_error=False), MX_ST_SET_JOINT_LIMITS: RobotStatusCodeInfo(MX_ST_SET_JOINT_LIMITS, "MX_ST_SET_JOINT_LIMITS", is_error=False), MX_ST_SET_JOINT_LIMITS_CFG: RobotStatusCodeInfo(MX_ST_SET_JOINT_LIMITS_CFG, "MX_ST_SET_JOINT_LIMITS_CFG", is_error=False), MX_ST_GET_JOINT_LIMITS_CFG: RobotStatusCodeInfo(MX_ST_GET_JOINT_LIMITS_CFG, "MX_ST_GET_JOINT_LIMITS_CFG", is_error=False), MX_ST_GET_ROBOT_NAME: RobotStatusCodeInfo(MX_ST_GET_ROBOT_NAME, "MX_ST_GET_ROBOT_NAME", is_error=False), MX_ST_GET_ROBOT_KIN_MODEL: RobotStatusCodeInfo(MX_ST_GET_ROBOT_KIN_MODEL, "MX_ST_GET_ROBOT_KIN_MODEL", is_error=False), MX_ST_GET_ROBOT_DH_MODEL: RobotStatusCodeInfo(MX_ST_GET_ROBOT_DH_MODEL, "MX_ST_GET_ROBOT_DH_MODEL", is_error=False), MX_ST_GET_JOINT_OFFSET: RobotStatusCodeInfo(MX_ST_GET_JOINT_OFFSET, "MX_ST_GET_JOINT_OFFSET", is_error=False), MX_ST_GET_MODEL_JOINT_LIMITS: RobotStatusCodeInfo(MX_ST_GET_MODEL_JOINT_LIMITS, "MX_ST_GET_MODEL_JOINT_LIMITS", is_error=False), MX_ST_GET_MOTION_OPTIONS: RobotStatusCodeInfo(MX_ST_GET_MOTION_OPTIONS, "MX_ST_GET_MOTION_OPTIONS", is_error=False), MX_ST_GET_MONITORING_INTERVAL: RobotStatusCodeInfo(MX_ST_GET_MONITORING_INTERVAL, "MX_ST_GET_MONITORING_INTERVAL", is_error=False), MX_ST_GET_REAL_TIME_MONITORING: RobotStatusCodeInfo(MX_ST_GET_REAL_TIME_MONITORING, "MX_ST_GET_REAL_TIME_MONITORING", is_error=False), MX_ST_GET_STATUS_EVENTS: RobotStatusCodeInfo(MX_ST_GET_STATUS_EVENTS, "MX_ST_GET_STATUS_EVENTS", is_error=False), MX_ST_GET_NETWORK_OPTIONS: RobotStatusCodeInfo(MX_ST_GET_NETWORK_OPTIONS, "MX_ST_GET_NETWORK_OPTIONS", is_error=False), MX_ST_GET_RTC: RobotStatusCodeInfo(MX_ST_GET_RTC, "MX_ST_GET_RTC", is_error=False), MX_ST_GET_BLENDING: RobotStatusCodeInfo(MX_ST_GET_BLENDING, "MX_ST_GET_BLENDING", is_error=False), MX_ST_GET_VEL_TIMEOUT: RobotStatusCodeInfo(MX_ST_GET_VEL_TIMEOUT, "MX_ST_GET_VEL_TIMEOUT", is_error=False), MX_ST_GET_JOINT_VEL: RobotStatusCodeInfo(MX_ST_GET_JOINT_VEL, "MX_ST_GET_JOINT_VEL", is_error=False), MX_ST_GET_JOINT_ACC: RobotStatusCodeInfo(MX_ST_GET_JOINT_ACC, "MX_ST_GET_JOINT_ACC", is_error=False), MX_ST_GET_CART_LIN_VEL: RobotStatusCodeInfo(MX_ST_GET_CART_LIN_VEL, "MX_ST_GET_CART_LIN_VEL", is_error=False), MX_ST_GET_CART_ANG_VEL: RobotStatusCodeInfo(MX_ST_GET_CART_ANG_VEL, "MX_ST_GET_CART_ANG_VEL", is_error=False), MX_ST_GET_CART_ACC: RobotStatusCodeInfo(MX_ST_GET_CART_ACC, "MX_ST_GET_CART_ACC", is_error=False), MX_ST_GET_CHECKPOINT: RobotStatusCodeInfo(MX_ST_GET_CHECKPOINT, "MX_ST_GET_CHECKPOINT", is_error=False), MX_ST_GET_GRIPPER_FORCE: RobotStatusCodeInfo(MX_ST_GET_GRIPPER_FORCE, "MX_ST_GET_GRIPPER_FORCE", is_error=False), MX_ST_GET_GRIPPER_VEL: RobotStatusCodeInfo(MX_ST_GET_GRIPPER_VEL, "MX_ST_GET_GRIPPER_VEL", is_error=False), MX_ST_GET_TORQUE_LIMITS_CFG: RobotStatusCodeInfo(MX_ST_GET_TORQUE_LIMITS_CFG, "MX_ST_GET_TORQUE_LIMITS_CFG", is_error=False), MX_ST_GET_TORQUE_LIMITS: RobotStatusCodeInfo(MX_ST_GET_TORQUE_LIMITS, "MX_ST_GET_TORQUE_LIMITS", is_error=False), MX_ST_RT_TARGET_JOINT_POS: RobotStatusCodeInfo(MX_ST_RT_TARGET_JOINT_POS, "MX_ST_RT_TARGET_JOINT_POS", is_error=False), MX_ST_RT_TARGET_CART_POS: RobotStatusCodeInfo(MX_ST_RT_TARGET_CART_POS, "MX_ST_RT_TARGET_CART_POS", is_error=False), MX_ST_RT_TARGET_JOINT_VEL: RobotStatusCodeInfo(MX_ST_RT_TARGET_JOINT_VEL, "MX_ST_RT_TARGET_JOINT_VEL", is_error=False), MX_ST_RT_TARGET_JOINT_TORQ: RobotStatusCodeInfo(MX_ST_RT_TARGET_JOINT_TORQ, "MX_ST_RT_TARGET_JOINT_TORQ", is_error=False), MX_ST_RT_TARGET_CART_VEL: RobotStatusCodeInfo(MX_ST_RT_TARGET_CART_VEL, "MX_ST_RT_TARGET_CART_VEL", is_error=False), MX_ST_RT_TARGET_CONF: RobotStatusCodeInfo(MX_ST_RT_TARGET_CONF, "MX_ST_RT_TARGET_CONF", is_error=False), MX_ST_RT_TARGET_CONF_TURN: RobotStatusCodeInfo(MX_ST_RT_TARGET_CONF_TURN, "MX_ST_RT_TARGET_CONF_TURN", is_error=False), MX_ST_RT_JOINT_POS: RobotStatusCodeInfo(MX_ST_RT_JOINT_POS, "MX_ST_RT_JOINT_POS", is_error=False), MX_ST_RT_CART_POS: RobotStatusCodeInfo(MX_ST_RT_CART_POS, "MX_ST_RT_CART_POS", is_error=False), MX_ST_RT_JOINT_VEL: RobotStatusCodeInfo(MX_ST_RT_JOINT_VEL, "MX_ST_RT_JOINT_VEL", is_error=False), MX_ST_RT_JOINT_TORQ: RobotStatusCodeInfo(MX_ST_RT_JOINT_TORQ, "MX_ST_RT_JOINT_TORQ", is_error=False), MX_ST_RT_CART_VEL: RobotStatusCodeInfo(MX_ST_RT_CART_VEL, "MX_ST_RT_CART_VEL", is_error=False), MX_ST_RT_CONF: RobotStatusCodeInfo(MX_ST_RT_CONF, "MX_ST_RT_CONF", is_error=False), MX_ST_RT_CONF_TURN: RobotStatusCodeInfo(MX_ST_RT_CONF_TURN, "MX_ST_RT_CONF_TURN", is_error=False), MX_ST_RT_ACCELEROMETER: RobotStatusCodeInfo(MX_ST_RT_ACCELEROMETER, "MX_ST_RT_ACCELEROMETER", is_error=False), MX_ST_RT_GRIPPER_FORCE: RobotStatusCodeInfo(MX_ST_RT_GRIPPER_FORCE, "MX_ST_RT_GRIPPER_FORCE", is_error=False), MX_ST_RT_EXTTOOL_STATUS: RobotStatusCodeInfo(MX_ST_RT_EXTTOOL_STATUS, "MX_ST_RT_EXTTOOL_STATUS", is_error=False), MX_ST_RT_GRIPPER_STATE: RobotStatusCodeInfo(MX_ST_RT_GRIPPER_STATE, "MX_ST_RT_GRIPPER_STATE", is_error=False), MX_ST_RT_VALVE_STATE: RobotStatusCodeInfo(MX_ST_RT_VALVE_STATE, "MX_ST_RT_VALVE_STATE", is_error=False), MX_ST_RT_CHECKPOINT: RobotStatusCodeInfo(MX_ST_RT_CHECKPOINT, "MX_ST_RT_CHECKPOINT", is_error=False), MX_ST_RT_WRF: RobotStatusCodeInfo(MX_ST_RT_WRF, "MX_ST_RT_WRF", is_error=False), MX_ST_RT_TRF: RobotStatusCodeInfo(MX_ST_RT_TRF, "MX_ST_RT_TRF", is_error=False), MX_ST_RT_CYCLE_END: RobotStatusCodeInfo(MX_ST_RT_CYCLE_END, "MX_ST_RT_CYCLE_END", is_error=False), MX_ST_CONNECTED: RobotStatusCodeInfo(MX_ST_CONNECTED, "MX_ST_CONNECTED", is_error=False), MX_ST_USER_ALREADY: RobotStatusCodeInfo(MX_ST_USER_ALREADY, "MX_ST_USER_ALREADY", is_error=True), MX_ST_UPGRADE_IN_PROGRESS: RobotStatusCodeInfo(MX_ST_UPGRADE_IN_PROGRESS, "MX_ST_UPGRADE_IN_PROGRESS", is_error=False), MX_ST_CMD_TOO_LONG: RobotStatusCodeInfo(MX_ST_CMD_TOO_LONG, "MX_ST_CMD_TOO_LONG", is_error=True), MX_ST_EOM: RobotStatusCodeInfo(MX_ST_EOM, "MX_ST_EOM", is_error=False), MX_ST_ERROR_MOTION: RobotStatusCodeInfo(MX_ST_ERROR_MOTION, "MX_ST_ERROR_MOTION", is_error=True), MX_ST_INIT_FAILED: RobotStatusCodeInfo(MX_ST_INIT_FAILED, "MX_ST_INIT_FAILED", is_error=True), MX_ST_EOB: RobotStatusCodeInfo(MX_ST_EOB, "MX_ST_EOB", is_error=False), MX_ST_END_OFFLINE: RobotStatusCodeInfo(MX_ST_END_OFFLINE, "MX_ST_END_OFFLINE", is_error=False), MX_ST_CANT_SAVE_OFFLINE: RobotStatusCodeInfo(MX_ST_CANT_SAVE_OFFLINE, "MX_ST_CANT_SAVE_OFFLINE", is_error=True), MX_ST_IGNORING_CMD: RobotStatusCodeInfo(MX_ST_IGNORING_CMD, "MX_ST_IGNORING_CMD", is_error=True), MX_ST_NO_OFFLINE_SAVED: RobotStatusCodeInfo(MX_ST_NO_OFFLINE_SAVED, "MX_ST_NO_OFFLINE_SAVED", is_error=True), MX_ST_OFFLINE_LOOP: RobotStatusCodeInfo(MX_ST_OFFLINE_LOOP, "MX_ST_OFFLINE_LOOP", is_error=False), MX_ST_ERROR_GRIPPER: RobotStatusCodeInfo(MX_ST_ERROR_GRIPPER, "MX_ST_ERROR_GRIPPER", is_error=True), MX_ST_ERROR_VBOX: RobotStatusCodeInfo(MX_ST_ERROR_VBOX, "MX_ST_ERROR_VBOX", is_error=True), MX_ST_MAINTENANCE_CHECK: RobotStatusCodeInfo(MX_ST_MAINTENANCE_CHECK, "MX_ST_MAINTENANCE_CHECK", is_error=True), MX_ST_INTERNAL_ERROR: RobotStatusCodeInfo(MX_ST_INTERNAL_ERROR, "MX_ST_INTERNAL_ERROR", is_error=True), MX_ST_EXCESSIVE_TRQ: RobotStatusCodeInfo(MX_ST_EXCESSIVE_TRQ, "MX_ST_EXCESSIVE_TRQ", is_error=True), MX_ST_CHECKPOINT_REACHED: RobotStatusCodeInfo(MX_ST_CHECKPOINT_REACHED, "MX_ST_CHECKPOINT_REACHED", is_error=False), MX_ST_TEXT_API_ERROR: RobotStatusCodeInfo(MX_ST_TEXT_API_ERROR, "MX_ST_TEXT_API_ERROR", is_error=True), MX_ST_PSTOP: RobotStatusCodeInfo(MX_ST_PSTOP, "MX_ST_PSTOP", is_error=True), MX_ST_NO_VALID_CFG: RobotStatusCodeInfo(MX_ST_NO_VALID_CFG, "MX_ST_NO_VALID_CFG", is_error=True), MX_ST_TRACE_LVL_CHANGED: RobotStatusCodeInfo(MX_ST_TRACE_LVL_CHANGED, "MX_ST_TRACE_LVL_CHANGED", is_error=False), MX_ST_TCP_DUMP_STARTED: RobotStatusCodeInfo(MX_ST_TCP_DUMP_STARTED, "MX_ST_TCP_DUMP_STARTED", is_error=False), MX_ST_TCP_DUMP_DONE: RobotStatusCodeInfo(MX_ST_TCP_DUMP_DONE, "MX_ST_TCP_DUMP_DONE", is_error=False), }
flowers = input() qty = int(input()) budget = int(input()) price = 0 Roses = 5 Dahlias = 3.8 Tulips = 2.8 Narcissus = 3 Gladiolus = 2.5 if flowers == "Roses": if qty > 80: price = Roses * qty * 0.9 else: price = Roses * qty elif flowers == "Dahlias": if qty > 90: price = Dahlias * qty * 0.85 else: price = Dahlias * qty elif flowers == "Tulips": if qty > 80: price = Tulips * qty * 0.85 else: price = Tulips * qty elif flowers == "Narcissus": if qty < 120: price = Narcissus * qty * 1.15 else: price = Narcissus * qty elif flowers == "Gladiolus": if qty < 80: price = Gladiolus * qty * 1.2 else: price = Gladiolus * qty if price > budget: print(f'Not enough money, you need {price - budget:.2f} leva more.') else: print(f'Hey, you have a great garden with {qty} {flowers} and {budget - price:.2f} leva left.')
def get_divisors(n): sum = 1 for i in range(2, int(n ** 0.5 + 1)): if n % i == 0: sum += i sum += n / i return sum def find_amicable_pair(): total = 0 for x in range(1, 10001): a = get_divisors(x) b = get_divisors(a) if b == x and x != a: total += x return total print(find_amicable_pair())
#sandwiches: def orderedsandwich(items): list_of_items = [] for item in items: list_of_items.append(item) print("This is items you ordered in your sandwich:") for item in list_of_items: print(item) orderedsandwich(['kela','aloo']) orderedsandwich(['cheese','poteto']) orderedsandwich(['uiyer'])
def fatorial(num=1): f = 1 for c in range(num, 0, -1): f *= c return f print(f'O resultado é: {fatorial(int(input("Digite um valor: ")))}')
class Player: name: str hp: int mp: int skills: dict def __init__(self, name: str, hp: int, mp: int): self.name = name self.hp = hp self.mp = mp self.skills = {} self.guild = 'Unaffiliated' def add_skill(self, skill_name, mana_cost): skills = [x for x in self.skills.keys()] if skill_name not in skills: self.skills[skill_name] = mana_cost return f'Skill {skill_name} added to the collection of the player {self.name}' return f'Skill already added' def player_info(self): data = f'Name: {self.name}\nGuild: {self.guild}\nHP: {self.hp}\nMP: {self.mp}\n' for (k, v) in self.skills.items(): data += f'==={k} - {v}\n' return data
""" CONVERSOR DE TEMPERATURAS ºC E ºF """ c = float(input('Informe a temperatura em ºC: ')) f = float(input('Informe a temperatura em ºF: ')) Tc = (f-32)/1.8 Tf = (c*1.8)+32 print('A temperatura de {:.2f}ºC Corresponde a {:.2f}ºF '.format(c,Tf)) print('A temperatura de {:.2f}ºF Corresponde a {:.2f}ºC'.format(f,Tc)) #ºC->ºF = ((9*c)/5)+32 #ºF->ºC = ((
students_number=int(input("Enter number of Students :")) per_student_kharcha=int(input("Enter per student expense :")) total_kharcha=students_number*per_student_kharcha if total_kharcha<50000: print ("Ham kharche ke andar hai ") else: print ("kharche se bahar hai ")
s = 'test' print(s[:]) # print whole string print(s[0:-1]) # print tes print(s[1]) # e print(s + "xyz") # concatination testxyz print("A"*90) #s[0] = "s" #str' object does not support item assignment S = "strawberry" L = list(S) print(L) L[0] = 'Z' print(''.join(L)) # Ztrawberry s = ''.join(L) s = s.replace('rr', 'rrr') print(s) line = 'aaa,bbb,ccc' print(line.split(',')) # разбить по разделителю строку print(line.upper()) test_string = '''etst gdf rt \ttew''' print(test_string) print(line.encode("utf-8")) print(line.encode("utf-16"))
a = 1 b = 2 c = a+b print(c) d= 5 e = 6 f = 7 k = 6 h = 50 j =522022 l= 5050 你是猪
# # Language constants # WELCOME = " Welcome to arpspoofKicker!" # # Universal # SELECT_AN_OPTION = "Select an option" # # main # MENU = "\n1. ARPSpoof a single device\n" \ "2. ARPSpoof a multiple devices\n" \ "E. Exit" MENU_1 = "\n1. ARPSpoof a single device\n" \ "2. ARPSpoof a multiple devices\n" \ "3. Run thread(s) in queue\n" \ "4. Stop running thread(s)\n" \ "5. Print thread(s) status\n" \ "E. Stop all threads and exit" # # Thread manager # THREAD_ENDED_UNEXPECTEDLY = "Thread %a ended unexpectedly" NO_INTERFACES_WERE_FOUND = "No interfaces were found, check your network configuration, press enter to exit " FOR_ARPSPOOF_CHECK_THIS = "To install 'arpspoof' check %a" UPDATE_CONNECTED_USERS = "Re-scan" THREAD_IS_NOT_RUNNING = "Thread %a is not running" SELECT_AN_INTERFACE = "Select your network interface" DISCOVERING_DEVICES = "\nRunning arp -a [Discovering devices]..." SELECT_THE_GATEWAY = "Select a GATEWAY [Host]" CONFIRM_INTERFACE = "Is %a your currently network interface?\n1. Yes\n2. No" THREAD_IS_RUNNING = "Thread %a is running" DUPLICATED_VICTIM = "A thread is already targeting %a" SELECT_A_VICTIM = "Select a victim" THREAD_CREATED = "A thread was created successfully" SELECT_OPTIONS = "Select an option [ Selected %a of %a ]" VIEW_AS_MAC = "View as MAC address" VIEW_AS_IP = "View as IPv4 address" THREAD_V_G = " thread for victim %a and gateway %a" STARTING = "Starting" STOPPING = "Stopping" DELETING = "Deleting" # # Util # IPCONFIG_COMMAND_NOT_FOUND = "ip or ifconfig command not found" ARPSPOOF_PERMISSION_DENIED = "You need root permissions to run 'arpspoof'\n Run with: sudo python3 main.py" ARPSPOOF_COMMAND_NOT_FOUND = "'arpspoof' is not installed" OPTION_IS_NOT_IN_LIST = "Your option is not in list, try any of these %a" ARP_COMMAND_NOT_FOUND = "Somehow 'arp' command were not found (Likely you're using linux, install net-tools)" STOPPING_ARPSPOOF = "Stopping arpspoof..." INCOMPLETE_DATA = "Some devices were not detected as incomplete, consider re-scan for devices" SELECT_ALL = "Select all" FINISH = "Finish"
class JackTokenizer: def __init__(self, src_file_name): self._line_index = 0 self._line_index = 0 self._lines = [] f = open(src_file_name) # First assesment of the Assembler for line in f.readlines(): strip_line = line.lstrip() # Skipping none relevant if len(strip_line) == 0 or strip_line[0:2] == '//': continue #l = strip_line.replace(' ', '') # Removing whitespace l = strip_line.replace('\n', '') # Removing new line l = l.replace('\t', '') # Removing tabs l = l.split('/')[0] # Removing comments self._lines.append(l) f.close() def current_token(self): curr_line = self._lines[self._line_index] return "" def advance(self): self._line_index+=1 def has_more_command(self): return len(self._lines) > self._line_index def token_type(self): pass
jolts = [0] while True: try: a = int(input()) jolts.append(a) except: break jolts.sort() jolts.append(jolts[-1] + 3) diffs = [0, 0] for i in range(1,len(jolts)): if jolts[i] - jolts[i-1] == 1: diffs[0] += 1 elif jolts[i] - jolts[i-1] == 3: diffs[1] += 1 print(diffs[0]*diffs[1]) #part 2 paths = [0 for _ in range(len(jolts))] paths[-1] = 1 for i in range(len(jolts)-2, -1,-1): from_here = 0 for j in range(1, 4): try: if jolts[i+j] - jolts[i] < 4: from_here += paths[i+j] except: pass paths[i] = from_here print(paths[0])
def gen_serial(username): log_10 = 0 log_14 = 0 log_15 = 0 eax = '' edx = '' ecx = '' for c in username: hex_symbol = hex(ord(c)) eax = hex_symbol eax = log_15 eax = eax << 2 log_10 = log_10 + eax eax = hex_symbol edx = log_10 edx = edx - int(eax, 16) eax = 0x0fa eax = eax ^ edx log_10 = eax eax = log_15 eax = eax << 3 log_14 = log_14 + eax eax = hex_symbol edx = log_14 edx = edx - int(eax, 16) eax = 0x11 eax = eax ^ edx log_10 = eax log_15 = int(hex_symbol, 16) eax = log_14 eax = eax >> 0x1f edx = eax edx = edx ^ log_14 edx = edx - eax eax = log_10 eax = eax >> 0x1f ecx = eax eax = ecx eax = eax ^ log_10 eax = eax - ecx return [eax, edx] if __name__ == "__main__": username = input('Enter Username: ') code = gen_serial(username) print('Code: ' + '{}-{}'.format(code[0], code[1]))
def clean_t (data): # Select columns to clean df = data # Create dummies using the items in the list of 'safety&security' column ss = df['safety_security'].dropna() df_new = df.join(ss.str.join('|').str.get_dummies().add_prefix('ss_')) # Drop 'safety_security' column df_new.drop('safety_security', axis=1, inplace=True) # Clean the model column df_new['model'] = df.model.apply(lambda x: x[1]) # Strip "\n"s from the 'make' column df_new['make'] = df.make.str.strip("\n") # Drop unnecesary column 'make_model' df_new.drop(columns = "make_model", inplace = True) # Clean 'model_code' column df_new.loc[df_new.model_code.notnull(), "model_code"] = df.model_code[df.model_code.notnull()].apply(lambda x: str(x)[4:-4]) # Clean 'country_version' column df_new.loc[df_new.country_version.notnull(), "country_version"] = df.country_version[df.country_version.notnull()].apply(lambda x: str(x)[4:-4]) # Clean 'co2_emission' column df_new['co2_emission'] = df.co2_emission.str[0].str.extract(r'(\d+)') # Change the 'co2' columns data type to numeric df_new['co2_emission'] = pd.to_numeric(df_new.co2_emission) # Clean 'cylinders' column df_new['cylinders'] = df.cylinders.str[0].str.extract(r'(\d+)') # Change the 'cylinders' columns data type to numeric df_new['cylinders'] = pd.to_numeric(df_new['cylinders']) # Extract displacement values (and remove commas) df_new['displacement'] = df.displacement.str[0].str.replace(",","").str.extract(r'(\d+)') # Change the type of displacement from object to numeric df_new['displacement'] = pd.to_numeric(df_new['displacement']) # Extract 'next_inspection' values df_new.next_inspection = df.next_inspection.str[0].str.strip("\n") # Create a boolean column from `next_inspection` df_new['next_inspection_bool'] = df_new.next_inspection.notnull() # Drop 'non-smoking_vehicle' column df_new.drop("non_smoking_vehicle", axis=1, inplace=True) # Extract hp from 'hp' column df_new['hp'] = df.hp.str.extract(r'(\d+)') # Change datatype to numeric df_new['hp'] = pd.to_numeric(df_new['hp']) # Drop 'kw' column df_new.drop('kw', axis=1, inplace=True) # Clean 'km' column df_new['km'] = df.km.str.replace(",", "").str.extract(r'(\d+)') # Clean "offer_number' column df_new['offer_number'] = df.offer_number.str[0].str.replace("\n","") # Create a boolean for checking "combined" consumption comb_bool = df.consumption.str[0].str[0].str.contains("comb", na=False) # Create a new column for 'consumption_comb' df_new['consumption_comb'] = df[comb_bool].consumption.str[0].str[0].str.extract(r'(\d.\d|\d)') # Drop 'consumption' column df_new.drop('consumption', axis=1, inplace=True) # Tidy column names df_new.columns = name_columns(df_new) # Change description from list to string df_new['description'] = df['description'].str.join('').str.strip("\n")[0] return df_new def clean_m(data): df=data #cleaning registration column and convertinf it to age column reg_new = df.registration[~df.registration.str.contains("-")] reg_new = pd.to_datetime(reg_new, format='%m/%Y') reg_year = reg_new.apply(lambda x: x.year) df['age'] = 2019 - reg_year df['gearing_type'] = df['gearing_type'].apply(lambda x:x[1]) df.loc[df['body'].notnull(), 'body'] = df.loc[df['body'].notnull(), 'body'].apply(lambda x: x[1]) df.loc[df['body_color'].notnull(), 'body_color'] = df.loc[df['body_color'].notnull(), 'body_color'].apply(lambda x: x[1]) ent=df[['entertainment_media']].dropna() df=df.join(ent['entertainment_media'].str.join('|').str.get_dummies().add_prefix('ent_media_')) df['gears']=df.gears.str[0].str.replace("\n", "") df['gears'] = pd.to_numeric(df.gears) df['paint_type']=df.paint_type.str[0].str.replace("\n", "") # converting inspection_new column to 1 if it contains Yes expression, else: 0 df["inspection_new"] = df.inspection_new.str[0].str.contains("Yes", na=False)*1 # extracting the number of days in availabiltiy column and converting column name to available_after_days df['availability'] = df.availability.str.extract(r'(\d+)') df['available_after_days'] = df.availability.apply(pd.to_numeric) # finding right pattern for date in a mixed column: 2 digits/4 digits to extract the date df['last_service_date'] = df.last_service_date.str[0].str.extract(r'(\d{2}\/\d{4})') # converting to datetime object df['last_service_date'] = pd.to_datetime(df['last_service_date'], format='%m/%Y') #cleaning the available_from column and converting to datetime df['available_from'] = df.available_from.str.strip("\n") df['available_from'] = pd.to_datetime(df['available_from']) name_columns(df) drop_list=['entertainment_media', 'availability', 'body_color_original', 'full_service', 'last_timing_belt_service_date', 'null', 'registration'] df.drop(drop_list, axis=1, inplace=True) return df def clean_update(data): '''Additional cleaning after performing EDA''' df = data # Change wrong data types to numeric df['km'] = pd.to_numeric(df['km']) df['consumption_comb'] = pd.to_numeric(df['consumption_comb']) df['nr_of_doors'] = pd.to_numeric(df['nr_of_doors']) df['nr_of_seats'] = pd.to_numeric(df['nr_of_seats']) df['previous_owners'] = pd.to_numeric(df['previous_owners']) df['weight_kg'] = pd.to_numeric(df['weight_kg']) #df['gears'] = pd.to_numeric(df['gears']) # clean_m updated # Change wrong data type to date_time df['first_registration'] = pd.to_datetime(df.first_registration, format='%Y') # Replace " " with NaNs df.loc[df.next_inspection == "",'next_inspection'] = np.nan # Drop 'prev_owner' column df.drop('prev_owner', axis=1, inplace = True) # Drop 'body_type' column (duplicate of 'body') df.drop('body_type', axis=1, inplace = True) # Drop 'next_inspection' column (created a new column 'next_inspection_bool') df.drop('next_inspection', axis=1, inplace = True) return df
def extractDustToRust(item): """ Parser for 'Dust to Rust' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'Kyuuketsu Hime' in item['tags']: return buildReleaseMessageWithType(item, 'Kyuuketsu Hime wa Barairo no Yume o Miru', vol, chp, frag=frag, postfix=postfix) if 'Vampire Princess' in item['tags']: return buildReleaseMessageWithType(item, 'Kyuuketsu Hime wa Barairo no Yume o Miru', vol, chp, frag=frag, postfix=postfix) if 'Reincarnate into a Slime' in item['tags']: return buildReleaseMessageWithType(item, 'Tensei Shitara Slime Datta Ken', vol, chp, frag=frag, postfix=postfix) if 'Slime' in item['tags']: return buildReleaseMessageWithType(item, 'Tensei Shitara Slime Datta Ken', vol, chp, frag=frag, postfix=postfix) return False
#encoding=utf-8 #Manacher is to find the longest Palindrome substring #normally, the time complexity is O(n2) #In order to reduce the time complexity #It tries to use the previous palindrome data #to reduce the time complexsity to O(n) def FindLongestPalindrome(str_line): p = [1]* len(str_line) mx = 1 id = 0 for i in range(1, len(str_line)): if mx > i: p[i] = min(p[2 * id - i], mx - i) #update id and mx idx = p[i] while (i+idx) < len(str_line) and str_line[i - idx] == str_line[i + idx]: p[i] = p[i] + 1 idx = idx + 1 if p[i] + i > mx: mx = p[i] + i -1 id = i print(max(p)*2-1) print(str_line[id - max(p)+1:id + max(p)]) def main(): str_line = '12212321' FindLongestPalindrome(str_line) if __name__ == '__main__': main()
# gunicorn config file access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" "pid=%(p)s"' raw_env = [ 'FLASK_APP=webhook', ] bind="0.0.0.0:5000" workers=5 accesslog="-"
# coding=utf-8 class NodeType: select = 'SELECT' insert = 'INSERT' delete = 'DELETE' update = 'UPDATE' train = 'TRAIN' register = 'REGISTER' load = 'LOAD' save = 'SAVE' connect = 'CONNECT' set = 'SET' alert = 'ALERT' create_table = 'CREATETABLE' drop_table = 'DROPTABLE' create_index = 'CREATEINDEX' drop_index = 'DROPINDEX' create_user = 'CREATEUSER' exit = 'EXIT' print_table = 'PRINT' show_tables = 'SHOW' value = 'VALUE' condition = 'CONDITION' relation_attr = 'RELATTR' grant_user = 'GRANTUSER' revoke_user = 'REVOKEUSER' attr_type = "ATTRTYPE" class QueryNode: def __init__(self, select_list, from_list, where_list, limit_num, as_table): self.type = NodeType.select self.select_list = select_list self.from_list = from_list self.where_list = where_list self.limit_num = limit_num self.as_table = as_table class LoadNode: def __init__(self, where_list, table_id): self.type = NodeType.load self.where_list = where_list self.table_id = table_id class SaveNode: def __init__(self, table_id): self.type = NodeType.save self.table_id = table_id class ConnectNode: def __init__(self, table_id): self.type = NodeType.connect self.table_id = table_id class SetNode: def __init__(self, where_list, table_id): self.type = NodeType.set self.where_list = where_list self.table_id = table_id class InsertNode: def __init__(self, table_name, value_list): self.type = NodeType.insert self.table_name = table_name self.value_list = value_list class DeleteNode: def __init__(self, table_name, where_list): self.type = NodeType.delete self.table_name = table_name self.where_list = where_list class UpdateNode: def __init__(self, table_name, set_list, where_list): self.type = NodeType.update self.table_name = table_name self.set_list = set_list self.where_list = where_list class TrainNode: def __init__(self, set_list, where_list): self.type = NodeType.train self.set_list = set_list self.where_list = where_list class RegisterNode: def __init__(self, set_list, where_list): self.type = NodeType.register self.set_list = set_list self.where_list = where_list class AlertNode: def __init__(self, table_name, op, attr_list): self.type = NodeType.alert self.table_name = table_name self.op = op self.attr_list = attr_list class CreateTableNode: def __init__(self, table_name, attr_list): self.type = NodeType.create_table self.table_name = table_name self.attr_list = attr_list class DropTableNode: def __init__(self, table_name): self.type = NodeType.drop_table self.table_name = table_name class CreateIndexNode: def __init__(self, table_name, attr_name): self.type = NodeType.create_index self.table_name = table_name self.attr_name = attr_name class DropIndexNode: def __init__(self, table_name, attr_name): self.type = NodeType.drop_index self.table_name = table_name self.attr_name = attr_name class CreateUserNode: def __init__(self, user_id, password): self.type = NodeType.create_user self.user_id = user_id self.password = password class GrantUserNode: def __init__(self, power_list, table_list, user_list): self.type = NodeType.grant_user self.power_list = power_list self.table_list = table_list self.user_list = user_list class RevokeUserNode: def __init__(self, power_list, table_list, user_list): self.type = NodeType.revoke_user self.power_list = power_list self.table_list = table_list self.user_list = user_list class Exit: def __init__(self): self.type = NodeType.exit class PrintTable: def __init__(self, table_name): self.type = NodeType.print_table self.table_name = table_name class ShowTables: def __init__(self): self.type = NodeType.show_tables class Value: def __init__(self, value_type, value): self.type = NodeType.value self.value_type = value_type self.value = value def __str__(self): return str(self.value) + '[' + self.value_type + ']' class RelAttr: def __init__(self, attr_name, table_name=None): self.type = NodeType.relation_attr self.table_name = table_name self.attr_name = attr_name def __str__(self): if self.table_name: return self.table_name + '.' + self.attr_name else: return self.attr_name class Cond: def __init__(self, left, op, right): self.type = NodeType.condition self.op = op.upper() self.left = left self.right = right def __str__(self): return '(' + str(self.left) + ', ' + str( self.right) + ', ' + self.op + ')' class AttrType: def __init__(self, attr_name, attr_type, type_len=1): self.type = NodeType.attr_type self.attr_type = attr_type self.type_len = type_len self.attr_name = attr_name def __str__(self): return self.attr_name + " " + self.attr_type + " " + str(self.type_len) if __name__ == '__main__': pass
# Name: # Date: # proj02: sum # Write a program that prompts the user to enter numbers, one per line, # ending with a line containing 0, and keep a running sum of the numbers. # Only print out the sum after all the numbers are entered # (at least in your final version). Each time you read in a number, # you can immediately use it for your sum, # and then be done with the number just entered. #Example: # Enter a number to sum, or 0 to indicate you are finished: 4 # Enter a number to sum, or 0 to indicate you are finished: 5 # Enter a number to sum, or 0 to indicate you are finished: 2 # Enter a number to sum, or 0 to indicate you are finished: 10 # Enter a number to sum, or 0 to indicate you are finished: 0 #The sum of your numbers is: 21 #Number adding thing num = int(input("Enter a number to sum, or 0 to indicate you are finished:")) sum = 0 summ = 0 while num > 0: sum = sum + num num = int(input("Enter a number to sum, or 0 to indicate you are finished:")) summ = summ + 1 average = sum/summ print("Your average is " + str(average)) """"#R/P/S answer = input("Would you like to play?") while answer == "Yes": p1_input = input("Rock, paper, scissors") p2_input = input("Rock, paper, scissors") if p1_input == "rock" and p2_input == "paper": print("Player 2 wins") elif p1_input == "rock" and p2_input == "scissors": print("Player 1 wins") elif p1_input == "paper" and p2_input == "rock": print("Player 1 wins") elif p1_input == "paper" and p2_input == "scissors": print("Player 2 wins") elif p1_input == "scissors" and p2_input == "rock": print("Player 2 wins") elif p1_input == "scissors" and p2_input == "Paper": print("Player 1 wins") else: print("It is a tie") answer = input("Would you like to play again?")"""
sentence='I am interested in {num}' pi=3.14 print(sentence.format(num=pi)) e=2.712 print(sentence.format(num=e))
""" File: rocket.py Name:Claire Lin ----------------------- This program should implement a console program that draws ASCII art - a rocket. The size of rocket is determined by a constant defined as SIZE at top of the file. Output format should match what is shown in the sample run in the Assignment 2 Handout. """ # This constant determines rocket size. SIZE = 3 def main(): """ :return: str, the rocket will be build in any size. """ head() belt() upper() lower() belt() head() def head(): for i in range(SIZE): print(' ', end='') for j in range(-i+(SIZE-1)): print(' ', end='') for k in range(i+1): print('/', end='') for l in range(i+1): print('\\', end='') print("") def belt(): print('+', end='') for k in range(SIZE*2): print('=', end='') print('+') def upper(): for m in range(SIZE): print('|', end='') for n in range(-m+(SIZE-1)): print('.', end='') for u in range(m+1): print('/\\', end='') for s in range(-m+(SIZE - 1)): print('.', end='') print('|') def lower(): for o in range(SIZE): print('|', end='') for p in range(o): print('.', end='') for r in range(-o+SIZE): print('\\/', end='') for q in range(o): print('.', end='') print('|') ###### DO NOT EDIT CODE BELOW THIS LINE ###### if __name__ == "__main__": main()
l = [int(i) for i in input().split()] print("largest - ", max(l)) print('smallest - ', min(l)) print('2nd largest - ', sorted(l)[-2]) print('2nd smallest - ', sorted(l)[1])
"""Tier of ecosystem membership.""" # pylint: disable=too-few-public-methods class Tier: """Tiers of ecosystem membership.""" MAIN: str = "MAIN" MEMBER: str = "MEMBER" CANDIDATE: str = "CANDIDATE" COMMUNITY: str = "COMMUNITY" PROTOTYPES: str = "PROTOTYPES"
N, M = list(map(int, input().split())) # N, M = (2, 3) def simple_add(n, m): if m == 0: return n elif m > 0: return simple_add(n + m, 0) else: return simple_add(n + m, 0) print(simple_add(N, M))
qtd=int(input()) if qtd>=0 and qtd<=1000: lista=[] for a in range(0,qtd): A=int(input()) while A<0 or A>10**6: A=int(input()) lista.append(A) acessos=0 dias=0 for a in lista: acessos+=a print(a, acessos) if acessos+a<10**6: dias+=1 print(dias+1)
class person: count=0 #class attribute def __init__(self,name="bol",age=23): #constructor self.__name=name #instance attribute self.__age=age #instance attribute person.count=person.count+1 def setname(self,name): self.__name=name def getname(self): return self.__name def displayInfo(self): #method print(self.name, self.age) name=property(getname,setname) def display(str): print(str) def displaydecorator(fn): def display_wrapper(str): print('Output:', end=" ") fn(str) return display_wrapper
# # PySNMP MIB module ELTEX-IP-OSPF-IF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-IP-OSPF-IF-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:45:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint") eltMes, = mibBuilder.importSymbols("ELTEX-MES", "eltMes") eltMesOspf, = mibBuilder.importSymbols("ELTEX-MES-IP", "eltMesOspf") PortList, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "PortList") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") TimeTicks, Gauge32, ObjectIdentity, Counter32, Unsigned32, MibIdentifier, Counter64, NotificationType, ModuleIdentity, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, iso, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Gauge32", "ObjectIdentity", "Counter32", "Unsigned32", "MibIdentifier", "Counter64", "NotificationType", "ModuleIdentity", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "iso", "IpAddress") TextualConvention, DisplayString, RowStatus, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "RowStatus", "TruthValue") eltIpOspfIfTable = MibTable((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1, 2), ) if mibBuilder.loadTexts: eltIpOspfIfTable.setStatus('current') eltIpOspfIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1, 2, 1), ).setIndexNames((0, "ELTEX-IP-OSPF-IF-MIB", "eltOspfIfAddress")) if mibBuilder.loadTexts: eltIpOspfIfEntry.setStatus('current') eltOspfIfAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1, 2, 1, 1), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: eltOspfIfAddress.setStatus('current') eltOspfIfPassiveDefault = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1, 2, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: eltOspfIfPassiveDefault.setStatus('current') eltOspfIfPassiveList = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1, 2, 1, 3), PortList()).setMaxAccess("readwrite") if mibBuilder.loadTexts: eltOspfIfPassiveList.setStatus('current') eltOspfIfStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: eltOspfIfStatus.setStatus('current') mibBuilder.exportSymbols("ELTEX-IP-OSPF-IF-MIB", eltOspfIfAddress=eltOspfIfAddress, eltOspfIfPassiveDefault=eltOspfIfPassiveDefault, eltIpOspfIfTable=eltIpOspfIfTable, eltOspfIfStatus=eltOspfIfStatus, eltIpOspfIfEntry=eltIpOspfIfEntry, eltOspfIfPassiveList=eltOspfIfPassiveList)
# Crie um programa que vai ler vários números e colocar numa lista. # Depois disso, mostre: # A) quantos números foram digitados; # B) a lista de valores, ordenada de forma decrescente; # C) se o valor 5 foi digitado e não está ou não na lista. valores = [] cont = 0 while True: valores.append(int(input('Digite um número: '))) cont += 1 print('-='*20) resposta = str(input('Quer continuar? [S/N] ')).strip().upper()[0] while resposta != 'S' and resposta != 'N': resposta = str(input('Quer continuar? [S/N] ')).strip().upper()[0] if resposta == 'N': break print('-=' * 25) print(f'Lista: {valores}') print(f'Foram digitados {cont} valores.') valores.sort(reverse=True) print(f'Lista dos valores em ordem decrescente: {valores}') if 5 in valores: print('Há o valor 5 nesta lista!') else: print('Não encontrei nenhum valor 5 nesta lista.') print('-=' * 25)
# -*- coding: utf-8 -*- def main(): s = input().split() ans = list() for si in s: if '@' in si: is_at = False string = '' for sii in si: if sii == '@': if string != '': ans.append(string) string = '' is_at = True elif is_at and sii != '@': string += sii if string != '': ans.append(string) print('\n'.join(map(str, sorted(set(ans))))) if __name__ == '__main__': main()
# move.py # handles movement in the world def toRoom(server, player, command): ''' moves player from their currentRoom to newRoom ''' newRoom = None #print "cmd:" + str(command) #print "cmd0:" + str(command[0]) #print str(player.currentRoom.orderedExits) # args = <some int> if int(command[0]) <= len(player.currentRoom.orderedExits): #print player.currentRoom.orderedExits #print player.currentRoom.orderedExits[int(command[0])-1] targetRoom = player.currentRoom.orderedExits[int(command[0])-1][0] #print "tg:" + str(targetRoom) for room in server.structureManager.masterRooms: #print room.name, room.exits if room.ID == targetRoom: #print room.ID, room.exits newRoom = room #print 'nr:' + str(newRoom) + str(newRoom.exits) elif int(command[0]) > len(player.currentRoom.orderedExits): player.connection.send_cc("^! There are only " + str(len(player.currentRoom.orderedExits)) + " exits!^~\n") return # args = <exit description text> cmdStr = " ".join(command) #print "cmdStr:" + cmdStr for exit in player.currentRoom.orderedExits: if cmdStr == exit[1]: newRoom = exit[0] if newRoom != None: #print player.currentRoom.players player.currentRoom.players.remove(player) #print player.currentRoom.players #print player for plyr in player.currentRoom.players: plyr.connection.send_cc(player.name + " left.\n") for room in server.structureManager.masterRooms: if room.ID == newRoom: newRoom = room player.currentRoom = newRoom server.Renderer.roomDisplay(player.connection, player.currentRoom) for plyr in player.currentRoom.players: plyr.connection.send_cc(player.name + " entered.\n") player.currentRoom.players.append(player) else: # args does not point to an exit player.connection.send_cc("^!I am not sure where I want to go!^~\n")
# -*- coding: utf-8 -*- """Top-level package for PCap Filter.""" __author__ = """Nahuel Defossé""" __email__ = "nahuel.defosse+pip@gmail.com" __version__ = "__version__ = '0.2.1'"
#!/usr/bin/env python3 # Testing apostraphes' in single quotes # if I were to: print('he's done') # error: compiler thinks the statement # is ended at the apostraphe after 'he'. # In order to print apostraphes and other # characters like it, escape them: print('he\'s done')
# Given: A protein string P of length at most 1000 aa. # # Return: The total weight of P. Consult the monoisotopic mass table. table = {} tableFile = open("mass table.txt","r") for line in tableFile: table[line[0]]=float(line[4::].strip()) aaFile = open("input.txt","r") total = float(0) for aa in aaFile.read().replace("\n",""): total += table[aa] print("%.3f"%total)
__author__ = "xTrinch" __email__ = "mojca.rojko@gmail.com" __version__ = "0.2.21" class NotificationError(Exception): pass default_app_config = 'fcm_django.apps.FcmDjangoConfig'
''' Intuition Imagine you are writing a small compiler for your college project and one of the tasks (or say sub-tasks) for the compiler would be to detect if the parenthesis are in place or not. The algorithm we will look at in this article can be then used to process all the parenthesis in the program your compiler is compiling and checking if all the parenthesis are in place. This makes checking if a given string of parenthesis is valid or not, an important programming problem. The expressions that we will deal with in this problem can consist of three different type of parenthesis: (), {} and [] Before looking at how we can check if a given expression consisting of these parenthesis is valid or not, let us look at a simpler version of the problem that consists of just one type of parenthesis. So, the expressions we can encounter in this simplified version of the problem are e.g. https://leetcode.com/problems/valid-parentheses/solution/ ''' class Solution: def __init__(self): self.stack = [] def isValid(self, s): for i, el in enumerate(s): if el == "(" or el == "{" or el == "[": self.stack.append(el) elif el == ")" or el == "}" or el == "]": if len(self.stack) == 0: return False lastEl = self.stack[-1] if el == ")" and lastEl != "(": return False if el == "}" and lastEl != "{": return False if el == "]" and lastEl != "[": return False self.stack.pop() return len(self.stack) == 0 class Solution2(object): def isValid(self, s): while "()" in s or "{}" in s or '[]' in s: s = s.replace("()", "").replace('{}', "").replace('[]', "") return s == ''
MAX_PREFIX_LEN = 60 EXCEPTION_PREFIXES = { "1. Une attestation de la maîtrise foncière sur l'emprise de ": None, "2. Un plan de l'exploitation à une échelle adaptée à la supe": None, '3. Une note succincte indiquant la nature de la substance ex': None, '4. Pour les carrières visées à la rubrique 2510-6, la justif': None, "5. Une description des modalités d'extraction et de remise e": None, '6. Les documents et registres prévus aux articles 3.5 et 4.7': None, '7. Les résultats des dernières mesures sur les effluents et ': None, "1. Le démantèlement des installations de production d'électr": None, "2. L'excavation de la totalité des fondations, jusqu'à la ba": None, '3. La remise en état qui consiste en le décaissement des air': None, 'I. ― Les aires de chargement et de déchargement des produits': 'caps', "1. Les zones d'effets Z1 et Z2 définies par l'arrêté du 20 a": None, "2. La zone d'effets Z3 définie par l'arrêté du 20 avril 2007": None, "3. La zone d'effets Z4 définie par l'arrêté du 20 avril 2007": None, "4. La zone d'effets Z5 (ou la zone d'effets Z4 dans le cas o": None, '5. Les effets dominos de toute installation, équipement ou b': None, "1. Lorsque les distances d'éloignement mentionnées au point ": None, "1. Le flux horaire maximal en COV à l'exclusion du méthane, ": None, "2. Le flux horaire maximal en COV à l'exclusion du méthane, ": None, '1. Le contrôleur vérifie la présence des documents listés ai': None, "2. L'effectif au jour du contrôle, selon le registre, l'extr": None, "1. L'installation est maintenue en parfait état d'entretien,": None, "2. L'exploitant justifie de la lutte contre la prolifération": None, "1. Lorsqu'un forage alimente en eau l'installation, il est m": None, "2. L'exploitant dispose d'un moyen pour surveiller sa consom": None, "1. Les effluents d'élevage issus des bâtiments d'élevage et ": None, "2. L'exploitant justifie que les capacités des équipements d": None, '3. Tout écoulement direct des boues ou eaux polluées vers le': None, "1. Le niveau sonore des bruits en provenance de l'élevage ne": None, "2. L'émergence due aux bruits engendrés par l'installation r": None, 'Méthode acoustique pour le contrôle des réservoirs enterrés ': 'caps', 'Méthode hydraulique pour le contrôle des réservoirs enterrés': 'caps', "1. Il existe un mode d'élimination des bidons de désinfectan": None, "2. Le contrôleur s'assure que :": None, '1. Les surfaces effectivement épandues ;': None, '2. Hors zone vulnérable aux pollutions par les nitrates, les': None, "3. Les dates d'épandage ;": None, '4. La nature des cultures ;': None, '5. Les rendements des cultures ;': None, "6. Les volumes par nature d'effluents et les quantités d'azo": None, "7. Le mode d'épandage et le délai d'enfouissement ;": None, "8. Le traitement mis en œuvre pour atténuer les odeurs (s'il": None, '1. Cas des turbines :': None, '1. Cas des turbines.': None, '2. Cas des moteurs.': None, '2. Cas des moteurs :': None, '3. Autres appareils de combustion :': None, '1. Lorsque la puissance est inférieure à 10 MW :': None, '2. Lorsque la puissance est supérieure ou égale à 10 MW :': None, '1. Réception :': None, '2. Expédition :': None, "1. - = Courant d'électrolyse, en A": None, "1. En ce qui concerne les reptiles, les sites d'implantation": 'caps', "2. En ce qui concerne les amphibiens, l'implantation des tra": 'caps', '1. La caractérisation des sous-produits ou effluents à épand': None, '2. La liste des parcelles avec, pour chacune, son emplacemen': None, "3. L'identification des contraintes liées au milieu naturel ": None, '4. La description des caractéristiques des sols ;': None, '5. Une analyse des sols portant sur les paramètres mentionné': None, "6. La justification des doses d'apport et des fréquences d'é": None, '7. La description des modalités techniques de réalisation de': None, '8. La description des modalités de surveillance des opératio': None, '9. La définition de la périodicité des analyses et sa justif': None, 'a) Si leurs concentrations en éléments pathogènes sont supér': None, 'b) Si les teneurs en éléments-traces métalliques dans les so': None, "c) Dès lors que l'une des teneurs en éléments ou composés in": None, 'd) Dès lors que le flux, cumulé sur une durée de dix ans, ap': None, 'e) En outre, lorsque les déchets ou effluents sont épandus s': None, 'IV-1. Détail du cycle :': 'caps', "IV-1.1. Cas des machines munies d'un distillateur :": 'numeric-d2', 'IV-1.2. Cas des machines sans distillateur :': 'numeric-d2', 'IV-1.2.1. Machines en plein bain :': 'numeric-d3', 'IV-1.2.2. Machines à pulvérisation :': 'numeric-d3', 'IV-2. Température de séchage :': 'caps', 'IV-3. Distillation :': 'caps', 'IV-4. Capacité machine :': 'caps', 'V-1. Concernant les charges textiles :': 'caps', 'V-2. Concernant la machine en essais :': 'caps', 'VI-1. Préparation de la machine :': 'caps', 'VI-1.1. Les séparateurs :': 'numeric-d2', 'VI-1.2. Pot à charbons actifs :': 'numeric-d2', 'VI-1.3. Fixation de la machine :': 'numeric-d2', 'VI-2. Pesée initiale (machine) :': 'caps', 'VI-3. Pesée initiale (charge textile) :': 'caps', 'VII-1. Déroulement :': 'caps', 'VII-2. Utilisation des charges textiles :': 'caps', "VII-3. Renouvellement d'air :": 'caps', "VII-4. Opérations d'entretien :": 'caps', 'VII-4.1. Nettoyage des filtres :': 'numeric-d2', 'VII-4.2. Distillateur :': 'numeric-d2', 'VIII-1. Séparateurs :': 'caps', 'VIII-2. Pot à charbons actifs :': 'caps', 'VIII-3. Pesée de la machine :': 'caps', 'VIII-4. Prise en compte du solvant recueilli du distillateur': 'caps', 'VIII-5. Prise en compte du solvant présent dans le pot à cha': 'caps', "2. Prescriptions spécifiques à l'emploi de l'ammoniac (insta": 'roman', '1. La surface maximale des îlots au sol est de 2 500 mètres ': None, "2. Pour les stockages couverts, une surface maximale d'îlots": None, "a) Sont des réservoirs à toit fixe reliés à l'URV conforméme": None, 'b) Sont conçues avec un toit flottant (externe ou interne) d': None, "a) Reliés à une URV conformément aux dispositions de l'annex": None, "b) Equipés d'un toit flottant interne doté d'un joint primai": None, '1. Etre accrédité selon la norme NF EN ISO/CEI 17025 pour la': None, '1. Etre accrédité selon la norme NF EN ISO CEI 17025 pour la': None, "2. Respecter les limites de quantification listées à l'artic": None, 'a) Turbine ou moteur destiné uniquement à alimenter des syst': None, 'b) Turbine dont le fonctionnement est nécessaire pour assure': None, "a) Les produits composés d'une matière végétale agricole ou ": None, 'b) Les déchets ci-après :': None, 'i) Déchets végétaux agricoles et forestiers ;': None, "v) Déchets de bois, à l'exception des déchets de bois qui so": None, "1. Dispositions générales relatives à l'entretien préventif ": 'numeric-d3', "1. Dispositions générales relatives à l'entretien préventif": 'numeric-d3', "2. Entretien préventif de l'installation": 'numeric-d3', "3. Surveillance de l'installation": 'numeric-d3', '1. Actions à mener si les résultats provisoires confirmés ou': 'numeric-d3', "2. Actions à mener si les résultats d'analyse selon la norme": 'numeric-d3', '3. Actions à mener si le dénombrement des Legionella pneumop': 'numeric-d3', '4. En cas de dérives répétées, consécutives ou non, de la co': 'numeric-d3', "1. Vérification de l'installation": 'numeric-d3', '2. Carnet de suivi': 'numeric-d3', "a) Seul ou en association avec d'autres agents, sans subir d": None, 'b) Comme agent de nettoyage pour dissoudre des salissures ;': None, 'c) Comme dissolvant ;': None, 'd) Comme dispersant ;': None, 'e) Comme correcteur de viscosité ;': None, 'f) Comme correcteur de tension superficielle ;': None, 'g) Comme plastifiant ;': None, 'h) Comme agent protecteur ;': None, '1. Si le flux horaire total de COV(1) dépasse 2 kg/h, la val': 'numeric-d3', '2. Si le flux horaire total des composés organiques listés c': 'numeric-d3', '3. Substances de mentions de danger H340, H350, H350i, H360D': 'numeric-d3', "4. Mise en œuvre d'un schéma de maîtrise des émissions de CO": 'numeric-d3', '1. Oxydes de soufre (exprimés en dioxyde de soufre) : si le ': 'numeric-d3', "2. Oxydes d'azote (exprimés en dioxyde d'azote) : si le flux": 'numeric-d3', "3. Chlorure d'hydrogène et autres composés inorganiques gaze": 'numeric-d3', '4. Fluor et composés inorganiques du fluor (gaz, vésicules e': 'numeric-d3', '5. Métaux :': 'numeric-d3', '1. Rejets de cadmium, mercure et thallium, et de leurs compo': None, "2. Rejets d'arsenic, sélénium et tellure, et de leurs compos": None, '3. Rejets de plomb et de ses composés : si le flux horaire t': None, "4. Rejets d'antimoine, chrome, cobalt, cuivre, étain, mangan": None, "1. Si la quantité d'explosif susceptible d'être présente dan": None, "2. Si la quantité d'explosif susceptible d'être présente est": None, '1. La surface des cellules peut dépasser 12 000 m2 si leurs ': None, '2. La hauteur des cellules peut dépasser 23 m si leurs surfa': None, '1. Soit des échantillonneurs monoflacons fixes ou portatifs ': None, '2. Soit des échantillonneurs multiflacons fixes ou portatifs': None, '1. Justesse et répétabilité du volume prélevé (volume minima': None, "2. Vitesse de circulation de l'effluent dans les tuyaux supé": None, 'a) Aucune des moyennes arithmétiques de tous les relevés eff': None, "b) Aucune des moyennes horaires n'est supérieure à 1,5 fois ": None, 'a) La moyenne de toutes les valeurs de mesure ne dépasse pas': None, 'a) turbine ou moteur destiné uniquement à alimenter des syst': None, 'b) turbine dont le fonctionnement est nécessaire pour assure': None, "a) les produits composés d'une matière végétale agricole ou ": None, 'b) les déchets ci-après :': None, 'i) déchets végétaux agricoles et forestiers ;': None, "v) déchets de bois, à l'exception des déchets de bois qui so": None, '1° Surface maximale des îlots au sol : 500 m2 ;': None, '2° Hauteur maximale de stockage : 8 mètres maximum ;': None, '3° Largeurs des allées entre îlots : 2 mètres minimum.': None, '1° Hauteur maximale de stockage : 10 mètres maximum ;': None, '2° Largeurs des allées entre ensembles de rayonnages ou de p': None, '7.7 Epandage': 'numeric-d2', 'D.1. Les apports de phosphore et de potasse, organique et mi': 'caps', "D.2. Les cendres ne contiennent pas d'éléments ou substances": 'caps', "D.3. Un programme prévisionnel annuel d'épandage est établi,": 'caps', "D.4. L'épandage des cendres est mis en œuvre afin que les nu": 'caps', 'D.5. Sous réserve des prescriptions fixées en application de': 'caps', "D.6. Les périodes d'épandage et les quantités épandues sont ": 'caps', 'D.7. Toute anomalie constatée sur les sols, les cultures et ': 'caps', "E.1. Les ouvrages permanents d'entreposage des cendres sont ": 'caps', "E.2. Le dépôt temporaire de déchets, sur les parcelles d'épa": 'caps', 'G.1. Des analyses sont effectuées, sur un échantillonnage re': 'caps', 'G.2. Seuils en éléments-traces métalliques et en substances ': 'caps', "G.3. Les méthodes d'échantillonnage et d'analyse sont défini": 'caps', "G.3. Les méthodes d'échantillonnage et d'analyse s'appuient ": 'caps', '22-3. La hauteur des parois des rétentions est au minimum de': 'numeric-d3-dash', '22-4. La distance entre les parois de la rétention et la par': 'numeric-d3-dash', '22-5. Dans tous les cas, la surface nette (réservoirs déduit': 'numeric-d3-dash', "22-6. Les rétentions sont accessibles aux moyens d'extinctio": 'numeric-d3-dash', '22-8. Une pompe de liquides inflammables peut être placée da': 'numeric-d3-dash', "22-9. Lorsqu'une perte de confinement sur un réservoir peut ": 'numeric-d3-dash', "22-10. A l'exception du point 22-9 du présent arrêté, les di": 'numeric-d3-dash', 'Art. 2.1. - Au sens du présent arrêté on entend par :': 'roman', "Art. 2.2. - I. - Le pétitionnaire et l'exploitant sont tenus": 'roman', "Art. 2.3. - I. - L'exploitant tient à la disposition de l'in": 'roman', 'Art. 4-1.-I.-Afin de satisfaire au premier alinéa du présent': 'roman-dash', 'Art. 4-2.-I.-Afin de satisfaire au premier alinéa du présent': 'roman-dash', 'Art. 4-3.-Les règles applicables aux avis conformes du minis': 'roman-dash', 'a) Dans tous les cas, avant rejet au milieu naturel ou dans ': None, "b) Dans le cas de rejet dans un réseau d'assainissement coll": None, 'c) Dans le cas de rejet dans le milieu naturel (ou dans un r': None, "a) Des prises d'eau, poteaux ou bouches d'incendie normalisé": None, "b) Des réserves d'eau, réalimentées ou non, disponibles pour": None, "I. - Tout stockage d'un liquide susceptible de créer une pol": None, "II. - La capacité de rétention est étanche aux produits qu'e": None, "III. - Lorsque les stockages sont à l'air libre, les rétenti": None, 'IV. - Le sol des aires et des locaux de stockage ou de manip': None, 'V. - Les dispositions des points I à III ne sont pas applica': None, "I. - La vitesse d'éjection des effluents gazeux en marche co": None, 'II. - Dans le cas de mesures périodiques, la moyenne de tout': None, '2.10 Cuvettes de rétention': 'numeric-d2', }
kDragAttributeFromAE = [] kIncompatibleAttribute = [] kInvalidAttribute = [] kLayer = []
DOTNETIMPL = { "mono": None, "core": None, "net": None, } DOTNETOS = { "darwin": "@bazel_tools//platforms:osx", "linux": "@bazel_tools//platforms:linux", "windows": "@bazel_tools//platforms:windows", } DOTNETARCH = { "amd64": "@bazel_tools//platforms:x86_64", } DOTNETIMPL_OS_ARCH = ( ("mono", "darwin", "amd64"), ("mono", "linux", "amd64"), ("mono", "windows", "amd64"), ("core", "darwin", "amd64"), ("core", "linux", "amd64"), ("core", "windows", "amd64"), ("net", "windows", "amd64"), ) def declare_config_settings(): for impl in DOTNETIMPL: native.config_setting( name = impl, #constraint_values = ["//dotnet/toolchain:" + impl], values = { "compilation_mode": impl } ) for os in DOTNETOS: native.config_setting( name = os, constraint_values = ["//dotnet/toolchain:" + os], ) for arch in DOTNETARCH: native.config_setting( name = arch, constraint_values = ["//dotnet/toolchain:" + arch], ) for impl, os, arch in DOTNETIMPL_OS_ARCH: native.config_setting( name = impl + "_" + os + "_" + arch, constraint_values = [ "//dotnet/toolchain:" + os, "//dotnet/toolchain:" + arch, "//dotnet/toolchain:" + impl, ], )
def cheese_and_crackers(cheese_count, boxes_of_crackers): print("You have ", cheese_count, "cheese!") print("you have ", boxes_of_crackers," boxes of crackers!") print("Man that's enough for a party!") print("Get a blamnket.\n") print("We can just give the function numbers directly:") cheese_and_crackers(20,30) print("Or we can use variables from our script :") amount_of_cheese = 10 amount_of_crackers = 50 cheese_and_crackers(amount_of_cheese, amount_of_crackers) print("we can even do match inside too:") cheese_and_crackers(10 + 20 , 5 + 6) print("And we can combine the two ,variables and match:") cheese_and_crackers(amount_of_cheese + 100 , amount_of_crackers - 1000)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/2/14 16:57 # @Author : Baimohan/PH # @Site : https://github.com/BaiMoHan # @File : function_return_test.py # @Software: PyCharm def get_math_func(types): # python支持在函数内定义函数为局部函数,局部函数对外隐藏 # 定义一个计算平方的局部函数 def square(n): return n ** 2 # 定义一个计算立方的局部函数 def cub(n): return n ** 3 # 定义一个计算阶乘的局部函数 def factorial(n): result = 1 for index in range(2, n + 1): result *= index return result # 调用局部函数 if types == 'square': return square elif types == 'cub': return cub else: return factorial if __name__ == '__main__': math_func = get_math_func('cub') # 程序返回一个嵌套函数 # print(math_func) <function get_math_func.<locals>.cub at 0x0000013E3F41C318> print(math_func(5)) math_func = get_math_func('square') print(math_func(5)) math_func = get_math_func('') print(math_func(5))
x=100 text="python tutorial" print(x) print(text) # Assign values to multiple variables x,y,z=10,20,30 print(x) print(y) print(z)
p = [0, 4, 8, 6, 2, 10, 100000000] s=[] d = {} rem=10 for i in p: if i in d: d[i] += 1 else: d[i] = 1 for i in range(0,rem/2+1): if i in d: pair = [i, rem-i] if pair[0]==pair[1] and d[i]>=2: s.append(pair) elif pair[1] in d: s.append(pair) print(s) ####################################################################################### ####################################################################################### rem55 = set() golden_val = 10 # The diff we want result = set() for ele in p: if ele in rem55: result.add((ele, golden_val-ele)) rem55.add(golden_val-ele) print(result)
totais = list() pares = list() impares = list() while True: r = '0' totais.append(int(input('Digite um valor'))) while r not in 'SsNn': r = str(input('Quer continuar? S/N')).strip()[0] if r in 'Nn': break for c in range(0, len(totais)): if totais[c] % 2 == 0: pares.append(totais[c]) else: impares.append(totais[c]) print('Todos: ', totais) print('Pares: ', pares) print('Ímpares: ', impares)
class Solution(object): def wordPattern(self, pattern, str): dic = {} dic2 = {} words = str.split(" ") if len(pattern) != len(words): return False i = 0 for cha in pattern: if cha in dic.keys(): if dic[cha] != words[i]: return False else: dic[cha] = words[i] i += 1 i = 0 for word in words: if word in dic2.keys(): if dic2[word] != pattern[i]: return False else: dic2[word] = pattern[i] i += 1 return True solution = Solution() print(solution.wordPattern("abba", "dog cat cat dog")) print(solution.wordPattern("abba", "dog cat cat fish")) print(solution.wordPattern("aaaa", "dog cat cat dog")) print(solution.wordPattern("abba", "dog dog dog dog"))
class Solution: def lastStoneWeight(self, stones: List[int]) -> int: while len(stones) > 1: stones.sort() a = stones.pop() b = stones.pop() last = a - b if last: stones.append(last) return stones[0] if stones else 0
class MyHashSet: def __init__(self): self.buckets = [] def hash(self, key: int) -> str: return chr(key) def add(self, key: int) -> None: val = self.hash(key) if val not in self.buckets: self.buckets.append(val) def remove(self, key: int) -> None: val = self.hash(key) if val in self.buckets: self.buckets.remove(val) def contains(self, key: int) -> bool: return self.hash(key) in self.buckets class MyHashMap: def __init__(self): self.buckets = [] @property def keys(self) -> list: return [x[0] for x in self.buckets] def put(self, key: int, value: int) -> None: if key in self.keys: index = 0 for bucket in self.buckets: if bucket[0] == key: self.buckets[index] = (key, value) break index += 1 else: self.buckets.append((key, value)) def get(self, key: int) -> int: if key in self.keys: for bucket in self.buckets: if bucket[0] == key: return bucket[1] else: return -1 def remove(self, key: int) -> None: if key in self.keys: for bucket in self.buckets: if bucket[0] == key: val = (bucket[0], bucket[1]) break self.buckets.remove(val)
def min_number(num_list): min_num = None for num in num_list: if min_num is None or min_num > num: min_num = num return min_num
# Copyright © 2019 Province of British Columbia # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an 'AS IS' BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Model helper utilities for processing search query and search detail requests. Search constants and helper functions. """ # flake8: noqa Q000,E122,E131 # Disable Q000: Allow query strings to be in double quotation marks that contain single quotation marks. # Disable E122: allow query strings to be more human readable. # Disable E131: allow query strings to be more human readable. GET_DETAIL_DAYS_LIMIT = 7 # Number of days in the past a get details request is allowed. # Maximum number of days in the past to filter when fetching account search history: set to <= 0 to disable. GET_HISTORY_DAYS_LIMIT = -1 # Account search history max result set size. ACCOUNT_SEARCH_HISTORY_MAX_SIZE = 1000 # Maximum number or results returned by search. SEARCH_RESULTS_MAX_SIZE = 1000 # Result set size limit clause RESULTS_SIZE_LIMIT_CLAUSE = 'FETCH FIRST :max_results_size ROWS ONLY' # Serial number search base where clause SERIAL_SEARCH_BASE = """ SELECT r.registration_type,r.registration_ts AS base_registration_ts, sc.serial_type,sc.serial_number,sc.year,sc.make,sc.model, r.registration_number AS base_registration_num, CASE WHEN serial_number = :query_value THEN 'EXACT' ELSE 'SIMILAR' END match_type, fs.expire_date,fs.state_type,sc.id AS vehicle_id, sc.mhr_number FROM registrations r, financing_statements fs, serial_collateral sc WHERE r.financing_id = fs.id AND r.registration_type_cl IN ('PPSALIEN', 'MISCLIEN', 'CROWNLIEN') AND r.base_reg_number IS NULL AND (fs.expire_date IS NULL OR fs.expire_date > ((now() at time zone 'utc') - interval '30 days')) AND NOT EXISTS (SELECT r3.id FROM registrations r3 WHERE r3.financing_id = fs.id AND r3.registration_type_cl = 'DISCHARGE' AND r3.registration_ts < ((now() at time zone 'utc') - interval '30 days')) AND sc.financing_id = fs.id AND sc.registration_id_end IS NULL """ # Equivalent logic as DB view search_by_reg_num_vw, but API determines the where clause. REG_NUM_QUERY = """ SELECT r2.registration_type, r2.registration_ts AS base_registration_ts, r2.registration_number AS base_registration_num, 'EXACT' AS match_type, fs.state_type, fs.expire_date FROM registrations r, financing_statements fs, registrations r2 WHERE r.financing_id = fs.id AND r2.financing_id = fs.id AND r2.registration_type_cl IN ('PPSALIEN', 'MISCLIEN', 'CROWNLIEN') AND r.registration_number = :query_value AND (fs.expire_date IS NULL OR fs.expire_date > ((now() at time zone 'utc') - interval '30 days')) AND NOT EXISTS (SELECT r3.id FROM registrations r3 WHERE r3.financing_id = fs.id AND r3.registration_type_cl = 'DISCHARGE' AND r3.registration_ts < ((now() at time zone 'utc') - interval '30 days')) """ # Equivalent logic as DB view search_by_mhr_num_vw, but API determines the where clause. MHR_NUM_QUERY = SERIAL_SEARCH_BASE + \ " AND sc.serial_type = 'MH' " + \ "AND sc.mhr_number = (SELECT searchkey_mhr(:query_value)) " + \ "ORDER BY match_type, r.registration_ts ASC " + RESULTS_SIZE_LIMIT_CLAUSE # Equivalent logic as DB view search_by_serial_num_vw, but API determines the where clause. SERIAL_NUM_QUERY = SERIAL_SEARCH_BASE + \ " AND sc.serial_type NOT IN ('AC', 'AF', 'AP') " + \ "AND sc.srch_vin = (SELECT searchkey_vehicle(:query_value)) " + \ "ORDER BY match_type, sc.serial_number " + RESULTS_SIZE_LIMIT_CLAUSE # Equivalent logic as DB view search_by_aircraft_dot_vw, but API determines the where clause. AIRCRAFT_DOT_QUERY = SERIAL_SEARCH_BASE + \ " AND sc.serial_type IN ('AC', 'AF', 'AP') " + \ "AND sc.srch_vin = (SELECT searchkey_aircraft(:query_value)) " + \ "ORDER BY match_type, sc.serial_number " + RESULTS_SIZE_LIMIT_CLAUSE BUSINESS_NAME_QUERY = """ SELECT r.registration_type,r.registration_ts AS base_registration_ts, p.business_name, r.registration_number AS base_registration_num, CASE WHEN p.business_name = :query_bus_name THEN 'EXACT' ELSE 'SIMILAR' END match_type, fs.expire_date,fs.state_type,p.id FROM registrations r, financing_statements fs, parties p WHERE r.financing_id = fs.id AND r.registration_type_cl IN ('PPSALIEN', 'MISCLIEN', 'CROWNLIEN') AND r.base_reg_number IS NULL AND (fs.expire_date IS NULL OR fs.expire_date > ((now() at time zone 'utc') - interval '30 days')) AND NOT EXISTS (SELECT r3.id FROM registrations r3 WHERE r3.financing_id = fs.id AND r3.registration_type_cl = 'DISCHARGE' AND r3.registration_ts < ((now() at time zone 'utc') - interval '30 days')) AND p.financing_id = fs.id AND p.registration_id_end IS NULL AND p.party_type = 'DB' AND (SELECT searchkey_business_name(:query_bus_name)) <% p.business_srch_key AND word_similarity(p.business_srch_key, (SELECT searchkey_business_name(:query_bus_name))) >= .60 ORDER BY match_type, p.business_name """ + RESULTS_SIZE_LIMIT_CLAUSE INDIVIDUAL_NAME_QUERY = """ SELECT r.registration_type,r.registration_ts AS base_registration_ts, p.last_name,p.first_name,p.middle_initial,p.id, r.registration_number AS base_registration_num, CASE WHEN p.last_name = :query_last AND p.first_name = :query_first THEN 'EXACT' ELSE 'SIMILAR' END match_type, fs.expire_date,fs.state_type, p.birth_date FROM registrations r, financing_statements fs, parties p WHERE r.financing_id = fs.id AND r.registration_type_cl IN ('PPSALIEN', 'MISCLIEN', 'CROWNLIEN') AND r.base_reg_number IS NULL AND (fs.expire_date IS NULL OR fs.expire_date > ((now() at time zone 'utc') - interval '30 days')) AND NOT EXISTS (SELECT r3.id FROM registrations r3 WHERE r3.financing_id = fs.id AND r3.registration_type_cl = 'DISCHARGE' AND r3.registration_ts < ((now() at time zone 'utc') - interval '30 days')) AND p.financing_id = fs.id AND p.registration_id_end IS NULL AND p.party_type = 'DI' AND p.id IN (SELECT * FROM unnest(match_individual_name(:query_last, :query_first))) ORDER BY match_type, p.last_name, p.first_name """ + RESULTS_SIZE_LIMIT_CLAUSE INDIVIDUAL_NAME_MIDDLE_QUERY = """ SELECT r.registration_type,r.registration_ts AS base_registration_ts, p.last_name,p.first_name,p.middle_initial,p.id, r.registration_number AS base_registration_num, CASE WHEN p.last_name = :query_last AND p.first_name = :query_first AND p.middle_initial = :query_middle THEN 'EXACT' ELSE 'SIMILAR' END match_type, fs.expire_date,fs.state_type, p.birth_date FROM registrations r, financing_statements fs, parties p WHERE r.financing_id = fs.id AND r.registration_type_cl IN ('PPSALIEN', 'MISCLIEN', 'CROWNLIEN') AND r.base_reg_number IS NULL AND (fs.expire_date IS NULL OR fs.expire_date > ((now() at time zone 'utc') - interval '30 days')) AND NOT EXISTS (SELECT r3.id FROM registrations r3 WHERE r3.financing_id = fs.id AND r3.registration_type_cl = 'DISCHARGE' AND r3.registration_ts < ((now() at time zone 'utc') - interval '30 days')) AND p.financing_id = fs.id AND p.registration_id_end IS NULL AND p.party_type = 'DI' AND p.id IN (SELECT * FROM unnest(match_individual_name(:query_last, :query_first))) ORDER BY match_type, p.last_name, p.first_name """ + RESULTS_SIZE_LIMIT_CLAUSE # Total result count queries for serial number, debtor name searches: BUSINESS_NAME_TOTAL_COUNT = """ SELECT COUNT(r.id) AS query_count FROM registrations r, financing_statements fs, parties p WHERE r.financing_id = fs.id AND r.registration_type_cl IN ('PPSALIEN', 'MISCLIEN', 'CROWNLIEN') AND r.base_reg_number IS NULL AND (fs.expire_date IS NULL OR fs.expire_date > ((now() at time zone 'utc') - interval '30 days')) AND NOT EXISTS (SELECT r3.id FROM registrations r3 WHERE r3.financing_id = fs.id AND r3.registration_type_cl = 'DISCHARGE' AND r3.registration_ts < ((now() at time zone 'utc') - interval '30 days')) AND p.financing_id = fs.id AND p.registration_id_end IS NULL AND p.party_type = 'DB' AND (SELECT searchkey_business_name(:query_bus_name)) <% p.business_srch_key AND word_similarity(p.business_srch_key, (SELECT searchkey_business_name(:query_bus_name))) >= .60 """ INDIVIDUAL_NAME_TOTAL_COUNT = """ SELECT COUNT(r.id) AS query_count FROM registrations r, financing_statements fs, parties p WHERE r.financing_id = fs.id AND r.registration_type_cl IN ('PPSALIEN', 'MISCLIEN', 'CROWNLIEN') AND r.base_reg_number IS NULL AND (fs.expire_date IS NULL OR fs.expire_date > ((now() at time zone 'utc') - interval '30 days')) AND NOT EXISTS (SELECT r3.id FROM registrations r3 WHERE r3.financing_id = fs.id AND r3.registration_type_cl = 'DISCHARGE' AND r3.registration_ts < ((now() at time zone 'utc') - interval '30 days')) AND p.financing_id = fs.id AND p.registration_id_end IS NULL AND p.party_type = 'DI' AND p.id IN (SELECT * FROM unnest(match_individual_name(:query_last, :query_first))) """ SERIAL_SEARCH_COUNT_BASE = """ SELECT COUNT(r.id) AS query_count FROM registrations r, financing_statements fs, serial_collateral sc WHERE r.financing_id = fs.id AND r.registration_type_cl IN ('PPSALIEN', 'MISCLIEN', 'CROWNLIEN') AND r.base_reg_number IS NULL AND (fs.expire_date IS NULL OR fs.expire_date > ((now() at time zone 'utc') - interval '30 days')) AND NOT EXISTS (SELECT r3.id FROM registrations r3 WHERE r3.financing_id = fs.id AND r3.registration_type_cl = 'DISCHARGE' AND r3.registration_ts < ((now() at time zone 'utc') - interval '30 days')) AND sc.financing_id = fs.id AND sc.registration_id_end IS NULL """ MHR_NUM_TOTAL_COUNT = SERIAL_SEARCH_COUNT_BASE + \ " AND sc.serial_type = 'MH' " + \ "AND sc.mhr_number = searchkey_mhr(:query_value)" SERIAL_NUM_TOTAL_COUNT = SERIAL_SEARCH_COUNT_BASE + \ " AND sc.serial_type NOT IN ('AC', 'AF') " + \ "AND sc.srch_vin = searchkey_vehicle(:query_value)" AIRCRAFT_DOT_TOTAL_COUNT = SERIAL_SEARCH_COUNT_BASE + \ " AND sc.serial_type IN ('AC', 'AF') " + \ "AND sc.srch_vin = searchkey_aircraft(:query_value)" COUNT_QUERY_FROM_SEARCH_TYPE = { 'AC': AIRCRAFT_DOT_TOTAL_COUNT, 'BS': BUSINESS_NAME_TOTAL_COUNT, 'IS': INDIVIDUAL_NAME_TOTAL_COUNT, 'MH': MHR_NUM_TOTAL_COUNT, 'SS': SERIAL_NUM_TOTAL_COUNT } ACCOUNT_SEARCH_HISTORY_DATE_QUERY = \ 'SELECT sc.id, sc.search_ts, sc.api_criteria, sc.total_results_size, sc.returned_results_size,' + \ 'sr.exact_match_count, sr.similar_match_count ' + \ 'FROM search_requests sc, search_results sr ' + \ 'WHERE sc.id = sr.search_id ' + \ "AND sc.account_id = '?' " + \ "AND sc.search_ts > ((now() at time zone 'utc') - interval '" + str(GET_HISTORY_DAYS_LIMIT) + " days') " + \ 'ORDER BY sc.search_ts DESC ' + \ 'FETCH FIRST ' + str(ACCOUNT_SEARCH_HISTORY_MAX_SIZE) + ' ROWS ONLY' ACCOUNT_SEARCH_HISTORY_QUERY = \ 'SELECT sc.id, sc.search_ts, sc.api_criteria, sc.total_results_size, sc.returned_results_size,' + \ 'sr.exact_match_count, sr.similar_match_count ' + \ 'FROM search_requests sc, search_results sr ' + \ 'WHERE sc.id = sr.search_id ' + \ "AND sc.account_id = '?' " + \ 'ORDER BY sc.search_ts DESC ' + \ 'FETCH FIRST ' + str(ACCOUNT_SEARCH_HISTORY_MAX_SIZE) + ' ROWS ONLY'
def pytest_addoption(parser): group = parser.getgroup("pypyjit options") group.addoption("--pypy", action="store", default=None, dest="pypy_c", help="the location of the JIT enabled pypy-c")
# @Time : 2019/6/1 23:01 # @Author : shakespere # @FileName: Sort Colors.py ''' 75. Sort Colors Medium 1623 156 Favorite Share Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively. Note: You are not suppose to use the library's sort function for this problem. Example: Input: [2,0,2,1,1,0] Output: [0,0,1,1,2,2] Follow up: A rather straight forward solution is a two-pass algorithm using counting sort. First, iterate the array counting number of 0's, 1's, and 2's, then overwrite array with total number of 0's, then 1's and followed by 2's. Could you come up with a one-pass algorithm using only constant space? ''' class Solution(object): def sortColors(self, nums): """ :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. """ i, p0, p2 = 0, 0, len(nums) - 1 while i <= p2: if nums[i] == 0: nums[p0], nums[i] = nums[i], nums[p0] p0 += 1 i += 1 elif nums[i] == 2: nums[p2], nums[i] = nums[i], nums[p2] p2 -= 1 else: i += 1 return nums
expected_output = { "interfaces": { "Port-channel20": { "description": "distacc Te1/1/1, Te2/1/1", "switchport_trunk_vlans": "9,51", "switchport_mode": "trunk", "ip_arp_inspection_trust": True, "ip_dhcp_snooping_trust": True, }, "GigabitEthernet0/0": { "vrf": "Mgmt-vrf", "shutdown": True, "negotiation_auto": True, }, "GigabitEthernet1/0/1": { "description": "unknown DA", "switchport_access_vlan": "51", "switchport_mode": "access", "spanning_tree_portfast": True, "ip_dhcp_snooping_limit_rate": "10", }, "GigabitEthernet1/0/2": { "description": "DA1202B_21_13 ap-100", "switchport_access_vlan": "51", "switchport_mode": "access", "spanning_tree_portfast": True, "ip_dhcp_snooping_limit_rate": "10", }, } }
# -*- coding: utf-8 -*- """ Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and its coefficient. If there is no solution for the equation, return "No solution". If there are infinite solutions for the equation, return "Infinite solutions". If there is exactly one solution for the equation, we ensure that the value of x is an integer. Example 1: Input: "x+5-3+x=6+x-2" Output: "x=2" Example 2: Input: "x=x" Output: "Infinite solutions" Example 3: Input: "2x=x" Output: "x=0" Example 4: Input: "2x+3x-6x=x+2" Output: "x=-1" Example 5: Input: "x=x+2" Output: "No solution" """ class Solution(object): def solveEquation(self, equation): """ :type equation: str :rtype: str """ def parse(exp): if not exp: return None, None a, b = 0, 0 # ax+b expLen = len(exp) l = 0 add = True for r, ch in enumerate(exp): if ch in {'-', '+'}: if r > 0 and exp[r - 1] == 'x': if add: a += int(exp[l:r - 1]) if l < r - 1 else 1 else: a -= int(exp[l:r - 1]) if l < r - 1 else 1 else: if add: b += int(exp[l:r]) if l < r else 0 else: b -= int(exp[l:r]) if l < r else 0 if ch == '-': add = False l = r + 1 elif ch == '+': add = True l = r + 1 if exp[-1] == 'x': if add: a += int(exp[l:expLen - 1]) if l < expLen - 1 else 1 else: a -= int(exp[l:expLen - 1]) if l < expLen - 1 else 1 else: if add: b += int(exp[l:]) if l < expLen else 0 else: b -= int(exp[l:]) if l < expLen else 0 return a, b left, right = equation.split('=') a, b = parse(left) c, d = parse(right) if a == c: if b != d: return "No solution" else: return "Infinite solutions" return 'x=%d' % ((d - b) // (a - c)) s = Solution() print(s.solveEquation("-x=-1")) print(s.solveEquation("x+5-3+x=6+x-2")) print(s.solveEquation("x=x")) print(s.solveEquation("2x=x")) print(s.solveEquation("2x+3x-6x=x+2")) print(s.solveEquation("x=x+2"))
#SKill : array iteration #A UTF-8 character encoding is a variable width character encoding # that can vary from 1 to 4 bytes depending on the character. The structure of the encoding is as follows: #1 byte: 0xxxxxxx #2 bytes: 110xxxxx 10xxxxxx #3 bytes: 1110xxxx 10xxxxxx 10xxxxxx #4 bytes: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx #For more information, you can read up on the Wikipedia Page. #Given a list of integers where each integer represents 1 byte, return whether or not the list of integers is a valid UTF-8 encoding. #Analysis # State machine # check pattern in sequence # from 4 byte to 1 byte pattern # For first byte, XOR(first byte, 4 byte mask) = value.... # if value <= 1<<3, match, otherwise, not match and try 3 byte to 1 byte mask # if it is N byte, check consecutive N-1 byte , if match XOR (byte, b10000000), if value < 1<<6, match... otherwise not match BYTE_MASKS = [ None, 0b10000000, 0b11100000, 0b11110000, 0b11111000, ] BYTE_EQUAL = [ None, 0b00000000, 0b11000000, 0b11100000, 0b11110000, ] def utf8_validator(bytes): numOfBytes = 4 cnt=0 while cnt < len(bytes): while numOfBytes>0: value = bytes[cnt] & BYTE_MASKS[numOfBytes] if value == BYTE_EQUAL[numOfBytes]: break else: numOfBytes -= 1 i = 0 if numOfBytes < 1: return False if numOfBytes + cnt > len(bytes): return False cnt += 1 while i < numOfBytes-1: value = bytes[cnt + i] ^ 0b10000000 if value < 1<<6: i +=1 else: return False cnt += (numOfBytes-1) numOfBytes = 4 return True if __name__ == "__main__": print(utf8_validator([0b11000000, 0b10000000, 0b00000000])) # True print(utf8_validator([0b11000000, 0b00000000])) # False print (utf8_validator([0b11000000, 0b10000000])) # True print (utf8_validator([0b00000000])) # True print (utf8_validator([0b00000000, 0b10000000])) # False
# Дано натуральное число. Выведите его последнюю цифру. num = int(input()) print(num % 10)
ES_HOST = 'localhost' ES_PORT = 9200 BULK_MAX_OPS_CNT = 1000 INDEX_NAME = 'cosc488' INDEX_SETTINGS_FP = 'properties/index_settings.json' DATA_DIR = 'data/docs' QUERIES_FP = 'data/queryfile.txt' QRELS_FP = 'data/qrel.txt' TRECEVAL_FP = 'bin/trec_eval'
prev = None def check_bst(root): if not root: return True ans = check_bst(root.left) if ans == False: return False if prev and root.value < prev: return False global prev prev = root return check_bst(root.right)
#!/usr/bin/python3.5 class MyClass: "This is a class" a = 10; def func(self): print('Hello World'); return 3; def my_function(a: MyClass): return a.func(); def other_function(b: my_function): a = MyClass(); return my_function(a); def object_function(obj: object): return 3;
### PROBLEM 1 def main(): print("Name: Shaymae Senhaji") print("Favorite Food: Brie Cheese") print("Favorite Color: Red") print("Favorite Hobby: Traveling") if __name__ == "__main__": main() #Name: Shaymae Senhaji #Favorite Food: Brie Cheese #Favorite Color: Red #Favorite Hobby: Traveling
''' Este snipet tiene como propósito dejar por escrito el uso del patrón de diseño de Visitors ''' class House(object): #The class being visited def accept(self, visitor): """Interface to accept a visitor""" visitor.visit(self) #Triggers the visiting operation! def work_on_hvac(self, hvac_specialist): print(self, "worked on by", hvac_specialist) #Note that we now have a reference to the HVAC specialist object in the house object! def work_on_electricity(self, electrician): print(self, "worked on by", electrician) #Note that we now have a reference to the electrician object in the house object! def __str__(self): """Simply return the class name when the House object is printed""" return self.__class__.__name__ class Visitor(object): """Abstract visitor""" def __str__(self): """Simply return the class name when the Visitor object is printed""" return self.__class__.__name__ class HvacSpecialist(Visitor): #Inherits from the parent class, Visitor """Concrete visitor: HVAC specialist""" def visit(self, house): house.work_on_hvac(self) #Note that the visitor now has a reference to the house object class Electrician(Visitor): #Inherits from the parent class, Visitor """Concrete visitor: electrician""" def visit(self, house): house.work_on_electricity(self) #Note that the visitor now has a reference to the house object #Create an HVAC specialist hv = HvacSpecialist() #Create an electrician e = Electrician() #Create a house home = House() #Let the house accept the HVAC specialist and work on the house by invoking the visit() method home.accept(hv) #Let the house accept the electrician and work on the house by invoking the visit() method home.accept(e)
corr_data = df_train[['Id', 'MSSubClass', 'LotFrontage', 'LotArea', 'OverallQual', 'OverallCond', 'YearBuilt', 'YearRemodAdd', 'MasVnrArea', 'BsmtFinSF1', 'BsmtFinSF2', 'BsmtUnfSF', 'TotalBsmtSF', '1stFlrSF', '2ndFlrSF', 'LowQualFinSF', 'GrLivArea', 'BsmtFullBath', 'BsmtHalfBath', 'FullBath', 'HalfBath', 'BedroomAbvGr', 'KitchenAbvGr', 'TotRmsAbvGrd', 'Fireplaces', 'GarageYrBlt', 'GarageCars', 'GarageArea', 'WoodDeckSF', 'OpenPorchSF', 'EnclosedPorch', '3SsnPorch', 'ScreenPorch', 'PoolArea', 'MiscVal', 'MoSold', 'YrSold', 'SalePrice']] colormap = plt.cm.PuBu sns.set(font_scale=1.0) f, ax = plt.subplots(figsize=(14, 12)) plt.title('Correlation of Numeric Features with Sale Price', y=1, size=18) sns.heatmap(corr_data.corr(), square=True, linewidths=0.1, cmap=colormap, linecolor="white", vmax=0.8) # Heat Map은 seaborn 덕분에 직관적으로 이해가 가능하여 변수 간 상관관계에 대하여 쉽게 알 수 있습니다. # 또한 변수 간 다중 공선성을 감지하는 데 유용합니다. # 대각선 열을 제외한 박스 중 가장 진한 파란색을 띄는 박스가 보입니다. # 첫 번째는 'TotalBsmtSF'와 '1stFlrSF'변수의 관계입니다. # 두 번째는 'Garage'와 관련한 변수를 나타냅니다. # 두 경우 모두 변수 사이의 상관 관계가 너무 강하여 다중 공선성(MultiColarisity) 상황이 나타날 수 있습니다. # 변수가 거의 동일한 정보를 제공하므로 다중 공선성이 실제로 발생한다는 결론을 내릴 수 있습니다. # 또한 확인해야할 부분은 'SalePrice'와의 상관 관계입니다. # 'GrLivArea', 'TotalBsmtSF'및 'OverallQual'은 큰 관계를 보입니다. # 나머지 변수와의 상관 관계를 자세히 알아보기 위해 Zoomed Heat Map을 확인합니다.
def getProgress(current, length): """This function formats a progress bar string for print out during a for loop execution. Currently, this uses 2% increments. Adjusting the inc variable to N will change increments to 1/N.""" inc = 50 n_bars = int(round(current*inc/length,1)) rem = inc - n_bars progress = '[' + '#'*n_bars + rem * ' ' + ']' + ' {}% Done'.format(round(current*100/length)) print(progress, end = '\r') create_table1 = """CREATE TABLE WHERE_SESSIONID_ITEM ( session_id int, item_in_session int, artist_name text, song_name text, song_length float, PRIMARY KEY (session_id, item_in_session,artist_name,song_name) );""" table1_message = "SUCCESS: Created table to retrieve the artist, song title and song's length in the music app history queried by sessionId and itemInSession." drop_table1 = "DROP TABLE IF EXISTS WHERE_SESSIONID_ITEM;" def query_table1(session_id, item_in_session): """ This function returns the SQL neccessary to get the artists, songs, and lengths of the songs with the specified session id passed as an argumemt and specified item in session passed as an argumemt. """ query = """select artist_name, song_name, song_length from WHERE_SESSIONID_ITEM where session_id = {} and item_in_session = {};""".format(session_id,item_in_session) return query def table1_populate(driver, data): """ This iterates through specified columns of the total dataset and inserts rows into Table 1. """ table_df = data[['sessionId','itemInSession','artist','song','length']] insert = "INSERT INTO CASS1.WHERE_SESSIONID_ITEM " insert += "(session_id,item_in_session,artist_name,song_name,song_length) " insert += "VALUES ( %s, %s, %s, %s, %s)" n_row = 0 print("Inserting {} Rows to Table 1.".format(table_df.shape[0])) for index,row in table_df.iterrows(): values = tuple(row.values.tolist()) driver.execute(insert,values) n_row += 1 #Print out Progress getProgress(n_row,table_df.shape[0]) print("\r") print(n_row, " Rows Added to Table 1: WHERE_SESSIONID_ITEM")
## Does my number look big in this? ## 6 kyu ## https://www.codewars.com/kata/5287e858c6b5a9678200083c def narcissistic(value): total = 0 for digit in str(value): total += int(digit) ** len(str(value)) return value == total
# This is the ball class that handles everything related to Balls class Ball: # The __init__ method is used to initialize class variables def __init__(self, position, velocity, acceleration): # Each ball has a position, velocity and acceleration self.position = position self.velocity = velocity self.acceleration = acceleration # The display method handles drawing the ball def display(self): noStroke() fill(255, 0, 0) ellipse(self.position.x, self.position.y, 50, 50) # The move method handles moving the Ball def move(self): # Velocity changes according to acceleration self.velocity.add(self.acceleration) # Position changes according to velocity self.position.add(self.velocity) # Reset acceleration self.acceleration.mult(0) # The add_force method adds a force to the acceleration of the Ball def add_force(self, force): self.acceleration.add(force) # check_ground checks if the ball falls off the bottom of the screen. # if it is off the screen, the ball bounces up def check_ground(self): if self.position.y > height: self.velocity.y *= -1 self.position.y = height gravity = PVector(0, 1) # creating a new ball at position 250, 250 with velocity and acceleration 0 b = Ball(PVector(250, 250), PVector(0, 0), PVector(0, 0)) def setup(): size(500, 500) def draw(): background(0) b.display() b.move() b.add_force(gravity) b.check_ground()
# # @lc app=leetcode id=75 lang=python3 # # [75] Sort Colors # class Solution: def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ a, i, b = 0, 0, len(nums) - 1 while i <= b: n_i = nums[i] if n_i == 1: i += 1 elif n_i == 0: if i > a: nums[a], nums[i] = n_i, nums[a] a += 1 i += 1 elif n_i == 2: nums[b], nums[i] = n_i, nums[b] b -= 1 else: raise RuntimeError('should not reach here')
"""All files in this module are automatically generated by hassfest. To update, run python3 -m script.hassfest """
def hashfunction(key): sum=0 for i in key: sum+=ord(i) return sum%100 hashtable=[] def insertkey(key,value): hashkey=hashfunction(key) return hashtable[hashkey].append(value)
t = int(input()) while(t!=0): count=0 n=int(input()) if n==1: print('no') else: for i in range(2,n//2): if(n%i == 0): count+=1 if(count>=1): print('no') else: print('yes') t-=1
class Solution: def romanToInt(self, s): """ :type s: str :rtype: int """ roman_int = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} s = [roman_int[x] for x in s] ans = 0 for n in range(len(s)-1): if s[n] >= s[n+1]: ans += s[n] else: ans -= s[n] ans += s[-1] return (ans)
#lrsclasses.py Langrenx=[]#狼人列表 Nvwux=[]#女巫列表 Yuyanjiax=[]#预言家列表 Shouweix=[]#守卫列表 Pingminx=[]#平民列表 Protected='' Alive=True Dead=False Players={} NvwuChance=1 class GetError: Error='None' IDto=0 class Langren: '狼人' global Langrenx number=0 def delete(name): if name in Langrenx: Langrenx.remove(name) del(Players[name]) return True else: GetError.Error='删除时出错:名称不存在' GetError.IDto=GetError.IDto+1 return False def new(name): if name in Langrenx: GetError.Error='创建时出错:名称已存在' GetError.IDto=GetError.IDto+1 return False else: Langrenx.append(name) Players[name]=True return True def kill(name): Proved=False for x in Shouwei: if Players[x]==Alive: Proved=True if Proved==True and name==Protected: GetError.Error='守护' GetError.IDto=GetError.IDto+1 return '守护' if Players[name]==Alive: Players[name]==Dead return True else: GetError.Error='尝试写入时出错:目标玩家已死' GetError.IDto=GetError.IDto+1 return False class Nvwu: '女巫' global Nvwux number=0 def delete(name): if name in Nvwux: Nvwux.remove(name) del(Players[name]) return True else: GetError.Error='删除时出错:名称不存在' GetError.IDto=GetError.IDto+1 return False def new(name): if name in Nvwux: GetError.Error='创建时出错:名称已存在' GetError.IDto=GetError.IDto+1 return False else: Nvwux.append(name) Players[name]=True return True def kill(name): #什么都没干 return True def save(name): if NvwuChance==0: GetError.Error='写入时出错:女巫机会已用完' GetError.IDto=GetError.IDto+1 return False if name in Players: if Players[name]==Dead: Players[name]=Alive return True else: GetError.Error='写入时出错:玩家还是活的,不需要救' GetError.IDto=GetError.IDto+1 return False class Yuyanjia: '预言家' def delete(name): if name in Yuyanjiax: Yuyanjiax.remove(name) del(Players[name]) return True else: GetError.Error='删除时出错:名称不存在' GetError.IDto=GetError.IDto+1 return False def new(name): if name in Yuyanjiax: GetError.Error='创建时出错:名称已存在' GetError.IDto=GetError.IDto+1 return False else: Yuyanjiax.append(name) Players[name]=True return True def know(name): return All.job(name) class Shouwei: def delete(name): if name in Shouweix: Shouweix.remove(name) del(Players[name]) return True else: GetError.Error='删除时出错:名称不存在' GetError.IDto=GetError.IDto+1 return False def new(name): if name in Shouweix: GetError.Error='创建时出错:名称已存在' GetError.IDto=GetError.IDto+1 return False else: Shouweix.append(name) Players[name]=True return True def protect(name): if name in Players: if name != Protected and Players[name]==Alive: Protected=name return True else: GetError.Error='在尝试保护的时候出错:玩家不存在或已在上一轮保护过' GetError.IDto=GetError.IDto+1 return False class Pingmin: '平民,无权限' def delete(name): if name in Pingminx: Pingminx.remove(name) del(Players[name]) return True else: GetError.Error='删除时出错:名称不存在' GetError.IDto=GetError.IDto+1 return False def new(name): if name in Pingminx: GetError.Error='创建时出错:名称已存在' GetError.IDto=GetError.IDto+1 return False else: Pingminx.append(name) Players[name]=True return True class All: '全体玩家控制' global Players def job(name): if name not in Players: GetError.Error='获取成员职务时出错:名称不存在' GetError.IDto=GetError.IDto+1 return False else: if name in Langrenx: return '狼人' elif name in Yuyanjiax: return '预言家' elif name in Pingminx: return '平民' elif name in Nvwux: return '女巫' def alive(name): if name in Players: return Players[name] else: return -1
class OrderDamageConfirmation: def __init__(self, content): self.system_seat_ids = content['systemSeatIds'] self.msg_id = content['msgId'] self.game_state_id = content['gameStateId'] self.result = content['orderDamageConfirmation']['result'] self.order_damage_type = content['orderDamageConfirmation'][ 'orderDamageType']
"""Python implementation of a Graph Data structure.""" class Graph(object): """ Graph implementation. Graph data structure supports following methods: nodes(): return a list of all nodes in the graph. edges(): return a list of all edges in the graph. add_node(n): adds a new node 'n' to the graph. add_edge(n1, n2): adds a new edge to the graph connecting 'n1' and 'n2', if either n1 or n2 are not already present in the graph, they should be added. del_node(n): deletes the node 'n' from the graph, raises an error if no such node exists. del_edge(n1, n2): deletes the edge connecting 'n1' and 'n2' from the graph, raises an error if no such edge exists. has_node(n): True if node 'n' is contained in the graph, False if not. neighbors(n): returns the list of all nodes connected to 'n' by edges, raises an error if n is not in g. adjacent(n1, n2): returns True if there is an edge connecting n1 and n2, False if not, raises an error if either of the supplied nodes are not in g. """ def __init__(self, data=None): """Initialize graph.""" self.graph = {} if data: for i in data: self.add_node(i) def nodes(self): """Return a list of all nodes in the graph.""" return list(self.graph.keys()) def edges(self): """Return a list of all edges in the graph.""" return [edge for edges in self.graph.values() for edge in edges] def add_node(self, n): """Add a new node to the graph.""" self.graph.setdefault(n, set()) def add_edge(self, n1, n2): """Add new edge to the graph.""" self.graph.setdefault(n1, set([n2])) self.graph.setdefault(n2, set()) self.graph[n1].add(n2) def del_node(self, n): """Delete the node 'n' from the graph.""" del self.graph[n] for k in self.graph: self.graph[k].discard(n) def del_edge(self, n1, n2): """Delete the edge connecting n1 and n2.""" self.graph[n1].remove(n2) def has_node(self, n): """Return boolean if 'n' is in the graph.""" return n in self.graph def neighbors(self, n): """Return the list of all nodes connected to n by edges.""" return self.graph[n] def adjacent(self, n1, n2): """Return boolean if there is an edge connecting n1 and n2.""" return n2 in self.neighbors(n1)
def test(): # if an assertion fails, the message will be displayed # --> must have the output in a comment assert "Mean: 5.0" in __solution__, "Did you record the correct program output as a comment?" # --> must have the correct arithmetic mean assert mean == 5.0, "Are you calculating the arithmetic mean?" # --> must not have a TODO marker in the solution assert "TODO" not in __solution__, "Did you remove the TODO marker when finished?" # display a congratulations for a correct solution __msg__.good("Well done!")
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def buildTree(self, inorder, postorder): """ :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode """ assert len(inorder) == len(postorder) in_indices = {val: index for index, val in enumerate(inorder)} def dfs(in_start, post_start, size): if size == 0: return None assert size > 0 val = postorder[post_start + size - 1] in_index = in_indices[val] assert in_start <= in_index < in_start + size delta = in_index - in_start root = TreeNode(val) root.left = dfs(in_start, post_start, delta) root.right = dfs(in_index + 1, post_start + delta, size - delta - 1) return root return dfs(0, 0, len(inorder))
MASTER_NAME = 'localhost:9090' MASTER_AUTH = ('admin', 'password') TEST_MONITOR_SVC_URLS = dict( base='http://{0}/nitestmonitor', base_sans_protocol='{0}://{1}/nitestmonitor', can_write='/v2/can-write', query_results='/v1/query-results', query_results_skip_take='/v1/query-results?skip={0}&take={1}', create_results='/v2/results', update_results='/v2/results', delete_result='/v2/results/{0}', query_steps='/v1/query-steps', query_steps_skip_take='/v1/query-steps?skip={0}&take={1}', create_steps='/v2/steps', delete_step='/v2/steps/{0}', delete_steps='/v2/delete-steps', delete_results='/v2/delete-results', list_report_files='/v2/reports', upload_report_for_result='/v2/results/{0}/upload', attach_report_to_result='/v2/results/{0}/attach', download_report='/v2/reports/{0}', delete_report='/v2/reports/{0}' )
requested_toppings = ['mushrooms', 'extra cheese'] if 'mushrooms' in requested_toppings: print("Adding mushrooms") if 'pepperoni' in requested_toppings: print("Adding pepperoni.") if 'extra cheese' in requested_toppings: print("Adding extra cheese.") print("\nFinished making your pizza!") """TRY IT YOURSELFS""" alien_color = 'green' if alien_color is 'red': print("The alien is shot down! You get 5 points!") elif alien_color is 'yellow': print("He's weak! Keep shooting!") elif alien_color is 'green': print("The alien is flying high!") age = 3 if age <= 2: print("You are a baby") elif age <= 4: print("You are a toddler") elif age <= 13: print("You are a kid") elif age <= 20: print("You are a teenager.") elif age <= 65: print("You are an adult") else: print("You are an elder") faves = ['kiwi', 'apple', 'orange'] if 'apple' in faves: print("mmm apple" ) if 'kiwi' in faves: print("mmm kiwi") if 'banana' in faves: print("ok i get it")