content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class InfiniteLineup: def __init__(self, players): self.players = players def lineup(self): lineup_max = len(self.players) idx = 0 while True: if idx < lineup_max: yield self.players[idx] else: idx = 0 yield self.players[idx] idx += 1 def __repr__(self): return f'<InfiniteLineup({self.players})' def __str__(self): return f'InfiniteLineup with the players: {self.players}' astros = [ 'Springer', 'Bregman', 'Altuve', 'Correa', 'Reddick', 'Gonzalez', 'McCann', 'Davis', 'Tucker' ] full_lineup = InfiniteLineup(astros) astros_lineup = full_lineup.lineup() print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup))
class Infinitelineup: def __init__(self, players): self.players = players def lineup(self): lineup_max = len(self.players) idx = 0 while True: if idx < lineup_max: yield self.players[idx] else: idx = 0 yield self.players[idx] idx += 1 def __repr__(self): return f'<InfiniteLineup({self.players})' def __str__(self): return f'InfiniteLineup with the players: {self.players}' astros = ['Springer', 'Bregman', 'Altuve', 'Correa', 'Reddick', 'Gonzalez', 'McCann', 'Davis', 'Tucker'] full_lineup = infinite_lineup(astros) astros_lineup = full_lineup.lineup() print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup)) print(next(astros_lineup))
class StoreObject: def _log_template(self, token): return f"<{token.server.upper()} {token.method}: {' '.join([str(token.params[k]) for k in token.params])}>" async def get(self, token, *args, **kwargs): raise NotImplementedError async def set(self, token, response, *args, **kwargs): raise NotImplementedError async def post(self, token, body, *args, **kwargs): raise NotImplementedError async def put(self, token, body, *args, **kwargs): raise NotImplementedError async def clear(self, *args, **kwargs): raise NotImplementedError async def expire(self, *args, **kwargs): raise NotImplementedError async def delete(self, token, *args, **kwargs): raise NotImplementedError async def contains(self, token, *args, **kwargs): raise NotImplementedError @property def classname(self): return self.__class__.__name__
class Storeobject: def _log_template(self, token): return f"<{token.server.upper()} {token.method}: {' '.join([str(token.params[k]) for k in token.params])}>" async def get(self, token, *args, **kwargs): raise NotImplementedError async def set(self, token, response, *args, **kwargs): raise NotImplementedError async def post(self, token, body, *args, **kwargs): raise NotImplementedError async def put(self, token, body, *args, **kwargs): raise NotImplementedError async def clear(self, *args, **kwargs): raise NotImplementedError async def expire(self, *args, **kwargs): raise NotImplementedError async def delete(self, token, *args, **kwargs): raise NotImplementedError async def contains(self, token, *args, **kwargs): raise NotImplementedError @property def classname(self): return self.__class__.__name__
a = 10 b = 22 while b - a > 4: c = b - (2 * a) if c > 0: d = c + 1 else: d = c + 5 a = a + 3 b = b - 2
a = 10 b = 22 while b - a > 4: c = b - 2 * a if c > 0: d = c + 1 else: d = c + 5 a = a + 3 b = b - 2
# HEAD # Destructing or Multiple Assignment Operators # DESCRIPTION # Describe incorrect usage of # multiple assignation which throws error # RESOURCES # # The number of items in the destructuring # have to be the same as variables used for assignation cat = ['fat', 'orange', 'loud'] # Will give an error since size is different size, color, disposition, name = cat # ERROR DETAILS - # Traceback (most recent call last): # File "<pyshell#84>", line 1, in <module> # size, color, disposition, name = cat # ValueError: need more than 3 values to unpack
cat = ['fat', 'orange', 'loud'] (size, color, disposition, name) = cat
pkg_dnf = { 'bind-utils': {}, 'bzip2': {}, 'coreutils': {}, 'curl': {}, 'diffutils': {}, 'file': {}, 'gcc': {}, 'gcc-c++': {}, 'git': {}, 'grep': {}, 'gzip': {}, 'hexedit': {}, 'hostname': {}, 'iotop': {}, 'iputils': {}, 'less': {}, 'lsof': {}, 'lynx': {}, 'man-db': {}, 'mlocate': {}, 'ncdu': {}, 'net-tools': {}, 'nmap': {}, 'nmap-ncat': {}, 'openssl': {}, 'p7zip': {}, 'p7zip-plugins': {}, 'patch': {}, 'pciutils': {}, 'psmisc': {}, 'redhat-rpm-config': {}, 'rsync': {}, 'screen': {}, 'sysstat': {}, 'tar': {}, 'tcpdump': {}, 'telnet': {}, 'traceroute': {}, 'tree': {}, 'unzip': {}, 'usbutils': {}, 'util-linux': {}, 'util-linux-user': {}, 'wget': {}, 'whois': {}, 'xz': {}, }
pkg_dnf = {'bind-utils': {}, 'bzip2': {}, 'coreutils': {}, 'curl': {}, 'diffutils': {}, 'file': {}, 'gcc': {}, 'gcc-c++': {}, 'git': {}, 'grep': {}, 'gzip': {}, 'hexedit': {}, 'hostname': {}, 'iotop': {}, 'iputils': {}, 'less': {}, 'lsof': {}, 'lynx': {}, 'man-db': {}, 'mlocate': {}, 'ncdu': {}, 'net-tools': {}, 'nmap': {}, 'nmap-ncat': {}, 'openssl': {}, 'p7zip': {}, 'p7zip-plugins': {}, 'patch': {}, 'pciutils': {}, 'psmisc': {}, 'redhat-rpm-config': {}, 'rsync': {}, 'screen': {}, 'sysstat': {}, 'tar': {}, 'tcpdump': {}, 'telnet': {}, 'traceroute': {}, 'tree': {}, 'unzip': {}, 'usbutils': {}, 'util-linux': {}, 'util-linux-user': {}, 'wget': {}, 'whois': {}, 'xz': {}}
# A - Set Lot Charge, Piece Price, Added Lead Time variables lot_charge = var('Lot Charge', 0, 'Lot charge for outside_service service', currency) piece_price = var('Piece Price', 0, 'Price per unit for the outside_service service', currency) added_lead_time = var('Added Lead Time', 0, 'Days of added lead time for outside_service service', number) # B - Define Extended Price extended_price = part.qty * piece_price # C - Compile costs if extended_price < lot_charge: # If the part quantity * piece price is less than the lot charge, then use the lot charge. PRICE = lot_charge else: # Otherwise, use the quantity * piece price. PRICE = extended_price # D - Define how many days this operation will contribute to the project lead time. DAYS = added_lead_time
lot_charge = var('Lot Charge', 0, 'Lot charge for outside_service service', currency) piece_price = var('Piece Price', 0, 'Price per unit for the outside_service service', currency) added_lead_time = var('Added Lead Time', 0, 'Days of added lead time for outside_service service', number) extended_price = part.qty * piece_price if extended_price < lot_charge: price = lot_charge else: price = extended_price days = added_lead_time
# # PySNMP MIB module ZHONE-GEN-VOICESTAT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-GEN-VOICESTAT # Produced by pysmi-0.3.4 at Wed May 1 15:47:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") ObjectIdentity, Bits, Integer32, Counter64, IpAddress, mib_2, NotificationType, Counter32, ModuleIdentity, TimeTicks, Gauge32, Unsigned32, MibIdentifier, iso, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Bits", "Integer32", "Counter64", "IpAddress", "mib-2", "NotificationType", "Counter32", "ModuleIdentity", "TimeTicks", "Gauge32", "Unsigned32", "MibIdentifier", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") zhoneSlotIndex, zhoneShelfIndex, zhoneGeneric = mibBuilder.importSymbols("Zhone", "zhoneSlotIndex", "zhoneShelfIndex", "zhoneGeneric") ZhoneRowStatus, = mibBuilder.importSymbols("Zhone-TC", "ZhoneRowStatus") zhoneVoiceStatsRecords = ModuleIdentity((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1)) zhoneVoiceStatsRecords.setRevisions(('2005-09-06 15:30', '2003-06-27 12:18',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setRevisionsDescriptions(('Add zhoneVoiceRingTable', 'V01.00.00 - Initial version',)) if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setLastUpdated('200306271737Z') if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setOrganization('Zhone Technologies, Inc.') if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setContactInfo('Postal: Zhone Technologies, Inc. @ Zhone Way 7001 Oakport Street Oakland, CA 94621 USA Toll-Free: +1 877-ZHONE20 (+1 877-946-6320) Tel: +1-510-777-7000 Fax: +1-510-777-7001 E-mail: support@zhone.com') if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setDescription('The MIB module to describe objects for voice call statistics. This MIB record contains tables that define voice calls statistics at the system, card, and subscriber end-point level for incoming, outgoing, and active calls. ') zhoneVoiceStats = ObjectIdentity((1, 3, 6, 1, 4, 1, 5504, 3, 11)) if mibBuilder.loadTexts: zhoneVoiceStats.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceStats.setDescription('Voice Call Statistics. This Object contains all instances associated with voice calls statistics. In revision 0, Completed, Blocked, and Active calls Statistics are implemented for System, card, and subscriber end-points. ') zhoneSystemStats = ObjectIdentity((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1)) if mibBuilder.loadTexts: zhoneSystemStats.setStatus('current') if mibBuilder.loadTexts: zhoneSystemStats.setDescription('The System voice statistics object is used to collect voice statistics at a system-wide level. These include statistics for incoming, outgoing, and active calls. The entry in this object is referenced using a static index of zero. ') systemIncomingCallsCompleted = MibScalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: systemIncomingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: systemIncomingCallsCompleted.setDescription('The number of completed incoming calls in the system.') systemIncomingCallsBlocked = MibScalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: systemIncomingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: systemIncomingCallsBlocked.setDescription('The number of blocked incoming calls in the system.') systemOutgoingCallsCompleted = MibScalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: systemOutgoingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: systemOutgoingCallsCompleted.setDescription('The number of completed outgoing calls in the system.') systemOutgoingCallsBlocked = MibScalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: systemOutgoingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: systemOutgoingCallsBlocked.setDescription('The number of blocked outgoing calls in the system.') systemActiveCalls = MibScalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: systemActiveCalls.setStatus('current') if mibBuilder.loadTexts: systemActiveCalls.setDescription('The number of currently active calls in the system.') zhoneCardStatsTable = MibTable((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2), ) if mibBuilder.loadTexts: zhoneCardStatsTable.setStatus('current') if mibBuilder.loadTexts: zhoneCardStatsTable.setDescription('The card voice statistics table is used to collect voice calls statistics on any card configured to carry voice traffic. Statistics are currently supported for cards with AAL2, GR303, V52 and POTS subscribers. This table collects statistics for incoming calls, outgoing calls, and active calls. The entry in this table is referenced using shelf/slot indices. ') zhoneCardStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1), ).setIndexNames((0, "Zhone", "zhoneShelfIndex"), (0, "Zhone", "zhoneSlotIndex")) if mibBuilder.loadTexts: zhoneCardStatsEntry.setStatus('current') if mibBuilder.loadTexts: zhoneCardStatsEntry.setDescription('An entry in the zhoneCardStatsTable') cardIncomingCallsCompleted = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cardIncomingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: cardIncomingCallsCompleted.setDescription('The number of completed incoming calls on the card.') cardIncomingCallsBlocked = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cardIncomingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: cardIncomingCallsBlocked.setDescription('The number of blocked incoming calls on the card.') cardOutgoingCallsCompleted = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cardOutgoingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: cardOutgoingCallsCompleted.setDescription('The number of completed outgoing calls on the card.') cardOutgoingCallsBlocked = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cardOutgoingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: cardOutgoingCallsBlocked.setDescription('The number of blocked outgoing calls on the card.') cardActiveCalls = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cardActiveCalls.setStatus('current') if mibBuilder.loadTexts: cardActiveCalls.setDescription('The number of currently active calls on the card.') zhoneSubscriberEPStatsTable = MibTable((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3), ) if mibBuilder.loadTexts: zhoneSubscriberEPStatsTable.setStatus('current') if mibBuilder.loadTexts: zhoneSubscriberEPStatsTable.setDescription('The subscriber voice end-point statistics table is used to collect incoming, outgoing, and active voice calls statistics for any subscriber end point.The entry in this table is referenced using end-point index. ') zhoneSubscriberEPStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1), ).setIndexNames((0, "ZHONE-GEN-VOICESTAT", "subVoiceEndPointIndex")) if mibBuilder.loadTexts: zhoneSubscriberEPStatsEntry.setStatus('current') if mibBuilder.loadTexts: zhoneSubscriberEPStatsEntry.setDescription('An entry in the zhoneSubscriberEPStatsTable') subVoiceEndPointIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: subVoiceEndPointIndex.setStatus('current') if mibBuilder.loadTexts: subVoiceEndPointIndex.setDescription('This index is equal to the end-point indices defined for the subscriber voice end-point tables in the zhoneSubscriberRecords. These end-points include AAL2, GR303, V52, POTS, etc. For all the end point types, the end-point index is unique to the sytem. ') subEPIncomingCallsCompleted = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: subEPIncomingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: subEPIncomingCallsCompleted.setDescription('The number of completed incoming calls at the subscriber voice end point.') subEPIncomingCallsBlocked = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: subEPIncomingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: subEPIncomingCallsBlocked.setDescription('The number of blocked incoming calls at the subscriber voice end point.') subEPOutgoingCallsCompleted = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: subEPOutgoingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: subEPOutgoingCallsCompleted.setDescription('The number of completed outgoing calls at the subscriber voice end point.') subEPOutgoingCallsBlocked = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: subEPOutgoingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: subEPOutgoingCallsBlocked.setDescription('The number of blocked outgoing calls at the subscriber voice end point.') subEPActiveCalls = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: subEPActiveCalls.setStatus('current') if mibBuilder.loadTexts: subEPActiveCalls.setDescription('The number of currently active calls at the subscriber voice end point.') zhoneVoiceStatsObjectsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 7)).setObjects(("ZHONE-GEN-VOICESTAT", "systemIncomingCallsCompleted"), ("ZHONE-GEN-VOICESTAT", "systemIncomingCallsBlocked"), ("ZHONE-GEN-VOICESTAT", "systemOutgoingCallsCompleted"), ("ZHONE-GEN-VOICESTAT", "systemOutgoingCallsBlocked"), ("ZHONE-GEN-VOICESTAT", "systemActiveCalls"), ("ZHONE-GEN-VOICESTAT", "cardIncomingCallsCompleted"), ("ZHONE-GEN-VOICESTAT", "cardIncomingCallsBlocked"), ("ZHONE-GEN-VOICESTAT", "cardOutgoingCallsCompleted"), ("ZHONE-GEN-VOICESTAT", "cardOutgoingCallsBlocked"), ("ZHONE-GEN-VOICESTAT", "cardActiveCalls"), ("ZHONE-GEN-VOICESTAT", "subEPIncomingCallsCompleted"), ("ZHONE-GEN-VOICESTAT", "subEPIncomingCallsBlocked"), ("ZHONE-GEN-VOICESTAT", "subEPOutgoingCallsCompleted"), ("ZHONE-GEN-VOICESTAT", "subEPOutgoingCallsBlocked"), ("ZHONE-GEN-VOICESTAT", "subEPActiveCalls")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): zhoneVoiceStatsObjectsGroup = zhoneVoiceStatsObjectsGroup.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceStatsObjectsGroup.setDescription('This group contains objects associated with voice statistics.') zhoneVoiceRingTable = MibTable((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8), ) if mibBuilder.loadTexts: zhoneVoiceRingTable.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingTable.setDescription('Table used to generate ring on a port.') zhoneVoiceRingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1), ).setIndexNames((0, "ZHONE-GEN-VOICESTAT", "zhoneVoiceRingIfIndex")) if mibBuilder.loadTexts: zhoneVoiceRingEntry.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingEntry.setDescription('Row in the zhoneVoiceRing table - corresponds to a port on which ring can be generated. ') zhoneVoiceRingIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: zhoneVoiceRingIfIndex.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingIfIndex.setDescription('physical interface') zhoneVoiceRingRingingCadence = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("ringCadenceR0", 1), ("ringCadenceR1", 2), ("ringCadenceR2", 3), ("ringCadenceR3", 4), ("ringCadenceR4", 5), ("ringCadenceR5", 6), ("ringCadenceR6", 7), ("ringCadenceR7", 8), ("ringCadenceCommon", 9), ("ringCadenceSplash", 10)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: zhoneVoiceRingRingingCadence.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingRingingCadence.setDescription('Ringing cadence to use in test.') zhoneVoiceRingTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 999))).setMaxAccess("readcreate") if mibBuilder.loadTexts: zhoneVoiceRingTimer.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingTimer.setDescription('Time in seconds to continue ringing.') zhoneVoiceRingRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1, 4), ZhoneRowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: zhoneVoiceRingRowStatus.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingRowStatus.setDescription('Row status.') mibBuilder.exportSymbols("ZHONE-GEN-VOICESTAT", subEPOutgoingCallsCompleted=subEPOutgoingCallsCompleted, cardIncomingCallsCompleted=cardIncomingCallsCompleted, subEPIncomingCallsCompleted=subEPIncomingCallsCompleted, zhoneSubscriberEPStatsEntry=zhoneSubscriberEPStatsEntry, zhoneVoiceRingIfIndex=zhoneVoiceRingIfIndex, zhoneVoiceStats=zhoneVoiceStats, zhoneCardStatsEntry=zhoneCardStatsEntry, zhoneSystemStats=zhoneSystemStats, zhoneSubscriberEPStatsTable=zhoneSubscriberEPStatsTable, zhoneVoiceRingTimer=zhoneVoiceRingTimer, cardIncomingCallsBlocked=cardIncomingCallsBlocked, cardActiveCalls=cardActiveCalls, subVoiceEndPointIndex=subVoiceEndPointIndex, cardOutgoingCallsBlocked=cardOutgoingCallsBlocked, PYSNMP_MODULE_ID=zhoneVoiceStatsRecords, subEPOutgoingCallsBlocked=subEPOutgoingCallsBlocked, zhoneVoiceStatsRecords=zhoneVoiceStatsRecords, zhoneVoiceRingTable=zhoneVoiceRingTable, subEPActiveCalls=subEPActiveCalls, zhoneVoiceRingEntry=zhoneVoiceRingEntry, zhoneVoiceRingRingingCadence=zhoneVoiceRingRingingCadence, systemOutgoingCallsBlocked=systemOutgoingCallsBlocked, cardOutgoingCallsCompleted=cardOutgoingCallsCompleted, systemOutgoingCallsCompleted=systemOutgoingCallsCompleted, systemIncomingCallsCompleted=systemIncomingCallsCompleted, systemIncomingCallsBlocked=systemIncomingCallsBlocked, zhoneVoiceStatsObjectsGroup=zhoneVoiceStatsObjectsGroup, subEPIncomingCallsBlocked=subEPIncomingCallsBlocked, systemActiveCalls=systemActiveCalls, zhoneCardStatsTable=zhoneCardStatsTable, zhoneVoiceRingRowStatus=zhoneVoiceRingRowStatus)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection') (interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex') (notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance') (object_identity, bits, integer32, counter64, ip_address, mib_2, notification_type, counter32, module_identity, time_ticks, gauge32, unsigned32, mib_identifier, iso, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'Bits', 'Integer32', 'Counter64', 'IpAddress', 'mib-2', 'NotificationType', 'Counter32', 'ModuleIdentity', 'TimeTicks', 'Gauge32', 'Unsigned32', 'MibIdentifier', 'iso', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') (zhone_slot_index, zhone_shelf_index, zhone_generic) = mibBuilder.importSymbols('Zhone', 'zhoneSlotIndex', 'zhoneShelfIndex', 'zhoneGeneric') (zhone_row_status,) = mibBuilder.importSymbols('Zhone-TC', 'ZhoneRowStatus') zhone_voice_stats_records = module_identity((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1)) zhoneVoiceStatsRecords.setRevisions(('2005-09-06 15:30', '2003-06-27 12:18')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setRevisionsDescriptions(('Add zhoneVoiceRingTable', 'V01.00.00 - Initial version')) if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setLastUpdated('200306271737Z') if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setOrganization('Zhone Technologies, Inc.') if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setContactInfo('Postal: Zhone Technologies, Inc. @ Zhone Way 7001 Oakport Street Oakland, CA 94621 USA Toll-Free: +1 877-ZHONE20 (+1 877-946-6320) Tel: +1-510-777-7000 Fax: +1-510-777-7001 E-mail: support@zhone.com') if mibBuilder.loadTexts: zhoneVoiceStatsRecords.setDescription('The MIB module to describe objects for voice call statistics. This MIB record contains tables that define voice calls statistics at the system, card, and subscriber end-point level for incoming, outgoing, and active calls. ') zhone_voice_stats = object_identity((1, 3, 6, 1, 4, 1, 5504, 3, 11)) if mibBuilder.loadTexts: zhoneVoiceStats.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceStats.setDescription('Voice Call Statistics. This Object contains all instances associated with voice calls statistics. In revision 0, Completed, Blocked, and Active calls Statistics are implemented for System, card, and subscriber end-points. ') zhone_system_stats = object_identity((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1)) if mibBuilder.loadTexts: zhoneSystemStats.setStatus('current') if mibBuilder.loadTexts: zhoneSystemStats.setDescription('The System voice statistics object is used to collect voice statistics at a system-wide level. These include statistics for incoming, outgoing, and active calls. The entry in this object is referenced using a static index of zero. ') system_incoming_calls_completed = mib_scalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: systemIncomingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: systemIncomingCallsCompleted.setDescription('The number of completed incoming calls in the system.') system_incoming_calls_blocked = mib_scalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: systemIncomingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: systemIncomingCallsBlocked.setDescription('The number of blocked incoming calls in the system.') system_outgoing_calls_completed = mib_scalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: systemOutgoingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: systemOutgoingCallsCompleted.setDescription('The number of completed outgoing calls in the system.') system_outgoing_calls_blocked = mib_scalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: systemOutgoingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: systemOutgoingCallsBlocked.setDescription('The number of blocked outgoing calls in the system.') system_active_calls = mib_scalar((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: systemActiveCalls.setStatus('current') if mibBuilder.loadTexts: systemActiveCalls.setDescription('The number of currently active calls in the system.') zhone_card_stats_table = mib_table((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2)) if mibBuilder.loadTexts: zhoneCardStatsTable.setStatus('current') if mibBuilder.loadTexts: zhoneCardStatsTable.setDescription('The card voice statistics table is used to collect voice calls statistics on any card configured to carry voice traffic. Statistics are currently supported for cards with AAL2, GR303, V52 and POTS subscribers. This table collects statistics for incoming calls, outgoing calls, and active calls. The entry in this table is referenced using shelf/slot indices. ') zhone_card_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1)).setIndexNames((0, 'Zhone', 'zhoneShelfIndex'), (0, 'Zhone', 'zhoneSlotIndex')) if mibBuilder.loadTexts: zhoneCardStatsEntry.setStatus('current') if mibBuilder.loadTexts: zhoneCardStatsEntry.setDescription('An entry in the zhoneCardStatsTable') card_incoming_calls_completed = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cardIncomingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: cardIncomingCallsCompleted.setDescription('The number of completed incoming calls on the card.') card_incoming_calls_blocked = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cardIncomingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: cardIncomingCallsBlocked.setDescription('The number of blocked incoming calls on the card.') card_outgoing_calls_completed = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cardOutgoingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: cardOutgoingCallsCompleted.setDescription('The number of completed outgoing calls on the card.') card_outgoing_calls_blocked = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cardOutgoingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: cardOutgoingCallsBlocked.setDescription('The number of blocked outgoing calls on the card.') card_active_calls = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 2, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cardActiveCalls.setStatus('current') if mibBuilder.loadTexts: cardActiveCalls.setDescription('The number of currently active calls on the card.') zhone_subscriber_ep_stats_table = mib_table((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3)) if mibBuilder.loadTexts: zhoneSubscriberEPStatsTable.setStatus('current') if mibBuilder.loadTexts: zhoneSubscriberEPStatsTable.setDescription('The subscriber voice end-point statistics table is used to collect incoming, outgoing, and active voice calls statistics for any subscriber end point.The entry in this table is referenced using end-point index. ') zhone_subscriber_ep_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1)).setIndexNames((0, 'ZHONE-GEN-VOICESTAT', 'subVoiceEndPointIndex')) if mibBuilder.loadTexts: zhoneSubscriberEPStatsEntry.setStatus('current') if mibBuilder.loadTexts: zhoneSubscriberEPStatsEntry.setDescription('An entry in the zhoneSubscriberEPStatsTable') sub_voice_end_point_index = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: subVoiceEndPointIndex.setStatus('current') if mibBuilder.loadTexts: subVoiceEndPointIndex.setDescription('This index is equal to the end-point indices defined for the subscriber voice end-point tables in the zhoneSubscriberRecords. These end-points include AAL2, GR303, V52, POTS, etc. For all the end point types, the end-point index is unique to the sytem. ') sub_ep_incoming_calls_completed = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: subEPIncomingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: subEPIncomingCallsCompleted.setDescription('The number of completed incoming calls at the subscriber voice end point.') sub_ep_incoming_calls_blocked = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: subEPIncomingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: subEPIncomingCallsBlocked.setDescription('The number of blocked incoming calls at the subscriber voice end point.') sub_ep_outgoing_calls_completed = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: subEPOutgoingCallsCompleted.setStatus('current') if mibBuilder.loadTexts: subEPOutgoingCallsCompleted.setDescription('The number of completed outgoing calls at the subscriber voice end point.') sub_ep_outgoing_calls_blocked = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: subEPOutgoingCallsBlocked.setStatus('current') if mibBuilder.loadTexts: subEPOutgoingCallsBlocked.setDescription('The number of blocked outgoing calls at the subscriber voice end point.') sub_ep_active_calls = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 3, 1, 7), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: subEPActiveCalls.setStatus('current') if mibBuilder.loadTexts: subEPActiveCalls.setDescription('The number of currently active calls at the subscriber voice end point.') zhone_voice_stats_objects_group = object_group((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 7)).setObjects(('ZHONE-GEN-VOICESTAT', 'systemIncomingCallsCompleted'), ('ZHONE-GEN-VOICESTAT', 'systemIncomingCallsBlocked'), ('ZHONE-GEN-VOICESTAT', 'systemOutgoingCallsCompleted'), ('ZHONE-GEN-VOICESTAT', 'systemOutgoingCallsBlocked'), ('ZHONE-GEN-VOICESTAT', 'systemActiveCalls'), ('ZHONE-GEN-VOICESTAT', 'cardIncomingCallsCompleted'), ('ZHONE-GEN-VOICESTAT', 'cardIncomingCallsBlocked'), ('ZHONE-GEN-VOICESTAT', 'cardOutgoingCallsCompleted'), ('ZHONE-GEN-VOICESTAT', 'cardOutgoingCallsBlocked'), ('ZHONE-GEN-VOICESTAT', 'cardActiveCalls'), ('ZHONE-GEN-VOICESTAT', 'subEPIncomingCallsCompleted'), ('ZHONE-GEN-VOICESTAT', 'subEPIncomingCallsBlocked'), ('ZHONE-GEN-VOICESTAT', 'subEPOutgoingCallsCompleted'), ('ZHONE-GEN-VOICESTAT', 'subEPOutgoingCallsBlocked'), ('ZHONE-GEN-VOICESTAT', 'subEPActiveCalls')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): zhone_voice_stats_objects_group = zhoneVoiceStatsObjectsGroup.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceStatsObjectsGroup.setDescription('This group contains objects associated with voice statistics.') zhone_voice_ring_table = mib_table((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8)) if mibBuilder.loadTexts: zhoneVoiceRingTable.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingTable.setDescription('Table used to generate ring on a port.') zhone_voice_ring_entry = mib_table_row((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1)).setIndexNames((0, 'ZHONE-GEN-VOICESTAT', 'zhoneVoiceRingIfIndex')) if mibBuilder.loadTexts: zhoneVoiceRingEntry.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingEntry.setDescription('Row in the zhoneVoiceRing table - corresponds to a port on which ring can be generated. ') zhone_voice_ring_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1, 1), interface_index()) if mibBuilder.loadTexts: zhoneVoiceRingIfIndex.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingIfIndex.setDescription('physical interface') zhone_voice_ring_ringing_cadence = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=named_values(('ringCadenceR0', 1), ('ringCadenceR1', 2), ('ringCadenceR2', 3), ('ringCadenceR3', 4), ('ringCadenceR4', 5), ('ringCadenceR5', 6), ('ringCadenceR6', 7), ('ringCadenceR7', 8), ('ringCadenceCommon', 9), ('ringCadenceSplash', 10)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: zhoneVoiceRingRingingCadence.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingRingingCadence.setDescription('Ringing cadence to use in test.') zhone_voice_ring_timer = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 999))).setMaxAccess('readcreate') if mibBuilder.loadTexts: zhoneVoiceRingTimer.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingTimer.setDescription('Time in seconds to continue ringing.') zhone_voice_ring_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 5504, 3, 11, 1, 8, 1, 4), zhone_row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: zhoneVoiceRingRowStatus.setStatus('current') if mibBuilder.loadTexts: zhoneVoiceRingRowStatus.setDescription('Row status.') mibBuilder.exportSymbols('ZHONE-GEN-VOICESTAT', subEPOutgoingCallsCompleted=subEPOutgoingCallsCompleted, cardIncomingCallsCompleted=cardIncomingCallsCompleted, subEPIncomingCallsCompleted=subEPIncomingCallsCompleted, zhoneSubscriberEPStatsEntry=zhoneSubscriberEPStatsEntry, zhoneVoiceRingIfIndex=zhoneVoiceRingIfIndex, zhoneVoiceStats=zhoneVoiceStats, zhoneCardStatsEntry=zhoneCardStatsEntry, zhoneSystemStats=zhoneSystemStats, zhoneSubscriberEPStatsTable=zhoneSubscriberEPStatsTable, zhoneVoiceRingTimer=zhoneVoiceRingTimer, cardIncomingCallsBlocked=cardIncomingCallsBlocked, cardActiveCalls=cardActiveCalls, subVoiceEndPointIndex=subVoiceEndPointIndex, cardOutgoingCallsBlocked=cardOutgoingCallsBlocked, PYSNMP_MODULE_ID=zhoneVoiceStatsRecords, subEPOutgoingCallsBlocked=subEPOutgoingCallsBlocked, zhoneVoiceStatsRecords=zhoneVoiceStatsRecords, zhoneVoiceRingTable=zhoneVoiceRingTable, subEPActiveCalls=subEPActiveCalls, zhoneVoiceRingEntry=zhoneVoiceRingEntry, zhoneVoiceRingRingingCadence=zhoneVoiceRingRingingCadence, systemOutgoingCallsBlocked=systemOutgoingCallsBlocked, cardOutgoingCallsCompleted=cardOutgoingCallsCompleted, systemOutgoingCallsCompleted=systemOutgoingCallsCompleted, systemIncomingCallsCompleted=systemIncomingCallsCompleted, systemIncomingCallsBlocked=systemIncomingCallsBlocked, zhoneVoiceStatsObjectsGroup=zhoneVoiceStatsObjectsGroup, subEPIncomingCallsBlocked=subEPIncomingCallsBlocked, systemActiveCalls=systemActiveCalls, zhoneCardStatsTable=zhoneCardStatsTable, zhoneVoiceRingRowStatus=zhoneVoiceRingRowStatus)
'''https://practice.geeksforgeeks.org/problems/common-elements1132/1 Common elements Easy Accuracy: 38.69% Submissions: 81306 Points: 2 Given three arrays sorted in increasing order. Find the elements that are common in all three arrays. Note: can you take care of the duplicates without using any additional Data Structure? Example 1: Input: n1 = 6; A = {1, 5, 10, 20, 40, 80} n2 = 5; B = {6, 7, 20, 80, 100} n3 = 8; C = {3, 4, 15, 20, 30, 70, 80, 120} Output: 20 80 Explanation: 20 and 80 are the only common elements in A, B and C. Your Task: You don't need to read input or print anything. Your task is to complete the function commonElements() which take the 3 arrays A[], B[], C[] and their respective sizes n1, n2 and n3 as inputs and returns an array containing the common element present in all the 3 arrays in sorted order. If there are no such elements return an empty array. In this case the output will be printed as -1. Expected Time Complexity: O(n1 + n2 + n3) Expected Auxiliary Space: O(n1 + n2 + n3) Constraints: 1 <= n1, n2, n3 <= 10^5 The array elements can be both positive or negative integers.''' # User function Template for python3 class Solution: def commonElements(self, A, B, C, n1, n2, n3): # your code here return sorted(list(set(A) & set(B) & set(C))) # { # Driver Code Starts # Initial Template for Python 3 t = int(input()) for tc in range(t): n1, n2, n3 = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) ob = Solution() res = ob.commonElements(A, B, C, n1, n2, n3) if len(res) == 0: print(-1) else: for i in range(len(res)): print(res[i], end=" ") print() # } Driver Code Ends
"""https://practice.geeksforgeeks.org/problems/common-elements1132/1 Common elements Easy Accuracy: 38.69% Submissions: 81306 Points: 2 Given three arrays sorted in increasing order. Find the elements that are common in all three arrays. Note: can you take care of the duplicates without using any additional Data Structure? Example 1: Input: n1 = 6; A = {1, 5, 10, 20, 40, 80} n2 = 5; B = {6, 7, 20, 80, 100} n3 = 8; C = {3, 4, 15, 20, 30, 70, 80, 120} Output: 20 80 Explanation: 20 and 80 are the only common elements in A, B and C. Your Task: You don't need to read input or print anything. Your task is to complete the function commonElements() which take the 3 arrays A[], B[], C[] and their respective sizes n1, n2 and n3 as inputs and returns an array containing the common element present in all the 3 arrays in sorted order. If there are no such elements return an empty array. In this case the output will be printed as -1. Expected Time Complexity: O(n1 + n2 + n3) Expected Auxiliary Space: O(n1 + n2 + n3) Constraints: 1 <= n1, n2, n3 <= 10^5 The array elements can be both positive or negative integers.""" class Solution: def common_elements(self, A, B, C, n1, n2, n3): return sorted(list(set(A) & set(B) & set(C))) t = int(input()) for tc in range(t): (n1, n2, n3) = list(map(int, input().split())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) ob = solution() res = ob.commonElements(A, B, C, n1, n2, n3) if len(res) == 0: print(-1) else: for i in range(len(res)): print(res[i], end=' ') print()
# the follow code is for key handover KEY_ACCEPTED = 1 KEY_NOT_ACCEPTED = 0 KEY_DESTINATION = 0 KEY_ESTATE = 1 KEY_ILOCK = 2 KEY_OTHER = 3 # the follow code is for note NOTE_USED = 1 NOTE_DISCARDED = 0 NOTE_TYPE_HOME = 0 NOTE_TYPE_OFFER = 1 NOTE_TYPE_USER = 2 # the follow code is for Utility UTILITY_USED = 1 UTILITY_DISCARDED = 0 # 0 =>discard, 1=>used IS_ACTIVE_USED = 1 IS_ACTIVE_DISCARDED = 0 # sms message type OFFER_READY_MESSAGE = 0 OFFER_FINISHED_MESSAGE = 1 INSPECTION_START = 2 INSPECTION_NEED_FIXATION = 3 INSPECTION_FINISHED = 4 PAYMENT_CONFIRMATION = 5 OFFER_PRIING_MESSAGE = 6 OFFER_FINISHED_MESSAGE_LINK = 'http://www.wehome.io/key-handling?home_id={}' INSPECTION_FINISHED_LINK = 'http://www.wehome.io/payment?home_id={}' OFFER_READY_MESSAGE_LINK = 'http://www.wehome.io/myhouse' # pm progress status PM_PROGRESS_INIT = 0 PM_PROGRESS_FIRST = 10 PM_PROGRESS_SECOND = 20 PM_PROGRESS_THIRD = 30 # property status PROPERTY_PENDINNG_STATUS = 0 #default PROPERTY_INSPECTING_STATUS = 1 #start inspection PROPERTY_MAINTANENCE_STATUS = 2 #3.4 PROPERTY_APPROVED_STATUS = 3 #3.3 PROPERTY_LEASING_STATUS = 4 # yes PROPERTY_REJECTED_STATUS = 5 # no PROPERTY_LEASED_STATUS = 6 #3.5 # wehome status # 1** => home info status # 2** => princing status # 3** => inspection status DEAL_NOT_PAY_FOR_PM = '310' DEAL_PAY_FOR_PM = '311' # 4** => deal status # 410 => deal agreed DEAL_AGREED = '410' # 42* => deal utility info status DEAL_UTILITY_INFO_WITHOUT_HOA = '420' DEAL_UTILITY_INFO_WITH_HOA = '421' # 430 => deal payment info status DEAL_PAYMENT_INFO = '430' # 440 => deal closed DEAL_CLOSED = '440' # 5** => rented status
key_accepted = 1 key_not_accepted = 0 key_destination = 0 key_estate = 1 key_ilock = 2 key_other = 3 note_used = 1 note_discarded = 0 note_type_home = 0 note_type_offer = 1 note_type_user = 2 utility_used = 1 utility_discarded = 0 is_active_used = 1 is_active_discarded = 0 offer_ready_message = 0 offer_finished_message = 1 inspection_start = 2 inspection_need_fixation = 3 inspection_finished = 4 payment_confirmation = 5 offer_priing_message = 6 offer_finished_message_link = 'http://www.wehome.io/key-handling?home_id={}' inspection_finished_link = 'http://www.wehome.io/payment?home_id={}' offer_ready_message_link = 'http://www.wehome.io/myhouse' pm_progress_init = 0 pm_progress_first = 10 pm_progress_second = 20 pm_progress_third = 30 property_pendinng_status = 0 property_inspecting_status = 1 property_maintanence_status = 2 property_approved_status = 3 property_leasing_status = 4 property_rejected_status = 5 property_leased_status = 6 deal_not_pay_for_pm = '310' deal_pay_for_pm = '311' deal_agreed = '410' deal_utility_info_without_hoa = '420' deal_utility_info_with_hoa = '421' deal_payment_info = '430' deal_closed = '440'
def mergeSort(lst): pass print(mergeSort([2,3,4,5,15,19,26,27,36,38,44,46,47,48,50] ))
def merge_sort(lst): pass print(merge_sort([2, 3, 4, 5, 15, 19, 26, 27, 36, 38, 44, 46, 47, 48, 50]))
def attach_label_operation(label_id: 'Long' = None, campaign_id: 'Long' = None, ad_id: 'Long' = None, ad_group_id: 'Long' = None, criterion_id: 'Long' = None, customer_id: 'Long' = None, operator: 'String' = 'ADD', **kwargs): operation = { 'operator': operator.upper(), 'operand': { 'labelId': label_id, } } if customer_id: operation['operand']['customerId'] = customer_id if campaign_id: operation['operand']['campaignId'] = campaign_id operation['xsi_type'] = 'CampaignLabelOperation' if ad_group_id: operation['operand']['adGroupId'] = ad_group_id operation['xsi_type'] = 'AdGroupLabelOperation' if ad_id: if campaign_id: operation['operand'].pop('campaignId', None) operation['operand']['adId'] = ad_id operation['xsi_type'] = 'AdGroupAdLabelOperation' if criterion_id: if campaign_id: operation['operand'].pop('campaignId', None) operation['operand']['criterionId'] = criterion_id operation['xsi_type'] = 'AdGroupCriterionLabelOperation' return operation
def attach_label_operation(label_id: 'Long'=None, campaign_id: 'Long'=None, ad_id: 'Long'=None, ad_group_id: 'Long'=None, criterion_id: 'Long'=None, customer_id: 'Long'=None, operator: 'String'='ADD', **kwargs): operation = {'operator': operator.upper(), 'operand': {'labelId': label_id}} if customer_id: operation['operand']['customerId'] = customer_id if campaign_id: operation['operand']['campaignId'] = campaign_id operation['xsi_type'] = 'CampaignLabelOperation' if ad_group_id: operation['operand']['adGroupId'] = ad_group_id operation['xsi_type'] = 'AdGroupLabelOperation' if ad_id: if campaign_id: operation['operand'].pop('campaignId', None) operation['operand']['adId'] = ad_id operation['xsi_type'] = 'AdGroupAdLabelOperation' if criterion_id: if campaign_id: operation['operand'].pop('campaignId', None) operation['operand']['criterionId'] = criterion_id operation['xsi_type'] = 'AdGroupCriterionLabelOperation' return operation
# Source : https://leetcode.com/problems/shortest-palindrome/ # Author : henrytine # Date : 2020-07-23 ##################################################################################################### # # Given a string s, you are allowed to convert it to a palindrome by adding characters in front of # it. Find and return the shortest palindrome you can find by performing this transformation. # # Example 1: # # Input: "aacecaaa" # Output: "aaacecaaa" # # Example 2: # # Input: "abcd" # Output: "dcbabcd" ##################################################################################################### class Solution: def shortestPalindrome(self, s: str) -> str: r = s[::-1] for i in range(len(s) + 1): if s.startswith(r[i:]): return r[:i] + s
class Solution: def shortest_palindrome(self, s: str) -> str: r = s[::-1] for i in range(len(s) + 1): if s.startswith(r[i:]): return r[:i] + s
def update_parameters(parameters, gradients, lr, batch_size, a): parameters["Wax"] = parameters["Wax"] - (lr/batch_size) * gradients["dWax"] parameters["Waa"] = parameters["Waa"] - (lr / batch_size) * gradients["dWaa"] parameters["ba"] = parameters["ba"] - (lr / batch_size) * gradients["dba"] if a == "d": parameters["Wya"] = parameters["Wya"] - (lr / batch_size) * gradients["dWya"] parameters["by"] = parameters["by"] - (lr / batch_size) * gradients["dby"] return parameters
def update_parameters(parameters, gradients, lr, batch_size, a): parameters['Wax'] = parameters['Wax'] - lr / batch_size * gradients['dWax'] parameters['Waa'] = parameters['Waa'] - lr / batch_size * gradients['dWaa'] parameters['ba'] = parameters['ba'] - lr / batch_size * gradients['dba'] if a == 'd': parameters['Wya'] = parameters['Wya'] - lr / batch_size * gradients['dWya'] parameters['by'] = parameters['by'] - lr / batch_size * gradients['dby'] return parameters
#!/usr/bin/python3 s='ODITSZAPC' p='ba9876420' for comb in range(0, 2**9): x = comb i = 0 c = '' v = 0 while x != 0: f = x % 2 if f == 1: c += s[i] v += 1<<int(p[i], 16) i += 1 x = int(x/2) if c == '': continue print('Z%s = 0x%x' % (c, v))
s = 'ODITSZAPC' p = 'ba9876420' for comb in range(0, 2 ** 9): x = comb i = 0 c = '' v = 0 while x != 0: f = x % 2 if f == 1: c += s[i] v += 1 << int(p[i], 16) i += 1 x = int(x / 2) if c == '': continue print('Z%s = 0x%x' % (c, v))
MAX_INT8 = 1 << 7 - 1 MIN_INT8 = -1 << 7 MAX_INT16 = 1 << 15 - 1 MIN_INT16 = -1 << 15 MAX_INT32 = 1 << 31 - 1 MIN_INT32 = -1 << 31 MAX_INT64 = 1 << 63 - 1 MIN_INT64 = -1 << 63 MAX_UINT8 = 1 << 8 - 1 MAX_UINT16 = 1 << 16 - 1 MAX_UINT32 = 1 << 32 - 1 MAX_UINT64 = 1 << 64 - 1
max_int8 = 1 << 7 - 1 min_int8 = -1 << 7 max_int16 = 1 << 15 - 1 min_int16 = -1 << 15 max_int32 = 1 << 31 - 1 min_int32 = -1 << 31 max_int64 = 1 << 63 - 1 min_int64 = -1 << 63 max_uint8 = 1 << 8 - 1 max_uint16 = 1 << 16 - 1 max_uint32 = 1 << 32 - 1 max_uint64 = 1 << 64 - 1
# board # display board # play game # handle turn # check win # check rows # check coumns # check diagonals # check tie # flip player #--------Global Variables------ #Game board board = ["-","-","-", "-","-","-", "-","-","-",] #if game is still going game_still_going = True #Who won? or tie? winner = None #Whos turn is it current_player = "X" def display_board(): print(board[0] + " | " + board[1] + " | " + board[2]) print(board[3] + " | " + board[4] + " | " + board[5]) print(board[6] + " | " + board[7] + " | " + board[8]) # play a game of tic tac toe def play_game(): # Display initial board display_board() # While the game is still going while game_still_going: # handel a single turn of an arbitrary player handle_turn(current_player) # Check if the game has ended check_if_game_over() # Flip to the other player flip_player() # The game has ended if winner == "X" or winner == "O": print(winner + " won.") elif winner == None: print("Tie.") # Handle a single turn of an arbitrary player def handle_turn(player): print(player + "'s turn.") position = input("Choose a position from 1-9: ") valid = False while not valid: while position not in["1","2","3","4","5","6","7","8","9"]: position = input("Invalid input. Choose a position from 1-9: ") position = int(position) - 1 if board[position] == "-": valid = True else: print("You cant go there. Go again.") board[position] = player display_board() def check_if_game_over(): check_for_winner() check_if_tie() def check_for_winner(): # Set up a global variables global winner # check rows row_winner = check_rows() # check cloumns column_winner = check_columns() # check diagonals diagonal_winner = check_diagonals() if row_winner: #there was a win winner = row_winner elif column_winner: #there was a win winner = column_winner elif diagonal_winner: #there was a win winner = diagonal_winner else: #there was no win winner = None return def check_rows(): # Set up global variables global game_still_going # check if any rows have the same value and is not empty row_1 = board[0]==board[1]==board[2] != "-" row_2 = board[3]==board[4]==board[5] != "-" row_3 = board[6]==board[7]==board[8] != "-" if row_1 or row_2 or row_3: game_still_going = False # Return the winner (X or O) if row_1: return board[0] if row_2: return board[3] if row_3: return board[6] return def check_columns(): # Set up global variables global game_still_going # check if any column have the same value and is not empty column_1 = board[0]==board[3]==board[6] != "-" column_2 = board[1]==board[4]==board[7] != "-" column_3 = board[2]==board[5]==board[8] != "-" if column_1 or column_2 or column_3: game_still_going = False # Return the winner (X or O) if column_1: return board[0] if column_2: return board[1] if column_3: return board[2] return def check_diagonals(): # Set up global variables global game_still_going # check if any diagonal have the same value and is not empty diagonal_1 = board[0]==board[4]==board[8] != "-" diagonal_2 = board[6]==board[4]==board[2] != "-" if diagonal_1 or diagonal_2: game_still_going = False # Return the winner (X or O) if diagonal_1: return board[0] if diagonal_2: return board[6] return def check_if_tie(): global game_still_going if "-" not in board: game_still_going = False return def flip_player(): # global variable global current_player # if the current player was x, then change it to O and vice-versa if current_player == "X": current_player = "O" elif current_player == "O": current_player = "X" return play_game()
board = ['-', '-', '-', '-', '-', '-', '-', '-', '-'] game_still_going = True winner = None current_player = 'X' def display_board(): print(board[0] + ' | ' + board[1] + ' | ' + board[2]) print(board[3] + ' | ' + board[4] + ' | ' + board[5]) print(board[6] + ' | ' + board[7] + ' | ' + board[8]) def play_game(): display_board() while game_still_going: handle_turn(current_player) check_if_game_over() flip_player() if winner == 'X' or winner == 'O': print(winner + ' won.') elif winner == None: print('Tie.') def handle_turn(player): print(player + "'s turn.") position = input('Choose a position from 1-9: ') valid = False while not valid: while position not in ['1', '2', '3', '4', '5', '6', '7', '8', '9']: position = input('Invalid input. Choose a position from 1-9: ') position = int(position) - 1 if board[position] == '-': valid = True else: print('You cant go there. Go again.') board[position] = player display_board() def check_if_game_over(): check_for_winner() check_if_tie() def check_for_winner(): global winner row_winner = check_rows() column_winner = check_columns() diagonal_winner = check_diagonals() if row_winner: winner = row_winner elif column_winner: winner = column_winner elif diagonal_winner: winner = diagonal_winner else: winner = None return def check_rows(): global game_still_going row_1 = board[0] == board[1] == board[2] != '-' row_2 = board[3] == board[4] == board[5] != '-' row_3 = board[6] == board[7] == board[8] != '-' if row_1 or row_2 or row_3: game_still_going = False if row_1: return board[0] if row_2: return board[3] if row_3: return board[6] return def check_columns(): global game_still_going column_1 = board[0] == board[3] == board[6] != '-' column_2 = board[1] == board[4] == board[7] != '-' column_3 = board[2] == board[5] == board[8] != '-' if column_1 or column_2 or column_3: game_still_going = False if column_1: return board[0] if column_2: return board[1] if column_3: return board[2] return def check_diagonals(): global game_still_going diagonal_1 = board[0] == board[4] == board[8] != '-' diagonal_2 = board[6] == board[4] == board[2] != '-' if diagonal_1 or diagonal_2: game_still_going = False if diagonal_1: return board[0] if diagonal_2: return board[6] return def check_if_tie(): global game_still_going if '-' not in board: game_still_going = False return def flip_player(): global current_player if current_player == 'X': current_player = 'O' elif current_player == 'O': current_player = 'X' return play_game()
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def addTwoNumbers(self, l1, l2): p1=l1 p2=l2 count=0 while p1 and p2: count+=p1.val count+=p2.val p1.val=count%10 count=count//10 p2=p2.next if p1.next is None: p1.next=p2 p1=None else: p1=p1.next while p2 and count>0: count+=p2.val p2.val=count%10 count=count//10 if p2.next is None and count>0: p2.next=ListNode(count) break else: p2=p2.next while p1 and count: count += p1.val p1.val = count % 10 count = count // 10 if p1.next is None and count > 0: p1.next = ListNode(count) break else: p1 = p1.next return l1
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def add_two_numbers(self, l1, l2): p1 = l1 p2 = l2 count = 0 while p1 and p2: count += p1.val count += p2.val p1.val = count % 10 count = count // 10 p2 = p2.next if p1.next is None: p1.next = p2 p1 = None else: p1 = p1.next while p2 and count > 0: count += p2.val p2.val = count % 10 count = count // 10 if p2.next is None and count > 0: p2.next = list_node(count) break else: p2 = p2.next while p1 and count: count += p1.val p1.val = count % 10 count = count // 10 if p1.next is None and count > 0: p1.next = list_node(count) break else: p1 = p1.next return l1
height = 6 num = 1 for i in range(height,-height-1,-1): for j in range(1,abs(i)+1): print(end=" ") if(i >= 0) : num = 1 else: num = abs(i) + 1; for j in range(height,abs(i)+1,-1): print(num,end=" ") num += 1 print() # Output :- # 1 # 1 2 # 1 2 3 # 1 2 3 4 # 1 2 3 4 5 # 2 3 4 5 # 3 4 5 # 4 5 # 5
height = 6 num = 1 for i in range(height, -height - 1, -1): for j in range(1, abs(i) + 1): print(end=' ') if i >= 0: num = 1 else: num = abs(i) + 1 for j in range(height, abs(i) + 1, -1): print(num, end=' ') num += 1 print()
f1 = 1 f2 = 2 not_a_flag = 3 print("step: 1") print("stat_1: 0.5") print("stat_2: 0.6") print("step: 2") print("stat_1: 0.7") print("stat_2: 0.8")
f1 = 1 f2 = 2 not_a_flag = 3 print('step: 1') print('stat_1: 0.5') print('stat_2: 0.6') print('step: 2') print('stat_1: 0.7') print('stat_2: 0.8')
load("@obazl_rules_ocaml//ocaml:providers.bzl", "OpamConfig", "BuildConfig") opam_pkg = { "async": ["v0.12.0"], "bignum": ["v0.12.0"], # WARNING: depends on zarith which depends on libgmp-dev on local system "bin_prot": ["v0.12.0"], "core": ["v0.12.1"], "core_kernel": ["v0.12.3"], "digestif": ["0.9.0"], "fieldslib": ["v0.12.0"], "num": ["1.1"], "ppx_assert": ["v0.12.0", ["ppx_assert.runtime-lib"]], "ppx_bench": ["v0.12.0", ["ppx_bench.runtime-lib"]], "ppx_bin_prot": ["v0.12.1"], "ppx_compare": ["v0.12.0", ["ppx_compare.runtime-lib"]], "ppx_custom_printf": ["v0.12.0"], "ppx_deriving": ["4.4.1", [ "ppx_deriving.enum", "ppx_deriving.eq", "ppx_deriving.std", "ppx_deriving.runtime" ]], "ppx_deriving_yojson": ["3.5.2", ["ppx_deriving_yojson.runtime"]], "ppx_enumerate": ["v0.12.0", ["ppx_enumerate.runtime-lib"]], "ppx_expect": ["v0.12.0", ["ppx_expect.collector"]], "ppx_fields_conv": ["v0.12.0"], "ppx_hash": ["v0.12.0", ["ppx_hash.runtime-lib"]], "ppx_inline_test": ["v0.12.0", ["ppx_inline_test.runtime-lib"]], "ppx_jane": ["v0.12.0"], "ppx_let": ["v0.12.0"], "ppx_module_timer": ["v0.12.0", ["ppx_module_timer.runtime"]], "ppx_sexp_conv": ["v0.12.0", ["ppx_sexp_conv.runtime-lib"]], "ppx_tools": ["5.1+4.06.0"], "ppxlib": ["0.8.1", ["ppxlib.metaquot"]], "yojson": ["1.7.0"] } opam = OpamConfig( version = "2.0", builds = { "mina-0.1.0": BuildConfig( default = True, switch = "4.07.1", compiler = "4.07.1", packages = opam_pkg, verify = True ), "4.07.1": BuildConfig( compiler = "4.07.1", packages = opam_pkg ), } )
load('@obazl_rules_ocaml//ocaml:providers.bzl', 'OpamConfig', 'BuildConfig') opam_pkg = {'async': ['v0.12.0'], 'bignum': ['v0.12.0'], 'bin_prot': ['v0.12.0'], 'core': ['v0.12.1'], 'core_kernel': ['v0.12.3'], 'digestif': ['0.9.0'], 'fieldslib': ['v0.12.0'], 'num': ['1.1'], 'ppx_assert': ['v0.12.0', ['ppx_assert.runtime-lib']], 'ppx_bench': ['v0.12.0', ['ppx_bench.runtime-lib']], 'ppx_bin_prot': ['v0.12.1'], 'ppx_compare': ['v0.12.0', ['ppx_compare.runtime-lib']], 'ppx_custom_printf': ['v0.12.0'], 'ppx_deriving': ['4.4.1', ['ppx_deriving.enum', 'ppx_deriving.eq', 'ppx_deriving.std', 'ppx_deriving.runtime']], 'ppx_deriving_yojson': ['3.5.2', ['ppx_deriving_yojson.runtime']], 'ppx_enumerate': ['v0.12.0', ['ppx_enumerate.runtime-lib']], 'ppx_expect': ['v0.12.0', ['ppx_expect.collector']], 'ppx_fields_conv': ['v0.12.0'], 'ppx_hash': ['v0.12.0', ['ppx_hash.runtime-lib']], 'ppx_inline_test': ['v0.12.0', ['ppx_inline_test.runtime-lib']], 'ppx_jane': ['v0.12.0'], 'ppx_let': ['v0.12.0'], 'ppx_module_timer': ['v0.12.0', ['ppx_module_timer.runtime']], 'ppx_sexp_conv': ['v0.12.0', ['ppx_sexp_conv.runtime-lib']], 'ppx_tools': ['5.1+4.06.0'], 'ppxlib': ['0.8.1', ['ppxlib.metaquot']], 'yojson': ['1.7.0']} opam = opam_config(version='2.0', builds={'mina-0.1.0': build_config(default=True, switch='4.07.1', compiler='4.07.1', packages=opam_pkg, verify=True), '4.07.1': build_config(compiler='4.07.1', packages=opam_pkg)})
keyFinancialIncomeStatement = [ # Valuation Measures "Revenue", "Total Revenue", "Cost of Revenue", ]
key_financial_income_statement = ['Revenue', 'Total Revenue', 'Cost of Revenue']
def wordInTarget(word, target): ''' Can a 'word', be made using letters from 'target'. ''' targetlist = list(target) i = 0 while i < len(word): letter = word[i] if letter in targetlist: targetlist.remove(letter) i += 1 else: return False return True
def word_in_target(word, target): """ Can a 'word', be made using letters from 'target'. """ targetlist = list(target) i = 0 while i < len(word): letter = word[i] if letter in targetlist: targetlist.remove(letter) i += 1 else: return False return True
N = int(input()) first_word = input() W = [input() for _ in range(N - 1)] last = first_word[-1] word_set = set([first_word]) for w in W: if w[0] != last or w in word_set: print("No") break word_set.add(w) last = w[-1] else: print("Yes")
n = int(input()) first_word = input() w = [input() for _ in range(N - 1)] last = first_word[-1] word_set = set([first_word]) for w in W: if w[0] != last or w in word_set: print('No') break word_set.add(w) last = w[-1] else: print('Yes')
''' este grupo de numeros tiene un bucle, digamos que hacemos el algoritmo para "x" numero la sucesion comenzara con (2, 2x, 2, ... , 2, 2x, 2, ...) donde ... es un bucle entonces cuando 2x aparezca por segunda vez cortamos alli la sucesion y sacamos el maximo ''' def algoritmo(a): lista = [] i = 0 cont = 0 xam = 0 n = 0 while(True): r = ((a - 1) ** n + (a + 1) ** n ) % (a ** 2) lista.append(r) i += 1 n += 1 if r == 2 * a: cont += 1 if cont == 2: lista = lista[0: i - 2] xam = max(lista) break return(xam) total = 0 for a in range(3, 1000 + 1): total += algoritmo(a) print(total)
""" este grupo de numeros tiene un bucle, digamos que hacemos el algoritmo para "x" numero la sucesion comenzara con (2, 2x, 2, ... , 2, 2x, 2, ...) donde ... es un bucle entonces cuando 2x aparezca por segunda vez cortamos alli la sucesion y sacamos el maximo """ def algoritmo(a): lista = [] i = 0 cont = 0 xam = 0 n = 0 while True: r = ((a - 1) ** n + (a + 1) ** n) % a ** 2 lista.append(r) i += 1 n += 1 if r == 2 * a: cont += 1 if cont == 2: lista = lista[0:i - 2] xam = max(lista) break return xam total = 0 for a in range(3, 1000 + 1): total += algoritmo(a) print(total)
'''> Greater that - True if left operand is greater than the right x > y < Less that - True if left operand is less than the right x < y == Equal to - True if both operands are equal x == y != Not equal to - True if operands are not equal x != y >= Greater than or equal to - True if left operand is greater than or equal to the right x >= y <= Less than or equal to - True if left operand is less than or equal to the right x <= y''' x = 10 y = 12 # Output: x > y is False print('x > y is',x>y) # Output: x < y is True print('x < y is',x<y) # Output: x == y is False print('x == y is',x==y) # Output: x != y is True print('x != y is',x!=y) # Output: x >= y is False print('x >= y is',x>=y) # Output: x <= y is True print('x <= y is',x<=y)
"""> Greater that - True if left operand is greater than the right x > y < Less that - True if left operand is less than the right x < y == Equal to - True if both operands are equal x == y != Not equal to - True if operands are not equal x != y >= Greater than or equal to - True if left operand is greater than or equal to the right x >= y <= Less than or equal to - True if left operand is less than or equal to the right x <= y""" x = 10 y = 12 print('x > y is', x > y) print('x < y is', x < y) print('x == y is', x == y) print('x != y is', x != y) print('x >= y is', x >= y) print('x <= y is', x <= y)
expected_output = { "vrf": { "default": { "address_family": { "ipv4": { "instance": { "65109": { "areas": { "0.0.0.8": { "database": { "lsa_types": { 1: { "lsa_type": 1, "lsas": { "192.168.165.220": { "adv_router": "192.168.165.220", "lsa_id": "192.168.165.220", "ospfv2": { "header": { "adv_router": "192.168.165.220", "age": 113, "checksum": "0x007C93", "link_count": 2, "lsa_id": "192.168.165.220", "seq_num": "0x800006E3", } }, }, "192.168.255.0": { "adv_router": "192.168.255.0", "lsa_id": "192.168.255.0", "ospfv2": { "header": { "adv_router": "192.168.255.0", "age": 1407, "checksum": "0x00ADD6", "link_count": 501, "lsa_id": "192.168.255.0", "seq_num": "0x800007BC", } }, }, "10.22.102.64": { "adv_router": "10.22.102.64", "lsa_id": "10.22.102.64", "ospfv2": { "header": { "adv_router": "10.22.102.64", "age": 2220, "checksum": "0x008BD8", "link_count": 3, "lsa_id": "10.22.102.64", "seq_num": "0x800003EC", } }, }, "172.31.197.252": { "adv_router": "172.31.197.252", "lsa_id": "172.31.197.252", "ospfv2": { "header": { "adv_router": "172.31.197.252", "age": 1272, "checksum": "0x00B9E5", "link_count": 6, "lsa_id": "172.31.197.252", "seq_num": "0x80000DBD", } }, }, "172.31.197.253": { "adv_router": "172.31.197.253", "lsa_id": "172.31.197.253", "ospfv2": { "header": { "adv_router": "172.31.197.253", "age": 663, "checksum": "0x00FFD8", "link_count": 4, "lsa_id": "172.31.197.253", "seq_num": "0x8000009D", } }, }, "172.31.197.254": { "adv_router": "172.31.197.254", "lsa_id": "172.31.197.254", "ospfv2": { "header": { "adv_router": "172.31.197.254", "age": 1900, "checksum": "0x00D029", "link_count": 3, "lsa_id": "172.31.197.254", "seq_num": "0x800000D9", } }, }, }, }, 2: { "lsa_type": 2, "lsas": { "192.168.255.0": { "adv_router": "172.31.197.252", "lsa_id": "192.168.255.0", "ospfv2": { "header": { "adv_router": "172.31.197.252", "age": 26, "checksum": "0x009E8D", "lsa_id": "192.168.255.0", "seq_num": "0x800000D1", } }, }, "10.22.102.50": { "adv_router": "10.22.102.64", "lsa_id": "10.22.102.50", "ospfv2": { "header": { "adv_router": "10.22.102.64", "age": 220, "checksum": "0x003A0A", "lsa_id": "10.22.102.50", "seq_num": "0x800000AD", } }, }, "10.22.102.58": { "adv_router": "10.22.102.64", "lsa_id": "10.22.102.58", "ospfv2": { "header": { "adv_router": "10.22.102.64", "age": 1220, "checksum": "0x00E2CD", "lsa_id": "10.22.102.58", "seq_num": "0x80000038", } }, }, "172.31.197.102": { "adv_router": "192.168.165.220", "lsa_id": "172.31.197.102", "ospfv2": { "header": { "adv_router": "192.168.165.220", "age": 113, "checksum": "0x009ACA", "lsa_id": "172.31.197.102", "seq_num": "0x80000055", } }, }, "172.31.197.94": { "adv_router": "172.31.197.254", "lsa_id": "172.31.197.94", "ospfv2": { "header": { "adv_router": "172.31.197.254", "age": 911, "checksum": "0x007ACC", "lsa_id": "172.31.197.94", "seq_num": "0x80000052", } }, }, "172.31.197.97": { "adv_router": "172.31.197.253", "lsa_id": "172.31.197.97", "ospfv2": { "header": { "adv_router": "172.31.197.253", "age": 663, "checksum": "0x00AAB4", "lsa_id": "172.31.197.97", "seq_num": "0x80000037", } }, }, }, }, 3: { "lsa_type": 3, "lsas": { "192.168.165.119": { "adv_router": "172.31.197.252", "lsa_id": "192.168.165.119", "ospfv2": { "header": { "adv_router": "172.31.197.252", "age": 1030, "checksum": "0x007847", "lsa_id": "192.168.165.119", "seq_num": "0x800000D4", } }, }, "192.168.165.120": { "adv_router": "172.31.197.252", "lsa_id": "192.168.165.120", "ospfv2": { "header": { "adv_router": "172.31.197.252", "age": 26, "checksum": "0x005160", "lsa_id": "192.168.165.120", "seq_num": "0x800003DE", } }, }, "192.168.165.48": { "adv_router": "172.31.197.252", "lsa_id": "192.168.165.48", "ospfv2": { "header": { "adv_router": "172.31.197.252", "age": 26, "checksum": "0x0006F6", "lsa_id": "192.168.165.48", "seq_num": "0x800003DF", } }, }, "192.168.165.56": { "adv_router": "172.31.197.252", "lsa_id": "192.168.165.56", "ospfv2": { "header": { "adv_router": "172.31.197.252", "age": 1779, "checksum": "0x00D42E", "lsa_id": "192.168.165.56", "seq_num": "0x800000D4", } }, }, }, }, 4: { "lsa_type": 4, "lsas": { "192.168.165.119": { "adv_router": "172.31.197.252", "lsa_id": "192.168.165.119", "ospfv2": { "header": { "adv_router": "172.31.197.252", "age": 1030, "checksum": "0x00605F", "lsa_id": "192.168.165.119", "seq_num": "0x800000D4", } }, }, "192.168.165.120": { "adv_router": "172.31.197.252", "lsa_id": "192.168.165.120", "ospfv2": { "header": { "adv_router": "172.31.197.252", "age": 26, "checksum": "0x003978", "lsa_id": "192.168.165.120", "seq_num": "0x800003DE", } }, }, }, }, } } } } } } } } } } }
expected_output = {'vrf': {'default': {'address_family': {'ipv4': {'instance': {'65109': {'areas': {'0.0.0.8': {'database': {'lsa_types': {1: {'lsa_type': 1, 'lsas': {'192.168.165.220': {'adv_router': '192.168.165.220', 'lsa_id': '192.168.165.220', 'ospfv2': {'header': {'adv_router': '192.168.165.220', 'age': 113, 'checksum': '0x007C93', 'link_count': 2, 'lsa_id': '192.168.165.220', 'seq_num': '0x800006E3'}}}, '192.168.255.0': {'adv_router': '192.168.255.0', 'lsa_id': '192.168.255.0', 'ospfv2': {'header': {'adv_router': '192.168.255.0', 'age': 1407, 'checksum': '0x00ADD6', 'link_count': 501, 'lsa_id': '192.168.255.0', 'seq_num': '0x800007BC'}}}, '10.22.102.64': {'adv_router': '10.22.102.64', 'lsa_id': '10.22.102.64', 'ospfv2': {'header': {'adv_router': '10.22.102.64', 'age': 2220, 'checksum': '0x008BD8', 'link_count': 3, 'lsa_id': '10.22.102.64', 'seq_num': '0x800003EC'}}}, '172.31.197.252': {'adv_router': '172.31.197.252', 'lsa_id': '172.31.197.252', 'ospfv2': {'header': {'adv_router': '172.31.197.252', 'age': 1272, 'checksum': '0x00B9E5', 'link_count': 6, 'lsa_id': '172.31.197.252', 'seq_num': '0x80000DBD'}}}, '172.31.197.253': {'adv_router': '172.31.197.253', 'lsa_id': '172.31.197.253', 'ospfv2': {'header': {'adv_router': '172.31.197.253', 'age': 663, 'checksum': '0x00FFD8', 'link_count': 4, 'lsa_id': '172.31.197.253', 'seq_num': '0x8000009D'}}}, '172.31.197.254': {'adv_router': '172.31.197.254', 'lsa_id': '172.31.197.254', 'ospfv2': {'header': {'adv_router': '172.31.197.254', 'age': 1900, 'checksum': '0x00D029', 'link_count': 3, 'lsa_id': '172.31.197.254', 'seq_num': '0x800000D9'}}}}}, 2: {'lsa_type': 2, 'lsas': {'192.168.255.0': {'adv_router': '172.31.197.252', 'lsa_id': '192.168.255.0', 'ospfv2': {'header': {'adv_router': '172.31.197.252', 'age': 26, 'checksum': '0x009E8D', 'lsa_id': '192.168.255.0', 'seq_num': '0x800000D1'}}}, '10.22.102.50': {'adv_router': '10.22.102.64', 'lsa_id': '10.22.102.50', 'ospfv2': {'header': {'adv_router': '10.22.102.64', 'age': 220, 'checksum': '0x003A0A', 'lsa_id': '10.22.102.50', 'seq_num': '0x800000AD'}}}, '10.22.102.58': {'adv_router': '10.22.102.64', 'lsa_id': '10.22.102.58', 'ospfv2': {'header': {'adv_router': '10.22.102.64', 'age': 1220, 'checksum': '0x00E2CD', 'lsa_id': '10.22.102.58', 'seq_num': '0x80000038'}}}, '172.31.197.102': {'adv_router': '192.168.165.220', 'lsa_id': '172.31.197.102', 'ospfv2': {'header': {'adv_router': '192.168.165.220', 'age': 113, 'checksum': '0x009ACA', 'lsa_id': '172.31.197.102', 'seq_num': '0x80000055'}}}, '172.31.197.94': {'adv_router': '172.31.197.254', 'lsa_id': '172.31.197.94', 'ospfv2': {'header': {'adv_router': '172.31.197.254', 'age': 911, 'checksum': '0x007ACC', 'lsa_id': '172.31.197.94', 'seq_num': '0x80000052'}}}, '172.31.197.97': {'adv_router': '172.31.197.253', 'lsa_id': '172.31.197.97', 'ospfv2': {'header': {'adv_router': '172.31.197.253', 'age': 663, 'checksum': '0x00AAB4', 'lsa_id': '172.31.197.97', 'seq_num': '0x80000037'}}}}}, 3: {'lsa_type': 3, 'lsas': {'192.168.165.119': {'adv_router': '172.31.197.252', 'lsa_id': '192.168.165.119', 'ospfv2': {'header': {'adv_router': '172.31.197.252', 'age': 1030, 'checksum': '0x007847', 'lsa_id': '192.168.165.119', 'seq_num': '0x800000D4'}}}, '192.168.165.120': {'adv_router': '172.31.197.252', 'lsa_id': '192.168.165.120', 'ospfv2': {'header': {'adv_router': '172.31.197.252', 'age': 26, 'checksum': '0x005160', 'lsa_id': '192.168.165.120', 'seq_num': '0x800003DE'}}}, '192.168.165.48': {'adv_router': '172.31.197.252', 'lsa_id': '192.168.165.48', 'ospfv2': {'header': {'adv_router': '172.31.197.252', 'age': 26, 'checksum': '0x0006F6', 'lsa_id': '192.168.165.48', 'seq_num': '0x800003DF'}}}, '192.168.165.56': {'adv_router': '172.31.197.252', 'lsa_id': '192.168.165.56', 'ospfv2': {'header': {'adv_router': '172.31.197.252', 'age': 1779, 'checksum': '0x00D42E', 'lsa_id': '192.168.165.56', 'seq_num': '0x800000D4'}}}}}, 4: {'lsa_type': 4, 'lsas': {'192.168.165.119': {'adv_router': '172.31.197.252', 'lsa_id': '192.168.165.119', 'ospfv2': {'header': {'adv_router': '172.31.197.252', 'age': 1030, 'checksum': '0x00605F', 'lsa_id': '192.168.165.119', 'seq_num': '0x800000D4'}}}, '192.168.165.120': {'adv_router': '172.31.197.252', 'lsa_id': '192.168.165.120', 'ospfv2': {'header': {'adv_router': '172.31.197.252', 'age': 26, 'checksum': '0x003978', 'lsa_id': '192.168.165.120', 'seq_num': '0x800003DE'}}}}}}}}}}}}}}}}
{ "variables": { "major_version": "<!(node -pe 'v=process.versions.node.split(\".\"); v[0];')", "minor_version": "<!(node -pe 'v=process.versions.node.split(\".\"); v[1];')", "micro_version": "<!(node -pe 'v=process.versions.node.split(\".\"); v[2];')" }, "targets": [ { "target_name": "poppler", "sources": [ "src/poppler.cc", "src/NodePopplerDocument.cc", "src/NodePopplerPage.cc", "src/iconv_string.cc", "src/MemoryStream.cc" ], "libraries": [ "<!@(pkg-config --libs poppler)" ], "cflags": [ "<!@(pkg-config --cflags poppler)" ], "defines": [ "NODE_VERSION_MAJOR=<(major_version)", "NODE_VERSION_MINOR=<(minor_version)", "NODE_VERSION_MICRO=<(micro_version)" ], "conditions": [ ['OS=="mac"', { 'xcode_settings': { 'OTHER_CFLAGS': [ "<!@(pkg-config --cflags poppler)", "<!@(dirname -- `pkg-config --cflags poppler`)", "-stdlib=libc++" ], "OTHER_LDFLAGS": [ "-liconv" ] }, }], ['OS!="win"', { 'cflags_cc+': [ '-std=c++14', ], }], ], "include_dirs": [ "<!(node -e \"require('nan')\")" ] } ] }
{'variables': {'major_version': '<!(node -pe \'v=process.versions.node.split("."); v[0];\')', 'minor_version': '<!(node -pe \'v=process.versions.node.split("."); v[1];\')', 'micro_version': '<!(node -pe \'v=process.versions.node.split("."); v[2];\')'}, 'targets': [{'target_name': 'poppler', 'sources': ['src/poppler.cc', 'src/NodePopplerDocument.cc', 'src/NodePopplerPage.cc', 'src/iconv_string.cc', 'src/MemoryStream.cc'], 'libraries': ['<!@(pkg-config --libs poppler)'], 'cflags': ['<!@(pkg-config --cflags poppler)'], 'defines': ['NODE_VERSION_MAJOR=<(major_version)', 'NODE_VERSION_MINOR=<(minor_version)', 'NODE_VERSION_MICRO=<(micro_version)'], 'conditions': [['OS=="mac"', {'xcode_settings': {'OTHER_CFLAGS': ['<!@(pkg-config --cflags poppler)', '<!@(dirname -- `pkg-config --cflags poppler`)', '-stdlib=libc++'], 'OTHER_LDFLAGS': ['-liconv']}}], ['OS!="win"', {'cflags_cc+': ['-std=c++14']}]], 'include_dirs': ['<!(node -e "require(\'nan\')")']}]}
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def levelOrder(self, root: TreeNode): if not root: return [] parents = [root] res = [] while parents: cur_values = [] next_nodes = [] for node in parents: cur_values.append(node.val) if node.left: next_nodes.append(node.left) if node.right: next_nodes.append(node.right) parents = next_nodes res.append(cur_values) return res l1 = TreeNode(5) l1.left = TreeNode(1) l1.left.left = TreeNode(4) l1.right = TreeNode(2) l1.right.right = TreeNode(3) slu = Solution() print(slu.levelOrder(l1))
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def level_order(self, root: TreeNode): if not root: return [] parents = [root] res = [] while parents: cur_values = [] next_nodes = [] for node in parents: cur_values.append(node.val) if node.left: next_nodes.append(node.left) if node.right: next_nodes.append(node.right) parents = next_nodes res.append(cur_values) return res l1 = tree_node(5) l1.left = tree_node(1) l1.left.left = tree_node(4) l1.right = tree_node(2) l1.right.right = tree_node(3) slu = solution() print(slu.levelOrder(l1))
def get_stats(data, country_list=None): country_list = list(country_list) country_list_slugs = [] country_list_codes = [] error_lst = [] cases = [] new_cases = [] deaths = [] new_deaths = [] recovered = [] new_recovered = [] names = [] codes = [] stats = [] if not country_list: cases.append(data["Global"]["TotalConfirmed"]) new_cases.append(data["Global"]["NewConfirmed"]) deaths.append(data["Global"]["TotalDeaths"]) new_deaths.append(data["Global"]["NewDeaths"]) recovered.append(data["Global"]["TotalRecovered"]) new_recovered.append(data["Global"]["NewRecovered"]) stats.append(cases) stats.append(deaths) stats.append(recovered) if new_cases != 0: cases = f'**{format(int(cases[0]), ",d")}**' + " (+" + format(int(new_cases[0]), ",d") + ")" if new_deaths != 0: deaths = f'**{format(int(deaths[0]), ",d")}**' + " (+" + format(int(new_deaths[0]), ",d") + ")" if new_recovered != 0: recovered = f'**{format(int(recovered[0]), ",d")}**' + " (+" + format(int(new_recovered[0]), ",d") + ")" else: for i in range(0, len(country_list)): if len(country_list[i]) > 2: country_list[i] = country_list[i].lower() else: country_list[i] = country_list[i].upper() country_list = ["GB" if x == "UK" else x for x in country_list] country_list = ["korea-south" if x == "south-korea" else x for x in country_list] country_list = ["korea-south" if x == "korea" else x for x in country_list] country_list = ["korea-north" if x == "north-korea" else x for x in country_list] country_list = ["US" if x == "usa" else x for x in country_list] country_list = ["US" if x == "united-states-of-america" else x for x in country_list] slug = list(filter(lambda change_name: change_name["Slug"] in country_list, data["Countries"])) for i in range(0, len(slug)): country_list_codes.append(slug[i]["CountryCode"]) country_list_slugs.append(slug[i]["Slug"]) code = list(filter(lambda change_name: change_name["CountryCode"] in country_list, data["Countries"])) for i in range(0, len(code)): country_list_codes.append(code[i]["CountryCode"]) country_list_slugs.append(code[i]["Slug"]) for i in range(0, len(country_list)): if str.upper(country_list[i]) not in country_list_codes and str.lower(country_list[i]) not in country_list_slugs: error_lst.append(country_list[i]) for i in range(0, len(error_lst)): country_list.remove(error_lst[i]) new_lst = slug + code lst = sorted(new_lst, key=lambda item_num: item_num["Country"]) for i in range(0, len(lst)): cases.append(lst[i]["TotalConfirmed"]) new_cases.append(lst[i]["NewConfirmed"]) deaths.append(lst[i]["TotalDeaths"]) new_deaths.append(lst[i]["NewDeaths"]) recovered.append(lst[i]["TotalRecovered"]) new_recovered.append(lst[i]["NewRecovered"]) names.append(lst[i]["Country"]) codes.append(lst[i]["CountryCode"]) stats.append(lst[i]["TotalConfirmed"]) stats.append(lst[i]["TotalDeaths"]) stats.append(lst[i]["TotalRecovered"]) if new_cases[i] != 0: cases[i] = f'**{format(int(cases[i]), ",d")}**' + " (+" + format(int(new_cases[i]), ",d") + ")" else: cases[i] = f'**{format(int(cases[i]), ",d")}**' if new_deaths[i] != 0: deaths[i] = f'**{format(int(deaths[i]), ",d")}**' + " (+" + format(int(new_deaths[i]), ",d") + ")" else: deaths[i] = f'**{format(int(deaths[i]), ",d")}**' if new_recovered[i] != 0: recovered[i] = f'**{format(int(recovered[i]), ",d")}**' + " (+" + format(int(new_recovered[i]), ",d") + ")" else: recovered[i] = f'**{format(int(recovered[i]), ",d")}**' return cases, deaths, recovered, names, codes, error_lst, stats
def get_stats(data, country_list=None): country_list = list(country_list) country_list_slugs = [] country_list_codes = [] error_lst = [] cases = [] new_cases = [] deaths = [] new_deaths = [] recovered = [] new_recovered = [] names = [] codes = [] stats = [] if not country_list: cases.append(data['Global']['TotalConfirmed']) new_cases.append(data['Global']['NewConfirmed']) deaths.append(data['Global']['TotalDeaths']) new_deaths.append(data['Global']['NewDeaths']) recovered.append(data['Global']['TotalRecovered']) new_recovered.append(data['Global']['NewRecovered']) stats.append(cases) stats.append(deaths) stats.append(recovered) if new_cases != 0: cases = f"**{format(int(cases[0]), ',d')}**" + ' (+' + format(int(new_cases[0]), ',d') + ')' if new_deaths != 0: deaths = f"**{format(int(deaths[0]), ',d')}**" + ' (+' + format(int(new_deaths[0]), ',d') + ')' if new_recovered != 0: recovered = f"**{format(int(recovered[0]), ',d')}**" + ' (+' + format(int(new_recovered[0]), ',d') + ')' else: for i in range(0, len(country_list)): if len(country_list[i]) > 2: country_list[i] = country_list[i].lower() else: country_list[i] = country_list[i].upper() country_list = ['GB' if x == 'UK' else x for x in country_list] country_list = ['korea-south' if x == 'south-korea' else x for x in country_list] country_list = ['korea-south' if x == 'korea' else x for x in country_list] country_list = ['korea-north' if x == 'north-korea' else x for x in country_list] country_list = ['US' if x == 'usa' else x for x in country_list] country_list = ['US' if x == 'united-states-of-america' else x for x in country_list] slug = list(filter(lambda change_name: change_name['Slug'] in country_list, data['Countries'])) for i in range(0, len(slug)): country_list_codes.append(slug[i]['CountryCode']) country_list_slugs.append(slug[i]['Slug']) code = list(filter(lambda change_name: change_name['CountryCode'] in country_list, data['Countries'])) for i in range(0, len(code)): country_list_codes.append(code[i]['CountryCode']) country_list_slugs.append(code[i]['Slug']) for i in range(0, len(country_list)): if str.upper(country_list[i]) not in country_list_codes and str.lower(country_list[i]) not in country_list_slugs: error_lst.append(country_list[i]) for i in range(0, len(error_lst)): country_list.remove(error_lst[i]) new_lst = slug + code lst = sorted(new_lst, key=lambda item_num: item_num['Country']) for i in range(0, len(lst)): cases.append(lst[i]['TotalConfirmed']) new_cases.append(lst[i]['NewConfirmed']) deaths.append(lst[i]['TotalDeaths']) new_deaths.append(lst[i]['NewDeaths']) recovered.append(lst[i]['TotalRecovered']) new_recovered.append(lst[i]['NewRecovered']) names.append(lst[i]['Country']) codes.append(lst[i]['CountryCode']) stats.append(lst[i]['TotalConfirmed']) stats.append(lst[i]['TotalDeaths']) stats.append(lst[i]['TotalRecovered']) if new_cases[i] != 0: cases[i] = f"**{format(int(cases[i]), ',d')}**" + ' (+' + format(int(new_cases[i]), ',d') + ')' else: cases[i] = f"**{format(int(cases[i]), ',d')}**" if new_deaths[i] != 0: deaths[i] = f"**{format(int(deaths[i]), ',d')}**" + ' (+' + format(int(new_deaths[i]), ',d') + ')' else: deaths[i] = f"**{format(int(deaths[i]), ',d')}**" if new_recovered[i] != 0: recovered[i] = f"**{format(int(recovered[i]), ',d')}**" + ' (+' + format(int(new_recovered[i]), ',d') + ')' else: recovered[i] = f"**{format(int(recovered[i]), ',d')}**" return (cases, deaths, recovered, names, codes, error_lst, stats)
class Platform: def set_nonblocking(self, read_fd): raise NotImplementedError( "Non-blocking capture not impelemented on this platform" ) def apply_workarounds(self): pass
class Platform: def set_nonblocking(self, read_fd): raise not_implemented_error('Non-blocking capture not impelemented on this platform') def apply_workarounds(self): pass
#request class DmRequest(object): __slots__ = ['gatewayobj'] def __init__(self, gatewayobj): self.gatewayobj = gatewayobj def DMchannel(self, channel_id): self.gatewayobj.send({'op':self.gatewayobj.OPCODE.DM_UPDATE,'d':{'channel_id':channel_id}})
class Dmrequest(object): __slots__ = ['gatewayobj'] def __init__(self, gatewayobj): self.gatewayobj = gatewayobj def d_mchannel(self, channel_id): self.gatewayobj.send({'op': self.gatewayobj.OPCODE.DM_UPDATE, 'd': {'channel_id': channel_id}})
numbers = [] # Going up first (1st digit cannot be 0) for digit1 in range(1, 10): for digit2 in range(0, 10): for digit3 in range(0, 10): if digit2 > digit1 and digit3 < digit2: numbers.append(str(digit1) + str(digit2) + str(digit3)) # Going down first for digit1 in range(1, 10): for digit2 in range(0, 10): for digit3 in range(0, 10): if digit2 < digit1 and digit3 > digit2: numbers.append(str(digit1) + str(digit2) + str(digit3)) satisfyCount = 0 for n in numbers: if n[1] == "6": print(n) satisfyCount += 1 print(f"{satisfyCount} numbers satisfy criteria")
numbers = [] for digit1 in range(1, 10): for digit2 in range(0, 10): for digit3 in range(0, 10): if digit2 > digit1 and digit3 < digit2: numbers.append(str(digit1) + str(digit2) + str(digit3)) for digit1 in range(1, 10): for digit2 in range(0, 10): for digit3 in range(0, 10): if digit2 < digit1 and digit3 > digit2: numbers.append(str(digit1) + str(digit2) + str(digit3)) satisfy_count = 0 for n in numbers: if n[1] == '6': print(n) satisfy_count += 1 print(f'{satisfyCount} numbers satisfy criteria')
def MeasureTime( v, t ): sT = time.process_time( ) leer_matriz(v, t) triangulo_superior(v, t) eT = time.process_time( ) return float( eT - sT ) def leer_matriz(v, t): for i in range (t): for j in range (t): print ("Escriba el elemento %u de la columna %u: ", j+1, i+1) v[i][j] = input() for i in range (t): for j in range (t): printf(v[i][j]) print("\n") def triangulo_superior(v, t): x = 0 for i in range (t): for j in range (t): if (j > i): x += v[i][j] print ( "La suma es:", x ) max = 5 print ("Cuantos elementos va a tener la matriz?: (maximo 5)"); t = input() meassureTime (v, t)
def measure_time(v, t): s_t = time.process_time() leer_matriz(v, t) triangulo_superior(v, t) e_t = time.process_time() return float(eT - sT) def leer_matriz(v, t): for i in range(t): for j in range(t): print('Escriba el elemento %u de la columna %u: ', j + 1, i + 1) v[i][j] = input() for i in range(t): for j in range(t): printf(v[i][j]) print('\n') def triangulo_superior(v, t): x = 0 for i in range(t): for j in range(t): if j > i: x += v[i][j] print('La suma es:', x) max = 5 print('Cuantos elementos va a tener la matriz?: (maximo 5)') t = input() meassure_time(v, t)
a = 'In this letter I make some remarks on a general principle relevant to enciphering in general and my machine.' b = 'If qualified opinions incline to believe in the exponential conjecture, then I think we cannot afford not to make use of it.' c = 'The most direct computation would be for the enemy to try all 2^r possible keys, one by one.' d = 'The significance of this general conjecture, assuming its truth, is easy to see. It means that it may be feasible to design ciphers that are effectively unbreakable.' a = 'To consider the resistance of an enciphering process to being broken we should assume that at same times the enemy knows everything but the key being used and to break it needs only discover the key from this information.' b = 'The most direct computation would be for the enemy to try all 2^r possible keys, one by one.' c = 'An enciphering-deciphering machine (in general outline) of my invention has been sent to your organization.' d = 'We see immediately that one needs little information to begin to break down the process.' for s in (a, b, c, d): n = len(s) b = ((n + 1) // 16 + 1) * 16 + 16 # print('%3d = %2d + %2d/16' % (n, n // 16, n % 16)) print('%3d => %3d %s' % (n, b, s[:20]))
a = 'In this letter I make some remarks on a general principle relevant to enciphering in general and my machine.' b = 'If qualified opinions incline to believe in the exponential conjecture, then I think we cannot afford not to make use of it.' c = 'The most direct computation would be for the enemy to try all 2^r possible keys, one by one.' d = 'The significance of this general conjecture, assuming its truth, is easy to see. It means that it may be feasible to design ciphers that are effectively unbreakable.' a = 'To consider the resistance of an enciphering process to being broken we should assume that at same times the enemy knows everything but the key being used and to break it needs only discover the key from this information.' b = 'The most direct computation would be for the enemy to try all 2^r possible keys, one by one.' c = 'An enciphering-deciphering machine (in general outline) of my invention has been sent to your organization.' d = 'We see immediately that one needs little information to begin to break down the process.' for s in (a, b, c, d): n = len(s) b = ((n + 1) // 16 + 1) * 16 + 16 print('%3d => %3d %s' % (n, b, s[:20]))
weight=1 def run(): r.absrot(90) r.absrot(0) r.absrot(-90) r.absrot(90)
weight = 1 def run(): r.absrot(90) r.absrot(0) r.absrot(-90) r.absrot(90)
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '8/14/2020 6:00 PM' class Solution: def __init__(self): self.data = ['1', '11', '21', '1211', '111221'] def read(self, string): pre = string[0] count = 1 res = [] for val in string[1:]: if val == pre: count += 1 else: res.append(str(count)) count = 1 res.append(pre) pre = val res.append(str(count)) res.append(pre) return "".join(res) def countAndSay(self, n: int) -> str: if n <= len(self.data): return self.data[n - 1] else: for index in range(5, n): self.data.append(self.read(self.data[index - 1])) return self.data[-1] if __name__ == '__main__': res = Solution().countAndSay(6) print(res)
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '8/14/2020 6:00 PM' class Solution: def __init__(self): self.data = ['1', '11', '21', '1211', '111221'] def read(self, string): pre = string[0] count = 1 res = [] for val in string[1:]: if val == pre: count += 1 else: res.append(str(count)) count = 1 res.append(pre) pre = val res.append(str(count)) res.append(pre) return ''.join(res) def count_and_say(self, n: int) -> str: if n <= len(self.data): return self.data[n - 1] else: for index in range(5, n): self.data.append(self.read(self.data[index - 1])) return self.data[-1] if __name__ == '__main__': res = solution().countAndSay(6) print(res)
# Sorting ## Sorting with keys airports = [ ('MROC', 'San Jose, CR'), ('KLAS', 'Las Vegas, USA'), ('EDDM', 'Munich, DE'), ('LSZH', 'Zurich, CH'), ('VNLK', 'Lukla, NEP') ] sorted_airports = dict(sorted(airports, key=lambda x:x[0])) print(sorted_airports)
airports = [('MROC', 'San Jose, CR'), ('KLAS', 'Las Vegas, USA'), ('EDDM', 'Munich, DE'), ('LSZH', 'Zurich, CH'), ('VNLK', 'Lukla, NEP')] sorted_airports = dict(sorted(airports, key=lambda x: x[0])) print(sorted_airports)
# Create Trend Filter to remove linear, annual, and semi-annual trend fl_tf = skdiscovery.data_structure.table.filters.TrendFilter('TrendFilter', []) # Create stage container for the trend filter sc_tf = StageContainer(fl_tf)
fl_tf = skdiscovery.data_structure.table.filters.TrendFilter('TrendFilter', []) sc_tf = stage_container(fl_tf)
# encode categorical protocol name to number def encode_protocol(text): # put frequent cases to the front if 'tcp' in text: return 6 elif 'udp' in text: return 17 elif 'icmp' in text: return 1 elif 'hopopt' in text: return 0 elif 'igmp' in text: return 2 elif 'ggp' in text: return 3 elif 'ipv4' in text: return 4 elif 'stp' in text: return 118 elif 'st' in text: return 5 elif 'cbt' in text: return 7 elif 'egp' in text: return 8 elif 'igp' in text: return 9 elif 'bbn-rcc' in text: return 10 elif 'nvp' in text: return 11 elif 'pup' in text: return 12 elif 'argus' in text: return 13 elif 'emcon' in text: return 14 elif 'xnet' in text: return 15 elif 'chaos' in text: return 16 elif 'mux' in text: return 18 elif 'dcn' in text: return 19 elif 'hmp' in text: return 20 elif 'prm' in text: return 21 elif 'xns-idp' in text: return 22 elif 'trunk-1' in text: return 23 elif 'trunk-2' in text: return 24 elif 'leaf-1' in text: return 25 elif 'leaf-2' in text: return 26 elif 'rdp' in text: return 27 elif 'irtp' in text: return 28 elif 'iso-tp4' in text: return 29 elif 'netblt' in text: return 30 elif 'mfe-nsp' in text: return 31 elif 'merit-inp' in text: return 32 elif 'dccp' in text: return 33 elif '3pc' in text: return 34 elif 'idpr' in text: return 35 elif 'xtp' in text: return 36 elif 'ddp' in text: return 37 elif 'idpr-cmtp' in text: return 38 elif 'tp++' in text: return 39 elif 'il' in text: return 40 elif 'sdrp' in text: return 42 elif 'ipv6-route' in text: return 43 elif 'ipv6-frag' in text: return 44 elif 'idrp' in text: return 45 elif 'rsvp' in text: return 46 elif 'gre' in text: return 47 elif 'dsr' in text: return 48 elif 'bna' in text: return 49 elif 'esp' in text: return 50 elif 'ah' in text: return 51 elif 'i-nlsp' in text: return 52 elif 'swipe' in text: return 53 elif 'narp' in text: return 54 elif 'mobile' in text: return 55 elif 'tlsp' in text: return 56 elif 'skip' in text: return 57 elif 'ipv6-icmp' in text: return 58 elif 'ipv6-nonxt' in text: return 59 elif 'ipv6-opts' in text: return 60 elif 'ipv6' in text: return 41 elif 'internal' in text: return 61 elif 'cftp' in text: return 62 elif 'local' in text: return 63 elif 'sat-expak' in text: return 64 elif 'kryptolan' in text: return 65 elif 'rvd' in text: return 66 elif 'ippc' in text: return 67 elif 'distributed' in text: return 68 elif 'sat-mon' in text: return 69 elif 'visa' in text: return 70 elif 'ipcv' in text: return 71 elif 'cpnx' in text: return 72 elif 'cphb' in text: return 73 elif 'wsn' in text: return 74 elif 'pvp' in text: return 75 elif 'br-sat-mon' in text: return 76 elif 'sun-nd' in text: return 77 elif 'wb-mon' in text: return 78 elif 'wb-expak' in text: return 79 elif 'iso-ip' in text: return 80 elif 'secure-vmtp' in text: return 82 elif 'vmtp' in text: return 81 elif 'vines' in text: return 83 elif 'ttp' in text: return 84 elif 'iptm' in text: return 84 elif 'nsfnet-igp' in text: return 85 elif 'dgp' in text: return 86 elif 'tcf' in text: return 87 elif 'eigrp' in text: return 88 elif 'ospfigp' in text: return 89 elif 'sprite-rpc' in text: return 90 elif 'larp' in text: return 91 elif 'mtp' in text: return 92 elif 'ax.25' in text: return 93 elif 'ipip' in text: return 94 elif 'micp' in text: return 95 elif 'ssc-sp' in text: return 96 elif 'etherip' in text: return 97 elif 'encap' in text: return 98 elif 'private-encryp' in text: return 99 elif 'gmtp' in text: return 100 elif 'ifmp' in text: return 101 elif 'pnni' in text: return 102 elif 'pim' in text: return 103 elif 'aris' in text: return 104 elif 'scps' in text: return 105 elif 'qnx' in text: return 106 elif 'a/n' in text: return 107 elif 'ipcomp' in text: return 108 elif 'snp' in text: return 109 elif 'compaq' in text: return 110 elif 'ipx-in-ip' in text: return 111 elif 'vrrp' in text: return 112 elif 'pgm' in text: return 113 elif '0-hop' in text: return 114 elif 'l2tp' in text: return 115 elif 'ddx' in text: return 116 elif 'iatp' in text: return 117 elif 'stp' in text: return 118 elif 'srp' in text: return 119 elif 'uti' in text: return 120 elif 'smp' in text: return 121 elif 'sm' in text: return 122 elif 'ptp' in text: return 123 elif 'isis' in text: return 124 elif 'fire' in text: return 125 elif 'crtp' in text: return 126 elif 'crudp' in text: return 127 elif 'sscopmce' in text: return 128 elif 'iplt' in text: return 129 elif 'sps' in text: return 130 elif 'pipe' in text: return 131 elif 'sctp' in text: return 132 elif 'fc' in text: return 133 elif 'rsvp-e2e-ignore' in text: return 134 elif 'mobility' in text: return 135 elif 'udplite' in text: return 136 elif 'mpls-in-ip' in text: return 137 elif 'manet' in text: return 138 elif 'hip' in text: return 139 elif 'shim6' in text: return 140 elif 'wesp' in text: return 141 elif 'rohc' in text: return 142 elif 'experiment' in text: return 143 # 253 elif 'test' in text: return 144 # 254 else: return 145 # 255
def encode_protocol(text): if 'tcp' in text: return 6 elif 'udp' in text: return 17 elif 'icmp' in text: return 1 elif 'hopopt' in text: return 0 elif 'igmp' in text: return 2 elif 'ggp' in text: return 3 elif 'ipv4' in text: return 4 elif 'stp' in text: return 118 elif 'st' in text: return 5 elif 'cbt' in text: return 7 elif 'egp' in text: return 8 elif 'igp' in text: return 9 elif 'bbn-rcc' in text: return 10 elif 'nvp' in text: return 11 elif 'pup' in text: return 12 elif 'argus' in text: return 13 elif 'emcon' in text: return 14 elif 'xnet' in text: return 15 elif 'chaos' in text: return 16 elif 'mux' in text: return 18 elif 'dcn' in text: return 19 elif 'hmp' in text: return 20 elif 'prm' in text: return 21 elif 'xns-idp' in text: return 22 elif 'trunk-1' in text: return 23 elif 'trunk-2' in text: return 24 elif 'leaf-1' in text: return 25 elif 'leaf-2' in text: return 26 elif 'rdp' in text: return 27 elif 'irtp' in text: return 28 elif 'iso-tp4' in text: return 29 elif 'netblt' in text: return 30 elif 'mfe-nsp' in text: return 31 elif 'merit-inp' in text: return 32 elif 'dccp' in text: return 33 elif '3pc' in text: return 34 elif 'idpr' in text: return 35 elif 'xtp' in text: return 36 elif 'ddp' in text: return 37 elif 'idpr-cmtp' in text: return 38 elif 'tp++' in text: return 39 elif 'il' in text: return 40 elif 'sdrp' in text: return 42 elif 'ipv6-route' in text: return 43 elif 'ipv6-frag' in text: return 44 elif 'idrp' in text: return 45 elif 'rsvp' in text: return 46 elif 'gre' in text: return 47 elif 'dsr' in text: return 48 elif 'bna' in text: return 49 elif 'esp' in text: return 50 elif 'ah' in text: return 51 elif 'i-nlsp' in text: return 52 elif 'swipe' in text: return 53 elif 'narp' in text: return 54 elif 'mobile' in text: return 55 elif 'tlsp' in text: return 56 elif 'skip' in text: return 57 elif 'ipv6-icmp' in text: return 58 elif 'ipv6-nonxt' in text: return 59 elif 'ipv6-opts' in text: return 60 elif 'ipv6' in text: return 41 elif 'internal' in text: return 61 elif 'cftp' in text: return 62 elif 'local' in text: return 63 elif 'sat-expak' in text: return 64 elif 'kryptolan' in text: return 65 elif 'rvd' in text: return 66 elif 'ippc' in text: return 67 elif 'distributed' in text: return 68 elif 'sat-mon' in text: return 69 elif 'visa' in text: return 70 elif 'ipcv' in text: return 71 elif 'cpnx' in text: return 72 elif 'cphb' in text: return 73 elif 'wsn' in text: return 74 elif 'pvp' in text: return 75 elif 'br-sat-mon' in text: return 76 elif 'sun-nd' in text: return 77 elif 'wb-mon' in text: return 78 elif 'wb-expak' in text: return 79 elif 'iso-ip' in text: return 80 elif 'secure-vmtp' in text: return 82 elif 'vmtp' in text: return 81 elif 'vines' in text: return 83 elif 'ttp' in text: return 84 elif 'iptm' in text: return 84 elif 'nsfnet-igp' in text: return 85 elif 'dgp' in text: return 86 elif 'tcf' in text: return 87 elif 'eigrp' in text: return 88 elif 'ospfigp' in text: return 89 elif 'sprite-rpc' in text: return 90 elif 'larp' in text: return 91 elif 'mtp' in text: return 92 elif 'ax.25' in text: return 93 elif 'ipip' in text: return 94 elif 'micp' in text: return 95 elif 'ssc-sp' in text: return 96 elif 'etherip' in text: return 97 elif 'encap' in text: return 98 elif 'private-encryp' in text: return 99 elif 'gmtp' in text: return 100 elif 'ifmp' in text: return 101 elif 'pnni' in text: return 102 elif 'pim' in text: return 103 elif 'aris' in text: return 104 elif 'scps' in text: return 105 elif 'qnx' in text: return 106 elif 'a/n' in text: return 107 elif 'ipcomp' in text: return 108 elif 'snp' in text: return 109 elif 'compaq' in text: return 110 elif 'ipx-in-ip' in text: return 111 elif 'vrrp' in text: return 112 elif 'pgm' in text: return 113 elif '0-hop' in text: return 114 elif 'l2tp' in text: return 115 elif 'ddx' in text: return 116 elif 'iatp' in text: return 117 elif 'stp' in text: return 118 elif 'srp' in text: return 119 elif 'uti' in text: return 120 elif 'smp' in text: return 121 elif 'sm' in text: return 122 elif 'ptp' in text: return 123 elif 'isis' in text: return 124 elif 'fire' in text: return 125 elif 'crtp' in text: return 126 elif 'crudp' in text: return 127 elif 'sscopmce' in text: return 128 elif 'iplt' in text: return 129 elif 'sps' in text: return 130 elif 'pipe' in text: return 131 elif 'sctp' in text: return 132 elif 'fc' in text: return 133 elif 'rsvp-e2e-ignore' in text: return 134 elif 'mobility' in text: return 135 elif 'udplite' in text: return 136 elif 'mpls-in-ip' in text: return 137 elif 'manet' in text: return 138 elif 'hip' in text: return 139 elif 'shim6' in text: return 140 elif 'wesp' in text: return 141 elif 'rohc' in text: return 142 elif 'experiment' in text: return 143 elif 'test' in text: return 144 else: return 145
class WebServer: def __init__(): pass
class Webserver: def __init__(): pass
class super: name ="" age ="" def set_user(self,a,b): self.name = a self.age = b def show(self): print(str(self.name)) print(str(self.age)) class sub(super): def pp(self): print("Python") obj1 = sub() obj1.set_user("AungMoeKyaw","22") obj1.show() obj1.pp()
class Super: name = '' age = '' def set_user(self, a, b): self.name = a self.age = b def show(self): print(str(self.name)) print(str(self.age)) class Sub(super): def pp(self): print('Python') obj1 = sub() obj1.set_user('AungMoeKyaw', '22') obj1.show() obj1.pp()
# Python3 code to find the element that occur only once INT_SIZE = 32 def getSingle(arr, n) : result = 0 for i in range(0, INT_SIZE) : sm = 0 x = (1 << i) for j in range(0, n) : if (arr[j] & x) : sm = sm + 1 if ((sm % 3)!= 0) : result = result | x return result arr = [12, 1, 12, 3, 12, 1, 1, 2, 3, 2, 2, 3, 7] n = len(arr) print("The element with single occurrence is ", getSingle(arr, n))
int_size = 32 def get_single(arr, n): result = 0 for i in range(0, INT_SIZE): sm = 0 x = 1 << i for j in range(0, n): if arr[j] & x: sm = sm + 1 if sm % 3 != 0: result = result | x return result arr = [12, 1, 12, 3, 12, 1, 1, 2, 3, 2, 2, 3, 7] n = len(arr) print('The element with single occurrence is ', get_single(arr, n))
#!/usr/bin/env python __version__ = "3.0.0" version = __version__
__version__ = '3.0.0' version = __version__
def closest_intersections(first_wire, second_wire): least_no_of_steps = None shortest_mh_distance = None steps_taken_first = 0 point_a_first = (0, 0) for instr_first in first_wire: point_b_first, steps_to_b_first = next_point(point_a_first, instr_first) steps_taken_second = 0 point_a_second = (0, 0) for instr_second in second_wire: point_b_second, steps_to_b_second = next_point(point_a_second, instr_second) if intersection_coords := intersection((point_a_first, point_b_first), (point_a_second, point_b_second)): x, y = intersection_coords mh_distance = abs(x) + abs(y) steps = steps_taken_first + steps_taken_second + steps_to_intersection(intersection_coords, point_a_first, point_a_second) if not shortest_mh_distance or mh_distance < shortest_mh_distance: shortest_mh_distance = mh_distance if not least_no_of_steps or steps < least_no_of_steps: least_no_of_steps = steps point_a_second = point_b_second steps_taken_second += steps_to_b_second point_a_first = point_b_first steps_taken_first += steps_to_b_first return shortest_mh_distance, least_no_of_steps def next_point(point, instruction): x, y = point direction = instruction[:1] distance = int(instruction[1:]) if direction == 'U': y += distance elif direction == 'R': x += distance elif direction == 'D': y -= distance elif direction == 'L': x -= distance return (x, y), distance def intersection(line1, line2): line1_horizontal = line1[0][1] == line1[1][1] line2_horizontal = line2[0][1] == line2[1][1] if line1_horizontal == line2_horizontal: return None horizontal_line = line1 if line1_horizontal else line2 vertical_line = line1 if line2_horizontal else line2 horizontal_p1, horizontal_p2 = horizontal_line vertical_p1, vertical_p2 = vertical_line horizontal_y = horizontal_p1[1] vertical_x = vertical_p1[0] if vertical_x == 0 and horizontal_y == 0: return None horizontal_min_x = min(horizontal_p1[0], horizontal_p2[0]) horizontal_max_x = max(horizontal_p1[0], horizontal_p2[0]) vertical_min_y = min(vertical_p1[1], vertical_p2[1]) vertical_max_y = max(vertical_p1[1], vertical_p2[1]) horizontal_align = vertical_min_y <= horizontal_y <= vertical_max_y vertical_align = horizontal_min_x <= vertical_x <= horizontal_max_x return (vertical_x, horizontal_y) if vertical_align and horizontal_align else None def steps_to_intersection(intersection_coords, previous_point_first, previous_point_second): int_x, int_y = intersection_coords first_x, first_y = previous_point_first second_x, second_y = previous_point_second if first_x == int_x: return abs(abs(int_y) - abs(first_y)) + abs(abs(int_x) - abs(second_x)) else: return abs(abs(int_x) - abs(first_x)) + abs(abs(int_y) - abs(second_y))
def closest_intersections(first_wire, second_wire): least_no_of_steps = None shortest_mh_distance = None steps_taken_first = 0 point_a_first = (0, 0) for instr_first in first_wire: (point_b_first, steps_to_b_first) = next_point(point_a_first, instr_first) steps_taken_second = 0 point_a_second = (0, 0) for instr_second in second_wire: (point_b_second, steps_to_b_second) = next_point(point_a_second, instr_second) if (intersection_coords := intersection((point_a_first, point_b_first), (point_a_second, point_b_second))): (x, y) = intersection_coords mh_distance = abs(x) + abs(y) steps = steps_taken_first + steps_taken_second + steps_to_intersection(intersection_coords, point_a_first, point_a_second) if not shortest_mh_distance or mh_distance < shortest_mh_distance: shortest_mh_distance = mh_distance if not least_no_of_steps or steps < least_no_of_steps: least_no_of_steps = steps point_a_second = point_b_second steps_taken_second += steps_to_b_second point_a_first = point_b_first steps_taken_first += steps_to_b_first return (shortest_mh_distance, least_no_of_steps) def next_point(point, instruction): (x, y) = point direction = instruction[:1] distance = int(instruction[1:]) if direction == 'U': y += distance elif direction == 'R': x += distance elif direction == 'D': y -= distance elif direction == 'L': x -= distance return ((x, y), distance) def intersection(line1, line2): line1_horizontal = line1[0][1] == line1[1][1] line2_horizontal = line2[0][1] == line2[1][1] if line1_horizontal == line2_horizontal: return None horizontal_line = line1 if line1_horizontal else line2 vertical_line = line1 if line2_horizontal else line2 (horizontal_p1, horizontal_p2) = horizontal_line (vertical_p1, vertical_p2) = vertical_line horizontal_y = horizontal_p1[1] vertical_x = vertical_p1[0] if vertical_x == 0 and horizontal_y == 0: return None horizontal_min_x = min(horizontal_p1[0], horizontal_p2[0]) horizontal_max_x = max(horizontal_p1[0], horizontal_p2[0]) vertical_min_y = min(vertical_p1[1], vertical_p2[1]) vertical_max_y = max(vertical_p1[1], vertical_p2[1]) horizontal_align = vertical_min_y <= horizontal_y <= vertical_max_y vertical_align = horizontal_min_x <= vertical_x <= horizontal_max_x return (vertical_x, horizontal_y) if vertical_align and horizontal_align else None def steps_to_intersection(intersection_coords, previous_point_first, previous_point_second): (int_x, int_y) = intersection_coords (first_x, first_y) = previous_point_first (second_x, second_y) = previous_point_second if first_x == int_x: return abs(abs(int_y) - abs(first_y)) + abs(abs(int_x) - abs(second_x)) else: return abs(abs(int_x) - abs(first_x)) + abs(abs(int_y) - abs(second_y))
_COURSIER_CLI_VERSION = "2.12" _COURSIER_VERSION = "1.1.0-M9" COURSIER_CLI_SHA256 = "8e7333506bb0db2a262d747873a434a476570dd09b30b61bcbac95aff18a8a9b" COURSIER_CLI_MAVEN_PATH = "io/get-coursier/coursier-cli_{COURSIER_CLI_VERSION}/{COURSIER_VERSION}/coursier-cli_{COURSIER_CLI_VERSION}-{COURSIER_VERSION}-standalone.jar".format( COURSIER_CLI_VERSION = _COURSIER_CLI_VERSION, COURSIER_VERSION = _COURSIER_VERSION, )
_coursier_cli_version = '2.12' _coursier_version = '1.1.0-M9' coursier_cli_sha256 = '8e7333506bb0db2a262d747873a434a476570dd09b30b61bcbac95aff18a8a9b' coursier_cli_maven_path = 'io/get-coursier/coursier-cli_{COURSIER_CLI_VERSION}/{COURSIER_VERSION}/coursier-cli_{COURSIER_CLI_VERSION}-{COURSIER_VERSION}-standalone.jar'.format(COURSIER_CLI_VERSION=_COURSIER_CLI_VERSION, COURSIER_VERSION=_COURSIER_VERSION)
userinput = "" print("Before User input ", userinput) userinput = input("EnterSomething :") print("After User input ", userinput)
userinput = '' print('Before User input ', userinput) userinput = input('EnterSomething :') print('After User input ', userinput)
''' WRITTEN BY Ramon Rossi PURPOSE The prime number is position one is 2. The prime number in position two is 3. The prime number is position three is 5. This function is_prime() finds the prime number at any position. It accepts an integer as an argument which is the position of the prime number to find. It returns the prime number at that position. EXAMPLE is_prime(100) will find the prime number at position 100 - it should return 541. ''' def is_prime(position_int): # 1 is not prime, so start with 2 x = 2 prime_num_list = [] count_prime_num_position = 0 while True: if x == 2: # add 2 to prime number list prime_num_list.append(x) count_prime_num_position += 1 else: # check if x is prime by dividing by y for y in range(2, x): if x % y == 0: #print('Not prime') break if (y+1) == x: #print('Prime') prime_num_list.append(x) count_prime_num_position += 1 #print('divisor = {}'.format(y)) # if found enough prime numbers, break the loop if count_prime_num_position == position_int: break x += 1 print('Prime numbers up to position {}...'.format(position_int)) print(prime_num_list) return prime_num_list[position_int-1] # run test 1 print('Test 1'.center(40,'-')) position_int = 3 result = is_prime(position_int) print('The prime number at position {} is {}'.format(position_int, result)) if result == 5: print('Test passed\n') else: print('Test failed\n') # run test 2 print('Test 2'.center(40,'-')) position_int = 100 result = is_prime(position_int) print('The prime number at position {} is {}'.format(position_int, result)) if result == 541: print('Test passed\n') else: print('Test failed\n')
""" WRITTEN BY Ramon Rossi PURPOSE The prime number is position one is 2. The prime number in position two is 3. The prime number is position three is 5. This function is_prime() finds the prime number at any position. It accepts an integer as an argument which is the position of the prime number to find. It returns the prime number at that position. EXAMPLE is_prime(100) will find the prime number at position 100 - it should return 541. """ def is_prime(position_int): x = 2 prime_num_list = [] count_prime_num_position = 0 while True: if x == 2: prime_num_list.append(x) count_prime_num_position += 1 else: for y in range(2, x): if x % y == 0: break if y + 1 == x: prime_num_list.append(x) count_prime_num_position += 1 if count_prime_num_position == position_int: break x += 1 print('Prime numbers up to position {}...'.format(position_int)) print(prime_num_list) return prime_num_list[position_int - 1] print('Test 1'.center(40, '-')) position_int = 3 result = is_prime(position_int) print('The prime number at position {} is {}'.format(position_int, result)) if result == 5: print('Test passed\n') else: print('Test failed\n') print('Test 2'.center(40, '-')) position_int = 100 result = is_prime(position_int) print('The prime number at position {} is {}'.format(position_int, result)) if result == 541: print('Test passed\n') else: print('Test failed\n')
# -*- coding: utf-8 -*- # @Author: Anderson # @Date: 2018-10-05 01:44:18 # @Last Modified by: Anderson # @Last Modified time: 2018-11-26 11:20:20 def anagrams(strs): word_dict = {} for word in strs: sorted_word = ''.join(sorted(word)) if sorted_word not in word_dict: word_dict[sorted_word] = [word] else: word_dict[sorted_word].append(word) count = 0 for item in word_dict: if len(word_dict[item]) >= 2: count += 1 return count s = input() word_list = s.split(' ') print(anagrams(word_list))
def anagrams(strs): word_dict = {} for word in strs: sorted_word = ''.join(sorted(word)) if sorted_word not in word_dict: word_dict[sorted_word] = [word] else: word_dict[sorted_word].append(word) count = 0 for item in word_dict: if len(word_dict[item]) >= 2: count += 1 return count s = input() word_list = s.split(' ') print(anagrams(word_list))
name = input("Enter your name: ") print("Your name is", name, ".") age = int(input("Enter your age: ")) if age > 18: print(name, "is", age, "years old.") height = float(input("Enter your Height(cm):")) if height > 0: print("That's a positive size!") weight = float(input("Enter your Weight(kg):")) if weight > 0: print("That's a positive weight!") eyes = input("Eye colour:") print ("and your eye color is:"+eyes) hair = input("Hair colour:") print ("and your hair color is:"+hair)
name = input('Enter your name: ') print('Your name is', name, '.') age = int(input('Enter your age: ')) if age > 18: print(name, 'is', age, 'years old.') height = float(input('Enter your Height(cm):')) if height > 0: print("That's a positive size!") weight = float(input('Enter your Weight(kg):')) if weight > 0: print("That's a positive weight!") eyes = input('Eye colour:') print('and your eye color is:' + eyes) hair = input('Hair colour:') print('and your hair color is:' + hair)
t=int(input()) for i in range(t): n=int(input()) dp=[0 for i in range(n+1)] dp[0]=1 dp[1]=1 for i in range(2,n+1): for j in range(0,i): dp[i]+=dp[j]*dp[i-j-1] print(dp[n])
t = int(input()) for i in range(t): n = int(input()) dp = [0 for i in range(n + 1)] dp[0] = 1 dp[1] = 1 for i in range(2, n + 1): for j in range(0, i): dp[i] += dp[j] * dp[i - j - 1] print(dp[n])
# You have a red lottery ticket showing ints a, b, and c, each of which is 0, 1, or 2. # If they are all the value 2, the result is 10. # Otherwise if they are all the same, the result is 5. # Otherwise so long as both b and c are different from a, the result is 1. # Otherwise the result is 0. # Write a function that given a, b, c, returns the value of the ticket # for more info on this quiz, go to this url: http://www.programmr.com/red-lottery-ticket-3 def find_ticket_value(a, b, c): try: if a == 2 and b == 2 and c == 2: return 10 elif a == b and b == c and a == c: return 5 elif b != a and c != a: return 1 else: return 0 except TypeError: return "wrong Data Type!" if __name__ == "__main__": print(find_ticket_value(0, 2, 2))
def find_ticket_value(a, b, c): try: if a == 2 and b == 2 and (c == 2): return 10 elif a == b and b == c and (a == c): return 5 elif b != a and c != a: return 1 else: return 0 except TypeError: return 'wrong Data Type!' if __name__ == '__main__': print(find_ticket_value(0, 2, 2))
# 1 Write a Python function, which gets 2 numbers, and return True if the second number is first number divider, otherwise False. def divider(a, b): if b % a == 0: return True else: return False # 2 Write a Python function, which gets a number, and return True if that number is palindrome, otherwise False def palindrome(s): s=str(s) if s == s[::-1]: return True else: return False # 3 Write a Python function, which gets a number, and return True if that number is prime, otherwise False. def prime(x): if x <= 1: return False for i in range(2, x): if x % i == 0: return False else: return True # 4Write a Python function, which checks if a number is perfect - that is equal to the sum of its proper positive divisors. def perfect(number): l = [] for x in range(1, number): if number % x == 0: l.append(x) if number == sum(l): return True else: return False # 5Write a function, which gets 2 numbers, and return their Great common divisor - https://en.wikipedia.org/wiki/Euclidean_algorithm def gcd(number1, number2): if number1 % number2 == 0: return number2 if number2 % number1 == 0: return number1 else: x = 0 for i in range(1, number1): if number1 % i == 0 and number2 % i == 0: x = i return x def main(): print(divider(10, 5)) print(divider(10, 5)) print(palindrome(161)) print(prime(15)) print(perfect(134)) print(gcd(15, 5)) main()
def divider(a, b): if b % a == 0: return True else: return False def palindrome(s): s = str(s) if s == s[::-1]: return True else: return False def prime(x): if x <= 1: return False for i in range(2, x): if x % i == 0: return False else: return True def perfect(number): l = [] for x in range(1, number): if number % x == 0: l.append(x) if number == sum(l): return True else: return False def gcd(number1, number2): if number1 % number2 == 0: return number2 if number2 % number1 == 0: return number1 else: x = 0 for i in range(1, number1): if number1 % i == 0 and number2 % i == 0: x = i return x def main(): print(divider(10, 5)) print(divider(10, 5)) print(palindrome(161)) print(prime(15)) print(perfect(134)) print(gcd(15, 5)) main()
def get_fibonacci_huge(n): if n <= 1: return n previous = 0 current =1 sum = 1 for __ in range(2,n+1): previous,current = current, previous+current sum = sum+(current*current) # print(sum, ' ', current*current) return sum%10 if __name__ == '__main__': n = int(input()) print(get_fibonacci_huge(n))
def get_fibonacci_huge(n): if n <= 1: return n previous = 0 current = 1 sum = 1 for __ in range(2, n + 1): (previous, current) = (current, previous + current) sum = sum + current * current return sum % 10 if __name__ == '__main__': n = int(input()) print(get_fibonacci_huge(n))
class Particle(object): def __init__(self, sprite): self.gravity = PVector(0, 0.1) self.lifespan = 255 self.velocity = PVector() partSize = random(10, 60) self.part = createShape() self.part.beginShape(QUAD) self.part.noStroke() self.part.texture(sprite) self.part.normal(0, 0, 1) self.part.vertex(-partSize / 2, -partSize / 2, 0, 0) self.part.vertex(+partSize / 2, -partSize / 2, sprite.width, 0) self.part.vertex(+partSize / 2, +partSize / 2, sprite.width, sprite.height) self.part.vertex(-partSize / 2, +partSize / 2, 0, sprite.height) self.part.endShape() self.rebirth(width / 2, height / 2) self.lifespan = random(255) def getShape(self): return self.part def rebirth(self, x, y): a = random(TWO_PI) speed = random(0.5, 4) self.velocity = PVector(cos(a), sin(a)) self.velocity.mult(speed) self.lifespan = 255 self.part.resetMatrix() self.part.translate(x, y) def isDead(self): return self.lifespan < 0 def update(self): self.lifespan -= 1 self.velocity.add(self.gravity) self.part.setTint(color(255, self.lifespan)) self.part.translate(self.velocity.x, self.velocity.y)
class Particle(object): def __init__(self, sprite): self.gravity = p_vector(0, 0.1) self.lifespan = 255 self.velocity = p_vector() part_size = random(10, 60) self.part = create_shape() self.part.beginShape(QUAD) self.part.noStroke() self.part.texture(sprite) self.part.normal(0, 0, 1) self.part.vertex(-partSize / 2, -partSize / 2, 0, 0) self.part.vertex(+partSize / 2, -partSize / 2, sprite.width, 0) self.part.vertex(+partSize / 2, +partSize / 2, sprite.width, sprite.height) self.part.vertex(-partSize / 2, +partSize / 2, 0, sprite.height) self.part.endShape() self.rebirth(width / 2, height / 2) self.lifespan = random(255) def get_shape(self): return self.part def rebirth(self, x, y): a = random(TWO_PI) speed = random(0.5, 4) self.velocity = p_vector(cos(a), sin(a)) self.velocity.mult(speed) self.lifespan = 255 self.part.resetMatrix() self.part.translate(x, y) def is_dead(self): return self.lifespan < 0 def update(self): self.lifespan -= 1 self.velocity.add(self.gravity) self.part.setTint(color(255, self.lifespan)) self.part.translate(self.velocity.x, self.velocity.y)
# # PySNMP MIB module ZYXEL-OAM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-OAM-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:51:06 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") ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") EnabledStatus, = mibBuilder.importSymbols("P-BRIDGE-MIB", "EnabledStatus") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, MibIdentifier, ObjectIdentity, IpAddress, Integer32, Gauge32, ModuleIdentity, TimeTicks, Counter64, Bits, Counter32, NotificationType, iso = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "MibIdentifier", "ObjectIdentity", "IpAddress", "Integer32", "Gauge32", "ModuleIdentity", "TimeTicks", "Counter64", "Bits", "Counter32", "NotificationType", "iso") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") esMgmt, = mibBuilder.importSymbols("ZYXEL-ES-SMI", "esMgmt") zyxelOam = ModuleIdentity((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56)) if mibBuilder.loadTexts: zyxelOam.setLastUpdated('201207010000Z') if mibBuilder.loadTexts: zyxelOam.setOrganization('Enterprise Solution ZyXEL') if mibBuilder.loadTexts: zyxelOam.setContactInfo('') if mibBuilder.loadTexts: zyxelOam.setDescription('The subtree for Operations, Administration, and Maintenance (OAM)') zyxelOamSetup = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1)) zyOamState = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 1), EnabledStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyOamState.setStatus('current') if mibBuilder.loadTexts: zyOamState.setDescription('Enable/Disable administrative status on the switch.') zyxelOamPortTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2), ) if mibBuilder.loadTexts: zyxelOamPortTable.setStatus('current') if mibBuilder.loadTexts: zyxelOamPortTable.setDescription('The table contains OAM (Operations, Administration, and Maintenance) port configuration. ') zyxelOamPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: zyxelOamPortEntry.setStatus('current') if mibBuilder.loadTexts: zyxelOamPortEntry.setDescription('An entry contains OAM port configuration.') zyOamPortFunctionsSupported = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2, 1, 1), Bits().clone(namedValues=NamedValues(("unidirectionalSupport", 0), ("loopbackSupport", 1), ("eventSupport", 2), ("variableSupport", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: zyOamPortFunctionsSupported.setReference('[802.3ah], 30.3.6.1.6') if mibBuilder.loadTexts: zyOamPortFunctionsSupported.setStatus('current') if mibBuilder.loadTexts: zyOamPortFunctionsSupported.setDescription("The OAM functions supported on this Ethernet-like interface. OAM consists of separate functional sets beyond the basic discovery process that is always required. These functional groups can be supported independently by any implementation. These values are communicated to the peer via the local configuration field of Information OAMPDUs. Setting 'unidirectionalSupport(0)' indicates that the OA entity supports the transmission of OAMPDUs on links that are operating in unidirectional mode (traffic flowing in one direction only). Setting 'loopbackSupport(1)' indicates that the OAM entity can initiate and respond to loopback commands. Setting 'eventSupport(2)' indicates that the OAM entity can send and receive Event Notification OAMPDUs. Setting 'variableSupport(3)' indicates that the OAM entity can send and receive Variable Request and Response OAMPDUs. ") mibBuilder.exportSymbols("ZYXEL-OAM-MIB", zyxelOamSetup=zyxelOamSetup, zyxelOam=zyxelOam, zyOamPortFunctionsSupported=zyOamPortFunctionsSupported, zyxelOamPortTable=zyxelOamPortTable, zyxelOamPortEntry=zyxelOamPortEntry, zyOamState=zyOamState, PYSNMP_MODULE_ID=zyxelOam)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (enabled_status,) = mibBuilder.importSymbols('P-BRIDGE-MIB', 'EnabledStatus') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, mib_identifier, object_identity, ip_address, integer32, gauge32, module_identity, time_ticks, counter64, bits, counter32, notification_type, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'MibIdentifier', 'ObjectIdentity', 'IpAddress', 'Integer32', 'Gauge32', 'ModuleIdentity', 'TimeTicks', 'Counter64', 'Bits', 'Counter32', 'NotificationType', 'iso') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') (es_mgmt,) = mibBuilder.importSymbols('ZYXEL-ES-SMI', 'esMgmt') zyxel_oam = module_identity((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56)) if mibBuilder.loadTexts: zyxelOam.setLastUpdated('201207010000Z') if mibBuilder.loadTexts: zyxelOam.setOrganization('Enterprise Solution ZyXEL') if mibBuilder.loadTexts: zyxelOam.setContactInfo('') if mibBuilder.loadTexts: zyxelOam.setDescription('The subtree for Operations, Administration, and Maintenance (OAM)') zyxel_oam_setup = mib_identifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1)) zy_oam_state = mib_scalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 1), enabled_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: zyOamState.setStatus('current') if mibBuilder.loadTexts: zyOamState.setDescription('Enable/Disable administrative status on the switch.') zyxel_oam_port_table = mib_table((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2)) if mibBuilder.loadTexts: zyxelOamPortTable.setStatus('current') if mibBuilder.loadTexts: zyxelOamPortTable.setDescription('The table contains OAM (Operations, Administration, and Maintenance) port configuration. ') zyxel_oam_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: zyxelOamPortEntry.setStatus('current') if mibBuilder.loadTexts: zyxelOamPortEntry.setDescription('An entry contains OAM port configuration.') zy_oam_port_functions_supported = mib_table_column((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2, 1, 1), bits().clone(namedValues=named_values(('unidirectionalSupport', 0), ('loopbackSupport', 1), ('eventSupport', 2), ('variableSupport', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: zyOamPortFunctionsSupported.setReference('[802.3ah], 30.3.6.1.6') if mibBuilder.loadTexts: zyOamPortFunctionsSupported.setStatus('current') if mibBuilder.loadTexts: zyOamPortFunctionsSupported.setDescription("The OAM functions supported on this Ethernet-like interface. OAM consists of separate functional sets beyond the basic discovery process that is always required. These functional groups can be supported independently by any implementation. These values are communicated to the peer via the local configuration field of Information OAMPDUs. Setting 'unidirectionalSupport(0)' indicates that the OA entity supports the transmission of OAMPDUs on links that are operating in unidirectional mode (traffic flowing in one direction only). Setting 'loopbackSupport(1)' indicates that the OAM entity can initiate and respond to loopback commands. Setting 'eventSupport(2)' indicates that the OAM entity can send and receive Event Notification OAMPDUs. Setting 'variableSupport(3)' indicates that the OAM entity can send and receive Variable Request and Response OAMPDUs. ") mibBuilder.exportSymbols('ZYXEL-OAM-MIB', zyxelOamSetup=zyxelOamSetup, zyxelOam=zyxelOam, zyOamPortFunctionsSupported=zyOamPortFunctionsSupported, zyxelOamPortTable=zyxelOamPortTable, zyxelOamPortEntry=zyxelOamPortEntry, zyOamState=zyOamState, PYSNMP_MODULE_ID=zyxelOam)
def intro(task): title = f" ** {task} ** " print ("\n") print ("*" * len(title)) print (title) print ("*" * len(title)) print ("\n") intro("School") class Person: def __init__(self, firstname, lastname, age, phone, email=None): self.firstname = firstname self.lastname = lastname self.age = age self.phone = phone self.email = email if isinstance(firstname, str) == False: raise ValueError("Lirstname should be a sting") if isinstance(lastname, str) == False: raise ValueError("Lastname should be a sting") if isinstance(age, int) == False: raise ValueError("Age should be a integrer") if isinstance(phone, int) == False and phone[0-2] == 467 and len(phone) == 11: raise ValueError("Age should be a 11 figure integrer that starts with 467") if email == None: self.email = str.lower(firstname) + "." + str.lower(lastname) + "@school.se" def sinfo(self): print("Name: " + self.firstname + " " + self.lastname) print(f"Age: {self.age}") print(f"Phone: {self.phone}") print("Email: " + self.email + "\n") class Student(Person): def __init__(self, firstname, lastname, age, phone, email=None, year=1 , grade=3, status="In school"): super().__init__(firstname,lastname,age,phone,email) self.year = year self.grade = grade self.status = status def longinfo(self): print("Name: " + self.firstname + " " + self.lastname) print("Status: " + self.status) print(f"Age: {self.age}") print(f"Phone: {self.phone}") print("Email: " + self.email) print(f"Grade: {self.grade}") print(f"Year in school: {self.year}\n") class Teacher(Person): def __init__(self, firstname, lastname, age, phone, salary, hired, email=None): super().__init__(firstname,lastname,age,phone,email) self.salary = salary self.hired = hired def longinfo(self): print("Name: " + self.firstname + " " + self.lastname) print(f"Age: {self.age}") print(f"Phone: {self.phone}") print("Email: " + self.email) print(f"Salary: ${self.salary}") print(f"Hired: {self.hired}\n") kalle = Person("Carl", "Forsudd", 8, 46749658745) karin = Student("Karin", "Petersson", 7, 46778934562) kajsa = Teacher("Kajsa", "Berggren", 42, 4678945645656, 12800, 1989) kajsa.sinfo() karin.sinfo() kajsa.longinfo() karin.longinfo()
def intro(task): title = f' ** {task} ** ' print('\n') print('*' * len(title)) print(title) print('*' * len(title)) print('\n') intro('School') class Person: def __init__(self, firstname, lastname, age, phone, email=None): self.firstname = firstname self.lastname = lastname self.age = age self.phone = phone self.email = email if isinstance(firstname, str) == False: raise value_error('Lirstname should be a sting') if isinstance(lastname, str) == False: raise value_error('Lastname should be a sting') if isinstance(age, int) == False: raise value_error('Age should be a integrer') if isinstance(phone, int) == False and phone[0 - 2] == 467 and (len(phone) == 11): raise value_error('Age should be a 11 figure integrer that starts with 467') if email == None: self.email = str.lower(firstname) + '.' + str.lower(lastname) + '@school.se' def sinfo(self): print('Name: ' + self.firstname + ' ' + self.lastname) print(f'Age: {self.age}') print(f'Phone: {self.phone}') print('Email: ' + self.email + '\n') class Student(Person): def __init__(self, firstname, lastname, age, phone, email=None, year=1, grade=3, status='In school'): super().__init__(firstname, lastname, age, phone, email) self.year = year self.grade = grade self.status = status def longinfo(self): print('Name: ' + self.firstname + ' ' + self.lastname) print('Status: ' + self.status) print(f'Age: {self.age}') print(f'Phone: {self.phone}') print('Email: ' + self.email) print(f'Grade: {self.grade}') print(f'Year in school: {self.year}\n') class Teacher(Person): def __init__(self, firstname, lastname, age, phone, salary, hired, email=None): super().__init__(firstname, lastname, age, phone, email) self.salary = salary self.hired = hired def longinfo(self): print('Name: ' + self.firstname + ' ' + self.lastname) print(f'Age: {self.age}') print(f'Phone: {self.phone}') print('Email: ' + self.email) print(f'Salary: ${self.salary}') print(f'Hired: {self.hired}\n') kalle = person('Carl', 'Forsudd', 8, 46749658745) karin = student('Karin', 'Petersson', 7, 46778934562) kajsa = teacher('Kajsa', 'Berggren', 42, 4678945645656, 12800, 1989) kajsa.sinfo() karin.sinfo() kajsa.longinfo() karin.longinfo()
def foo(y): x=y return x bar = foo(7)
def foo(y): x = y return x bar = foo(7)
class Solution: def countPrimes(self, n: int) -> int: primes = [] for i in range(2, n): for prime in primes: if i % prime == 0: break else: primes.append(i) return len(primes)
class Solution: def count_primes(self, n: int) -> int: primes = [] for i in range(2, n): for prime in primes: if i % prime == 0: break else: primes.append(i) return len(primes)
#!/usr/bin/env python # -*- coding: utf-8 -*- # Used to simulate an enum with unique values class Enumeration(set): def __getattr__(self, name): if name in self: return name raise AttributeError def __setattr__(self, name, value): raise RuntimeError("Cannot override values") def __delattr__(self, name): raise RuntimeError("Cannot delete values")
class Enumeration(set): def __getattr__(self, name): if name in self: return name raise AttributeError def __setattr__(self, name, value): raise runtime_error('Cannot override values') def __delattr__(self, name): raise runtime_error('Cannot delete values')
def fib(n, c={0:1, 1:1}): if n not in c: x = n // 2 c[n] = fib(x-1) * fib(n-x-1) + fib(x) * fib(n - x) return c[n] fib(10000000) # calculating it takes a few seconds, printing it takes eons
def fib(n, c={0: 1, 1: 1}): if n not in c: x = n // 2 c[n] = fib(x - 1) * fib(n - x - 1) + fib(x) * fib(n - x) return c[n] fib(10000000)
def build_and(left, right): return {'type':'and','left':left,'right':right} def build_or(left,right): return {'type':'or','left':left,'right':right} def build_atom(atom): return {'type':'atom','atom':atom} def equal(p0,p1): if p0['type'] == p1['type']: if p1['type'] == 'atom': return p0['atom'] == p1['atom'] else: return equal(p0['left'],p1['left']) and equal(p0['right'],p1['right']) else: return False def normalize1(p): if p['type'] == 'atom': return p else: a = normalize1(p['left']) b = normalize1(p['right']) if p['type'] == 'or': if b['type'] == 'and': return build_and(build_or(a,b['left']), build_or(a,b['right'])) else: if a['type'] == 'and': return build_and(build_or(a['left'],b), build_or(a['right'],b)) else: return build_or(a,b) else: return build_and(a,b) def normalize(p): p0 = normalize1(p) while equal(p0,p) == False: p = p0 p0 = normalize1(p) return p0 def big_and(t,f): if len(t) == 1: return f(t[0]) else: return build_and(big_and(t[0:1],f),big_and(t[1:],f)) def big_or(t,f): if len(t) == 1: return f(t[0]) else: return build_or(big_or(t[0:1],f),big_or(t[1:],f)) def to_clauses(t): if t['type'] == "atom": return [[t['atom']]] if t['type'] == 'and': return to_clauses(t['left'])+to_clauses(t['right']) if t['type'] == 'or': return [to_clauses(t['left'])[0]+to_clauses(t['right'])[0]] def check_tree(tree,b): if tree['type'] == "atom": return True if tree['type'] == 'and' and b == True: return False if tree['type'] == "or": return check_tree(tree['left'],True) and check_tree(tree['right'],True) if tree['type'] == "and": return check_tree(tree['left'],b) and check_tree(tree['right'],b) def print_tree(p,acc): if p['type'] == 'atom': print(acc+p['type']+":"+str(p['atom'])) else: print(acc+p['type']) print_tree(p['left'],acc+"\t") print_tree(p['right'],acc+"\t")
def build_and(left, right): return {'type': 'and', 'left': left, 'right': right} def build_or(left, right): return {'type': 'or', 'left': left, 'right': right} def build_atom(atom): return {'type': 'atom', 'atom': atom} def equal(p0, p1): if p0['type'] == p1['type']: if p1['type'] == 'atom': return p0['atom'] == p1['atom'] else: return equal(p0['left'], p1['left']) and equal(p0['right'], p1['right']) else: return False def normalize1(p): if p['type'] == 'atom': return p else: a = normalize1(p['left']) b = normalize1(p['right']) if p['type'] == 'or': if b['type'] == 'and': return build_and(build_or(a, b['left']), build_or(a, b['right'])) elif a['type'] == 'and': return build_and(build_or(a['left'], b), build_or(a['right'], b)) else: return build_or(a, b) else: return build_and(a, b) def normalize(p): p0 = normalize1(p) while equal(p0, p) == False: p = p0 p0 = normalize1(p) return p0 def big_and(t, f): if len(t) == 1: return f(t[0]) else: return build_and(big_and(t[0:1], f), big_and(t[1:], f)) def big_or(t, f): if len(t) == 1: return f(t[0]) else: return build_or(big_or(t[0:1], f), big_or(t[1:], f)) def to_clauses(t): if t['type'] == 'atom': return [[t['atom']]] if t['type'] == 'and': return to_clauses(t['left']) + to_clauses(t['right']) if t['type'] == 'or': return [to_clauses(t['left'])[0] + to_clauses(t['right'])[0]] def check_tree(tree, b): if tree['type'] == 'atom': return True if tree['type'] == 'and' and b == True: return False if tree['type'] == 'or': return check_tree(tree['left'], True) and check_tree(tree['right'], True) if tree['type'] == 'and': return check_tree(tree['left'], b) and check_tree(tree['right'], b) def print_tree(p, acc): if p['type'] == 'atom': print(acc + p['type'] + ':' + str(p['atom'])) else: print(acc + p['type']) print_tree(p['left'], acc + '\t') print_tree(p['right'], acc + '\t')
self.con_win_size = 9 self.halfwin = con_win_size // 2 def load_data(self): for i in range(self.n_file): self.log("n." + str(i+1)) inp = np.load(os.path.join(self.data_path, os.listdir(self.data_path)[i])) full_x = np.pad(inp["imgs"], [(self.halfwin,self.halfwin), (0,0)], mode='constant') for frame_idx in range(len(inp['imgs'])): # load a context window centered around the frame index sample_x = np.swapaxes(full_x[frame_idx : frame_idx+self.con_win_size],0,1) self.training_data.append((sample_x.astype('float64'), inp['labels'][frame_idx][::-1].astype('float64')))
self.con_win_size = 9 self.halfwin = con_win_size // 2 def load_data(self): for i in range(self.n_file): self.log('n.' + str(i + 1)) inp = np.load(os.path.join(self.data_path, os.listdir(self.data_path)[i])) full_x = np.pad(inp['imgs'], [(self.halfwin, self.halfwin), (0, 0)], mode='constant') for frame_idx in range(len(inp['imgs'])): sample_x = np.swapaxes(full_x[frame_idx:frame_idx + self.con_win_size], 0, 1) self.training_data.append((sample_x.astype('float64'), inp['labels'][frame_idx][::-1].astype('float64')))
class TTRssException(Exception): pass class TTRssArgumentException(TTRssException): pass class TTRssConfigurationException(TTRssException): pass
class Ttrssexception(Exception): pass class Ttrssargumentexception(TTRssException): pass class Ttrssconfigurationexception(TTRssException): pass
lista = ('carro','moto','trator','caminhao','coracao','ovo', 'mao','paralelepipedo','borboleta','onibus','Brasil','papai') for i in lista: print(f'\nA palavra {i}, possui as vogais: ',end='') for j in i: if j.lower() in 'aeiou': print(j, end=' ')
lista = ('carro', 'moto', 'trator', 'caminhao', 'coracao', 'ovo', 'mao', 'paralelepipedo', 'borboleta', 'onibus', 'Brasil', 'papai') for i in lista: print(f'\nA palavra {i}, possui as vogais: ', end='') for j in i: if j.lower() in 'aeiou': print(j, end=' ')
def find(n,m,index,cursor): if index == m: print(" ".join(map(str,foundlist))) return else: for i in range(cursor,n+1): if findnum[i] == True: continue else: findnum[i] = True foundlist[index] = cursor = i find(n,m,index+1,cursor) findnum[i] = False n,m = map(int,input().split()) findnum = [False]*(n+1) foundlist = [0]*m find(n,m,0,1)
def find(n, m, index, cursor): if index == m: print(' '.join(map(str, foundlist))) return else: for i in range(cursor, n + 1): if findnum[i] == True: continue else: findnum[i] = True foundlist[index] = cursor = i find(n, m, index + 1, cursor) findnum[i] = False (n, m) = map(int, input().split()) findnum = [False] * (n + 1) foundlist = [0] * m find(n, m, 0, 1)
ONES = {0: '', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'} TEENS = {11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen'} TENS = {0: '', 1: 'ten', 2: 'twenty', 3: 'thirty', 4: 'forty', 5: 'fifty', 6: 'sixty', 7: 'seventy', 8: 'eighty', 9: 'ninety'} HUNDREDS = {1: 'onehundred', 2: 'twohundred', 3: 'threehundred', 4: 'fourhundred', 5: 'fivehundred', 6: 'sixhundred', 7: 'sevenhundred', 8: 'eighthundred', 9: 'ninehundred'} def solve(): words = [] # for number_as_str in (str(i) for i in range(1, 1001)): # print(number_as_str, len(number_as_str)) # if len_i == 1: # print(ONES[i]) # words += ONES[i] # elif len_i == 2: # try: # print(TEENS[i]) # words += TEENS[i] # except KeyError: # print(TENS[int(str_i[0])] + ONES[int(str_i[1])]) # words += TENS[int(str_i[0])] + ONES[int(str_i[1])] # elif len_i == 3: # try: # print(HUNDREDS[int(str_i[0])] + 'and' + TEENS[int(str_i[1:])]) # words += HUNDREDS[int(str_i[0])] + 'and' + TEENS[int(str_i[1:])] # except KeyError: # if i % 100 != 0: # print(HUNDREDS[int(str_i[0])] + 'and' + TENS[int(str_i[1])] + ONES[int(str_i[2])]) # words += HUNDREDS[int(str_i[0])] + 'and' + TENS[int(str_i[1])] + ONES[int(str_i[2])] # elif i % 100 == 0: # print(HUNDREDS[int(str_i[0])]) # words += HUNDREDS[int(str_i[0])] # elif len_i == 4: # print('onethousand') # words += 'onethousand' return len(''.join(words)) if __name__ == '__main__': print(solve())
ones = {0: '', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'} teens = {11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen'} tens = {0: '', 1: 'ten', 2: 'twenty', 3: 'thirty', 4: 'forty', 5: 'fifty', 6: 'sixty', 7: 'seventy', 8: 'eighty', 9: 'ninety'} hundreds = {1: 'onehundred', 2: 'twohundred', 3: 'threehundred', 4: 'fourhundred', 5: 'fivehundred', 6: 'sixhundred', 7: 'sevenhundred', 8: 'eighthundred', 9: 'ninehundred'} def solve(): words = [] return len(''.join(words)) if __name__ == '__main__': print(solve())
class Solution: def numDupDigitsAtMostN(self, N: int) -> int: list_n = list(map(int, str(N + 1))) res = 0 len_n = len(list_n) for i in range(1, len_n): res += 9 * self.get_cnt(9, i - 1) s = set() for i, x in enumerate(list_n): for y in range(0 if i else 1, x): if y in s: continue res += self.get_cnt(9 - i, len_n - i - 1) if x in s: break s.add(x) return N - res def get_cnt(self, m: int, n: int) -> int: if 0 == n: return 1 return self.get_cnt(m, n - 1) * (m - n + 1) if __name__ == '__main__': sol = Solution() # print(sol.numDupDigitsAtMostN(20)) print(sol.numDupDigitsAtMostN(100)) print(sol.numDupDigitsAtMostN(6718458))
class Solution: def num_dup_digits_at_most_n(self, N: int) -> int: list_n = list(map(int, str(N + 1))) res = 0 len_n = len(list_n) for i in range(1, len_n): res += 9 * self.get_cnt(9, i - 1) s = set() for (i, x) in enumerate(list_n): for y in range(0 if i else 1, x): if y in s: continue res += self.get_cnt(9 - i, len_n - i - 1) if x in s: break s.add(x) return N - res def get_cnt(self, m: int, n: int) -> int: if 0 == n: return 1 return self.get_cnt(m, n - 1) * (m - n + 1) if __name__ == '__main__': sol = solution() print(sol.numDupDigitsAtMostN(100)) print(sol.numDupDigitsAtMostN(6718458))
# # PySNMP MIB module HPN-ICF-COMMON-SYSTEM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-COMMON-SYSTEM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:37:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection") hpnicf, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicf") InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Bits, Unsigned32, TimeTicks, IpAddress, NotificationType, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, iso, Gauge32, ObjectIdentity, ModuleIdentity, Counter32, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Unsigned32", "TimeTicks", "IpAddress", "NotificationType", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "iso", "Gauge32", "ObjectIdentity", "ModuleIdentity", "Counter32", "Integer32") DisplayString, TextualConvention, DateAndTime = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "DateAndTime") hpnicfSystem = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6)) hpnicfSystem.setRevisions(('2004-06-30 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hpnicfSystem.setRevisionsDescriptions(('Initial revision of this MIB module.',)) if mibBuilder.loadTexts: hpnicfSystem.setLastUpdated('201206060000Z') if mibBuilder.loadTexts: hpnicfSystem.setOrganization('') if mibBuilder.loadTexts: hpnicfSystem.setContactInfo('') if mibBuilder.loadTexts: hpnicfSystem.setDescription('This file describes common MIB objects implemented by both Routers and Switches.') hpnicfWriteConfig = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("save", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfWriteConfig.setStatus('current') if mibBuilder.loadTexts: hpnicfWriteConfig.setDescription('Write config to router.') hpnicfStartFtpServer = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfStartFtpServer.setStatus('current') if mibBuilder.loadTexts: hpnicfStartFtpServer.setDescription('Decide whether start ftp-server.enable(1) indicates to start ftp-server; disable(2) indicates to stop ftp-server.') hpnicfReboot = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("normal", 0), ("reboot", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfReboot.setStatus('current') if mibBuilder.loadTexts: hpnicfReboot.setDescription("normal:do nothing. reboot :reboot the router. 'normal' will be returned when getting.") hpnicfSystemNotification = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8)) hpnicfWriteSuccessTrap = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 1)) if mibBuilder.loadTexts: hpnicfWriteSuccessTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfWriteSuccessTrap.setDescription('Send a trap about write success.') hpnicfWriteFailureTrap = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 2)) if mibBuilder.loadTexts: hpnicfWriteFailureTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfWriteFailureTrap.setDescription('Send a trap about write failure.') hpnicfRebootSendTrap = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 3)) if mibBuilder.loadTexts: hpnicfRebootSendTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfRebootSendTrap.setDescription("If a user restarts the device with command 'reboot', this trap will be sent two seconds before the device reboots.") hpnicfSysColdStartTrap = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 4)).setObjects(("HPN-ICF-COMMON-SYSTEM-MIB", "hpnicfSysFirstTrapTime")) if mibBuilder.loadTexts: hpnicfSysColdStartTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfSysColdStartTrap.setDescription('System cold start trap.') hpnicfSysWarmStartTrap = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 5)).setObjects(("HPN-ICF-COMMON-SYSTEM-MIB", "hpnicfSysFirstTrapTime")) if mibBuilder.loadTexts: hpnicfSysWarmStartTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfSysWarmStartTrap.setDescription('System warm start trap.') hpnicfSysLoghostUnreachableTrap = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 6)).setObjects(("HPN-ICF-COMMON-SYSTEM-MIB", "hpnicfSysLoghostIndex"), ("HPN-ICF-COMMON-SYSTEM-MIB", "hpnicfSysLoghostIpaddressType"), ("HPN-ICF-COMMON-SYSTEM-MIB", "hpnicfSysLoghostIpaddress"), ("HPN-ICF-COMMON-SYSTEM-MIB", "hpnicfSysLoghostTrapVpnName")) if mibBuilder.loadTexts: hpnicfSysLoghostUnreachableTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostUnreachableTrap.setDescription('This notification will be sent when a loghost becomes unreachable.') hpnicfSoftwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfSoftwareVersion.setStatus('current') if mibBuilder.loadTexts: hpnicfSoftwareVersion.setDescription('Software version.') hpnicfSysBootType = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("coldStart", 1), ("warmStart", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfSysBootType.setStatus('current') if mibBuilder.loadTexts: hpnicfSysBootType.setDescription('Boot type of the system, indicates whether the last device reboot was by CLI (warm start) or power off (cold start).') hpnicfSystemInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11)) hpnicfSysStatisticPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 900))).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfSysStatisticPeriod.setStatus('current') if mibBuilder.loadTexts: hpnicfSysStatisticPeriod.setDescription('Statistic period. The device collects statistics within the period.') hpnicfSysSamplePeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 300))).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfSysSamplePeriod.setStatus('current') if mibBuilder.loadTexts: hpnicfSysSamplePeriod.setDescription('Sampling period. The device takes samples periodically for statistics collection.') hpnicfSysTrapResendPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3600))).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfSysTrapResendPeriod.setStatus('current') if mibBuilder.loadTexts: hpnicfSysTrapResendPeriod.setDescription('Trap resending period. If the value is zero, the trap will not be re-sent.') hpnicfSysTrapCollectionPeriod = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 60))).setUnits('seconds').setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfSysTrapCollectionPeriod.setStatus('current') if mibBuilder.loadTexts: hpnicfSysTrapCollectionPeriod.setDescription('Trap collecting period. If the value is zero, the trap will not be re-sent.') hpnicfSysSnmpPort = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfSysSnmpPort.setStatus('current') if mibBuilder.loadTexts: hpnicfSysSnmpPort.setDescription('UDP port for SNMP protocol entity to receive messages except Trap-PDU.') hpnicfSysSnmpTrapPort = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfSysSnmpTrapPort.setStatus('current') if mibBuilder.loadTexts: hpnicfSysSnmpTrapPort.setDescription('UDP port for Trap-PDU to receive messages.') hpnicfSysNetID = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfSysNetID.setStatus('current') if mibBuilder.loadTexts: hpnicfSysNetID.setDescription('System Net ID.') hpnicfSysLastSampleTime = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 8), DateAndTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfSysLastSampleTime.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLastSampleTime.setDescription('Last sampling time of the system.') hpnicfSysTrapSendNum = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfSysTrapSendNum.setStatus('current') if mibBuilder.loadTexts: hpnicfSysTrapSendNum.setDescription('Maximum number of times for sending a trap. If the value is zero, a trap will be sent at an interval continually.') hpnicfSysFirstTrapTime = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 10), TimeTicks()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfSysFirstTrapTime.setStatus('current') if mibBuilder.loadTexts: hpnicfSysFirstTrapTime.setDescription('Time when the first trap is sent.') hpnicfSysBannerMOTD = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 2000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfSysBannerMOTD.setStatus('current') if mibBuilder.loadTexts: hpnicfSysBannerMOTD.setDescription('An administratively configured message that is displayed to the user when the user logs in to the device through the console port or Web interface.') hpnicfSystemNotificationInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12)) hpnicfSysLoghostIndex = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12, 1), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfSysLoghostIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostIndex.setDescription('Index of loghost.') hpnicfSysLoghostIpaddressType = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12, 2), InetAddressType()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfSysLoghostIpaddressType.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostIpaddressType.setDescription('IP address type of the loghost.') hpnicfSysLoghostIpaddress = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12, 3), InetAddress()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfSysLoghostIpaddress.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostIpaddress.setDescription('IP address of the loghost.') hpnicfSysLoghostTrapVpnName = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfSysLoghostTrapVpnName.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostTrapVpnName.setDescription('VPN name of the loghost.') mibBuilder.exportSymbols("HPN-ICF-COMMON-SYSTEM-MIB", hpnicfSysSamplePeriod=hpnicfSysSamplePeriod, hpnicfSysLoghostTrapVpnName=hpnicfSysLoghostTrapVpnName, hpnicfSysBootType=hpnicfSysBootType, hpnicfReboot=hpnicfReboot, hpnicfSysLoghostUnreachableTrap=hpnicfSysLoghostUnreachableTrap, hpnicfSysTrapResendPeriod=hpnicfSysTrapResendPeriod, hpnicfStartFtpServer=hpnicfStartFtpServer, hpnicfWriteConfig=hpnicfWriteConfig, hpnicfSysLoghostIndex=hpnicfSysLoghostIndex, hpnicfSysStatisticPeriod=hpnicfSysStatisticPeriod, hpnicfRebootSendTrap=hpnicfRebootSendTrap, hpnicfSysSnmpPort=hpnicfSysSnmpPort, hpnicfSysLastSampleTime=hpnicfSysLastSampleTime, hpnicfSystemInfo=hpnicfSystemInfo, hpnicfWriteSuccessTrap=hpnicfWriteSuccessTrap, hpnicfSysLoghostIpaddress=hpnicfSysLoghostIpaddress, hpnicfSysTrapCollectionPeriod=hpnicfSysTrapCollectionPeriod, hpnicfSystem=hpnicfSystem, hpnicfSysFirstTrapTime=hpnicfSysFirstTrapTime, PYSNMP_MODULE_ID=hpnicfSystem, hpnicfSysTrapSendNum=hpnicfSysTrapSendNum, hpnicfSoftwareVersion=hpnicfSoftwareVersion, hpnicfSysBannerMOTD=hpnicfSysBannerMOTD, hpnicfSystemNotification=hpnicfSystemNotification, hpnicfSysNetID=hpnicfSysNetID, hpnicfSysWarmStartTrap=hpnicfSysWarmStartTrap, hpnicfSysLoghostIpaddressType=hpnicfSysLoghostIpaddressType, hpnicfSystemNotificationInfo=hpnicfSystemNotificationInfo, hpnicfSysColdStartTrap=hpnicfSysColdStartTrap, hpnicfSysSnmpTrapPort=hpnicfSysSnmpTrapPort, hpnicfWriteFailureTrap=hpnicfWriteFailureTrap)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection') (hpnicf,) = mibBuilder.importSymbols('HPN-ICF-OID-MIB', 'hpnicf') (inet_address, inet_address_type) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddress', 'InetAddressType') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (bits, unsigned32, time_ticks, ip_address, notification_type, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, iso, gauge32, object_identity, module_identity, counter32, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'Unsigned32', 'TimeTicks', 'IpAddress', 'NotificationType', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'iso', 'Gauge32', 'ObjectIdentity', 'ModuleIdentity', 'Counter32', 'Integer32') (display_string, textual_convention, date_and_time) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention', 'DateAndTime') hpnicf_system = module_identity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6)) hpnicfSystem.setRevisions(('2004-06-30 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hpnicfSystem.setRevisionsDescriptions(('Initial revision of this MIB module.',)) if mibBuilder.loadTexts: hpnicfSystem.setLastUpdated('201206060000Z') if mibBuilder.loadTexts: hpnicfSystem.setOrganization('') if mibBuilder.loadTexts: hpnicfSystem.setContactInfo('') if mibBuilder.loadTexts: hpnicfSystem.setDescription('This file describes common MIB objects implemented by both Routers and Switches.') hpnicf_write_config = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('save', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfWriteConfig.setStatus('current') if mibBuilder.loadTexts: hpnicfWriteConfig.setDescription('Write config to router.') hpnicf_start_ftp_server = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfStartFtpServer.setStatus('current') if mibBuilder.loadTexts: hpnicfStartFtpServer.setDescription('Decide whether start ftp-server.enable(1) indicates to start ftp-server; disable(2) indicates to stop ftp-server.') hpnicf_reboot = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('normal', 0), ('reboot', 1)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfReboot.setStatus('current') if mibBuilder.loadTexts: hpnicfReboot.setDescription("normal:do nothing. reboot :reboot the router. 'normal' will be returned when getting.") hpnicf_system_notification = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8)) hpnicf_write_success_trap = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 1)) if mibBuilder.loadTexts: hpnicfWriteSuccessTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfWriteSuccessTrap.setDescription('Send a trap about write success.') hpnicf_write_failure_trap = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 2)) if mibBuilder.loadTexts: hpnicfWriteFailureTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfWriteFailureTrap.setDescription('Send a trap about write failure.') hpnicf_reboot_send_trap = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 3)) if mibBuilder.loadTexts: hpnicfRebootSendTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfRebootSendTrap.setDescription("If a user restarts the device with command 'reboot', this trap will be sent two seconds before the device reboots.") hpnicf_sys_cold_start_trap = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 4)).setObjects(('HPN-ICF-COMMON-SYSTEM-MIB', 'hpnicfSysFirstTrapTime')) if mibBuilder.loadTexts: hpnicfSysColdStartTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfSysColdStartTrap.setDescription('System cold start trap.') hpnicf_sys_warm_start_trap = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 5)).setObjects(('HPN-ICF-COMMON-SYSTEM-MIB', 'hpnicfSysFirstTrapTime')) if mibBuilder.loadTexts: hpnicfSysWarmStartTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfSysWarmStartTrap.setDescription('System warm start trap.') hpnicf_sys_loghost_unreachable_trap = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 8, 6)).setObjects(('HPN-ICF-COMMON-SYSTEM-MIB', 'hpnicfSysLoghostIndex'), ('HPN-ICF-COMMON-SYSTEM-MIB', 'hpnicfSysLoghostIpaddressType'), ('HPN-ICF-COMMON-SYSTEM-MIB', 'hpnicfSysLoghostIpaddress'), ('HPN-ICF-COMMON-SYSTEM-MIB', 'hpnicfSysLoghostTrapVpnName')) if mibBuilder.loadTexts: hpnicfSysLoghostUnreachableTrap.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostUnreachableTrap.setDescription('This notification will be sent when a loghost becomes unreachable.') hpnicf_software_version = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 9), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfSoftwareVersion.setStatus('current') if mibBuilder.loadTexts: hpnicfSoftwareVersion.setDescription('Software version.') hpnicf_sys_boot_type = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('coldStart', 1), ('warmStart', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfSysBootType.setStatus('current') if mibBuilder.loadTexts: hpnicfSysBootType.setDescription('Boot type of the system, indicates whether the last device reboot was by CLI (warm start) or power off (cold start).') hpnicf_system_info = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11)) hpnicf_sys_statistic_period = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 900))).setUnits('seconds').setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfSysStatisticPeriod.setStatus('current') if mibBuilder.loadTexts: hpnicfSysStatisticPeriod.setDescription('Statistic period. The device collects statistics within the period.') hpnicf_sys_sample_period = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 300))).setUnits('seconds').setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfSysSamplePeriod.setStatus('current') if mibBuilder.loadTexts: hpnicfSysSamplePeriod.setDescription('Sampling period. The device takes samples periodically for statistics collection.') hpnicf_sys_trap_resend_period = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 3600))).setUnits('seconds').setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfSysTrapResendPeriod.setStatus('current') if mibBuilder.loadTexts: hpnicfSysTrapResendPeriod.setDescription('Trap resending period. If the value is zero, the trap will not be re-sent.') hpnicf_sys_trap_collection_period = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 60))).setUnits('seconds').setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfSysTrapCollectionPeriod.setStatus('current') if mibBuilder.loadTexts: hpnicfSysTrapCollectionPeriod.setDescription('Trap collecting period. If the value is zero, the trap will not be re-sent.') hpnicf_sys_snmp_port = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfSysSnmpPort.setStatus('current') if mibBuilder.loadTexts: hpnicfSysSnmpPort.setDescription('UDP port for SNMP protocol entity to receive messages except Trap-PDU.') hpnicf_sys_snmp_trap_port = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfSysSnmpTrapPort.setStatus('current') if mibBuilder.loadTexts: hpnicfSysSnmpTrapPort.setDescription('UDP port for Trap-PDU to receive messages.') hpnicf_sys_net_id = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 7), octet_string().subtype(subtypeSpec=value_size_constraint(0, 127))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfSysNetID.setStatus('current') if mibBuilder.loadTexts: hpnicfSysNetID.setDescription('System Net ID.') hpnicf_sys_last_sample_time = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 8), date_and_time()).setMaxAccess('readonly') if mibBuilder.loadTexts: hpnicfSysLastSampleTime.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLastSampleTime.setDescription('Last sampling time of the system.') hpnicf_sys_trap_send_num = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 24))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfSysTrapSendNum.setStatus('current') if mibBuilder.loadTexts: hpnicfSysTrapSendNum.setDescription('Maximum number of times for sending a trap. If the value is zero, a trap will be sent at an interval continually.') hpnicf_sys_first_trap_time = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 10), time_ticks()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfSysFirstTrapTime.setStatus('current') if mibBuilder.loadTexts: hpnicfSysFirstTrapTime.setDescription('Time when the first trap is sent.') hpnicf_sys_banner_motd = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 11, 11), octet_string().subtype(subtypeSpec=value_size_constraint(0, 2000))).setMaxAccess('readwrite') if mibBuilder.loadTexts: hpnicfSysBannerMOTD.setStatus('current') if mibBuilder.loadTexts: hpnicfSysBannerMOTD.setDescription('An administratively configured message that is displayed to the user when the user logs in to the device through the console port or Web interface.') hpnicf_system_notification_info = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12)) hpnicf_sys_loghost_index = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12, 1), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfSysLoghostIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostIndex.setDescription('Index of loghost.') hpnicf_sys_loghost_ipaddress_type = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12, 2), inet_address_type()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfSysLoghostIpaddressType.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostIpaddressType.setDescription('IP address type of the loghost.') hpnicf_sys_loghost_ipaddress = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12, 3), inet_address()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfSysLoghostIpaddress.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostIpaddress.setDescription('IP address of the loghost.') hpnicf_sys_loghost_trap_vpn_name = mib_scalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 6, 12, 4), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: hpnicfSysLoghostTrapVpnName.setStatus('current') if mibBuilder.loadTexts: hpnicfSysLoghostTrapVpnName.setDescription('VPN name of the loghost.') mibBuilder.exportSymbols('HPN-ICF-COMMON-SYSTEM-MIB', hpnicfSysSamplePeriod=hpnicfSysSamplePeriod, hpnicfSysLoghostTrapVpnName=hpnicfSysLoghostTrapVpnName, hpnicfSysBootType=hpnicfSysBootType, hpnicfReboot=hpnicfReboot, hpnicfSysLoghostUnreachableTrap=hpnicfSysLoghostUnreachableTrap, hpnicfSysTrapResendPeriod=hpnicfSysTrapResendPeriod, hpnicfStartFtpServer=hpnicfStartFtpServer, hpnicfWriteConfig=hpnicfWriteConfig, hpnicfSysLoghostIndex=hpnicfSysLoghostIndex, hpnicfSysStatisticPeriod=hpnicfSysStatisticPeriod, hpnicfRebootSendTrap=hpnicfRebootSendTrap, hpnicfSysSnmpPort=hpnicfSysSnmpPort, hpnicfSysLastSampleTime=hpnicfSysLastSampleTime, hpnicfSystemInfo=hpnicfSystemInfo, hpnicfWriteSuccessTrap=hpnicfWriteSuccessTrap, hpnicfSysLoghostIpaddress=hpnicfSysLoghostIpaddress, hpnicfSysTrapCollectionPeriod=hpnicfSysTrapCollectionPeriod, hpnicfSystem=hpnicfSystem, hpnicfSysFirstTrapTime=hpnicfSysFirstTrapTime, PYSNMP_MODULE_ID=hpnicfSystem, hpnicfSysTrapSendNum=hpnicfSysTrapSendNum, hpnicfSoftwareVersion=hpnicfSoftwareVersion, hpnicfSysBannerMOTD=hpnicfSysBannerMOTD, hpnicfSystemNotification=hpnicfSystemNotification, hpnicfSysNetID=hpnicfSysNetID, hpnicfSysWarmStartTrap=hpnicfSysWarmStartTrap, hpnicfSysLoghostIpaddressType=hpnicfSysLoghostIpaddressType, hpnicfSystemNotificationInfo=hpnicfSystemNotificationInfo, hpnicfSysColdStartTrap=hpnicfSysColdStartTrap, hpnicfSysSnmpTrapPort=hpnicfSysSnmpTrapPort, hpnicfWriteFailureTrap=hpnicfWriteFailureTrap)
## Recursion with memoization # Time: O(n^3) class Solution: def wordBreak(self, s: str, wordDict: List[str]) -> bool: @lru_cache def recur( s, word_dict, start ): if start == len(s): return True for end in range( start+1, len(s)+1 ): if s[start:end] in word_dict and recur( s, word_dict, end ): return True return False return recur( s, frozenset(wordDict), 0 ) class SolutionII: def wordBreak(self, s: str, wordDict: List[str]) -> bool: memo = [-1]*len(s) def recur( s, word_dict, start ): if start == len(s): return True if memo[start] != -1: return memo[start] for end in range( start+1, len(s)+1 ): if s[start:end] in word_dict and recur( s, word_dict, end ): memo[start] = True return True memo[start] = False return False return recur( s, set(wordDict), 0 ) ## Brute Force # Time: O(2^n) class Solution: def wordBreak(self, s: str, wordDict: List[str]) -> bool: def recur( s, word_dict, start ): if start == len(s): return True for end in range( start+1, len(s)+1 ): if s[start:end] in word_dict and recur( s, word_dict, end ): return True return False return recur( s, set(wordDict), 0 )
class Solution: def word_break(self, s: str, wordDict: List[str]) -> bool: @lru_cache def recur(s, word_dict, start): if start == len(s): return True for end in range(start + 1, len(s) + 1): if s[start:end] in word_dict and recur(s, word_dict, end): return True return False return recur(s, frozenset(wordDict), 0) class Solutionii: def word_break(self, s: str, wordDict: List[str]) -> bool: memo = [-1] * len(s) def recur(s, word_dict, start): if start == len(s): return True if memo[start] != -1: return memo[start] for end in range(start + 1, len(s) + 1): if s[start:end] in word_dict and recur(s, word_dict, end): memo[start] = True return True memo[start] = False return False return recur(s, set(wordDict), 0) class Solution: def word_break(self, s: str, wordDict: List[str]) -> bool: def recur(s, word_dict, start): if start == len(s): return True for end in range(start + 1, len(s) + 1): if s[start:end] in word_dict and recur(s, word_dict, end): return True return False return recur(s, set(wordDict), 0)
expected_output = { "active_translations": {"dynamic": 0, "extended": 0, "static": 0, "total": 0}, "cef_punted_pkts": 0, "cef_translated_pkts": 0, "dynamic_mappings": { "inside_source": { "id": { 1: { "access_list": "test-robot", "match": "access-list test-robot pool test-robot", "pool": { "test-robot": { "allocated": 0, "allocated_percentage": 0, "end": "10.1.1.1", "misses": 0, "netmask": "255.255.255.252", "start": "10.1.1.1", "total_addresses": 1, "type": "generic", } }, "refcount": 0, } } } }, "expired_translations": 11013, "hits": 3358708, "interfaces": { "inside": ["TenGigabitEthernet0/1/0"], "outside": ["TenGigabitEthernet0/2/0"], }, "ip_alias_add_fail": 0, "limit_entry_add_fail": 0, "mapping_stats_drop": 0, "misses": 11050, "pool_stats_drop": 0, "port_block_alloc_fail": 0, }
expected_output = {'active_translations': {'dynamic': 0, 'extended': 0, 'static': 0, 'total': 0}, 'cef_punted_pkts': 0, 'cef_translated_pkts': 0, 'dynamic_mappings': {'inside_source': {'id': {1: {'access_list': 'test-robot', 'match': 'access-list test-robot pool test-robot', 'pool': {'test-robot': {'allocated': 0, 'allocated_percentage': 0, 'end': '10.1.1.1', 'misses': 0, 'netmask': '255.255.255.252', 'start': '10.1.1.1', 'total_addresses': 1, 'type': 'generic'}}, 'refcount': 0}}}}, 'expired_translations': 11013, 'hits': 3358708, 'interfaces': {'inside': ['TenGigabitEthernet0/1/0'], 'outside': ['TenGigabitEthernet0/2/0']}, 'ip_alias_add_fail': 0, 'limit_entry_add_fail': 0, 'mapping_stats_drop': 0, 'misses': 11050, 'pool_stats_drop': 0, 'port_block_alloc_fail': 0}
# Copyright (C) 2021 Clinton Garwood # MIT Open Source Initiative Approved License # while_true_clinton.py # CIS-135 Python # Assignment #9 # # # Lab 9 # Get while_yes and enter Loop # Initial Value received from input is a string value # print("While Looping Exercises") #while_yes = input("Yes or No? Input y for yes, or n for no") # # While Yes Loop # while_yes = 'y' # while while_yes == 'y' or while_yes == "Y": # print("'While-Yes Loop' runs as long as 'y' is entered, any other character exits the loop") # while_yes = input("Type y to continue, or any other character to exit.") # print("Exited Loop Successfully") # # While True Loop # while_true = True # This is a boolean value (True or False) # while(while_true == True): # print("While True loop will run until False (#2) is entered") # t_f = int(input("Enter 1 for True, or 2 for False ")) # if t_f == 1: # pass # elif t_f == 2: # while_true = False # print("While True Loop Successfully") # While False Loop while_false = False # This is a boolean value (True or False) while(while_false != True): print("While False loop will exit if True (#1) is entered") t_f = int(input("Enter 1 for True, or 2 for False ")) if t_f == 1: while_false = True else: print("") print("Exited While False Loop Successfully")
while_false = False while while_false != True: print('While False loop will exit if True (#1) is entered') t_f = int(input('Enter 1 for True, or 2 for False ')) if t_f == 1: while_false = True else: print('') print('Exited While False Loop Successfully')
engine.run_script('init-touchcursor') # https://github.com/autokey/autokey/issues/127 # Can't simulate multimedia keys #127 # xmodmap -pk | grep XF86AudioRaiseVolume # 123 0x1008ff13 (XF86AudioRaiseVolume) 0x0000 (NoSymbol) 0x1008ff13 (XF86AudioRaiseVolume) # keyboard.send_keys("<code123>") # https://unix.stackexchange.com/questions/342554/how-to-enable-my-keyboards-volume-keys-in-xfce/342555 # xfce4-pulseaudio-plugin # pactl -- set-sink-volume 0 +5% # raise volume by each 10% (more than 100% possible, might distort the sound) # pactl -- set-sink-volume 0 -5% # reduce volume by each 10% # pactl -- set-sink-mute 0 toggle # mute/unmutes audio system.exec_command("pactl -- set-sink-volume 0 +5%", getOutput=False)
engine.run_script('init-touchcursor') system.exec_command('pactl -- set-sink-volume 0 +5%', getOutput=False)
class Solution: def twoSum(self, nums: list[int], target: int) -> list[int]: l = len(nums) data = {} for i in range(l): xa = nums[i] if xa in data: return [data[xa], i] xb = target - xa data[xb] = i return [] def alternate(self, nums: list[int], target: int) -> list[int]: l = len(nums) for i in range(l - 1): for j in range(i + 1, l): if nums[i] + nums[j] == target: return [i, j] return []
class Solution: def two_sum(self, nums: list[int], target: int) -> list[int]: l = len(nums) data = {} for i in range(l): xa = nums[i] if xa in data: return [data[xa], i] xb = target - xa data[xb] = i return [] def alternate(self, nums: list[int], target: int) -> list[int]: l = len(nums) for i in range(l - 1): for j in range(i + 1, l): if nums[i] + nums[j] == target: return [i, j] return []
envs = [ 'dm.acrobot.swingup', 'dm.cheetah.run', 'dm.finger.turn_hard', 'dm.walker.run', 'dm.quadruped.run', 'dm.quadruped.walk', 'dm.hopper.hop', ] times = [ 1e6, 1e6, 1e6, 1e6, 2e6, 2e6, 1e6 ] sigma = 0.001 f_dims = [1024, 512, 256, 128, 64] lr = '1e-4' count = 0 for i, env in enumerate(envs): commands = [] base_str = f"python main.py --policy PytorchSAC --env {env} --start_timesteps 5000 --hidden_dim 1024 --batch_size 1024 --n_hidden 2 --lr {lr}" max_timesteps = int(times[i]) # LFF for fourier_dim in f_dims: for seed in [10, 20, 30]: commands.append(base_str + f' --network_class FourierMLP --concatenate_fourier --train_B' f' --sigma {sigma} --fourier_dim {fourier_dim} --seed {seed}') for command in commands: count += 1 print(f'CUDA_VISIBLE_DEVICES=0 taskset -c a-b {command} --max_timesteps {max_timesteps} &') if count % 10 == 0: print(count) print(count) # ablation_envs = []
envs = ['dm.acrobot.swingup', 'dm.cheetah.run', 'dm.finger.turn_hard', 'dm.walker.run', 'dm.quadruped.run', 'dm.quadruped.walk', 'dm.hopper.hop'] times = [1000000.0, 1000000.0, 1000000.0, 1000000.0, 2000000.0, 2000000.0, 1000000.0] sigma = 0.001 f_dims = [1024, 512, 256, 128, 64] lr = '1e-4' count = 0 for (i, env) in enumerate(envs): commands = [] base_str = f'python main.py --policy PytorchSAC --env {env} --start_timesteps 5000 --hidden_dim 1024 --batch_size 1024 --n_hidden 2 --lr {lr}' max_timesteps = int(times[i]) for fourier_dim in f_dims: for seed in [10, 20, 30]: commands.append(base_str + f' --network_class FourierMLP --concatenate_fourier --train_B --sigma {sigma} --fourier_dim {fourier_dim} --seed {seed}') for command in commands: count += 1 print(f'CUDA_VISIBLE_DEVICES=0 taskset -c a-b {command} --max_timesteps {max_timesteps} &') if count % 10 == 0: print(count) print(count)
def foo(): return "foo 1" def bar(): return "bar 1" if __name__ == "__main__": print(foo()) print(bar())
def foo(): return 'foo 1' def bar(): return 'bar 1' if __name__ == '__main__': print(foo()) print(bar())
def find_node_in_list(name, l): for i in l: if i.name == name: return i return False def remove_bag(string): string = string.replace('bags', '') if 'bags' in string else string string = string.replace('bag', '') if 'bag' in string else string return string.strip() class LinkedList: def __init__(self, name): self.name = name self.next = {} def add_next(self, next_node, amount): self.next[next_node] = amount def contains(self, name): if find_node_in_list(name, self.next): return True for child in self.next: if child.contains(name): return True return False def cost(self): return self._cost() - 1 def _cost(self): cost = 1 for child in self.next: cost += self.next[child] * child._cost() return cost def __repr__(self): return f'<LinkedListNode:{self.name}>' with open('day-07/input.txt', 'r') as file: puzzle_input_raw = [i.strip() for i in file.readlines()] puzzle_input = {} for entry in puzzle_input_raw: parent, other = entry.split(' contain ') parent = remove_bag(parent) puzzle_input[parent] = {} for child in other.split(', '): if child == 'no other bags.': continue amount, name = child.replace('.', '').split(' ', 1) name = remove_bag(name) puzzle_input[parent][name] = int(amount) puzzle_objects = [] for bag in puzzle_input: node = LinkedList(bag) puzzle_objects.append(node) for bag in puzzle_input: parent = find_node_in_list(bag, puzzle_objects) for i in puzzle_input[bag]: child = find_node_in_list(i, puzzle_objects) parent.add_next(child, puzzle_input[bag][i]) def part_1(puzzle_input): return sum([bag.contains('shiny gold') for bag in puzzle_input]) def part_2(puzzle_input): bag = find_node_in_list('shiny gold', puzzle_input) return bag.cost() print(part_1(puzzle_objects)) print(part_2(puzzle_objects))
def find_node_in_list(name, l): for i in l: if i.name == name: return i return False def remove_bag(string): string = string.replace('bags', '') if 'bags' in string else string string = string.replace('bag', '') if 'bag' in string else string return string.strip() class Linkedlist: def __init__(self, name): self.name = name self.next = {} def add_next(self, next_node, amount): self.next[next_node] = amount def contains(self, name): if find_node_in_list(name, self.next): return True for child in self.next: if child.contains(name): return True return False def cost(self): return self._cost() - 1 def _cost(self): cost = 1 for child in self.next: cost += self.next[child] * child._cost() return cost def __repr__(self): return f'<LinkedListNode:{self.name}>' with open('day-07/input.txt', 'r') as file: puzzle_input_raw = [i.strip() for i in file.readlines()] puzzle_input = {} for entry in puzzle_input_raw: (parent, other) = entry.split(' contain ') parent = remove_bag(parent) puzzle_input[parent] = {} for child in other.split(', '): if child == 'no other bags.': continue (amount, name) = child.replace('.', '').split(' ', 1) name = remove_bag(name) puzzle_input[parent][name] = int(amount) puzzle_objects = [] for bag in puzzle_input: node = linked_list(bag) puzzle_objects.append(node) for bag in puzzle_input: parent = find_node_in_list(bag, puzzle_objects) for i in puzzle_input[bag]: child = find_node_in_list(i, puzzle_objects) parent.add_next(child, puzzle_input[bag][i]) def part_1(puzzle_input): return sum([bag.contains('shiny gold') for bag in puzzle_input]) def part_2(puzzle_input): bag = find_node_in_list('shiny gold', puzzle_input) return bag.cost() print(part_1(puzzle_objects)) print(part_2(puzzle_objects))
n = int(input()) ans = 0 for a in range(10 ** 5): if a ** 2 <= n: ans = a else: break print(ans)
n = int(input()) ans = 0 for a in range(10 ** 5): if a ** 2 <= n: ans = a else: break print(ans)
dict = { 'apples': 7, 'oranges': 12, 'grapes': 5 } # to get an item from a dictionary apples = dict.get('apples') # option 1 apples1 = dict['apples'] # option 2 print(apples1) # add items to the dict dict['banana'] = 4 print(dict) # remove items from the dict dict.popitem() # removes last item from dict print(dict) dict.pop('oranges') print(dict)
dict = {'apples': 7, 'oranges': 12, 'grapes': 5} apples = dict.get('apples') apples1 = dict['apples'] print(apples1) dict['banana'] = 4 print(dict) dict.popitem() print(dict) dict.pop('oranges') print(dict)
A, B = map(int, input().split()) while A != 0 and B != 0: X = set(map(int, input().split())) Y = set(map(int, input().split())) print(min(len(X-Y), len(Y-X))) A, B = map(int, input().split())
(a, b) = map(int, input().split()) while A != 0 and B != 0: x = set(map(int, input().split())) y = set(map(int, input().split())) print(min(len(X - Y), len(Y - X))) (a, b) = map(int, input().split())
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'array_data_model', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'autocomplete_list', 'dependencies': [ 'list', 'list_single_selection_model', 'position_util', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'command', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:ui', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'context_menu_button', 'dependencies': [ 'menu_button', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'context_menu_handler', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target', '../compiled_resources2.gyp:ui', 'menu', 'menu_button', 'position_util', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'dialogs', 'dependencies': [ '../../compiled_resources2.gyp:cr', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'drag_wrapper', 'dependencies': [ '../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'focus_grid', 'dependencies': [ '../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:event_tracker', 'focus_row', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'focus_manager', 'dependencies': ['../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'focus_outline_manager', 'dependencies': ['../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'focus_row', 'dependencies': [ '../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:event_tracker', '../../compiled_resources2.gyp:util', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'focus_without_ink', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:ui', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'grid', 'dependencies': [ 'list', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'list', 'dependencies': [ 'array_data_model', 'list_item', 'list_selection_controller', 'list_selection_model', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'list_item', 'dependencies': [ '../../compiled_resources2.gyp:cr', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'list_selection_controller', 'dependencies': [ '../../compiled_resources2.gyp:cr', 'list_selection_model', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'list_selection_model', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'list_single_selection_model', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'menu_button', 'dependencies': [ '../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:event_tracker', '../compiled_resources2.gyp:ui', 'menu', 'menu_item', 'position_util', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'menu_item', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:load_time_data', '../compiled_resources2.gyp:ui', 'command', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'menu', 'dependencies': [ '../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:ui', 'menu_item', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'node_utils', 'dependencies': [ '../../compiled_resources2.gyp:cr', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'overlay', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:util', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'position_util', 'dependencies': [ '../../compiled_resources2.gyp:cr', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'splitter', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:ui', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'table', 'dependencies': [ 'list', 'list_single_selection_model', 'table/compiled_resources2.gyp:table_column_model', 'table/compiled_resources2.gyp:table_header', 'table/compiled_resources2.gyp:table_list', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, { 'target_name': 'tree', 'dependencies': [ '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:util', '../compiled_resources2.gyp:ui', ], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'], }, ], }
{'targets': [{'target_name': 'array_data_model', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'autocomplete_list', 'dependencies': ['list', 'list_single_selection_model', 'position_util'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'command', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:ui'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'context_menu_button', 'dependencies': ['menu_button'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'context_menu_handler', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target', '../compiled_resources2.gyp:ui', 'menu', 'menu_button', 'position_util'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'dialogs', 'dependencies': ['../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'drag_wrapper', 'dependencies': ['../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'focus_grid', 'dependencies': ['../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:event_tracker', 'focus_row'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'focus_manager', 'dependencies': ['../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'focus_outline_manager', 'dependencies': ['../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'focus_row', 'dependencies': ['../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:event_tracker', '../../compiled_resources2.gyp:util'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'focus_without_ink', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:ui'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'grid', 'dependencies': ['list'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'list', 'dependencies': ['array_data_model', 'list_item', 'list_selection_controller', 'list_selection_model'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'list_item', 'dependencies': ['../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'list_selection_controller', 'dependencies': ['../../compiled_resources2.gyp:cr', 'list_selection_model'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'list_selection_model', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'list_single_selection_model', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:event_target'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'menu_button', 'dependencies': ['../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:event_tracker', '../compiled_resources2.gyp:ui', 'menu', 'menu_item', 'position_util'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'menu_item', 'dependencies': ['../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:load_time_data', '../compiled_resources2.gyp:ui', 'command'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'menu', 'dependencies': ['../../compiled_resources2.gyp:assert', '../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:ui', 'menu_item'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'node_utils', 'dependencies': ['../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'overlay', 'dependencies': ['../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:util'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'position_util', 'dependencies': ['../../compiled_resources2.gyp:cr'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'splitter', 'dependencies': ['../../compiled_resources2.gyp:cr', '../compiled_resources2.gyp:ui'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'table', 'dependencies': ['list', 'list_single_selection_model', 'table/compiled_resources2.gyp:table_column_model', 'table/compiled_resources2.gyp:table_header', 'table/compiled_resources2.gyp:table_list'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}, {'target_name': 'tree', 'dependencies': ['../../compiled_resources2.gyp:cr', '../../compiled_resources2.gyp:util', '../compiled_resources2.gyp:ui'], 'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi']}]}
######################################## # QUESTION ######################################## # Create a function (or write a script in Shell) that takes an integer as an argument # and returns "Even" for even numbers or "Odd" for odd numbers. ################################### # SOLUTION ################################### def even_or_odd(number): if number % 2 == 0: return "Even" else: return "Odd"
def even_or_odd(number): if number % 2 == 0: return 'Even' else: return 'Odd'
# -*- coding: utf-8 -*- VERSION_MAJOR = '0' VERSION_MINOR = '1' VERSION_PATCH = '1' VERSION_DEV = 'dev' def version(): dev = '' if VERSION_DEV: dev = '-' + VERSION_DEV return VERSION_MAJOR + '.' + VERSION_MINOR + '.' + VERSION_PATCH + dev
version_major = '0' version_minor = '1' version_patch = '1' version_dev = 'dev' def version(): dev = '' if VERSION_DEV: dev = '-' + VERSION_DEV return VERSION_MAJOR + '.' + VERSION_MINOR + '.' + VERSION_PATCH + dev
# coding: utf-8 default_app_config = 'modernrpc.apps.ModernRpcConfig' __version__ = '0.11.1'
default_app_config = 'modernrpc.apps.ModernRpcConfig' __version__ = '0.11.1'
x = 0 if x < 2 : print('small') elif x < 10 : print('Medium') else : print('LARGE') print('All done')
x = 0 if x < 2: print('small') elif x < 10: print('Medium') else: print('LARGE') print('All done')
CONTENT_OPERATIONS_RESOURCES_NAMESPACE = \ 'bclearer_boson_1_1_source.resources.content_universes' ADJUSTMENT_OPERATIONS_RESOURCES_NAMESPACE = \ 'bclearer_boson_1_1_source.resources.adjustment_universes'
content_operations_resources_namespace = 'bclearer_boson_1_1_source.resources.content_universes' adjustment_operations_resources_namespace = 'bclearer_boson_1_1_source.resources.adjustment_universes'
# More About the print Function (Title) # Reading # Suppressing the Print Function's Ending Newline print('one') print('two') print('three') # To print space instead of newline character (new line of output) print('one', end=' ') print('two', end=' ') print('three') # To print nothing at the end of its output print('one', end='') print('two', end='') print('three', end='') # Specifiying an Item Separator (section) print('One', 'Two', 'Three') # Use sep='' if you want no space printed between items print('One' , 'Two', 'Three', sep='') # Special argument to separate multiple items (similar to above) print('One', 'Two', 'Three', sep='*') # Additional example print('One', 'Two', 'Three', sep='~~~') # Escape Characters (sections) # Escape Character \n print('One/nTwo/nThree') # Escape Character \t print('Mon\tTues\tWed') print('Thur\tFri\tSat') # Escape Character \' and \" to display quotation marks print("Your assignment is to read \"Hamlet\" by tomorrow.") print('I\'m ready to being.') # Escape Character \\ to display a backslash print('The path is C:\\temp\\data.') # End # Checkpoint # 2.25 How do you supress the print function's ending newline? # A: Pass special argument end = ' ' to the function # 2.26 How can you change the character that is automatically # displayed between multiple items that are passed to the print function? # A: Pass the argument sep = ' ' to the print function # 2.27 What is the '/n' escape character? # A: Newline escape character # End
print('one') print('two') print('three') print('one', end=' ') print('two', end=' ') print('three') print('one', end='') print('two', end='') print('three', end='') print('One', 'Two', 'Three') print('One', 'Two', 'Three', sep='') print('One', 'Two', 'Three', sep='*') print('One', 'Two', 'Three', sep='~~~') print('One/nTwo/nThree') print('Mon\tTues\tWed') print('Thur\tFri\tSat') print('Your assignment is to read "Hamlet" by tomorrow.') print("I'm ready to being.") print('The path is C:\\temp\\data.')
# Copyright 2020 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. PYTHON_VERSION_COMPATIBILITY = "PY2+3" DEPS = [ 'provenance', 'recipe_engine/path', ] def RunSteps(api): api.provenance.generate( 'projects/PROJECT/locations/global/keyRings/KEYRING/cryptoKeys/KEY', api.path['start_dir'].join('input.json'), api.path['cleanup'].join('output.attestation'), ) # Generate another attestation; the module shouldn't install provenance again. api.provenance.generate( 'projects/PROJECT/locations/global/keyRings/KEYRING/cryptoKeys/KEY', api.path['start_dir'].join('another-input.json'), api.path['cleanup'].join('another-output.attestation'), ) def GenTests(api): yield api.test('simple')
python_version_compatibility = 'PY2+3' deps = ['provenance', 'recipe_engine/path'] def run_steps(api): api.provenance.generate('projects/PROJECT/locations/global/keyRings/KEYRING/cryptoKeys/KEY', api.path['start_dir'].join('input.json'), api.path['cleanup'].join('output.attestation')) api.provenance.generate('projects/PROJECT/locations/global/keyRings/KEYRING/cryptoKeys/KEY', api.path['start_dir'].join('another-input.json'), api.path['cleanup'].join('another-output.attestation')) def gen_tests(api): yield api.test('simple')
# # PySNMP MIB module BASIS-GENERIC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BASIS-GENERIC-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:34:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion") cardGeneric, = mibBuilder.importSymbols("BASIS-MIB", "cardGeneric") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, iso, Unsigned32, ModuleIdentity, Integer32, Bits, NotificationType, ObjectIdentity, TimeTicks, Counter64, Gauge32, MibIdentifier, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "iso", "Unsigned32", "ModuleIdentity", "Integer32", "Bits", "NotificationType", "ObjectIdentity", "TimeTicks", "Counter64", "Gauge32", "MibIdentifier", "IpAddress") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") cardInformation = MibIdentifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 1)) cardInterface = MibIdentifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 2)) cardSelfTest = MibIdentifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 3)) moduleSlotNumber = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleSlotNumber.setStatus('mandatory') if mibBuilder.loadTexts: moduleSlotNumber.setDescription('Slot number this card is present ') functionModuleType = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 10, 11, 12, 20, 21, 22, 23, 24, 25, 30, 31, 32, 33, 34, 35, 36, 37, 40, 41, 50, 51, 52, 53, 60, 61, 70, 71, 72, 73, 80, 90, 91, 100, 101, 110, 111, 120, 121, 130, 131, 132, 133, 134, 135, 136, 137, 140, 141, 150, 151, 563, 564, 787, 1000, 1001, 1002, 1003, 2000, 2001))).clone(namedValues=NamedValues(("other", 1), ("asc", 2), ("bnm-T3", 10), ("bnm-E3", 11), ("bnm-155", 12), ("srm-4T1E1", 20), ("srm-3T3", 21), ("srme-1OC3", 22), ("srme-1STS3", 23), ("srme-NOBC", 24), ("srm-3T3-NOBC", 25), ("frsm-4T1", 30), ("frsm-4E1", 31), ("frsm-4T1-C", 32), ("frsm-4E1-C", 33), ("frsm-hs1", 34), ("frsm-8T1", 35), ("frsm-8E1", 36), ("frsm-hs1b", 37), ("ausm-4T1", 40), ("ausm-4E1", 41), ("ausm-8T1", 50), ("ausm-8E1", 51), ("ausmB-8T1", 52), ("ausmB-8E1", 53), ("cesm-4T1", 60), ("cesm-4E1", 61), ("imatm-T3T1", 70), ("imatm-E3E1", 71), ("imatmB-8T1", 72), ("imatmB-8E1", 73), ("frasm-8T1", 80), ("cesm-8T1", 90), ("cesm-8E1", 91), ("bscsm-2", 100), ("bscsm-4", 101), ("atmt-8T1", 110), ("atmt-8E1", 111), ("frt-8T1", 120), ("frt-8E1", 121), ("frsm-2ct3", 130), ("frsm-2t3", 131), ("frsm-2e3", 132), ("frsm-hs2", 133), ("frsm-2t3b", 134), ("frsm-2e3b", 135), ("frsm-hs2b-hssi", 136), ("frsm-hs2b-12In1", 137), ("cesm-T3", 140), ("cesm-E3", 141), ("vism-8T1", 150), ("vism-8E1", 151), ("vism-pr-8T1", 563), ("vism-pr-8E1", 564), ("cesmB-8T1", 787), ("pxm1", 1000), ("pxm1-2t3e3", 1001), ("pxm1-4oc3", 1002), ("pxm1-oc12", 1003), ("rpm", 2000), ("rpm-pr", 2001))).clone('other')).setMaxAccess("readonly") if mibBuilder.loadTexts: functionModuleType.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleType.setDescription('This object holds the type of the card. The card can type is for Processor module as well as service module. ') functionModuleDescription = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readonly") if mibBuilder.loadTexts: functionModuleDescription.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleDescription.setDescription('Describes the card ') functionModuleSerialNum = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 11))).setMaxAccess("readonly") if mibBuilder.loadTexts: functionModuleSerialNum.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleSerialNum.setDescription('Serial number of the function Module.') functionModuleHWRev = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 2))).setMaxAccess("readonly") if mibBuilder.loadTexts: functionModuleHWRev.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleHWRev.setDescription('Hardware revision number for function Module.') functionModuleFWRev = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: functionModuleFWRev.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleFWRev.setDescription('Firmware revision number of the function Module.') functionModuleState = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17))).clone(namedValues=NamedValues(("nocard", 1), ("standby", 2), ("active", 3), ("failed", 4), ("selfTest", 5), ("heldInReset", 6), ("boot", 7), ("mismatch", 8), ("unknown", 9), ("coreCardMisMatch", 10), ("blocked", 11), ("reserved", 12), ("hold", 13), ("notResponding", 14), ("cardinit", 17)))).setMaxAccess("readonly") if mibBuilder.loadTexts: functionModuleState.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleState.setDescription("This object holds the status of a card in a particular shelf-slot. The possible values are : nocard(1) : card not present. standby(2) : card in standby state. The card is in ready state and will be ready to take over the service if the corresponding active card(redundant) fails. active(3) : card in active state. The card is providing the service. failed(4) : card in failed state. The card can come out of this state only after user intervention (Reset or running some CLI commands). selfTest(5) : online diagnostics is being run in card. heldInReset(6) : The card configuration is being cleared. No requests can be serviced. boot(7) : card in boot state. mismatch(8) : card is not compatible with the current configuration. Card was correctly provisioned earlier, however the card was replaced by an incompatible card. This state can be resolved by clearing the configuration, or replacing with the appropriate card. unknown(9) : could not determine the state coreCardMisMatch(10) : Controller Card(PXM/ASC etc) and SRM(Service Resource Module) combination does not match. blocked(11) : In case of 1:N redundancy configuration the secondary card(backup card) is covering one of the primary card and can not cover any other card in the group if there is a failure. Redundancy is blocked. hold(13) : The standby controller card assumes the hold state during PXM upgrades. In this state, the standby PXM will be running a different software but will be receiving all standby updates(BRAM and Database). This state is applicable only for MGX8250 Platform. notResponding(14): Response from the Service Module has become slow probably due to overloading of CPU. No recovery action is required on user part. At present, this state is applicable only for Router Blade(RPM). cardinit(17) : When the physical presence of card has been detected but the communication hasn't yet been established between the controller card (PXM) and Service Module. ") functionModuleResetReason = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18))).clone(namedValues=NamedValues(("powerUp", 1), ("parityError", 2), ("watchDog", 3), ("resourceOverflow", 4), ("clrAllCnf", 5), ("missingTask", 6), ("pxmLowVoltage", 7), ("resetByEventLogTask", 8), ("resetFromShell", 9), ("unknown", 10), ("resetFromPXM", 11), ("resetSys", 12), ("switchCC", 13), ("sCacheError", 14), ("swError", 15), ("upgrade", 16), ("restoreAllCnf", 17), ("driverError", 18)))).setMaxAccess("readonly") if mibBuilder.loadTexts: functionModuleResetReason.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleResetReason.setDescription('Last reason for card to reset. The possible values are : powerUp(1) : power up parityError(2) : parity error watchDog(3) : watchdog resourceOverflow (4) : resource overflow clrAllCnf (5) : configuration of the shelf is cleared. missingTask (6) : task is missing pxmLowVoltage(7): low voltage detected on PXM resetByEventLogTask(8): resetFromShell(9): command is run from command shell unknown(10) : resetFromPXM(11) : Controller Card(PXM) reset the card. resetSys(12) : due to resetsys CLI Command. switchCC(13) : due to switch over CLI command. sCacheError(14) : swError(15) : software error. upgrade(16) : upgrade restoreAllCnf(17): restore configuration. driverError(18) : driver error. Valid values for VISM: powerUp, watchDog, resetFromShell and resetFromPXM. ') lineModuleType = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 48, 49, 50, 51, 60, 61, 62, 63, 70, 71, 80, 81, 500, 501, 502, 503, 504, 505, 506, 507, 511, 512, 513, 514, 515, 1006, 1050, 1051, 1052))).clone(namedValues=NamedValues(("other", 1), ("lm-ASC", 2), ("lm-DB15-4T1", 16), ("lm-DB15-4E1", 17), ("lm-BNC-4E1", 18), ("lm-DB15-4T1-R", 19), ("lm-DB15-4E1-R", 20), ("lm-BNC-4E1-R", 21), ("lm-RJ48-8T1", 22), ("lm-RJ48-8E1", 23), ("lm-SMB-8E1", 24), ("lm-RJ48-T3T1", 25), ("lm-RJ48-E3E1", 26), ("lm-RJ48-T3E1", 27), ("lm-SMB-E3E1", 28), ("lm-RJ48-E3T1", 29), ("lm-SMB-T3E1", 30), ("lm-T3E3-D", 32), ("lm-T3E3-B", 33), ("lm-155-SMF", 34), ("lm-155-UTP", 35), ("lm-RJ48-8T1-R", 48), ("lm-RJ48-8E1-R", 49), ("lm-SMB-8E1-R", 50), ("lm-3T3-B", 51), ("lm-HS1-4X21", 60), ("lm-HS1-3HSSI", 61), ("lm-HS1-4V35", 62), ("lm-12In1-8s", 63), ("lm-BSCSM-2", 70), ("lm-BSCSM-4", 71), ("lm-BNC-2T3", 80), ("lm-BNC-2E3", 81), ("pxm-ui", 500), ("smfir-1-622", 501), ("smflr-1-622", 502), ("smfir15-1-622", 503), ("smflr15-1-622", 504), ("mmf-4-155", 505), ("smfir-4-155", 506), ("smflr-4-155", 507), ("rj45-fe", 511), ("mmf-fe", 512), ("mmf-fddi", 513), ("smf-fddi", 514), ("rj45-4e", 515), ("pxm-ui-s3", 1006), ("lm-srme-1OC3-smlr", 1050), ("lm-srme-1OC3-smir", 1051), ("lm-srme-1OC3-smb", 1052))).clone('other')).setMaxAccess("readonly") if mibBuilder.loadTexts: lineModuleType.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleType.setDescription('This object contains the Line Module(back card) type. Physically it is behind the backplane, normally with connectors for physical devices. These are specific to the front or functional modules. ') lineModuleDescription = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readonly") if mibBuilder.loadTexts: lineModuleDescription.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleDescription.setDescription('This object contains description of the line module.') lineModuleSerialNum = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 11), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 11))).setMaxAccess("readonly") if mibBuilder.loadTexts: lineModuleSerialNum.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleSerialNum.setDescription('This object contains Serial number of the line module.') lineModuleHWRev = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 12), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 2))).setMaxAccess("readonly") if mibBuilder.loadTexts: lineModuleHWRev.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleHWRev.setDescription('This object contains Hardware revision for line module.') lineModuleFWRev = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: lineModuleFWRev.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleFWRev.setDescription('Firmware revision for line module. The current version does not have any firmware, hence will always contains zero length octet string.') lineModuleState = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notPresent", 1), ("present", 2), ("invalid", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: lineModuleState.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleState.setDescription('line module status.') moduleTrapAlarmSeverity = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("minor", 1), ("major", 2), ("dontCare", 3), ("critical", 4), ("error", 5), ("warning", 6), ("notice", 7), ("info", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: moduleTrapAlarmSeverity.setStatus('mandatory') if mibBuilder.loadTexts: moduleTrapAlarmSeverity.setDescription('This object is sent to managers as part of all Trap PDUs, to determine the module alarm severity. An implementation may not support all the possible values. The Possible values are : major (1) : Major Service has been impacted minor (2) : Minor Service has been lost dontCare (3) : severity is not applicable critical (4) : affects existing data traffic error (5) : error has occurred warning (6) : a threshold has been reached notice (7) : a normal but significant event has occurred info (8) : informational ') mibVersionNumber = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 16), Integer32().clone(2)).setMaxAccess("readonly") if mibBuilder.loadTexts: mibVersionNumber.setStatus('mandatory') if mibBuilder.loadTexts: mibVersionNumber.setDescription('MIB version number. Updated when any part of the MIB changes. ') configChangeTypeBitMap = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 17), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: configChangeTypeBitMap.setStatus('mandatory') if mibBuilder.loadTexts: configChangeTypeBitMap.setDescription('Configuration change Type BitMap bit 0 set = Card Configuration Change bit 1 set = Line Configuration Change bit 2 set = Port Configuration Change bit 3 set = Chan Configuration Change bit 4 set = STUN protocol group configuration Change bit 5 set = STUN port configuration Change bit 6 set = STUN route configuration Change bit 7 set = BSTUN protocol configuration Change bit 8 set = BSTUN port configuration Change bit 9 set = BSTUN route configuration Change bit 10 set = FRASBNN route configuration Change bit 11 set = FRASBAN route configuration Change bit 12 set = SDLC port configuration Change bit 13 set = SDLC LS configuration Change bit 14 set = BSC port configuration Change bit 15 set = LLC port configuration Change bit 16 set = card LCN partition change (controller based only) bit 17 set = port resource partition change (under any partition type) bit 18 set = VISM Endpoint Configuration Change bit 19 set = Egress Q configuration change default value is 0, no change This object makes sense only in traps. A GET on this may not return a Useful result. Bit 19 is not applicable for MGX 8850 Release 1.x.x and MGX 8220 ') configChangeObjectIndex = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: configChangeObjectIndex.setStatus('mandatory') if mibBuilder.loadTexts: configChangeObjectIndex.setDescription("Configuration change object index, could be line number or port number or channel number depends on the type bitmap, for port resouce partition change (bit 17), this index is actually constructed by (portNum << 16 | controller) because the table has two indices. When the 'Line Configuration Change' bit is set, the configChangeObjectIndex has the following special meanings in IMATM and FRSM-2CT3 cards: IMATM - configChangeObjectIndex range between 1..8 indicates that the configuration change refers to the DS1 line index. A value of 9 indicates that the configuration change refers to the DS3 line index. FRSM-2CT3 - configChangeObjectIndex range between 1..56 indicates that the configuration change refers to the DS1 line index. A value of (128 + n) refers to DS3 line index numbered 'n'. This object makes sense only in traps. A GET on this may not return a Useful result. ") configChangeStatus = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly") if mibBuilder.loadTexts: configChangeStatus.setStatus('mandatory') if mibBuilder.loadTexts: configChangeStatus.setDescription('This object is applicable only for traps. The SNMP operation may not be meaningful. The value contained in this object is same as the value of the other objects which are used for adding/deleting/modifying the row. The possible values are 0 - No meaning and is not applicable. 1 - add [ Row added ] 2 - delete [ Row deleted ] 3 - mod [ Row modified ] This value and value contained in configChangeTypeBitMap represent the configuration change operation. The default value is 0 and it does not represent any status.') cardIntegratedAlarmBitMap = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 20), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cardIntegratedAlarmBitMap.setStatus('mandatory') if mibBuilder.loadTexts: cardIntegratedAlarmBitMap.setDescription('Bit position represents the different types of alarm for ASC: bit 0: ShelfFunctionModuleState (BNM only) (failed/boot/mismatch/heldinReset) bit 1: LineModuleState (BNM only) (notPresent/invalid) bit 2: ASMPhysicalAlarmState (BNM only) bit 3: ATMLMIFailure (ASC only) bit 4: LineAlarmState (BNM only) bit 5: LineStatisticalAlarmState (BNM only) bit 6: PLCPAlarmState (BNM only) bit 7: PLCPStatisticalAlarmState (BNM only) bit 8: SmConnectionFailureAlarm for SM: bit 0: ShelfFunctionModuleState (failed/boot/mismatch/heldinReset) bit 1: LineModuleState (notPresent/invalid) bit 2: PortLMIFailure bit 3: LineAlarmState bit 4: LineStatisticalAlarmState bit 5: FrameRelayPortState (RemoteLoopback/ FailedDueToLine/ FailedDueToSig) bit 6: ChannelState for PXM/SRM Only (MGX8850 Platfrom): Only those marked with SRM are valid for both PXM/SRM. The rest are valid only for PXM. bit 0 : ShelfFunctionModuleState bit 1 : Backcard Line Module (SRM/PXM) This Alarm is generated when the Line Module (Trunk Backcard) is removed or goes to a mismatch state(or backcard type is unknown). bit 2 : Backcard UIModule This Alarm is generated when the UI backcard is removed or goes to a mismatch state (or backcard type is unknown). bit 3 : ASM Physical Alarm This specifies whether any of the environmental monitoring components like Temperature, Voltage Supply, Fan Speed have gone into alarm. bit 4 : ATM LMI Failure bit 5 : Line Alarm (SRM/PXM) bit 6 : Line Statistical Alarm (SRM/PXM) bit 7 : Lines Alarm (SRM/PXM) bit 8 : PLCP Alarm bit 9 : PLCP Statistical Alarm bit 10 : Connections exist on removed SM bit 11 : Disk related Failure on first PXM slot bit 12 : Disk related Failure on second PXM slot The Disk Alarms are generated when any of the file operations on Disk like open,read,write, lseek etc fail. VSM Alarms bit 13 : Port LMI Failure bit 14 : Port State Alarm bit 15 : Channel Shelf Alarm bit 16 : Taskmon Task Suspended bit 17 : Excess Power Consumption bit 30 : bit set(1) major alarm, else (0) minor alarm ') cleiCode = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 21), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 10))).setMaxAccess("readonly") if mibBuilder.loadTexts: cleiCode.setStatus('mandatory') if mibBuilder.loadTexts: cleiCode.setDescription('Common Language Equipment(CLEI) Code. ') macAddress = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 22), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: macAddress.setStatus('mandatory') if mibBuilder.loadTexts: macAddress.setDescription('Ethernet address (base address) stored in NVRAM, entered by manfacturing. ') macAddrBlkSize = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 23), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: macAddrBlkSize.setStatus('mandatory') if mibBuilder.loadTexts: macAddrBlkSize.setDescription('The MAC address block size, entered by manufacturing. ') finalTestTechnician = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 24), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 6))).setMaxAccess("readonly") if mibBuilder.loadTexts: finalTestTechnician.setStatus('mandatory') if mibBuilder.loadTexts: finalTestTechnician.setDescription('The Final Test Technician Employee Identification Number. ') hwFailures = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 25), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hwFailures.setStatus('mandatory') if mibBuilder.loadTexts: hwFailures.setDescription('Hardware failure code.') hwHistory = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 26), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hwHistory.setStatus('mandatory') if mibBuilder.loadTexts: hwHistory.setDescription('RMA Test History - RMA Failure Code.') secLineModuleType = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 27), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 48, 49, 50, 51, 60, 61, 62, 63, 70, 71, 80, 81, 500, 501, 502, 503, 504, 505, 506, 507, 511, 512, 513, 514, 515, 1006))).clone(namedValues=NamedValues(("other", 1), ("lm-ASC", 2), ("lm-DB15-4T1", 16), ("lm-DB15-4E1", 17), ("lm-BNC-4E1", 18), ("lm-DB15-4T1-R", 19), ("lm-DB15-4E1-R", 20), ("lm-BNC-4E1-R", 21), ("lm-RJ48-8T1", 22), ("lm-RJ48-8E1", 23), ("lm-SMB-8E1", 24), ("lm-RJ48-T3T1", 25), ("lm-RJ48-E3E1", 26), ("lm-RJ48-T3E1", 27), ("lm-SMB-E3E1", 28), ("lm-RJ48-E3T1", 29), ("lm-SMB-T3E1", 30), ("lm-T3E3-D", 32), ("lm-T3E3-B", 33), ("lm-155-SMF", 34), ("lm-155-UTP", 35), ("lm-RJ48-8T1-R", 48), ("lm-RJ48-8E1-R", 49), ("lm-SMB-8E1-R", 50), ("lm-3T3-B", 51), ("lm-HS1-4X21", 60), ("lm-HS1-3HSSI", 61), ("lm-HS1-4V35", 62), ("lm-12In1-8s", 63), ("lm-BSCSM-2", 70), ("lm-BSCSM-4", 71), ("lm-BNC-2T3", 80), ("lm-BNC-2E3", 81), ("pxm-ui", 500), ("smfir-1-622", 501), ("smflr-1-622", 502), ("smfir15-1-622", 503), ("smflr15-1-622", 504), ("mmf-4-155", 505), ("smfir-4-155", 506), ("smflr-4-155", 507), ("rj45-fe", 511), ("mmf-fe", 512), ("mmf-fddi", 513), ("smf-fddi", 514), ("rj45-4e", 515), ("pxm-ui-s3", 1006))).clone('other')).setMaxAccess("readonly") if mibBuilder.loadTexts: secLineModuleType.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleType.setDescription('This object contains the type of secondary line module(back card). Physically it is the bottom card behind the backplane. Normally with connectors for physical devices. These are specific to the front or function modules. This Object is applicable only to selected MGX switches. ') secLineModuleDescription = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 28), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readonly") if mibBuilder.loadTexts: secLineModuleDescription.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleDescription.setDescription('Description of the Secondary line module. This Object is applicable only to selected MGX switches. ') secLineModuleSerialNum = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 29), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 11))).setMaxAccess("readonly") if mibBuilder.loadTexts: secLineModuleSerialNum.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleSerialNum.setDescription('Serial number of the secondary(bottom) line module. This object is applicable only to selected MGX switches. ') secLineModuleHWRev = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 30), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 2))).setMaxAccess("readonly") if mibBuilder.loadTexts: secLineModuleHWRev.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleHWRev.setDescription('Hardware revision for secondary (bottom) line module This object is applicable only to selected MGX switches. ') secLineModuleFWRev = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 31), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: secLineModuleFWRev.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleFWRev.setDescription('Firmware revision for Secondary line module This object is applicable only to selected MGX switches. If there is no Firmware revision, then this object returns 0. ') secLineModuleState = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notPresent", 1), ("present", 2), ("invalid", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: secLineModuleState.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleState.setDescription('line module status of secondary (bottom) back card. This object is applicable only to selected MGX switches.') configChangeParentObjectIndex = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 33), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: configChangeParentObjectIndex.setStatus('mandatory') if mibBuilder.loadTexts: configChangeParentObjectIndex.setDescription(" Parent object index, could be - line index - port index This object will indicate the index of the immediate higher level object (line or port) of configChangeObjectIndex. This object is applicable only when configChangeObjectIndex represents a channel, port, egress Q or resource partition index. Following specifies the mapping between the configChangeObjectIndex and its corresponding configChangeParentObjectIndex. configChangeObjectIndex configChangeParentObjectIndex ----------------------- ----------------------------- Port Index Line Index Egress Q Index Port Index Resource Partition Index Port Index Channel Index Port Index When the 'Port Configuration Change' bit is set, the configChangeParentObjectIndex will represent a 'Line Index' which in turn has the following special meaning in FRSM-2CT3 cards. - configChangeParentObjectIndex range between 1..56 indicates that the configuration change refers to the DS1 line index. A value of (128 + n) refers to DS3 line index numbered 'n'. This object object is applicable only in traps. A GET on this may not return a useful result. This object Object is not applicable to MGX 8850 Release 1.x.x and MGX8220 ") configChangeGrandParentObjectIndex = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 34), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: configChangeGrandParentObjectIndex.setStatus('mandatory') if mibBuilder.loadTexts: configChangeGrandParentObjectIndex.setDescription(" Grand Parent object index, could be - line index This object will indicate the index of the immediate higher level object (line) of configChangeParentObjectIndex. This object is applicable only when configChangeParentObjectIndex represents a port index. Following specifies the mapping between the configChangeParentObjectIndex and its corresponding configChangeGrandParentObjectIndex. When the 'Port Configuration Change' bit is set the configChangeGrandParentObjectIndex will represent a 'Line Index' which in turn has the following special meaning in FRSM-2CT3 cards. - configChangeParentObjectIndex range between 1..56 indicates that the configuration change refers to the DS1 line index. A value of (128 + n) refers to DS3 line index numbered 'n'. This object is applicable only in traps. A GET on this may not return a useful result. This object is not applicable to MGX 8850 release 1.x.x and MGX8220.") configChangeSMSpecificObject = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 35), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 16777215))).setMaxAccess("readonly") if mibBuilder.loadTexts: configChangeSMSpecificObject.setStatus('mandatory') if mibBuilder.loadTexts: configChangeSMSpecificObject.setDescription(' configChangeSMSpecificObject is a generic object which is Service Module Specific. It can be used for different purposes in different cards. The usage of the same with regard to very card type is listed below. FRSM-8T1E1 - used to store portDs0ConfigBitMap FRSM-VHS - used to store portDs0ConfigBitMap CESM-8T1E1 - used to store cesPortDs0ConfigBitMap CESM-T3E3 - not used AUSM-8T1E1 - not used This object is not applicable to MGX 8850 Release 1.x.x and MGX8220.') transId = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 36), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: transId.setStatus('mandatory') if mibBuilder.loadTexts: transId.setDescription('Per card transaction ID. This object is used to keep track of configuration change on the card. The transId will be incremented by one for every configuration change on the card.') interfaceNumOfValidEntries = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: interfaceNumOfValidEntries.setStatus('mandatory') if mibBuilder.loadTexts: interfaceNumOfValidEntries.setDescription('Number of rows in interface Table The number represents the physcial interfaces the module has. ') interfaceLineTable = MibTable((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1), ) if mibBuilder.loadTexts: interfaceLineTable.setStatus('mandatory') if mibBuilder.loadTexts: interfaceLineTable.setDescription('This table has list of the physical interfaces and the services available on this module. ') interfaceLineEntry = MibTableRow((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1), ).setIndexNames((0, "BASIS-GENERIC-MIB", "interfaceLineNum")) if mibBuilder.loadTexts: interfaceLineEntry.setStatus('mandatory') if mibBuilder.loadTexts: interfaceLineEntry.setDescription('An entry for physical interface ') interfaceLineNum = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10))).setMaxAccess("readonly") if mibBuilder.loadTexts: interfaceLineNum.setStatus('mandatory') if mibBuilder.loadTexts: interfaceLineNum.setDescription('An index to uniquely indentify the physical interface and service. Indices 1..8 are used for VISM-8T1/E1. ') interfaceLineType = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 18, 19, 26, 30, 33, 45, 46))).clone(namedValues=NamedValues(("other", 1), ("ds1", 18), ("e1", 19), ("ethernet-3Mbit", 26), ("ds3", 30), ("rs232", 33), ("v35", 45), ("hssi", 46)))).setMaxAccess("readonly") if mibBuilder.loadTexts: interfaceLineType.setStatus('mandatory') if mibBuilder.loadTexts: interfaceLineType.setDescription('This object indicates the type of interfaces provided by this Module. These numbers are from RFC1700.') interfaceNumOfPortsPerLine = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(672)).setMaxAccess("readonly") if mibBuilder.loadTexts: interfaceNumOfPortsPerLine.setStatus('mandatory') if mibBuilder.loadTexts: interfaceNumOfPortsPerLine.setDescription('The number of physical ports of the line type. VISM has a port, but is not linked to these physical lines, hence value=0 is returned. ') interfaceServiceType = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 26, 28, 32, 37, 42))).clone(namedValues=NamedValues(("other", 1), ("ethernet-3Mbit", 26), ("slip", 28), ("frameRelay", 32), ("atm", 37), ("voice", 42)))).setMaxAccess("readonly") if mibBuilder.loadTexts: interfaceServiceType.setStatus('mandatory') if mibBuilder.loadTexts: interfaceServiceType.setDescription('The services available on the interfaceLineType object ') interfaceNumOfPVC = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: interfaceNumOfPVC.setStatus('mandatory') if mibBuilder.loadTexts: interfaceNumOfPVC.setDescription('The Max number of Permanent Virtual Channels available per physical line (line as defined in interfaceLineType). VISM has a PVC but is not linked to the lines, hence value=0 is returned. ') interfaceNumOfEgressQueue = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: interfaceNumOfEgressQueue.setStatus('mandatory') if mibBuilder.loadTexts: interfaceNumOfEgressQueue.setDescription('The Max number of Queues per port. Value=0 is returned for VISM card. ') selfTestEnable = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2))).clone('disable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: selfTestEnable.setStatus('mandatory') if mibBuilder.loadTexts: selfTestEnable.setDescription('This object indicates the self test state 1 ==> self test enabled 2 ==> self test disabled ') selfTestPeriod = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 60)).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: selfTestPeriod.setStatus('mandatory') if mibBuilder.loadTexts: selfTestPeriod.setDescription('Interval (in minutes) for self test. ') selfTestState = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("passed", 1), ("failed", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: selfTestState.setStatus('mandatory') if mibBuilder.loadTexts: selfTestState.setDescription('Self test results for the module. ') selfTestResultDescription = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 40))).setMaxAccess("readonly") if mibBuilder.loadTexts: selfTestResultDescription.setStatus('mandatory') if mibBuilder.loadTexts: selfTestResultDescription.setDescription('Self test Result description ') selfTestClrResultButton = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("clear", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: selfTestClrResultButton.setStatus('mandatory') if mibBuilder.loadTexts: selfTestClrResultButton.setDescription('This object is used for clearing the result of an online diagnostics(or other self tests).') controlMsgCounter = MibIdentifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 4)) riscXmtCtrlMsg = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: riscXmtCtrlMsg.setStatus('mandatory') if mibBuilder.loadTexts: riscXmtCtrlMsg.setDescription('The number of control Frames transmitted to SAR (from RISC) maintained by RISC ') riscRcvCtrlMsg = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: riscRcvCtrlMsg.setStatus('mandatory') if mibBuilder.loadTexts: riscRcvCtrlMsg.setDescription('The number of control Frames received from SAR (to RISC) maintained by RISC ') sarXmtCtrlMsg = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sarXmtCtrlMsg.setStatus('mandatory') if mibBuilder.loadTexts: sarXmtCtrlMsg.setDescription('The number of control Frames transmitted to RISC from SAR maintained by SAR (should be equal to (riscRcvCtrlMsg) ') sarRcvCtrlMsg = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sarRcvCtrlMsg.setStatus('mandatory') if mibBuilder.loadTexts: sarRcvCtrlMsg.setDescription('The number of control Frames received to SAR from RISC maintained by SAR (should be equal to (riscXmtCtrlMsg) ') sarCtrlMsgDiscLenErr = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sarCtrlMsgDiscLenErr.setStatus('mandatory') if mibBuilder.loadTexts: sarCtrlMsgDiscLenErr.setDescription('Total control (management) frames (for MGX8800) or cells(for MGX8220) discarded due to illegal length error ') sarCtrlMsgDiscCRCErr = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sarCtrlMsgDiscCRCErr.setStatus('mandatory') if mibBuilder.loadTexts: sarCtrlMsgDiscCRCErr.setDescription('Total control (management) frames (MGX8800) or cells(MGX8220) discard due to illegal CRC error. ') sarCtrlMsgDiscUnknownChan = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sarCtrlMsgDiscUnknownChan.setStatus('mandatory') if mibBuilder.loadTexts: sarCtrlMsgDiscUnknownChan.setDescription('Count of discarded control message due to unknown channel error.') sarCtrlMsgLastUnkownChan = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: sarCtrlMsgLastUnkownChan.setStatus('mandatory') if mibBuilder.loadTexts: sarCtrlMsgLastUnkownChan.setDescription('The control cell header Rcvd of the last unknown channel.') ctrlMsgClrButton = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("clear", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctrlMsgClrButton.setStatus('mandatory') if mibBuilder.loadTexts: ctrlMsgClrButton.setDescription('This object is used for clearing the messages in controlMsgCounter group.') sarChannelCounter = MibIdentifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 5)) chanNumOfValidEntries = MibScalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: chanNumOfValidEntries.setStatus('mandatory') if mibBuilder.loadTexts: chanNumOfValidEntries.setDescription('Number of entries in the sar channel table ') sarChannelCounterTable = MibTable((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1), ) if mibBuilder.loadTexts: sarChannelCounterTable.setStatus('mandatory') if mibBuilder.loadTexts: sarChannelCounterTable.setDescription('The table is for logical channels This table contains the counters for cells transmitted on each channel.') sarChannelCounterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1), ).setIndexNames((0, "BASIS-GENERIC-MIB", "sarShelfNum"), (0, "BASIS-GENERIC-MIB", "sarSlotNum"), (0, "BASIS-GENERIC-MIB", "sarChanNum")) if mibBuilder.loadTexts: sarChannelCounterEntry.setStatus('mandatory') if mibBuilder.loadTexts: sarChannelCounterEntry.setDescription(' An entry for logical channel ') sarShelfNum = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4))).setMaxAccess("readonly") if mibBuilder.loadTexts: sarShelfNum.setStatus('mandatory') if mibBuilder.loadTexts: sarShelfNum.setDescription('Shelf number ') sarSlotNum = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: sarSlotNum.setStatus('mandatory') if mibBuilder.loadTexts: sarSlotNum.setDescription('Slot number, the slot and shelf info is required here because BSC sends the OAM cells for the FRSM cards that have failed BSC could have upto 4000 connections in this table.') sarChanNum = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4015))).setMaxAccess("readonly") if mibBuilder.loadTexts: sarChanNum.setStatus('mandatory') if mibBuilder.loadTexts: sarChanNum.setDescription(' BSC could have upto 4000 connections in this table ') xmtCells = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xmtCells.setStatus('mandatory') if mibBuilder.loadTexts: xmtCells.setDescription('The number of cells transmitted on this channel. ') xmtCellsCLP = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xmtCellsCLP.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsCLP.setDescription('The total number of CLP cells that were transmitted on this channel.') xmtCellsAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xmtCellsAIS.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsAIS.setDescription('The number of AIS cells that were transmitted on this channel. ') xmtCellsFERF = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xmtCellsFERF.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsFERF.setDescription('The number of FERF cells that were transmitted on this channel. ') xmtCellsBCM = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xmtCellsBCM.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsBCM.setDescription('The number of BCM cells that were transmitted on this channel.') xmtCellsEnd2EndLpBk = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xmtCellsEnd2EndLpBk.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsEnd2EndLpBk.setDescription('The number of End2End loop cells that were transmitted on this channel.') xmtCellsSegmentLpBk = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xmtCellsSegmentLpBk.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsSegmentLpBk.setDescription('The number of segment loop cells that were transmitted on this channel.') xmtCellsDiscShelfAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xmtCellsDiscShelfAlarm.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsDiscShelfAlarm.setDescription('The number of cells discard due to Shelfalarm on this channel. ') rcvCells = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rcvCells.setStatus('mandatory') if mibBuilder.loadTexts: rcvCells.setDescription('The number of cells that were received on this channel. ') rcvCellsCLP = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rcvCellsCLP.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsCLP.setDescription('The number of CLP cells that were received on this channel. ') rcvCellsAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rcvCellsAIS.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsAIS.setDescription('The number of AIS cells that were received on this channel. ') rcvCellsFERF = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rcvCellsFERF.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsFERF.setDescription('The number of FERF cells that were received on this channel. ') rcvCellsBCM = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rcvCellsBCM.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsBCM.setDescription('The number of BCM cells that were received on this channel. ') rcvCellsEnd2EndLpBk = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rcvCellsEnd2EndLpBk.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsEnd2EndLpBk.setDescription('The number of End2End loop cells that were received on this channel.') rcvCellsSegmentLpBk = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rcvCellsSegmentLpBk.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsSegmentLpBk.setDescription('The number of segment loop cells that were received on this channel. ') rcvCellsDiscOAM = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rcvCellsDiscOAM.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsDiscOAM.setDescription('The number of cells that had CRC error on OAM cells ') sarClrButton = MibTableColumn((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("clear", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: sarClrButton.setStatus('mandatory') if mibBuilder.loadTexts: sarClrButton.setDescription('clear the counters in the table ') mibBuilder.exportSymbols("BASIS-GENERIC-MIB", configChangeObjectIndex=configChangeObjectIndex, functionModuleFWRev=functionModuleFWRev, interfaceLineNum=interfaceLineNum, cardSelfTest=cardSelfTest, rcvCellsCLP=rcvCellsCLP, sarCtrlMsgDiscLenErr=sarCtrlMsgDiscLenErr, ctrlMsgClrButton=ctrlMsgClrButton, xmtCellsSegmentLpBk=xmtCellsSegmentLpBk, macAddrBlkSize=macAddrBlkSize, interfaceNumOfEgressQueue=interfaceNumOfEgressQueue, moduleTrapAlarmSeverity=moduleTrapAlarmSeverity, chanNumOfValidEntries=chanNumOfValidEntries, interfaceLineType=interfaceLineType, interfaceServiceType=interfaceServiceType, interfaceNumOfPortsPerLine=interfaceNumOfPortsPerLine, lineModuleDescription=lineModuleDescription, lineModuleFWRev=lineModuleFWRev, secLineModuleSerialNum=secLineModuleSerialNum, xmtCellsAIS=xmtCellsAIS, xmtCellsEnd2EndLpBk=xmtCellsEnd2EndLpBk, selfTestResultDescription=selfTestResultDescription, sarSlotNum=sarSlotNum, functionModuleState=functionModuleState, selfTestEnable=selfTestEnable, functionModuleDescription=functionModuleDescription, interfaceLineTable=interfaceLineTable, sarChannelCounterEntry=sarChannelCounterEntry, selfTestPeriod=selfTestPeriod, sarChanNum=sarChanNum, rcvCellsDiscOAM=rcvCellsDiscOAM, sarCtrlMsgDiscUnknownChan=sarCtrlMsgDiscUnknownChan, sarRcvCtrlMsg=sarRcvCtrlMsg, riscXmtCtrlMsg=riscXmtCtrlMsg, functionModuleSerialNum=functionModuleSerialNum, configChangeGrandParentObjectIndex=configChangeGrandParentObjectIndex, xmtCellsCLP=xmtCellsCLP, lineModuleHWRev=lineModuleHWRev, selfTestClrResultButton=selfTestClrResultButton, hwHistory=hwHistory, xmtCells=xmtCells, functionModuleType=functionModuleType, functionModuleResetReason=functionModuleResetReason, selfTestState=selfTestState, xmtCellsBCM=xmtCellsBCM, secLineModuleHWRev=secLineModuleHWRev, interfaceNumOfPVC=interfaceNumOfPVC, rcvCellsEnd2EndLpBk=rcvCellsEnd2EndLpBk, secLineModuleFWRev=secLineModuleFWRev, rcvCells=rcvCells, sarXmtCtrlMsg=sarXmtCtrlMsg, riscRcvCtrlMsg=riscRcvCtrlMsg, cardInformation=cardInformation, controlMsgCounter=controlMsgCounter, sarChannelCounter=sarChannelCounter, configChangeStatus=configChangeStatus, rcvCellsSegmentLpBk=rcvCellsSegmentLpBk, rcvCellsBCM=rcvCellsBCM, cleiCode=cleiCode, secLineModuleState=secLineModuleState, mibVersionNumber=mibVersionNumber, sarCtrlMsgLastUnkownChan=sarCtrlMsgLastUnkownChan, secLineModuleType=secLineModuleType, configChangeParentObjectIndex=configChangeParentObjectIndex, transId=transId, lineModuleState=lineModuleState, rcvCellsFERF=rcvCellsFERF, sarChannelCounterTable=sarChannelCounterTable, functionModuleHWRev=functionModuleHWRev, hwFailures=hwFailures, configChangeSMSpecificObject=configChangeSMSpecificObject, xmtCellsDiscShelfAlarm=xmtCellsDiscShelfAlarm, configChangeTypeBitMap=configChangeTypeBitMap, lineModuleType=lineModuleType, interfaceNumOfValidEntries=interfaceNumOfValidEntries, interfaceLineEntry=interfaceLineEntry, cardInterface=cardInterface, sarClrButton=sarClrButton, lineModuleSerialNum=lineModuleSerialNum, macAddress=macAddress, cardIntegratedAlarmBitMap=cardIntegratedAlarmBitMap, sarCtrlMsgDiscCRCErr=sarCtrlMsgDiscCRCErr, rcvCellsAIS=rcvCellsAIS, sarShelfNum=sarShelfNum, moduleSlotNumber=moduleSlotNumber, secLineModuleDescription=secLineModuleDescription, xmtCellsFERF=xmtCellsFERF, finalTestTechnician=finalTestTechnician)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion') (card_generic,) = mibBuilder.importSymbols('BASIS-MIB', 'cardGeneric') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mib_scalar, mib_table, mib_table_row, mib_table_column, counter32, iso, unsigned32, module_identity, integer32, bits, notification_type, object_identity, time_ticks, counter64, gauge32, mib_identifier, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32', 'iso', 'Unsigned32', 'ModuleIdentity', 'Integer32', 'Bits', 'NotificationType', 'ObjectIdentity', 'TimeTicks', 'Counter64', 'Gauge32', 'MibIdentifier', 'IpAddress') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') card_information = mib_identifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 1)) card_interface = mib_identifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 2)) card_self_test = mib_identifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 3)) module_slot_number = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 32))).setMaxAccess('readonly') if mibBuilder.loadTexts: moduleSlotNumber.setStatus('mandatory') if mibBuilder.loadTexts: moduleSlotNumber.setDescription('Slot number this card is present ') function_module_type = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 10, 11, 12, 20, 21, 22, 23, 24, 25, 30, 31, 32, 33, 34, 35, 36, 37, 40, 41, 50, 51, 52, 53, 60, 61, 70, 71, 72, 73, 80, 90, 91, 100, 101, 110, 111, 120, 121, 130, 131, 132, 133, 134, 135, 136, 137, 140, 141, 150, 151, 563, 564, 787, 1000, 1001, 1002, 1003, 2000, 2001))).clone(namedValues=named_values(('other', 1), ('asc', 2), ('bnm-T3', 10), ('bnm-E3', 11), ('bnm-155', 12), ('srm-4T1E1', 20), ('srm-3T3', 21), ('srme-1OC3', 22), ('srme-1STS3', 23), ('srme-NOBC', 24), ('srm-3T3-NOBC', 25), ('frsm-4T1', 30), ('frsm-4E1', 31), ('frsm-4T1-C', 32), ('frsm-4E1-C', 33), ('frsm-hs1', 34), ('frsm-8T1', 35), ('frsm-8E1', 36), ('frsm-hs1b', 37), ('ausm-4T1', 40), ('ausm-4E1', 41), ('ausm-8T1', 50), ('ausm-8E1', 51), ('ausmB-8T1', 52), ('ausmB-8E1', 53), ('cesm-4T1', 60), ('cesm-4E1', 61), ('imatm-T3T1', 70), ('imatm-E3E1', 71), ('imatmB-8T1', 72), ('imatmB-8E1', 73), ('frasm-8T1', 80), ('cesm-8T1', 90), ('cesm-8E1', 91), ('bscsm-2', 100), ('bscsm-4', 101), ('atmt-8T1', 110), ('atmt-8E1', 111), ('frt-8T1', 120), ('frt-8E1', 121), ('frsm-2ct3', 130), ('frsm-2t3', 131), ('frsm-2e3', 132), ('frsm-hs2', 133), ('frsm-2t3b', 134), ('frsm-2e3b', 135), ('frsm-hs2b-hssi', 136), ('frsm-hs2b-12In1', 137), ('cesm-T3', 140), ('cesm-E3', 141), ('vism-8T1', 150), ('vism-8E1', 151), ('vism-pr-8T1', 563), ('vism-pr-8E1', 564), ('cesmB-8T1', 787), ('pxm1', 1000), ('pxm1-2t3e3', 1001), ('pxm1-4oc3', 1002), ('pxm1-oc12', 1003), ('rpm', 2000), ('rpm-pr', 2001))).clone('other')).setMaxAccess('readonly') if mibBuilder.loadTexts: functionModuleType.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleType.setDescription('This object holds the type of the card. The card can type is for Processor module as well as service module. ') function_module_description = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readonly') if mibBuilder.loadTexts: functionModuleDescription.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleDescription.setDescription('Describes the card ') function_module_serial_num = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 4), display_string().subtype(subtypeSpec=value_size_constraint(0, 11))).setMaxAccess('readonly') if mibBuilder.loadTexts: functionModuleSerialNum.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleSerialNum.setDescription('Serial number of the function Module.') function_module_hw_rev = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 5), display_string().subtype(subtypeSpec=value_size_constraint(0, 2))).setMaxAccess('readonly') if mibBuilder.loadTexts: functionModuleHWRev.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleHWRev.setDescription('Hardware revision number for function Module.') function_module_fw_rev = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 6), display_string().subtype(subtypeSpec=value_size_constraint(0, 8))).setMaxAccess('readonly') if mibBuilder.loadTexts: functionModuleFWRev.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleFWRev.setDescription('Firmware revision number of the function Module.') function_module_state = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17))).clone(namedValues=named_values(('nocard', 1), ('standby', 2), ('active', 3), ('failed', 4), ('selfTest', 5), ('heldInReset', 6), ('boot', 7), ('mismatch', 8), ('unknown', 9), ('coreCardMisMatch', 10), ('blocked', 11), ('reserved', 12), ('hold', 13), ('notResponding', 14), ('cardinit', 17)))).setMaxAccess('readonly') if mibBuilder.loadTexts: functionModuleState.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleState.setDescription("This object holds the status of a card in a particular shelf-slot. The possible values are : nocard(1) : card not present. standby(2) : card in standby state. The card is in ready state and will be ready to take over the service if the corresponding active card(redundant) fails. active(3) : card in active state. The card is providing the service. failed(4) : card in failed state. The card can come out of this state only after user intervention (Reset or running some CLI commands). selfTest(5) : online diagnostics is being run in card. heldInReset(6) : The card configuration is being cleared. No requests can be serviced. boot(7) : card in boot state. mismatch(8) : card is not compatible with the current configuration. Card was correctly provisioned earlier, however the card was replaced by an incompatible card. This state can be resolved by clearing the configuration, or replacing with the appropriate card. unknown(9) : could not determine the state coreCardMisMatch(10) : Controller Card(PXM/ASC etc) and SRM(Service Resource Module) combination does not match. blocked(11) : In case of 1:N redundancy configuration the secondary card(backup card) is covering one of the primary card and can not cover any other card in the group if there is a failure. Redundancy is blocked. hold(13) : The standby controller card assumes the hold state during PXM upgrades. In this state, the standby PXM will be running a different software but will be receiving all standby updates(BRAM and Database). This state is applicable only for MGX8250 Platform. notResponding(14): Response from the Service Module has become slow probably due to overloading of CPU. No recovery action is required on user part. At present, this state is applicable only for Router Blade(RPM). cardinit(17) : When the physical presence of card has been detected but the communication hasn't yet been established between the controller card (PXM) and Service Module. ") function_module_reset_reason = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18))).clone(namedValues=named_values(('powerUp', 1), ('parityError', 2), ('watchDog', 3), ('resourceOverflow', 4), ('clrAllCnf', 5), ('missingTask', 6), ('pxmLowVoltage', 7), ('resetByEventLogTask', 8), ('resetFromShell', 9), ('unknown', 10), ('resetFromPXM', 11), ('resetSys', 12), ('switchCC', 13), ('sCacheError', 14), ('swError', 15), ('upgrade', 16), ('restoreAllCnf', 17), ('driverError', 18)))).setMaxAccess('readonly') if mibBuilder.loadTexts: functionModuleResetReason.setStatus('mandatory') if mibBuilder.loadTexts: functionModuleResetReason.setDescription('Last reason for card to reset. The possible values are : powerUp(1) : power up parityError(2) : parity error watchDog(3) : watchdog resourceOverflow (4) : resource overflow clrAllCnf (5) : configuration of the shelf is cleared. missingTask (6) : task is missing pxmLowVoltage(7): low voltage detected on PXM resetByEventLogTask(8): resetFromShell(9): command is run from command shell unknown(10) : resetFromPXM(11) : Controller Card(PXM) reset the card. resetSys(12) : due to resetsys CLI Command. switchCC(13) : due to switch over CLI command. sCacheError(14) : swError(15) : software error. upgrade(16) : upgrade restoreAllCnf(17): restore configuration. driverError(18) : driver error. Valid values for VISM: powerUp, watchDog, resetFromShell and resetFromPXM. ') line_module_type = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 48, 49, 50, 51, 60, 61, 62, 63, 70, 71, 80, 81, 500, 501, 502, 503, 504, 505, 506, 507, 511, 512, 513, 514, 515, 1006, 1050, 1051, 1052))).clone(namedValues=named_values(('other', 1), ('lm-ASC', 2), ('lm-DB15-4T1', 16), ('lm-DB15-4E1', 17), ('lm-BNC-4E1', 18), ('lm-DB15-4T1-R', 19), ('lm-DB15-4E1-R', 20), ('lm-BNC-4E1-R', 21), ('lm-RJ48-8T1', 22), ('lm-RJ48-8E1', 23), ('lm-SMB-8E1', 24), ('lm-RJ48-T3T1', 25), ('lm-RJ48-E3E1', 26), ('lm-RJ48-T3E1', 27), ('lm-SMB-E3E1', 28), ('lm-RJ48-E3T1', 29), ('lm-SMB-T3E1', 30), ('lm-T3E3-D', 32), ('lm-T3E3-B', 33), ('lm-155-SMF', 34), ('lm-155-UTP', 35), ('lm-RJ48-8T1-R', 48), ('lm-RJ48-8E1-R', 49), ('lm-SMB-8E1-R', 50), ('lm-3T3-B', 51), ('lm-HS1-4X21', 60), ('lm-HS1-3HSSI', 61), ('lm-HS1-4V35', 62), ('lm-12In1-8s', 63), ('lm-BSCSM-2', 70), ('lm-BSCSM-4', 71), ('lm-BNC-2T3', 80), ('lm-BNC-2E3', 81), ('pxm-ui', 500), ('smfir-1-622', 501), ('smflr-1-622', 502), ('smfir15-1-622', 503), ('smflr15-1-622', 504), ('mmf-4-155', 505), ('smfir-4-155', 506), ('smflr-4-155', 507), ('rj45-fe', 511), ('mmf-fe', 512), ('mmf-fddi', 513), ('smf-fddi', 514), ('rj45-4e', 515), ('pxm-ui-s3', 1006), ('lm-srme-1OC3-smlr', 1050), ('lm-srme-1OC3-smir', 1051), ('lm-srme-1OC3-smb', 1052))).clone('other')).setMaxAccess('readonly') if mibBuilder.loadTexts: lineModuleType.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleType.setDescription('This object contains the Line Module(back card) type. Physically it is behind the backplane, normally with connectors for physical devices. These are specific to the front or functional modules. ') line_module_description = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 10), display_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readonly') if mibBuilder.loadTexts: lineModuleDescription.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleDescription.setDescription('This object contains description of the line module.') line_module_serial_num = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 11), display_string().subtype(subtypeSpec=value_size_constraint(0, 11))).setMaxAccess('readonly') if mibBuilder.loadTexts: lineModuleSerialNum.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleSerialNum.setDescription('This object contains Serial number of the line module.') line_module_hw_rev = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 12), display_string().subtype(subtypeSpec=value_size_constraint(0, 2))).setMaxAccess('readonly') if mibBuilder.loadTexts: lineModuleHWRev.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleHWRev.setDescription('This object contains Hardware revision for line module.') line_module_fw_rev = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 13), display_string().subtype(subtypeSpec=value_size_constraint(0, 8))).setMaxAccess('readonly') if mibBuilder.loadTexts: lineModuleFWRev.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleFWRev.setDescription('Firmware revision for line module. The current version does not have any firmware, hence will always contains zero length octet string.') line_module_state = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('notPresent', 1), ('present', 2), ('invalid', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: lineModuleState.setStatus('mandatory') if mibBuilder.loadTexts: lineModuleState.setDescription('line module status.') module_trap_alarm_severity = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('minor', 1), ('major', 2), ('dontCare', 3), ('critical', 4), ('error', 5), ('warning', 6), ('notice', 7), ('info', 8)))).setMaxAccess('readonly') if mibBuilder.loadTexts: moduleTrapAlarmSeverity.setStatus('mandatory') if mibBuilder.loadTexts: moduleTrapAlarmSeverity.setDescription('This object is sent to managers as part of all Trap PDUs, to determine the module alarm severity. An implementation may not support all the possible values. The Possible values are : major (1) : Major Service has been impacted minor (2) : Minor Service has been lost dontCare (3) : severity is not applicable critical (4) : affects existing data traffic error (5) : error has occurred warning (6) : a threshold has been reached notice (7) : a normal but significant event has occurred info (8) : informational ') mib_version_number = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 16), integer32().clone(2)).setMaxAccess('readonly') if mibBuilder.loadTexts: mibVersionNumber.setStatus('mandatory') if mibBuilder.loadTexts: mibVersionNumber.setDescription('MIB version number. Updated when any part of the MIB changes. ') config_change_type_bit_map = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 17), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: configChangeTypeBitMap.setStatus('mandatory') if mibBuilder.loadTexts: configChangeTypeBitMap.setDescription('Configuration change Type BitMap bit 0 set = Card Configuration Change bit 1 set = Line Configuration Change bit 2 set = Port Configuration Change bit 3 set = Chan Configuration Change bit 4 set = STUN protocol group configuration Change bit 5 set = STUN port configuration Change bit 6 set = STUN route configuration Change bit 7 set = BSTUN protocol configuration Change bit 8 set = BSTUN port configuration Change bit 9 set = BSTUN route configuration Change bit 10 set = FRASBNN route configuration Change bit 11 set = FRASBAN route configuration Change bit 12 set = SDLC port configuration Change bit 13 set = SDLC LS configuration Change bit 14 set = BSC port configuration Change bit 15 set = LLC port configuration Change bit 16 set = card LCN partition change (controller based only) bit 17 set = port resource partition change (under any partition type) bit 18 set = VISM Endpoint Configuration Change bit 19 set = Egress Q configuration change default value is 0, no change This object makes sense only in traps. A GET on this may not return a Useful result. Bit 19 is not applicable for MGX 8850 Release 1.x.x and MGX 8220 ') config_change_object_index = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 18), integer32().subtype(subtypeSpec=value_range_constraint(1, 1024))).setMaxAccess('readonly') if mibBuilder.loadTexts: configChangeObjectIndex.setStatus('mandatory') if mibBuilder.loadTexts: configChangeObjectIndex.setDescription("Configuration change object index, could be line number or port number or channel number depends on the type bitmap, for port resouce partition change (bit 17), this index is actually constructed by (portNum << 16 | controller) because the table has two indices. When the 'Line Configuration Change' bit is set, the configChangeObjectIndex has the following special meanings in IMATM and FRSM-2CT3 cards: IMATM - configChangeObjectIndex range between 1..8 indicates that the configuration change refers to the DS1 line index. A value of 9 indicates that the configuration change refers to the DS3 line index. FRSM-2CT3 - configChangeObjectIndex range between 1..56 indicates that the configuration change refers to the DS1 line index. A value of (128 + n) refers to DS3 line index numbered 'n'. This object makes sense only in traps. A GET on this may not return a Useful result. ") config_change_status = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 19), integer32().subtype(subtypeSpec=value_range_constraint(0, 3))).setMaxAccess('readonly') if mibBuilder.loadTexts: configChangeStatus.setStatus('mandatory') if mibBuilder.loadTexts: configChangeStatus.setDescription('This object is applicable only for traps. The SNMP operation may not be meaningful. The value contained in this object is same as the value of the other objects which are used for adding/deleting/modifying the row. The possible values are 0 - No meaning and is not applicable. 1 - add [ Row added ] 2 - delete [ Row deleted ] 3 - mod [ Row modified ] This value and value contained in configChangeTypeBitMap represent the configuration change operation. The default value is 0 and it does not represent any status.') card_integrated_alarm_bit_map = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 20), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: cardIntegratedAlarmBitMap.setStatus('mandatory') if mibBuilder.loadTexts: cardIntegratedAlarmBitMap.setDescription('Bit position represents the different types of alarm for ASC: bit 0: ShelfFunctionModuleState (BNM only) (failed/boot/mismatch/heldinReset) bit 1: LineModuleState (BNM only) (notPresent/invalid) bit 2: ASMPhysicalAlarmState (BNM only) bit 3: ATMLMIFailure (ASC only) bit 4: LineAlarmState (BNM only) bit 5: LineStatisticalAlarmState (BNM only) bit 6: PLCPAlarmState (BNM only) bit 7: PLCPStatisticalAlarmState (BNM only) bit 8: SmConnectionFailureAlarm for SM: bit 0: ShelfFunctionModuleState (failed/boot/mismatch/heldinReset) bit 1: LineModuleState (notPresent/invalid) bit 2: PortLMIFailure bit 3: LineAlarmState bit 4: LineStatisticalAlarmState bit 5: FrameRelayPortState (RemoteLoopback/ FailedDueToLine/ FailedDueToSig) bit 6: ChannelState for PXM/SRM Only (MGX8850 Platfrom): Only those marked with SRM are valid for both PXM/SRM. The rest are valid only for PXM. bit 0 : ShelfFunctionModuleState bit 1 : Backcard Line Module (SRM/PXM) This Alarm is generated when the Line Module (Trunk Backcard) is removed or goes to a mismatch state(or backcard type is unknown). bit 2 : Backcard UIModule This Alarm is generated when the UI backcard is removed or goes to a mismatch state (or backcard type is unknown). bit 3 : ASM Physical Alarm This specifies whether any of the environmental monitoring components like Temperature, Voltage Supply, Fan Speed have gone into alarm. bit 4 : ATM LMI Failure bit 5 : Line Alarm (SRM/PXM) bit 6 : Line Statistical Alarm (SRM/PXM) bit 7 : Lines Alarm (SRM/PXM) bit 8 : PLCP Alarm bit 9 : PLCP Statistical Alarm bit 10 : Connections exist on removed SM bit 11 : Disk related Failure on first PXM slot bit 12 : Disk related Failure on second PXM slot The Disk Alarms are generated when any of the file operations on Disk like open,read,write, lseek etc fail. VSM Alarms bit 13 : Port LMI Failure bit 14 : Port State Alarm bit 15 : Channel Shelf Alarm bit 16 : Taskmon Task Suspended bit 17 : Excess Power Consumption bit 30 : bit set(1) major alarm, else (0) minor alarm ') clei_code = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 21), display_string().subtype(subtypeSpec=value_size_constraint(0, 10))).setMaxAccess('readonly') if mibBuilder.loadTexts: cleiCode.setStatus('mandatory') if mibBuilder.loadTexts: cleiCode.setDescription('Common Language Equipment(CLEI) Code. ') mac_address = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 22), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: macAddress.setStatus('mandatory') if mibBuilder.loadTexts: macAddress.setDescription('Ethernet address (base address) stored in NVRAM, entered by manfacturing. ') mac_addr_blk_size = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 23), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: macAddrBlkSize.setStatus('mandatory') if mibBuilder.loadTexts: macAddrBlkSize.setDescription('The MAC address block size, entered by manufacturing. ') final_test_technician = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 24), display_string().subtype(subtypeSpec=value_size_constraint(0, 6))).setMaxAccess('readonly') if mibBuilder.loadTexts: finalTestTechnician.setStatus('mandatory') if mibBuilder.loadTexts: finalTestTechnician.setDescription('The Final Test Technician Employee Identification Number. ') hw_failures = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 25), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hwFailures.setStatus('mandatory') if mibBuilder.loadTexts: hwFailures.setDescription('Hardware failure code.') hw_history = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 26), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: hwHistory.setStatus('mandatory') if mibBuilder.loadTexts: hwHistory.setDescription('RMA Test History - RMA Failure Code.') sec_line_module_type = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 27), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 48, 49, 50, 51, 60, 61, 62, 63, 70, 71, 80, 81, 500, 501, 502, 503, 504, 505, 506, 507, 511, 512, 513, 514, 515, 1006))).clone(namedValues=named_values(('other', 1), ('lm-ASC', 2), ('lm-DB15-4T1', 16), ('lm-DB15-4E1', 17), ('lm-BNC-4E1', 18), ('lm-DB15-4T1-R', 19), ('lm-DB15-4E1-R', 20), ('lm-BNC-4E1-R', 21), ('lm-RJ48-8T1', 22), ('lm-RJ48-8E1', 23), ('lm-SMB-8E1', 24), ('lm-RJ48-T3T1', 25), ('lm-RJ48-E3E1', 26), ('lm-RJ48-T3E1', 27), ('lm-SMB-E3E1', 28), ('lm-RJ48-E3T1', 29), ('lm-SMB-T3E1', 30), ('lm-T3E3-D', 32), ('lm-T3E3-B', 33), ('lm-155-SMF', 34), ('lm-155-UTP', 35), ('lm-RJ48-8T1-R', 48), ('lm-RJ48-8E1-R', 49), ('lm-SMB-8E1-R', 50), ('lm-3T3-B', 51), ('lm-HS1-4X21', 60), ('lm-HS1-3HSSI', 61), ('lm-HS1-4V35', 62), ('lm-12In1-8s', 63), ('lm-BSCSM-2', 70), ('lm-BSCSM-4', 71), ('lm-BNC-2T3', 80), ('lm-BNC-2E3', 81), ('pxm-ui', 500), ('smfir-1-622', 501), ('smflr-1-622', 502), ('smfir15-1-622', 503), ('smflr15-1-622', 504), ('mmf-4-155', 505), ('smfir-4-155', 506), ('smflr-4-155', 507), ('rj45-fe', 511), ('mmf-fe', 512), ('mmf-fddi', 513), ('smf-fddi', 514), ('rj45-4e', 515), ('pxm-ui-s3', 1006))).clone('other')).setMaxAccess('readonly') if mibBuilder.loadTexts: secLineModuleType.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleType.setDescription('This object contains the type of secondary line module(back card). Physically it is the bottom card behind the backplane. Normally with connectors for physical devices. These are specific to the front or function modules. This Object is applicable only to selected MGX switches. ') sec_line_module_description = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 28), display_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readonly') if mibBuilder.loadTexts: secLineModuleDescription.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleDescription.setDescription('Description of the Secondary line module. This Object is applicable only to selected MGX switches. ') sec_line_module_serial_num = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 29), display_string().subtype(subtypeSpec=value_size_constraint(0, 11))).setMaxAccess('readonly') if mibBuilder.loadTexts: secLineModuleSerialNum.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleSerialNum.setDescription('Serial number of the secondary(bottom) line module. This object is applicable only to selected MGX switches. ') sec_line_module_hw_rev = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 30), display_string().subtype(subtypeSpec=value_size_constraint(0, 2))).setMaxAccess('readonly') if mibBuilder.loadTexts: secLineModuleHWRev.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleHWRev.setDescription('Hardware revision for secondary (bottom) line module This object is applicable only to selected MGX switches. ') sec_line_module_fw_rev = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 31), display_string().subtype(subtypeSpec=value_size_constraint(0, 8))).setMaxAccess('readonly') if mibBuilder.loadTexts: secLineModuleFWRev.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleFWRev.setDescription('Firmware revision for Secondary line module This object is applicable only to selected MGX switches. If there is no Firmware revision, then this object returns 0. ') sec_line_module_state = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 32), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('notPresent', 1), ('present', 2), ('invalid', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: secLineModuleState.setStatus('mandatory') if mibBuilder.loadTexts: secLineModuleState.setDescription('line module status of secondary (bottom) back card. This object is applicable only to selected MGX switches.') config_change_parent_object_index = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 33), integer32().subtype(subtypeSpec=value_range_constraint(1, 1024))).setMaxAccess('readonly') if mibBuilder.loadTexts: configChangeParentObjectIndex.setStatus('mandatory') if mibBuilder.loadTexts: configChangeParentObjectIndex.setDescription(" Parent object index, could be - line index - port index This object will indicate the index of the immediate higher level object (line or port) of configChangeObjectIndex. This object is applicable only when configChangeObjectIndex represents a channel, port, egress Q or resource partition index. Following specifies the mapping between the configChangeObjectIndex and its corresponding configChangeParentObjectIndex. configChangeObjectIndex configChangeParentObjectIndex ----------------------- ----------------------------- Port Index Line Index Egress Q Index Port Index Resource Partition Index Port Index Channel Index Port Index When the 'Port Configuration Change' bit is set, the configChangeParentObjectIndex will represent a 'Line Index' which in turn has the following special meaning in FRSM-2CT3 cards. - configChangeParentObjectIndex range between 1..56 indicates that the configuration change refers to the DS1 line index. A value of (128 + n) refers to DS3 line index numbered 'n'. This object object is applicable only in traps. A GET on this may not return a useful result. This object Object is not applicable to MGX 8850 Release 1.x.x and MGX8220 ") config_change_grand_parent_object_index = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 34), integer32().subtype(subtypeSpec=value_range_constraint(1, 1024))).setMaxAccess('readonly') if mibBuilder.loadTexts: configChangeGrandParentObjectIndex.setStatus('mandatory') if mibBuilder.loadTexts: configChangeGrandParentObjectIndex.setDescription(" Grand Parent object index, could be - line index This object will indicate the index of the immediate higher level object (line) of configChangeParentObjectIndex. This object is applicable only when configChangeParentObjectIndex represents a port index. Following specifies the mapping between the configChangeParentObjectIndex and its corresponding configChangeGrandParentObjectIndex. When the 'Port Configuration Change' bit is set the configChangeGrandParentObjectIndex will represent a 'Line Index' which in turn has the following special meaning in FRSM-2CT3 cards. - configChangeParentObjectIndex range between 1..56 indicates that the configuration change refers to the DS1 line index. A value of (128 + n) refers to DS3 line index numbered 'n'. This object is applicable only in traps. A GET on this may not return a useful result. This object is not applicable to MGX 8850 release 1.x.x and MGX8220.") config_change_sm_specific_object = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 35), integer32().subtype(subtypeSpec=value_range_constraint(0, 16777215))).setMaxAccess('readonly') if mibBuilder.loadTexts: configChangeSMSpecificObject.setStatus('mandatory') if mibBuilder.loadTexts: configChangeSMSpecificObject.setDescription(' configChangeSMSpecificObject is a generic object which is Service Module Specific. It can be used for different purposes in different cards. The usage of the same with regard to very card type is listed below. FRSM-8T1E1 - used to store portDs0ConfigBitMap FRSM-VHS - used to store portDs0ConfigBitMap CESM-8T1E1 - used to store cesPortDs0ConfigBitMap CESM-T3E3 - not used AUSM-8T1E1 - not used This object is not applicable to MGX 8850 Release 1.x.x and MGX8220.') trans_id = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 1, 36), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: transId.setStatus('mandatory') if mibBuilder.loadTexts: transId.setDescription('Per card transaction ID. This object is used to keep track of configuration change on the card. The transId will be incremented by one for every configuration change on the card.') interface_num_of_valid_entries = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: interfaceNumOfValidEntries.setStatus('mandatory') if mibBuilder.loadTexts: interfaceNumOfValidEntries.setDescription('Number of rows in interface Table The number represents the physcial interfaces the module has. ') interface_line_table = mib_table((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1)) if mibBuilder.loadTexts: interfaceLineTable.setStatus('mandatory') if mibBuilder.loadTexts: interfaceLineTable.setDescription('This table has list of the physical interfaces and the services available on this module. ') interface_line_entry = mib_table_row((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1)).setIndexNames((0, 'BASIS-GENERIC-MIB', 'interfaceLineNum')) if mibBuilder.loadTexts: interfaceLineEntry.setStatus('mandatory') if mibBuilder.loadTexts: interfaceLineEntry.setDescription('An entry for physical interface ') interface_line_num = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 10))).setMaxAccess('readonly') if mibBuilder.loadTexts: interfaceLineNum.setStatus('mandatory') if mibBuilder.loadTexts: interfaceLineNum.setDescription('An index to uniquely indentify the physical interface and service. Indices 1..8 are used for VISM-8T1/E1. ') interface_line_type = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 18, 19, 26, 30, 33, 45, 46))).clone(namedValues=named_values(('other', 1), ('ds1', 18), ('e1', 19), ('ethernet-3Mbit', 26), ('ds3', 30), ('rs232', 33), ('v35', 45), ('hssi', 46)))).setMaxAccess('readonly') if mibBuilder.loadTexts: interfaceLineType.setStatus('mandatory') if mibBuilder.loadTexts: interfaceLineType.setDescription('This object indicates the type of interfaces provided by this Module. These numbers are from RFC1700.') interface_num_of_ports_per_line = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535)).clone(672)).setMaxAccess('readonly') if mibBuilder.loadTexts: interfaceNumOfPortsPerLine.setStatus('mandatory') if mibBuilder.loadTexts: interfaceNumOfPortsPerLine.setDescription('The number of physical ports of the line type. VISM has a port, but is not linked to these physical lines, hence value=0 is returned. ') interface_service_type = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 26, 28, 32, 37, 42))).clone(namedValues=named_values(('other', 1), ('ethernet-3Mbit', 26), ('slip', 28), ('frameRelay', 32), ('atm', 37), ('voice', 42)))).setMaxAccess('readonly') if mibBuilder.loadTexts: interfaceServiceType.setStatus('mandatory') if mibBuilder.loadTexts: interfaceServiceType.setDescription('The services available on the interfaceLineType object ') interface_num_of_pvc = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: interfaceNumOfPVC.setStatus('mandatory') if mibBuilder.loadTexts: interfaceNumOfPVC.setDescription('The Max number of Permanent Virtual Channels available per physical line (line as defined in interfaceLineType). VISM has a PVC but is not linked to the lines, hence value=0 is returned. ') interface_num_of_egress_queue = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 2, 1, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: interfaceNumOfEgressQueue.setStatus('mandatory') if mibBuilder.loadTexts: interfaceNumOfEgressQueue.setDescription('The Max number of Queues per port. Value=0 is returned for VISM card. ') self_test_enable = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disable', 1), ('enable', 2))).clone('disable')).setMaxAccess('readwrite') if mibBuilder.loadTexts: selfTestEnable.setStatus('mandatory') if mibBuilder.loadTexts: selfTestEnable.setDescription('This object indicates the self test state 1 ==> self test enabled 2 ==> self test disabled ') self_test_period = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 60)).clone(1)).setMaxAccess('readwrite') if mibBuilder.loadTexts: selfTestPeriod.setStatus('mandatory') if mibBuilder.loadTexts: selfTestPeriod.setDescription('Interval (in minutes) for self test. ') self_test_state = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('passed', 1), ('failed', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: selfTestState.setStatus('mandatory') if mibBuilder.loadTexts: selfTestState.setDescription('Self test results for the module. ') self_test_result_description = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 4), display_string().subtype(subtypeSpec=value_size_constraint(0, 40))).setMaxAccess('readonly') if mibBuilder.loadTexts: selfTestResultDescription.setStatus('mandatory') if mibBuilder.loadTexts: selfTestResultDescription.setDescription('Self test Result description ') self_test_clr_result_button = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 3, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('clear', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: selfTestClrResultButton.setStatus('mandatory') if mibBuilder.loadTexts: selfTestClrResultButton.setDescription('This object is used for clearing the result of an online diagnostics(or other self tests).') control_msg_counter = mib_identifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 4)) risc_xmt_ctrl_msg = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: riscXmtCtrlMsg.setStatus('mandatory') if mibBuilder.loadTexts: riscXmtCtrlMsg.setDescription('The number of control Frames transmitted to SAR (from RISC) maintained by RISC ') risc_rcv_ctrl_msg = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: riscRcvCtrlMsg.setStatus('mandatory') if mibBuilder.loadTexts: riscRcvCtrlMsg.setDescription('The number of control Frames received from SAR (to RISC) maintained by RISC ') sar_xmt_ctrl_msg = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sarXmtCtrlMsg.setStatus('mandatory') if mibBuilder.loadTexts: sarXmtCtrlMsg.setDescription('The number of control Frames transmitted to RISC from SAR maintained by SAR (should be equal to (riscRcvCtrlMsg) ') sar_rcv_ctrl_msg = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sarRcvCtrlMsg.setStatus('mandatory') if mibBuilder.loadTexts: sarRcvCtrlMsg.setDescription('The number of control Frames received to SAR from RISC maintained by SAR (should be equal to (riscXmtCtrlMsg) ') sar_ctrl_msg_disc_len_err = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sarCtrlMsgDiscLenErr.setStatus('mandatory') if mibBuilder.loadTexts: sarCtrlMsgDiscLenErr.setDescription('Total control (management) frames (for MGX8800) or cells(for MGX8220) discarded due to illegal length error ') sar_ctrl_msg_disc_crc_err = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sarCtrlMsgDiscCRCErr.setStatus('mandatory') if mibBuilder.loadTexts: sarCtrlMsgDiscCRCErr.setDescription('Total control (management) frames (MGX8800) or cells(MGX8220) discard due to illegal CRC error. ') sar_ctrl_msg_disc_unknown_chan = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sarCtrlMsgDiscUnknownChan.setStatus('mandatory') if mibBuilder.loadTexts: sarCtrlMsgDiscUnknownChan.setDescription('Count of discarded control message due to unknown channel error.') sar_ctrl_msg_last_unkown_chan = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 8), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: sarCtrlMsgLastUnkownChan.setStatus('mandatory') if mibBuilder.loadTexts: sarCtrlMsgLastUnkownChan.setDescription('The control cell header Rcvd of the last unknown channel.') ctrl_msg_clr_button = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 4, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('clear', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: ctrlMsgClrButton.setStatus('mandatory') if mibBuilder.loadTexts: ctrlMsgClrButton.setDescription('This object is used for clearing the messages in controlMsgCounter group.') sar_channel_counter = mib_identifier((1, 3, 6, 1, 4, 1, 351, 110, 2, 5)) chan_num_of_valid_entries = mib_scalar((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: chanNumOfValidEntries.setStatus('mandatory') if mibBuilder.loadTexts: chanNumOfValidEntries.setDescription('Number of entries in the sar channel table ') sar_channel_counter_table = mib_table((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1)) if mibBuilder.loadTexts: sarChannelCounterTable.setStatus('mandatory') if mibBuilder.loadTexts: sarChannelCounterTable.setDescription('The table is for logical channels This table contains the counters for cells transmitted on each channel.') sar_channel_counter_entry = mib_table_row((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1)).setIndexNames((0, 'BASIS-GENERIC-MIB', 'sarShelfNum'), (0, 'BASIS-GENERIC-MIB', 'sarSlotNum'), (0, 'BASIS-GENERIC-MIB', 'sarChanNum')) if mibBuilder.loadTexts: sarChannelCounterEntry.setStatus('mandatory') if mibBuilder.loadTexts: sarChannelCounterEntry.setDescription(' An entry for logical channel ') sar_shelf_num = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 4))).setMaxAccess('readonly') if mibBuilder.loadTexts: sarShelfNum.setStatus('mandatory') if mibBuilder.loadTexts: sarShelfNum.setDescription('Shelf number ') sar_slot_num = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 16))).setMaxAccess('readonly') if mibBuilder.loadTexts: sarSlotNum.setStatus('mandatory') if mibBuilder.loadTexts: sarSlotNum.setDescription('Slot number, the slot and shelf info is required here because BSC sends the OAM cells for the FRSM cards that have failed BSC could have upto 4000 connections in this table.') sar_chan_num = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 4015))).setMaxAccess('readonly') if mibBuilder.loadTexts: sarChanNum.setStatus('mandatory') if mibBuilder.loadTexts: sarChanNum.setDescription(' BSC could have upto 4000 connections in this table ') xmt_cells = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xmtCells.setStatus('mandatory') if mibBuilder.loadTexts: xmtCells.setDescription('The number of cells transmitted on this channel. ') xmt_cells_clp = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xmtCellsCLP.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsCLP.setDescription('The total number of CLP cells that were transmitted on this channel.') xmt_cells_ais = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xmtCellsAIS.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsAIS.setDescription('The number of AIS cells that were transmitted on this channel. ') xmt_cells_ferf = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xmtCellsFERF.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsFERF.setDescription('The number of FERF cells that were transmitted on this channel. ') xmt_cells_bcm = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 8), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xmtCellsBCM.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsBCM.setDescription('The number of BCM cells that were transmitted on this channel.') xmt_cells_end2_end_lp_bk = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 9), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xmtCellsEnd2EndLpBk.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsEnd2EndLpBk.setDescription('The number of End2End loop cells that were transmitted on this channel.') xmt_cells_segment_lp_bk = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 10), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xmtCellsSegmentLpBk.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsSegmentLpBk.setDescription('The number of segment loop cells that were transmitted on this channel.') xmt_cells_disc_shelf_alarm = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 11), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xmtCellsDiscShelfAlarm.setStatus('mandatory') if mibBuilder.loadTexts: xmtCellsDiscShelfAlarm.setDescription('The number of cells discard due to Shelfalarm on this channel. ') rcv_cells = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 12), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: rcvCells.setStatus('mandatory') if mibBuilder.loadTexts: rcvCells.setDescription('The number of cells that were received on this channel. ') rcv_cells_clp = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 13), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: rcvCellsCLP.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsCLP.setDescription('The number of CLP cells that were received on this channel. ') rcv_cells_ais = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: rcvCellsAIS.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsAIS.setDescription('The number of AIS cells that were received on this channel. ') rcv_cells_ferf = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: rcvCellsFERF.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsFERF.setDescription('The number of FERF cells that were received on this channel. ') rcv_cells_bcm = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 16), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: rcvCellsBCM.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsBCM.setDescription('The number of BCM cells that were received on this channel. ') rcv_cells_end2_end_lp_bk = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 17), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: rcvCellsEnd2EndLpBk.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsEnd2EndLpBk.setDescription('The number of End2End loop cells that were received on this channel.') rcv_cells_segment_lp_bk = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 18), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: rcvCellsSegmentLpBk.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsSegmentLpBk.setDescription('The number of segment loop cells that were received on this channel. ') rcv_cells_disc_oam = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 19), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: rcvCellsDiscOAM.setStatus('mandatory') if mibBuilder.loadTexts: rcvCellsDiscOAM.setDescription('The number of cells that had CRC error on OAM cells ') sar_clr_button = mib_table_column((1, 3, 6, 1, 4, 1, 351, 110, 2, 5, 1, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('clear', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: sarClrButton.setStatus('mandatory') if mibBuilder.loadTexts: sarClrButton.setDescription('clear the counters in the table ') mibBuilder.exportSymbols('BASIS-GENERIC-MIB', configChangeObjectIndex=configChangeObjectIndex, functionModuleFWRev=functionModuleFWRev, interfaceLineNum=interfaceLineNum, cardSelfTest=cardSelfTest, rcvCellsCLP=rcvCellsCLP, sarCtrlMsgDiscLenErr=sarCtrlMsgDiscLenErr, ctrlMsgClrButton=ctrlMsgClrButton, xmtCellsSegmentLpBk=xmtCellsSegmentLpBk, macAddrBlkSize=macAddrBlkSize, interfaceNumOfEgressQueue=interfaceNumOfEgressQueue, moduleTrapAlarmSeverity=moduleTrapAlarmSeverity, chanNumOfValidEntries=chanNumOfValidEntries, interfaceLineType=interfaceLineType, interfaceServiceType=interfaceServiceType, interfaceNumOfPortsPerLine=interfaceNumOfPortsPerLine, lineModuleDescription=lineModuleDescription, lineModuleFWRev=lineModuleFWRev, secLineModuleSerialNum=secLineModuleSerialNum, xmtCellsAIS=xmtCellsAIS, xmtCellsEnd2EndLpBk=xmtCellsEnd2EndLpBk, selfTestResultDescription=selfTestResultDescription, sarSlotNum=sarSlotNum, functionModuleState=functionModuleState, selfTestEnable=selfTestEnable, functionModuleDescription=functionModuleDescription, interfaceLineTable=interfaceLineTable, sarChannelCounterEntry=sarChannelCounterEntry, selfTestPeriod=selfTestPeriod, sarChanNum=sarChanNum, rcvCellsDiscOAM=rcvCellsDiscOAM, sarCtrlMsgDiscUnknownChan=sarCtrlMsgDiscUnknownChan, sarRcvCtrlMsg=sarRcvCtrlMsg, riscXmtCtrlMsg=riscXmtCtrlMsg, functionModuleSerialNum=functionModuleSerialNum, configChangeGrandParentObjectIndex=configChangeGrandParentObjectIndex, xmtCellsCLP=xmtCellsCLP, lineModuleHWRev=lineModuleHWRev, selfTestClrResultButton=selfTestClrResultButton, hwHistory=hwHistory, xmtCells=xmtCells, functionModuleType=functionModuleType, functionModuleResetReason=functionModuleResetReason, selfTestState=selfTestState, xmtCellsBCM=xmtCellsBCM, secLineModuleHWRev=secLineModuleHWRev, interfaceNumOfPVC=interfaceNumOfPVC, rcvCellsEnd2EndLpBk=rcvCellsEnd2EndLpBk, secLineModuleFWRev=secLineModuleFWRev, rcvCells=rcvCells, sarXmtCtrlMsg=sarXmtCtrlMsg, riscRcvCtrlMsg=riscRcvCtrlMsg, cardInformation=cardInformation, controlMsgCounter=controlMsgCounter, sarChannelCounter=sarChannelCounter, configChangeStatus=configChangeStatus, rcvCellsSegmentLpBk=rcvCellsSegmentLpBk, rcvCellsBCM=rcvCellsBCM, cleiCode=cleiCode, secLineModuleState=secLineModuleState, mibVersionNumber=mibVersionNumber, sarCtrlMsgLastUnkownChan=sarCtrlMsgLastUnkownChan, secLineModuleType=secLineModuleType, configChangeParentObjectIndex=configChangeParentObjectIndex, transId=transId, lineModuleState=lineModuleState, rcvCellsFERF=rcvCellsFERF, sarChannelCounterTable=sarChannelCounterTable, functionModuleHWRev=functionModuleHWRev, hwFailures=hwFailures, configChangeSMSpecificObject=configChangeSMSpecificObject, xmtCellsDiscShelfAlarm=xmtCellsDiscShelfAlarm, configChangeTypeBitMap=configChangeTypeBitMap, lineModuleType=lineModuleType, interfaceNumOfValidEntries=interfaceNumOfValidEntries, interfaceLineEntry=interfaceLineEntry, cardInterface=cardInterface, sarClrButton=sarClrButton, lineModuleSerialNum=lineModuleSerialNum, macAddress=macAddress, cardIntegratedAlarmBitMap=cardIntegratedAlarmBitMap, sarCtrlMsgDiscCRCErr=sarCtrlMsgDiscCRCErr, rcvCellsAIS=rcvCellsAIS, sarShelfNum=sarShelfNum, moduleSlotNumber=moduleSlotNumber, secLineModuleDescription=secLineModuleDescription, xmtCellsFERF=xmtCellsFERF, finalTestTechnician=finalTestTechnician)
class MinStack(object): def __init__(self): self.stack = [] def push(self, x): self.stack.append((x, min(self.getMin(), x))) def pop(self): self.stack.pop() def top(self): return self.stack[-1][0] def getMin(self): return self.stack[-1][1] if self.stack else float('inf')
class Minstack(object): def __init__(self): self.stack = [] def push(self, x): self.stack.append((x, min(self.getMin(), x))) def pop(self): self.stack.pop() def top(self): return self.stack[-1][0] def get_min(self): return self.stack[-1][1] if self.stack else float('inf')
# Definition for an interval. # class Interval: # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution: # @param intervals, a list of Intervals # @param newInterval, a Interval # @return a list of Interval def insert(self, intervals, newInterval): res = [] if len(intervals) == 0: res.append(newInterval) return res # insert the new interval intervals.append(newInterval) # sort list according to the start value intervals.sort(key=lambda x: x.start) res.append(intervals[0]) # scan the list for i in range(1, len(intervals)): cur = intervals[i] pre = res[-1] # check if current interval intersects with previous one if cur.start <= pre.end: res[-1].end = max(pre.end, cur.end) # merge else: res.append(cur) # insert return res
class Solution: def insert(self, intervals, newInterval): res = [] if len(intervals) == 0: res.append(newInterval) return res intervals.append(newInterval) intervals.sort(key=lambda x: x.start) res.append(intervals[0]) for i in range(1, len(intervals)): cur = intervals[i] pre = res[-1] if cur.start <= pre.end: res[-1].end = max(pre.end, cur.end) else: res.append(cur) return res
class dotIFC2X3_Application_t(object): # no doc ApplicationFullName=None ApplicationIdentifier=None Version=None
class Dotifc2X3_Application_T(object): application_full_name = None application_identifier = None version = None
class LaunchAPIException(Exception): def __init__(self, message, status_code): super(Exception, self).__init__(message) self.status_code = status_code class ClientException(LaunchAPIException): pass
class Launchapiexception(Exception): def __init__(self, message, status_code): super(Exception, self).__init__(message) self.status_code = status_code class Clientexception(LaunchAPIException): pass
def main(): OnFwd(OUT_AB, 80) TextOut(0, LCD_LINE1, 20) Wait(2000)
def main(): on_fwd(OUT_AB, 80) text_out(0, LCD_LINE1, 20) wait(2000)
FreeMonoOblique9pt7bBitmaps = [ 0x11, 0x22, 0x24, 0x40, 0x00, 0xC0, 0xDE, 0xE5, 0x29, 0x00, 0x09, 0x05, 0x02, 0x82, 0x47, 0xF8, 0xA0, 0x51, 0xFE, 0x28, 0x14, 0x0A, 0x09, 0x00, 0x08, 0x1D, 0x23, 0x40, 0x70, 0x1C, 0x02, 0x82, 0x84, 0x78, 0x20, 0x20, 0x1C, 0x11, 0x08, 0x83, 0x80, 0x18, 0x71, 0xC0, 0x1C, 0x11, 0x08, 0x83, 0x80, 0x1E, 0x60, 0x81, 0x03, 0x0A, 0x65, 0x46, 0x88, 0xE8, 0xFA, 0x80, 0x12, 0x24, 0x48, 0x88, 0x88, 0x88, 0x80, 0x01, 0x11, 0x11, 0x11, 0x22, 0x44, 0x80, 0x10, 0x22, 0x5B, 0xC3, 0x0A, 0x22, 0x00, 0x04, 0x02, 0x02, 0x1F, 0xF0, 0x80, 0x40, 0x20, 0x00, 0x36, 0x4C, 0x80, 0xFF, 0x80, 0xF0, 0x00, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x08, 0x08, 0x00, 0x1C, 0x45, 0x0A, 0x18, 0x30, 0x61, 0x42, 0x85, 0x11, 0xC0, 0x04, 0x38, 0x90, 0x20, 0x81, 0x02, 0x04, 0x08, 0x23, 0xF8, 0x07, 0x04, 0xC4, 0x20, 0x10, 0x10, 0x30, 0x20, 0x20, 0x60, 0x40, 0x3F, 0x80, 0x0F, 0x00, 0x40, 0x20, 0x20, 0x60, 0x18, 0x04, 0x02, 0x01, 0x43, 0x1E, 0x00, 0x03, 0x05, 0x0A, 0x12, 0x22, 0x22, 0x42, 0x7F, 0x04, 0x04, 0x1E, 0x1F, 0x88, 0x08, 0x05, 0xC3, 0x30, 0x08, 0x04, 0x02, 0x02, 0x42, 0x1E, 0x00, 0x07, 0x18, 0x20, 0x40, 0x5C, 0xA6, 0xC2, 0x82, 0x82, 0xC4, 0x78, 0xFF, 0x04, 0x10, 0x20, 0x82, 0x04, 0x10, 0x20, 0x81, 0x00, 0x1E, 0x23, 0x41, 0x41, 0x62, 0x1C, 0x66, 0x82, 0x82, 0x84, 0x78, 0x1E, 0x23, 0x41, 0x41, 0x43, 0x65, 0x3A, 0x02, 0x04, 0x18, 0xE0, 0x6C, 0x00, 0x36, 0x18, 0xC0, 0x00, 0x19, 0x8C, 0xC4, 0x00, 0x01, 0x83, 0x06, 0x0C, 0x06, 0x00, 0x80, 0x30, 0x04, 0xFF, 0x80, 0x00, 0x1F, 0xF0, 0x20, 0x0C, 0x01, 0x00, 0x60, 0x20, 0x60, 0xC1, 0x80, 0x3D, 0x8E, 0x08, 0x10, 0xC6, 0x08, 0x00, 0x01, 0x80, 0x1C, 0x45, 0x0A, 0x79, 0x34, 0x69, 0x4E, 0x81, 0x03, 0x03, 0xC0, 0x0F, 0x00, 0x60, 0x12, 0x02, 0x40, 0x88, 0x21, 0x07, 0xE1, 0x04, 0x20, 0x5E, 0x3C, 0x3F, 0x84, 0x11, 0x04, 0x82, 0x3F, 0x88, 0x32, 0x04, 0x81, 0x60, 0xBF, 0xC0, 0x1E, 0x98, 0xD0, 0x28, 0x08, 0x04, 0x02, 0x01, 0x00, 0x41, 0x1F, 0x00, 0x3F, 0x0C, 0x22, 0x04, 0x81, 0x20, 0x48, 0x12, 0x09, 0x02, 0x43, 0x3F, 0x00, 0x3F, 0xC4, 0x11, 0x00, 0x88, 0x3E, 0x08, 0x82, 0x00, 0x82, 0x60, 0xBF, 0xE0, 0x3F, 0xE2, 0x08, 0x40, 0x11, 0x03, 0xE0, 0x44, 0x08, 0x01, 0x00, 0x60, 0x1F, 0x00, 0x1E, 0x98, 0xD0, 0x08, 0x08, 0x04, 0x7A, 0x05, 0x02, 0x41, 0x1F, 0x00, 0x3D, 0xE2, 0x18, 0x42, 0x08, 0x43, 0xF8, 0x41, 0x08, 0x21, 0x08, 0x21, 0x1E, 0xF0, 0x3F, 0x82, 0x02, 0x01, 0x00, 0x80, 0x40, 0x20, 0x20, 0x10, 0x7F, 0x00, 0x0F, 0xE0, 0x20, 0x04, 0x00, 0x80, 0x10, 0x02, 0x20, 0x84, 0x10, 0x84, 0x0F, 0x00, 0x3C, 0xE2, 0x10, 0x44, 0x11, 0x02, 0xC0, 0x64, 0x08, 0x81, 0x08, 0x61, 0x1E, 0x38, 0x3E, 0x02, 0x00, 0x80, 0x20, 0x10, 0x04, 0x01, 0x04, 0x42, 0x10, 0xBF, 0xE0, 0x38, 0x38, 0xC3, 0x05, 0x28, 0x29, 0x42, 0x52, 0x13, 0x10, 0x99, 0x84, 0x08, 0x20, 0x47, 0x8F, 0x00, 0x70, 0xE6, 0x08, 0xA1, 0x14, 0x22, 0x48, 0x49, 0x11, 0x22, 0x14, 0x43, 0x1E, 0x20, 0x1E, 0x18, 0x90, 0x28, 0x18, 0x0C, 0x06, 0x05, 0x02, 0x46, 0x1E, 0x00, 0x3F, 0x84, 0x31, 0x04, 0x81, 0x20, 0x8F, 0xC2, 0x00, 0x80, 0x60, 0x3E, 0x00, 0x1E, 0x18, 0x90, 0x28, 0x18, 0x0C, 0x06, 0x05, 0x02, 0x46, 0x1E, 0x08, 0x0F, 0x44, 0x60, 0x3F, 0x84, 0x31, 0x04, 0x81, 0x20, 0x8F, 0xC2, 0x10, 0x84, 0x60, 0xBC, 0x10, 0x0F, 0x88, 0xC8, 0x24, 0x01, 0x80, 0x38, 0x05, 0x02, 0xC2, 0x5E, 0x00, 0xFF, 0xC4, 0x44, 0x02, 0x01, 0x00, 0x80, 0x40, 0x60, 0x20, 0x7E, 0x00, 0xF1, 0xD0, 0x24, 0x09, 0x02, 0x41, 0xA0, 0x48, 0x12, 0x04, 0xC6, 0x1F, 0x00, 0xF1, 0xE8, 0x11, 0x02, 0x20, 0x82, 0x20, 0x44, 0x09, 0x01, 0x40, 0x28, 0x02, 0x00, 0xF1, 0xE8, 0x09, 0x12, 0x26, 0x45, 0x48, 0xAA, 0x29, 0x45, 0x28, 0xC6, 0x18, 0xC0, 0x38, 0xE2, 0x08, 0x26, 0x05, 0x00, 0x40, 0x18, 0x04, 0x81, 0x08, 0x41, 0x1C, 0x70, 0xE3, 0xA0, 0x90, 0x84, 0x81, 0x80, 0x80, 0x40, 0x20, 0x20, 0x7E, 0x00, 0x3F, 0x90, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x82, 0x7F, 0x00, 0x39, 0x08, 0x44, 0x21, 0x08, 0x42, 0x21, 0x0E, 0x00, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11, 0x38, 0x42, 0x11, 0x08, 0x42, 0x10, 0x84, 0x2E, 0x00, 0x08, 0x28, 0x92, 0x18, 0x20, 0xFF, 0xC0, 0xA4, 0x3E, 0x00, 0x80, 0x47, 0xA4, 0x34, 0x12, 0x18, 0xF7, 0x38, 0x01, 0x00, 0x40, 0x09, 0xE1, 0xC6, 0x20, 0x44, 0x09, 0x01, 0x30, 0x46, 0x13, 0xBC, 0x00, 0x1F, 0x48, 0x74, 0x0A, 0x00, 0x80, 0x20, 0x0C, 0x18, 0xF8, 0x01, 0x80, 0x40, 0x23, 0x96, 0x32, 0x0A, 0x05, 0x02, 0x81, 0x61, 0x1F, 0xE0, 0x1F, 0x30, 0xD0, 0x3F, 0xF8, 0x04, 0x01, 0x00, 0x7C, 0x07, 0xC3, 0x00, 0x80, 0xFE, 0x10, 0x04, 0x01, 0x00, 0x40, 0x10, 0x08, 0x0F, 0xE0, 0x1D, 0xD8, 0xC4, 0x12, 0x04, 0x82, 0x20, 0x8C, 0x61, 0xE8, 0x02, 0x01, 0x07, 0x80, 0x30, 0x04, 0x01, 0x00, 0x5C, 0x38, 0x88, 0x22, 0x08, 0x82, 0x21, 0x18, 0x4F, 0x3C, 0x04, 0x04, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0xFF, 0x01, 0x00, 0x80, 0x03, 0xF0, 0x10, 0x08, 0x04, 0x02, 0x02, 0x01, 0x00, 0x80, 0x40, 0x47, 0xC0, 0x38, 0x08, 0x04, 0x02, 0x71, 0x20, 0xA0, 0xA0, 0x68, 0x24, 0x11, 0x38, 0xE0, 0x3C, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0xFF, 0x3E, 0xE2, 0x64, 0x88, 0x91, 0x12, 0x24, 0x48, 0x91, 0x17, 0x33, 0x37, 0x14, 0x4C, 0x24, 0x12, 0x09, 0x08, 0x85, 0xE3, 0x1E, 0x10, 0x90, 0x30, 0x18, 0x0C, 0x0B, 0x08, 0x78, 0x33, 0xC3, 0x8C, 0x40, 0x88, 0x12, 0x02, 0x60, 0x8C, 0x31, 0x78, 0x20, 0x08, 0x03, 0xE0, 0x00, 0x1C, 0xD8, 0xC4, 0x12, 0x04, 0x81, 0x20, 0x4C, 0x21, 0xF8, 0x02, 0x00, 0x81, 0xF0, 0x73, 0x8E, 0x04, 0x04, 0x02, 0x01, 0x00, 0x81, 0xFC, 0x1F, 0x61, 0x40, 0x3C, 0x03, 0x81, 0x82, 0xFC, 0x10, 0x63, 0xF9, 0x02, 0x04, 0x10, 0x20, 0x40, 0x7C, 0xE3, 0x10, 0x90, 0x48, 0x24, 0x22, 0x11, 0x18, 0xF6, 0xF3, 0xD0, 0x44, 0x10, 0x88, 0x24, 0x09, 0x02, 0x80, 0x40, 0xE1, 0xD0, 0x24, 0x91, 0x24, 0x55, 0x19, 0x86, 0x61, 0x10, 0x39, 0xC4, 0x20, 0xB0, 0x30, 0x0C, 0x04, 0x86, 0x13, 0x8E, 0x3C, 0x71, 0x04, 0x10, 0x40, 0x88, 0x09, 0x00, 0xA0, 0x06, 0x00, 0x40, 0x08, 0x01, 0x00, 0xFC, 0x00, 0x7F, 0x42, 0x04, 0x08, 0x10, 0x20, 0x42, 0xFE, 0x0C, 0x41, 0x04, 0x30, 0x8C, 0x08, 0x21, 0x04, 0x10, 0x60, 0x24, 0x94, 0x92, 0x52, 0x40, 0x18, 0x20, 0x82, 0x10, 0x40, 0xC4, 0x10, 0x82, 0x08, 0xC0, 0x61, 0x24, 0x30 ] FreeMonoOblique9pt7bGlyphs = [ [ 0, 0, 0, 11, 0, 1 ], # 0x20 ' ' [ 0, 4, 11, 11, 4, -10 ], # 0x21 '!' [ 6, 5, 5, 11, 4, -10 ], # 0x22 '"' [ 10, 9, 12, 11, 2, -10 ], # 0x23 '#' [ 24, 8, 12, 11, 3, -10 ], # 0x24 '$' [ 36, 9, 11, 11, 2, -10 ], # 0x25 '%' [ 49, 7, 10, 11, 2, -9 ], # 0x26 '&' [ 58, 2, 5, 11, 6, -10 ], # 0x27 ''' [ 60, 4, 13, 11, 6, -10 ], # 0x28 '(' [ 67, 4, 13, 11, 3, -10 ], # 0x29 ')' [ 74, 7, 7, 11, 4, -10 ], # 0x2A '#' [ 81, 9, 8, 11, 2, -8 ], # 0x2B '+' [ 90, 4, 5, 11, 2, -1 ], # 0x2C ',' [ 93, 9, 1, 11, 2, -5 ], # 0x2D '-' [ 95, 2, 2, 11, 4, -1 ], # 0x2E '.' [ 96, 9, 13, 11, 2, -11 ], # 0x2F '/' [ 111, 7, 11, 11, 3, -10 ], # 0x30 '0' [ 121, 7, 11, 11, 2, -10 ], # 0x31 '1' [ 131, 9, 11, 11, 2, -10 ], # 0x32 '2' [ 144, 9, 11, 11, 2, -10 ], # 0x33 '3' [ 157, 8, 11, 11, 2, -10 ], # 0x34 '4' [ 168, 9, 11, 11, 2, -10 ], # 0x35 '5' [ 181, 8, 11, 11, 3, -10 ], # 0x36 '6' [ 192, 7, 11, 11, 4, -10 ], # 0x37 '7' [ 202, 8, 11, 11, 3, -10 ], # 0x38 '8' [ 213, 8, 11, 11, 3, -10 ], # 0x39 '9' [ 224, 3, 8, 11, 4, -7 ], # 0x3A ':' [ 227, 5, 11, 11, 2, -7 ], # 0x3B '' [ 234, 9, 8, 11, 2, -8 ], # 0x3C '<' [ 243, 9, 4, 11, 2, -6 ], # 0x3D '=' [ 248, 9, 8, 11, 2, -8 ], # 0x3E '>' [ 257, 7, 10, 11, 4, -9 ], # 0x3F '?' [ 266, 7, 12, 11, 3, -10 ], # 0x40 '@' [ 277, 11, 10, 11, 0, -9 ], # 0x41 'A' [ 291, 10, 10, 11, 1, -9 ], # 0x42 'B' [ 304, 9, 10, 11, 2, -9 ], # 0x43 'C' [ 316, 10, 10, 11, 1, -9 ], # 0x44 'D' [ 329, 10, 10, 11, 1, -9 ], # 0x45 'E' [ 342, 11, 10, 11, 1, -9 ], # 0x46 'F' [ 356, 9, 10, 11, 2, -9 ], # 0x47 'G' [ 368, 11, 10, 11, 1, -9 ], # 0x48 'H' [ 382, 9, 10, 11, 2, -9 ], # 0x49 'I' [ 394, 11, 10, 11, 2, -9 ], # 0x4A 'J' [ 408, 11, 10, 11, 1, -9 ], # 0x4B 'K' [ 422, 10, 10, 11, 1, -9 ], # 0x4C 'L' [ 435, 13, 10, 11, 0, -9 ], # 0x4D 'M' [ 452, 11, 10, 11, 1, -9 ], # 0x4E 'N' [ 466, 9, 10, 11, 2, -9 ], # 0x4F 'O' [ 478, 10, 10, 11, 1, -9 ], # 0x50 'P' [ 491, 9, 13, 11, 2, -9 ], # 0x51 'Q' [ 506, 10, 10, 11, 1, -9 ], # 0x52 'R' [ 519, 9, 10, 11, 2, -9 ], # 0x53 'S' [ 531, 9, 10, 11, 3, -9 ], # 0x54 'T' [ 543, 10, 10, 11, 2, -9 ], # 0x55 'U' [ 556, 11, 10, 11, 2, -9 ], # 0x56 'V' [ 570, 11, 10, 11, 2, -9 ], # 0x57 'W' [ 584, 11, 10, 11, 1, -9 ], # 0x58 'X' [ 598, 9, 10, 11, 3, -9 ], # 0x59 'Y' [ 610, 9, 10, 11, 2, -9 ], # 0x5A 'Z' [ 622, 5, 13, 11, 5, -10 ], # 0x5B '[' [ 631, 4, 14, 11, 4, -11 ], # 0x5C '\' [ 638, 5, 13, 11, 2, -10 ], # 0x5D ']' [ 647, 7, 5, 11, 3, -10 ], # 0x5E '^' [ 652, 11, 1, 11, 0, 2 ], # 0x5F '_' [ 654, 2, 3, 11, 5, -11 ], # 0x60 '`' [ 655, 9, 8, 11, 2, -7 ], # 0x61 'a' [ 664, 11, 11, 11, 0, -10 ], # 0x62 'b' [ 680, 10, 8, 11, 2, -7 ], # 0x63 'c' [ 690, 9, 11, 11, 2, -10 ], # 0x64 'd' [ 703, 9, 8, 11, 2, -7 ], # 0x65 'e' [ 712, 10, 11, 11, 2, -10 ], # 0x66 'f' [ 726, 10, 11, 11, 2, -7 ], # 0x67 'g' [ 740, 10, 11, 11, 1, -10 ], # 0x68 'h' [ 754, 8, 11, 11, 2, -10 ], # 0x69 'i' [ 765, 9, 14, 11, 1, -10 ], # 0x6A 'j' [ 781, 9, 11, 11, 1, -10 ], # 0x6B 'k' [ 794, 8, 11, 11, 2, -10 ], # 0x6C 'l' [ 805, 11, 8, 11, 0, -7 ], # 0x6D 'm' [ 816, 9, 8, 11, 1, -7 ], # 0x6E 'n' [ 825, 9, 8, 11, 2, -7 ], # 0x6F 'o' [ 834, 11, 11, 11, 0, -7 ], # 0x70 'p' [ 850, 10, 11, 11, 2, -7 ], # 0x71 'q' [ 864, 9, 8, 11, 2, -7 ], # 0x72 'r' [ 873, 8, 8, 11, 2, -7 ], # 0x73 's' [ 881, 7, 10, 11, 2, -9 ], # 0x74 't' [ 890, 9, 8, 11, 2, -7 ], # 0x75 'u' [ 899, 10, 8, 11, 2, -7 ], # 0x76 'v' [ 909, 10, 8, 11, 2, -7 ], # 0x77 'w' [ 919, 10, 8, 11, 1, -7 ], # 0x78 'x' [ 929, 12, 11, 11, 0, -7 ], # 0x79 'y' [ 946, 8, 8, 11, 2, -7 ], # 0x7A 'z' [ 954, 6, 13, 11, 4, -10 ], # 0x7B '[' [ 964, 3, 12, 11, 5, -9 ], # 0x7C '|' [ 969, 6, 13, 11, 3, -10 ], # 0x7D ']' [ 979, 7, 3, 11, 3, -6 ] ] # 0x7E '~' FreeMonoOblique9pt7b = [ FreeMonoOblique9pt7bBitmaps, FreeMonoOblique9pt7bGlyphs, 0x20, 0x7E, 18 ] # Approx. 1654 bytes
free_mono_oblique9pt7b_bitmaps = [17, 34, 36, 64, 0, 192, 222, 229, 41, 0, 9, 5, 2, 130, 71, 248, 160, 81, 254, 40, 20, 10, 9, 0, 8, 29, 35, 64, 112, 28, 2, 130, 132, 120, 32, 32, 28, 17, 8, 131, 128, 24, 113, 192, 28, 17, 8, 131, 128, 30, 96, 129, 3, 10, 101, 70, 136, 232, 250, 128, 18, 36, 72, 136, 136, 136, 128, 1, 17, 17, 17, 34, 68, 128, 16, 34, 91, 195, 10, 34, 0, 4, 2, 2, 31, 240, 128, 64, 32, 0, 54, 76, 128, 255, 128, 240, 0, 128, 128, 64, 64, 64, 32, 32, 32, 16, 16, 16, 8, 8, 0, 28, 69, 10, 24, 48, 97, 66, 133, 17, 192, 4, 56, 144, 32, 129, 2, 4, 8, 35, 248, 7, 4, 196, 32, 16, 16, 48, 32, 32, 96, 64, 63, 128, 15, 0, 64, 32, 32, 96, 24, 4, 2, 1, 67, 30, 0, 3, 5, 10, 18, 34, 34, 66, 127, 4, 4, 30, 31, 136, 8, 5, 195, 48, 8, 4, 2, 2, 66, 30, 0, 7, 24, 32, 64, 92, 166, 194, 130, 130, 196, 120, 255, 4, 16, 32, 130, 4, 16, 32, 129, 0, 30, 35, 65, 65, 98, 28, 102, 130, 130, 132, 120, 30, 35, 65, 65, 67, 101, 58, 2, 4, 24, 224, 108, 0, 54, 24, 192, 0, 25, 140, 196, 0, 1, 131, 6, 12, 6, 0, 128, 48, 4, 255, 128, 0, 31, 240, 32, 12, 1, 0, 96, 32, 96, 193, 128, 61, 142, 8, 16, 198, 8, 0, 1, 128, 28, 69, 10, 121, 52, 105, 78, 129, 3, 3, 192, 15, 0, 96, 18, 2, 64, 136, 33, 7, 225, 4, 32, 94, 60, 63, 132, 17, 4, 130, 63, 136, 50, 4, 129, 96, 191, 192, 30, 152, 208, 40, 8, 4, 2, 1, 0, 65, 31, 0, 63, 12, 34, 4, 129, 32, 72, 18, 9, 2, 67, 63, 0, 63, 196, 17, 0, 136, 62, 8, 130, 0, 130, 96, 191, 224, 63, 226, 8, 64, 17, 3, 224, 68, 8, 1, 0, 96, 31, 0, 30, 152, 208, 8, 8, 4, 122, 5, 2, 65, 31, 0, 61, 226, 24, 66, 8, 67, 248, 65, 8, 33, 8, 33, 30, 240, 63, 130, 2, 1, 0, 128, 64, 32, 32, 16, 127, 0, 15, 224, 32, 4, 0, 128, 16, 2, 32, 132, 16, 132, 15, 0, 60, 226, 16, 68, 17, 2, 192, 100, 8, 129, 8, 97, 30, 56, 62, 2, 0, 128, 32, 16, 4, 1, 4, 66, 16, 191, 224, 56, 56, 195, 5, 40, 41, 66, 82, 19, 16, 153, 132, 8, 32, 71, 143, 0, 112, 230, 8, 161, 20, 34, 72, 73, 17, 34, 20, 67, 30, 32, 30, 24, 144, 40, 24, 12, 6, 5, 2, 70, 30, 0, 63, 132, 49, 4, 129, 32, 143, 194, 0, 128, 96, 62, 0, 30, 24, 144, 40, 24, 12, 6, 5, 2, 70, 30, 8, 15, 68, 96, 63, 132, 49, 4, 129, 32, 143, 194, 16, 132, 96, 188, 16, 15, 136, 200, 36, 1, 128, 56, 5, 2, 194, 94, 0, 255, 196, 68, 2, 1, 0, 128, 64, 96, 32, 126, 0, 241, 208, 36, 9, 2, 65, 160, 72, 18, 4, 198, 31, 0, 241, 232, 17, 2, 32, 130, 32, 68, 9, 1, 64, 40, 2, 0, 241, 232, 9, 18, 38, 69, 72, 170, 41, 69, 40, 198, 24, 192, 56, 226, 8, 38, 5, 0, 64, 24, 4, 129, 8, 65, 28, 112, 227, 160, 144, 132, 129, 128, 128, 64, 32, 32, 126, 0, 63, 144, 136, 128, 128, 128, 128, 128, 130, 130, 127, 0, 57, 8, 68, 33, 8, 66, 33, 14, 0, 136, 68, 68, 34, 34, 17, 17, 56, 66, 17, 8, 66, 16, 132, 46, 0, 8, 40, 146, 24, 32, 255, 192, 164, 62, 0, 128, 71, 164, 52, 18, 24, 247, 56, 1, 0, 64, 9, 225, 198, 32, 68, 9, 1, 48, 70, 19, 188, 0, 31, 72, 116, 10, 0, 128, 32, 12, 24, 248, 1, 128, 64, 35, 150, 50, 10, 5, 2, 129, 97, 31, 224, 31, 48, 208, 63, 248, 4, 1, 0, 124, 7, 195, 0, 128, 254, 16, 4, 1, 0, 64, 16, 8, 15, 224, 29, 216, 196, 18, 4, 130, 32, 140, 97, 232, 2, 1, 7, 128, 48, 4, 1, 0, 92, 56, 136, 34, 8, 130, 33, 24, 79, 60, 4, 4, 0, 56, 8, 8, 8, 8, 16, 16, 255, 1, 0, 128, 3, 240, 16, 8, 4, 2, 2, 1, 0, 128, 64, 71, 192, 56, 8, 4, 2, 113, 32, 160, 160, 104, 36, 17, 56, 224, 60, 4, 4, 8, 8, 8, 8, 8, 16, 16, 255, 62, 226, 100, 136, 145, 18, 36, 72, 145, 23, 51, 55, 20, 76, 36, 18, 9, 8, 133, 227, 30, 16, 144, 48, 24, 12, 11, 8, 120, 51, 195, 140, 64, 136, 18, 2, 96, 140, 49, 120, 32, 8, 3, 224, 0, 28, 216, 196, 18, 4, 129, 32, 76, 33, 248, 2, 0, 129, 240, 115, 142, 4, 4, 2, 1, 0, 129, 252, 31, 97, 64, 60, 3, 129, 130, 252, 16, 99, 249, 2, 4, 16, 32, 64, 124, 227, 16, 144, 72, 36, 34, 17, 24, 246, 243, 208, 68, 16, 136, 36, 9, 2, 128, 64, 225, 208, 36, 145, 36, 85, 25, 134, 97, 16, 57, 196, 32, 176, 48, 12, 4, 134, 19, 142, 60, 113, 4, 16, 64, 136, 9, 0, 160, 6, 0, 64, 8, 1, 0, 252, 0, 127, 66, 4, 8, 16, 32, 66, 254, 12, 65, 4, 48, 140, 8, 33, 4, 16, 96, 36, 148, 146, 82, 64, 24, 32, 130, 16, 64, 196, 16, 130, 8, 192, 97, 36, 48] free_mono_oblique9pt7b_glyphs = [[0, 0, 0, 11, 0, 1], [0, 4, 11, 11, 4, -10], [6, 5, 5, 11, 4, -10], [10, 9, 12, 11, 2, -10], [24, 8, 12, 11, 3, -10], [36, 9, 11, 11, 2, -10], [49, 7, 10, 11, 2, -9], [58, 2, 5, 11, 6, -10], [60, 4, 13, 11, 6, -10], [67, 4, 13, 11, 3, -10], [74, 7, 7, 11, 4, -10], [81, 9, 8, 11, 2, -8], [90, 4, 5, 11, 2, -1], [93, 9, 1, 11, 2, -5], [95, 2, 2, 11, 4, -1], [96, 9, 13, 11, 2, -11], [111, 7, 11, 11, 3, -10], [121, 7, 11, 11, 2, -10], [131, 9, 11, 11, 2, -10], [144, 9, 11, 11, 2, -10], [157, 8, 11, 11, 2, -10], [168, 9, 11, 11, 2, -10], [181, 8, 11, 11, 3, -10], [192, 7, 11, 11, 4, -10], [202, 8, 11, 11, 3, -10], [213, 8, 11, 11, 3, -10], [224, 3, 8, 11, 4, -7], [227, 5, 11, 11, 2, -7], [234, 9, 8, 11, 2, -8], [243, 9, 4, 11, 2, -6], [248, 9, 8, 11, 2, -8], [257, 7, 10, 11, 4, -9], [266, 7, 12, 11, 3, -10], [277, 11, 10, 11, 0, -9], [291, 10, 10, 11, 1, -9], [304, 9, 10, 11, 2, -9], [316, 10, 10, 11, 1, -9], [329, 10, 10, 11, 1, -9], [342, 11, 10, 11, 1, -9], [356, 9, 10, 11, 2, -9], [368, 11, 10, 11, 1, -9], [382, 9, 10, 11, 2, -9], [394, 11, 10, 11, 2, -9], [408, 11, 10, 11, 1, -9], [422, 10, 10, 11, 1, -9], [435, 13, 10, 11, 0, -9], [452, 11, 10, 11, 1, -9], [466, 9, 10, 11, 2, -9], [478, 10, 10, 11, 1, -9], [491, 9, 13, 11, 2, -9], [506, 10, 10, 11, 1, -9], [519, 9, 10, 11, 2, -9], [531, 9, 10, 11, 3, -9], [543, 10, 10, 11, 2, -9], [556, 11, 10, 11, 2, -9], [570, 11, 10, 11, 2, -9], [584, 11, 10, 11, 1, -9], [598, 9, 10, 11, 3, -9], [610, 9, 10, 11, 2, -9], [622, 5, 13, 11, 5, -10], [631, 4, 14, 11, 4, -11], [638, 5, 13, 11, 2, -10], [647, 7, 5, 11, 3, -10], [652, 11, 1, 11, 0, 2], [654, 2, 3, 11, 5, -11], [655, 9, 8, 11, 2, -7], [664, 11, 11, 11, 0, -10], [680, 10, 8, 11, 2, -7], [690, 9, 11, 11, 2, -10], [703, 9, 8, 11, 2, -7], [712, 10, 11, 11, 2, -10], [726, 10, 11, 11, 2, -7], [740, 10, 11, 11, 1, -10], [754, 8, 11, 11, 2, -10], [765, 9, 14, 11, 1, -10], [781, 9, 11, 11, 1, -10], [794, 8, 11, 11, 2, -10], [805, 11, 8, 11, 0, -7], [816, 9, 8, 11, 1, -7], [825, 9, 8, 11, 2, -7], [834, 11, 11, 11, 0, -7], [850, 10, 11, 11, 2, -7], [864, 9, 8, 11, 2, -7], [873, 8, 8, 11, 2, -7], [881, 7, 10, 11, 2, -9], [890, 9, 8, 11, 2, -7], [899, 10, 8, 11, 2, -7], [909, 10, 8, 11, 2, -7], [919, 10, 8, 11, 1, -7], [929, 12, 11, 11, 0, -7], [946, 8, 8, 11, 2, -7], [954, 6, 13, 11, 4, -10], [964, 3, 12, 11, 5, -9], [969, 6, 13, 11, 3, -10], [979, 7, 3, 11, 3, -6]] free_mono_oblique9pt7b = [FreeMonoOblique9pt7bBitmaps, FreeMonoOblique9pt7bGlyphs, 32, 126, 18]
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of easy-drf. # https://github.com/talp101/easy-drf.git # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT-license # Copyright (c) 2015, Tal Peretz <13@1500.co.il> __version__ = '0.1.2' # NOQA
__version__ = '0.1.2'
class Solution: # @param dictionary: a list of strings # @return: a list of strings def longestWords(self, dictionary): def word_len_list(dictionary): wd_list =[] for word in dictionary: wd_list.append(len(word)) return max(wd_list) def find_word(dictionary): result = [] for word in dictionary: if len(word) == word_len_list(dictionary): result.append(word) return result return find_word(dictionary) print(Solution().longestWords(["apped","apdoap","pajdnd","adjdnd"]))
class Solution: def longest_words(self, dictionary): def word_len_list(dictionary): wd_list = [] for word in dictionary: wd_list.append(len(word)) return max(wd_list) def find_word(dictionary): result = [] for word in dictionary: if len(word) == word_len_list(dictionary): result.append(word) return result return find_word(dictionary) print(solution().longestWords(['apped', 'apdoap', 'pajdnd', 'adjdnd']))
@jit(nopython=True) def pressure_poisson(p, b, l2_target): I, J = b.shape iter_diff = l2_target + 1 n = 0 while iter_diff > l2_target and n <= 500: pn = p.copy() for i in range(1, I - 1): for j in range(1, J - 1): p[i, j] = (.25 * (pn[i, j + 1] + pn[i, j - 1] + pn[i + 1, j] + pn[i - 1, j]) - b[i, j]) for i in range(I): p[i, 0] = p[i, 1] p[i, -1] = 0 for j in range(J): p[0, j] = p[1, j] p[-1, j] = p[-2, j] if n % 10 == 0: iter_diff = numpy.sqrt(numpy.sum((p - pn)**2)/numpy.sum(pn**2)) n += 1 return p
@jit(nopython=True) def pressure_poisson(p, b, l2_target): (i, j) = b.shape iter_diff = l2_target + 1 n = 0 while iter_diff > l2_target and n <= 500: pn = p.copy() for i in range(1, I - 1): for j in range(1, J - 1): p[i, j] = 0.25 * (pn[i, j + 1] + pn[i, j - 1] + pn[i + 1, j] + pn[i - 1, j]) - b[i, j] for i in range(I): p[i, 0] = p[i, 1] p[i, -1] = 0 for j in range(J): p[0, j] = p[1, j] p[-1, j] = p[-2, j] if n % 10 == 0: iter_diff = numpy.sqrt(numpy.sum((p - pn) ** 2) / numpy.sum(pn ** 2)) n += 1 return p
def findAllDuplicates(nums): d = dict() for i in nums: d[i] = d.get(i, 0) + 1 dup = list() print(d) for i in d: if d[i] == 2: dup.append(i) return dup nums = [4, 3, 2, 7, 8, 2, 3, 1] dup = findAllDuplicates(nums) print(dup)
def find_all_duplicates(nums): d = dict() for i in nums: d[i] = d.get(i, 0) + 1 dup = list() print(d) for i in d: if d[i] == 2: dup.append(i) return dup nums = [4, 3, 2, 7, 8, 2, 3, 1] dup = find_all_duplicates(nums) print(dup)
##sq=lambda x:x**2 ##res=sq(5) ##print("square is:",res) ## ## ## ##add=lambda x,y,z:x+y+z ## ## ##print("sum is:",add(2,3,4)) ## ##l=[1,2,3,4,5] ##li=list(map(lambda x:x**3,l)) ##print(li) t=(1,2,3,4,5) def sum(x): return x+10 a=list(map(sum,t)) print(a)
t = (1, 2, 3, 4, 5) def sum(x): return x + 10 a = list(map(sum, t)) print(a)
# Title : TODO # Objective : TODO # Created by: Wenzurk # Created on: 2018/2/3 transportation = ['bicycle', 'motorcycle', 'car', 'airplane'] message = 'I would like to own a ' print(message + transportation[0] + ".") print(message + transportation[1] + ".") print(message + transportation[2] + ".") print(message + transportation[3] + ".")
transportation = ['bicycle', 'motorcycle', 'car', 'airplane'] message = 'I would like to own a ' print(message + transportation[0] + '.') print(message + transportation[1] + '.') print(message + transportation[2] + '.') print(message + transportation[3] + '.')