content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" :testcase_name record_metrics :author Sriteja Kummita :script_type class :description Metrics contains the getters and setter for precision and recall. RecordMetrics uses these methods to set and get the respective metrics. """ class Metrics: def __init__(self): self.precision = 0.0 self.recall = 0.0 def record_precision(self, p): self.precision = p def record_recall(self, r): self.recall = r def get_precision(self): return self.precision def get_recall(self): return self.recall class RecordMetrics: def __init__(self): self.m = Metrics() def record(self, p, r): self.m.record_precision(p) self.m.record_recall(r) def get_metrics(self): return self.m if __name__ == '__main__': obj = RecordMetrics() obj.record(10.0, 14.0)
""" :testcase_name record_metrics :author Sriteja Kummita :script_type class :description Metrics contains the getters and setter for precision and recall. RecordMetrics uses these methods to set and get the respective metrics. """ class Metrics: def __init__(self): self.precision = 0.0 self.recall = 0.0 def record_precision(self, p): self.precision = p def record_recall(self, r): self.recall = r def get_precision(self): return self.precision def get_recall(self): return self.recall class Recordmetrics: def __init__(self): self.m = metrics() def record(self, p, r): self.m.record_precision(p) self.m.record_recall(r) def get_metrics(self): return self.m if __name__ == '__main__': obj = record_metrics() obj.record(10.0, 14.0)
# # PySNMP MIB module WWP-LEOS-PORT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-PORT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:38:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint") dot3adAggPortListPorts, dot3adAggPortActorAdminKey = mibBuilder.importSymbols("IEEE8023-LAG-MIB", "dot3adAggPortListPorts", "dot3adAggPortActorAdminKey") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") sysName, sysLocation = mibBuilder.importSymbols("SNMPv2-MIB", "sysName", "sysLocation") ObjectIdentity, IpAddress, Unsigned32, MibIdentifier, Bits, ModuleIdentity, Counter64, TimeTicks, Counter32, iso, Gauge32, Integer32, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "IpAddress", "Unsigned32", "MibIdentifier", "Bits", "ModuleIdentity", "Counter64", "TimeTicks", "Counter32", "iso", "Gauge32", "Integer32", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") RowStatus, TruthValue, MacAddress, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TruthValue", "MacAddress", "DisplayString", "TextualConvention") wwpModulesLeos, wwpModules = mibBuilder.importSymbols("WWP-SMI", "wwpModulesLeos", "wwpModules") wwpLeosPortMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2)) wwpLeosPortMIB.setRevisions(('2012-05-25 00:00', '2011-02-02 00:00', '2010-11-01 00:00', '2010-07-28 00:00', '2010-05-05 17:00', '2008-11-14 00:00', '2008-07-21 00:00', '2007-08-11 00:00', '2007-06-20 00:00', '2006-05-26 00:00', '2006-05-18 00:00', '2006-03-15 00:00', '2005-07-28 00:00', '2004-04-18 17:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: wwpLeosPortMIB.setRevisionsDescriptions(('Added wwpLeosEtherPortAdvertSpeed and wwpLeosEtherPortAdvertDuplex to WwpLeosEtherPortEntry MIB object', 'Added admitOnlyUntagged to wwpLeosEtherPortAcceptableFrameTypes MIB object', 'Added wwpLeosEtherPortEgressCosPolicy', 'Added wwpLeosEtherFixedRColor and wwpLeosEtherPortFrameCosMapId mib objects', 'Added changed length of wwpLeosPortDescr from 32 to 128.', 'Added wwpLeosEtherPortEgressPortQueueMapId to wwpLeosEtherPortEntryTable. Added 10 gig option to wwpLeosEtherInterfaceType, wwpLeosEtherAdminSpeed and wwpLeosEtherOperSpeed', 'Added wwpLeosEtherPortResolvedCosPolicy,wwpLeosEtherPortMode and wwpLeosEtherFixedRcos mib objects', 'Added new mib object wwpLeosEtherPortStateMirrorGroupType.', 'Added new mib object wwpLeosEtherPortUntagDataVid.', 'Added new mib object wwpLeosEtherPortOperAutoNeg.', 'Added new mib object wwpLeosEtherPortStateMirrorGroupOperStatus. Added new mib object wwpLeosEtherPortStateMirrorGroupNumSrcPorts. Added new mib object wwpLeosEtherPortStateMirrorGroupNumDstPorts. Added new mib object wwpLeosEtherPortStateMirrorGroupMemOperState.', 'This MIB module is for the Extension of the dot1dBasePortTable for WWP Products', 'Added eumeration to wwpLeosEtherPortAdminSpeed.', 'Added new tables to support port state mirroring feature.',)) if mibBuilder.loadTexts: wwpLeosPortMIB.setLastUpdated('201205250000Z') if mibBuilder.loadTexts: wwpLeosPortMIB.setOrganization('Ciena, Inc') if mibBuilder.loadTexts: wwpLeosPortMIB.setContactInfo('Mib Meister 115 North Sullivan Road Spokane Valley, WA 99037 USA Phone: +1 509 242 9000 Email: support@ciena.com') if mibBuilder.loadTexts: wwpLeosPortMIB.setDescription('This MIB defines the managed objects for Ethernet ports.') class PortList(TextualConvention, OctetString): description = "Each octet within this value specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'." status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255) class PortEgressFrameCosPolicy(TextualConvention, Integer32): description = 'Egress cos policy to use on this port ignore means leave egress map disabled' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("ingore", 1), ("rcosToL2OuterPcpMap", 2)) class PortIngressFixedColor(TextualConvention, Integer32): description = 'Egress cos policy to use on this port ignore means leave egress map disabled' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("green", 1), ("yellow", 2)) wwpLeosPortMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1)) wwpLeosEtherPort = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1)) wwpLeosEtherPortNotif = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2)) wwpLeosPortMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2)) wwpLeosPortMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0)) wwpLeosPortMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3)) wwpLeosPortMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3, 1)) wwpLeosPortMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3, 2)) wwpLeosEtherPortTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1), ) if mibBuilder.loadTexts: wwpLeosEtherPortTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortTable.setDescription('Table of Ethernet Ports.') wwpLeosEtherPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId")) if mibBuilder.loadTexts: wwpLeosEtherPortEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortEntry.setDescription('Port Entry in the Ethernet Port Table.') wwpLeosEtherPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortId.setDescription("Port ID for the instance. Port ID's start at 1, and may not be consecutive for each additional port. This port Id should refer to the dot1dBasePort in the Dot1dBasePortEntry.") wwpLeosEtherPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortName.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortName.setDescription('A textual string containing information about the port. This string should indicate about the physical location of the port as well.') wwpLeosEtherPortDesc = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortDesc.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortDesc.setDescription('A textual string containing port description.') wwpLeosEtherPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("ethernet", 1), ("fastEthernet", 2), ("hundredFx", 3), ("gigEthernet", 4), ("lagPort", 5), ("unknown", 6), ("gigHundredFx", 7), ("tripleSpeed", 8), ("tenGigEthernet", 9), ("gigTenGigEthernet", 10)))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortType.setDescription('The port type for the port.') wwpLeosEtherPortPhysAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 5), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortPhysAddr.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortPhysAddr.setDescription('The ethernet MAC address for the port. This information can also be achieved via dot1dTpFdbTable') wwpLeosEtherPortAutoNeg = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 6), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAutoNeg.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAutoNeg.setDescription('The object sets the port to AUTO NEG MOde and vice versa. Specific platforms may have requirements of configuring speed before moving the port to out of AUTO-NEG mode.') wwpLeosEtherPortAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAdminStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminStatus.setDescription('The desired state of the port.') wwpLeosEtherPortOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("notauth", 3), ("lbtx", 4), ("lbrx", 5), ("linkflap", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortOperStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperStatus.setDescription('The current operational state of Port.') wwpLeosEtherPortAdminSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("tenMb", 1), ("hundredMb", 2), ("gig", 3), ("auto", 4), ("tenGig", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAdminSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminSpeed.setDescription('Desired speed of the port. Set the port speed to be either 10MB, 100MB, or gig. Set the port speed to auto to enable automatic port speed detection. The default value for this object depends upon the platform.') wwpLeosEtherPortOperSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 0), ("tenMb", 1), ("hundredMb", 2), ("gig", 3), ("tenGig", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortOperSpeed.setStatus('deprecated') if mibBuilder.loadTexts: wwpLeosEtherPortOperSpeed.setDescription('The current operational speed of the port.') wwpLeosEtherPortAdminDuplex = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("half", 1), ("full", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAdminDuplex.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminDuplex.setDescription('The desired mode for the port. It can be set to either half or full duplex operation. The default value for this object depends upon the platform.') wwpLeosEtherPortOperDuplex = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("half", 1), ("full", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortOperDuplex.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperDuplex.setDescription('The current duplex mode of the port.') wwpLeosEtherPortAdminFlowCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("off", 2), ("asymTx", 3), ("asymRx", 4), ("sym", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAdminFlowCtrl.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminFlowCtrl.setDescription('Configures the ports flow control operation.') wwpLeosEtherPortOperFlowCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("off", 2), ("asymTx", 3), ("asymRx", 4), ("sym", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortOperFlowCtrl.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperFlowCtrl.setDescription('Shows ports flow control configuration.') wwpLeosEtherIngressPvid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 24576)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setReference('IEEE 802.1Q/D11 Section 12.10.1.1') if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setDescription('The Ingress PVID, the VLAN ID associated with untagged frames ingressing the port or if tunnel is enabled on this port. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.') wwpLeosEtherUntagEgressVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24576))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherUntagEgressVlanId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherUntagEgressVlanId.setDescription('All the egress frames whose VLAN id matches the wwpLeosEtherUntagEgressVlanId, will egress the port as untagged. To egress the frames tagged set wwpLeosEtherUntagEgressVlanId to 0. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.') wwpLeosEtherPortAcceptableFrameTypes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("admitAll", 1), ("admitOnlyVlanTagged", 2), ("admitOnlyUntagged", 3))).clone('admitAll')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setReference('IEEE 802.1Q/D11 Section 12.10.1.3') if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setDescription('When this is admitOnlyVlanTagged(2) the device will discard untagged frames or Priority-Tagged frames received on this port. When admitOnlyUntagged(3) is set, the device will discard VLAN tagged frames received on this port. With admitOnlyUntagged(3) and admitAll(1), untagged frames or Priority-Tagged frames received on this port will be accepted and assigned to the PVID for this port. This control does not affect VLAN independent BPDU frames, such as GVRP and STP. It does affect VLAN dependent BPDU frames, such as GMRP.') wwpLeosEtherPortUntaggedPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("p0", 0), ("p1", 1), ("p2", 2), ("p3", 3), ("p4", 4), ("p5", 5), ("p6", 6), ("p7", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortUntaggedPriority.setStatus('deprecated') if mibBuilder.loadTexts: wwpLeosEtherPortUntaggedPriority.setDescription('The 802.1p packet priority to be assigned to packets ingressing this port that do not have an 802.1Q VLAN header. This priority is also assigned to ingress frame if tunnel is enabled on this port.') wwpLeosEtherPortMaxFrameSize = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1522, 9216))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMaxFrameSize.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMaxFrameSize.setDescription('Setting this object will set the max frame size allowed on a port. The max frame size can vary from 1522 bytes to 9216 bytes. Default value is 1526 bytes.') wwpLeosEtherPortVlanIngressFiltering = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 20), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFiltering.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFiltering.setDescription('When this is true(1) the device will discard incoming frames for VLANs which do not include this Port in its Member set. When false(2), the port will accept all incoming frames.') wwpLeosEtherPortAdminAdvertisedFlowCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("off", 2), ("asymTx", 3), ("sym", 4), ("symAsymRx", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAdminAdvertisedFlowCtrl.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminAdvertisedFlowCtrl.setDescription('This object specifies the advertised flow control for given port.') wwpLeosEtherPortVplsPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notDefined", 1), ("subscriber", 2), ("networkFacing", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortVplsPortType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortVplsPortType.setDescription('This object specifies whether port is in subscriber type, network facing side or both. ') wwpLeosEtherPortIngressCosPolicy = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("leave", 1), ("fixed", 2), ("ippInherit", 3), ("phbgInherit", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortIngressCosPolicy.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortIngressCosPolicy.setDescription('This object specifies the ingress cos policy to be applied to all frames coming in on the given port.') wwpLeosEtherPortIngressFixedDot1dPri = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortIngressFixedDot1dPri.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortIngressFixedDot1dPri.setDescription("The 802.1p packet priority to be assigned to packets ingressing this port that do not have an 802.1Q VLAN header. This priority is also assigned to ingress untagged frame if the virtual switch cos policy is set to 'fix' for a given port.") wwpLeosEtherPortUntagDataVsi = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsi.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsi.setDescription('This object specifies the virtual switch to be used for this port if data frame is untagged. If this object is set to 0 then device will unset this object. When setting this object to Mpls Vsi Index then wwpLeosEtherPortUntagDataVsiType must also be set to mpls (Use multiple set operation)') wwpLeosEtherPortOperationalSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 26), Gauge32()).setUnits('kbps').setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortOperationalSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperationalSpeed.setDescription("An estimate of the port's current bandwidth in k-bits per second for given port.") wwpLeosEtherPortUntagCtrlVsi = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsi.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsi.setDescription('This object specifies the virtual switch to be used for this port if control frame is untagged. If this object is set to 0 then device will unset this object. When setting this object to Mpls Vsi Index then wwpLeosEtherPortUntagCtrlVsiType must also be set to mpls (Use multiple set operation)') wwpLeosEtherPortMirrorPort = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 28), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMirrorPort.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorPort.setDescription('This object defines whether the port will allow traffic from other ports to be mirrored to this port. To allow traffic from other ports to be sent to this port, set this object to True(1). This port is known as a mirror port. If set to true, then other ports may set the values of their wwpLeosEtherPortMirrorIngress or wwpLeosEtherPortMirrorEgress objects to the port index of this port. Setting this object to false(2) disables this port as a mirror port.') wwpLeosEtherPortMirrorIngress = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 29), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMirrorIngress.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorIngress.setDescription("The value of this object is the port index of a mirror port. The ingress traffic of this port can be mirrored by setting the destination port's wwpLeosEtherPortMirrorPort object to true. If the value of this object is set to zero this port's ingress traffic will not be mirrored.") wwpLeosEtherPortMirrorEgress = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEgress.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEgress.setDescription("The value of this object is the port index of a mirror port. The egress traffic of this port can be mirrored by setting the destination port's wwpLeosEtherPortMirrorPort object to true. If the value of this object is set to zero this port's egress traffic will not be mirrored.") wwpLeosEtherPortUntagDataVsiType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ethernet", 1), ("mpls", 2))).clone('ethernet')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsiType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsiType.setDescription('This object specifies the virtual switch instance type associated with this port. This object defaults to ethernet and specifies if wwpLeosEtherPortUntagDataVsi belongs to ethernet virtual switch table (wwpLeosVplsVirtualSwitchEthTable in WWP-LEOS-VPLS-MIB) or mpls virtual switch table (wwpLeosVplsVirtualSwitchMplsTable in WWP-LEOS-VPLS-MIB). When setting wwpLeosEtherPortUntagDataVsi to MPLS Vsi Index then this object must also be set to mpls (Use mutliple set operation).') wwpLeosEtherPortUntagCtrlVsiType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ethernet", 1), ("mpls", 2))).clone('ethernet')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsiType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsiType.setDescription('This object specifies the virtual switch instance type associated with this port. This object defaults to ethernet and specifies if wwpLeosEtherPortUntagCtrlVsi belongs to ethernet virtual switch table (wwpLeosVplsVirtualSwitchEthTable) or mpls virtual switch table (wwpLeosVplsVirtualSwitchMplsTable). When setting wwpLeosEtherPortUntagCtrlVsi to MPLS Vsi Index then this object must also be set to mpls (Use mutliple set operation)') wwpLeosEtherPortVsIngressFiltering = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 33), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortVsIngressFiltering.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortVsIngressFiltering.setDescription('This item is applicable to this port when the port is added as a per-port member to a virtual switch. If true(1) the device will discard incoming tagged frames. If false(2) the device will forwared incoming tagged frames so long as those customer tagged frames do not match another virtual switch with this port included as a per-port-per-vlan member.') wwpLeosEtherPortOperAutoNeg = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 34), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortOperAutoNeg.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperAutoNeg.setDescription('The object specifies the operational auto neg state.') wwpLeosEtherPortUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 35), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortUpTime.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUpTime.setDescription('The object specifies the port up time in hundredths of a second.') wwpLeosEtherPortUntagDataVid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 36), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24576)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setReference('IEEE 802.1Q/D11 Section 12.10.1.1') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setDescription('The Ingress Untagged Data Vid, the VLAN ID stamped on untagged frames ingressing the port or if tunnel is enabled on this port. To disable tagging of untagged data on ingress write a value of 0. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.') wwpLeosEtherPortPhyLoopback = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 37), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortPhyLoopback.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortPhyLoopback.setDescription('This object defines whether the phy has been placed in loopback mode, which causes frames egressing the port to be looped back to the port.') wwpLeosEtherPortVlanIngressFilterStrict = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 38), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFilterStrict.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFilterStrict.setDescription('This item is applicable to this port when the port is added as a to a virtual switch. If true(1) the legacy ingress filter behavior will be enforced at member addition (drop bit will be set to drop untagged traffic). If false, the splat bit will not be changed. Note that external VLAN associations are also maintained when strict is false.') wwpLeosEtherPortMacSaDaSwap = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 39), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwap.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwap.setDescription('This object defines whether the MAC SA and DA will be swapped on frames egressing the port. This only works on a 311V.') wwpLeosEtherPortMacSaDaSwapVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 40), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24576))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwapVlan.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwapVlan.setDescription('This object defines whether the MAC SA and DA will be swapped on specific VLAN frames egressing the port. This only works on a 311V.') wwpLeosEtherPortResolvedCosPolicy = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 41), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 99))).clone(namedValues=NamedValues(("dot1d", 1), ("l3DscpCos", 2), ("fixedCos", 3), ("unknown", 99)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosPolicy.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosPolicy.setDescription(' The Resolved Cost Policy. Setting this attribute is not supported in leos version 4') wwpLeosEtherPortMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 42), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 99))).clone(namedValues=NamedValues(("rj45", 1), ("sfp", 2), ("default", 3), ("unknown", 99)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMode.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMode.setDescription('The mode of the port Setting this attribute is not supported in leos version 4') wwpLeosEtherFixedRcos = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 43), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherFixedRcos.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherFixedRcos.setDescription('The fixed Resolve Cost value. Setting this attribute is not supported in leos version 4') wwpLeosEtherPortEgressPortQueueMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 44), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortEgressPortQueueMapId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortEgressPortQueueMapId.setDescription('The Egress-port-Queue associated with this port. Setting this attribute is not supported in leos version 4') wwpLeosEtherPortResolvedCosMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 45), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosMapId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosMapId.setDescription('RCOS map id for the port. Setting this attribute is not supported in leos version 4') wwpLeosEtherPortResolvedCosRemarkL2 = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 46), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosRemarkL2.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosRemarkL2.setDescription('The object specifies whether to remark L2 based on L3. This applies when the resolved cos policy is either l3-dscp-cos or dot1d-tag1-cos but not when it is fixed-cos policy. Setting this attribute is not supported in leos version 4') wwpLeosEtherPortL2TransformMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 47), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("iPush-e-Pop", 1), ("iStamp-Push-e-QualifiedPopStamp", 2), ("iPush-e-PopStamp", 3))).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortL2TransformMode.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortL2TransformMode.setDescription('L2 transform action for port. Setting this attribute is not supported in leos version 4') wwpLeosEtherPortLinkFlapDetection = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 48), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetection.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetection.setDescription('This object defines whether link flap detection will be enabled on the port.') wwpLeosEtherPortLinkFlapCount = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 49), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64)).clone(5)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapCount.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapCount.setDescription('This object defines how many link down events are required to trigger a link flap event.') wwpLeosEtherPortLinkFlapDetectTime = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 50), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 600)).clone(10)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetectTime.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetectTime.setDescription('This object defines the time in seconds during which link down events are accumlated to trigger a link flap event.') wwpLeosEtherPortLinkFlapHoldTime = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 51), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 600)).clone(300)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapHoldTime.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapHoldTime.setDescription('This object defines the time in seconds that a port will be operationally disabled after a link flap event, before it is re-enabled. A value of zero causes the port to remain disabled until manually enabled.') wwpLeosEtherFixedRColor = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 52), PortIngressFixedColor().clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherFixedRColor.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherFixedRColor.setDescription('This sets the fixed color to green (default) or yellow. Setting this attribute is not supported in saos version 4') wwpLeosEtherPortFrameCosMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 53), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortFrameCosMapId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortFrameCosMapId.setDescription('Frame COS map id for the port. Setting this attribute is not supported in leos version 4') wwpLeosEtherPortEgressCosPolicy = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 54), PortEgressFrameCosPolicy().clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortEgressCosPolicy.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortEgressCosPolicy.setDescription('Sets the egress frame cos policy Setting this attribute is not supported in leos version 4') wwpLeosEtherPortEgressSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 55), Gauge32()).setUnits('kbps').setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortEgressSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortEgressSpeed.setDescription("An estimate of the port's current egress bandwidth restriction in k-bits per second for given port. A value of 0 means there is no active restriction. This attribute not supported in leos version 6") wwpLeosEtherPortAdaptiveRateSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 56), Gauge32()).setUnits('kbps').setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortAdaptiveRateSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdaptiveRateSpeed.setDescription("An estimate of the port's current adaptive-rate bandwidth restriction in k-bits per second for given port. A value of 0 means there is no active restriction. This attribute not supported in leos version 6") wwpLeosEtherPortMirrorEncap = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 57), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("vlanTag", 1))).clone('none')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncap.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncap.setDescription('This object defines whether the port will encapsulate mirrored frames by adding a vlan-tag. (Or, in the case where a mirrored frame is already tagged, by adding a further vlan-tag to the frame) To allow mirrored traffic to be encapsulated, set this object to vlan-tag(1). If set to vlan-tag, then the values of wwpLeosEtherPortMirrorEncapVid and wwpLeosEtherPortMirrorEncapTpid will be used to populate tag added to each mirrored frame. Setting this object to none(0) indicates no tag is to be added to the mirrored frames.') wwpLeosEtherPortMirrorEncapVid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 58), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24576)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapVid.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapVid.setDescription('This object defines the VID that will be added to mirrored frames when the mirroring encapsulation mode is vlan-tag') wwpLeosEtherPortMirrorEncapTpid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 59), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("tpid8100", 1), ("tpid9100", 2), ("tpid88A8", 3))).clone('tpid8100')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapTpid.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapTpid.setDescription('This object defines the tpid used in the tag that is added to mirrored frames, when the mirroring encapsulation mode is vlan-tag') wwpLeosEtherPortIfgDecrease = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 60), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 5))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortIfgDecrease.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortIfgDecrease.setDescription('This object defines the number of bytes that will be subtracted from the minimum standard IFG of 12 bytes as defined in IEEE 802.3. SAOS 6.x only supports a value of 0 or 4.') wwpLeosEtherPortAdvertSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 61), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("not-applicable", 1), ("ten", 2), ("hundred", 3), ("gigabit", 4), ("ten-hundred-gigabit", 5))).clone('ten-hundred-gigabit')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAdvertSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdvertSpeed.setDescription('This object defines the speed capabilities that will be advertised during the auto-negotiation process.') wwpLeosEtherPortAdvertDuplex = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 62), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("not-applicable", 1), ("half", 2), ("full", 3), ("half-full", 4))).clone('half-full')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortAdvertDuplex.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdvertDuplex.setDescription('This object defines the duplex capabilities that will be advertised during the auto-negotiation process.') wwpLeosEtherPortFlushTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2), ) if mibBuilder.loadTexts: wwpLeosEtherPortFlushTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortFlushTable.setDescription('Table of port flush entries.') wwpLeosEtherPortFlushEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId")) if mibBuilder.loadTexts: wwpLeosEtherPortFlushEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortFlushEntry.setDescription('Broadcast containment port entry in the Ethernet Port Table.') wwpLeosEtherPortFlushActivate = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortFlushActivate.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortFlushActivate.setDescription("Setting this object to 'true' will cause the Macs to be flushed for the port specified by wwpLeosEtherPortId.") wwpLeosEtherPortTrapsTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3), ) if mibBuilder.loadTexts: wwpLeosEtherPortTrapsTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortTrapsTable.setDescription('Table of Ethernet Ports Traps.') wwpLeosEtherPortTrapsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId")) if mibBuilder.loadTexts: wwpLeosEtherPortTrapsEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortTrapsEntry.setDescription('Port Traps Entry in the Ethernet Port Trap Table.') wwpLeosEtherPortTrapsState = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortTrapsState.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortTrapsState.setDescription('Setting this object will enable or disable all traps on given port.') wwpLeosEtherPortStateMirrorGroupTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4), ) if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupTable.setDescription('This table can be used to keep track of all the port state mirror groups. To create entry in this table along with indexes following mib objects must be set using multiple set operation wwpLeosEtherPortStateMirrorGroupName must be valid string. wwpLeosEtherPortStateMirrorGroupStatus must be set.') wwpLeosEtherPortStateMirrorGroupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortStateMirrorGroupId")) if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupEntry.setDescription('Each entry in this table will define the port state mirror group.') wwpLeosEtherPortStateMirrorGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupId.setDescription('This mib object is used as index in the table and is used to identify the unique group id.') wwpLeosEtherPortStateMirrorGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 15))).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupName.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupName.setDescription('This mib object is used to specify the name of the group.') wwpLeosEtherPortStateMirrorGroupOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupOperStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupOperStatus.setDescription('This mib object is used to specify the operational status of the group.') wwpLeosEtherPortStateMirrorGroupNumSrcPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumSrcPorts.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumSrcPorts.setDescription('This mib object is used to specify the total number of source ports that exists in the group.') wwpLeosEtherPortStateMirrorGroupNumDstPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumDstPorts.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumDstPorts.setDescription('This mib object is used to specify the total number of destination ports that exists in the group.') wwpLeosEtherPortStateMirrorGroupStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 6), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupStatus.setDescription('Used to manage the creation and deletion of the conceptual rows in this table.') wwpLeosEtherPortStateMirrorGroupType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("unidirectional", 1), ("bidirectional", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupType.setDescription("This mib object is used to specify the directional mode type for the port state mirror group. A uni-directional(1) mirror group type will only mirror the port state of the source port(s) to the destination port(s). The bi-directional(2) mirror group type will mirror state of either the source port(s) to the destination port(s) or the state of the destination port(s) will be mirrored to the source port(s). Where there are more than one source or destination ports the combined state of the source or destination group will be the combined 'OR'ed status of all the ports in either the source or destination groups. In other words, if one or more source ports is 'UP' then the source group is 'UP' and the mirrored destination state may be 'UP'. The default for this object type is uni-directional.") wwpLeosEtherPortStateMirrorGroupMemTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5), ) if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemTable.setDescription('This table is used to keep track of port group membership.') wwpLeosEtherPortStateMirrorGroupMemEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortStateMirrorGroupId"), (0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId")) if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemEntry.setDescription('Each entry in this table is used to represent the membership of port to a given group and group type.') wwpLeosEtherPortStateMirrorGroupMemType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("srcPort", 1), ("dstPort", 2))).clone('srcPort')).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemType.setDescription('Setting this object will specify the type of group this port is member of for a given port state mirror group. This object can only be set while creating the entry. This object cannot be modified once entry is created.') wwpLeosEtherPortStateMirrorGroupMemOperState = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemOperState.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemOperState.setDescription('This mib object is used to specify the operational status of the port.') wwpLeosEtherPortStateMirrorGroupMemStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemStatus.setDescription('Used to manage the creation and deletion of the conceptual rows in this table.') wwpLeosEtherStndLinkUpDownTrapsEnable = MibScalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 1), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherStndLinkUpDownTrapsEnable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherStndLinkUpDownTrapsEnable.setDescription("Setting this object to 'false(2)' will cause standard Link Up Down Traps to be suppressed.") wwpLeosEtherPortLinkUpDownTrapsEnable = MibScalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 2), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherPortLinkUpDownTrapsEnable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkUpDownTrapsEnable.setDescription("Setting this object to 'true(1)' will cause wwp specific port up down trap to be generated.") wwpLeosEtherAggPortLinkUpDownTrapsEnable = MibScalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 3), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wwpLeosEtherAggPortLinkUpDownTrapsEnable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherAggPortLinkUpDownTrapsEnable.setDescription("Setting this object to 'true(1)' will cause wwp specific agg port up down trap to be generated for a link state change on a physical port that is a member of a agg.") wwpLeosEthLinkUp = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 3)).setObjects(("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortType"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortAdminStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortOperStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc")) if mibBuilder.loadTexts: wwpLeosEthLinkUp.setStatus('current') if mibBuilder.loadTexts: wwpLeosEthLinkUp.setDescription('A wwpLeosEthLinkUp trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has entered the up state.') wwpLeosEthLinkDown = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 4)).setObjects(("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortType"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortAdminStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortOperStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc")) if mibBuilder.loadTexts: wwpLeosEthLinkDown.setStatus('current') if mibBuilder.loadTexts: wwpLeosEthLinkDown.setDescription('A wwpLeosEthLinkDown trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has entered the down state.') wwpLeosEthAdminSpeedIncompatible = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 5)).setObjects(("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId")) if mibBuilder.loadTexts: wwpLeosEthAdminSpeedIncompatible.setStatus('current') if mibBuilder.loadTexts: wwpLeosEthAdminSpeedIncompatible.setDescription("A wwpLeosEthAdminSpeedIncompatible trap is generated when the port administrative speed doesn't match the speed of the SFP transceiver installed.") wwpLeosEthLinkFlap = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 6)).setObjects(("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortType"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortOperStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortLinkFlapHoldTime")) if mibBuilder.loadTexts: wwpLeosEthLinkFlap.setStatus('current') if mibBuilder.loadTexts: wwpLeosEthLinkFlap.setDescription('A wwpLeosEthLinkFlap trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has been changed due to link flap detection.') wwpLeosAggLinkUpDown = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 7)).setObjects(("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortType"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortAdminStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortOperStatus"), ("IEEE8023-LAG-MIB", "dot3adAggPortActorAdminKey"), ("IEEE8023-LAG-MIB", "dot3adAggPortListPorts"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc")) if mibBuilder.loadTexts: wwpLeosAggLinkUpDown.setStatus('current') if mibBuilder.loadTexts: wwpLeosAggLinkUpDown.setDescription('A wwpLeosAggLinkUpDown trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has changed state.') mibBuilder.exportSymbols("WWP-LEOS-PORT-MIB", wwpLeosEthLinkDown=wwpLeosEthLinkDown, wwpLeosEtherPortUntagCtrlVsi=wwpLeosEtherPortUntagCtrlVsi, wwpLeosEtherPortOperFlowCtrl=wwpLeosEtherPortOperFlowCtrl, wwpLeosEtherPortUntagDataVid=wwpLeosEtherPortUntagDataVid, wwpLeosEtherPortStateMirrorGroupMemStatus=wwpLeosEtherPortStateMirrorGroupMemStatus, wwpLeosEtherPortUntaggedPriority=wwpLeosEtherPortUntaggedPriority, wwpLeosEtherPortEntry=wwpLeosEtherPortEntry, wwpLeosEtherFixedRcos=wwpLeosEtherFixedRcos, wwpLeosEtherPortAdvertSpeed=wwpLeosEtherPortAdvertSpeed, wwpLeosEtherUntagEgressVlanId=wwpLeosEtherUntagEgressVlanId, wwpLeosEtherPortStateMirrorGroupType=wwpLeosEtherPortStateMirrorGroupType, wwpLeosEtherPortLinkFlapDetection=wwpLeosEtherPortLinkFlapDetection, wwpLeosEtherPortAdminStatus=wwpLeosEtherPortAdminStatus, PortEgressFrameCosPolicy=PortEgressFrameCosPolicy, wwpLeosEtherPortAcceptableFrameTypes=wwpLeosEtherPortAcceptableFrameTypes, wwpLeosPortMIBGroups=wwpLeosPortMIBGroups, wwpLeosEtherPortType=wwpLeosEtherPortType, wwpLeosEthLinkUp=wwpLeosEthLinkUp, wwpLeosEtherPortMirrorEgress=wwpLeosEtherPortMirrorEgress, wwpLeosEtherPortVsIngressFiltering=wwpLeosEtherPortVsIngressFiltering, wwpLeosEtherPortAdminAdvertisedFlowCtrl=wwpLeosEtherPortAdminAdvertisedFlowCtrl, wwpLeosEtherPortDesc=wwpLeosEtherPortDesc, wwpLeosEtherPortResolvedCosMapId=wwpLeosEtherPortResolvedCosMapId, wwpLeosEtherPortEgressPortQueueMapId=wwpLeosEtherPortEgressPortQueueMapId, wwpLeosEtherPortStateMirrorGroupMemOperState=wwpLeosEtherPortStateMirrorGroupMemOperState, wwpLeosEtherPortResolvedCosPolicy=wwpLeosEtherPortResolvedCosPolicy, wwpLeosPortMIBCompliances=wwpLeosPortMIBCompliances, wwpLeosEtherPortL2TransformMode=wwpLeosEtherPortL2TransformMode, wwpLeosEtherPortVlanIngressFiltering=wwpLeosEtherPortVlanIngressFiltering, wwpLeosPortMIBNotificationPrefix=wwpLeosPortMIBNotificationPrefix, wwpLeosEtherPortPhysAddr=wwpLeosEtherPortPhysAddr, wwpLeosEtherPortAutoNeg=wwpLeosEtherPortAutoNeg, wwpLeosEtherPortStateMirrorGroupMemTable=wwpLeosEtherPortStateMirrorGroupMemTable, wwpLeosEtherPortFlushActivate=wwpLeosEtherPortFlushActivate, wwpLeosEtherPortOperDuplex=wwpLeosEtherPortOperDuplex, wwpLeosEtherPort=wwpLeosEtherPort, wwpLeosEtherPortStateMirrorGroupNumSrcPorts=wwpLeosEtherPortStateMirrorGroupNumSrcPorts, wwpLeosEtherPortFlushTable=wwpLeosEtherPortFlushTable, wwpLeosEtherPortStateMirrorGroupStatus=wwpLeosEtherPortStateMirrorGroupStatus, wwpLeosEthAdminSpeedIncompatible=wwpLeosEthAdminSpeedIncompatible, wwpLeosEtherPortNotif=wwpLeosEtherPortNotif, wwpLeosEtherPortStateMirrorGroupMemEntry=wwpLeosEtherPortStateMirrorGroupMemEntry, wwpLeosEtherPortAdminFlowCtrl=wwpLeosEtherPortAdminFlowCtrl, wwpLeosEtherPortUntagCtrlVsiType=wwpLeosEtherPortUntagCtrlVsiType, wwpLeosEtherPortStateMirrorGroupMemType=wwpLeosEtherPortStateMirrorGroupMemType, wwpLeosEtherPortResolvedCosRemarkL2=wwpLeosEtherPortResolvedCosRemarkL2, wwpLeosEtherPortStateMirrorGroupName=wwpLeosEtherPortStateMirrorGroupName, wwpLeosPortMIB=wwpLeosPortMIB, wwpLeosEtherPortLinkUpDownTrapsEnable=wwpLeosEtherPortLinkUpDownTrapsEnable, wwpLeosEtherIngressPvid=wwpLeosEtherIngressPvid, wwpLeosPortMIBConformance=wwpLeosPortMIBConformance, wwpLeosEtherPortMirrorEncapTpid=wwpLeosEtherPortMirrorEncapTpid, wwpLeosEtherPortMirrorIngress=wwpLeosEtherPortMirrorIngress, wwpLeosEtherPortAdaptiveRateSpeed=wwpLeosEtherPortAdaptiveRateSpeed, wwpLeosEtherPortLinkFlapDetectTime=wwpLeosEtherPortLinkFlapDetectTime, wwpLeosEtherPortTrapsTable=wwpLeosEtherPortTrapsTable, wwpLeosEtherPortMirrorEncap=wwpLeosEtherPortMirrorEncap, wwpLeosEtherPortMacSaDaSwapVlan=wwpLeosEtherPortMacSaDaSwapVlan, wwpLeosEtherPortTrapsEntry=wwpLeosEtherPortTrapsEntry, wwpLeosEtherPortIngressFixedDot1dPri=wwpLeosEtherPortIngressFixedDot1dPri, wwpLeosEtherPortMirrorPort=wwpLeosEtherPortMirrorPort, wwpLeosPortMIBNotifications=wwpLeosPortMIBNotifications, wwpLeosEtherFixedRColor=wwpLeosEtherFixedRColor, wwpLeosEtherPortVplsPortType=wwpLeosEtherPortVplsPortType, wwpLeosEtherPortIngressCosPolicy=wwpLeosEtherPortIngressCosPolicy, wwpLeosEtherPortStateMirrorGroupTable=wwpLeosEtherPortStateMirrorGroupTable, wwpLeosEtherPortMode=wwpLeosEtherPortMode, wwpLeosEtherPortOperationalSpeed=wwpLeosEtherPortOperationalSpeed, wwpLeosEtherPortName=wwpLeosEtherPortName, wwpLeosEtherPortOperSpeed=wwpLeosEtherPortOperSpeed, wwpLeosEtherPortStateMirrorGroupOperStatus=wwpLeosEtherPortStateMirrorGroupOperStatus, wwpLeosEtherPortOperAutoNeg=wwpLeosEtherPortOperAutoNeg, wwpLeosAggLinkUpDown=wwpLeosAggLinkUpDown, wwpLeosPortMIBObjects=wwpLeosPortMIBObjects, wwpLeosEtherPortStateMirrorGroupEntry=wwpLeosEtherPortStateMirrorGroupEntry, PortIngressFixedColor=PortIngressFixedColor, wwpLeosEtherPortId=wwpLeosEtherPortId, wwpLeosEtherPortVlanIngressFilterStrict=wwpLeosEtherPortVlanIngressFilterStrict, wwpLeosEtherPortStateMirrorGroupId=wwpLeosEtherPortStateMirrorGroupId, wwpLeosEtherPortIfgDecrease=wwpLeosEtherPortIfgDecrease, wwpLeosEtherPortUpTime=wwpLeosEtherPortUpTime, wwpLeosEtherPortMirrorEncapVid=wwpLeosEtherPortMirrorEncapVid, wwpLeosEtherPortUntagDataVsi=wwpLeosEtherPortUntagDataVsi, wwpLeosEtherPortFrameCosMapId=wwpLeosEtherPortFrameCosMapId, wwpLeosEtherPortLinkFlapCount=wwpLeosEtherPortLinkFlapCount, wwpLeosEtherStndLinkUpDownTrapsEnable=wwpLeosEtherStndLinkUpDownTrapsEnable, wwpLeosEtherPortOperStatus=wwpLeosEtherPortOperStatus, wwpLeosEtherPortAdvertDuplex=wwpLeosEtherPortAdvertDuplex, wwpLeosEtherPortStateMirrorGroupNumDstPorts=wwpLeosEtherPortStateMirrorGroupNumDstPorts, PortList=PortList, wwpLeosEtherPortTrapsState=wwpLeosEtherPortTrapsState, wwpLeosEtherPortMaxFrameSize=wwpLeosEtherPortMaxFrameSize, wwpLeosEtherPortPhyLoopback=wwpLeosEtherPortPhyLoopback, wwpLeosEtherPortUntagDataVsiType=wwpLeosEtherPortUntagDataVsiType, wwpLeosEtherPortFlushEntry=wwpLeosEtherPortFlushEntry, wwpLeosEtherPortLinkFlapHoldTime=wwpLeosEtherPortLinkFlapHoldTime, PYSNMP_MODULE_ID=wwpLeosPortMIB, wwpLeosEtherPortEgressSpeed=wwpLeosEtherPortEgressSpeed, wwpLeosEthLinkFlap=wwpLeosEthLinkFlap, wwpLeosEtherPortTable=wwpLeosEtherPortTable, wwpLeosEtherAggPortLinkUpDownTrapsEnable=wwpLeosEtherAggPortLinkUpDownTrapsEnable, wwpLeosEtherPortMacSaDaSwap=wwpLeosEtherPortMacSaDaSwap, wwpLeosEtherPortEgressCosPolicy=wwpLeosEtherPortEgressCosPolicy, wwpLeosEtherPortAdminSpeed=wwpLeosEtherPortAdminSpeed, wwpLeosEtherPortAdminDuplex=wwpLeosEtherPortAdminDuplex)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, single_value_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint') (dot3ad_agg_port_list_ports, dot3ad_agg_port_actor_admin_key) = mibBuilder.importSymbols('IEEE8023-LAG-MIB', 'dot3adAggPortListPorts', 'dot3adAggPortActorAdminKey') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (sys_name, sys_location) = mibBuilder.importSymbols('SNMPv2-MIB', 'sysName', 'sysLocation') (object_identity, ip_address, unsigned32, mib_identifier, bits, module_identity, counter64, time_ticks, counter32, iso, gauge32, integer32, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'IpAddress', 'Unsigned32', 'MibIdentifier', 'Bits', 'ModuleIdentity', 'Counter64', 'TimeTicks', 'Counter32', 'iso', 'Gauge32', 'Integer32', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn') (row_status, truth_value, mac_address, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'TruthValue', 'MacAddress', 'DisplayString', 'TextualConvention') (wwp_modules_leos, wwp_modules) = mibBuilder.importSymbols('WWP-SMI', 'wwpModulesLeos', 'wwpModules') wwp_leos_port_mib = module_identity((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2)) wwpLeosPortMIB.setRevisions(('2012-05-25 00:00', '2011-02-02 00:00', '2010-11-01 00:00', '2010-07-28 00:00', '2010-05-05 17:00', '2008-11-14 00:00', '2008-07-21 00:00', '2007-08-11 00:00', '2007-06-20 00:00', '2006-05-26 00:00', '2006-05-18 00:00', '2006-03-15 00:00', '2005-07-28 00:00', '2004-04-18 17:00')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: wwpLeosPortMIB.setRevisionsDescriptions(('Added wwpLeosEtherPortAdvertSpeed and wwpLeosEtherPortAdvertDuplex to WwpLeosEtherPortEntry MIB object', 'Added admitOnlyUntagged to wwpLeosEtherPortAcceptableFrameTypes MIB object', 'Added wwpLeosEtherPortEgressCosPolicy', 'Added wwpLeosEtherFixedRColor and wwpLeosEtherPortFrameCosMapId mib objects', 'Added changed length of wwpLeosPortDescr from 32 to 128.', 'Added wwpLeosEtherPortEgressPortQueueMapId to wwpLeosEtherPortEntryTable. Added 10 gig option to wwpLeosEtherInterfaceType, wwpLeosEtherAdminSpeed and wwpLeosEtherOperSpeed', 'Added wwpLeosEtherPortResolvedCosPolicy,wwpLeosEtherPortMode and wwpLeosEtherFixedRcos mib objects', 'Added new mib object wwpLeosEtherPortStateMirrorGroupType.', 'Added new mib object wwpLeosEtherPortUntagDataVid.', 'Added new mib object wwpLeosEtherPortOperAutoNeg.', 'Added new mib object wwpLeosEtherPortStateMirrorGroupOperStatus. Added new mib object wwpLeosEtherPortStateMirrorGroupNumSrcPorts. Added new mib object wwpLeosEtherPortStateMirrorGroupNumDstPorts. Added new mib object wwpLeosEtherPortStateMirrorGroupMemOperState.', 'This MIB module is for the Extension of the dot1dBasePortTable for WWP Products', 'Added eumeration to wwpLeosEtherPortAdminSpeed.', 'Added new tables to support port state mirroring feature.')) if mibBuilder.loadTexts: wwpLeosPortMIB.setLastUpdated('201205250000Z') if mibBuilder.loadTexts: wwpLeosPortMIB.setOrganization('Ciena, Inc') if mibBuilder.loadTexts: wwpLeosPortMIB.setContactInfo('Mib Meister 115 North Sullivan Road Spokane Valley, WA 99037 USA Phone: +1 509 242 9000 Email: support@ciena.com') if mibBuilder.loadTexts: wwpLeosPortMIB.setDescription('This MIB defines the managed objects for Ethernet ports.') class Portlist(TextualConvention, OctetString): description = "Each octet within this value specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'." status = 'current' subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 255) class Portegressframecospolicy(TextualConvention, Integer32): description = 'Egress cos policy to use on this port ignore means leave egress map disabled' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('ingore', 1), ('rcosToL2OuterPcpMap', 2)) class Portingressfixedcolor(TextualConvention, Integer32): description = 'Egress cos policy to use on this port ignore means leave egress map disabled' status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('green', 1), ('yellow', 2)) wwp_leos_port_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1)) wwp_leos_ether_port = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1)) wwp_leos_ether_port_notif = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2)) wwp_leos_port_mib_notification_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2)) wwp_leos_port_mib_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0)) wwp_leos_port_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3)) wwp_leos_port_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3, 1)) wwp_leos_port_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3, 2)) wwp_leos_ether_port_table = mib_table((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1)) if mibBuilder.loadTexts: wwpLeosEtherPortTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortTable.setDescription('Table of Ethernet Ports.') wwp_leos_ether_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1)).setIndexNames((0, 'WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId')) if mibBuilder.loadTexts: wwpLeosEtherPortEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortEntry.setDescription('Port Entry in the Ethernet Port Table.') wwp_leos_ether_port_id = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortId.setDescription("Port ID for the instance. Port ID's start at 1, and may not be consecutive for each additional port. This port Id should refer to the dot1dBasePort in the Dot1dBasePortEntry.") wwp_leos_ether_port_name = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 8))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortName.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortName.setDescription('A textual string containing information about the port. This string should indicate about the physical location of the port as well.') wwp_leos_ether_port_desc = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortDesc.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortDesc.setDescription('A textual string containing port description.') wwp_leos_ether_port_type = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=named_values(('ethernet', 1), ('fastEthernet', 2), ('hundredFx', 3), ('gigEthernet', 4), ('lagPort', 5), ('unknown', 6), ('gigHundredFx', 7), ('tripleSpeed', 8), ('tenGigEthernet', 9), ('gigTenGigEthernet', 10)))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortType.setDescription('The port type for the port.') wwp_leos_ether_port_phys_addr = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 5), mac_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortPhysAddr.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortPhysAddr.setDescription('The ethernet MAC address for the port. This information can also be achieved via dot1dTpFdbTable') wwp_leos_ether_port_auto_neg = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 6), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAutoNeg.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAutoNeg.setDescription('The object sets the port to AUTO NEG MOde and vice versa. Specific platforms may have requirements of configuring speed before moving the port to out of AUTO-NEG mode.') wwp_leos_ether_port_admin_status = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('up', 1), ('down', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAdminStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminStatus.setDescription('The desired state of the port.') wwp_leos_ether_port_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('up', 1), ('down', 2), ('notauth', 3), ('lbtx', 4), ('lbrx', 5), ('linkflap', 6)))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortOperStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperStatus.setDescription('The current operational state of Port.') wwp_leos_ether_port_admin_speed = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('tenMb', 1), ('hundredMb', 2), ('gig', 3), ('auto', 4), ('tenGig', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAdminSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminSpeed.setDescription('Desired speed of the port. Set the port speed to be either 10MB, 100MB, or gig. Set the port speed to auto to enable automatic port speed detection. The default value for this object depends upon the platform.') wwp_leos_ether_port_oper_speed = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4))).clone(namedValues=named_values(('unknown', 0), ('tenMb', 1), ('hundredMb', 2), ('gig', 3), ('tenGig', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortOperSpeed.setStatus('deprecated') if mibBuilder.loadTexts: wwpLeosEtherPortOperSpeed.setDescription('The current operational speed of the port.') wwp_leos_ether_port_admin_duplex = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('half', 1), ('full', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAdminDuplex.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminDuplex.setDescription('The desired mode for the port. It can be set to either half or full duplex operation. The default value for this object depends upon the platform.') wwp_leos_ether_port_oper_duplex = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('half', 1), ('full', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortOperDuplex.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperDuplex.setDescription('The current duplex mode of the port.') wwp_leos_ether_port_admin_flow_ctrl = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('unknown', 1), ('off', 2), ('asymTx', 3), ('asymRx', 4), ('sym', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAdminFlowCtrl.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminFlowCtrl.setDescription('Configures the ports flow control operation.') wwp_leos_ether_port_oper_flow_ctrl = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('unknown', 1), ('off', 2), ('asymTx', 3), ('asymRx', 4), ('sym', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortOperFlowCtrl.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperFlowCtrl.setDescription('Shows ports flow control configuration.') wwp_leos_ether_ingress_pvid = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 15), integer32().subtype(subtypeSpec=value_range_constraint(1, 24576)).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setReference('IEEE 802.1Q/D11 Section 12.10.1.1') if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setDescription('The Ingress PVID, the VLAN ID associated with untagged frames ingressing the port or if tunnel is enabled on this port. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.') wwp_leos_ether_untag_egress_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(0, 24576))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherUntagEgressVlanId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherUntagEgressVlanId.setDescription('All the egress frames whose VLAN id matches the wwpLeosEtherUntagEgressVlanId, will egress the port as untagged. To egress the frames tagged set wwpLeosEtherUntagEgressVlanId to 0. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.') wwp_leos_ether_port_acceptable_frame_types = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 17), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('admitAll', 1), ('admitOnlyVlanTagged', 2), ('admitOnlyUntagged', 3))).clone('admitAll')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setReference('IEEE 802.1Q/D11 Section 12.10.1.3') if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setDescription('When this is admitOnlyVlanTagged(2) the device will discard untagged frames or Priority-Tagged frames received on this port. When admitOnlyUntagged(3) is set, the device will discard VLAN tagged frames received on this port. With admitOnlyUntagged(3) and admitAll(1), untagged frames or Priority-Tagged frames received on this port will be accepted and assigned to the PVID for this port. This control does not affect VLAN independent BPDU frames, such as GVRP and STP. It does affect VLAN dependent BPDU frames, such as GMRP.') wwp_leos_ether_port_untagged_priority = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 18), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('p0', 0), ('p1', 1), ('p2', 2), ('p3', 3), ('p4', 4), ('p5', 5), ('p6', 6), ('p7', 7)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortUntaggedPriority.setStatus('deprecated') if mibBuilder.loadTexts: wwpLeosEtherPortUntaggedPriority.setDescription('The 802.1p packet priority to be assigned to packets ingressing this port that do not have an 802.1Q VLAN header. This priority is also assigned to ingress frame if tunnel is enabled on this port.') wwp_leos_ether_port_max_frame_size = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 19), integer32().subtype(subtypeSpec=value_range_constraint(1522, 9216))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMaxFrameSize.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMaxFrameSize.setDescription('Setting this object will set the max frame size allowed on a port. The max frame size can vary from 1522 bytes to 9216 bytes. Default value is 1526 bytes.') wwp_leos_ether_port_vlan_ingress_filtering = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 20), truth_value().clone('true')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFiltering.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFiltering.setDescription('When this is true(1) the device will discard incoming frames for VLANs which do not include this Port in its Member set. When false(2), the port will accept all incoming frames.') wwp_leos_ether_port_admin_advertised_flow_ctrl = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 21), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('unknown', 1), ('off', 2), ('asymTx', 3), ('sym', 4), ('symAsymRx', 5)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAdminAdvertisedFlowCtrl.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdminAdvertisedFlowCtrl.setDescription('This object specifies the advertised flow control for given port.') wwp_leos_ether_port_vpls_port_type = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 22), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('notDefined', 1), ('subscriber', 2), ('networkFacing', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortVplsPortType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortVplsPortType.setDescription('This object specifies whether port is in subscriber type, network facing side or both. ') wwp_leos_ether_port_ingress_cos_policy = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 23), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('leave', 1), ('fixed', 2), ('ippInherit', 3), ('phbgInherit', 4)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortIngressCosPolicy.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortIngressCosPolicy.setDescription('This object specifies the ingress cos policy to be applied to all frames coming in on the given port.') wwp_leos_ether_port_ingress_fixed_dot1d_pri = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 24), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortIngressFixedDot1dPri.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortIngressFixedDot1dPri.setDescription("The 802.1p packet priority to be assigned to packets ingressing this port that do not have an 802.1Q VLAN header. This priority is also assigned to ingress untagged frame if the virtual switch cos policy is set to 'fix' for a given port.") wwp_leos_ether_port_untag_data_vsi = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 25), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsi.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsi.setDescription('This object specifies the virtual switch to be used for this port if data frame is untagged. If this object is set to 0 then device will unset this object. When setting this object to Mpls Vsi Index then wwpLeosEtherPortUntagDataVsiType must also be set to mpls (Use multiple set operation)') wwp_leos_ether_port_operational_speed = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 26), gauge32()).setUnits('kbps').setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortOperationalSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperationalSpeed.setDescription("An estimate of the port's current bandwidth in k-bits per second for given port.") wwp_leos_ether_port_untag_ctrl_vsi = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 27), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsi.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsi.setDescription('This object specifies the virtual switch to be used for this port if control frame is untagged. If this object is set to 0 then device will unset this object. When setting this object to Mpls Vsi Index then wwpLeosEtherPortUntagCtrlVsiType must also be set to mpls (Use multiple set operation)') wwp_leos_ether_port_mirror_port = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 28), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorPort.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorPort.setDescription('This object defines whether the port will allow traffic from other ports to be mirrored to this port. To allow traffic from other ports to be sent to this port, set this object to True(1). This port is known as a mirror port. If set to true, then other ports may set the values of their wwpLeosEtherPortMirrorIngress or wwpLeosEtherPortMirrorEgress objects to the port index of this port. Setting this object to false(2) disables this port as a mirror port.') wwp_leos_ether_port_mirror_ingress = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 29), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorIngress.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorIngress.setDescription("The value of this object is the port index of a mirror port. The ingress traffic of this port can be mirrored by setting the destination port's wwpLeosEtherPortMirrorPort object to true. If the value of this object is set to zero this port's ingress traffic will not be mirrored.") wwp_leos_ether_port_mirror_egress = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 30), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEgress.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEgress.setDescription("The value of this object is the port index of a mirror port. The egress traffic of this port can be mirrored by setting the destination port's wwpLeosEtherPortMirrorPort object to true. If the value of this object is set to zero this port's egress traffic will not be mirrored.") wwp_leos_ether_port_untag_data_vsi_type = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 31), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ethernet', 1), ('mpls', 2))).clone('ethernet')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsiType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsiType.setDescription('This object specifies the virtual switch instance type associated with this port. This object defaults to ethernet and specifies if wwpLeosEtherPortUntagDataVsi belongs to ethernet virtual switch table (wwpLeosVplsVirtualSwitchEthTable in WWP-LEOS-VPLS-MIB) or mpls virtual switch table (wwpLeosVplsVirtualSwitchMplsTable in WWP-LEOS-VPLS-MIB). When setting wwpLeosEtherPortUntagDataVsi to MPLS Vsi Index then this object must also be set to mpls (Use mutliple set operation).') wwp_leos_ether_port_untag_ctrl_vsi_type = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 32), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ethernet', 1), ('mpls', 2))).clone('ethernet')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsiType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsiType.setDescription('This object specifies the virtual switch instance type associated with this port. This object defaults to ethernet and specifies if wwpLeosEtherPortUntagCtrlVsi belongs to ethernet virtual switch table (wwpLeosVplsVirtualSwitchEthTable) or mpls virtual switch table (wwpLeosVplsVirtualSwitchMplsTable). When setting wwpLeosEtherPortUntagCtrlVsi to MPLS Vsi Index then this object must also be set to mpls (Use mutliple set operation)') wwp_leos_ether_port_vs_ingress_filtering = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 33), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortVsIngressFiltering.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortVsIngressFiltering.setDescription('This item is applicable to this port when the port is added as a per-port member to a virtual switch. If true(1) the device will discard incoming tagged frames. If false(2) the device will forwared incoming tagged frames so long as those customer tagged frames do not match another virtual switch with this port included as a per-port-per-vlan member.') wwp_leos_ether_port_oper_auto_neg = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 34), truth_value()).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortOperAutoNeg.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortOperAutoNeg.setDescription('The object specifies the operational auto neg state.') wwp_leos_ether_port_up_time = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 35), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortUpTime.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUpTime.setDescription('The object specifies the port up time in hundredths of a second.') wwp_leos_ether_port_untag_data_vid = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 36), integer32().subtype(subtypeSpec=value_range_constraint(0, 24576)).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setReference('IEEE 802.1Q/D11 Section 12.10.1.1') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setDescription('The Ingress Untagged Data Vid, the VLAN ID stamped on untagged frames ingressing the port or if tunnel is enabled on this port. To disable tagging of untagged data on ingress write a value of 0. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.') wwp_leos_ether_port_phy_loopback = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 37), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortPhyLoopback.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortPhyLoopback.setDescription('This object defines whether the phy has been placed in loopback mode, which causes frames egressing the port to be looped back to the port.') wwp_leos_ether_port_vlan_ingress_filter_strict = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 38), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFilterStrict.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFilterStrict.setDescription('This item is applicable to this port when the port is added as a to a virtual switch. If true(1) the legacy ingress filter behavior will be enforced at member addition (drop bit will be set to drop untagged traffic). If false, the splat bit will not be changed. Note that external VLAN associations are also maintained when strict is false.') wwp_leos_ether_port_mac_sa_da_swap = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 39), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwap.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwap.setDescription('This object defines whether the MAC SA and DA will be swapped on frames egressing the port. This only works on a 311V.') wwp_leos_ether_port_mac_sa_da_swap_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 40), integer32().subtype(subtypeSpec=value_range_constraint(0, 24576))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwapVlan.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwapVlan.setDescription('This object defines whether the MAC SA and DA will be swapped on specific VLAN frames egressing the port. This only works on a 311V.') wwp_leos_ether_port_resolved_cos_policy = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 41), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 99))).clone(namedValues=named_values(('dot1d', 1), ('l3DscpCos', 2), ('fixedCos', 3), ('unknown', 99)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosPolicy.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosPolicy.setDescription(' The Resolved Cost Policy. Setting this attribute is not supported in leos version 4') wwp_leos_ether_port_mode = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 42), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 99))).clone(namedValues=named_values(('rj45', 1), ('sfp', 2), ('default', 3), ('unknown', 99)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMode.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMode.setDescription('The mode of the port Setting this attribute is not supported in leos version 4') wwp_leos_ether_fixed_rcos = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 43), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherFixedRcos.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherFixedRcos.setDescription('The fixed Resolve Cost value. Setting this attribute is not supported in leos version 4') wwp_leos_ether_port_egress_port_queue_map_id = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 44), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortEgressPortQueueMapId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortEgressPortQueueMapId.setDescription('The Egress-port-Queue associated with this port. Setting this attribute is not supported in leos version 4') wwp_leos_ether_port_resolved_cos_map_id = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 45), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosMapId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosMapId.setDescription('RCOS map id for the port. Setting this attribute is not supported in leos version 4') wwp_leos_ether_port_resolved_cos_remark_l2 = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 46), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosRemarkL2.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosRemarkL2.setDescription('The object specifies whether to remark L2 based on L3. This applies when the resolved cos policy is either l3-dscp-cos or dot1d-tag1-cos but not when it is fixed-cos policy. Setting this attribute is not supported in leos version 4') wwp_leos_ether_port_l2_transform_mode = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 47), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('none', 0), ('iPush-e-Pop', 1), ('iStamp-Push-e-QualifiedPopStamp', 2), ('iPush-e-PopStamp', 3))).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortL2TransformMode.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortL2TransformMode.setDescription('L2 transform action for port. Setting this attribute is not supported in leos version 4') wwp_leos_ether_port_link_flap_detection = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 48), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetection.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetection.setDescription('This object defines whether link flap detection will be enabled on the port.') wwp_leos_ether_port_link_flap_count = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 49), integer32().subtype(subtypeSpec=value_range_constraint(1, 64)).clone(5)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapCount.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapCount.setDescription('This object defines how many link down events are required to trigger a link flap event.') wwp_leos_ether_port_link_flap_detect_time = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 50), integer32().subtype(subtypeSpec=value_range_constraint(1, 600)).clone(10)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetectTime.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetectTime.setDescription('This object defines the time in seconds during which link down events are accumlated to trigger a link flap event.') wwp_leos_ether_port_link_flap_hold_time = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 51), integer32().subtype(subtypeSpec=value_range_constraint(0, 600)).clone(300)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapHoldTime.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapHoldTime.setDescription('This object defines the time in seconds that a port will be operationally disabled after a link flap event, before it is re-enabled. A value of zero causes the port to remain disabled until manually enabled.') wwp_leos_ether_fixed_r_color = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 52), port_ingress_fixed_color().clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherFixedRColor.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherFixedRColor.setDescription('This sets the fixed color to green (default) or yellow. Setting this attribute is not supported in saos version 4') wwp_leos_ether_port_frame_cos_map_id = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 53), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortFrameCosMapId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortFrameCosMapId.setDescription('Frame COS map id for the port. Setting this attribute is not supported in leos version 4') wwp_leos_ether_port_egress_cos_policy = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 54), port_egress_frame_cos_policy().clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortEgressCosPolicy.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortEgressCosPolicy.setDescription('Sets the egress frame cos policy Setting this attribute is not supported in leos version 4') wwp_leos_ether_port_egress_speed = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 55), gauge32()).setUnits('kbps').setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortEgressSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortEgressSpeed.setDescription("An estimate of the port's current egress bandwidth restriction in k-bits per second for given port. A value of 0 means there is no active restriction. This attribute not supported in leos version 6") wwp_leos_ether_port_adaptive_rate_speed = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 56), gauge32()).setUnits('kbps').setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortAdaptiveRateSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdaptiveRateSpeed.setDescription("An estimate of the port's current adaptive-rate bandwidth restriction in k-bits per second for given port. A value of 0 means there is no active restriction. This attribute not supported in leos version 6") wwp_leos_ether_port_mirror_encap = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 57), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('none', 0), ('vlanTag', 1))).clone('none')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncap.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncap.setDescription('This object defines whether the port will encapsulate mirrored frames by adding a vlan-tag. (Or, in the case where a mirrored frame is already tagged, by adding a further vlan-tag to the frame) To allow mirrored traffic to be encapsulated, set this object to vlan-tag(1). If set to vlan-tag, then the values of wwpLeosEtherPortMirrorEncapVid and wwpLeosEtherPortMirrorEncapTpid will be used to populate tag added to each mirrored frame. Setting this object to none(0) indicates no tag is to be added to the mirrored frames.') wwp_leos_ether_port_mirror_encap_vid = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 58), integer32().subtype(subtypeSpec=value_range_constraint(0, 24576)).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapVid.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapVid.setDescription('This object defines the VID that will be added to mirrored frames when the mirroring encapsulation mode is vlan-tag') wwp_leos_ether_port_mirror_encap_tpid = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 59), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('tpid8100', 1), ('tpid9100', 2), ('tpid88A8', 3))).clone('tpid8100')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapTpid.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapTpid.setDescription('This object defines the tpid used in the tag that is added to mirrored frames, when the mirroring encapsulation mode is vlan-tag') wwp_leos_ether_port_ifg_decrease = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 60), integer32().subtype(subtypeSpec=value_range_constraint(0, 5))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortIfgDecrease.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortIfgDecrease.setDescription('This object defines the number of bytes that will be subtracted from the minimum standard IFG of 12 bytes as defined in IEEE 802.3. SAOS 6.x only supports a value of 0 or 4.') wwp_leos_ether_port_advert_speed = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 61), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('not-applicable', 1), ('ten', 2), ('hundred', 3), ('gigabit', 4), ('ten-hundred-gigabit', 5))).clone('ten-hundred-gigabit')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAdvertSpeed.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdvertSpeed.setDescription('This object defines the speed capabilities that will be advertised during the auto-negotiation process.') wwp_leos_ether_port_advert_duplex = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 62), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('not-applicable', 1), ('half', 2), ('full', 3), ('half-full', 4))).clone('half-full')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortAdvertDuplex.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortAdvertDuplex.setDescription('This object defines the duplex capabilities that will be advertised during the auto-negotiation process.') wwp_leos_ether_port_flush_table = mib_table((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2)) if mibBuilder.loadTexts: wwpLeosEtherPortFlushTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortFlushTable.setDescription('Table of port flush entries.') wwp_leos_ether_port_flush_entry = mib_table_row((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2, 1)).setIndexNames((0, 'WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId')) if mibBuilder.loadTexts: wwpLeosEtherPortFlushEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortFlushEntry.setDescription('Broadcast containment port entry in the Ethernet Port Table.') wwp_leos_ether_port_flush_activate = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2, 1, 1), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortFlushActivate.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortFlushActivate.setDescription("Setting this object to 'true' will cause the Macs to be flushed for the port specified by wwpLeosEtherPortId.") wwp_leos_ether_port_traps_table = mib_table((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3)) if mibBuilder.loadTexts: wwpLeosEtherPortTrapsTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortTrapsTable.setDescription('Table of Ethernet Ports Traps.') wwp_leos_ether_port_traps_entry = mib_table_row((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3, 1)).setIndexNames((0, 'WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId')) if mibBuilder.loadTexts: wwpLeosEtherPortTrapsEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortTrapsEntry.setDescription('Port Traps Entry in the Ethernet Port Trap Table.') wwp_leos_ether_port_traps_state = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disable', 1), ('enable', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortTrapsState.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortTrapsState.setDescription('Setting this object will enable or disable all traps on given port.') wwp_leos_ether_port_state_mirror_group_table = mib_table((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4)) if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupTable.setDescription('This table can be used to keep track of all the port state mirror groups. To create entry in this table along with indexes following mib objects must be set using multiple set operation wwpLeosEtherPortStateMirrorGroupName must be valid string. wwpLeosEtherPortStateMirrorGroupStatus must be set.') wwp_leos_ether_port_state_mirror_group_entry = mib_table_row((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1)).setIndexNames((0, 'WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortStateMirrorGroupId')) if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupEntry.setDescription('Each entry in this table will define the port state mirror group.') wwp_leos_ether_port_state_mirror_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupId.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupId.setDescription('This mib object is used as index in the table and is used to identify the unique group id.') wwp_leos_ether_port_state_mirror_group_name = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(1, 15))).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupName.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupName.setDescription('This mib object is used to specify the name of the group.') wwp_leos_ether_port_state_mirror_group_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupOperStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupOperStatus.setDescription('This mib object is used to specify the operational status of the group.') wwp_leos_ether_port_state_mirror_group_num_src_ports = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumSrcPorts.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumSrcPorts.setDescription('This mib object is used to specify the total number of source ports that exists in the group.') wwp_leos_ether_port_state_mirror_group_num_dst_ports = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumDstPorts.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumDstPorts.setDescription('This mib object is used to specify the total number of destination ports that exists in the group.') wwp_leos_ether_port_state_mirror_group_status = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 6), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupStatus.setDescription('Used to manage the creation and deletion of the conceptual rows in this table.') wwp_leos_ether_port_state_mirror_group_type = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('unidirectional', 1), ('bidirectional', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupType.setDescription("This mib object is used to specify the directional mode type for the port state mirror group. A uni-directional(1) mirror group type will only mirror the port state of the source port(s) to the destination port(s). The bi-directional(2) mirror group type will mirror state of either the source port(s) to the destination port(s) or the state of the destination port(s) will be mirrored to the source port(s). Where there are more than one source or destination ports the combined state of the source or destination group will be the combined 'OR'ed status of all the ports in either the source or destination groups. In other words, if one or more source ports is 'UP' then the source group is 'UP' and the mirrored destination state may be 'UP'. The default for this object type is uni-directional.") wwp_leos_ether_port_state_mirror_group_mem_table = mib_table((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5)) if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemTable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemTable.setDescription('This table is used to keep track of port group membership.') wwp_leos_ether_port_state_mirror_group_mem_entry = mib_table_row((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1)).setIndexNames((0, 'WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortStateMirrorGroupId'), (0, 'WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId')) if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemEntry.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemEntry.setDescription('Each entry in this table is used to represent the membership of port to a given group and group type.') wwp_leos_ether_port_state_mirror_group_mem_type = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('srcPort', 1), ('dstPort', 2))).clone('srcPort')).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemType.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemType.setDescription('Setting this object will specify the type of group this port is member of for a given port state mirror group. This object can only be set while creating the entry. This object cannot be modified once entry is created.') wwp_leos_ether_port_state_mirror_group_mem_oper_state = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemOperState.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemOperState.setDescription('This mib object is used to specify the operational status of the port.') wwp_leos_ether_port_state_mirror_group_mem_status = mib_table_column((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 3), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemStatus.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemStatus.setDescription('Used to manage the creation and deletion of the conceptual rows in this table.') wwp_leos_ether_stnd_link_up_down_traps_enable = mib_scalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 1), truth_value().clone('true')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherStndLinkUpDownTrapsEnable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherStndLinkUpDownTrapsEnable.setDescription("Setting this object to 'false(2)' will cause standard Link Up Down Traps to be suppressed.") wwp_leos_ether_port_link_up_down_traps_enable = mib_scalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 2), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherPortLinkUpDownTrapsEnable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherPortLinkUpDownTrapsEnable.setDescription("Setting this object to 'true(1)' will cause wwp specific port up down trap to be generated.") wwp_leos_ether_agg_port_link_up_down_traps_enable = mib_scalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 3), truth_value().clone('false')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wwpLeosEtherAggPortLinkUpDownTrapsEnable.setStatus('current') if mibBuilder.loadTexts: wwpLeosEtherAggPortLinkUpDownTrapsEnable.setDescription("Setting this object to 'true(1)' will cause wwp specific agg port up down trap to be generated for a link state change on a physical port that is a member of a agg.") wwp_leos_eth_link_up = notification_type((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 3)).setObjects(('SNMPv2-MIB', 'sysName'), ('SNMPv2-MIB', 'sysLocation'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortName'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortType'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortAdminStatus'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortOperStatus'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortDesc')) if mibBuilder.loadTexts: wwpLeosEthLinkUp.setStatus('current') if mibBuilder.loadTexts: wwpLeosEthLinkUp.setDescription('A wwpLeosEthLinkUp trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has entered the up state.') wwp_leos_eth_link_down = notification_type((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 4)).setObjects(('SNMPv2-MIB', 'sysName'), ('SNMPv2-MIB', 'sysLocation'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortType'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortName'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortAdminStatus'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortOperStatus'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortDesc')) if mibBuilder.loadTexts: wwpLeosEthLinkDown.setStatus('current') if mibBuilder.loadTexts: wwpLeosEthLinkDown.setDescription('A wwpLeosEthLinkDown trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has entered the down state.') wwp_leos_eth_admin_speed_incompatible = notification_type((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 5)).setObjects(('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId')) if mibBuilder.loadTexts: wwpLeosEthAdminSpeedIncompatible.setStatus('current') if mibBuilder.loadTexts: wwpLeosEthAdminSpeedIncompatible.setDescription("A wwpLeosEthAdminSpeedIncompatible trap is generated when the port administrative speed doesn't match the speed of the SFP transceiver installed.") wwp_leos_eth_link_flap = notification_type((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 6)).setObjects(('SNMPv2-MIB', 'sysName'), ('SNMPv2-MIB', 'sysLocation'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortType'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortName'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortOperStatus'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortDesc'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortLinkFlapHoldTime')) if mibBuilder.loadTexts: wwpLeosEthLinkFlap.setStatus('current') if mibBuilder.loadTexts: wwpLeosEthLinkFlap.setDescription('A wwpLeosEthLinkFlap trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has been changed due to link flap detection.') wwp_leos_agg_link_up_down = notification_type((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 7)).setObjects(('SNMPv2-MIB', 'sysName'), ('SNMPv2-MIB', 'sysLocation'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortId'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortName'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortDesc'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortType'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortAdminStatus'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortOperStatus'), ('IEEE8023-LAG-MIB', 'dot3adAggPortActorAdminKey'), ('IEEE8023-LAG-MIB', 'dot3adAggPortListPorts'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortName'), ('WWP-LEOS-PORT-MIB', 'wwpLeosEtherPortDesc')) if mibBuilder.loadTexts: wwpLeosAggLinkUpDown.setStatus('current') if mibBuilder.loadTexts: wwpLeosAggLinkUpDown.setDescription('A wwpLeosAggLinkUpDown trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has changed state.') mibBuilder.exportSymbols('WWP-LEOS-PORT-MIB', wwpLeosEthLinkDown=wwpLeosEthLinkDown, wwpLeosEtherPortUntagCtrlVsi=wwpLeosEtherPortUntagCtrlVsi, wwpLeosEtherPortOperFlowCtrl=wwpLeosEtherPortOperFlowCtrl, wwpLeosEtherPortUntagDataVid=wwpLeosEtherPortUntagDataVid, wwpLeosEtherPortStateMirrorGroupMemStatus=wwpLeosEtherPortStateMirrorGroupMemStatus, wwpLeosEtherPortUntaggedPriority=wwpLeosEtherPortUntaggedPriority, wwpLeosEtherPortEntry=wwpLeosEtherPortEntry, wwpLeosEtherFixedRcos=wwpLeosEtherFixedRcos, wwpLeosEtherPortAdvertSpeed=wwpLeosEtherPortAdvertSpeed, wwpLeosEtherUntagEgressVlanId=wwpLeosEtherUntagEgressVlanId, wwpLeosEtherPortStateMirrorGroupType=wwpLeosEtherPortStateMirrorGroupType, wwpLeosEtherPortLinkFlapDetection=wwpLeosEtherPortLinkFlapDetection, wwpLeosEtherPortAdminStatus=wwpLeosEtherPortAdminStatus, PortEgressFrameCosPolicy=PortEgressFrameCosPolicy, wwpLeosEtherPortAcceptableFrameTypes=wwpLeosEtherPortAcceptableFrameTypes, wwpLeosPortMIBGroups=wwpLeosPortMIBGroups, wwpLeosEtherPortType=wwpLeosEtherPortType, wwpLeosEthLinkUp=wwpLeosEthLinkUp, wwpLeosEtherPortMirrorEgress=wwpLeosEtherPortMirrorEgress, wwpLeosEtherPortVsIngressFiltering=wwpLeosEtherPortVsIngressFiltering, wwpLeosEtherPortAdminAdvertisedFlowCtrl=wwpLeosEtherPortAdminAdvertisedFlowCtrl, wwpLeosEtherPortDesc=wwpLeosEtherPortDesc, wwpLeosEtherPortResolvedCosMapId=wwpLeosEtherPortResolvedCosMapId, wwpLeosEtherPortEgressPortQueueMapId=wwpLeosEtherPortEgressPortQueueMapId, wwpLeosEtherPortStateMirrorGroupMemOperState=wwpLeosEtherPortStateMirrorGroupMemOperState, wwpLeosEtherPortResolvedCosPolicy=wwpLeosEtherPortResolvedCosPolicy, wwpLeosPortMIBCompliances=wwpLeosPortMIBCompliances, wwpLeosEtherPortL2TransformMode=wwpLeosEtherPortL2TransformMode, wwpLeosEtherPortVlanIngressFiltering=wwpLeosEtherPortVlanIngressFiltering, wwpLeosPortMIBNotificationPrefix=wwpLeosPortMIBNotificationPrefix, wwpLeosEtherPortPhysAddr=wwpLeosEtherPortPhysAddr, wwpLeosEtherPortAutoNeg=wwpLeosEtherPortAutoNeg, wwpLeosEtherPortStateMirrorGroupMemTable=wwpLeosEtherPortStateMirrorGroupMemTable, wwpLeosEtherPortFlushActivate=wwpLeosEtherPortFlushActivate, wwpLeosEtherPortOperDuplex=wwpLeosEtherPortOperDuplex, wwpLeosEtherPort=wwpLeosEtherPort, wwpLeosEtherPortStateMirrorGroupNumSrcPorts=wwpLeosEtherPortStateMirrorGroupNumSrcPorts, wwpLeosEtherPortFlushTable=wwpLeosEtherPortFlushTable, wwpLeosEtherPortStateMirrorGroupStatus=wwpLeosEtherPortStateMirrorGroupStatus, wwpLeosEthAdminSpeedIncompatible=wwpLeosEthAdminSpeedIncompatible, wwpLeosEtherPortNotif=wwpLeosEtherPortNotif, wwpLeosEtherPortStateMirrorGroupMemEntry=wwpLeosEtherPortStateMirrorGroupMemEntry, wwpLeosEtherPortAdminFlowCtrl=wwpLeosEtherPortAdminFlowCtrl, wwpLeosEtherPortUntagCtrlVsiType=wwpLeosEtherPortUntagCtrlVsiType, wwpLeosEtherPortStateMirrorGroupMemType=wwpLeosEtherPortStateMirrorGroupMemType, wwpLeosEtherPortResolvedCosRemarkL2=wwpLeosEtherPortResolvedCosRemarkL2, wwpLeosEtherPortStateMirrorGroupName=wwpLeosEtherPortStateMirrorGroupName, wwpLeosPortMIB=wwpLeosPortMIB, wwpLeosEtherPortLinkUpDownTrapsEnable=wwpLeosEtherPortLinkUpDownTrapsEnable, wwpLeosEtherIngressPvid=wwpLeosEtherIngressPvid, wwpLeosPortMIBConformance=wwpLeosPortMIBConformance, wwpLeosEtherPortMirrorEncapTpid=wwpLeosEtherPortMirrorEncapTpid, wwpLeosEtherPortMirrorIngress=wwpLeosEtherPortMirrorIngress, wwpLeosEtherPortAdaptiveRateSpeed=wwpLeosEtherPortAdaptiveRateSpeed, wwpLeosEtherPortLinkFlapDetectTime=wwpLeosEtherPortLinkFlapDetectTime, wwpLeosEtherPortTrapsTable=wwpLeosEtherPortTrapsTable, wwpLeosEtherPortMirrorEncap=wwpLeosEtherPortMirrorEncap, wwpLeosEtherPortMacSaDaSwapVlan=wwpLeosEtherPortMacSaDaSwapVlan, wwpLeosEtherPortTrapsEntry=wwpLeosEtherPortTrapsEntry, wwpLeosEtherPortIngressFixedDot1dPri=wwpLeosEtherPortIngressFixedDot1dPri, wwpLeosEtherPortMirrorPort=wwpLeosEtherPortMirrorPort, wwpLeosPortMIBNotifications=wwpLeosPortMIBNotifications, wwpLeosEtherFixedRColor=wwpLeosEtherFixedRColor, wwpLeosEtherPortVplsPortType=wwpLeosEtherPortVplsPortType, wwpLeosEtherPortIngressCosPolicy=wwpLeosEtherPortIngressCosPolicy, wwpLeosEtherPortStateMirrorGroupTable=wwpLeosEtherPortStateMirrorGroupTable, wwpLeosEtherPortMode=wwpLeosEtherPortMode, wwpLeosEtherPortOperationalSpeed=wwpLeosEtherPortOperationalSpeed, wwpLeosEtherPortName=wwpLeosEtherPortName, wwpLeosEtherPortOperSpeed=wwpLeosEtherPortOperSpeed, wwpLeosEtherPortStateMirrorGroupOperStatus=wwpLeosEtherPortStateMirrorGroupOperStatus, wwpLeosEtherPortOperAutoNeg=wwpLeosEtherPortOperAutoNeg, wwpLeosAggLinkUpDown=wwpLeosAggLinkUpDown, wwpLeosPortMIBObjects=wwpLeosPortMIBObjects, wwpLeosEtherPortStateMirrorGroupEntry=wwpLeosEtherPortStateMirrorGroupEntry, PortIngressFixedColor=PortIngressFixedColor, wwpLeosEtherPortId=wwpLeosEtherPortId, wwpLeosEtherPortVlanIngressFilterStrict=wwpLeosEtherPortVlanIngressFilterStrict, wwpLeosEtherPortStateMirrorGroupId=wwpLeosEtherPortStateMirrorGroupId, wwpLeosEtherPortIfgDecrease=wwpLeosEtherPortIfgDecrease, wwpLeosEtherPortUpTime=wwpLeosEtherPortUpTime, wwpLeosEtherPortMirrorEncapVid=wwpLeosEtherPortMirrorEncapVid, wwpLeosEtherPortUntagDataVsi=wwpLeosEtherPortUntagDataVsi, wwpLeosEtherPortFrameCosMapId=wwpLeosEtherPortFrameCosMapId, wwpLeosEtherPortLinkFlapCount=wwpLeosEtherPortLinkFlapCount, wwpLeosEtherStndLinkUpDownTrapsEnable=wwpLeosEtherStndLinkUpDownTrapsEnable, wwpLeosEtherPortOperStatus=wwpLeosEtherPortOperStatus, wwpLeosEtherPortAdvertDuplex=wwpLeosEtherPortAdvertDuplex, wwpLeosEtherPortStateMirrorGroupNumDstPorts=wwpLeosEtherPortStateMirrorGroupNumDstPorts, PortList=PortList, wwpLeosEtherPortTrapsState=wwpLeosEtherPortTrapsState, wwpLeosEtherPortMaxFrameSize=wwpLeosEtherPortMaxFrameSize, wwpLeosEtherPortPhyLoopback=wwpLeosEtherPortPhyLoopback, wwpLeosEtherPortUntagDataVsiType=wwpLeosEtherPortUntagDataVsiType, wwpLeosEtherPortFlushEntry=wwpLeosEtherPortFlushEntry, wwpLeosEtherPortLinkFlapHoldTime=wwpLeosEtherPortLinkFlapHoldTime, PYSNMP_MODULE_ID=wwpLeosPortMIB, wwpLeosEtherPortEgressSpeed=wwpLeosEtherPortEgressSpeed, wwpLeosEthLinkFlap=wwpLeosEthLinkFlap, wwpLeosEtherPortTable=wwpLeosEtherPortTable, wwpLeosEtherAggPortLinkUpDownTrapsEnable=wwpLeosEtherAggPortLinkUpDownTrapsEnable, wwpLeosEtherPortMacSaDaSwap=wwpLeosEtherPortMacSaDaSwap, wwpLeosEtherPortEgressCosPolicy=wwpLeosEtherPortEgressCosPolicy, wwpLeosEtherPortAdminSpeed=wwpLeosEtherPortAdminSpeed, wwpLeosEtherPortAdminDuplex=wwpLeosEtherPortAdminDuplex)
budget = int(input()) season = input() fisherman = int(input()) rent_price = 0 if season == "Spring": rent_price = 3000 elif season == "Summer" or season == "Autumn": rent_price = 4200 elif season == "Winter": rent_price = 2600 if fisherman <= 6: rent_price = rent_price - (rent_price * 0.1) elif 7 <= fisherman <= 11: rent_price = rent_price - (rent_price * 0.15) elif fisherman >= 12: rent_price = rent_price - (rent_price * 0.25) if fisherman % 2 == 0 and season == "Spring": rent_price = rent_price - (rent_price * 0.05) elif fisherman % 2 == 0 and season == "Summer": rent_price = rent_price - (rent_price * 0.05) elif fisherman % 2 == 0 and season == "Winter": rent_price = rent_price - (rent_price * 0.05) else: rent_price = rent_price if budget >= rent_price: extra_money = budget - rent_price print(f"Yes! You have {extra_money:.2f} leva left.") else: lack = rent_price - budget print(f"Not enough money! You need {lack:.2f} leva.")
budget = int(input()) season = input() fisherman = int(input()) rent_price = 0 if season == 'Spring': rent_price = 3000 elif season == 'Summer' or season == 'Autumn': rent_price = 4200 elif season == 'Winter': rent_price = 2600 if fisherman <= 6: rent_price = rent_price - rent_price * 0.1 elif 7 <= fisherman <= 11: rent_price = rent_price - rent_price * 0.15 elif fisherman >= 12: rent_price = rent_price - rent_price * 0.25 if fisherman % 2 == 0 and season == 'Spring': rent_price = rent_price - rent_price * 0.05 elif fisherman % 2 == 0 and season == 'Summer': rent_price = rent_price - rent_price * 0.05 elif fisherman % 2 == 0 and season == 'Winter': rent_price = rent_price - rent_price * 0.05 else: rent_price = rent_price if budget >= rent_price: extra_money = budget - rent_price print(f'Yes! You have {extra_money:.2f} leva left.') else: lack = rent_price - budget print(f'Not enough money! You need {lack:.2f} leva.')
def pascal_triangle(n): if n == 0: return [1] else: row = [1] line_behind = pascal_triangle(n - 1) for r in range(len(line_behind) - 1): row.append(line_behind[r] + line_behind[r + 1]) row += [1] return row print(pascal_triangle(4))
def pascal_triangle(n): if n == 0: return [1] else: row = [1] line_behind = pascal_triangle(n - 1) for r in range(len(line_behind) - 1): row.append(line_behind[r] + line_behind[r + 1]) row += [1] return row print(pascal_triangle(4))
class YesError(Exception): pass class YesUserCanceledError(YesError): pass class YesUnknownIssuerError(YesError): pass class YesAccountSelectionRequested(YesError): redirect_uri: str class YesOAuthError(YesError): oauth_error: str oauth_error_description: str
class Yeserror(Exception): pass class Yesusercancelederror(YesError): pass class Yesunknownissuererror(YesError): pass class Yesaccountselectionrequested(YesError): redirect_uri: str class Yesoautherror(YesError): oauth_error: str oauth_error_description: str
class Packtry(object): @staticmethod def print(): print('print')
class Packtry(object): @staticmethod def print(): print('print')
#!/usr/bin/env python # -*- coding: utf-8 -*- class UnsupportedFileFormatError(Exception): """ This exception is intended to communicate that the file extension is not one of the supported file types and cannot be parsed with AICSImage. """ def __init__(self, data, **kwargs): super().__init__(**kwargs) self.data = data def __str__(self): return f"AICSImage module does not support this image file type: '{self.data}'." class InvalidDimensionOrderingError(Exception): """ A general exception that can be thrown when handling dimension ordering or validation. Should be provided a message for the user to be given more context. """ def __init__(self, message: str, **kwargs): super().__init__(**kwargs) self.message = message def __str__(self): return self.message class ConflictingArgumentsError(Exception): """ This exception is returned when 2 arguments to the same function are in conflict. """ pass class InconsistentShapeError(Exception): """ A general function to use when the shape returned or requested from an array operation is invalid. """ pass class InconsistentPixelType(Exception): """ This exception is returned when the metadata has conflicting pixel types. """ pass
class Unsupportedfileformaterror(Exception): """ This exception is intended to communicate that the file extension is not one of the supported file types and cannot be parsed with AICSImage. """ def __init__(self, data, **kwargs): super().__init__(**kwargs) self.data = data def __str__(self): return f"AICSImage module does not support this image file type: '{self.data}'." class Invaliddimensionorderingerror(Exception): """ A general exception that can be thrown when handling dimension ordering or validation. Should be provided a message for the user to be given more context. """ def __init__(self, message: str, **kwargs): super().__init__(**kwargs) self.message = message def __str__(self): return self.message class Conflictingargumentserror(Exception): """ This exception is returned when 2 arguments to the same function are in conflict. """ pass class Inconsistentshapeerror(Exception): """ A general function to use when the shape returned or requested from an array operation is invalid. """ pass class Inconsistentpixeltype(Exception): """ This exception is returned when the metadata has conflicting pixel types. """ pass
class Constants: APPLICATION_TITLE = "Welcome to Kafka Local Setup Tool" APPLICATION_WINDOW_TITLE = "Kafka Application Tool" START_BUTTON = "Start" STOP_BUTTON = "Stop" CHOOSE_FOLDER = "Choose Folder" SELECT_FOLDER = "Select the folder" ZOOKEEPER_START_SERVER_PATH = "bin/zookeeper-server-start.sh" APACHE_ZOOKEEPER_START_SERVER_CONFIG = "config/zookeeper.properties" CONFLUENT_ZOOKEEPER_START_SERVER_CONFIG = "etc/zookeeper.properties" KAFKA_START_SERVER_PATH = "bin/kafka-server-start.sh" APACHE_KAFKA_START_SERVER_CONFIG = "config/server.properties" CONFLUENT_KAFKA_START_SERVER_CONFIG = "etc/server.properties" ZOOKEEPER_STOP_SERVER_PATH = "bin/zookeeper-server-stop.sh" KAFKA_STOP_SERVER_PATH = "bin/kafka-server-stop.sh" KAFKA_BASE_IMAGE = "app/images/kafka.png" APACHE_KAFKA = "Apache" CONFLUENT_KAFKA = "Confluent"
class Constants: application_title = 'Welcome to Kafka Local Setup Tool' application_window_title = 'Kafka Application Tool' start_button = 'Start' stop_button = 'Stop' choose_folder = 'Choose Folder' select_folder = 'Select the folder' zookeeper_start_server_path = 'bin/zookeeper-server-start.sh' apache_zookeeper_start_server_config = 'config/zookeeper.properties' confluent_zookeeper_start_server_config = 'etc/zookeeper.properties' kafka_start_server_path = 'bin/kafka-server-start.sh' apache_kafka_start_server_config = 'config/server.properties' confluent_kafka_start_server_config = 'etc/server.properties' zookeeper_stop_server_path = 'bin/zookeeper-server-stop.sh' kafka_stop_server_path = 'bin/kafka-server-stop.sh' kafka_base_image = 'app/images/kafka.png' apache_kafka = 'Apache' confluent_kafka = 'Confluent'
class User(): def __init__(self, Name, LastName, ID, Mail, Phone): self.Name = Name self.LastName = LastName self.ID = ID self.Mail = Mail self.Phone = Phone def Describe_U(self): s = "\nName: " + self.Name + " "+self.LastName + "\nID: "+self.ID s += "\nInfo contacto\nPhone: " + self.Phone + " Mail: " + self.Mail print(s) def Greet_U(self): s = "\nWelcome " + self.Name + " " + self.LastName + "\n" print(s) Usuarios = [] Usuarios.append(User("Omar","Padilla","1","omarpadilla@mail.com","1234567890")) Usuarios.append(User("Diego","Castillo","2","castillo117@mail.com","0987654321")) Usuarios.append(User("Fernanda","Cisneros","3","fercis@mail.com","7894561230")) Usuarios.append(User("Alejandra","Sanchez","4","alesa19@mail.com","3692581470")) Usuarios.append(User("Armando","Garces","5","chivascampeon@mail.com","4561237890")) for i in Usuarios: i.Describe_U() i.Greet_U()
class User: def __init__(self, Name, LastName, ID, Mail, Phone): self.Name = Name self.LastName = LastName self.ID = ID self.Mail = Mail self.Phone = Phone def describe_u(self): s = '\nName: ' + self.Name + ' ' + self.LastName + '\nID: ' + self.ID s += '\nInfo contacto\nPhone: ' + self.Phone + ' Mail: ' + self.Mail print(s) def greet_u(self): s = '\nWelcome ' + self.Name + ' ' + self.LastName + '\n' print(s) usuarios = [] Usuarios.append(user('Omar', 'Padilla', '1', 'omarpadilla@mail.com', '1234567890')) Usuarios.append(user('Diego', 'Castillo', '2', 'castillo117@mail.com', '0987654321')) Usuarios.append(user('Fernanda', 'Cisneros', '3', 'fercis@mail.com', '7894561230')) Usuarios.append(user('Alejandra', 'Sanchez', '4', 'alesa19@mail.com', '3692581470')) Usuarios.append(user('Armando', 'Garces', '5', 'chivascampeon@mail.com', '4561237890')) for i in Usuarios: i.Describe_U() i.Greet_U()
with open("data_100.vrt", "rb") as f_in: with open("data_broken_header.vrt", "wb") as f_out: f_out.write(f_in.read(2)) with open("data_missing_fields.vrt", "wb") as f_out: f_out.write(f_in.read(4)) with open("data_broken_fields.vrt", "wb") as f_out: f_out.write(f_in.read(6)) with open("data_missing_trailer.vrt", "wb") as f_out: f_out.write(f_in.read(4 * 514)) with open("data_missing_words.vrt", "wb") as f_out: f_out.write(f_in.read(4 * 514)) f_in.seek(4 * 7) f_out.write(f_in.read(4 * 10 * 515)) with open("if_context_100.vrt", "rb") as f_in: with open("if_context_missing_context.vrt", "wb") as f_out: f_out.write(f_in.read(4 * 2)) with open("if_context_broken_context.vrt", "wb") as f_out: f_out.write(f_in.read(4 * 3))
with open('data_100.vrt', 'rb') as f_in: with open('data_broken_header.vrt', 'wb') as f_out: f_out.write(f_in.read(2)) with open('data_missing_fields.vrt', 'wb') as f_out: f_out.write(f_in.read(4)) with open('data_broken_fields.vrt', 'wb') as f_out: f_out.write(f_in.read(6)) with open('data_missing_trailer.vrt', 'wb') as f_out: f_out.write(f_in.read(4 * 514)) with open('data_missing_words.vrt', 'wb') as f_out: f_out.write(f_in.read(4 * 514)) f_in.seek(4 * 7) f_out.write(f_in.read(4 * 10 * 515)) with open('if_context_100.vrt', 'rb') as f_in: with open('if_context_missing_context.vrt', 'wb') as f_out: f_out.write(f_in.read(4 * 2)) with open('if_context_broken_context.vrt', 'wb') as f_out: f_out.write(f_in.read(4 * 3))
""" Euclidean common divisor algorithm. """ def greatest_common_divisor(num_a: int, num_b: int) -> int: """ A method to compute the greatest common divisor. Args: num_a (int): The first number. num_b (int): Second number Returns: The greatest common divisor. """ if num_b == 0: return num_a print(f">>> Value of num_b: {num_b}") return greatest_common_divisor(num_b, num_a % num_b) if __name__ == "__main__": a = 357 b = 234 print(f">>> GCD of {a} and {b} is: {greatest_common_divisor(a, b)}")
""" Euclidean common divisor algorithm. """ def greatest_common_divisor(num_a: int, num_b: int) -> int: """ A method to compute the greatest common divisor. Args: num_a (int): The first number. num_b (int): Second number Returns: The greatest common divisor. """ if num_b == 0: return num_a print(f'>>> Value of num_b: {num_b}') return greatest_common_divisor(num_b, num_a % num_b) if __name__ == '__main__': a = 357 b = 234 print(f'>>> GCD of {a} and {b} is: {greatest_common_divisor(a, b)}')
n = int(input()) arr = [int(x) for x in input().split()] if all(item < 0 for item in arr): print(0) else: mx = 0 su = 0 for item in arr: su += item if su < 0: su = 0 if su > mx: mx = su print(mx)
n = int(input()) arr = [int(x) for x in input().split()] if all((item < 0 for item in arr)): print(0) else: mx = 0 su = 0 for item in arr: su += item if su < 0: su = 0 if su > mx: mx = su print(mx)
def flatten_list(mylist,index=0,newlist=[]): if(index==len(mylist)): return newlist if(type(mylist[index])== list): newlist.extend(flatten_list(mylist[index],0,[])) else: newlist.append(mylist[index]) return flatten_list(mylist,index+1,newlist) mylist=[1,2,[3,4],[5,[6,7,[8]]],[],9] print(mylist) flat_list= flatten_list(mylist) print(flat_list)
def flatten_list(mylist, index=0, newlist=[]): if index == len(mylist): return newlist if type(mylist[index]) == list: newlist.extend(flatten_list(mylist[index], 0, [])) else: newlist.append(mylist[index]) return flatten_list(mylist, index + 1, newlist) mylist = [1, 2, [3, 4], [5, [6, 7, [8]]], [], 9] print(mylist) flat_list = flatten_list(mylist) print(flat_list)
class Service(object): '''Basic service interface. If you want your own service, you should respect this interface so that your service can be used by the looper. ''' def __init__(self, cfg, comp, outdir): ''' cfg: framework.config.Service object containing whatever parameters you need comp: dummy parameter outdir: output directory for your service (feel free not to use it) Please have a look at TFileService for more information ''' def start(self): '''Start the service. Called by the looper, not by the user. ''' pass def stop(self): '''Stop the service. Called by the looper, not by the user. ''' pass
class Service(object): """Basic service interface. If you want your own service, you should respect this interface so that your service can be used by the looper. """ def __init__(self, cfg, comp, outdir): """ cfg: framework.config.Service object containing whatever parameters you need comp: dummy parameter outdir: output directory for your service (feel free not to use it) Please have a look at TFileService for more information """ def start(self): """Start the service. Called by the looper, not by the user. """ pass def stop(self): """Stop the service. Called by the looper, not by the user. """ pass
# Copyright 2015 Curtis Sand # # 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. class CommandMixin(object): """Command Mixin: Used to add commands to an interpreter. Subclasses of the CommandMixin should use mangled class attributes to avoid collisions when the interpreter object is put together. Example:: class Example(CommandMixin): '''Example command help documentation.''' def __count(self, opts): pass # some code goes here def __setup_parser(self): parser = ArgumentParser(prog='example', description=Example.__doc__) self._add_argument(parser, '-c', '--count', const=self.__count) return parser, self.__count def do_example(self, line): return super(Test2, self)._do(line, self.__setup_parser) def help_example(self): print(Example.__doc__) """ def __init__(self, engine): self.engine = engine def _do(self, line, setup_parser): """ The parser object will set arg.action to a method which will perform the action for this command. If opts.action is None, the method returned from "__setup_parser" will be called instead. """ try: parser, default_action = setup_parser() (opts, args) = parser.parse_known_args(line.split(' ')) setattr(opts, 'args', args) if opts.action is None: default_action(opts) else: opts.action(opts) except SystemExit: pass return False def _add_argument(self, parser, *args, **kwargs): """Help set the "action" and "dest" attrs for the argument""" action = 'action' dest = 'dest' if action not in kwargs: kwargs[action] = 'store_const' if dest not in kwargs: kwargs[dest] = action parser.add_argument(*args, **kwargs)
class Commandmixin(object): """Command Mixin: Used to add commands to an interpreter. Subclasses of the CommandMixin should use mangled class attributes to avoid collisions when the interpreter object is put together. Example:: class Example(CommandMixin): '''Example command help documentation.''' def __count(self, opts): pass # some code goes here def __setup_parser(self): parser = ArgumentParser(prog='example', description=Example.__doc__) self._add_argument(parser, '-c', '--count', const=self.__count) return parser, self.__count def do_example(self, line): return super(Test2, self)._do(line, self.__setup_parser) def help_example(self): print(Example.__doc__) """ def __init__(self, engine): self.engine = engine def _do(self, line, setup_parser): """ The parser object will set arg.action to a method which will perform the action for this command. If opts.action is None, the method returned from "__setup_parser" will be called instead. """ try: (parser, default_action) = setup_parser() (opts, args) = parser.parse_known_args(line.split(' ')) setattr(opts, 'args', args) if opts.action is None: default_action(opts) else: opts.action(opts) except SystemExit: pass return False def _add_argument(self, parser, *args, **kwargs): """Help set the "action" and "dest" attrs for the argument""" action = 'action' dest = 'dest' if action not in kwargs: kwargs[action] = 'store_const' if dest not in kwargs: kwargs[dest] = action parser.add_argument(*args, **kwargs)
def shorten_string(string : str, max_length : int): shortened_name = string if len(string) > max_length: shortened_name = string[0:max_length] + '...' return shortened_name
def shorten_string(string: str, max_length: int): shortened_name = string if len(string) > max_length: shortened_name = string[0:max_length] + '...' return shortened_name
#!/usr/bin/env python3 # # Prints to stdout very fast. # # Optimal time: # time ./stress.py >/dev/null # Actual time: # time ./stress.py for i in range(1000000): print('\033[31;1m', i, '\033[0m')
for i in range(1000000): print('\x1b[31;1m', i, '\x1b[0m')
GstreamerPackage ('gstreamer', 'gst-plugins-bad', '0.10.23', configure_flags = [ ' --disable-gtk-doc', ' --with-plugins=quicktime', ' --disable-apexsink', ' --disable-bz2', ' --disable-metadata', ' --disable-oss4', ' --disable-theoradec' ])
gstreamer_package('gstreamer', 'gst-plugins-bad', '0.10.23', configure_flags=[' --disable-gtk-doc', ' --with-plugins=quicktime', ' --disable-apexsink', ' --disable-bz2', ' --disable-metadata', ' --disable-oss4', ' --disable-theoradec'])
n = int(input()) list_names = [] for i in range(n): name = input() list_names.append(name) print(list_names)
n = int(input()) list_names = [] for i in range(n): name = input() list_names.append(name) print(list_names)
class CubeOrder: """"" There does not seem to be one single standard for cube representation among various solvers. Different programs will receive an input string expecting a different order. This class allows us to convert from one order to another order allowing stitching among solvers. The names of the facelet positions of the cube |************| |*U1**U2**U3*| |************| |*U4**U5**U6*| |************| |*U7**U8**U9*| |************| |************|************|************|************| |*L1**L2**L3*|*F1**F2**F3*|*R1**R2**R3*|*B1**B2**B3*| |************|************|************|************| |*L4**L5**L6*|*F4**F5**F6*|*R4**R5**R6*|*B4**B5**B6*| |************|************|************|************| |*L7**L8**L9*|*F7**F8**F9*|*R7**R8**R9*|*B7**B8**B9*| |************|************|************|************| |************| |*D1**D2**D3*| |************| |*D4**D5**D6*| |************| |*D7**D8**D9*| |************| Note that the bottom (B1-B9) is considered viewed from the bottom. So B1 is adjacent to R3. And B3 is adjacent to L1. Etc. """ U1 = "U1" U2 = "U2" U3 = "U3" U4 = "U4" U5 = "U5" U6 = "U6" U7 = "U7" U8 = "U8" U9 = "U9" L1 = "L1" L2 = "L2" L3 = "L3" L4 = "L4" L5 = "L5" L6 = "L6" L7 = "L7" L8 = "L8" L9 = "L9" F1 = "F1" F2 = "F2" F3 = "F3" F4 = "F4" F5 = "F5" F6 = "F6" F7 = "F7" F8 = "F8" F9 = "F9" R1 = "R1" R2 = "R2" R3 = "R3" R4 = "R4" R5 = "R5" R6 = "R6" R7 = "R7" R8 = "R8" R9 = "R9" B1 = "B1" B2 = "B2" B3 = "B3" B4 = "B4" B5 = "B5" B6 = "B6" B7 = "B7" B8 = "B8" B9 = "B9" D1 = "D1" D2 = "D2" D3 = "D3" D4 = "D4" D5 = "D5" D6 = "D6" D7 = "D7" D8 = "D8" D9 = "D9" # kociemba defines INPUT/OUPUT for his cube in an order that keeps the stickers of every face together # U1-U9, R1-R9, F1-F9, D1-D9, L1-L9, B1-B9 # Note: B7 is adjacent to R9 STICKER_GROUPS_URFDLB = [ U1, U2, U3, U4, U5, U6, U7, U8, U9, R1, R2, R3, # R3 is next to B1 R4, R5, R6, # R6 is next to B4 R7, R8, R9, # R9 is next to B7 F1, F2, F3, F4, F5, F6, F7, F8, F9, D1, D2, D3, D4, D5, D6, D7, D8, D9, L1, L2, L3, L4, L5, L6, L7, L8, L9, B1, B2, B3, # R3 is next to B1 B4, B5, B6, # R6 is next to B4 B7, B8, B9 # R9 is next to B7 ] #https://github.com/hkociemba/RubiksCube-TwophaseSolver KOCIEMBA_ORDER = STICKER_GROUPS_URFDLB #https://github.com/dwalton76/rubiks-color-resolver COLOR_RESOLVER_ORDER = [ U1, U2, U3, U4, U5, U6, U7, U8, U9, R1, R2, R3, R4, R5, R6, R7, R8, R9, F1, F2, F3, F4, F5, F6, F7, F8, F9, D1, D2, D3, D4, D5, D6, D7, D8, D9, L1, L2, L3, L4, L5, L6, L7, L8, L9, B1, B2, B3, B4, B5, B6, B7, B8, B9 #B3, B2, B1, #B6, B5, B4, #B9, B8, B7 ] # Other solvers represent INPUT/OUTPUT by unfolding the cube then simply reading order: # in top to bottom rows read left to right # Unfold back means we think of the Back as if viewed from below, looking up # as if unfolding a paper box and laying it down flat # The Back pieces retain their order as we rotate the entire cube around Z # Note: B7 is adjacent to R9 #https://github.com/pglass/cube SLICE_UNFOLD_BACK = [ U1, U2, U3, U4, U5, U6, U7, U8, U9, L1, L2, L3, F1, F2, F3, R1, R2, R3, B1, B2, B3, L4, L5, L6, F4, F5, F6, R4, R5, R6, B4, B5, B6, L7, L8, L9, F7, F8, F9, R7, R8, R9, B7, B8, B9, D1, D2, D3, D4, D5, D6, D7, D8, D9 ] # Xray slices means we think of the Back as if viewed through the front # Note: B7 is adjacent to R9 SLICE_XRAYBACK = [ U1, U2, U3, U4, U5, U6, U7, U8, U9, L1, L2, L3, F1, F2, F3, R1, R2, R3, B3, B2, B1, L4, L5, L6, F4, F5, F6, R4, R5, R6, B6, B5, B4, L7, L8, L9, F7, F8, F9, R7, R8, R9, B9, B8, B7, D1, D2, D3, D4, D5, D6, D7, D8, D9 ] #AnimCubeJS https://cubing.github.io/AnimCubeJS/animcubejs.html SLICE_ANIMJS3 = [ U7, U8, U9, U4, U5, U6, U1, U2, U3, D1, D4, D7, D2, D5, D8, D3, D6, D9, F1, F4, F7, F2, F5, F8, F3, F6, F9, B1, B4, B7, B2, B5, B8, B3, B6, B9, L3, L2, L1, L6, L5, L4, L9, L8, L7, R1, R4, R7, R2, R5, R8, R3, R6, R9, ] animOrderLookup = [ 7, 8, 9, 4, 5, 6, 1, 2, 3, 39, 38, 37, 19, 22, 25, 46, 49, 52, 28, 31, 34, 42, 41, 40, 20, 23, 26, 47, 50, 53, 29, 32, 35, 45, 44, 43, 21, 24, 27, 48, 51, 54, 30, 33, 36, 10, 13, 16, 11, 14, 17, 12, 15, 18, ] def convert (self, cubeString, fromType, toType): convertedList = [None]*54 for i, cubeChar in enumerate(cubeString): sticker = fromType[i] j = toType.index(sticker) convertedList[j] = cubeChar assert None not in convertedList convertString = "".join(convertedList) return convertString
class Cubeorder: """"" There does not seem to be one single standard for cube representation among various solvers. Different programs will receive an input string expecting a different order. This class allows us to convert from one order to another order allowing stitching among solvers. The names of the facelet positions of the cube |************| |*U1**U2**U3*| |************| |*U4**U5**U6*| |************| |*U7**U8**U9*| |************| |************|************|************|************| |*L1**L2**L3*|*F1**F2**F3*|*R1**R2**R3*|*B1**B2**B3*| |************|************|************|************| |*L4**L5**L6*|*F4**F5**F6*|*R4**R5**R6*|*B4**B5**B6*| |************|************|************|************| |*L7**L8**L9*|*F7**F8**F9*|*R7**R8**R9*|*B7**B8**B9*| |************|************|************|************| |************| |*D1**D2**D3*| |************| |*D4**D5**D6*| |************| |*D7**D8**D9*| |************| Note that the bottom (B1-B9) is considered viewed from the bottom. So B1 is adjacent to R3. And B3 is adjacent to L1. Etc. """ u1 = 'U1' u2 = 'U2' u3 = 'U3' u4 = 'U4' u5 = 'U5' u6 = 'U6' u7 = 'U7' u8 = 'U8' u9 = 'U9' l1 = 'L1' l2 = 'L2' l3 = 'L3' l4 = 'L4' l5 = 'L5' l6 = 'L6' l7 = 'L7' l8 = 'L8' l9 = 'L9' f1 = 'F1' f2 = 'F2' f3 = 'F3' f4 = 'F4' f5 = 'F5' f6 = 'F6' f7 = 'F7' f8 = 'F8' f9 = 'F9' r1 = 'R1' r2 = 'R2' r3 = 'R3' r4 = 'R4' r5 = 'R5' r6 = 'R6' r7 = 'R7' r8 = 'R8' r9 = 'R9' b1 = 'B1' b2 = 'B2' b3 = 'B3' b4 = 'B4' b5 = 'B5' b6 = 'B6' b7 = 'B7' b8 = 'B8' b9 = 'B9' d1 = 'D1' d2 = 'D2' d3 = 'D3' d4 = 'D4' d5 = 'D5' d6 = 'D6' d7 = 'D7' d8 = 'D8' d9 = 'D9' sticker_groups_urfdlb = [U1, U2, U3, U4, U5, U6, U7, U8, U9, R1, R2, R3, R4, R5, R6, R7, R8, R9, F1, F2, F3, F4, F5, F6, F7, F8, F9, D1, D2, D3, D4, D5, D6, D7, D8, D9, L1, L2, L3, L4, L5, L6, L7, L8, L9, B1, B2, B3, B4, B5, B6, B7, B8, B9] kociemba_order = STICKER_GROUPS_URFDLB color_resolver_order = [U1, U2, U3, U4, U5, U6, U7, U8, U9, R1, R2, R3, R4, R5, R6, R7, R8, R9, F1, F2, F3, F4, F5, F6, F7, F8, F9, D1, D2, D3, D4, D5, D6, D7, D8, D9, L1, L2, L3, L4, L5, L6, L7, L8, L9, B1, B2, B3, B4, B5, B6, B7, B8, B9] slice_unfold_back = [U1, U2, U3, U4, U5, U6, U7, U8, U9, L1, L2, L3, F1, F2, F3, R1, R2, R3, B1, B2, B3, L4, L5, L6, F4, F5, F6, R4, R5, R6, B4, B5, B6, L7, L8, L9, F7, F8, F9, R7, R8, R9, B7, B8, B9, D1, D2, D3, D4, D5, D6, D7, D8, D9] slice_xrayback = [U1, U2, U3, U4, U5, U6, U7, U8, U9, L1, L2, L3, F1, F2, F3, R1, R2, R3, B3, B2, B1, L4, L5, L6, F4, F5, F6, R4, R5, R6, B6, B5, B4, L7, L8, L9, F7, F8, F9, R7, R8, R9, B9, B8, B7, D1, D2, D3, D4, D5, D6, D7, D8, D9] slice_animjs3 = [U7, U8, U9, U4, U5, U6, U1, U2, U3, D1, D4, D7, D2, D5, D8, D3, D6, D9, F1, F4, F7, F2, F5, F8, F3, F6, F9, B1, B4, B7, B2, B5, B8, B3, B6, B9, L3, L2, L1, L6, L5, L4, L9, L8, L7, R1, R4, R7, R2, R5, R8, R3, R6, R9] anim_order_lookup = [7, 8, 9, 4, 5, 6, 1, 2, 3, 39, 38, 37, 19, 22, 25, 46, 49, 52, 28, 31, 34, 42, 41, 40, 20, 23, 26, 47, 50, 53, 29, 32, 35, 45, 44, 43, 21, 24, 27, 48, 51, 54, 30, 33, 36, 10, 13, 16, 11, 14, 17, 12, 15, 18] def convert(self, cubeString, fromType, toType): converted_list = [None] * 54 for (i, cube_char) in enumerate(cubeString): sticker = fromType[i] j = toType.index(sticker) convertedList[j] = cubeChar assert None not in convertedList convert_string = ''.join(convertedList) return convertString
class Dataset(object): """ Class representation of a dataset on Citrination. """ def __init__(self, id, name=None, description=None, created_at=None): """ Constructor. :param id: The ID of the dataset (required for instantiation) :type id: int :param name: The name of the dataset :type name: str :param description: The description of the dataset :type description: str :param created_at: The timestamp for creation of the dataset :type created_at: str """ self._name = name self._description = description self._id = id self._created_at = created_at @property def id(self): return self._id @property def name(self): return self._name @name.setter def name(self, value): self._name = value @name.deleter def name(self): self._name = None @property def description(self): return self._description @description.setter def description(self, value): self._description = value @description.deleter def description(self): self._description = None @property def created_at(self): return self._created_at @created_at.setter def created_at(self, value): self._created_at = value @created_at.deleter def created_at(self): self._created_at = None
class Dataset(object): """ Class representation of a dataset on Citrination. """ def __init__(self, id, name=None, description=None, created_at=None): """ Constructor. :param id: The ID of the dataset (required for instantiation) :type id: int :param name: The name of the dataset :type name: str :param description: The description of the dataset :type description: str :param created_at: The timestamp for creation of the dataset :type created_at: str """ self._name = name self._description = description self._id = id self._created_at = created_at @property def id(self): return self._id @property def name(self): return self._name @name.setter def name(self, value): self._name = value @name.deleter def name(self): self._name = None @property def description(self): return self._description @description.setter def description(self, value): self._description = value @description.deleter def description(self): self._description = None @property def created_at(self): return self._created_at @created_at.setter def created_at(self, value): self._created_at = value @created_at.deleter def created_at(self): self._created_at = None
"""Exception types.""" class IntegratorError(RuntimeError): """Error raised when integrator step fails.""" class NonReversibleStepError(IntegratorError): """Error raised when integrator step fails reversibility check.""" class ConvergenceError(IntegratorError): """Error raised when solver fails to converge within allowed iterations."""
"""Exception types.""" class Integratorerror(RuntimeError): """Error raised when integrator step fails.""" class Nonreversiblesteperror(IntegratorError): """Error raised when integrator step fails reversibility check.""" class Convergenceerror(IntegratorError): """Error raised when solver fails to converge within allowed iterations."""
class Solution: # 1st two-pass solution # O(2n) time | O(1) space def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ zero = 0 for i in range(len(nums)): if nums[i] == 0: nums[i], nums[zero] = nums[zero], nums[i] zero += 1 two = len(nums) - 1 for i in reversed(range(len(nums))): if nums[i] == 2: nums[i], nums[two] = nums[two], nums[i] two -= 1 # 2nd one-pass solution # O(n) time | O(1) space def sortColors(self, nums: List[int]) -> None: """ Since all numbers befor zero index have been checked, we could move forward directly. But for numbers after two index, after we change the numbers, we need to check current number again. """ zero = 0 two = len(nums) - 1 i = 0 while i <= two: if nums[i] == 0: nums[i], nums[zero] = nums[zero], nums[i] zero += 1 i += 1 elif nums[i] == 2: nums[i], nums[two] = nums[two], nums[i] two -= 1 elif nums[i] == 1: i += 1
class Solution: def sort_colors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ zero = 0 for i in range(len(nums)): if nums[i] == 0: (nums[i], nums[zero]) = (nums[zero], nums[i]) zero += 1 two = len(nums) - 1 for i in reversed(range(len(nums))): if nums[i] == 2: (nums[i], nums[two]) = (nums[two], nums[i]) two -= 1 def sort_colors(self, nums: List[int]) -> None: """ Since all numbers befor zero index have been checked, we could move forward directly. But for numbers after two index, after we change the numbers, we need to check current number again. """ zero = 0 two = len(nums) - 1 i = 0 while i <= two: if nums[i] == 0: (nums[i], nums[zero]) = (nums[zero], nums[i]) zero += 1 i += 1 elif nums[i] == 2: (nums[i], nums[two]) = (nums[two], nums[i]) two -= 1 elif nums[i] == 1: i += 1
#!/usr/bin/env python # -*- coding: utf-8 -*- EXPECTED_REPR = u"""""" EXPECTED_AGG_QUERY = { "week": { "aggs": { "nested_below_week": { "aggs": { "local_metrics.field_class.name": { "aggs": { "min_f1_score": { "min": { "field": "local_metrics.performance.test.f1_score" } } }, "terms": { "field": "local_metrics.field_class.name", "size": 10, }, } }, "nested": {"path": "local_metrics"}, } }, "date_histogram": {"field": "date", "format": "yyyy-MM-dd", "interval": "1w"}, } }
expected_repr = u'' expected_agg_query = {'week': {'aggs': {'nested_below_week': {'aggs': {'local_metrics.field_class.name': {'aggs': {'min_f1_score': {'min': {'field': 'local_metrics.performance.test.f1_score'}}}, 'terms': {'field': 'local_metrics.field_class.name', 'size': 10}}}, 'nested': {'path': 'local_metrics'}}}, 'date_histogram': {'field': 'date', 'format': 'yyyy-MM-dd', 'interval': '1w'}}}
"""Py4research main library. Note that it consists of two modules. """ __version__ = '1.0.1'
"""Py4research main library. Note that it consists of two modules. """ __version__ = '1.0.1'
# -*- coding: utf-8 -*- # Copyright 2021 Cohesity Inc. class DbTypeEnum(object): """Implementation of the 'DbType' enum. Specifies the type of the database in Oracle Protection Source. 'kRACDatabase' indicates the database is a RAC DB. 'kSingleInstance' indicates that the database is single instance. Attributes: KSINGLEINSTANCE: TODO: type description here. KRACDATABASE: TODO: type description here. """ KSINGLEINSTANCE = 'kSingleInstance' KRACDATABASE = 'kRACDatabase'
class Dbtypeenum(object): """Implementation of the 'DbType' enum. Specifies the type of the database in Oracle Protection Source. 'kRACDatabase' indicates the database is a RAC DB. 'kSingleInstance' indicates that the database is single instance. Attributes: KSINGLEINSTANCE: TODO: type description here. KRACDATABASE: TODO: type description here. """ ksingleinstance = 'kSingleInstance' kracdatabase = 'kRACDatabase'
# -*- coding: utf-8 -*- textFile = """ . . . One has to consider that the database is closed. Spyder """ print("Osman Orhun OZSAN") print("2017-01-19 14:00:00") print(textFile)
text_file = '\n.\n.\n.\n\n One has to consider that the database is closed.\n \n Spyder\n' print('Osman Orhun OZSAN') print('2017-01-19 14:00:00') print(textFile)
def mergeSort(myArray): # print to show splitting print("Splitting ",myArray) # if array is greater than 1 then: if len(myArray) > 1: # mid, leftside, and right side of array stored as variables mid = len(myArray)//2 lefthalf = myArray[:mid] righthalf = myArray[mid:] # function mergeSort passed both sides of array mergeSort(lefthalf) mergeSort(righthalf) # initialise i=0 j=0 k=0 # while loop, while i less than the length of leftside of array and right side of the array do the following while i < len(lefthalf) and j < len(righthalf): if lefthalf[i] < righthalf[j]: myArray[k] = lefthalf[i] i=i+1 else: myArray[k] = righthalf[j] j = j+1 k = k+1 # while loop, while i less than the length of leftside of array do the following while i < len(lefthalf): myArray[k] = lefthalf[i] i = i+1 k = k+1 # while loop, while j less than the length of rightside of array do the following while j < len(righthalf): myArray[k] = righthalf[j] j = j+1 k = k+1 # print to show merging print("Merging ",myArray) myArrray = [22,55,91,15,66,22,25,5,18] mergeSort(myArrray) print(myArrray)
def merge_sort(myArray): print('Splitting ', myArray) if len(myArray) > 1: mid = len(myArray) // 2 lefthalf = myArray[:mid] righthalf = myArray[mid:] merge_sort(lefthalf) merge_sort(righthalf) i = 0 j = 0 k = 0 while i < len(lefthalf) and j < len(righthalf): if lefthalf[i] < righthalf[j]: myArray[k] = lefthalf[i] i = i + 1 else: myArray[k] = righthalf[j] j = j + 1 k = k + 1 while i < len(lefthalf): myArray[k] = lefthalf[i] i = i + 1 k = k + 1 while j < len(righthalf): myArray[k] = righthalf[j] j = j + 1 k = k + 1 print('Merging ', myArray) my_arrray = [22, 55, 91, 15, 66, 22, 25, 5, 18] merge_sort(myArrray) print(myArrray)
class TSheetsError(Exception): """Exception Class to handle the failure of the request.""" def __init__(self, base_exception=None): self.base_exception = base_exception def __str__(self): if self.base_exception: return str(self.base_exception) return "An unknown error occurred." class FilterInvalidValueError(TSheetsError): pass class MethodNotAvailableError(TSheetsError): pass class TSheetsExpectedError(Exception): def __init__(self, base_exception=None, response=None): self.base_exception = base_exception self.response = response def __str__(self): error_msg = "" if self.base_exception: error_msg = str(self.base_exception) if self.response.status_code == 417: try: r = self.response.json() error = r.get("error", {}) msg = error.get("message", None) error_msg = msg except: pass return str(error_msg)
class Tsheetserror(Exception): """Exception Class to handle the failure of the request.""" def __init__(self, base_exception=None): self.base_exception = base_exception def __str__(self): if self.base_exception: return str(self.base_exception) return 'An unknown error occurred.' class Filterinvalidvalueerror(TSheetsError): pass class Methodnotavailableerror(TSheetsError): pass class Tsheetsexpectederror(Exception): def __init__(self, base_exception=None, response=None): self.base_exception = base_exception self.response = response def __str__(self): error_msg = '' if self.base_exception: error_msg = str(self.base_exception) if self.response.status_code == 417: try: r = self.response.json() error = r.get('error', {}) msg = error.get('message', None) error_msg = msg except: pass return str(error_msg)
"""Compatibility support for Python 2 and 3.""" try: string_types = (basestring,) except NameError: string_types = (str,)
"""Compatibility support for Python 2 and 3.""" try: string_types = (basestring,) except NameError: string_types = (str,)
ATOM, BOND, DIGIT, LPAR, RPAR, LSPAR, RSPAR, PLUS, MINUS, DOT, WILDCARD, PERCENT, AT, COLON, EOF = ( 'ATOM', 'BOND', 'DIGIT', '(', ')', '[', ']', '+', '-', '.', '*', '%', '@', ':', 'EOF' ) SYMBOLS_TR = { '=': BOND, '#': BOND, '$': BOND, '/': BOND, '\\': BOND, '(': LPAR, ')': RPAR, '[': LSPAR, ']': RSPAR, '+': PLUS, '-': MINUS, '.': DOT, '*': WILDCARD, '%': PERCENT, '@': AT, ':': COLON, # chain terminators: ' ': EOF, '\t': EOF, '\n': EOF, '\r': EOF, '\0': EOF, } BONDS_TYPE = [BOND, MINUS, COLON] BOND_ORDER = { '.': 0, '-': 1, '=': 2, '#': 3, '$': 4, '/': 1, '\\': 1 } ELEMENT_SYMBOLS = [ 'H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Fl', 'Lv', # TODO: next symbols 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr' ] AROMATIC_SYMBOLS = ['b', 'c', 'n', 'o', 'p', 's', 'se', 'as'] ALIPHATIC_SYMBOLS = ['B', 'C', 'N', 'O', 'S', 'P', 'F', 'Cl', 'Br'] TOT_SYMBOLS = ELEMENT_SYMBOLS + AROMATIC_SYMBOLS ORGANIC_SUBSET = AROMATIC_SYMBOLS + ALIPHATIC_SYMBOLS NORMAL_VALENCES = { 'B': (3,), 'C': (4,), 'N': (3, 5), 'O': (2,), 'P': (3, 5), 'S': (2, 4, 6), 'F': (1,), 'Cl': (1,), 'Br': (1,), 'I': (1,), 'Se': (2, 4, 6), 'As': (3, 5) } class Token: """Token class""" def __init__(self, type_, value, position=-1): self.type = type_ self.value = value self.position = position def __repr__(self): return 'Token({}, {}{})'.format( self.type, repr(self.value), ', {}'.format(self.position) if self.position > -1 else '')
(atom, bond, digit, lpar, rpar, lspar, rspar, plus, minus, dot, wildcard, percent, at, colon, eof) = ('ATOM', 'BOND', 'DIGIT', '(', ')', '[', ']', '+', '-', '.', '*', '%', '@', ':', 'EOF') symbols_tr = {'=': BOND, '#': BOND, '$': BOND, '/': BOND, '\\': BOND, '(': LPAR, ')': RPAR, '[': LSPAR, ']': RSPAR, '+': PLUS, '-': MINUS, '.': DOT, '*': WILDCARD, '%': PERCENT, '@': AT, ':': COLON, ' ': EOF, '\t': EOF, '\n': EOF, '\r': EOF, '\x00': EOF} bonds_type = [BOND, MINUS, COLON] bond_order = {'.': 0, '-': 1, '=': 2, '#': 3, '$': 4, '/': 1, '\\': 1} element_symbols = ['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe', 'Cs', 'Ba', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 'Fr', 'Ra', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Fl', 'Lv', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr'] aromatic_symbols = ['b', 'c', 'n', 'o', 'p', 's', 'se', 'as'] aliphatic_symbols = ['B', 'C', 'N', 'O', 'S', 'P', 'F', 'Cl', 'Br'] tot_symbols = ELEMENT_SYMBOLS + AROMATIC_SYMBOLS organic_subset = AROMATIC_SYMBOLS + ALIPHATIC_SYMBOLS normal_valences = {'B': (3,), 'C': (4,), 'N': (3, 5), 'O': (2,), 'P': (3, 5), 'S': (2, 4, 6), 'F': (1,), 'Cl': (1,), 'Br': (1,), 'I': (1,), 'Se': (2, 4, 6), 'As': (3, 5)} class Token: """Token class""" def __init__(self, type_, value, position=-1): self.type = type_ self.value = value self.position = position def __repr__(self): return 'Token({}, {}{})'.format(self.type, repr(self.value), ', {}'.format(self.position) if self.position > -1 else '')
#!/usr/bin/env python3 class Flower(): color = 'unknown' rose = Flower() rose.color = "red" violet = Flower() violet.color = "blue" this_pun_is_for_you = "The honey is sweet and so are you" print("Roses are {},".format(rose.color)) print("violets are {},".format(violet.color)) print(this_pun_is_for_you)
class Flower: color = 'unknown' rose = flower() rose.color = 'red' violet = flower() violet.color = 'blue' this_pun_is_for_you = 'The honey is sweet and so are you' print('Roses are {},'.format(rose.color)) print('violets are {},'.format(violet.color)) print(this_pun_is_for_you)
def query(start, end): if start < end: print('M {} {}'.format(start, end), flush=True) else: print('M {} {}'.format(end, start), flush=True) def swap(pos1, pos2): if pos1 < pos2: print('S {} {}'.format(pos1, pos2), flush=True) else: print('S {} {}'.format(pos2, pos1), flush=True) def solve(n): for i in range(1, n): start = i end = n query(start, end) min = int(input()) if min != i: swap(min, i) print('D') result = int(input()) if result != 1: quit() if __name__ == '__main__': t, n = list(map(int, input().split())) for case in range(1, t+1): solve(n)
def query(start, end): if start < end: print('M {} {}'.format(start, end), flush=True) else: print('M {} {}'.format(end, start), flush=True) def swap(pos1, pos2): if pos1 < pos2: print('S {} {}'.format(pos1, pos2), flush=True) else: print('S {} {}'.format(pos2, pos1), flush=True) def solve(n): for i in range(1, n): start = i end = n query(start, end) min = int(input()) if min != i: swap(min, i) print('D') result = int(input()) if result != 1: quit() if __name__ == '__main__': (t, n) = list(map(int, input().split())) for case in range(1, t + 1): solve(n)
# -*- mode: python -*- DOCUMENTATION = ''' --- module: group_by short_description: Create Ansible groups based on facts description: - Use facts to create ad-hoc groups that can be used later in a playbook. version_added: "0.9" options: key: description: - The variables whose values will be used as groups required: true author: Jeroen Hoekx notes: - Spaces in group names are converted to dashes '-'. ''' EXAMPLES = ''' # Create groups based on the machine architecture - group_by: key=machine_{{ ansible_machine }} # Create groups like 'kvm-host' - group_by: key=virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }} '''
documentation = '\n---\nmodule: group_by\nshort_description: Create Ansible groups based on facts\ndescription:\n - Use facts to create ad-hoc groups that can be used later in a playbook.\nversion_added: "0.9"\noptions:\n key:\n description:\n - The variables whose values will be used as groups\n required: true\nauthor: Jeroen Hoekx\nnotes:\n - Spaces in group names are converted to dashes \'-\'.\n' examples = "\n# Create groups based on the machine architecture\n- group_by: key=machine_{{ ansible_machine }}\n# Create groups like 'kvm-host'\n- group_by: key=virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }}\n"
""" 10.2.1 Can you implement the dynamic-set operation INSERT on a singly linked list in O(1) time? How about DELETE? """ class Node: def __init__(self, data=0, next=None): self.data = data self.next = next class LinkedList: def __init__(self): self.head = None """Insertion at the head is done in O(1) time""" def insert_at_head(self, data): new_node = Node(data) new_node.next = self.head self.head = new_node def insert_at_tail(self, data): new_node = Node(data) if self.head is None: self.head = new_node else: curr = self.head while curr.next: curr = curr.next curr.next = new_node def printll(self): curr = self.head while curr: print(curr.data, end=" -> ") curr = curr.next print("/") ll = LinkedList() ll.insert_at_tail(40) ll.insert_at_head(5) ll.insert_at_head(10) ll.printll() ll.insert_at_head(15) ll.insert_at_tail(20) ll.printll() """ Insertion at the head is only done in O(1) time DELETE operation can not be performed in O(1) time """
""" 10.2.1 Can you implement the dynamic-set operation INSERT on a singly linked list in O(1) time? How about DELETE? """ class Node: def __init__(self, data=0, next=None): self.data = data self.next = next class Linkedlist: def __init__(self): self.head = None 'Insertion at the head is done in O(1) time' def insert_at_head(self, data): new_node = node(data) new_node.next = self.head self.head = new_node def insert_at_tail(self, data): new_node = node(data) if self.head is None: self.head = new_node else: curr = self.head while curr.next: curr = curr.next curr.next = new_node def printll(self): curr = self.head while curr: print(curr.data, end=' -> ') curr = curr.next print('/') ll = linked_list() ll.insert_at_tail(40) ll.insert_at_head(5) ll.insert_at_head(10) ll.printll() ll.insert_at_head(15) ll.insert_at_tail(20) ll.printll() '\nInsertion at the head is only done in O(1) time\nDELETE operation can not be performed in O(1) time\n'
#!/usr/bin/env python3 """Advent of Code 2021 Day 12 - Passage Pathing""" with open('inputs/day_12.txt', 'r') as aoc_input: lines = [line.strip().split('-') for line in aoc_input.readlines()] connections = {} for line in lines: from_cave, to_cave = line if from_cave not in connections.keys(): connections[from_cave] = set() if to_cave not in connections.keys(): connections[to_cave] = set() connections[from_cave].add(to_cave) connections[to_cave].add(from_cave) paths = set() current_paths = [] for to_cave in connections['start']: current_paths.append(('start', to_cave)) while current_paths: path = current_paths.pop() current_cave = path[-1] for connected_cave in connections[current_cave]: # Can't revisit small caves if connected_cave in path and connected_cave.lower() == connected_cave: continue new_path = path + (connected_cave,) # Check if at end and unique path if connected_cave == 'end' and new_path not in paths: paths.add(new_path) continue current_paths.append(new_path) # Answer One print("Number of paths through cave system:", len(paths)) paths = set() current_paths = [] for to_cave in connections['start']: current_paths.append((('start', to_cave), False)) while current_paths: path, revisited = current_paths.pop() current_cave = path[-1] for connected_cave in connections[current_cave]: new_path_revisited = revisited # Can't go back to start if connected_cave == 'start': continue # Can't revisit small caves more than once for one of them if connected_cave in path: if connected_cave.lower() == connected_cave: if new_path_revisited: continue else: new_path_revisited = True new_path = path + (connected_cave,) # Check if at end and unique path if connected_cave == 'end' and new_path not in paths: paths.add(new_path) continue current_paths.append(((new_path), new_path_revisited)) # Answer Two print("Number of paths through cave system:", len(paths))
"""Advent of Code 2021 Day 12 - Passage Pathing""" with open('inputs/day_12.txt', 'r') as aoc_input: lines = [line.strip().split('-') for line in aoc_input.readlines()] connections = {} for line in lines: (from_cave, to_cave) = line if from_cave not in connections.keys(): connections[from_cave] = set() if to_cave not in connections.keys(): connections[to_cave] = set() connections[from_cave].add(to_cave) connections[to_cave].add(from_cave) paths = set() current_paths = [] for to_cave in connections['start']: current_paths.append(('start', to_cave)) while current_paths: path = current_paths.pop() current_cave = path[-1] for connected_cave in connections[current_cave]: if connected_cave in path and connected_cave.lower() == connected_cave: continue new_path = path + (connected_cave,) if connected_cave == 'end' and new_path not in paths: paths.add(new_path) continue current_paths.append(new_path) print('Number of paths through cave system:', len(paths)) paths = set() current_paths = [] for to_cave in connections['start']: current_paths.append((('start', to_cave), False)) while current_paths: (path, revisited) = current_paths.pop() current_cave = path[-1] for connected_cave in connections[current_cave]: new_path_revisited = revisited if connected_cave == 'start': continue if connected_cave in path: if connected_cave.lower() == connected_cave: if new_path_revisited: continue else: new_path_revisited = True new_path = path + (connected_cave,) if connected_cave == 'end' and new_path not in paths: paths.add(new_path) continue current_paths.append((new_path, new_path_revisited)) print('Number of paths through cave system:', len(paths))
#class that represents a resource class Resource: def __init__(self,name,id): self.name = name self.ID = id self.aliases = [name] #list of all the events this resource is involved in #reflects when the resource worked on which object #list of Event objects self.events = [] def getName(self): return self.name def setName(self,name): self.name = name def getID(self): return self.ID #add an alias for this resource def addAlias(self,name): if not (name in self.aliases): self.aliases.append(name) #get list of resource names def getNames(self): return self.aliases #returns a string of all the resource aliases def getLabel(self): label = "" count = 0 for alias in self.aliases: if(count != 0): label += "+" label += alias count += 1 return label def getEvents(self): return self.events #Append this event to the resource's list of events in which he was involved #@param event : event object def addEvent(self,event): self.events.append(event) #@returns a list of all the objects this programmer worked on in his Event list def getListOfObjects(self): files = [] for e in self.events: f = e.getObject() if f not in files: files.append(f) return files #@param file : Object object #@returns a list of time stamps the programmer worked on this object def getTimestampsForObject(self,file): timestamps = [] for e in self.events: if e.getObject() == file: time = e.getTimestamp() if time not in timestamps: timestamps.append(time) return timestamps
class Resource: def __init__(self, name, id): self.name = name self.ID = id self.aliases = [name] self.events = [] def get_name(self): return self.name def set_name(self, name): self.name = name def get_id(self): return self.ID def add_alias(self, name): if not name in self.aliases: self.aliases.append(name) def get_names(self): return self.aliases def get_label(self): label = '' count = 0 for alias in self.aliases: if count != 0: label += '+' label += alias count += 1 return label def get_events(self): return self.events def add_event(self, event): self.events.append(event) def get_list_of_objects(self): files = [] for e in self.events: f = e.getObject() if f not in files: files.append(f) return files def get_timestamps_for_object(self, file): timestamps = [] for e in self.events: if e.getObject() == file: time = e.getTimestamp() if time not in timestamps: timestamps.append(time) return timestamps
""" http://adventofcode.com/2017/day/9 """ def cleanStream(stream): streamToClean = stream[:] isCleaned = False while not isCleaned: idx = [i for i,item in enumerate(streamToClean) if item=="!"] if len(idx)<1: isCleaned = True break streamToClean = streamToClean[:idx[0]]+streamToClean[idx[0]+2:] return streamToClean def cleanGarbage(stream): streamToClean = cleanStream(stream) garbage = "" hasGarbage = True while hasGarbage: idxOpen = [i for i,item in enumerate(streamToClean) if item=="<"] idxClose = [i for i,item in enumerate(streamToClean) if item==">"] if len(idxOpen)<1 and len(idxClose)<1: hasGarbage = False break elif len(idxOpen)<1 or len(idxClose)<1: print("Mismatch in garbage parentheses") break garbage = garbage + streamToClean[idxOpen[0]+1:idxClose[0]] streamToClean = streamToClean[:idxOpen[0]]+streamToClean[idxClose[0]+1:] return streamToClean, garbage assert cleanGarbage("{<<<<>}") == ("{}","<<<") assert cleanGarbage("{<{!>}>}") == ("{}","{}") assert cleanGarbage("{<!!>}") == ("{}","") assert cleanGarbage("{<random characters>}") == ("{}","random characters") assert cleanGarbage("{<>}") == ("{}","") assert cleanGarbage("{<!!!>>}") == ("{}","") assert cleanGarbage('{<{o"i!a,<{i<a>}') == ("{}",'{o"i,<{i<a') def calculateScore(stream): streamToScore,garbage = cleanGarbage(stream) score = 0 currentPoint = 0 for bracket in streamToScore: if bracket == "{": currentPoint += 1 score += currentPoint elif bracket =="}": currentPoint -= 1 if currentPoint != 0: print("Mismatch in parentheses") return score assert calculateScore(cleanGarbage('{}')[0]) == 1 assert calculateScore(cleanGarbage('{{{}}}')[0]) == 6 assert calculateScore(cleanGarbage('{{},{}}')[0]) == 5 assert calculateScore(cleanGarbage('{{{},{},{{}}}}')[0]) == 16 assert calculateScore(cleanGarbage('{<a>,<a>,<a>,<a>}')[0]) == 1 assert calculateScore(cleanGarbage('{{<ab>},{<ab>},{<ab>},{<ab>}}')[0]) == 9 assert calculateScore(cleanGarbage('{{<!!>},{<!!>},{<!!>},{<!!>}}')[0]) == 9 assert calculateScore(cleanGarbage('{{<a!>},{<a!>},{<a!>},{<ab>}}')[0]) == 3 if __name__ == "__main__": with open("day09_input.txt") as f: # part 1 cleanedStream,garbage = cleanGarbage(f.read()) print(calculateScore(cleanedStream)) # part 2 print(len(garbage))
""" http://adventofcode.com/2017/day/9 """ def clean_stream(stream): stream_to_clean = stream[:] is_cleaned = False while not isCleaned: idx = [i for (i, item) in enumerate(streamToClean) if item == '!'] if len(idx) < 1: is_cleaned = True break stream_to_clean = streamToClean[:idx[0]] + streamToClean[idx[0] + 2:] return streamToClean def clean_garbage(stream): stream_to_clean = clean_stream(stream) garbage = '' has_garbage = True while hasGarbage: idx_open = [i for (i, item) in enumerate(streamToClean) if item == '<'] idx_close = [i for (i, item) in enumerate(streamToClean) if item == '>'] if len(idxOpen) < 1 and len(idxClose) < 1: has_garbage = False break elif len(idxOpen) < 1 or len(idxClose) < 1: print('Mismatch in garbage parentheses') break garbage = garbage + streamToClean[idxOpen[0] + 1:idxClose[0]] stream_to_clean = streamToClean[:idxOpen[0]] + streamToClean[idxClose[0] + 1:] return (streamToClean, garbage) assert clean_garbage('{<<<<>}') == ('{}', '<<<') assert clean_garbage('{<{!>}>}') == ('{}', '{}') assert clean_garbage('{<!!>}') == ('{}', '') assert clean_garbage('{<random characters>}') == ('{}', 'random characters') assert clean_garbage('{<>}') == ('{}', '') assert clean_garbage('{<!!!>>}') == ('{}', '') assert clean_garbage('{<{o"i!a,<{i<a>}') == ('{}', '{o"i,<{i<a') def calculate_score(stream): (stream_to_score, garbage) = clean_garbage(stream) score = 0 current_point = 0 for bracket in streamToScore: if bracket == '{': current_point += 1 score += currentPoint elif bracket == '}': current_point -= 1 if currentPoint != 0: print('Mismatch in parentheses') return score assert calculate_score(clean_garbage('{}')[0]) == 1 assert calculate_score(clean_garbage('{{{}}}')[0]) == 6 assert calculate_score(clean_garbage('{{},{}}')[0]) == 5 assert calculate_score(clean_garbage('{{{},{},{{}}}}')[0]) == 16 assert calculate_score(clean_garbage('{<a>,<a>,<a>,<a>}')[0]) == 1 assert calculate_score(clean_garbage('{{<ab>},{<ab>},{<ab>},{<ab>}}')[0]) == 9 assert calculate_score(clean_garbage('{{<!!>},{<!!>},{<!!>},{<!!>}}')[0]) == 9 assert calculate_score(clean_garbage('{{<a!>},{<a!>},{<a!>},{<ab>}}')[0]) == 3 if __name__ == '__main__': with open('day09_input.txt') as f: (cleaned_stream, garbage) = clean_garbage(f.read()) print(calculate_score(cleanedStream)) print(len(garbage))
# -*- coding: utf-8 -*- """ Created on Fri Jun 14 20:08:32 2019 @author: Parikshith.H """ class Date: def __init__(self,day,month,year): self.__day=day self.__month=month self.__year=year def get_day(self): return self.__day def get_month(self): return self.__month def get_year(self): return self.__year def set_day(self,value): self.__day=value def set_month(self,value): self.__month=value def set_year(self,value): self.__year=value class customer: def __init__(self,name,num,dob): self.__name=name self.__num=num self.__dob=dob def get_name(self): return self.__name def get_num(self): return self.__num def get_dob(self): return self.__dob def set_name(self,value): self.__name=value def set_num(self,value): self.__num=value def set_dob(self,value): self.__dob=value d=Date(13,11,1998) c1=customer("Manoj",7204444566,d) print(c1.get_name(),c1.get_num(),c1.get_dob().get_day()) #Manoj 7203344566 13 temp=c1.get_dob() print(temp.get_day()) #13 temp.set_year(1999) print(temp.get_day(),temp.get_month(),temp.get_year()) #13 11 1999 c1.get_dob().set_year(2000) # ============================================================================= # #output: # Manoj 7204444566 13 # 13 # 13 11 1999 # =============================================================================
""" Created on Fri Jun 14 20:08:32 2019 @author: Parikshith.H """ class Date: def __init__(self, day, month, year): self.__day = day self.__month = month self.__year = year def get_day(self): return self.__day def get_month(self): return self.__month def get_year(self): return self.__year def set_day(self, value): self.__day = value def set_month(self, value): self.__month = value def set_year(self, value): self.__year = value class Customer: def __init__(self, name, num, dob): self.__name = name self.__num = num self.__dob = dob def get_name(self): return self.__name def get_num(self): return self.__num def get_dob(self): return self.__dob def set_name(self, value): self.__name = value def set_num(self, value): self.__num = value def set_dob(self, value): self.__dob = value d = date(13, 11, 1998) c1 = customer('Manoj', 7204444566, d) print(c1.get_name(), c1.get_num(), c1.get_dob().get_day()) temp = c1.get_dob() print(temp.get_day()) temp.set_year(1999) print(temp.get_day(), temp.get_month(), temp.get_year()) c1.get_dob().set_year(2000)
class Book(): def __init__(self, name) -> None: self._name = name def get_name(self): return self._name class BookShelf(): def __init__(self) -> None: self._books: list[Book] = [] def append(self, book: Book): self._books.append(book) def get_book_at(self, index): return self._books[index] def is_valid(self, index): return 0 <= index < len(self._books) bookShelf = BookShelf() bookShelf.append(Book("Around the World in 80 days")) bookShelf.append(Book("Bible")) bookShelf.append(Book("Cinderella")) bookShelf.append(Book("Daddy-Long-Legs")) index = 0 while bookShelf.is_valid(index): book = bookShelf.get_book_at(index) print(book.get_name()) index += 1
class Book: def __init__(self, name) -> None: self._name = name def get_name(self): return self._name class Bookshelf: def __init__(self) -> None: self._books: list[Book] = [] def append(self, book: Book): self._books.append(book) def get_book_at(self, index): return self._books[index] def is_valid(self, index): return 0 <= index < len(self._books) book_shelf = book_shelf() bookShelf.append(book('Around the World in 80 days')) bookShelf.append(book('Bible')) bookShelf.append(book('Cinderella')) bookShelf.append(book('Daddy-Long-Legs')) index = 0 while bookShelf.is_valid(index): book = bookShelf.get_book_at(index) print(book.get_name()) index += 1
"""from random import random class TestDocTrackingMlflow: def test_doc(self): #### DOC START from dbnd import task from mlflow import start_run, end_run from mlflow import log_metric, log_param @task def calculate_alpha(): start_run() # params log_param("alpha", random()) log_param("beta", random()) # metrics log_metric("accuracy", random()) log_metric("coefficient", random()) end_run() #### DOC END calculate_alpha.dbnd_run()"""
"""from random import random class TestDocTrackingMlflow: def test_doc(self): #### DOC START from dbnd import task from mlflow import start_run, end_run from mlflow import log_metric, log_param @task def calculate_alpha(): start_run() # params log_param("alpha", random()) log_param("beta", random()) # metrics log_metric("accuracy", random()) log_metric("coefficient", random()) end_run() #### DOC END calculate_alpha.dbnd_run()"""
# -*- coding: utf-8 -*- def main(): s = input() k = int(input()) count = 0 for si in s: if si == '1': count += 1 else: break if s[0] != '1': print(s[0]) else: if k <= count: print(1) else: print(s[count]) if __name__ == '__main__': main()
def main(): s = input() k = int(input()) count = 0 for si in s: if si == '1': count += 1 else: break if s[0] != '1': print(s[0]) elif k <= count: print(1) else: print(s[count]) if __name__ == '__main__': main()
values = input("please fill value: ") previous = [] result = [] def isAEIOU(value): # value = str(value) if value.upper() == 'A': return True elif value.upper() == 'E': return True elif value.upper() == 'I': return True elif value.upper() == 'O': return True elif value.upper() == 'U': return True return False for value in values : if isAEIOU(value) : previous.append(value) if len(previous) > 1: result.append(''.join(previous)) else : previous.clear() print(len(result)) print(result)
values = input('please fill value: ') previous = [] result = [] def is_aeiou(value): if value.upper() == 'A': return True elif value.upper() == 'E': return True elif value.upper() == 'I': return True elif value.upper() == 'O': return True elif value.upper() == 'U': return True return False for value in values: if is_aeiou(value): previous.append(value) if len(previous) > 1: result.append(''.join(previous)) else: previous.clear() print(len(result)) print(result)
__author__ = 'Shane' class ClassToPass: def __init__(self, int1=int(), int2=int()): self.int1 = int1 self.int2 = int2 def gimmeTheSum(self, a, b) -> int: return a + b
__author__ = 'Shane' class Classtopass: def __init__(self, int1=int(), int2=int()): self.int1 = int1 self.int2 = int2 def gimme_the_sum(self, a, b) -> int: return a + b
"""Utility functions for the cargo rules""" load("//rust/platform:triple_mappings.bzl", "system_to_binary_ext") def _resolve_repository_template( template, abi = None, arch = None, system = None, tool = None, triple = None, vendor = None, version = None): """Render values into a repository template string Args: template (str): The template to use for rendering abi (str, optional): The host ABI arch (str, optional): The host CPU architecture system (str, optional): The host system name tool (str, optional): The tool to expect in the particular repository. Eg. `cargo`, `rustc`, `stdlib`. triple (str, optional): The host triple vendor (str, optional): The host vendor name version (str, optional): The Rust version used in the toolchain. Returns: string: The resolved template string based on the given parameters """ if abi: template = template.replace("{abi}", abi) if arch: template = template.replace("{arch}", arch) if system: template = template.replace("{system}", system) if tool: template = template.replace("{tool}", tool) if triple: template = template.replace("{triple}", triple) if vendor: template = template.replace("{vendor}", vendor) if version: template = template.replace("{version}", version) return template def get_rust_tools(cargo_template, rustc_template, host_triple, version): """Retrieve `cargo` and `rustc` labels based on the host triple. Args: cargo_template (str): A template used to identify the label of the host `cargo` binary. rustc_template (str): A template used to identify the label of the host `rustc` binary. host_triple (struct): The host's triple. See `@rules_rust//rust/platform:triple.bzl`. version (str): The version of Cargo+Rustc to use. Returns: struct: A struct containing the labels of expected tools """ extension = system_to_binary_ext(host_triple.system) cargo_label = Label(_resolve_repository_template( template = cargo_template, version = version, triple = host_triple.str, arch = host_triple.arch, vendor = host_triple.vendor, system = host_triple.system, abi = host_triple.abi, tool = "cargo" + extension, )) rustc_label = Label(_resolve_repository_template( template = rustc_template, version = version, triple = host_triple.str, arch = host_triple.arch, vendor = host_triple.vendor, system = host_triple.system, abi = host_triple.abi, tool = "rustc" + extension, )) return struct( cargo = cargo_label, rustc = rustc_label, )
"""Utility functions for the cargo rules""" load('//rust/platform:triple_mappings.bzl', 'system_to_binary_ext') def _resolve_repository_template(template, abi=None, arch=None, system=None, tool=None, triple=None, vendor=None, version=None): """Render values into a repository template string Args: template (str): The template to use for rendering abi (str, optional): The host ABI arch (str, optional): The host CPU architecture system (str, optional): The host system name tool (str, optional): The tool to expect in the particular repository. Eg. `cargo`, `rustc`, `stdlib`. triple (str, optional): The host triple vendor (str, optional): The host vendor name version (str, optional): The Rust version used in the toolchain. Returns: string: The resolved template string based on the given parameters """ if abi: template = template.replace('{abi}', abi) if arch: template = template.replace('{arch}', arch) if system: template = template.replace('{system}', system) if tool: template = template.replace('{tool}', tool) if triple: template = template.replace('{triple}', triple) if vendor: template = template.replace('{vendor}', vendor) if version: template = template.replace('{version}', version) return template def get_rust_tools(cargo_template, rustc_template, host_triple, version): """Retrieve `cargo` and `rustc` labels based on the host triple. Args: cargo_template (str): A template used to identify the label of the host `cargo` binary. rustc_template (str): A template used to identify the label of the host `rustc` binary. host_triple (struct): The host's triple. See `@rules_rust//rust/platform:triple.bzl`. version (str): The version of Cargo+Rustc to use. Returns: struct: A struct containing the labels of expected tools """ extension = system_to_binary_ext(host_triple.system) cargo_label = label(_resolve_repository_template(template=cargo_template, version=version, triple=host_triple.str, arch=host_triple.arch, vendor=host_triple.vendor, system=host_triple.system, abi=host_triple.abi, tool='cargo' + extension)) rustc_label = label(_resolve_repository_template(template=rustc_template, version=version, triple=host_triple.str, arch=host_triple.arch, vendor=host_triple.vendor, system=host_triple.system, abi=host_triple.abi, tool='rustc' + extension)) return struct(cargo=cargo_label, rustc=rustc_label)
N = input() N = '0' + N result = 0 carry = 0 for i in range(len(N) - 1, 0, -1): c = int(N[i]) + carry n = int(N[i - 1]) if c < 5 or (c == 5 and n < 5): result += c carry = 0 else: result += 10 - c carry = 1 result += carry print(result)
n = input() n = '0' + N result = 0 carry = 0 for i in range(len(N) - 1, 0, -1): c = int(N[i]) + carry n = int(N[i - 1]) if c < 5 or (c == 5 and n < 5): result += c carry = 0 else: result += 10 - c carry = 1 result += carry print(result)
class Demo: def __init__(self, name): self.name = name print("Started!") def hello(self): print("Hey " + self.name + "!") def goodbye(self): print("Good-bye " + self.name + "!") m = Demo("Alexa") m.hello() m.goodbye()
class Demo: def __init__(self, name): self.name = name print('Started!') def hello(self): print('Hey ' + self.name + '!') def goodbye(self): print('Good-bye ' + self.name + '!') m = demo('Alexa') m.hello() m.goodbye()
assert set([1,2]) == set([1,2]) assert not set([1,2,3]) == set([1,2]) assert set([1,2,3]) >= set([1,2]) assert set([1,2]) >= set([1,2]) assert not set([1,3]) >= set([1,2]) assert set([1,2,3]).issuperset(set([1,2])) assert set([1,2]).issuperset(set([1,2])) assert not set([1,3]).issuperset(set([1,2])) assert set([1,2,3]) > set([1,2]) assert not set([1,2]) > set([1,2]) assert not set([1,3]) > set([1,2]) assert set([1,2]) <= set([1,2,3]) assert set([1,2]) <= set([1,2]) assert not set([1,3]) <= set([1,2]) assert set([1,2]).issubset(set([1,2,3])) assert set([1,2]).issubset(set([1,2])) assert not set([1,3]).issubset(set([1,2])) assert set([1,2]) < set([1,2,3]) assert not set([1,2]) < set([1,2]) assert not set([1,3]) < set([1,2]) class Hashable(object): def __init__(self, obj): self.obj = obj def __repr__(self): return repr(self.obj) def __hash__(self): return id(self) recursive = set() recursive.add(Hashable(recursive)) assert repr(recursive) == "{set(...)}" a = set([1, 2, 3]) assert len(a) == 3 a.clear() assert len(a) == 0 assert set([1,2,3]).union(set([4,5])) == set([1,2,3,4,5]) assert set([1,2,3]).union(set([1,2,3,4,5])) == set([1,2,3,4,5]) assert set([1,2,3]) | set([4,5]) == set([1,2,3,4,5]) assert set([1,2,3]) | set([1,2,3,4,5]) == set([1,2,3,4,5]) assert set([1,2,3]).intersection(set([1,2])) == set([1,2]) assert set([1,2,3]).intersection(set([5,6])) == set([]) assert set([1,2,3]) & set([4,5]) == set([]) assert set([1,2,3]) & set([1,2,3,4,5]) == set([1,2,3]) assert set([1,2,3]).difference(set([1,2])) == set([3]) assert set([1,2,3]).difference(set([5,6])) == set([1,2,3]) assert set([1,2,3]) - set([4,5]) == set([1,2,3]) assert set([1,2,3]) - set([1,2,3,4,5]) == set([]) assert set([1,2,3]).symmetric_difference(set([1,2])) == set([3]) assert set([1,2,3]).symmetric_difference(set([5,6])) == set([1,2,3,5,6]) assert set([1,2,3]) ^ set([4,5]) == set([1,2,3,4,5]) assert set([1,2,3]) ^ set([1,2,3,4,5]) == set([4,5]) try: set([[]]) except TypeError: pass else: assert False, "TypeError was not raised" try: set().add([]) except TypeError: pass else: assert False, "TypeError was not raised"
assert set([1, 2]) == set([1, 2]) assert not set([1, 2, 3]) == set([1, 2]) assert set([1, 2, 3]) >= set([1, 2]) assert set([1, 2]) >= set([1, 2]) assert not set([1, 3]) >= set([1, 2]) assert set([1, 2, 3]).issuperset(set([1, 2])) assert set([1, 2]).issuperset(set([1, 2])) assert not set([1, 3]).issuperset(set([1, 2])) assert set([1, 2, 3]) > set([1, 2]) assert not set([1, 2]) > set([1, 2]) assert not set([1, 3]) > set([1, 2]) assert set([1, 2]) <= set([1, 2, 3]) assert set([1, 2]) <= set([1, 2]) assert not set([1, 3]) <= set([1, 2]) assert set([1, 2]).issubset(set([1, 2, 3])) assert set([1, 2]).issubset(set([1, 2])) assert not set([1, 3]).issubset(set([1, 2])) assert set([1, 2]) < set([1, 2, 3]) assert not set([1, 2]) < set([1, 2]) assert not set([1, 3]) < set([1, 2]) class Hashable(object): def __init__(self, obj): self.obj = obj def __repr__(self): return repr(self.obj) def __hash__(self): return id(self) recursive = set() recursive.add(hashable(recursive)) assert repr(recursive) == '{set(...)}' a = set([1, 2, 3]) assert len(a) == 3 a.clear() assert len(a) == 0 assert set([1, 2, 3]).union(set([4, 5])) == set([1, 2, 3, 4, 5]) assert set([1, 2, 3]).union(set([1, 2, 3, 4, 5])) == set([1, 2, 3, 4, 5]) assert set([1, 2, 3]) | set([4, 5]) == set([1, 2, 3, 4, 5]) assert set([1, 2, 3]) | set([1, 2, 3, 4, 5]) == set([1, 2, 3, 4, 5]) assert set([1, 2, 3]).intersection(set([1, 2])) == set([1, 2]) assert set([1, 2, 3]).intersection(set([5, 6])) == set([]) assert set([1, 2, 3]) & set([4, 5]) == set([]) assert set([1, 2, 3]) & set([1, 2, 3, 4, 5]) == set([1, 2, 3]) assert set([1, 2, 3]).difference(set([1, 2])) == set([3]) assert set([1, 2, 3]).difference(set([5, 6])) == set([1, 2, 3]) assert set([1, 2, 3]) - set([4, 5]) == set([1, 2, 3]) assert set([1, 2, 3]) - set([1, 2, 3, 4, 5]) == set([]) assert set([1, 2, 3]).symmetric_difference(set([1, 2])) == set([3]) assert set([1, 2, 3]).symmetric_difference(set([5, 6])) == set([1, 2, 3, 5, 6]) assert set([1, 2, 3]) ^ set([4, 5]) == set([1, 2, 3, 4, 5]) assert set([1, 2, 3]) ^ set([1, 2, 3, 4, 5]) == set([4, 5]) try: set([[]]) except TypeError: pass else: assert False, 'TypeError was not raised' try: set().add([]) except TypeError: pass else: assert False, 'TypeError was not raised'
def makeGood(s: str) -> str: stack = [] for i in range(len(s)): if stack and ((s[i].isupper() and stack[-1] == s[i].lower()) or (s[i].islower() and stack[-1] == s[i].upper())): stack.pop() else: stack.append(s[i]) return ''.join(stack)
def make_good(s: str) -> str: stack = [] for i in range(len(s)): if stack and (s[i].isupper() and stack[-1] == s[i].lower() or (s[i].islower() and stack[-1] == s[i].upper())): stack.pop() else: stack.append(s[i]) return ''.join(stack)
""" # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ class Solution(object): def levelOrder(self, root): """ :type root: Node :rtype: List[List[int]] """ if not root: return [] res = [] stack = [root] while stack: tmp = [] res.append([node.val for node in stack]) for node in stack: for child_node in node.children: tmp.append(child_node) stack = tmp return res
""" # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ class Solution(object): def level_order(self, root): """ :type root: Node :rtype: List[List[int]] """ if not root: return [] res = [] stack = [root] while stack: tmp = [] res.append([node.val for node in stack]) for node in stack: for child_node in node.children: tmp.append(child_node) stack = tmp return res
#Given a binary tree, return all root-to-leaf paths. # dfs+stack, bfs+queue, dfs recursively class Solution: def binaryTreePaths1(self, root): if not root: return [] res, stack = [], [(root, "")] while stack: node, ls = stack.pop() if not node.left and not node.right: res.append(ls+str(node.val)) if node.right: stack.append((node.right, ls+str(node.val)+"->")) if node.left: stack.append((node.left, ls+str(node.val)+"->")) return res # bfs + queue def binaryTreePaths2(self, root): if not root: return [] res, queue = [], collections.deque([(root, "")]) while queue: node, ls = queue.popleft() if not node.left and not node.right: res.append(ls+str(node.val)) if node.left: queue.append((node.left, ls+str(node.val)+"->")) if node.right: queue.append((node.right, ls+str(node.val)+"->")) return res # dfs recursively def binaryTreePaths(self, root): if not root: return [] res = [] self.dfs(root, "", res) return res def dfs(self, root, ls, res): if not root.left and not root.right: res.append(ls+str(root.val)) if root.left: self.dfs(root.left, ls+str(root.val)+"->", res) if root.right: self.dfs(root.right, ls+str(root.val)+"->", res)
class Solution: def binary_tree_paths1(self, root): if not root: return [] (res, stack) = ([], [(root, '')]) while stack: (node, ls) = stack.pop() if not node.left and (not node.right): res.append(ls + str(node.val)) if node.right: stack.append((node.right, ls + str(node.val) + '->')) if node.left: stack.append((node.left, ls + str(node.val) + '->')) return res def binary_tree_paths2(self, root): if not root: return [] (res, queue) = ([], collections.deque([(root, '')])) while queue: (node, ls) = queue.popleft() if not node.left and (not node.right): res.append(ls + str(node.val)) if node.left: queue.append((node.left, ls + str(node.val) + '->')) if node.right: queue.append((node.right, ls + str(node.val) + '->')) return res def binary_tree_paths(self, root): if not root: return [] res = [] self.dfs(root, '', res) return res def dfs(self, root, ls, res): if not root.left and (not root.right): res.append(ls + str(root.val)) if root.left: self.dfs(root.left, ls + str(root.val) + '->', res) if root.right: self.dfs(root.right, ls + str(root.val) + '->', res)
class Solution: def diagonalSum(self, mat: List[List[int]]) -> int: sum = 0 n = len(mat) for i in range(n): sum += mat[i][i] if i != n - 1 - i: sum += mat[i][n - 1 - i] return sum
class Solution: def diagonal_sum(self, mat: List[List[int]]) -> int: sum = 0 n = len(mat) for i in range(n): sum += mat[i][i] if i != n - 1 - i: sum += mat[i][n - 1 - i] return sum
def courses_list(user=None): user = auth.user if not user else db(db.users.id==user).select().first() if user.type_==1: courses = db(db.registered_courses.professor==user.id).select(db.registered_courses.course_id) courses = map(lambda x: x.course_id, courses) else: courses = db(db.student_registrations.student_id==user.id).select(db.student_registrations.registered_course_id) courses = map(lambda x: x.registered_course_id, courses) courses = db(db.courses.id.belongs(courses)).select() return dict(current_year=get_current_year(), current_sem=get_current_sem(), courses=courses, user=user)
def courses_list(user=None): user = auth.user if not user else db(db.users.id == user).select().first() if user.type_ == 1: courses = db(db.registered_courses.professor == user.id).select(db.registered_courses.course_id) courses = map(lambda x: x.course_id, courses) else: courses = db(db.student_registrations.student_id == user.id).select(db.student_registrations.registered_course_id) courses = map(lambda x: x.registered_course_id, courses) courses = db(db.courses.id.belongs(courses)).select() return dict(current_year=get_current_year(), current_sem=get_current_sem(), courses=courses, user=user)
def check_inners(rule): if target in rules[rule]: return 1 for bag in rules[rule]: if check_inners(bag): return 1 return 0 def part1(): count = 0 for rule in rules: #print(rule) if rule == target: next else: count += check_inners(rule) print('part 1 = ',count) ######################### def counting(rule): count = 0 for bag in rules[rule]: count += rules[rule][bag] count += rules[rule][bag] * counting(bag) return count def part2(): print('part 2 = ',counting(target)) ############################## target = "shiny gold" rules = dict() for line in open("input.txt"): main = line.split("bags contain")[0].strip() rules[main] = dict() inside = line.split("bags contain")[1].split(',') for bag in inside: if not "no other bags" in bag: bag = bag.replace('bags','').replace('bag','').replace('.','').strip() rules[main][' '.join(bag.split(' ')[1:] )] = int(bag.split(' ')[0]) part1() part2()
def check_inners(rule): if target in rules[rule]: return 1 for bag in rules[rule]: if check_inners(bag): return 1 return 0 def part1(): count = 0 for rule in rules: if rule == target: next else: count += check_inners(rule) print('part 1 = ', count) def counting(rule): count = 0 for bag in rules[rule]: count += rules[rule][bag] count += rules[rule][bag] * counting(bag) return count def part2(): print('part 2 = ', counting(target)) target = 'shiny gold' rules = dict() for line in open('input.txt'): main = line.split('bags contain')[0].strip() rules[main] = dict() inside = line.split('bags contain')[1].split(',') for bag in inside: if not 'no other bags' in bag: bag = bag.replace('bags', '').replace('bag', '').replace('.', '').strip() rules[main][' '.join(bag.split(' ')[1:])] = int(bag.split(' ')[0]) part1() part2()
#practice using data structures and several algorithms #compiled all classes into one class Node: def __init__(self, data): self.data = data self.next = None class BinaryNode: def __init__(self, data): self.data = data self.left = None self.right = None self.val = data class GraphNode: def __init__(self, data, adj=[], visited=0): self.data = data self.adj = adj self.next = None self.visited = visited def print_node(self): return self.data def print_adj(self): return self.adj def update_adj(self, arr): self.adj = arr class LinkedList: def __init__(self): self.head = None def getNodeValue(self, node): return node.data def deleteNode(self, key): headnode = self.head if headnode.data == key: headnode.data = None self.head = headnode.next else: prevnode = headnode headnode = headnode.next while headnode != None: #print(prevnode.data, headnode.data) if headnode.data == key: prevnode.next = headnode.next headnode = None else: prevnode = headnode headnode = headnode.next def insertNode(self, key, placement): insertnode = Node(key) headnode = self.head if placement == "start": insertnode.next = self.head self.head = insertnode if placement == "end": while headnode != None: #print(headnode.data) if headnode.next == None: headnode.next = insertnode break else: headnode = headnode.next def insertNodeBtwn(self, key, front, back): frontnode = self.head backnode = self.head.next while backnode != None: if frontnode.data == front and backnode.data == back: insertnode = Node(key) frontnode.next = insertnode insertnode.next = backnode break else: backnode = backnode.next frontnode = frontnode.next def printLList(self): nodeList = [] headnode = self.head while headnode != None: #print(headnode.data) nodeList.append(headnode.data) #print(headnode.data) headnode = headnode.next return nodeList class BinaryTree: def __init__(self): self.root = None #def rebalance(self, currNode): #while def visitTree(self, currNode): if currNode != None: self.visitTree(currNode.left) print(currNode.data) self.visitTree(currNode.right) def insertNode(self, nodeRoot, data): if self.root == None: self.root = BinaryNode(data) elif nodeRoot == None: #return nodeRoot(data) return BinaryNode(data) else: if nodeRoot.data == data: return nodeRoot elif nodeRoot.data < data: nodeRoot.right = self.insertNode(nodeRoot.right, data) else: nodeRoot.left = self.insertNode(nodeRoot.left, data) return nodeRoot def updateRoot(self, data): self.root = BinaryNode(data) def peek(self): return self.root.data class MinHeap: def __init__(self): self.arr = [] self.root = None def insert_node(self, val): self.arr.append(val) self.sift_up(val) def sift_up(self, curr_node): parent_pos = self.arr.index(curr_node)//2 child_pos = self.arr.index(curr_node) while self.arr[child_pos] < self.arr[parent_pos]: self.swap(self.arr.index(curr_node),(self.arr.index(curr_node)//2)) child_pos = parent_pos parent_pos = parent_pos//2 def swap(self, first_pos, second_pos): self.arr[first_pos], self.arr[second_pos] = self.arr[second_pos], self.arr[first_pos] def print_heap(self): print(self.arr) class Queue: def __init__(self): self.frontNode = None self.backNode = None def queueNode(self, newNode): #newNode = Node(key) if isinstance(newNode, GraphNode) or isinstance(newNode, Node): if self.backNode != None: self.backNode.next = newNode self.backNode = newNode if self.frontNode is None: self.frontNode = self.backNode else: return def dequeueNode(self): if self.frontNode is None: return data = self.frontNode self.frontNode = self.frontNode.next if self.frontNode is None: self.backNode = None return data def peek(self): return self.frontNode.data def isEmpty(self): if self.frontNode == None: return True else: return False def printQueue(self, currNode): arr = [] while currNode != None: arr.append(currNode.data) currNode = currNode.next print(arr) class Stack: def __init__(self): self.topNode = None def pushNode(self, newNode): if isinstance(newNode, Node): if self.topNode == None: self.topNode = newNode else: newNode.next = self.topNode self.topNode = newNode else: return def popNode(self): if self.topNode == None: return self.topNode = self.topNode.next def peek(self): return self.topNode.data def dfs(curr_node): if curr_node == None: return print(curr_node.print_node()) curr_node.visited = 1 for n in curr_node.adj: if n.visited == 0: dfs(n) def bfs(curr_node): order = Queue() #print(order.isEmpty()) curr_node.visited = 1 order.queueNode(curr_node) print(curr_node.data) #order.printQueue(curr_node) #print(order.isEmpty()) #print(curr_node.data) #print(order.frontNode.data) while order.isEmpty() != True: #print(order.isEmpty()) #print(curr_node.data) next_node = order.dequeueNode() next_node.visited = 1 order.printQueue(next_node) print("Dequeued " + str(next_node.data)) #print(order.isEmpty()) #print(next_node.adj) for n in next_node.adj: #print(n.visited) if n.visited == 0: print("Adding " + str(n.data) + " to queue") n.visited = 1 #print("Node " + str(n.data) + " visited " + str(n.visited)) order.queueNode(n) #print(order.peek())
class Node: def __init__(self, data): self.data = data self.next = None class Binarynode: def __init__(self, data): self.data = data self.left = None self.right = None self.val = data class Graphnode: def __init__(self, data, adj=[], visited=0): self.data = data self.adj = adj self.next = None self.visited = visited def print_node(self): return self.data def print_adj(self): return self.adj def update_adj(self, arr): self.adj = arr class Linkedlist: def __init__(self): self.head = None def get_node_value(self, node): return node.data def delete_node(self, key): headnode = self.head if headnode.data == key: headnode.data = None self.head = headnode.next else: prevnode = headnode headnode = headnode.next while headnode != None: if headnode.data == key: prevnode.next = headnode.next headnode = None else: prevnode = headnode headnode = headnode.next def insert_node(self, key, placement): insertnode = node(key) headnode = self.head if placement == 'start': insertnode.next = self.head self.head = insertnode if placement == 'end': while headnode != None: if headnode.next == None: headnode.next = insertnode break else: headnode = headnode.next def insert_node_btwn(self, key, front, back): frontnode = self.head backnode = self.head.next while backnode != None: if frontnode.data == front and backnode.data == back: insertnode = node(key) frontnode.next = insertnode insertnode.next = backnode break else: backnode = backnode.next frontnode = frontnode.next def print_l_list(self): node_list = [] headnode = self.head while headnode != None: nodeList.append(headnode.data) headnode = headnode.next return nodeList class Binarytree: def __init__(self): self.root = None def visit_tree(self, currNode): if currNode != None: self.visitTree(currNode.left) print(currNode.data) self.visitTree(currNode.right) def insert_node(self, nodeRoot, data): if self.root == None: self.root = binary_node(data) elif nodeRoot == None: return binary_node(data) else: if nodeRoot.data == data: return nodeRoot elif nodeRoot.data < data: nodeRoot.right = self.insertNode(nodeRoot.right, data) else: nodeRoot.left = self.insertNode(nodeRoot.left, data) return nodeRoot def update_root(self, data): self.root = binary_node(data) def peek(self): return self.root.data class Minheap: def __init__(self): self.arr = [] self.root = None def insert_node(self, val): self.arr.append(val) self.sift_up(val) def sift_up(self, curr_node): parent_pos = self.arr.index(curr_node) // 2 child_pos = self.arr.index(curr_node) while self.arr[child_pos] < self.arr[parent_pos]: self.swap(self.arr.index(curr_node), self.arr.index(curr_node) // 2) child_pos = parent_pos parent_pos = parent_pos // 2 def swap(self, first_pos, second_pos): (self.arr[first_pos], self.arr[second_pos]) = (self.arr[second_pos], self.arr[first_pos]) def print_heap(self): print(self.arr) class Queue: def __init__(self): self.frontNode = None self.backNode = None def queue_node(self, newNode): if isinstance(newNode, GraphNode) or isinstance(newNode, Node): if self.backNode != None: self.backNode.next = newNode self.backNode = newNode if self.frontNode is None: self.frontNode = self.backNode else: return def dequeue_node(self): if self.frontNode is None: return data = self.frontNode self.frontNode = self.frontNode.next if self.frontNode is None: self.backNode = None return data def peek(self): return self.frontNode.data def is_empty(self): if self.frontNode == None: return True else: return False def print_queue(self, currNode): arr = [] while currNode != None: arr.append(currNode.data) curr_node = currNode.next print(arr) class Stack: def __init__(self): self.topNode = None def push_node(self, newNode): if isinstance(newNode, Node): if self.topNode == None: self.topNode = newNode else: newNode.next = self.topNode self.topNode = newNode else: return def pop_node(self): if self.topNode == None: return self.topNode = self.topNode.next def peek(self): return self.topNode.data def dfs(curr_node): if curr_node == None: return print(curr_node.print_node()) curr_node.visited = 1 for n in curr_node.adj: if n.visited == 0: dfs(n) def bfs(curr_node): order = queue() curr_node.visited = 1 order.queueNode(curr_node) print(curr_node.data) while order.isEmpty() != True: next_node = order.dequeueNode() next_node.visited = 1 order.printQueue(next_node) print('Dequeued ' + str(next_node.data)) for n in next_node.adj: if n.visited == 0: print('Adding ' + str(n.data) + ' to queue') n.visited = 1 order.queueNode(n)
# list(map(int, input().split())) # int(input()) def main(X, Y): cand = Y // 4 for i in range(cand, -1, -1): if i * 4 + (X - i) * 2 == Y: print('Yes') exit() else: print('No') if __name__ == '__main__': X, Y = list(map(int, input().split())) main(X, Y)
def main(X, Y): cand = Y // 4 for i in range(cand, -1, -1): if i * 4 + (X - i) * 2 == Y: print('Yes') exit() else: print('No') if __name__ == '__main__': (x, y) = list(map(int, input().split())) main(X, Y)
class Solution: def peakIndexInMountainArray(self, arr: List[int]) -> int: count = 0 for i in range(len(arr)-1): if arr[i] < arr[i+1]: count += 1 return count
class Solution: def peak_index_in_mountain_array(self, arr: List[int]) -> int: count = 0 for i in range(len(arr) - 1): if arr[i] < arr[i + 1]: count += 1 return count
def mutate_kernel_size(kernel): return None def mutate_stride(stride): return None def mutate_padding(padding): return None def mutate_filter(filter): return None
def mutate_kernel_size(kernel): return None def mutate_stride(stride): return None def mutate_padding(padding): return None def mutate_filter(filter): return None
# Check a number for prime.... a = int(input("Enter Number: ")) c = 0 for i in range(1, a+1): if a % i == 0: c += 1 if c == 2: print("Prime") else: print("Not Prime")
a = int(input('Enter Number: ')) c = 0 for i in range(1, a + 1): if a % i == 0: c += 1 if c == 2: print('Prime') else: print('Not Prime')
def readint(msg): ok = False value = 0 while True: n1 = str(input(msg)) if n1.isnumeric(): value = int(n1) ok = True else: print('\033[0;31mError! Please enter a valid number. \033[m') if ok: break return value n = readint('Enter a number: ') print(f'You just typed the number {n}')
def readint(msg): ok = False value = 0 while True: n1 = str(input(msg)) if n1.isnumeric(): value = int(n1) ok = True else: print('\x1b[0;31mError! Please enter a valid number. \x1b[m') if ok: break return value n = readint('Enter a number: ') print(f'You just typed the number {n}')
# https://leetcode.com/problems/keys-and-rooms/ class Solution: def canVisitAllRooms(self, rooms: List[List[int]]) -> bool: return self.dfs(rooms, 0, set()) def dfs(self, rooms: List[List[int]], node: int, visited: set[int]) -> bool: if node in visited: return False visited.add(node) if len(visited) == len(rooms): return True for key in rooms[node]: if self.dfs(rooms, key, visited): return True return False
class Solution: def can_visit_all_rooms(self, rooms: List[List[int]]) -> bool: return self.dfs(rooms, 0, set()) def dfs(self, rooms: List[List[int]], node: int, visited: set[int]) -> bool: if node in visited: return False visited.add(node) if len(visited) == len(rooms): return True for key in rooms[node]: if self.dfs(rooms, key, visited): return True return False
c = float(input()) n = int(input()) t=0 for each in range(n): h,w = list(map(float, input().split())) t+= h*w*c print("{:.8f}".format(t))
c = float(input()) n = int(input()) t = 0 for each in range(n): (h, w) = list(map(float, input().split())) t += h * w * c print('{:.8f}'.format(t))
class Dsu: def __init__(self, n, ranked): self.parents = [i for i in range(n)] self.ranked = ranked self.ranks = [0 for i in range(n)] self.messages = [0 for i in range(n)] self.read = [0 for i in range(n)] def find(self, v): if v == self.parents[v]: return v else: head = self.find(self.parents[v]) if head != self.parents[v]: self.messages[v] += self.messages[self.parents[v]] self.parents[v] = head return self.parents[v] def check(self, v): self.find(v) value = self.messages[v] - self.read[v] if self.parents[v] != v: value += self.messages[self.parents[v]] self.read[v] += value return value def send(self, v): a = self.find(v) self.messages[a] += 1 def union(self, a, b): a = self.find(a) b = self.find(b) if a != b: if self.ranked: if self.ranks[a] < self.ranks[b]: a, b = b, a self.parents[b] = a self.messages[b] -= self.messages[a] if self.ranks[a] == self.ranks[b]: self.ranks[a] += 1 else: self.parents[a] = b return True return False def getX(i): # return i return (i+zerg)%n n, m = map(int, input().split()) dsu = Dsu(n, True) p = int(1e6+3) zerg = 0 for i in range(m): line = input().split() if line[0] == '1': i = int(line[1]) dsu.send(getX(i)) zerg = (30 * zerg + 239) % p elif line[0] == '2': i = int(line[1]) j = int(line[2]) if dsu.union(getX(i), getX(j)): zerg = (13*zerg+11) % p else: i = int(line[1]) read = dsu.check(getX(i)) print(read) zerg = (100500*zerg+read) % p
class Dsu: def __init__(self, n, ranked): self.parents = [i for i in range(n)] self.ranked = ranked self.ranks = [0 for i in range(n)] self.messages = [0 for i in range(n)] self.read = [0 for i in range(n)] def find(self, v): if v == self.parents[v]: return v else: head = self.find(self.parents[v]) if head != self.parents[v]: self.messages[v] += self.messages[self.parents[v]] self.parents[v] = head return self.parents[v] def check(self, v): self.find(v) value = self.messages[v] - self.read[v] if self.parents[v] != v: value += self.messages[self.parents[v]] self.read[v] += value return value def send(self, v): a = self.find(v) self.messages[a] += 1 def union(self, a, b): a = self.find(a) b = self.find(b) if a != b: if self.ranked: if self.ranks[a] < self.ranks[b]: (a, b) = (b, a) self.parents[b] = a self.messages[b] -= self.messages[a] if self.ranks[a] == self.ranks[b]: self.ranks[a] += 1 else: self.parents[a] = b return True return False def get_x(i): return (i + zerg) % n (n, m) = map(int, input().split()) dsu = dsu(n, True) p = int(1000000.0 + 3) zerg = 0 for i in range(m): line = input().split() if line[0] == '1': i = int(line[1]) dsu.send(get_x(i)) zerg = (30 * zerg + 239) % p elif line[0] == '2': i = int(line[1]) j = int(line[2]) if dsu.union(get_x(i), get_x(j)): zerg = (13 * zerg + 11) % p else: i = int(line[1]) read = dsu.check(get_x(i)) print(read) zerg = (100500 * zerg + read) % p
""" Exceptions ~~~~~~~~~~ Custom exceptions raised by the phenotype service. """ class PhenotypeError(Exception): pass
""" Exceptions ~~~~~~~~~~ Custom exceptions raised by the phenotype service. """ class Phenotypeerror(Exception): pass
''' A simple exercie sript to find out total pay by multiplying hours worked with rate per hour. ''' hr1 = input('Enter Hours: ') rate1 = input('Enter Rate: ') # made failure proof so if user inputs values other than number it won't crash # and through an error. so the program will just quit with following warning # to the user try: hrs = float(hr1) rate = float(rate1) # scrip can be made much better by adding 'continue' instead of 'quit()' in a # while loop so that by printing failure message it just asks user for other # input instead of quiting except: print('Failure: Enter Integers Only') quit() pay = float(hrs * rate) print('Pay:', pay)
""" A simple exercie sript to find out total pay by multiplying hours worked with rate per hour. """ hr1 = input('Enter Hours: ') rate1 = input('Enter Rate: ') try: hrs = float(hr1) rate = float(rate1) except: print('Failure: Enter Integers Only') quit() pay = float(hrs * rate) print('Pay:', pay)
spark = SparkSession \ .builder \ .appName("exercise_eighteen") \ .getOrCreate() (df.select("id", "first_name", "last_name", "gender", "country", "birthdate", "salary") .filter(df["country"] == "United States") .orderBy(df["gender"].asc(), df["salary"].asc()) .show()) df.select("id", "first_name", "last_name", "gender", "country", "birthdate", "salary") \ .filter(df["country"] == "United States") \ .orderBy(df["gender"].asc(), df["salary"].asc()) \ .show()
spark = SparkSession.builder.appName('exercise_eighteen').getOrCreate() df.select('id', 'first_name', 'last_name', 'gender', 'country', 'birthdate', 'salary').filter(df['country'] == 'United States').orderBy(df['gender'].asc(), df['salary'].asc()).show() df.select('id', 'first_name', 'last_name', 'gender', 'country', 'birthdate', 'salary').filter(df['country'] == 'United States').orderBy(df['gender'].asc(), df['salary'].asc()).show()
"""utils.py""" def param_dict(param_list): """param_dict""" dct = {} for param in param_list: dct[param.key] = param return dct
"""utils.py""" def param_dict(param_list): """param_dict""" dct = {} for param in param_list: dct[param.key] = param return dct
#personaldetails print("NAME: Jaskeerat Singh \nE-MAIL: jsing322@uwo.ca \nSLACK USERNAME: @jass \nBIOSTACK: Genomics \nTwitter Handle: @jsin") def hamming_distance(a,b): count=0 for i in range(len(a)): if a[i] != b[i]: count +=1 return count print(hamming_distance('@jass','@jsin'))
print('NAME: Jaskeerat Singh \nE-MAIL: jsing322@uwo.ca \nSLACK USERNAME: @jass \nBIOSTACK: Genomics \nTwitter Handle: @jsin') def hamming_distance(a, b): count = 0 for i in range(len(a)): if a[i] != b[i]: count += 1 return count print(hamming_distance('@jass', '@jsin'))
# autogenerated by /home/astivala/phd/ptgraph/buildversion.sh # Fri Aug 10 09:43:43 EST 2012 def get_version(): """ Return version string containing global version number and 'build' date """ return "Revision 4288:4291, Fri Aug 10 09:43:43 EST 2012"
def get_version(): """ Return version string containing global version number and 'build' date """ return 'Revision 4288:4291, Fri Aug 10 09:43:43 EST 2012'
"""Role testing files using testinfra.""" def test_lvm_package_shall_be_installed(host): assert host.package("lvm2").is_installed def test_non_persistent_volume_group_is_created(host): command = """sudo vgdisplay | grep -c 'non-persistent'""" cmd = host.run(command) assert '1' in cmd.stdout def test_thinpool_logical_volume_is_created(host): command = """sudo lvs -o lv_name non-persistent --separator='|' \ --noheadings | grep -c 'thinpool'""" cmd = host.run(command) assert int(cmd.stdout.rstrip()) >= 1 def test_thinpoolmeta_logical_volume_is_created(host): command = """sudo lvs -o metadata_lv non-persistent --separator='|' \ --noheadings | grep -c 'thinpool_tmeta'""" cmd = host.run(command) assert '1' in cmd.stdout def test_thinpool_profile_autoextends_treshold_is_set(host): command = """cat /etc/lvm/profile/non-persistent-thinpool.profile \ | grep -c 'thin_pool_autoextend_threshold=80'""" cmd = host.run(command) assert '1' in cmd.stdout def test_thinpool_profile_autoextends_percent_is_set(host): command = """cat /etc/lvm/profile/non-persistent-thinpool.profile \ | grep -c 'thin_pool_autoextend_percent=20'""" cmd = host.run(command) assert '1' in cmd.stdout def test_thinpool_is_monitored(host): command = """sudo lvs -o+seg_monitor | grep -c 'monitored'""" cmd = host.run(command) assert '1' in cmd.stdout # Don't know how to test autoextend def test_formating_is_xfs(host): command = """sudo xfs_info /dev/non-persistent/thinpool \ | grep -c 'ftype=1'""" cmd = host.run(command) assert '1' in cmd.stdout def test_xfs_volume_is_mounted(host): host.file("/var/lib/docker").mode == 0o731
"""Role testing files using testinfra.""" def test_lvm_package_shall_be_installed(host): assert host.package('lvm2').is_installed def test_non_persistent_volume_group_is_created(host): command = "sudo vgdisplay | grep -c 'non-persistent'" cmd = host.run(command) assert '1' in cmd.stdout def test_thinpool_logical_volume_is_created(host): command = "sudo lvs -o lv_name non-persistent --separator='|' --noheadings | grep -c 'thinpool'" cmd = host.run(command) assert int(cmd.stdout.rstrip()) >= 1 def test_thinpoolmeta_logical_volume_is_created(host): command = "sudo lvs -o metadata_lv non-persistent --separator='|' --noheadings | grep -c 'thinpool_tmeta'" cmd = host.run(command) assert '1' in cmd.stdout def test_thinpool_profile_autoextends_treshold_is_set(host): command = "cat /etc/lvm/profile/non-persistent-thinpool.profile | grep -c 'thin_pool_autoextend_threshold=80'" cmd = host.run(command) assert '1' in cmd.stdout def test_thinpool_profile_autoextends_percent_is_set(host): command = "cat /etc/lvm/profile/non-persistent-thinpool.profile | grep -c 'thin_pool_autoextend_percent=20'" cmd = host.run(command) assert '1' in cmd.stdout def test_thinpool_is_monitored(host): command = "sudo lvs -o+seg_monitor | grep -c 'monitored'" cmd = host.run(command) assert '1' in cmd.stdout def test_formating_is_xfs(host): command = "sudo xfs_info /dev/non-persistent/thinpool | grep -c 'ftype=1'" cmd = host.run(command) assert '1' in cmd.stdout def test_xfs_volume_is_mounted(host): host.file('/var/lib/docker').mode == 473
""" Get Height of Binary Tree """ class Node: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right def get_height(root): """ >>> assert(get_height(None) == -1) >>> root = Node(1) >>> assert(get_height(root) == 0) >>> root = Node(1, Node(2)) >>> assert(get_height(root) == 1) >>> root = Node(1, Node(2, Node(3))) >>> assert(get_height(root) == 2) """ if root is None: return -1 height_left = get_height(root.left) height_right = get_height(root.right) return 1 + max(height_left, height_right)
""" Get Height of Binary Tree """ class Node: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right def get_height(root): """ >>> assert(get_height(None) == -1) >>> root = Node(1) >>> assert(get_height(root) == 0) >>> root = Node(1, Node(2)) >>> assert(get_height(root) == 1) >>> root = Node(1, Node(2, Node(3))) >>> assert(get_height(root) == 2) """ if root is None: return -1 height_left = get_height(root.left) height_right = get_height(root.right) return 1 + max(height_left, height_right)
# Time: O(logn) # Space: O(1) class Solution(object): def toHex(self, num): """ :type num: int :rtype: str """ if not num: return "0" result = [] while num and len(result) != 8: h = num & 15 if h < 10: result.append(str(chr(ord('0') + h))) else: result.append(str(chr(ord('a') + h-10))) num >>= 4 result.reverse() return "".join(result)
class Solution(object): def to_hex(self, num): """ :type num: int :rtype: str """ if not num: return '0' result = [] while num and len(result) != 8: h = num & 15 if h < 10: result.append(str(chr(ord('0') + h))) else: result.append(str(chr(ord('a') + h - 10))) num >>= 4 result.reverse() return ''.join(result)
class Interface(object): def __init__(self, name, idx, addrwidth, datawidth, lite=False): self.name = name self.idx = idx self.datawidth = datawidth self.addrwidth = addrwidth self.lite = lite def __repr__(self): ret = [] ret.append('(') ret.append(self.__class__.__name__) ret.append(' ') ret.append('NAME:') ret.append(str(self.name)) ret.append(' ') ret.append('ID:') ret.append(str(self.idx)) ret.append(' ') ret.append('ADDR_WIDTH:') ret.append(str(self.addrwidth)) ret.append(' ') ret.append('DATA_WIDTH:') ret.append(str(self.datawidth)) ret.append(' ') ret.append('LITE:') ret.append(str(self.lite)) ret.append(')') return ''.join(ret) class MasterMemory(Interface): pass class SlaveMemory(Interface): pass
class Interface(object): def __init__(self, name, idx, addrwidth, datawidth, lite=False): self.name = name self.idx = idx self.datawidth = datawidth self.addrwidth = addrwidth self.lite = lite def __repr__(self): ret = [] ret.append('(') ret.append(self.__class__.__name__) ret.append(' ') ret.append('NAME:') ret.append(str(self.name)) ret.append(' ') ret.append('ID:') ret.append(str(self.idx)) ret.append(' ') ret.append('ADDR_WIDTH:') ret.append(str(self.addrwidth)) ret.append(' ') ret.append('DATA_WIDTH:') ret.append(str(self.datawidth)) ret.append(' ') ret.append('LITE:') ret.append(str(self.lite)) ret.append(')') return ''.join(ret) class Mastermemory(Interface): pass class Slavememory(Interface): pass
class HierarchicalDataTemplate(DataTemplate,INameScope,ISealable,IHaveResources,IQueryAmbient): """ Represents a System.Windows.DataTemplate that supports System.Windows.Controls.HeaderedItemsControl,such as System.Windows.Controls.TreeViewItem or System.Windows.Controls.MenuItem. HierarchicalDataTemplate() HierarchicalDataTemplate(dataType: object) """ def ValidateTemplatedParent(self,*args): """ ValidateTemplatedParent(self: DataTemplate,templatedParent: FrameworkElement) Checks the templated parent against a set of rules. templatedParent: The element this template is applied to. """ pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self,dataType=None): """ __new__(cls: type) __new__(cls: type,dataType: object) """ pass AlternationCount=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the number of alternating item containers for the child items. Get: AlternationCount(self: HierarchicalDataTemplate) -> int Set: AlternationCount(self: HierarchicalDataTemplate)=value """ ItemBindingGroup=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the System.Windows.Data.BindingGroup that is copied to each child item. Get: ItemBindingGroup(self: HierarchicalDataTemplate) -> BindingGroup Set: ItemBindingGroup(self: HierarchicalDataTemplate)=value """ ItemContainerStyle=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the System.Windows.Style that is applied to the item container for each child item. Get: ItemContainerStyle(self: HierarchicalDataTemplate) -> Style Set: ItemContainerStyle(self: HierarchicalDataTemplate)=value """ ItemContainerStyleSelector=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets custom style-selection logic for a style that can be applied to each item container. Get: ItemContainerStyleSelector(self: HierarchicalDataTemplate) -> StyleSelector Set: ItemContainerStyleSelector(self: HierarchicalDataTemplate)=value """ ItemsSource=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the binding for this data template,which indicates where to find the collection that represents the next level in the data hierarchy. Get: ItemsSource(self: HierarchicalDataTemplate) -> BindingBase Set: ItemsSource(self: HierarchicalDataTemplate)=value """ ItemStringFormat=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets a composite string that specifies how to format the items in the next level in the data hierarchy if they are displayed as strings. Get: ItemStringFormat(self: HierarchicalDataTemplate) -> str Set: ItemStringFormat(self: HierarchicalDataTemplate)=value """ ItemTemplate=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the System.Windows.DataTemplate to apply to the System.Windows.Controls.ItemsControl.ItemTemplate property on a generated System.Windows.Controls.HeaderedItemsControl (such as a System.Windows.Controls.MenuItem or a System.Windows.Controls.TreeViewItem),to indicate how to display items from the next level in the data hierarchy. Get: ItemTemplate(self: HierarchicalDataTemplate) -> DataTemplate Set: ItemTemplate(self: HierarchicalDataTemplate)=value """ ItemTemplateSelector=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the System.Windows.Controls.DataTemplateSelector to apply to the System.Windows.Controls.ItemsControl.ItemTemplateSelector property on a generated System.Windows.Controls.HeaderedItemsControl (such as a System.Windows.Controls.MenuItem or a System.Windows.Controls.TreeViewItem),to indicate how to select a template to display items from the next level in the data hierarchy. Get: ItemTemplateSelector(self: HierarchicalDataTemplate) -> DataTemplateSelector Set: ItemTemplateSelector(self: HierarchicalDataTemplate)=value """
class Hierarchicaldatatemplate(DataTemplate, INameScope, ISealable, IHaveResources, IQueryAmbient): """ Represents a System.Windows.DataTemplate that supports System.Windows.Controls.HeaderedItemsControl,such as System.Windows.Controls.TreeViewItem or System.Windows.Controls.MenuItem. HierarchicalDataTemplate() HierarchicalDataTemplate(dataType: object) """ def validate_templated_parent(self, *args): """ ValidateTemplatedParent(self: DataTemplate,templatedParent: FrameworkElement) Checks the templated parent against a set of rules. templatedParent: The element this template is applied to. """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self, dataType=None): """ __new__(cls: type) __new__(cls: type,dataType: object) """ pass alternation_count = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the number of alternating item containers for the child items.\n\n\n\nGet: AlternationCount(self: HierarchicalDataTemplate) -> int\n\n\n\nSet: AlternationCount(self: HierarchicalDataTemplate)=value\n\n' item_binding_group = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the System.Windows.Data.BindingGroup that is copied to each child item.\n\n\n\nGet: ItemBindingGroup(self: HierarchicalDataTemplate) -> BindingGroup\n\n\n\nSet: ItemBindingGroup(self: HierarchicalDataTemplate)=value\n\n' item_container_style = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the System.Windows.Style that is applied to the item container for each child item.\n\n\n\nGet: ItemContainerStyle(self: HierarchicalDataTemplate) -> Style\n\n\n\nSet: ItemContainerStyle(self: HierarchicalDataTemplate)=value\n\n' item_container_style_selector = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets custom style-selection logic for a style that can be applied to each item container.\n\n\n\nGet: ItemContainerStyleSelector(self: HierarchicalDataTemplate) -> StyleSelector\n\n\n\nSet: ItemContainerStyleSelector(self: HierarchicalDataTemplate)=value\n\n' items_source = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the binding for this data template,which indicates where to find the collection that represents the next level in the data hierarchy.\n\n\n\nGet: ItemsSource(self: HierarchicalDataTemplate) -> BindingBase\n\n\n\nSet: ItemsSource(self: HierarchicalDataTemplate)=value\n\n' item_string_format = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets a composite string that specifies how to format the items in the next level in the data hierarchy if they are displayed as strings.\n\n\n\nGet: ItemStringFormat(self: HierarchicalDataTemplate) -> str\n\n\n\nSet: ItemStringFormat(self: HierarchicalDataTemplate)=value\n\n' item_template = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the System.Windows.DataTemplate to apply to the System.Windows.Controls.ItemsControl.ItemTemplate property on a generated System.Windows.Controls.HeaderedItemsControl (such as a System.Windows.Controls.MenuItem or a System.Windows.Controls.TreeViewItem),to indicate how to display items from the next level in the data hierarchy.\n\n\n\nGet: ItemTemplate(self: HierarchicalDataTemplate) -> DataTemplate\n\n\n\nSet: ItemTemplate(self: HierarchicalDataTemplate)=value\n\n' item_template_selector = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets or sets the System.Windows.Controls.DataTemplateSelector to apply to the System.Windows.Controls.ItemsControl.ItemTemplateSelector property on a generated System.Windows.Controls.HeaderedItemsControl (such as a System.Windows.Controls.MenuItem or a System.Windows.Controls.TreeViewItem),to indicate how to select a template to display items from the next level in the data hierarchy.\n\n\n\nGet: ItemTemplateSelector(self: HierarchicalDataTemplate) -> DataTemplateSelector\n\n\n\nSet: ItemTemplateSelector(self: HierarchicalDataTemplate)=value\n\n'
{ 'includes': [ 'deps/common.gypi', ], 'variables': { 'gtest%': 0, 'gtest_static_libs%': [], 'glfw%': 0, 'glfw_static_libs%': [], 'mason_platform': 'osx', }, 'targets': [ { 'target_name': 'geojsonvt', 'product_name': 'geojsonvt', 'type': 'static_library', 'standalone_static_library': 1, 'include_dirs': [ 'include', ], 'sources': [ 'include/mapbox/geojsonvt.hpp', 'include/mapbox/geojsonvt/clip.hpp', 'include/mapbox/geojsonvt/convert.hpp', 'include/mapbox/geojsonvt/simplify.hpp', 'include/mapbox/geojsonvt/transform.hpp', 'include/mapbox/geojsonvt/tile.hpp', 'include/mapbox/geojsonvt/types.hpp', 'include/mapbox/geojsonvt/wrap.hpp', 'src/geojsonvt.cpp', 'src/clip.cpp', 'src/convert.cpp', 'src/simplify.cpp', 'src/transform.cpp', 'src/tile.cpp', 'src/wrap.cpp', ], 'variables': { 'cflags_cc': [ '<@(variant_cflags)', '<@(rapidjson_cflags)', ], 'ldflags': [], 'libraries': [], }, 'conditions': [ ['OS == "mac"', { 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], }, }, { 'cflags_cc': [ '<@(cflags_cc)' ], }], ], 'link_settings': { 'conditions': [ ['OS == "mac"', { 'libraries': [ '<@(libraries)' ], 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(ldflags)' ] } }, { 'libraries': [ '<@(libraries)', '<@(ldflags)' ], }] ], }, 'direct_dependent_settings': { 'include_dirs': [ 'include', ], }, }, { 'target_name': 'install', 'type': 'none', 'hard_dependency': 1, 'dependencies': [ 'geojsonvt', ], 'copies': [ { 'files': [ '<(PRODUCT_DIR)/libgeojsonvt.a' ], 'destination': '<(install_prefix)/lib' }, { 'files': [ '<!@(find include/mapbox/geojsonvt -name "*.hpp")' ], 'destination': '<(install_prefix)/include/mapbox/geojsonvt' }, { 'files': [ 'include/mapbox/geojsonvt.hpp' ], 'destination': '<(install_prefix)/include/mapbox' }, ], }, ], 'conditions': [ ['gtest', { 'targets': [ { 'target_name': 'test', 'product_name': 'test', 'type': 'executable', 'dependencies': [ 'geojsonvt', ], 'include_dirs': [ 'src', ], 'sources': [ 'test/test.cpp', 'test/util.hpp', 'test/util.cpp', 'test/test_clip.cpp', 'test/test_full.cpp', 'test/test_get_tile.cpp', 'test/test_simplify.cpp', ], 'variables': { 'cflags_cc': [ '<@(rapidjson_cflags)', '<@(variant_cflags)', '<@(gtest_cflags)', ], 'ldflags': [ '<@(gtest_ldflags)' ], 'libraries': [ '<@(gtest_static_libs)', ], }, 'conditions': [ ['OS == "mac"', { 'libraries': [ '<@(libraries)' ], 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], 'OTHER_LDFLAGS': [ '<@(ldflags)' ], } }, { 'cflags_cc': [ '<@(cflags_cc)' ], 'libraries': [ '<@(libraries)', '<@(ldflags)' ], }] ], }, ], }], ['glfw', { 'targets': [ { 'target_name': 'debug', 'product_name': 'debug', 'type': 'executable', 'dependencies': [ 'geojsonvt', ], 'include_dirs': [ 'src', ], 'sources': [ 'debug/debug.cpp', ], 'variables': { 'cflags_cc': [ '<@(variant_cflags)', '<@(glfw_cflags)', ], 'ldflags': [ '<@(glfw_ldflags)' ], 'libraries': [ '<@(glfw_static_libs)', ], }, 'conditions': [ ['OS == "mac"', { 'libraries': [ '<@(libraries)' ], 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ], 'OTHER_LDFLAGS': [ '<@(ldflags)' ], } }, { 'cflags_cc': [ '<@(cflags_cc)' ], 'libraries': [ '<@(libraries)', '<@(ldflags)' ], }] ], }, ], }], ], }
{'includes': ['deps/common.gypi'], 'variables': {'gtest%': 0, 'gtest_static_libs%': [], 'glfw%': 0, 'glfw_static_libs%': [], 'mason_platform': 'osx'}, 'targets': [{'target_name': 'geojsonvt', 'product_name': 'geojsonvt', 'type': 'static_library', 'standalone_static_library': 1, 'include_dirs': ['include'], 'sources': ['include/mapbox/geojsonvt.hpp', 'include/mapbox/geojsonvt/clip.hpp', 'include/mapbox/geojsonvt/convert.hpp', 'include/mapbox/geojsonvt/simplify.hpp', 'include/mapbox/geojsonvt/transform.hpp', 'include/mapbox/geojsonvt/tile.hpp', 'include/mapbox/geojsonvt/types.hpp', 'include/mapbox/geojsonvt/wrap.hpp', 'src/geojsonvt.cpp', 'src/clip.cpp', 'src/convert.cpp', 'src/simplify.cpp', 'src/transform.cpp', 'src/tile.cpp', 'src/wrap.cpp'], 'variables': {'cflags_cc': ['<@(variant_cflags)', '<@(rapidjson_cflags)'], 'ldflags': [], 'libraries': []}, 'conditions': [['OS == "mac"', {'xcode_settings': {'OTHER_CPLUSPLUSFLAGS': ['<@(cflags_cc)']}}, {'cflags_cc': ['<@(cflags_cc)']}]], 'link_settings': {'conditions': [['OS == "mac"', {'libraries': ['<@(libraries)'], 'xcode_settings': {'OTHER_LDFLAGS': ['<@(ldflags)']}}, {'libraries': ['<@(libraries)', '<@(ldflags)']}]]}, 'direct_dependent_settings': {'include_dirs': ['include']}}, {'target_name': 'install', 'type': 'none', 'hard_dependency': 1, 'dependencies': ['geojsonvt'], 'copies': [{'files': ['<(PRODUCT_DIR)/libgeojsonvt.a'], 'destination': '<(install_prefix)/lib'}, {'files': ['<!@(find include/mapbox/geojsonvt -name "*.hpp")'], 'destination': '<(install_prefix)/include/mapbox/geojsonvt'}, {'files': ['include/mapbox/geojsonvt.hpp'], 'destination': '<(install_prefix)/include/mapbox'}]}], 'conditions': [['gtest', {'targets': [{'target_name': 'test', 'product_name': 'test', 'type': 'executable', 'dependencies': ['geojsonvt'], 'include_dirs': ['src'], 'sources': ['test/test.cpp', 'test/util.hpp', 'test/util.cpp', 'test/test_clip.cpp', 'test/test_full.cpp', 'test/test_get_tile.cpp', 'test/test_simplify.cpp'], 'variables': {'cflags_cc': ['<@(rapidjson_cflags)', '<@(variant_cflags)', '<@(gtest_cflags)'], 'ldflags': ['<@(gtest_ldflags)'], 'libraries': ['<@(gtest_static_libs)']}, 'conditions': [['OS == "mac"', {'libraries': ['<@(libraries)'], 'xcode_settings': {'OTHER_CPLUSPLUSFLAGS': ['<@(cflags_cc)'], 'OTHER_LDFLAGS': ['<@(ldflags)']}}, {'cflags_cc': ['<@(cflags_cc)'], 'libraries': ['<@(libraries)', '<@(ldflags)']}]]}]}], ['glfw', {'targets': [{'target_name': 'debug', 'product_name': 'debug', 'type': 'executable', 'dependencies': ['geojsonvt'], 'include_dirs': ['src'], 'sources': ['debug/debug.cpp'], 'variables': {'cflags_cc': ['<@(variant_cflags)', '<@(glfw_cflags)'], 'ldflags': ['<@(glfw_ldflags)'], 'libraries': ['<@(glfw_static_libs)']}, 'conditions': [['OS == "mac"', {'libraries': ['<@(libraries)'], 'xcode_settings': {'OTHER_CPLUSPLUSFLAGS': ['<@(cflags_cc)'], 'OTHER_LDFLAGS': ['<@(ldflags)']}}, {'cflags_cc': ['<@(cflags_cc)'], 'libraries': ['<@(libraries)', '<@(ldflags)']}]]}]}]]}
print(True) print(False) print("True") print("False") print(5 == 1) print(5 != 1) print("Ham" == "Ham") print("ham " == "ham") print(5 == 5.0) print(5 < 1) print(5 >= 5) print(5 < 8 <= 7)
print(True) print(False) print('True') print('False') print(5 == 1) print(5 != 1) print('Ham' == 'Ham') print('ham ' == 'ham') print(5 == 5.0) print(5 < 1) print(5 >= 5) print(5 < 8 <= 7)
class Animal: def __init__(self, leg_count=4): # Constructor, initializes the new obj # Print("constructor called!") self.leg_count = leg_count self.likes_food = True def get_leg_count(self): # getter return self.leg_count def set_leg_count(self, leg_count): # setter self.leg_count = leg_count # Objects, AKA instances cat = Animal() # Construct a new Animal, Instantiate a new Animal dog = Animal() # Construct a new Animal centipede = Animal(100) # Make a list of Animals rabbits = [ Animal(4), Animal(4), Animal(4) ] rabbits[1].leg_count = 3 # leg_count is an "attribute" on the object print(f"rabbit 0's leg count: {rabbits[0].leg_count}") print(f"rabbit 1's leg count: {rabbits[1].leg_count}") print(f"rabbit 2's leg count: {rabbits[2].leg_count}") # "cat" is an instance of an Animal # "cat" is an Animal # print(f"cat's leg count: {cat.leg_count}") # cat.leg_count = 4 # print(f"cat's leg count: {cat.leg_count}") # print(f"dog's leg count: {dog.leg_count}") print(cat.get_leg_count()) cat.set_leg_count(3) print(cat.get_leg_count())
class Animal: def __init__(self, leg_count=4): self.leg_count = leg_count self.likes_food = True def get_leg_count(self): return self.leg_count def set_leg_count(self, leg_count): self.leg_count = leg_count cat = animal() dog = animal() centipede = animal(100) rabbits = [animal(4), animal(4), animal(4)] rabbits[1].leg_count = 3 print(f"rabbit 0's leg count: {rabbits[0].leg_count}") print(f"rabbit 1's leg count: {rabbits[1].leg_count}") print(f"rabbit 2's leg count: {rabbits[2].leg_count}") print(cat.get_leg_count()) cat.set_leg_count(3) print(cat.get_leg_count())
def check(x): """ Checking for password format Format::: (min)-(max) (letter): password """ count = 0 dashIndex = x.find('-') colonIndex = x.find(':') minCount = int(x[:dashIndex]) - 1 maxCount = int(x[(dashIndex + 1):(colonIndex - 2)]) - 1 letter = x[colonIndex - 1] password = x[(colonIndex + 2):] check = ((password[minCount] == letter and password[maxCount] != letter) or ( password[maxCount] == letter and password[minCount] != letter)) return check valid = 0 f = open("input.txt", "r") fl = f.readlines() for x in fl: if (check(x)): valid += 1 print(valid)
def check(x): """ Checking for password format Format::: (min)-(max) (letter): password """ count = 0 dash_index = x.find('-') colon_index = x.find(':') min_count = int(x[:dashIndex]) - 1 max_count = int(x[dashIndex + 1:colonIndex - 2]) - 1 letter = x[colonIndex - 1] password = x[colonIndex + 2:] check = password[minCount] == letter and password[maxCount] != letter or (password[maxCount] == letter and password[minCount] != letter) return check valid = 0 f = open('input.txt', 'r') fl = f.readlines() for x in fl: if check(x): valid += 1 print(valid)
#!/usr/bin/env python # -*- coding: utf-8 -*- """Exporting modules of Clastering Algorithms Benchmarking Framework algorithms/ - evaluating algorithms utils/ - evaluation utilities benchapps - evaluating algorithms executors benchevals - evaluation utilities (and measures) executors benchmark - the benchmarking framework benchutils - [internal] accessory Python routings of the benchmarking """ __all__ = ['algorithms', 'utils', # dirs 'benchapps', 'benchevals', 'benchmark', 'benchutils'] # modules
"""Exporting modules of Clastering Algorithms Benchmarking Framework algorithms/ - evaluating algorithms utils/ - evaluation utilities benchapps - evaluating algorithms executors benchevals - evaluation utilities (and measures) executors benchmark - the benchmarking framework benchutils - [internal] accessory Python routings of the benchmarking """ __all__ = ['algorithms', 'utils', 'benchapps', 'benchevals', 'benchmark', 'benchutils']
a = float(input()) b = float(input()) peso_nota_a = 3.5 peso_nota_b = 7.5 media = (a * peso_nota_a + b * peso_nota_b) / (peso_nota_a + peso_nota_b) print(f"MEDIA = {media:.5f}")
a = float(input()) b = float(input()) peso_nota_a = 3.5 peso_nota_b = 7.5 media = (a * peso_nota_a + b * peso_nota_b) / (peso_nota_a + peso_nota_b) print(f'MEDIA = {media:.5f}')
class Node(object): def __init__(self, data): self.data = data self.left = None self.right = None def __str__(self): return str(self.data) class AVL_Tree(object): def height(self,root): if not root: return -1 else: hl = self.height(root.left) hr = self.height(root.right) if hl>hr: return hl+1 else: return hr+1 def insert(self,root,data): if root is None: root = Node(data) else: fp = None p = root while p : fp = p p = p.left if data<p.data else p.right if data < fp.data: fp.left = Node(data) else: fp.right = Node(data) # printTree90(root) if not self.isBalance(root): print("Not Balance, Rebalance!") root = self.reBalance(root) return root def isBalance(self,root): out = self._isBalance(root) return True if out == 1 else False def _isBalance(self,root): if not root : return 1 else: if abs(self.height(root.left)-self.height(root.right))>=2: return 0 else: return 1*self._isBalance(root.left)*self._isBalance(root.right) def reBalance(self,root): if not root : pass # print("basecase reached") else: print("recurrrr") printTree90(root) if self.height(root.left)-self.height(root.right)<=-2: root.right = self.reBalance(root.right) if self.height(root.left)-self.height(root.right)<=-2: root = self.Rleftchild(root) elif self.height(root.left)-self.height(root.right)>=2: root = self.Rrightchild(root) elif self.height(root.left)-self.height(root.right)>=2: root.left = self.reBalance(root.left) if self.height(root.left)-self.height(root.right)<=-2: root = self.Rleftchild(root) elif self.height(root.left)-self.height(root.right)>=2: root = self.Rrightchild(root) if not self.isBalance(root): root.right = self.reBalance(root.right) root.left = self.reBalance(root.left) return root def Rleftchild(self,root): newr = root.right root.right = newr.left newr.left = root return newr def Rrightchild(self,root): newr = root.left root.left = newr.right newr.right = root return newr def printTree90(node, level = 0): if node != None: printTree90(node.right, level + 1) print(' ' * level, node) printTree90(node.left, level + 1) myTree = AVL_Tree() root = None data = input("Enter Input : ").split() for e in data: print("insert :",e) root = myTree.insert(root, int(e)) printTree90(root) print("===============")
class Node(object): def __init__(self, data): self.data = data self.left = None self.right = None def __str__(self): return str(self.data) class Avl_Tree(object): def height(self, root): if not root: return -1 else: hl = self.height(root.left) hr = self.height(root.right) if hl > hr: return hl + 1 else: return hr + 1 def insert(self, root, data): if root is None: root = node(data) else: fp = None p = root while p: fp = p p = p.left if data < p.data else p.right if data < fp.data: fp.left = node(data) else: fp.right = node(data) if not self.isBalance(root): print('Not Balance, Rebalance!') root = self.reBalance(root) return root def is_balance(self, root): out = self._isBalance(root) return True if out == 1 else False def _is_balance(self, root): if not root: return 1 elif abs(self.height(root.left) - self.height(root.right)) >= 2: return 0 else: return 1 * self._isBalance(root.left) * self._isBalance(root.right) def re_balance(self, root): if not root: pass else: print('recurrrr') print_tree90(root) if self.height(root.left) - self.height(root.right) <= -2: root.right = self.reBalance(root.right) if self.height(root.left) - self.height(root.right) <= -2: root = self.Rleftchild(root) elif self.height(root.left) - self.height(root.right) >= 2: root = self.Rrightchild(root) elif self.height(root.left) - self.height(root.right) >= 2: root.left = self.reBalance(root.left) if self.height(root.left) - self.height(root.right) <= -2: root = self.Rleftchild(root) elif self.height(root.left) - self.height(root.right) >= 2: root = self.Rrightchild(root) if not self.isBalance(root): root.right = self.reBalance(root.right) root.left = self.reBalance(root.left) return root def rleftchild(self, root): newr = root.right root.right = newr.left newr.left = root return newr def rrightchild(self, root): newr = root.left root.left = newr.right newr.right = root return newr def print_tree90(node, level=0): if node != None: print_tree90(node.right, level + 1) print(' ' * level, node) print_tree90(node.left, level + 1) my_tree = avl__tree() root = None data = input('Enter Input : ').split() for e in data: print('insert :', e) root = myTree.insert(root, int(e)) print_tree90(root) print('===============')
# enter the Chocolate Rooom ownername = "Daw Hla" playerlives = 2 chocolate = 2 print("Welcome to the Chocolate Room. I am the owner of this sweet shop, my name is " + ownername) print("You must answer this question.") # add an input statement to ask the question on the next line and store the response in a variable called answer # "Which of the following could be used as a good password" # "1. Your pet's name. 2. Password123 3. A random collection of numbers and letters?" # HINT : User answer = int(input(.......)) print("Which of the following could be used as a good password") print("1. Your pet's name. 2. Password123 3. A random collection of numbers and letters?") answer = int(input("Please Choose 1,2,3: ")) if answer == 3: chocolatebar = int(input("Do you want chocolate bar 1 or 2? ")) if chocolatebar == 1: print("Hard luck, you lse a life and there is no information in the wrapper") playerlives = playerlives - 1 # add code to check if the chocolate bar is equal to 1 # ---> add code to print this message to the user "Hard luck, you lse a life and there is no information in the wrapper" # ---> add code to subtract 1 from the player lives elif chocolatebar == 2: print("OK - you can have the chocolate bar and the letter in the wrapper is T") else: print("Wrong answer - you lose a life and all of your chocolate") chocolate = 0 playerlives = playerlives - 1 # add code to set the chocolate value to 0 # add code to subtract 1 from player lives
ownername = 'Daw Hla' playerlives = 2 chocolate = 2 print('Welcome to the Chocolate Room. I am the owner of this sweet shop, my name is ' + ownername) print('You must answer this question.') print('Which of the following could be used as a good password') print("1. Your pet's name. 2. Password123 3. A random collection of numbers and letters?") answer = int(input('Please Choose 1,2,3: ')) if answer == 3: chocolatebar = int(input('Do you want chocolate bar 1 or 2? ')) if chocolatebar == 1: print('Hard luck, you lse a life and there is no information in the wrapper') playerlives = playerlives - 1 elif chocolatebar == 2: print('OK - you can have the chocolate bar and the letter in the wrapper is T') else: print('Wrong answer - you lose a life and all of your chocolate') chocolate = 0 playerlives = playerlives - 1
''' https://leetcode.com/contest/weekly-contest-150/problems/as-far-from-land-as-possible/ ''' diffs = [(1, 0), (0, 1), (-1, 0), (0, -1)] class Cell: def __init__(self, x, y, dist=0): self.dist = dist self.x, self.y = x, y class Solver: def __init__(self, grid): self.g = grid self.l, self.w = len(self.g), len(self.g[0]) self.inf = 1000 self.dists = [[Cell(j, i, dist=self.inf) for i in range(self.w)] for j in range(self.l)] def solve(self): q, qi = [], 0 lands = 0 for i in range(self.l): for j in range(self.w): if self.g[i][j] == 1: self.dists[i][j].dist = 0 q.append(self.dists[i][j]) lands += 1 if lands == 0 or lands == self.l * self.w: return -1 while len(q) - qi > 0: f = q[qi]; qi += 1 for diff in diffs: x, y = f.x + diff[0], f.y + diff[1] if self.valid_xy(x, y) and self.makes_sense_to_q(x, y, f.dist + 1): c = self.dists[x][y] c.dist = f.dist + 1 q.append(c) return self.find_farthest_water() def find_farthest_water(self): max_dist = 0 for i in range(self.l): for j in range(self.w): if self.g[i][j] == 0: # water max_dist = max(max_dist, self.dists[i][j].dist) if max_dist == self.inf: return -1 return max_dist def makes_sense_to_q(self, x, y, d): return self.dists[x][y].dist > d def valid_xy(self, x, y): return x >= 0 and y >= 0 and x < self.l and y < self.w class Solution: def maxDistance(self, grid: List[List[int]]) -> int: return Solver(grid).solve()
""" https://leetcode.com/contest/weekly-contest-150/problems/as-far-from-land-as-possible/ """ diffs = [(1, 0), (0, 1), (-1, 0), (0, -1)] class Cell: def __init__(self, x, y, dist=0): self.dist = dist (self.x, self.y) = (x, y) class Solver: def __init__(self, grid): self.g = grid (self.l, self.w) = (len(self.g), len(self.g[0])) self.inf = 1000 self.dists = [[cell(j, i, dist=self.inf) for i in range(self.w)] for j in range(self.l)] def solve(self): (q, qi) = ([], 0) lands = 0 for i in range(self.l): for j in range(self.w): if self.g[i][j] == 1: self.dists[i][j].dist = 0 q.append(self.dists[i][j]) lands += 1 if lands == 0 or lands == self.l * self.w: return -1 while len(q) - qi > 0: f = q[qi] qi += 1 for diff in diffs: (x, y) = (f.x + diff[0], f.y + diff[1]) if self.valid_xy(x, y) and self.makes_sense_to_q(x, y, f.dist + 1): c = self.dists[x][y] c.dist = f.dist + 1 q.append(c) return self.find_farthest_water() def find_farthest_water(self): max_dist = 0 for i in range(self.l): for j in range(self.w): if self.g[i][j] == 0: max_dist = max(max_dist, self.dists[i][j].dist) if max_dist == self.inf: return -1 return max_dist def makes_sense_to_q(self, x, y, d): return self.dists[x][y].dist > d def valid_xy(self, x, y): return x >= 0 and y >= 0 and (x < self.l) and (y < self.w) class Solution: def max_distance(self, grid: List[List[int]]) -> int: return solver(grid).solve()
f=str(input('Digite uma frase: ')).strip().upper() print('Tem {} A na frase.'.format(f.count('A'))) print('O primeiro A esta em {} letra.'.format(f.find('A')+1)) print('O ultimo A esta em {} letra.'.format(f.rfind('A')+1))
f = str(input('Digite uma frase: ')).strip().upper() print('Tem {} A na frase.'.format(f.count('A'))) print('O primeiro A esta em {} letra.'.format(f.find('A') + 1)) print('O ultimo A esta em {} letra.'.format(f.rfind('A') + 1))
def start_room(): return "room1"
def start_room(): return 'room1'
node = S(input, "application/json") childNode = node.prop("orderDetails") property = childNode.prop("article") value = property.stringValue()
node = s(input, 'application/json') child_node = node.prop('orderDetails') property = childNode.prop('article') value = property.stringValue()
bit_list = [19, 17, 16, 18, 26, 24, 22, 21, 23, 25] value = 5808 for bit in bit_list: new_value = value + 2 ** bit print(value, new_value-1) value = new_value
bit_list = [19, 17, 16, 18, 26, 24, 22, 21, 23, 25] value = 5808 for bit in bit_list: new_value = value + 2 ** bit print(value, new_value - 1) value = new_value
class Solution: # @return a string def minWindow(self, S, T): s = S t = T d = {} td = {} for c in t: td[c] = td.get(c, 0) + 1 left = 0 right = 0 lefts = [] rights = [] for i, c in enumerate(s): if c in td: d[c] = d.get(c, 0) + 1 if self.contains(d, td): # Contains all characters right = i # Move left pointers cc = s[left] while left <= right and (cc not in d or d[cc] > td[cc]): if cc in d: d[cc] -= 1 left += 1 cc = s[left] lefts.append(left) rights.append(right) if not lefts: return '' res_left = lefts[0] res_right = rights[0] n = len(lefts) for i in range(1, n): if rights[i] - lefts[i] < res_right - res_left: res_left = lefts[i] res_right = rights[i] return s[res_left:res_right + 1] def contains(self, d, td): for k in td: if k not in d or d[k] < td[k]: return False return True
class Solution: def min_window(self, S, T): s = S t = T d = {} td = {} for c in t: td[c] = td.get(c, 0) + 1 left = 0 right = 0 lefts = [] rights = [] for (i, c) in enumerate(s): if c in td: d[c] = d.get(c, 0) + 1 if self.contains(d, td): right = i cc = s[left] while left <= right and (cc not in d or d[cc] > td[cc]): if cc in d: d[cc] -= 1 left += 1 cc = s[left] lefts.append(left) rights.append(right) if not lefts: return '' res_left = lefts[0] res_right = rights[0] n = len(lefts) for i in range(1, n): if rights[i] - lefts[i] < res_right - res_left: res_left = lefts[i] res_right = rights[i] return s[res_left:res_right + 1] def contains(self, d, td): for k in td: if k not in d or d[k] < td[k]: return False return True
class Solution: def canJump(self, nums: List[int]) -> bool: if not nums or len(nums) == 0: return False target = len(nums) - 1 for i in range(len(nums) - 1, -1, -1): if (nums[i] + i >= target): target = i return target == 0
class Solution: def can_jump(self, nums: List[int]) -> bool: if not nums or len(nums) == 0: return False target = len(nums) - 1 for i in range(len(nums) - 1, -1, -1): if nums[i] + i >= target: target = i return target == 0
print ("How old are you?"), age = input() print ("How tall are you?"), height = input() print ("How much do you weigh?"), weight = input() print ("So you are %r old, %r tall and %r heavy!"%(age,weight,height) )
(print('How old are you?'),) age = input() (print('How tall are you?'),) height = input() (print('How much do you weigh?'),) weight = input() print('So you are %r old, %r tall and %r heavy!' % (age, weight, height))
a=int(input("enter number:")) b=int(input("enter number:")) c=int(input("enter number:")) d=int(input("enter number:")) total=a+b+c+d average=total/4 print("total=",total) print("average=",average)
a = int(input('enter number:')) b = int(input('enter number:')) c = int(input('enter number:')) d = int(input('enter number:')) total = a + b + c + d average = total / 4 print('total=', total) print('average=', average)
# test decorators def dec(f): print('dec') return f def dec_arg(x): print(x) return lambda f:f # plain decorator @dec def f(): pass # decorator with arg @dec_arg('dec_arg') def g(): pass # decorator of class @dec class A: pass print("PASS")
def dec(f): print('dec') return f def dec_arg(x): print(x) return lambda f: f @dec def f(): pass @dec_arg('dec_arg') def g(): pass @dec class A: pass print('PASS')
def read_E_matrix(): # # physical distance # E = [[1, 1, 0, 0, 1, 1], # [1, 1, 1, 1, 1, 0], # [0, 1, 1, 1, 0, 0], # [0, 1, 1, 1, 0, 0], # [1, 1, 0, 0, 1, 0], # [1, 0, 0, 0, 0, 1] # ] # fully connected # E = [[1, 1, 1, 1, 1, 1], # [1, 1, 1, 1, 1, 1], # [1, 1, 1, 1, 1, 1], # [1, 1, 1, 1, 1, 1], # [1, 1, 1, 1, 1, 1], # [1, 1, 1, 1, 1, 1] # ] # view similarity connections. # E = [[1, 0, 0, 0, 0, 1], # [0, 1, 0, 1, 0, 0], # [0, 0, 1, 1, 0, 1], # [0, 1, 1, 1, 0, 0], # [0, 0, 0, 0, 1, 1], # [1, 0, 1, 0, 1, 1] # ] # view sim new graph E= [[1, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1]] # E = graph_p2(5) # E = graph_p3(5) # E = graph_p4(5) # E = graph_p5(5) # E = graph_p6(5) # E = graph_p7(5) # E = graph_p8(5) # E = graph_p9(5) # E = graph_random(14) return E def graph_random(i): if i == 6: E= [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 7: E= [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 8: E= [[1, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 9: E= [[1, 1, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 10: E= [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 11: E= [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1], [0, 1, 0, 1, 1, 1]] if i == 12: E= [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [0, 1, 0, 1, 1, 1]] if i == 13: E= [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [0, 1, 1, 1, 1, 1]] if i == 14: E= [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1]] return E def graph_p9(i): if i == 1: # 0510 E= [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1]] if i == 2: # 0511 E= [[0, 1, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0]] if i == 3: # 0511 E= [[0, 1, 1, 1, 1, 0], [1, 0, 1, 0, 1, 1], [1, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1], [1, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 0]] if i == 4: # 0511 E= [[0, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0]] if i == 5: # 0511 E= [[0, 1, 0, 1, 1, 1], [1, 0, 1, 1, 1, 1], [0, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0]] return E def graph_p8(i): if i == 1: # 0510 E = [[1, 0, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1]] if i == 2: # 0511 E= [[1, 1, 1, 1, 0, 0], [1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 1]] if i == 3: # 0511 E= [[1, 0, 1, 1, 1, 0], [0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1], [1, 1, 1, 0, 1, 0], [0, 1, 1, 1, 0, 1]] if i == 4: # 0511 E= [[0, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 1], [0, 1, 0, 1, 1, 1], [0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0]] if i == 5: # 0511 E= [[0, 1, 1, 1, 1, 0], [1, 0, 1, 1, 0, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 0, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0]] return E def graph_p7(i): if i == 1: # 0510 E= [[1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1]] if i == 2: # 0511 E= [[1, 0, 0, 1, 1, 0], [0, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1]] if i == 3: # 0511 E= [[1, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 1], [1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0], [1, 1, 0, 1, 0, 1]] if i == 4: # 0511 E= [[1, 1, 0, 1, 0, 0], [1, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1]] if i == 5: # 0511 E= [[1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1], [1, 1, 0, 1, 0, 0], [1, 0, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1]] return E def graph_p6(i): if i == 1: # 0510 E= [[1, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 0], [1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 1]] if i == 2: # 0511 E= [[1, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1]] if i == 3: # 0511 E= [[1, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0], [1, 1, 1, 0, 0, 1]] if i == 4: # 0511 E= [[1, 1, 1, 0, 1, 0], [1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1], [0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 1, 1, 0, 1, 1]] if i == 5: # 0511 E= [[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 1, 1], [1, 0, 0, 1, 0, 1], [1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1]] return E def graph_p5(i): if i == 1: # 0510 E= [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 1], [0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1]] if i == 2: # 0511 E= [[1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1]] if i == 3: # 0511 E= [[1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]] if i == 4: # 0511 E= [[1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1]] if i == 5: # 0511 E= [[1, 0, 0, 0, 1, 1], [0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1]] return E def graph_p4(i): if i == 1: # 0510 E= [[1, 0, 1, 1, 1, 0], [0, 1, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1], [1, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1]] if i == 2: # 0511 E= [[1, 1, 0, 1, 1, 0], [1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 1, 1]] if i == 3: # 0511 E= [[1, 0, 0, 0, 0, 1], [0, 1, 1, 1, 0, 0], [0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1]] if i == 4: # 0511 E= [[1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1]] if i == 5: # 0511 E= [[1, 1, 0, 1, 1, 1], [1, 1, 0, 1, 0, 1], [0, 0, 1, 0, 0, 1], [1, 1, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0], [1, 1, 1, 0, 0, 1]] return E def graph_p3(i): if i == 1: # 0510 E= [[1, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 1], [1, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1]] if i == 2: # 0511 E= [[1, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1]] if i == 3: # 0511 E= [[1, 1, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0], [0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1]] if i == 4: # 0511 E= [[1, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 1]] if i == 5: # 0511 E= [[1, 0, 0, 0, 0, 1], [0, 1, 1, 1, 0, 0], [0, 1, 1, 0, 1, 1], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [1, 0, 1, 1, 0, 1]] return E def graph_p2(i): if i == 1: # 0510 E= [[1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0], [1, 0, 1, 1, 0, 1], [0, 0, 1, 1, 0, 0], [1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1]] if i == 2: # 0511 E= [[1, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 0, 1, 1], [1, 0, 0, 0, 1, 1]] if i == 3: # 0511 E= [[1, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1]] if i == 4: # 0511 E= [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 1, 1], [0, 0, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1]] if i == 5: # 0511 E= [[1, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1]] return E
def read_e_matrix(): e = [[1, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1]] return E def graph_random(i): if i == 6: e = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 7: e = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 8: e = [[1, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 9: e = [[1, 1, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 10: e = [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 0], [1, 0, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1]] if i == 11: e = [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1], [0, 1, 0, 1, 1, 1]] if i == 12: e = [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [0, 1, 0, 1, 1, 1]] if i == 13: e = [[1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [0, 1, 1, 1, 1, 1]] if i == 14: e = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 1, 1]] return E def graph_p9(i): if i == 1: e = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1]] if i == 2: e = [[0, 1, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0]] if i == 3: e = [[0, 1, 1, 1, 1, 0], [1, 0, 1, 0, 1, 1], [1, 1, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1], [1, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 0]] if i == 4: e = [[0, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0], [1, 1, 1, 1, 0, 0]] if i == 5: e = [[0, 1, 0, 1, 1, 1], [1, 0, 1, 1, 1, 1], [0, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0]] return E def graph_p8(i): if i == 1: e = [[1, 0, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1]] if i == 2: e = [[1, 1, 1, 1, 0, 0], [1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 1]] if i == 3: e = [[1, 0, 1, 1, 1, 0], [0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 0, 1], [1, 1, 1, 0, 1, 0], [0, 1, 1, 1, 0, 1]] if i == 4: e = [[0, 1, 0, 0, 1, 1], [1, 0, 1, 1, 1, 1], [0, 1, 0, 1, 1, 1], [0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0]] if i == 5: e = [[0, 1, 1, 1, 1, 0], [1, 0, 1, 1, 0, 1], [1, 1, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 0, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0]] return E def graph_p7(i): if i == 1: e = [[1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1]] if i == 2: e = [[1, 0, 0, 1, 1, 0], [0, 1, 1, 1, 0, 1], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 1]] if i == 3: e = [[1, 0, 1, 1, 0, 1], [0, 1, 1, 0, 0, 1], [1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 1, 1], [0, 0, 1, 1, 1, 0], [1, 1, 0, 1, 0, 1]] if i == 4: e = [[1, 1, 0, 1, 0, 0], [1, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1]] if i == 5: e = [[1, 1, 0, 1, 1, 1], [1, 1, 1, 1, 0, 1], [0, 1, 1, 0, 1, 1], [1, 1, 0, 1, 0, 0], [1, 0, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1]] return E def graph_p6(i): if i == 1: e = [[1, 0, 1, 1, 1, 0], [0, 1, 0, 0, 1, 0], [1, 0, 1, 1, 1, 0], [1, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 1]] if i == 2: e = [[1, 0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1]] if i == 3: e = [[1, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1], [1, 0, 0, 1, 1, 0], [0, 1, 1, 1, 1, 0], [1, 1, 1, 0, 0, 1]] if i == 4: e = [[1, 1, 1, 0, 1, 0], [1, 1, 0, 1, 1, 1], [1, 0, 1, 1, 0, 1], [0, 1, 1, 1, 0, 0], [1, 1, 0, 0, 1, 1], [0, 1, 1, 0, 1, 1]] if i == 5: e = [[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 1, 1], [1, 0, 0, 1, 0, 1], [1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1]] return E def graph_p5(i): if i == 1: e = [[1, 1, 0, 0, 0, 0], [1, 1, 1, 0, 0, 1], [0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 1]] if i == 2: e = [[1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 1, 1], [0, 1, 1, 1, 1, 0], [0, 0, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1]] if i == 3: e = [[1, 1, 1, 1, 0, 0], [1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 0, 1], [0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 0, 1]] if i == 4: e = [[1, 0, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0], [1, 1, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1]] if i == 5: e = [[1, 0, 0, 0, 1, 1], [0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 1], [0, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1]] return E def graph_p4(i): if i == 1: e = [[1, 0, 1, 1, 1, 0], [0, 1, 1, 0, 1, 0], [1, 1, 1, 1, 0, 1], [1, 0, 1, 1, 0, 0], [1, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1]] if i == 2: e = [[1, 1, 0, 1, 1, 0], [1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 0], [1, 0, 1, 0, 1, 1], [0, 0, 0, 0, 1, 1]] if i == 3: e = [[1, 0, 0, 0, 0, 1], [0, 1, 1, 1, 0, 0], [0, 1, 1, 0, 1, 0], [0, 1, 0, 1, 1, 1], [0, 0, 1, 1, 1, 1], [1, 0, 0, 1, 1, 1]] if i == 4: e = [[1, 1, 1, 0, 1, 1], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [1, 0, 1, 0, 0, 1]] if i == 5: e = [[1, 1, 0, 1, 1, 1], [1, 1, 0, 1, 0, 1], [0, 0, 1, 0, 0, 1], [1, 1, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0], [1, 1, 1, 0, 0, 1]] return E def graph_p3(i): if i == 1: e = [[1, 0, 1, 0, 0, 1], [0, 1, 0, 0, 1, 1], [1, 0, 1, 1, 0, 0], [0, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 0], [1, 1, 0, 1, 0, 1]] if i == 2: e = [[1, 0, 1, 0, 1, 1], [0, 1, 0, 0, 0, 1], [1, 0, 1, 0, 0, 1], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1]] if i == 3: e = [[1, 1, 0, 1, 0, 0], [1, 1, 0, 0, 1, 0], [0, 0, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0], [0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1]] if i == 4: e = [[1, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1], [1, 1, 1, 0, 0, 0], [0, 0, 0, 1, 1, 0], [1, 0, 0, 1, 1, 0], [0, 1, 0, 0, 0, 1]] if i == 5: e = [[1, 0, 0, 0, 0, 1], [0, 1, 1, 1, 0, 0], [0, 1, 1, 0, 1, 1], [0, 1, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [1, 0, 1, 1, 0, 1]] return E def graph_p2(i): if i == 1: e = [[1, 1, 1, 0, 1, 0], [1, 1, 0, 0, 0, 0], [1, 0, 1, 1, 0, 1], [0, 0, 1, 1, 0, 0], [1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1]] if i == 2: e = [[1, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0], [0, 1, 1, 1, 0, 0], [0, 0, 1, 0, 1, 1], [1, 0, 0, 0, 1, 1]] if i == 3: e = [[1, 0, 1, 0, 0, 0], [0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 0], [0, 0, 1, 1, 0, 0], [0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 0, 1]] if i == 4: e = [[1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 0, 0], [1, 1, 1, 0, 1, 1], [0, 0, 0, 1, 0, 1], [0, 0, 1, 0, 1, 0], [0, 0, 1, 1, 0, 1]] if i == 5: e = [[1, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0], [0, 0, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1], [0, 0, 1, 0, 1, 0], [0, 0, 0, 1, 0, 1]] return E
# Databricks notebook source # MAGIC %run ./_utility-methods $lesson="dlt_lab_82" # COMMAND ---------- # MAGIC %run ./mount-datasets # COMMAND ---------- # def print_sql(rows, sql): # displayHTML(f"""<body><textarea style="width:100%" rows={rows}> \n{sql.strip()}</textarea></body>""") # COMMAND ---------- # generate_register_dlt_event_metrics_sql_string = "" # def _generate_register_dlt_event_metrics_sql(): # global generate_register_dlt_event_metrics_sql_string # generate_register_dlt_event_metrics_sql_string = f""" # CREATE TABLE IF NOT EXISTS {DA.db_name}.dlt_events # LOCATION '{DA.paths.working_dir}/storage/system/events'; # CREATE VIEW IF NOT EXISTS {DA.db_name}.dlt_success AS # SELECT * FROM {DA.db_name}.dlt_events # WHERE details:flow_progress:metrics IS NOT NULL; # CREATE VIEW IF NOT EXISTS {DA.db_name}.dlt_metrics AS # SELECT timestamp, origin.flow_name, details # FROM {DA.db_name}.dlt_success # ORDER BY timestamp DESC;""".strip() # print_sql(13, generate_register_dlt_event_metrics_sql_string) # DA.generate_register_dlt_event_metrics_sql = _generate_register_dlt_event_metrics_sql # COMMAND ---------- # def _generate_daily_patient_avg(): # sql = f"SELECT * FROM {DA.db_name}.daily_patient_avg" # print_sql(3, sql) # DA.generate_daily_patient_avg = _generate_daily_patient_avg # COMMAND ---------- # def _generate_visualization_query(): # sql = f""" # SELECT flow_name, timestamp, int(details:flow_progress:metrics:num_output_rows) num_output_rows # FROM {DA.db_name}.dlt_metrics # ORDER BY timestamp DESC;""" # print_sql(5, sql) # DA.generate_visualization_query = _generate_visualization_query # COMMAND ---------- def print_pipeline_config(): displayHTML(f"""<table> <tr><td>Pipeline Name:</td><td><b>DLT-Lab-82L-{DA.username}</b></td></tr> <tr><td>Source:</td><td><b>{DA.paths.working_dir}/source/tracker</b></td></tr> <tr><td>Target:</td><td><b>{DA.db_name}</b></td></tr> <tr><td>Storage Location:</td><td><b>{DA.paths.working_dir}/storage</b></td></tr> </table>""") # COMMAND ---------- DA.cleanup() DA.init() # DA.paths.data_source = "/mnt/training/healthcare" # DA.paths.storage_location = f"{DA.paths.working_dir}/storage" # DA.paths.data_landing_location = f"{DA.paths.working_dir}/source/tracker" DA.data_factory = DltDataFactory() DA.conclude_setup()
def print_pipeline_config(): display_html(f'<table>\n <tr><td>Pipeline Name:</td><td><b>DLT-Lab-82L-{DA.username}</b></td></tr>\n <tr><td>Source:</td><td><b>{DA.paths.working_dir}/source/tracker</b></td></tr>\n <tr><td>Target:</td><td><b>{DA.db_name}</b></td></tr>\n <tr><td>Storage Location:</td><td><b>{DA.paths.working_dir}/storage</b></td></tr>\n </table>') DA.cleanup() DA.init() DA.data_factory = dlt_data_factory() DA.conclude_setup()
# color mixer print("Red, blue, and yellow are primary colors.") print() # ask user to choose two primary colors to mix color1 = input("Enter the primary color 1 (red,blue, or yellow): ") color2 = input("Enter the primary color 2 (red,blue, or yellow): ") if color1 == "red" and color2 == "blue": print("The secondary color is purple.") elif color1 == "blue" and color2 == "red": print("The secondary color is purple.") elif color1 == "red" and color2 == "yellow": print("The secondary color is orange.") elif color1 == "red" and color2 == "yellow": print("The secondary color is orange.") elif color1 == "blue" and color2 == "yellow": print("The secondary color is green.") elif color1 == "yellow" and color2 == "blue": print("The secondary color is green.") else: print("ERROR")
print('Red, blue, and yellow are primary colors.') print() color1 = input('Enter the primary color 1 (red,blue, or yellow): ') color2 = input('Enter the primary color 2 (red,blue, or yellow): ') if color1 == 'red' and color2 == 'blue': print('The secondary color is purple.') elif color1 == 'blue' and color2 == 'red': print('The secondary color is purple.') elif color1 == 'red' and color2 == 'yellow': print('The secondary color is orange.') elif color1 == 'red' and color2 == 'yellow': print('The secondary color is orange.') elif color1 == 'blue' and color2 == 'yellow': print('The secondary color is green.') elif color1 == 'yellow' and color2 == 'blue': print('The secondary color is green.') else: print('ERROR')
# Non-MacOS users can change it to Chrome/Firefox. BROWSER = "Chrome" # can be Chrome/Safari/Firefox MATCH_URL = "http://www.espncricinfo.com/series/8039/commentary/1144506/afghanistan-vs-england-24th-match-icc-cricket-world-cup-2019" MESSAGE_BOX_CLASS_NAME = "_3u328" SEND_BUTTON_CLASS_NAME = "_3M-N-" # Match start timings according to where the script is being run. MATCH_START_HOURS = 13 MATCH_START_MINUTES = 30 MATCH_END_HOURS = 23 MATCH_END_MINUTES = 0 SCRIPT_LOG_FILE_NAME = '../logs/script_logs.log' ERROR_LOG_FILE_NAME = '../logs/error_logs.log' # This tells whether the script is running in test mode or not. If yes, the actual data sent is less, for better debugging. IS_TEST_MODE = False
browser = 'Chrome' match_url = 'http://www.espncricinfo.com/series/8039/commentary/1144506/afghanistan-vs-england-24th-match-icc-cricket-world-cup-2019' message_box_class_name = '_3u328' send_button_class_name = '_3M-N-' match_start_hours = 13 match_start_minutes = 30 match_end_hours = 23 match_end_minutes = 0 script_log_file_name = '../logs/script_logs.log' error_log_file_name = '../logs/error_logs.log' is_test_mode = False
# REST API server related constants USERNAME = "asdfg" PASSWORD = "asdfg" HOST = "http://127.0.0.1:8000" AUTH_URL: str = f"{HOST}/auth/" LOCATIONS_URL: str = f"{HOST}/api/locations/" PANIC_URL: str = f"{HOST}/api/panic/" # Format constants DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ" PRECISION = 6 # Job scheduling constants TIME_PANIC = 1 # TODO: Change to 60 TIME_NO_PANIC = 5 # TODO: Change to 1800 TIME_CHECK_PANIC = 3 # TODO: Change to 300 # Logging constants LOG_FILE = "gps_tracker.log" # TODO: move to /var/log/ LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s" PENDING_FILE = "pending_locations.json" # TODO: move to /usr/local/share/gps_tracker/
username = 'asdfg' password = 'asdfg' host = 'http://127.0.0.1:8000' auth_url: str = f'{HOST}/auth/' locations_url: str = f'{HOST}/api/locations/' panic_url: str = f'{HOST}/api/panic/' datetime_format = '%Y-%m-%dT%H:%M:%S.%fZ' precision = 6 time_panic = 1 time_no_panic = 5 time_check_panic = 3 log_file = 'gps_tracker.log' log_format = '%(asctime)s - %(levelname)s - %(message)s' pending_file = 'pending_locations.json'
LOCK = False RELEASE = True VERSION = "19.99.0" VERSION_AGAIN = "19.99.0" STRICT_VERSION = "19.99.0" UNRELATED_STRING = "apple"
lock = False release = True version = '19.99.0' version_again = '19.99.0' strict_version = '19.99.0' unrelated_string = 'apple'
def dec_to_bin(dec): bin_num = '' while dec > 0: bin_num = str(dec % 2) + bin_num dec //= 2 return bin_num if __name__ == "__main__": dec_num = int(input()) print(dec_to_bin(dec_num))
def dec_to_bin(dec): bin_num = '' while dec > 0: bin_num = str(dec % 2) + bin_num dec //= 2 return bin_num if __name__ == '__main__': dec_num = int(input()) print(dec_to_bin(dec_num))
#! /usr/bin/env python # -*- coding: utf-8 -*- # author: ouyangshaokun # date: print(44444444444) print("fsfasfaa") print(22222222) print("fsfasfa") print(123214) print(22222222) print(22222222) print(22222222) print(22222222) print(22222222) print(22222222) print(42342)
print(44444444444) print('fsfasfaa') print(22222222) print('fsfasfa') print(123214) print(22222222) print(22222222) print(22222222) print(22222222) print(22222222) print(22222222) print(42342)