content
stringlengths
7
1.05M
def extractTravistranslationsCom(item): ''' Parser for 'travistranslations.com' DISABLED ''' return None
# -*- coding: utf-8 -*- """ test.t_scripts ~~~~~~~~~~~~~~ :copyright: Copyright 2013 by the ControlBeast team, see AUTHORS. :license: ISC, see LICENSE for details. """
"""Top-level package for wangls.""" __author__ = """Ahmed Ali""" __email__ = 'norbixin@live.com' __version__ = '0.1.6'
class BufferFullException(Exception): pass class BufferEmptyException(Exception): pass class CircularBuffer: def __init__(self, capacity): self.buffer = [None] * capacity self.read_index = 0 self.write_index = 0 def read(self): data = self.buffer[self.read_index] if not data: raise BufferEmptyException(r".+") self.buffer[self.read_index] = None self.read_index = (self.read_index + 1) % len(self.buffer) return data def write(self, data): if self.buffer[self.write_index]: raise BufferFullException(r".+") self.buffer[self.write_index] = data self.write_index = (self.write_index + 1) % len(self.buffer) def overwrite(self, data): if self.buffer[self.write_index]: self.buffer[self.read_index] = data self.read_index = (self.read_index + 1) % len(self.buffer) self.write_index = self.read_index else: self.write(data) def clear(self): self.buffer = [None] * len(self.buffer) self.read_index = 0 self.write_index = 0
getObject = { 'accountId': 31111, 'balancedTerminationFlag': False, 'cooldown': 1800, 'createDate': '2018-04-30T15:07:40-04:00', 'desiredMemberCount': None, 'id': 12222222, 'lastActionDate': '2019-10-02T16:26:17-04:00', 'loadBalancers': [], 'maximumMemberCount': 6, 'minimumMemberCount': 2, 'modifyDate': '2019-10-03T17:16:47-04:00', 'name': 'tests', 'networkVlans': [ { 'networkVlan': { 'accountId': 31111, 'id': 2222222, 'modifyDate': '2019-07-16T13:09:47-04:00', 'networkSpace': 'PRIVATE', 'primaryRouter': { 'hostname': 'bcr01a.sao01' }, 'primarySubnetId': 1172222, 'vlanNumber': 1111 }, 'networkVlanId': 2281111 } ], 'policies': [ { 'actions': [ { 'amount': 1, 'createDate': '2019-09-26T18:30:22-04:00', 'deleteFlag': None, 'id': 611111, 'modifyDate': None, 'scalePolicy': None, 'scalePolicyId': 681111, 'scaleType': 'RELATIVE', 'typeId': 1 } ], 'cooldown': None, 'createDate': '2019-09-26T18:30:14-04:00', 'id': 680000, 'name': 'prime-poly', 'scaleActions': [ { 'amount': 1, 'createDate': '2019-09-26T18:30:22-04:00', 'deleteFlag': None, 'id': 633333, 'modifyDate': None, 'scalePolicy': None, 'scalePolicyId': 680123, 'scaleType': 'RELATIVE', 'typeId': 1 } ], 'triggers': [ { 'createDate': '2019-09-26T18:30:14-04:00', 'deleteFlag': None, 'id': 557111, 'modifyDate': None, 'scalePolicy': None, 'scalePolicyId': 680000, 'typeId': 3 } ] } ], 'regionalGroup': { 'description': 'sa-bra-south-1', 'id': 663, 'locationGroupTypeId': 42, 'locations': [ { 'id': 983497, 'longName': 'Sao Paulo 1', 'name': 'sao01', 'statusId': 2 } ], 'name': 'sa-bra-south-1', 'securityLevelId': None }, 'regionalGroupId': 663, 'status': { 'id': 1, 'keyName': 'ACTIVE', 'name': 'Active' }, 'suspendedFlag': False, 'terminationPolicy': { 'id': 2, 'keyName': 'NEWEST', 'name': 'Newest' }, 'terminationPolicyId': 2, 'virtualGuestAssets': [], 'virtualGuestMemberCount': 6, 'virtualGuestMemberTemplate': { 'accountId': 31111, 'blockDevices': [ { 'bootableFlag': None, 'createDate': None, 'device': '0', 'diskImage': { 'capacity': 25, 'createDate': None, 'id': None, 'modifyDate': None, 'parentId': None, 'storageRepositoryId': None, 'typeId': None}, 'diskImageId': None, 'guestId': None, 'hotPlugFlag': None, 'id': None, 'modifyDate': None, 'statusId': None }, { 'bootableFlag': None, 'createDate': None, 'device': '2', 'diskImage': { 'capacity': 10, 'createDate': None, 'id': None, 'modifyDate': None, 'parentId': None, 'storageRepositoryId': None, 'typeId': None}, 'diskImageId': None, 'guestId': None, 'hotPlugFlag': None, 'id': None, 'modifyDate': None, 'statusId': None } ], 'createDate': None, 'datacenter': { 'id': None, 'name': 'sao01', 'statusId': None }, 'dedicatedAccountHostOnlyFlag': None, 'domain': 'tech-support.com', 'hostname': 'testing', 'hourlyBillingFlag': True, 'id': None, 'lastPowerStateId': None, 'lastVerifiedDate': None, 'localDiskFlag': False, 'maxCpu': None, 'maxMemory': 1024, 'metricPollDate': None, 'modifyDate': None, 'networkComponents': [ { 'createDate': None, 'guestId': None, 'id': None, 'maxSpeed': 100, 'modifyDate': None, 'networkId': None, 'port': None, 'speed': None } ], 'operatingSystemReferenceCode': 'CENTOS_LATEST', 'placementGroupId': None, 'postInstallScriptUri': 'https://test.com/', 'privateNetworkOnlyFlag': False, 'provisionDate': None, 'sshKeys': [ { 'createDate': None, 'id': 490279, 'modifyDate': None } ], 'startCpus': 1, 'statusId': None, 'typeId': None}, 'virtualGuestMembers': [ { 'id': 3111111, 'virtualGuest': { 'domain': 'tech-support.com', 'hostname': 'test', 'provisionDate': '2019-09-27T14:29:53-04:00' } } ] } getVirtualGuestMembers = getObject['virtualGuestMembers'] scale = [ { "accountId": 31111, "cooldown": 1800, "createDate": "2016-10-25T01:48:34+08:00", "id": 12222222, "maximumMemberCount": 5, "minimumMemberCount": 0, "name": "tests", "virtualGuest": { "accountId": 31111, "createDate": "2019-10-02T15:24:54-06:00", "billingItem": { "cancellationDate": "2019-10-02T08:34:21-06:00"} }, "virtualGuestMemberTemplate": { "accountId": 31111, "domain": "sodg.com", "hostname": "testing", "maxMemory": 32768, "startCpus": 32, "blockDevices": [ { "device": "0", "diskImage": { "capacity": 25, } } ], "datacenter": { "name": "sao01", }, "hourlyBillingFlag": True, "operatingSystemReferenceCode": "CENTOS_LATEST", "privateNetworkOnlyFlag": True }, "virtualGuestMemberCount": 0, "status": { "id": 1, "keyName": "ACTIVE", "name": "Active" }, "virtualGuestAssets": [], "virtualGuestMembers": [] }, { "accountId": 31111, "cooldown": 1800, "createDate": "2018-04-24T04:22:00+08:00", "id": 224533333, "maximumMemberCount": 10, "minimumMemberCount": 0, "modifyDate": "2019-01-19T04:53:21+08:00", "name": "test-ajcb", "virtualGuest": { "accountId": 31111, "createDate": "2019-10-02T15:24:54-06:00", "billingItem": { "cancellationDate": "2019-10-02T08:34:21-06:00"} }, "virtualGuestMemberTemplate": { "accountId": 31111, "domain": "test.local", "hostname": "autoscale-ajcb01", "id": None, "maxCpu": None, "maxMemory": 1024, "postInstallScriptUri": "http://test.com", "startCpus": 1, "blockDevices": [ { "device": "0", "diskImage": { "capacity": 25, } } ], "datacenter": { "name": "seo01", }, "hourlyBillingFlag": True, "operatingSystemReferenceCode": "CENTOS_7_64", }, "virtualGuestMemberCount": 0, "status": { "id": 1, "keyName": "ACTIVE", "name": "Active" }, "virtualGuestAssets": [], "virtualGuestMembers": [] } ] scaleTo = [ { "accountId": 31111, "cooldown": 1800, "createDate": "2016-10-25T01:48:34+08:00", "id": 12222222, "lastActionDate": "2016-10-25T01:48:34+08:00", "maximumMemberCount": 5, "minimumMemberCount": 0, "name": "tests", "regionalGroupId": 663, "virtualGuest": { }, "virtualGuestMemberTemplate": { "accountId": 31111, "domain": "sodg.com", "hostname": "testing", "id": None, "maxCpu": None, "maxMemory": 32768, "startCpus": 32, "datacenter": { "name": "sao01", }, "hourlyBillingFlag": True, "operatingSystemReferenceCode": "CENTOS_LATEST", "privateNetworkOnlyFlag": True }, "virtualGuestMemberCount": 0, "status": { "id": 1, "keyName": "ACTIVE", "name": "Active" }, "virtualGuestAssets": [], "virtualGuestMembers": [] }, { "accountId": 31111, "cooldown": 1800, "createDate": "2018-04-24T04:22:00+08:00", "id": 224533333, "lastActionDate": "2019-01-19T04:53:18+08:00", "maximumMemberCount": 10, "minimumMemberCount": 0, "modifyDate": "2019-01-19T04:53:21+08:00", "name": "test-ajcb", "regionalGroupId": 1025, "virtualGuest": { "accountId": 31111, "createDate": "2019-10-02T15:24:54-06:00", "billingItem": { "cancellationDate": "2019-10-02T08:34:21-06:00"} }, "virtualGuestMemberTemplate": { "accountId": 31111, "domain": "test.local", "hostname": "autoscale-ajcb01", "id": None, "maxCpu": None, "maxMemory": 1024, "postInstallScriptUri": "http://test.com", "startCpus": 1, "blockDevices": [ { "device": "0", "diskImage": { "capacity": 25, } } ], "datacenter": { "name": "seo01", }, "hourlyBillingFlag": True, "operatingSystemReferenceCode": "CENTOS_7_64", }, "virtualGuestMemberCount": 0, "status": { "id": 1, "keyName": "ACTIVE", "name": "Active" }, "virtualGuestAssets": [], "virtualGuestMembers": [] }, ] getLogs = [ { "createDate": "2019-10-03T04:26:11+08:00", "description": "Scaling group to 6 member(s) by adding 3 member(s) as manually requested", "id": 3821111, "scaleGroupId": 2252222, "scaleGroup": { "accountId": 31111, "cooldown": 1800, "createDate": "2018-05-01T03:07:40+08:00", "id": 2251111, "lastActionDate": "2019-10-03T04:26:17+08:00", "maximumMemberCount": 6, "minimumMemberCount": 2, "modifyDate": "2019-10-03T04:26:21+08:00", "name": "ajcb-autoscale11", "regionalGroupId": 663, "terminationPolicyId": 2, "virtualGuestMemberTemplate": { "accountId": 31111, "domain": "techsupport.com", "hostname": "ajcb-autoscale22", "maxMemory": 1024, "postInstallScriptUri": "https://pastebin.com/raw/62wrEKuW", "startCpus": 1, "blockDevices": [ { "device": "0", "diskImage": { "capacity": 25, } }, { "device": "2", "diskImage": { "capacity": 10, } } ], "datacenter": { "name": "sao01", }, "networkComponents": [ { "maxSpeed": 100, } ], "operatingSystemReferenceCode": "CENTOS_LATEST", "sshKeys": [ { "id": 49111, } ] }, "logs": [ { "createDate": "2019-09-28T02:31:35+08:00", "description": "Scaling group to 3 member(s) by removing -1 member(s) as manually requested", "id": 3821111, "scaleGroupId": 2251111, }, { "createDate": "2019-09-28T02:26:11+08:00", "description": "Scaling group to 4 member(s) by adding 2 member(s) as manually requested", "id": 38211111, "scaleGroupId": 2251111, }, ] } }, ] editObject = True forceDeleteObject = True createObject = { "accountId": 307608, "cooldown": 3600, "createDate": "2022-04-22T13:45:24-06:00", "id": 5446140, "lastActionDate": "2022-04-22T13:45:29-06:00", "maximumMemberCount": 5, "minimumMemberCount": 1, "name": "test22042022", "regionalGroupId": 4568, "suspendedFlag": False, "terminationPolicyId": 2, "virtualGuestMemberTemplate": { "accountId": 307608, "domain": "test.com", "hostname": "testvs", "maxMemory": 2048, "startCpus": 2, "blockDevices": [ { "diskImage": { "capacity": 100, } } ], "hourlyBillingFlag": True, "localDiskFlag": True, "networkComponents": [ { "maxSpeed": 100, } ], "operatingSystemReferenceCode": "CENTOS_7_64", "userData": [ { "value": "the userData" } ] }, "virtualGuestMemberCount": 0, "networkVlans": [], "policies": [], "status": { "id": 1, "keyName": "ACTIVE", "name": "Active" }, "virtualGuestAssets": [], "virtualGuestMembers": [ { "createDate": "2022-04-22T13:45:29-06:00", "id": 123456, "scaleGroupId": 5446140, "virtualGuest": { "createDate": "2022-04-22T13:45:28-06:00", "deviceStatusId": 3, "domain": "test.com", "fullyQualifiedDomainName": "testvs-97e7.test.com", "hostname": "testvs-97e7", "id": 129911702, "maxCpu": 2, "maxCpuUnits": "CORE", "maxMemory": 2048, "startCpus": 2, "statusId": 1001, "typeId": 1, "uuid": "46e55f99-b412-4287-95b5-b8182b2fc924", "status": { "keyName": "ACTIVE", "name": "Active" } } } ] }
# # PySNMP MIB module HPN-ICF-RMON-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-RMON-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:41:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion") hpnicfrmonExtend, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfrmonExtend") OwnerString, = mibBuilder.importSymbols("IF-MIB", "OwnerString") EntryStatus, = mibBuilder.importSymbols("RMON-MIB", "EntryStatus") trapDestEntry, trapDestIndex = mibBuilder.importSymbols("RMON2-MIB", "trapDestEntry", "trapDestIndex") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") ObjectIdentity, NotificationType, Unsigned32, IpAddress, Counter64, Integer32, iso, TimeTicks, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Counter32, Bits, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "NotificationType", "Unsigned32", "IpAddress", "Counter64", "Integer32", "iso", "TimeTicks", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Counter32", "Bits", "Gauge32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") hpnicfperformance = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4)) hpnicfperformance.setRevisions(('2003-03-15 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: hpnicfperformance.setRevisionsDescriptions(('The initial revision of this MIB module.',)) if mibBuilder.loadTexts: hpnicfperformance.setLastUpdated('200303150000Z') if mibBuilder.loadTexts: hpnicfperformance.setOrganization('') if mibBuilder.loadTexts: hpnicfperformance.setContactInfo('') if mibBuilder.loadTexts: hpnicfperformance.setDescription(' ') hpnicfprialarmTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1), ) if mibBuilder.loadTexts: hpnicfprialarmTable.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmTable.setDescription('A list of alarm entries.') hpnicfprialarmEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1), ).setIndexNames((0, "HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmIndex")) if mibBuilder.loadTexts: hpnicfprialarmEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmEntry.setDescription('A list of parameters that set up a periodic checking for alarm conditions. For example, an instance of the alarmValue object might be named alarmValue.8') hpnicfprialarmIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfprialarmIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmIndex.setDescription('An index that uniquely identifies an entry in the alarm table. Each such entry defines a diagnostic sample at a particular interval for an object on the device.') hpnicfprialarmInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmInterval.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmInterval.setDescription('The interval in seconds over which the data is sampled and compared with the rising and falling thresholds. When setting this variable, care should be taken in the case of deltaValue sampling - the interval should be set short enough that the sampled variable is very unlikely to increase or decrease by more than 2^31 - 1 during a single sampling interval. This object may not be modified if the associated alarmStatus object is equal to valid(1).') hpnicfprialarmVariable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmVariable.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmVariable.setDescription('The object identifier of the particular variable to be sampled. Only variables that resolve to an ASN.1 primitive type of INTEGER (INTEGER, Integer32, Counter32, Counter64, Gauge, or TimeTicks) may be sampled. Because SNMP access control is articulated entirely in terms of the contents of MIB views, no access control mechanism exists that can restrict the value of this object to identify only those objects that exist in a particular MIB view. Because there is thus no acceptable means of restricting the read access that could be obtained through the alarm mechanism, the probe must only grant write access to this object in those views that have read access to all objects on the probe. During a set operation, if the supplied variable name is not available in the selected MIB view, a badValue error must be returned. If at any time the variable name of an established alarmEntry is no longer available in the selected MIB view, the probe must change the status of this alarmEntry to invalid(4). This object may not be modified if the associated alarmStatus object is equal to valid(1).') hpnicfprialarmSympol = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 4), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmSympol.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmSympol.setDescription('') hpnicfprialarmSampleType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("absoluteValue", 1), ("deltaValue", 2), ("speedValue", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmSampleType.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmSampleType.setDescription('The method of sampling the selected variable and calculating the value to be compared against the thresholds. If the value of this object is absoluteValue(1), the value of the selected variable will be compared directly with the thresholds at the end of the sampling interval. If the value of this object is deltaValue(2), the value of the selected variable at the last sample will be subtracted from the current value, and the difference compared with the thresholds. This object may not be modified if the associated alarmStatus object is equal to valid(1).') hpnicfprialarmValue = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfprialarmValue.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmValue.setDescription('The value of the statistic during the last sampling period. For example, if the sample type is deltaValue, this value will be the difference between the samples at the beginning and end of the period. If the sample type is absoluteValue, this value will be the sampled value at the end of the period. This is the value that is compared with the rising and falling thresholds. The value during the current sampling period is not made available until the period is completed and will remain available until the next period completes.') hpnicfprialarmStartupAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("risingAlarm", 1), ("fallingAlarm", 2), ("risingOrFallingAlarm", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmStartupAlarm.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmStartupAlarm.setDescription('The alarm that may be sent when this entry is first set to valid. If the first sample after this entry becomes valid is greater than or equal to the risingThreshold and alarmStartupAlarm is equal to risingAlarm(1) or risingOrFallingAlarm(3), then a single rising alarm will be generated. If the first sample after this entry becomes valid is less than or equal to the fallingThreshold and alarmStartupAlarm is equal to fallingAlarm(2) or risingOrFallingAlarm(3), then a single falling alarm will be generated. This object may not be modified if the associated alarmStatus object is equal to valid(1).') hpnicfprialarmRisingThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmRisingThreshold.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmRisingThreshold.setDescription('A threshold for the sampled statistic. When the current sampled value is greater than or equal to this threshold, and the value at the last sampling interval was less than this threshold, a single event will be generated. A single event will also be generated if the first sample after this entry becomes valid is greater than or equal to this threshold and the associated alarmStartupAlarm is equal to risingAlarm(1) or risingOrFallingAlarm(3). After a rising event is generated, another such event will not be generated until the sampled value falls below this threshold and reaches the alarmFallingThreshold. This object may not be modified if the associated alarmStatus object is equal to valid(1).') hpnicfprialarmFallingThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmFallingThreshold.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmFallingThreshold.setDescription('A threshold for the sampled statistic. When the current sampled value is less than or equal to this threshold, and the value at the last sampling interval was greater than this threshold, a single event will be generated. A single event will also be generated if the first sample after this entry becomes valid is less than or equal to this threshold and the associated alarmStartupAlarm is equal to fallingAlarm(2) or risingOrFallingAlarm(3). After a falling event is generated, another such event will not be generated until the sampled value rises above this threshold and reaches the alarmRisingThreshold. This object may not be modified if the associated alarmStatus object is equal to valid(1).') hpnicfprialarmRisingEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmRisingEventIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmRisingEventIndex.setDescription('The index of the eventEntry that is used when a rising threshold is crossed. The eventEntry identified by a particular value of this index is the same as identified by the same value of the eventIndex object. If there is no corresponding entry in the eventTable, then no association exists. In particular, if this value is zero, no associated event will be generated, as zero is not a valid event index. This object may not be modified if the associated alarmStatus object is equal to valid(1).') hpnicfprialarmFallingEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmFallingEventIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmFallingEventIndex.setDescription('The index of the eventEntry that is used when a falling threshold is crossed. The eventEntry identified by a particular value of this index is the same as identified by the same value of the eventIndex object. If there is no corresponding entry in the eventTable, then no association exists. In particular, if this value is zero, no associated event will be generated, as zero is not a valid event index. This object may not be modified if the associated alarmStatus object is equal to valid(1).') hpnicfprialarmStatCycle = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmStatCycle.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmStatCycle.setDescription('') hpnicfprialarmStatType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("forever", 1), ("during", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmStatType.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmStatType.setDescription('') hpnicfprialarmOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 14), OwnerString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmOwner.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmOwner.setDescription('The entity that configured this entry and is therefore using the resources assigned to it.') hpnicfprialarmStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 15), EntryStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfprialarmStatus.setStatus('current') if mibBuilder.loadTexts: hpnicfprialarmStatus.setDescription('The status of this alarm entry.') hpnicfrmonEnableTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5), ) if mibBuilder.loadTexts: hpnicfrmonEnableTable.setStatus('current') if mibBuilder.loadTexts: hpnicfrmonEnableTable.setDescription('A list of enable rmon entries.') hpnicfrmonEnableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1), ).setIndexNames((0, "HPN-ICF-RMON-EXT-MIB", "hpnicfrmonEnableIfIndex")) if mibBuilder.loadTexts: hpnicfrmonEnableEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfrmonEnableEntry.setDescription('A list of parameters that set up a hpnicfrmonEnableTable') hpnicfrmonEnableIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfrmonEnableIfIndex.setStatus('current') if mibBuilder.loadTexts: hpnicfrmonEnableIfIndex.setDescription('Specify an interface to enable rmon.') hpnicfrmonEnableStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfrmonEnableStatus.setStatus('current') if mibBuilder.loadTexts: hpnicfrmonEnableStatus.setDescription('Specify an interface to enable rmon.') hpnicfTrapDestTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6), ) if mibBuilder.loadTexts: hpnicfTrapDestTable.setStatus('current') if mibBuilder.loadTexts: hpnicfTrapDestTable.setDescription('Defines the trap destination Extend Table for providing, via SNMP, the capability of configure a trap dest.') hpnicfTrapDestEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6, 1), ) trapDestEntry.registerAugmentions(("HPN-ICF-RMON-EXT-MIB", "hpnicfTrapDestEntry")) hpnicfTrapDestEntry.setIndexNames(*trapDestEntry.getIndexNames()) if mibBuilder.loadTexts: hpnicfTrapDestEntry.setStatus('current') if mibBuilder.loadTexts: hpnicfTrapDestEntry.setDescription('Defines an entry in the hpnicfTrapDestTable.') hpnicfTrapDestVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("snmpv1", 1), ("snmpv2", 2), ("snmpv3andauthen", 3), ("snmpv3andnoauthen", 4), ("snmpv3andpriv", 5))).clone('snmpv1')).setMaxAccess("readcreate") if mibBuilder.loadTexts: hpnicfTrapDestVersion.setStatus('current') if mibBuilder.loadTexts: hpnicfTrapDestVersion.setDescription('The version for trap destination. This object may not be modified if the associated trapDestStatus object is equal to active(1).') hpnicfrmonExtendEventsV2 = ObjectIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0)) if mibBuilder.loadTexts: hpnicfrmonExtendEventsV2.setStatus('current') if mibBuilder.loadTexts: hpnicfrmonExtendEventsV2.setDescription('Definition point for pri RMON notifications.') hpnicfpririsingAlarm = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0, 1)).setObjects(("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmIndex"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmSympol"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmSampleType"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmValue"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmRisingThreshold")) if mibBuilder.loadTexts: hpnicfpririsingAlarm.setStatus('current') if mibBuilder.loadTexts: hpnicfpririsingAlarm.setDescription('The SNMP trap that is generated when an alarm entry crosses its rising threshold and generates an event that is configured for sending SNMP traps.') hpnicfprifallingAlarm = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0, 2)).setObjects(("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmIndex"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmSympol"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmSampleType"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmValue"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmFallingThreshold")) if mibBuilder.loadTexts: hpnicfprifallingAlarm.setStatus('current') if mibBuilder.loadTexts: hpnicfprifallingAlarm.setDescription('The SNMP trap that is generated when an alarm entry crosses its falling threshold and generates an event that is configured for sending SNMP traps.') mibBuilder.exportSymbols("HPN-ICF-RMON-EXT-MIB", hpnicfprialarmSympol=hpnicfprialarmSympol, hpnicfrmonEnableEntry=hpnicfrmonEnableEntry, hpnicfprialarmStatType=hpnicfprialarmStatType, hpnicfprifallingAlarm=hpnicfprifallingAlarm, hpnicfprialarmRisingThreshold=hpnicfprialarmRisingThreshold, hpnicfprialarmEntry=hpnicfprialarmEntry, hpnicfprialarmRisingEventIndex=hpnicfprialarmRisingEventIndex, hpnicfprialarmFallingEventIndex=hpnicfprialarmFallingEventIndex, hpnicfrmonEnableIfIndex=hpnicfrmonEnableIfIndex, hpnicfrmonEnableTable=hpnicfrmonEnableTable, hpnicfprialarmOwner=hpnicfprialarmOwner, hpnicfrmonExtendEventsV2=hpnicfrmonExtendEventsV2, hpnicfprialarmSampleType=hpnicfprialarmSampleType, hpnicfTrapDestVersion=hpnicfTrapDestVersion, hpnicfprialarmIndex=hpnicfprialarmIndex, hpnicfpririsingAlarm=hpnicfpririsingAlarm, hpnicfprialarmTable=hpnicfprialarmTable, hpnicfprialarmStatCycle=hpnicfprialarmStatCycle, hpnicfperformance=hpnicfperformance, hpnicfprialarmFallingThreshold=hpnicfprialarmFallingThreshold, hpnicfTrapDestEntry=hpnicfTrapDestEntry, hpnicfprialarmStartupAlarm=hpnicfprialarmStartupAlarm, hpnicfprialarmInterval=hpnicfprialarmInterval, hpnicfTrapDestTable=hpnicfTrapDestTable, hpnicfprialarmStatus=hpnicfprialarmStatus, hpnicfprialarmValue=hpnicfprialarmValue, PYSNMP_MODULE_ID=hpnicfperformance, hpnicfrmonEnableStatus=hpnicfrmonEnableStatus, hpnicfprialarmVariable=hpnicfprialarmVariable)
def test_add_project(app, json_project): project = json_project old_projects = app.project.get_project_list() app.project.create_project(project) new_projects = app.project.get_project_list() old_projects.append(project) assert len(old_projects) == len(new_projects)
#Entrada la=int(input("Ingrese la lectura actual: ")) le=int(input("Ingrese la lectura anterior: ")) #Caja negra lnc=le-la if(lnc>=0) and (lnc<=100): s=lnc*4600 elif(lnc>=101) and (lnc<=300): s=lnc*80000 elif(lnc>=301) and (lnc<=500): s=lnc*100000 elif(lnc>=501): s=lnc*120000 #Salida print("El monto a pagar sera: ", s)
# # PySNMP MIB module DNOS-NSF-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNOS-NSF-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:51:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection") dnOS, = mibBuilder.importSymbols("DELL-REF-MIB", "dnOS") agentInventoryUnitNumber, agentInventoryUnitEntry = mibBuilder.importSymbols("DNOS-INVENTORY-MIB", "agentInventoryUnitNumber", "agentInventoryUnitEntry") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, ModuleIdentity, iso, ObjectIdentity, NotificationType, Counter64, Unsigned32, Integer32, Gauge32, Counter32, Bits, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "ModuleIdentity", "iso", "ObjectIdentity", "NotificationType", "Counter64", "Unsigned32", "Integer32", "Gauge32", "Counter32", "Bits", "TimeTicks") TextualConvention, DisplayString, TruthValue, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue", "RowStatus") fastPathNsf = ModuleIdentity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46)) fastPathNsf.setRevisions(('2011-01-26 00:00', '2009-04-23 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: fastPathNsf.setRevisionsDescriptions(('Postal address updated.', 'Initial version.',)) if mibBuilder.loadTexts: fastPathNsf.setLastUpdated('201101260000Z') if mibBuilder.loadTexts: fastPathNsf.setOrganization('Dell, Inc.') if mibBuilder.loadTexts: fastPathNsf.setContactInfo('') if mibBuilder.loadTexts: fastPathNsf.setDescription('This MIB defines the objects used for FastPath to configure and report information and status of NSF features.') agentNsfUnitTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1), ) if mibBuilder.loadTexts: agentNsfUnitTable.setStatus('current') if mibBuilder.loadTexts: agentNsfUnitTable.setDescription('A table of Per-Unit configuration objects for NSF.') agentNsfUnitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1, 1), ) agentInventoryUnitEntry.registerAugmentions(("DNOS-NSF-MIB", "agentNsfUnitEntry")) agentNsfUnitEntry.setIndexNames(*agentInventoryUnitEntry.getIndexNames()) if mibBuilder.loadTexts: agentNsfUnitEntry.setStatus('current') if mibBuilder.loadTexts: agentNsfUnitEntry.setDescription('Each Instance corresponds with a different unit managed by this agent.') agentNsfUnitSupport = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1, 1, 1), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfUnitSupport.setStatus('current') if mibBuilder.loadTexts: agentNsfUnitSupport.setDescription('Indicates if the unit supports the NSF feature.') agentNsfGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2)) agentNsfAdminStatus = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentNsfAdminStatus.setStatus('current') if mibBuilder.loadTexts: agentNsfAdminStatus.setDescription('Controls whether NSF is enabled on the unit/stack.') agentNsfOperStatus = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfOperStatus.setStatus('current') if mibBuilder.loadTexts: agentNsfOperStatus.setDescription('Indicates whether NSF is enabled on the unit/stack.') agentNsfLastStartupReason = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unknown", 1), ("power-on", 2), ("warm-admin-move", 3), ("cold-admin-move", 4), ("warm-auto-restart", 5), ("cold-auto-restart", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfLastStartupReason.setStatus('current') if mibBuilder.loadTexts: agentNsfLastStartupReason.setDescription("The type of activation that caused the software to start the last time. unknown: The switch rebooted for an unknown reason. power-on: The switch rebooted. This could have been caused by a power cycle or an administrative 'Reload' command. warm-admin-move: The administrator issued a command for the stand-by manager to take over. cold-admin-move: The administrator issued a command for the stand-by manager to take over, but the system was not ready for a warm-failover. warm-auto-restart: The primary management card restarted due to a failure, and the system executed a nonstop forwarding failover. cold-auto-restart: The system switched from the active manager to the backup manager and was unable to maintain user data traffic. This is usually caused by multiple failures occurring close together") agentNsfTimeSinceLastRestart = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfTimeSinceLastRestart.setStatus('current') if mibBuilder.loadTexts: agentNsfTimeSinceLastRestart.setDescription('Time since the current management card became the active management card.') agentNsfRestartInProgress = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 5), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfRestartInProgress.setStatus('current') if mibBuilder.loadTexts: agentNsfRestartInProgress.setDescription('Whether a restart is in progress. A restart is not considered complete until all hardware tables have been fully reconciled.') agentNsfWarmRestartReady = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 6), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfWarmRestartReady.setStatus('current') if mibBuilder.loadTexts: agentNsfWarmRestartReady.setDescription('Whether the initial full checkpoint has finished.') agentNsfBackupConfigurationAge = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 7), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfBackupConfigurationAge.setStatus('current') if mibBuilder.loadTexts: agentNsfBackupConfigurationAge.setDescription('Age of the configuration on the backup unit. The time since the running configuration was last copied to the backup unit.') agentNsfInitiateFailover = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentNsfInitiateFailover.setStatus('current') if mibBuilder.loadTexts: agentNsfInitiateFailover.setDescription('Triggers an administrative failover to the backup unit.') agentCheckpointStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3)) agentCheckpointClearStatistics = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentCheckpointClearStatistics.setStatus('current') if mibBuilder.loadTexts: agentCheckpointClearStatistics.setDescription('When set to enable(1), resets checkpoint statistics.') agentCheckpointMessages = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentCheckpointMessages.setStatus('current') if mibBuilder.loadTexts: agentCheckpointMessages.setDescription('Total number of checkpoint messages sent.') agentCheckpointBytes = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentCheckpointBytes.setStatus('current') if mibBuilder.loadTexts: agentCheckpointBytes.setDescription('Size in bytes of the total ammount of checkpoint messages sent.') agentCheckpointTimeSinceCountersCleared = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentCheckpointTimeSinceCountersCleared.setStatus('current') if mibBuilder.loadTexts: agentCheckpointTimeSinceCountersCleared.setDescription('Indicates how long since the Checkpoint counters have been cleared.') agentCheckpointMessageRateInterval = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 5), Unsigned32()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: agentCheckpointMessageRateInterval.setStatus('current') if mibBuilder.loadTexts: agentCheckpointMessageRateInterval.setDescription('Indicates the duration in seconds of the message rate interval.') agentCheckpointMessageRate = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentCheckpointMessageRate.setStatus('current') if mibBuilder.loadTexts: agentCheckpointMessageRate.setDescription('Number of checkpoint messages received in the last interval defined by agentCheckpointMessageRateInterval.') agentCheckpointHighestMessageRate = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 7), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentCheckpointHighestMessageRate.setStatus('current') if mibBuilder.loadTexts: agentCheckpointHighestMessageRate.setDescription('Highest number of checkpoint messages received in an interval defined by agentCheckpointMessageRateInterval.') agentNsfOspfGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4)) agentNsfOspfSupportMode = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("planned", 2), ("always", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentNsfOspfSupportMode.setStatus('current') if mibBuilder.loadTexts: agentNsfOspfSupportMode.setDescription('') agentNsfOspfRestartInterval = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 2), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentNsfOspfRestartInterval.setStatus('current') if mibBuilder.loadTexts: agentNsfOspfRestartInterval.setDescription('') agentNsfOspfRestartStatus = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("not-restarting", 2), ("planned-restart", 3), ("unplanned-restart", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfOspfRestartStatus.setStatus('current') if mibBuilder.loadTexts: agentNsfOspfRestartStatus.setDescription('') agentNsfOspfRestartAge = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfOspfRestartAge.setStatus('current') if mibBuilder.loadTexts: agentNsfOspfRestartAge.setDescription('') agentNsfOspfRestartExitReason = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("none", 1), ("in-progress", 2), ("completed", 3), ("timed-out", 4), ("topology-change", 5), ("manual-clear", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: agentNsfOspfRestartExitReason.setStatus('current') if mibBuilder.loadTexts: agentNsfOspfRestartExitReason.setDescription('') agentNsfOspfHelperSupportMode = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("planned", 2), ("always", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentNsfOspfHelperSupportMode.setStatus('current') if mibBuilder.loadTexts: agentNsfOspfHelperSupportMode.setDescription('') agentNsfOspfHelperStrictLSAChecking = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentNsfOspfHelperStrictLSAChecking.setStatus('current') if mibBuilder.loadTexts: agentNsfOspfHelperStrictLSAChecking.setDescription('') agentNsfTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 0)) agentNsfStackRestartComplete = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 0, 1)).setObjects(("DNOS-INVENTORY-MIB", "agentInventoryUnitNumber"), ("DNOS-NSF-MIB", "agentNsfLastStartupReason")) if mibBuilder.loadTexts: agentNsfStackRestartComplete.setStatus('current') if mibBuilder.loadTexts: agentNsfStackRestartComplete.setDescription('Sent when the stack finishes restarting after a failover.') mibBuilder.exportSymbols("DNOS-NSF-MIB", PYSNMP_MODULE_ID=fastPathNsf, agentCheckpointTimeSinceCountersCleared=agentCheckpointTimeSinceCountersCleared, agentNsfOspfRestartExitReason=agentNsfOspfRestartExitReason, agentNsfTraps=agentNsfTraps, agentCheckpointMessageRateInterval=agentCheckpointMessageRateInterval, agentCheckpointMessageRate=agentCheckpointMessageRate, agentNsfBackupConfigurationAge=agentNsfBackupConfigurationAge, agentCheckpointHighestMessageRate=agentCheckpointHighestMessageRate, agentNsfLastStartupReason=agentNsfLastStartupReason, agentNsfAdminStatus=agentNsfAdminStatus, agentNsfTimeSinceLastRestart=agentNsfTimeSinceLastRestart, agentNsfOspfHelperStrictLSAChecking=agentNsfOspfHelperStrictLSAChecking, agentCheckpointClearStatistics=agentCheckpointClearStatistics, agentCheckpointBytes=agentCheckpointBytes, agentNsfUnitTable=agentNsfUnitTable, agentCheckpointStatsGroup=agentCheckpointStatsGroup, agentNsfInitiateFailover=agentNsfInitiateFailover, agentNsfUnitSupport=agentNsfUnitSupport, agentCheckpointMessages=agentCheckpointMessages, agentNsfOspfRestartAge=agentNsfOspfRestartAge, agentNsfOperStatus=agentNsfOperStatus, agentNsfOspfRestartStatus=agentNsfOspfRestartStatus, agentNsfOspfGroup=agentNsfOspfGroup, fastPathNsf=fastPathNsf, agentNsfGroup=agentNsfGroup, agentNsfWarmRestartReady=agentNsfWarmRestartReady, agentNsfUnitEntry=agentNsfUnitEntry, agentNsfOspfRestartInterval=agentNsfOspfRestartInterval, agentNsfStackRestartComplete=agentNsfStackRestartComplete, agentNsfOspfSupportMode=agentNsfOspfSupportMode, agentNsfRestartInProgress=agentNsfRestartInProgress, agentNsfOspfHelperSupportMode=agentNsfOspfHelperSupportMode)
expected_output = { 'table_id': { '0xe0000000': { 'forward_referenced': 'No', 'prefix_count': 12, 'prefix_limit': 10000000, 'prefix_limit_notified': 'No', 'safi': 'uni', 'table_deleted': 'No', 'table_id': '0xe0000000', 'table_name': 'default', 'table_reached_convergence': 'Yes', 'table_version': 13, 'vrf_name': 'default' }, '0xe0000001': { 'forward_referenced': 'No', 'prefix_count': 0, 'prefix_limit': 10000000, 'prefix_limit_notified': 'No', 'safi': 'uni', 'table_deleted': 'No', 'table_id': '0xe0000001', 'table_name': 'default', 'table_reached_convergence': 'Yes', 'table_version': 0, 'vrf_name': 'bob:by' }, '0xe0000002': { 'forward_referenced': 'No', 'prefix_count': 2, 'prefix_limit': 10000000, 'prefix_limit_notified': 'No', 'safi': 'uni', 'table_deleted': 'No', 'table_id': '0xe0000002', 'table_name': 'default', 'table_reached_convergence': 'Yes', 'table_version': 3, 'vrf_name': 'DC-LAN' }, '0xe0100000': { 'forward_referenced': 'No', 'prefix_count': 0, 'prefix_limit': 10000000, 'prefix_limit_notified': 'No', 'safi': 'multi', 'table_deleted': 'No', 'table_id': '0xe0100000', 'table_name': 'default', 'table_reached_convergence': 'Yes', 'table_version': 0, 'vrf_name': '**nVjjh' } } }
grid_size = 8 cycles = 6 grid = [[[[c for c in input()] for _ in range(grid_size)]]] for i in range(grid_size): grid[0][0][i] = ['.' for _ in range(cycles)] + grid[0][0][i] + ['.' for _ in range(cycles)] for _ in range(cycles): grid[0][0] = [['.' for _ in range(grid_size + cycles * 2)]] + grid[0][0] + \ [['.' for _ in range(grid_size + cycles * 2)]] for _ in range(cycles): grid[0] = [[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)]] + grid[0] + \ [[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)]] for _ in range(cycles): grid = [[[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)] for _ in range(len(grid[0]))]] + grid + \ [[[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)] for _ in range(len(grid[0]))]] for _ in range(cycles): new_grid = [[[['.' for _ in range(len(grid[0][0][0]))] for _ in range(len(grid[0][0]))] for _ in range(len(grid[0]))] for _ in range(len(grid))] for w in range(len(grid)): for z in range(len(grid[w])): for y in range(len(grid[w][z])): for x in range(len(grid[w][z][y])): active_neighbours = 0 for h in range(max(0, w-1), min(w+2, len(grid))): for i in range(max(0, z-1), min(z+2, len(grid[w]))): for j in range(max(0, y-1), min(y+2, len(grid[w][z]))): for k in range(max(0, x-1), min(x+2, len(grid[w][z][y]))): if grid[h][i][j][k] == '#' and (h != w or i != z or j != y or k != x): active_neighbours += 1 if grid[w][z][y][x] == '#': new_grid[w][z][y][x] = '#' if 2 <= active_neighbours <= 3 else '.' else: new_grid[w][z][y][x] = '#' if active_neighbours == 3 else '.' grid = new_grid counter = 0 for w in range(len(grid)): for z in range(len(grid[w])): for y in range(len(grid[w][z])): for x in range(len(grid[w][z][y])): if grid[w][z][y][x] == '#': counter += 1 print(counter)
f = open("./2020_09_10_12_29_04_marc.monfort.Cifrado", "r") """ Generate a frequency list of letters. The letter with more occurences probably is the letter 'e' (English text). """ all_freq = {} for line in f: for i in line: if i in all_freq: all_freq[i] += 1 else: all_freq[i] = 1 sorted = {k: v for k, v in sorted(all_freq.items(), key=lambda item: item[1])} print(str(sorted)) f = open("./2020_09_10_12_29_04_marc.monfort.Cifrado", "r") result = open("./solved_cesar.txt", "w") """ The values depends on the padding of the text. The letter 'e' is the most common in English texts. ord('⎰') - ord('e') = 9035 After testing with 9035, there are some letters that still dont change, because they made a flip on the alphabet when applying Cesar. Check which ones dont change and use the new value for them. ord('⎥') - ord('t') = 9009 """ for line in f: n_line = "" for c in line: aux = (ord(c)-9035) if (aux < 70) or (aux > 122): # Range without change n_line = n_line + c elif (aux < 97): aux2 = (ord(c) - 9009) n_line = n_line + chr(aux2) else: n_line = n_line + chr(aux) result.write(n_line) result.close() # Copyright Marc Monfort
"""A special form of recursion where the last operation of a function is a recursive call. """ def tailrecursive(n: int, a=1) -> int: if n == 0: return a return tailrecursive(n - 1, n * a) def nontailrecursive(n: int) -> int: # The function is not tail # recursive because the value # returned by nontailrecursive(n-1) is used # in nontailrecursive(n) and call to nontailrecursive(n-1) # is not the last thing done by # nontailrecursive(n) if n == 0: return 1 return n * nontailrecursive(n - 1) if __name__ == "__main__": """ from timeit import timeit print(timeit(lambda: tailrecursive(10), number=10000)) # 0.012317868999161874 print(timeit(lambda: nontailrecursive(10), number=10000)) # 0.010385317998952814 """
def soma(*valores): s = 0 for num in valores: s += num print(f'A soma dos valores {valores} é = {s}') soma(2, 3, 4) soma(1, 5)
def fizzbuzz(número): if (número % 3 == 0) and (número % 5 != 0): return 'Fizz' elif (número % 3 != 0) and (número % 5 == 0): return 'Buzz' elif (número % 3 == 0) and (número % 5 == 0): return 'FizzBuzz' else: return número
class TestAddFile: # решение части 1 def test_add_file(self,input_page): path = 'K:/Learn/POM_Learning_OTUS/Test_suite/data/pict.jpg' input_page.load_file(path=path) # здесь будет решения части 2, когда я пойму как это сделать # def test_add_file_to_opencart(self, admin_product_page, setup_product_page): # path = 'K:/Learn/POM_Learning_OTUS/Test_suite/data/pict.jpg' # admin_product_page.add_image_to_product_by_name(p_name='Mouse', path=path)
#! Symbol table class holds the value of the variables respectively in a dict class SymbolTable: def __init__(self, parent = None): self.symbols = {} self.parent = parent def get(self,name): value = self.symbols.get(name, None) if value == None and self.parent: return self.parent.get(name) return value def set(self,name, value): self.symbols[name] = value def remove(self, name): del self.symbols[name]
class PolyCurve(Curve,IDisposable,ISerializable): """ Represents a curve that is the result of joining several (possibly different) types of curves. PolyCurve() """ def Append(self,*__args): """ Append(self: PolyCurve,curve: Curve) -> bool Appends and matches the start of the curve to the end of polycurve. This function will fail if the PolyCurve is closed or if SegmentCount > 0 and the new segment is closed. curve: Segment to append. Returns: true on success,false on failure. Append(self: PolyCurve,arc: Arc) -> bool Appends and matches the start of the arc to the end of polycurve. This function will fail if the polycurve is closed or if SegmentCount > 0 and the arc is closed. arc: Arc segment to append. Returns: true on success,false on failure. Append(self: PolyCurve,line: Line) -> bool Appends and matches the start of the line to the end of polycurve. This function will fail if the polycurve is closed. line: Line segment to append. Returns: true on success,false on failure. """ pass def ConstructConstObject(self,*args): """ ConstructConstObject(self: CommonObject,parentObject: object,subobject_index: int) Assigns a parent object and a subobject index to this. parentObject: The parent object. subobject_index: The subobject index. """ pass def Dispose(self): """ Dispose(self: Curve,disposing: bool) For derived class implementers. This method is called with argument true when class user calls Dispose(),while with argument false when the Garbage Collector invokes the finalizer,or Finalize() method.You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.Also,you must call the base virtual method within your overriding method. disposing: true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer. """ pass def Duplicate(self): """ Duplicate(self: PolyCurve) -> GeometryBase Duplicates this polycurve. When not overridden in a derived class,this calls Rhino.Geometry.PolyCurve.DuplicatePolyCurve. Returns: An exact duplicate of this curve. """ pass def DuplicatePolyCurve(self): """ DuplicatePolyCurve(self: PolyCurve) -> PolyCurve Duplicates this polycurve. This is the same as Rhino.Geometry.PolyCurve.Duplicate. Returns: An exact duplicate of this curve. """ pass def Explode(self): """ Explode(self: PolyCurve) -> Array[Curve] Explodes this PolyCurve into a list of Curve segments. This will not explode nested polycurves. Call Rhino.Geometry.PolyCurve.RemoveNesting first if you need all individual segments. Returns: An array of polycurve segments. """ pass def NonConstOperation(self,*args): """ NonConstOperation(self: Curve) For derived classes implementers. Defines the necessary implementation to free the instance from being const. """ pass def OnSwitchToNonConst(self,*args): """ OnSwitchToNonConst(self: GeometryBase) Is called when a non-const operation occurs. """ pass def PolyCurveParameter(self,segmentIndex,segmentCurveParameter): """ PolyCurveParameter(self: PolyCurve,segmentIndex: int,segmentCurveParameter: float) -> float Converts a segment curve parameter to a polycurve parameter. segmentIndex: Index of segment. segmentCurveParameter: Parameter on segment. Returns: Polycurve evaluation parameter or UnsetValue if the polycurve curve parameter could not be computed. """ pass def RemoveNesting(self): """ RemoveNesting(self: PolyCurve) -> bool Explodes nested polycurve segments and reconstructs this curve from the shattered remains. The result will have not have any PolyCurves as segments but it will have identical locus and parameterization. Returns: true if any nested PolyCurve was found and absorbed,false if no PolyCurve segments could be found. """ pass def SegmentCurve(self,index): """ SegmentCurve(self: PolyCurve,index: int) -> Curve Gets the segment curve at the given index. index: Index of segment to retrieve. Returns: The segment at the given index or null on failure. """ pass def SegmentCurveParameter(self,polycurveParameter): """ SegmentCurveParameter(self: PolyCurve,polycurveParameter: float) -> float Converts a polycurve parameter to a segment curve parameter. polycurveParameter: Parameter on PolyCurve to convert. Returns: Segment curve evaluation parameter or UnsetValue if the segment curve parameter could not be computed. """ pass def SegmentDomain(self,segmentIndex): """ SegmentDomain(self: PolyCurve,segmentIndex: int) -> Interval Returns the polycurve subdomain assigned to a segment curve. segmentIndex: Index of segment. Returns: The polycurve subdomain assigned to a segment curve. Returns Interval.Unset if segment_index < 0 or segment_index >= Count(). """ pass def SegmentIndex(self,polycurveParameter): """ SegmentIndex(self: PolyCurve,polycurveParameter: float) -> int Finds the segment used for evaluation at polycurve_parameter. polycurveParameter: Parameter on polycurve for segment lookup. Returns: Index of the segment used for evaluation at polycurve_parameter. If polycurve_parameter < Domain.Min(),then 0 is returned. If polycurve_parameter > Domain.Max(),then Count()-1 is returned. """ pass def SegmentIndexes(self,subdomain,segmentIndex0,segmentIndex1): """ SegmentIndexes(self: PolyCurve,subdomain: Interval) -> (int,int,int) Finds the segments that overlap the Polycurve sub domain. subdomain: Domain on this PolyCurve. Returns: Number of segments that overlap the subdomain. """ pass def __enter__(self,*args): """ __enter__(self: IDisposable) -> object Provides the implementation of __enter__ for objects which implement IDisposable. """ pass def __exit__(self,*args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) Provides the implementation of __exit__ for objects which implement IDisposable. """ pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self): """ __new__(cls: type,info: SerializationInfo,context: StreamingContext) __new__(cls: type) """ pass def __reduce_ex__(self,*args): pass HasGap=property(lambda self: object(),lambda self,v: None,lambda self: None) """This is a quick way to see if the curve has gaps between the sub curve segments. Get: HasGap(self: PolyCurve) -> bool """ IsNested=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets a value indicating whether or not a PolyCurve contains nested PolyCurves. Get: IsNested(self: PolyCurve) -> bool """ SegmentCount=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the number of segments that make up this Polycurve. Get: SegmentCount(self: PolyCurve) -> int """
def tag_skip_and_punct(nlp, name, config): r''' Detects and tags spacy tokens that are punctuation and that should be skipped. Args: nlp (spacy.language.<lng>): The base spacy NLP pipeline. name (`str`): The component instance name. config (`medcat.config.Config`): Global config for medcat. ''' return _Tagger(nlp, name, config) tag_skip_and_punct.name = "tag_skip_and_punct" class _Tagger(object): def __init__(self, nlp, name, config): self.nlp = nlp self.name = name self.config = config def __call__(self, doc): # Make life easier cnf_p = self.config.preprocessing for token in doc: if self.config.punct_checker.match(token.lower_) and token.text not in cnf_p['keep_punct']: # There can't be punct in a token if it also has text token._.is_punct = True token._.to_skip = True elif self.config.word_skipper.match(token.lower_): # Skip if specific strings token._.to_skip = True elif cnf_p['skip_stopwords'] and token.is_stop: token._.to_skip = True return doc
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] for l in range(0, 3): for c in range(0, 3): matriz[l][c] = int(input('Digite um valor na posição [{}, {}]'.format(l, c))) cont = 0 for l in range(0, 3): for c in range(0, 3): print('[{:^5}]'.format(matriz[l][c]),end='') print()
channel_routing = { 'websocket.receive': 'chat.consumers.ws_message', 'websocket.connect': 'chat.consumers.ws_add', 'websocket.disconnect': 'chat.consumers.ws_disconnect', 'slack.message': 'chat.consumers.slack_message', }
#hello.py print("Hello world") """ Author: som Date: 2021-05-11 이 프로그램은 Hello World를 출력하는 프로그램이다. """
def power(base, exponent): assert int(exponent) == exponent and exponent>=0, "exponent must be an integer greater or equal to zero" if exponent == 0: return 1 if exponent == 1: return base return base * power(base, exponent-1) print(power(4, 3))
class EntangleException(Exception): """Entangle exception. All non-system exceptions raised by Entangle and Entangle definitions must inherit from :class:`EntangleException`. :cvar definition: Definition. :cvar name: Name. """ pass class BadMessageError(EntangleException): """Bad message. """ definition = 'entangle' name = 'BadMessage' class InternalServerError(EntangleException): """Internal server error. """ definition = 'entangle' name = 'InternalServerError' class UnknownMethodError(EntangleException): """Unknown method. """ definition = 'entangle' name = 'UnknownMethod' class InvalidArgumentError(EntangleException): """Invalid argument. """ definition = 'entangle' name = 'InvalidArgument' class UnknownException(EntangleException): """Unknown exception. """ def __init__(self, definition, name, message): super(EntangleException, self).__init__(message) self.definition = definition self.name = name class PackingError(EntangleException): """Packing error. """ definition = 'entangle' name = 'PackingError' class DeserializationError(EntangleException): """Deserialization error. """ definition = 'entangle' name = 'DeserializationError' class UnexpectedMessageError(EntangleException): """Unexpected message. """ definition = 'entangle' name = 'UnexpectedMessage' class ConnectionLostError(EntangleException): """Connection lost. """ definition = 'entangle' name = 'ConnectionLost' entangle_exceptions = { BadMessageError.name: BadMessageError, InternalServerError.name: InternalServerError, UnknownMethodError.name: UnknownMethodError, InvalidArgumentError.name: InvalidArgumentError, } """Entangle exceptions. """ def parse_exception(definition, name, message): """Parse an exception. :param definition: Definition. :param name: Name. :param message: Message. :returns: the parsed exception or :class:`UnknownException` if the exception is not known. """ if definition == 'entangle': try: return entangle_exceptions[name](message) except KeyError: pass return UnknownException(definition, name, message)
def Sum (a, b) : return a+b x, y = int(input('x, y를 차례로 입력해주세요 ---> ').split()) print('x와 y의 합은 %s 입니다.' %Sum(x,y))
def main(): # input a = int(input()) b = int(input()) h = int(input()) # compute # output print((a+b) * h // 2) if __name__ == '__main__': main()
def Fac(n): if n == 1: return n return n * Fac(n - 1) def sum_digits(n): s = 0 while n: s += n % 10 n //= 10 return s print(sum_digits(Fac(100)))
start_message = ( "Привет, {name}!\n" "Этот бот поможет тебе загружать книги с флибусты.\n" "Узнать, как со мной работать /help.\n" "Настройки языков для поиска /settings.\n" "Информация о боте /info.\n" "Оставить отзыв /vote.\n" "Чтобы помочь /donate." ) help_msg = ( "Лучше один раз увидеть, чем сто раз услышать.\n" "https://youtu.be/HV6Wm87D6_A" ) info_msg = (""" В связи с блокировкой обсуждения во Вконтакте были созданы: чат, в котором можно задать вопрос и обсудить работу бота и канал с актуальными новостями и Чат: @flibusta_rebot_chat Канал: @flibusta_rebot_channel Связь с создателем проекта @kurbezz Github: https://goo.gl/V0Iw7m """) vote_msg = "Проголосовать можно тут: https://t.me/storebot?start=flibusta_rebot" donate_msg = ( "Кофе, кофе, кофе... \n" "Он помогает лучше думать и добавлять больше функционала, но увы за него надо платить. " "Если вы хотите помочь и сделать свой вклад в проект, " "можете сделать это пожертвовав любую сумму на реквизиты ниже. " "В комментариях к платежу указывайте на что пойдут деньги " "(оплата сервера, добавление нового функционала и т.д.).\n\n" "СберБанк, РокетБанк, Тинькофф, Киви:\n" "+7-953-496-65-56\n\n" "Карта:\n" "5536 9138 2061 9688\n\n" "Яндекс.Деньги:\n" "410015188456452" ) cache_removed = ( "Файл обновлен!" ) share = "Поделиться"
# Runtime: 258 ms, faster than 43.76% of Python3 online submissions for How Many Numbers Are Smaller Than the Current Number. # Memory Usage: 14.4 MB, less than 46.01% of Python3 online submissions for How Many Numbers Are Smaller Than the Current Number. # https://leetcode.com/submissions/detail/591527345/ class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: output_list = list() for current_number in nums: count_smaller = 0 for i in nums: if i < current_number: count_smaller += 1 output_list.append(count_smaller) return output_list
# cook your dish here for _ in range(int(input())): n = int(input()) print(int(n/2)+1)
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 load("//bazel_tools:haskell.bzl", "da_haskell_test") def _damlc_compile_test_impl(ctx): stack_opt = "-K" + ctx.attr.stack_limit if ctx.attr.stack_limit else "" heap_opt = "-M" + ctx.attr.heap_limit if ctx.attr.heap_limit else "" script = """ set -eou pipefail DAMLC=$(rlocation $TEST_WORKSPACE/{damlc}) MAIN=$(rlocation $TEST_WORKSPACE/{main}) TMP=$(mktemp -d) function cleanup() {{ rm -rf "$TMP" }} trap cleanup EXIT $DAMLC compile $MAIN -o $TMP/out +RTS -s {stack_opt} {heap_opt} """.format( damlc = ctx.executable.damlc.short_path, main = ctx.files.main[0].short_path, stack_opt = stack_opt, heap_opt = heap_opt, ) ctx.actions.write( output = ctx.outputs.executable, content = script, ) # To ensure the files needed by the script are available, we put them in # the runfiles. runfiles = ctx.runfiles( files = ctx.files.srcs + ctx.files.main + [ctx.executable.damlc], ) return [DefaultInfo( runfiles = runfiles, )] damlc_compile_test = rule( implementation = _damlc_compile_test_impl, attrs = { "srcs": attr.label_list(allow_files = True), "main": attr.label(allow_files = True), "damlc": attr.label( default = Label("//compiler/damlc"), executable = True, cfg = "target", allow_files = True, ), "stack_limit": attr.string(), "heap_limit": attr.string(), }, test = True, ) def damlc_integration_test(name, main_function): da_haskell_test( name = name, size = "large", srcs = ["src/DA/Test/DamlcIntegration.hs"], src_strip_prefix = "src", main_function = main_function, data = [ "//compiler/damlc/pkg-db", "//compiler/damlc/stable-packages", "//compiler/scenario-service/server:scenario_service_jar", "@jq_dev_env//:jq", ":daml-test-files", ":bond-trading", ":query-lf-lib", ], deps = [ "//compiler/daml-lf-ast", "//compiler/daml-lf-proto", "//compiler/damlc/daml-compiler", "//compiler/damlc/daml-ide-core", "//compiler/damlc/daml-lf-conversion", "//compiler/damlc/daml-opts:daml-opts-types", "//compiler/damlc/daml-opts", "//daml-lf/archive:daml_lf_dev_archive_haskell_proto", "//libs-haskell/bazel-runfiles", "//libs-haskell/da-hs-base", "//libs-haskell/test-utils", ], hackage_deps = [ "aeson-pretty", "base", "bytestring", "data-default", "deepseq", "directory", "dlist", "extra", "filepath", "ghc-lib", "ghc-lib-parser", "ghcide", "haskell-lsp-types", "optparse-applicative", "process", "proto3-suite", "shake", "tagged", "tasty", "tasty-hunit", "text", "time", "unordered-containers", ], visibility = ["//visibility:public"], )
# Idade em Dias dia=int(input()) print('{} ano(s)'.format(dia//365)) print('{} mes(es)'.format((dia%365)//30)) print('{} dia(s)'.format((dia%365)%30))
# @Title: 有序链表转换二叉搜索树 (Convert Sorted List to Binary Search Tree) # @Author: KivenC # @Date: 2020-08-18 22:37:05 # @Runtime: 172 ms # @Memory: 19.9 MB # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def sortedListToBST(self, head: ListNode) -> TreeNode: def getMidNode(left: ListNode, right: ListNode) -> TreeNode: slow = fast = left while fast != right and fast.next != right: fast = fast.next.next slow = slow.next return slow def generateTree(left: ListNode, right: ListNode) -> TreeNode: if left == right: return None mid = getMidNode(left, right) root = TreeNode(mid.val) root.left = generateTree(left, mid) root.right = generateTree(mid.next, right) return root return generateTree(head, None)
''' Se pida al usuario un año. Devolver si es o no bisiesto ''' year = int(input("Introduce un año: ")) if year % 4 == 0: print("El año es bisiesto") else: print("El año no es bisiesto")
#Aluguel de Carro - Pgto à vista: 10% ou Parcelado em 3x c/ 5% print('-' * 50) km = float(input('\033[1;35mQual a quilometragem percorrida? \033[m')) dias = int(input('\033[1;35mQuantos dias de aluguel? \033[m')) preco = (60 * dias)+(0.15 * km) print('-' * 50) print(f'\033[1;36mCom quilometragem de {km:.2f} e o prazo de {dias} dias\né de R${preco:.2f}.\033[m') print('-' * 50) pgto = int(input('\033[1;36mÀ vista com 10% desc., digite [1]\nParcelado em 3x com 5% de desc.; digite [2] \033[m')) if pgto == 1: preco *= 0.90 else: preco *= 0.95 / 3 print('-' * 50) print(f'\033[1;35mO valor a ser pago é de R$ {preco:.2f}\33[m')
sample_rate = 44100 window_size = 2048 # 1024 # 2048 overlap = 672 # 256 # 672 # So that there are 320 frames in an audio clip seq_len = 320 # 573 # 320 mel_bins = 64 labels = ['airport', 'bus', 'metro', 'metro_station', 'park', 'public_square', 'shopping_mall', 'street_pedestrian', 'street_traffic', 'tram'] lb_to_ix = {lb: ix for ix, lb in enumerate(labels)} ix_to_lb = {ix: lb for ix, lb in enumerate(labels)} labels_domain = ['a', 'b', 'c'] lb_to_ix_domain = {lbd: ixd for ixd, lbd in enumerate(labels_domain)} ix_to_lb_domain = {ixd: lbd for ixd, lbd in enumerate(labels_domain)}
class Solution(object): def checkPossibility(self, nums): """ :type nums: List[int] :rtype: bool """ if not nums: return True l = len(nums) fixed = False for i in xrange(l): if i + 1 < l: if nums[i] > nums[i + 1]: if fixed: return False if i + 2 >= l or i == 0: pass elif nums[i + 1] >= nums[i - 1]: pass else: nums[i + 1] = nums[i] fixed = True return True
ficha=[] while True: nome=input('Nome: ') nota1=float(input('Nota 1: ')) nota2=float(input('Nota 2: ')) media=(nota1+nota2)/2 ficha.append([nome, [nota1,nota2], media]) resp=str(input('Quer continuar? [S/N]: ')).strip().upper()[0] if resp in 'Nn': break print(f'{"No.":<4}{"NOME":<10}{"MÉDIA":>8}') for i, a in enumerate(ficha): print(f'{i:<4}{a[0]:<10}{a[2]:>8.1f}') while True: opc=int(input('Mostrar notas de qual aluno? (999 interrompe): ')) if opc==999: break if opc<=len(ficha)-1: print('Notas de {} são: {}'.format(ficha[opc][0],ficha[opc][1])) print('\033[35mFIM')
# alonso = 18 # edad = 0 # for x in range(5): # edad = edad + 1 # print(alonso + edad) # # alumnos = [20, 25, 23, 24, 26] # # for fgh in alumnos: # # print(fgh) print(round(3.5)) print(round(4.5)) print(round(5.5)) print(round(80.5))
""" Definition of the config-related exception types. """ ################################################################################ # Exception types class ConfigError(Exception): """ Base class for config-related exceptions """ pass class ConfigParsingError(ConfigError): """ Exception raised when configuration parsing fails """ pass class ConfigValueError(ConfigError): """ Exception raised when configuration contains bad values or is missing values """ pass ################################################################################
__ACTIVATION__ = 'relu' __NORM_LAYER__ = 'bn' def get_default_activation(): global __ACTIVATION__ return __ACTIVATION__ def set_default_activation(name): global __ACTIVATION__ __ACTIVATION__ = name def get_default_norm_layer(): global __NORM_LAYER__ return __NORM_LAYER__ def set_default_norm_layer(name): global __NORM_LAYER__ __NORM_LAYER__ = name
# Бинго 75 + Выигрышные номера последнего тиража def test_bingo75_winning_numbers_last_draw(app): app.ResultAndPrizes.open_page_results_and_prizes() app.ResultAndPrizes.click_game_bingo75() app.ResultAndPrizes.button_get_report_winners() app.ResultAndPrizes.message_id_33_bingo75_winning_numbers_last_draw() app.ResultAndPrizes.parser_report_text_winners() assert "ВЫИГРЫШНЫЕ НОМЕРА" in app.ResultAndPrizes.parser_report_text_winners() app.ResultAndPrizes.comeback_main_page()
# # PySNMP MIB module CISCO-CONFIG-COPY-MIB (http://pysnmp.sf.net) # ASN.1 source http://mibs.snmplabs.com:80/asn1/CISCO-CONFIG-COPY-MIB # Produced by pysmi-0.0.7 at Tue Feb 7 11:41:27 2017 # On host e436de1e4e9d platform Linux version 4.4.0-59-generic by user root # Using Python version 2.7.13 (default, Dec 22 2016, 09:22:15) # ( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") ( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ( ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint") ( ciscoMgmt, ) = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") ( FcNameIdOrZero, ) = mibBuilder.importSymbols("CISCO-ST-TC", "FcNameIdOrZero") ( InetAddress, InetAddressType, ) = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") ( SnmpAdminString, ) = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ( NotificationGroup, ModuleCompliance, ObjectGroup, ) = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup") ( Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, MibIdentifier, Bits, TimeTicks, Counter64, Unsigned32, ModuleIdentity, Gauge32, iso, ObjectIdentity, IpAddress, Counter32, ) = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "MibIdentifier", "Bits", "TimeTicks", "Counter64", "Unsigned32", "ModuleIdentity", "Gauge32", "iso", "ObjectIdentity", "IpAddress", "Counter32") ( DisplayString, TimeStamp, TruthValue, RowStatus, TextualConvention, ) = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TimeStamp", "TruthValue", "RowStatus", "TextualConvention") ciscoConfigCopyMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 96)).setRevisions(("2005-04-06 00:00", "2004-03-17 00:00", "2002-12-17 00:00", "2002-05-30 00:00", "2002-05-07 00:00", "2002-03-28 00:00",)) class ConfigCopyProtocol(Integer32, TextualConvention): subtypeSpec = Integer32.subtypeSpec+SingleValueConstraint(1, 2, 3, 4, 5,) namedValues = NamedValues(("tftp", 1), ("ftp", 2), ("rcp", 3), ("scp", 4), ("sftp", 5),) class ConfigCopyState(Integer32, TextualConvention): subtypeSpec = Integer32.subtypeSpec+SingleValueConstraint(1, 2, 3, 4,) namedValues = NamedValues(("waiting", 1), ("running", 2), ("successful", 3), ("failed", 4),) class ConfigCopyFailCause(Integer32, TextualConvention): subtypeSpec = Integer32.subtypeSpec+SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9,) namedValues = NamedValues(("unknown", 1), ("badFileName", 2), ("timeout", 3), ("noMem", 4), ("noConfig", 5), ("unsupportedProtocol", 6), ("someConfigApplyFailed", 7), ("systemNotReady", 8), ("requestAborted", 9),) class ConfigFileType(Integer32, TextualConvention): subtypeSpec = Integer32.subtypeSpec+SingleValueConstraint(1, 2, 3, 4, 5, 6,) namedValues = NamedValues(("networkFile", 1), ("iosFile", 2), ("startupConfig", 3), ("runningConfig", 4), ("terminal", 5), ("fabricStartupConfig", 6),) ciscoConfigCopyMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 1)) ccCopy = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1)) ccCopyTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1), ) ccCopyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1), ).setIndexNames((0, "CISCO-CONFIG-COPY-MIB", "ccCopyIndex")) ccCopyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1,2147483647))) ccCopyProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 2), ConfigCopyProtocol().clone('tftp')).setMaxAccess("readcreate") ccCopySourceFileType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 3), ConfigFileType()).setMaxAccess("readcreate") ccCopyDestFileType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 4), ConfigFileType()).setMaxAccess("readcreate") ccCopyServerAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 5), IpAddress()).setMaxAccess("readcreate") ccCopyFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 6), DisplayString()).setMaxAccess("readcreate") ccCopyUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1,40))).setMaxAccess("readcreate") ccCopyUserPassword = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1,40))).setMaxAccess("readcreate") ccCopyNotificationOnCompletion = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 9), TruthValue().clone('false')).setMaxAccess("readcreate") ccCopyState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 10), ConfigCopyState()).setMaxAccess("readonly") ccCopyTimeStarted = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 11), TimeStamp()).setMaxAccess("readonly") ccCopyTimeCompleted = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 12), TimeStamp()).setMaxAccess("readonly") ccCopyFailCause = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 13), ConfigCopyFailCause()).setMaxAccess("readonly") ccCopyEntryRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 14), RowStatus()).setMaxAccess("readcreate") ccCopyServerAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 15), InetAddressType()).setMaxAccess("readcreate") ccCopyServerAddressRev1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 16), InetAddress()).setMaxAccess("readcreate") ccCopyErrorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2), ) ccCopyErrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1), ).setIndexNames((0, "CISCO-CONFIG-COPY-MIB", "ccCopyIndex"), (0, "CISCO-CONFIG-COPY-MIB", "ccCopyErrorIndex")) ccCopyErrorIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 1), Unsigned32()) ccCopyErrorDeviceIpAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 2), InetAddressType()).setMaxAccess("readonly") ccCopyErrorDeviceIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 3), InetAddress()).setMaxAccess("readonly") ccCopyErrorDeviceWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 4), FcNameIdOrZero()).setMaxAccess("readonly") ccCopyErrorDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 5), SnmpAdminString()).setMaxAccess("readonly") ciscoConfigCopyMIBTrapPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 2)) ccCopyMIBTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 2, 1)) ccCopyCompletion = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 96, 2, 1, 1)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyServerAddress"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFileName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyState"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeStarted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeCompleted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFailCause"),)) ciscoConfigCopyMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3)) ccCopyMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1)) ccCopyMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2)) ccCopyMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 1)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyGroup"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationsGroup"),)) ccCopyMIBComplianceRev1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 2)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyGroupRev1"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationsGroup"),)) ccCopyMIBComplianceRev2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 3)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyGroupRev1"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationsGroup"), ("CISCO-CONFIG-COPY-MIB", "ccCopyErrorGroup"),)) ccCopyGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 1)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyProtocol"), ("CISCO-CONFIG-COPY-MIB", "ccCopySourceFileType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyDestFileType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyServerAddress"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFileName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyUserName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyUserPassword"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationOnCompletion"), ("CISCO-CONFIG-COPY-MIB", "ccCopyState"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeStarted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeCompleted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFailCause"), ("CISCO-CONFIG-COPY-MIB", "ccCopyEntryRowStatus"),)) ccCopyNotificationsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 2)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyCompletion"),)) ccCopyGroupRev1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 3)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyProtocol"), ("CISCO-CONFIG-COPY-MIB", "ccCopySourceFileType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyDestFileType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyServerAddressType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyServerAddressRev1"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFileName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyUserName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyUserPassword"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationOnCompletion"), ("CISCO-CONFIG-COPY-MIB", "ccCopyState"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeStarted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeCompleted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFailCause"), ("CISCO-CONFIG-COPY-MIB", "ccCopyEntryRowStatus"),)) ccCopyErrorGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 4)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyErrorDeviceIpAddressType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyErrorDeviceIpAddress"), ("CISCO-CONFIG-COPY-MIB", "ccCopyErrorDeviceWWN"), ("CISCO-CONFIG-COPY-MIB", "ccCopyErrorDescription"),)) mibBuilder.exportSymbols("CISCO-CONFIG-COPY-MIB", ciscoConfigCopyMIBConformance=ciscoConfigCopyMIBConformance, ccCopyMIBGroups=ccCopyMIBGroups, ccCopyServerAddress=ccCopyServerAddress, ccCopyNotificationOnCompletion=ccCopyNotificationOnCompletion, ciscoConfigCopyMIB=ciscoConfigCopyMIB, ccCopyState=ccCopyState, ccCopyDestFileType=ccCopyDestFileType, ccCopySourceFileType=ccCopySourceFileType, ccCopyErrorEntry=ccCopyErrorEntry, ccCopyMIBCompliance=ccCopyMIBCompliance, ccCopyTimeCompleted=ccCopyTimeCompleted, ccCopyErrorDeviceIpAddress=ccCopyErrorDeviceIpAddress, ccCopyEntry=ccCopyEntry, ccCopyErrorDeviceIpAddressType=ccCopyErrorDeviceIpAddressType, PYSNMP_MODULE_ID=ciscoConfigCopyMIB, ccCopyMIBTraps=ccCopyMIBTraps, ccCopyServerAddressType=ccCopyServerAddressType, ccCopyUserPassword=ccCopyUserPassword, ccCopyGroupRev1=ccCopyGroupRev1, ciscoConfigCopyMIBObjects=ciscoConfigCopyMIBObjects, ccCopyMIBCompliances=ccCopyMIBCompliances, ccCopyTable=ccCopyTable, ccCopyErrorDeviceWWN=ccCopyErrorDeviceWWN, ccCopyCompletion=ccCopyCompletion, ciscoConfigCopyMIBTrapPrefix=ciscoConfigCopyMIBTrapPrefix, ccCopyErrorIndex=ccCopyErrorIndex, ccCopyErrorDescription=ccCopyErrorDescription, ccCopyFailCause=ccCopyFailCause, ccCopyUserName=ccCopyUserName, ccCopyTimeStarted=ccCopyTimeStarted, ConfigCopyState=ConfigCopyState, ccCopyNotificationsGroup=ccCopyNotificationsGroup, ConfigCopyFailCause=ConfigCopyFailCause, ccCopyServerAddressRev1=ccCopyServerAddressRev1, ccCopyErrorTable=ccCopyErrorTable, ConfigFileType=ConfigFileType, ccCopyFileName=ccCopyFileName, ConfigCopyProtocol=ConfigCopyProtocol, ccCopyGroup=ccCopyGroup, ccCopyMIBComplianceRev1=ccCopyMIBComplianceRev1, ccCopyEntryRowStatus=ccCopyEntryRowStatus, ccCopyIndex=ccCopyIndex, ccCopyMIBComplianceRev2=ccCopyMIBComplianceRev2, ccCopy=ccCopy, ccCopyErrorGroup=ccCopyErrorGroup, ccCopyProtocol=ccCopyProtocol)
currentEvents = False pastEvents = [ {"date": "2014-2019", "details": "Ongoing exhibit space at Libby Ross Therapy", "location": "Columbia, SC"}, {"date": "2008-2010", 'details': 'Ongoing exhibit space at Angie’s Hair Salon', 'location': 'Lexington, SC'}, {'date': '2006 -2007', 'details': 'Ongoing exhibit space at Charlotte Arts League Gallery', 'location': '1517 Camden Rd, Charlotte, NC'}, {'date': 'June 2005', 'details': '“Driven to Abstraction” at Charlotte Arts League Gallery', 'location': 'Charlotte, NC'}, {'date': 'May 7, 2005', 'details': '“Blessing of the Inlet” at Belin United Methodist Church', 'location': 'Murrells Inlet, SC'}, {'date': 'April 7 – May 27, 2005', 'details': '“Dreams Community Art Project” Chapel Hill', 'location': 'NC communityartproject.org'}, {'date': 'March 2005', 'details': 'Solo Exhibit at Lexington County Public Library Main Branch', 'location': '5440 Augusta Rd, Lexington, SC'}, {'date': 'December 2004', 'details': '“La’ Danse” at Charlotte Arts League Gallery', 'location': 'Charlotte, NC'} ] theBooks = [ {'bookImg': 'https://images.craftsnherbs.com/logo.jpg', 'bookName': 'Zag the Caring Tree Frog', 'description': 'Check out my latest interactive children’s book! Zag the Caring Tree Frog Children’s Book Zag makes sure everyone knows that someone cares', 'price': 'TBD'}, {'bookImg': 'https://images.craftsnherbs.com/logo.jpg', 'bookName': 'Jar Child Fantasy Novel Girl', 'description': "This is a new fantasy story that I’m current working on. Jar Child Fantasy Novel Girl learns about herself, powers, and life outside her jar.", 'price': 'TBD'}, {'bookImg': 'https://images.craftsnherbs.com/logo.jpg', 'bookName': 'Poetry', 'description': "Poetry Raw emotions that will move you.", 'price': 'TBD'} ]
def parse_version(version): """Convert version to a tuple. Tuple will have a form (num1, num2, num3, num4, suffix). For example: - 1.1 => (1, 1, 0, 0, "") - 2.3.4.5 => (2, 3, 4, 5, "") - 1.0.1-open => (1, 0, 1, 0, "open") - 1.0.1-beta.12 => (1, 0, 1, 12, "beta") """ lversion = version.split(".") l = len(lversion) if l > 4 or l == 0: fail("Invalid version:", version) suffix = "" for i in range(l): if not lversion[i].isdigit(): if suffix != "": fail("Version suffix already defined:", version) s = lversion[i].partition("-") if s[2] == "": fail("Invalid version segment:", version) if not s[0].isdigit(): fail("Not a digit in a version:", version) lversion[i] = int(s[0]) suffix = s[2] else: lversion[i] = int(lversion[i]) if l == 4: return (lversion[0], lversion[1], lversion[2], lversion[3], suffix) elif l == 3: return (lversion[0], lversion[1], lversion[2], 0, suffix) elif l == 2: return (lversion[0], lversion[1], 0, 0, suffix) elif l == 1: return (lversion[0], 0, 0, 0, suffix) else: fail("Unreachable") def test_parse_version(): a = parse_version("1.1") if a != (1, 1, 0, 0, ""): print("Unexpected result:", a) fail("test 1 failed") a = parse_version("2.3.4.5") if a != (2, 3, 4, 5, ""): print("Unexpected result:", a) fail("test 2 failed") a = parse_version("1.0.1-open") if a != (1, 0, 1, 0, "open"): print("Unexpected result:", a) fail("test 3 failed") a = parse_version("1.0.1-beta.12") if a != (1, 0, 1, 12, "beta"): print("Unexpected result:", a) fail("test 4 failed") def version2string(tversion): """ Converts version tuple to string """ s = "" if tversion[3] != 0: s = "{}.{}.{}.{}".format(tversion[0], tversion[1], tversion[2], tversion[3]) elif tversion[2] != 0: s = "{}.{}.{}".format(tversion[0], tversion[1], tversion[2]) else: s = "{}.{}".format(tversion[0], tversion[1]) if tversion[4] != "": s = s + "-" + tversion[4] return s def test_version2string(): a = "1.1" b = parse_version(a) c = version2string(b) if c != a: print("Unexpected result:", c) fail("test 1 failed") a = "2.3.4.5" b = parse_version(a) c = version2string(b) if c != a: print("Unexpected result:", c) fail("test 1 failed") a = "1.0.1-open" b = parse_version(a) c = version2string(b) if c != a: print("Unexpected result:", c) fail("test 1 failed") a = "1.0.1-beta.12" b = parse_version(a) c = version2string(b) if c != "1.0.1.12-beta": print("Unexpected result:", c) fail("test 1 failed") a = "1.0" b = parse_version(a) c = version2string(b) if c != a: print("Unexpected result:", c) fail("test 1 failed") a = "1.2.3" b = parse_version(a) c = version2string(b) if c != a: print("Unexpected result:", c) fail("test 1 failed") def compare_versions(tversion1, tversion2): for i in range(4): if tversion1[i] > tversion2[i]: return 1 if tversion1[i] < tversion2[i]: return -1 if tversion1[4] == "": if tversion2[4] == "": return 0 return 1 if tversion2[4] == "": if tversion1[4] == "": return 0 return -1 if tversion1[4] > tversion2[4]: return 1 if tversion1[4] < tversion2[4]: return -1 return 0 def test_compare_versions(): z = [["1.1", "1.1", 0], ["1.1", "1.2", -1], ["1.2", "1.1", 1], ["1.1.1", "1.1", 1], ["1.1", "1.1.1", -1], ["1.1.2.4", "1.1.2.3-beta", 1], ["1.1.2.3", "1.1.2.3-beta", 1]] for k in z: c = parse_version(k[0]) d = parse_version(k[1]) v = compare_versions(c, d) if v != k[2]: print("Unexpected result {} {} = {} (expected {})".format(k[0], k[1], v, k[2])) fail("test failed")
params = { 'contacts_csv': 'CUSTOMERCONTACTS.csv', 'shipments_csv': 'CUSTOMERSHIPMENTS.csv', 'packingslips_csv': 'PACKINGSLIPS.csv', 'log_file': 'logfile.txt', 'BigVendor_code': 2758, 'dlr_email_template_file': 'Dealer_email.html', 'BigVendor_email_template_file': 'BigVendor_email.html', # Credentials created via http://www.ups.com/upsdeveloperkit 'ups_access_license': "AAAAAAAAAAAAAAA", 'ups_userid': "xxxxxx", 'ups_password': "xxxxxxx", # Used only for creating the link for an email recipient 'ups_web_root': "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=", 'gmail_userid': 'xxxxxxxx', 'gmail_password': 'xxxxxxxxx', # gmail password is specified with "--password xxxx" command line option. # This must be set to something that will never appear in a real email, # because we're doublechecking before sending them to make sure # this text isn't in the email to send. 'text_placeholder_if_info_missing': '<font color="red">[MISSING]</font>', 'email_from_name': "[My Company] Shipping", 'email_subject_line_jd': "Your [Big Vendor] direct order with [My Company] has shipped", 'email_subject_line_non_jd': "Your order with [My Company] has shipped", #(need to build in an additional parameter if there will be different subject lines # for JD vs. non-JD orders.) 'email_from_name_for_internal_notes': "Shipping notification records", 'email_address_for_company_records': "xxxx@xxxx.com", 'email_address_for_contact_info_updating': "xxxx@xxxx.com", # The 'simulated_emails' option causes the emailer to create HTML files in the # working directory containing the email example, instead of actually sending # anything to any email address. Overrides the "testing mode" below. 'simulated_emails': False, # The 'email_in_testing_mode' option allows email addresses found in the # customer contacts sheet to be replaced by these testing addresses. # This has no effect if "simulated_emails" is True. 'email_in_testing_mode': False, 'test_email_recipient_as_customer': "xxxx@xxxx.com", 'test_email_recipient_as_records': "xxxx@xxxx.com", 'test_email_recipient_as_contactupdating': "xxxx@xxxx.com", } item_column_labels = { 'part': 'Part No.', 'description': 'Description', 'quantity': 'Qty' } shipments_heading = { 'name': 'Name', 'cust_id': 'Customer', 'BigVendor_shortchar_lookup': 'ShortChar01', } pslips_heading = { 'slip_id': 'Packing Slip', 'cust_id': 'Customer', # program uses only the right-most "Customer" value 'order_id': 'Order', 'BigVendor_dns_number': 'Reference 4', 'BigVendor_shortchar_id': 'Reference 5', 'addr_name': 'Name', 'addr_line1': "Address", 'addr_line2': "Address2", 'addr_line3': "Address3", 'addr_city': 'City', 'addr_state': 'State/Province', 'addr_pcode': 'Postal Code', 'shipvia': 'Ship Via', 'tracknum': 'Tracking Number', 'description': 'Rev Description', 'partcode': 'Part', 'quantity': 'Qty', } contacts_heading = { 'cust_id': 'Customer', 'name': 'Name', 'email': 'EMail Address', } mail_fieldtags = { 'greeting_name': 'putncdealernamehere', 'dns': 'putdnshere', # ["Big Vendor"] orders only 'fso': 'putfsohere', 'date': 'putdatehere', 'tracknum': 'placetrackingnumberhere', 'a_name': 'putnamehere', 'a_address': 'putaddresshere', 'a_citysz': 'putcityszhere', 'itemtable': 'puttablehere', }
# # PySNMP MIB module RADLAN-DHCPv6-RELAY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-DHCPv6-RELAY # Produced by pysmi-0.3.4 at Mon Apr 29 20:37:53 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint") InetAddressIPv6, InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressIPv6", "InetAddressType", "InetAddress") rlDhcpv6Relay, = mibBuilder.importSymbols("RADLAN-DHCPv6", "rlDhcpv6Relay") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Counter64, IpAddress, Integer32, TimeTicks, Counter32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, MibIdentifier, ModuleIdentity, Gauge32, Bits, iso, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "IpAddress", "Integer32", "TimeTicks", "Counter32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "MibIdentifier", "ModuleIdentity", "Gauge32", "Bits", "iso", "ObjectIdentity") DisplayString, RowStatus, MacAddress, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "MacAddress", "TextualConvention", "TruthValue") rlDhcpv6RelayInterfaceListTable = MibTable((1, 3, 6, 1, 4, 1, 89, 214, 3, 1), ) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceListTable.setStatus('current') rlDhcpv6RelayInterfaceListEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1), ).setIndexNames((0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceListIfIndex")) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceListEntry.setStatus('current') rlDhcpv6RelayInterfaceListIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1, 1), Unsigned32()) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceListIfIndex.setStatus('current') rlDhcpv6RelayInterfaceListRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1, 2), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceListRowStatus.setStatus('current') rlDhcpv6RelayDestinationsGlobalTable = MibTable((1, 3, 6, 1, 4, 1, 89, 214, 3, 2), ) if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalTable.setStatus('current') rlDhcpv6RelayDestinationsGlobalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1), ).setIndexNames((0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayDestinationsGlobalIpv6AddrType"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayDestinationsGlobalIpv6Addr"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayDestinationsGlobalOutputInterface")) if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalEntry.setStatus('current') rlDhcpv6RelayDestinationsGlobalIpv6AddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 1), InetAddressType()) if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalIpv6AddrType.setStatus('current') rlDhcpv6RelayDestinationsGlobalIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 2), InetAddress()) if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalIpv6Addr.setStatus('current') rlDhcpv6RelayDestinationsGlobalOutputInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 3), Unsigned32()) if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalOutputInterface.setStatus('current') rlDhcpv6RelayDestinationsGlobalRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 4), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalRowStatus.setStatus('current') rlDhcpv6RelayInterfaceDestinationsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 214, 3, 3), ) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsTable.setStatus('current') rlDhcpv6RelayInterfaceDestinationsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1), ).setIndexNames((0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceDestinationsIfindex"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceDestinationsIpv6AddrType"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceDestinationsIpv6Addr"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceDestinationsOutputInterface")) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsEntry.setStatus('current') rlDhcpv6RelayInterfaceDestinationsIfindex = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 1), Unsigned32()) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsIfindex.setStatus('current') rlDhcpv6RelayInterfaceDestinationsIpv6AddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 2), InetAddressType()) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsIpv6AddrType.setStatus('current') rlDhcpv6RelayInterfaceDestinationsIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 3), InetAddress()) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsIpv6Addr.setStatus('current') rlDhcpv6RelayInterfaceDestinationsOutputInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 4), Unsigned32()) if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsOutputInterface.setStatus('current') rlDhcpv6RelayInterfaceDestinationsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 5), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsRowStatus.setStatus('current') mibBuilder.exportSymbols("RADLAN-DHCPv6-RELAY", rlDhcpv6RelayInterfaceDestinationsEntry=rlDhcpv6RelayInterfaceDestinationsEntry, rlDhcpv6RelayInterfaceDestinationsOutputInterface=rlDhcpv6RelayInterfaceDestinationsOutputInterface, rlDhcpv6RelayInterfaceDestinationsRowStatus=rlDhcpv6RelayInterfaceDestinationsRowStatus, rlDhcpv6RelayInterfaceListTable=rlDhcpv6RelayInterfaceListTable, rlDhcpv6RelayDestinationsGlobalOutputInterface=rlDhcpv6RelayDestinationsGlobalOutputInterface, rlDhcpv6RelayInterfaceListIfIndex=rlDhcpv6RelayInterfaceListIfIndex, rlDhcpv6RelayDestinationsGlobalIpv6AddrType=rlDhcpv6RelayDestinationsGlobalIpv6AddrType, rlDhcpv6RelayInterfaceDestinationsIfindex=rlDhcpv6RelayInterfaceDestinationsIfindex, rlDhcpv6RelayInterfaceDestinationsIpv6AddrType=rlDhcpv6RelayInterfaceDestinationsIpv6AddrType, rlDhcpv6RelayDestinationsGlobalIpv6Addr=rlDhcpv6RelayDestinationsGlobalIpv6Addr, rlDhcpv6RelayDestinationsGlobalRowStatus=rlDhcpv6RelayDestinationsGlobalRowStatus, rlDhcpv6RelayInterfaceDestinationsTable=rlDhcpv6RelayInterfaceDestinationsTable, rlDhcpv6RelayInterfaceDestinationsIpv6Addr=rlDhcpv6RelayInterfaceDestinationsIpv6Addr, rlDhcpv6RelayDestinationsGlobalEntry=rlDhcpv6RelayDestinationsGlobalEntry, rlDhcpv6RelayInterfaceListEntry=rlDhcpv6RelayInterfaceListEntry, rlDhcpv6RelayDestinationsGlobalTable=rlDhcpv6RelayDestinationsGlobalTable, rlDhcpv6RelayInterfaceListRowStatus=rlDhcpv6RelayInterfaceListRowStatus)
class FlaskAWSCognitoError(Exception): pass class TokenVerifyError(Exception): pass
# find numbers n such that n and n^2 have same digit sum def sum_digit(i): """Die Funktion berechnet die Quersumme von i.""" summe = 0 for digit in str(i): summe += int(digit) return summe def check_same_digit(m, exponent): """Die Funktion checkt, welche Zahlen von 0 bis m die gleiche Quersumme wie ihre Quadratzahlen haben.""" i = 0 while i <= m: if sum_digit(i) == sum_digit(i**exponent): numbers.append(i) else: pass i += 1 numbers = [] check_same_digit(1000, 2) print(numbers)
class Queue: def __init__(self): self.front = None self.rear = None def enqueue(self,value): new_node = value if self.rear: self.rear.next = new_node self.rear = new_node else: self.front = new_node self.rear = new_node def dequeue(self): try: if self.front: temp = self.front self.front = self.front.next return temp.value else: raise Exception('Empty Queue') except: return 'Empty Queue' def peek(self): try: if self.front: return self.front.value else: raise Exception('Empty Queue') except: return 'Empty Queue' def isEmpty(self): if self.front: return False elif not self.front: return True class Node: def __init__(self,value): self.value = value self.next = None self.left = None self.right = None class BinaryTree: def __init__(self): self.root = None def pre_order(self): output=[] def _walk(node): output.append(node.value) if node.left: _walk(node.left) if node.right: _walk(node.right) _walk(self.root) return output def in_order(self): output=[] def _walk(node): if node.left: _walk(node.left) output.append(node.value) if node.right: _walk(node.right) _walk(self.root) return output def post_order(self): output=[] def _walk(node): if node.left: _walk(node.left) if node.right: _walk(node.right) output.append(node.value) _walk(self.root) return output def breadth_first(self): if self.root: output=[] q = Queue() q.enqueue(self.root) while q.front != None: current = q.front if current.left: q.enqueue(current.left) if current.right: q.enqueue(current.right) output.append(current.value) q.dequeue() return output else: return 'Empty Tree' def find_maximum_value(self): self.max=self.root.value def _walk(node): if node.value > self.max: self.max =node.value if node.left: _walk(node.left) if node.right: _walk(node.right) _walk(self.root) return self.max class BinarySearchTree(BinaryTree): def add(self, value): if not self.root: self.root = Node(value) else: def _walk(node): if value < node.value: if not node.left: node.left = Node(value) return else: _walk(node.left) else: if not node.right: node.right = Node(value) return else: _walk(node.right) _walk(self.root) def contains(self,value): if self.root: current = self.root def _walk(current): if value == current.value: return True elif value < current.value: current = current.left if current: return _walk(current) elif value > current.value: current = current.right if current: return _walk(current) if _walk(current) == True: return True else: return False else: return False def fizz_buzz_tree(tree): new_tree = tree if new_tree.root != None: def _walk(node): if node.value%3==0 and node.value%5==0: node.value = 'FizzBuzz' elif node.value%3==0: node.value = 'Fizz' elif node.value%5==0: node.value = 'Buzz' elif node.value%3!=0 and node.value%5!=0: node.value = str(node.value) if node.left: _walk(node.left) if node.right: _walk(node.right) _walk(new_tree.root) return new_tree else: new_tree.root =Node('Tree is Empty') return new_tree if __name__ == "__main__": bt = BinaryTree() bt.root = Node(4) bt.root.right = Node(9) bt.root.left = Node(15) bt.root.right.left = Node(6) bt.root.left.left = Node(3) bt.root.left.right = Node(5) print(bt.find_maximum_value()) print(fizz_buzz_tree(bt).breadth_first())
class db_connection_issue(Exception): pass
# copyright by Adam Celej class Zamowienie: def __init__(self, id_zamowienia, id_zamawiajacego, id_przedmiotu): self.id_zamowienia = id_zamowienia self.id_zamawiajacego = id_zamawiajacego self.id_przedmiotu = id_przedmiotu self.lista_zamowien = [] def __del__(self): print("Zamowienie zostalo anulowane")
GRAY, BLACK = 0, 1 def top_sort_recursive(graph): """ Time complexity is the same as DFS, which is O(V + E) Space complexity: O(V) """ order, enter, state = [], set(graph), {} def dfs(node): state[node] = GRAY #print(node) for k in graph.get(node, ()): sk = state.get(k, None) if sk == GRAY: raise ValueError("cycle") if sk == BLACK: continue enter.discard(k) dfs(k) order.append(node) state[node] = BLACK while enter: dfs(enter.pop()) return order def top_sort(graph): """ Time complexity is the same as DFS, which is O(V + E) Space complexity: O(V) """ order, enter, state = [], set(graph), {} def is_ready(node): lst = graph.get(node, ()) if len(lst) == 0: return True for k in lst: sk = state.get(k, None) if sk == GRAY: raise ValueError("cycle") if sk != BLACK: return False return True while enter: node = enter.pop() stack = [] while True: state[node] = GRAY stack.append(node) for k in graph.get(node, ()): sk = state.get(k, None) if sk == GRAY: raise ValueError("cycle") if sk == BLACK: continue enter.discard(k) stack.append(k) while stack and is_ready(stack[-1]): node = stack.pop() order.append(node) state[node] = BLACK if len(stack) == 0: break node = stack.pop() return order
# -*- coding: utf-8 -*- class Match: score = [] opcionset = {"1st": 0, "2nd": 1, "3rd": 2, "4th": 3, "5th": 4} def __init__(self, player1, player2, pacted_sets): self.p1 = player1 self.p2 = player2 self.pacted_sets = pacted_sets self.textoganador = "" self.wonp1 = 0 self.wonp2 = 0 del self.score[:] self.score.append("0-0") self.ganadorinicial = "none" def score_set(self): self.ganador() return "{0} | {1}".format(self.textoganador, self.listascoreset()) def iniciarganador(self, playerwon): if self.ganadorinicial == "none": self.ganadorinicial = playerwon def listascoreset(self): listascore = "" inicio = 0 for index in self.score: if inicio == 0: listascore = index inicio += 1 else: listascore = listascore + ", " + index return listascore def ordenarscoreganador(self, playerwon, scorej1, scorej2): self.iniciarganador(playerwon) if self.ganadorinicial == playerwon: return scorej1 + "-" + scorej2 else: return scorej2 + "-" + scorej1 def save_set_won(self, player): if(player == self.p1): self.wonp1 += 1 else: self.wonp2 += 1 def save_score_set(self, scorej1, scorej2, numberset, playerwon): if(numberset == "1st"): self.score[0] = self.ordenarscoreganador( playerwon, scorej1, scorej2) else: self.score.insert(self.opcionset.get( numberset), self.ordenarscoreganador(playerwon, scorej1, scorej2)) def ganador(self): numeroaum = 1 if int(self.pacted_sets) == 5: numeroaum = 2 if((self.wonp1 + numeroaum) == int(self.pacted_sets)): self.textoganador = self.p1 + " defeated " + self.p2 elif ((self.wonp2 + numeroaum) == int(self.pacted_sets)): self.textoganador = self.p2 + " defeated " + self.p1 else: self.textoganador = self.p1 + " plays with " + self.p2
# Copyright 2021 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Definition of java_library rule. """ load(":common/java/java_common.bzl", "JAVA_COMMON_DEP") load(":common/rule_util.bzl", "create_rule") load(":common/java/java_semantics.bzl", "semantics") load(":common/java/proguard_validation.bzl", "VALIDATE_PROGUARD_SPECS") JavaInfo = _builtins.toplevel.JavaInfo JavaPluginInfo = _builtins.toplevel.JavaPluginInfo CcInfo = _builtins.toplevel.CcInfo def _java_library_rule_impl(ctx): if not ctx.attr.srcs and ctx.attr.deps: fail("deps not allowed without srcs; move to runtime_deps?") semantics.check_rule(ctx) semantics.check_dependency_rule_kinds(ctx) extra_resources = semantics.preprocess(ctx) base_info = JAVA_COMMON_DEP.call(ctx, extra_resources = extra_resources, output_prefix = "lib") proguard_specs_provider = VALIDATE_PROGUARD_SPECS.call(ctx) base_info.output_groups["_hidden_top_level_INTERNAL_"] = proguard_specs_provider.specs base_info.extra_providers.append(proguard_specs_provider) java_info = semantics.postprocess(ctx, base_info) return [ base_info.default_info, java_info, base_info.instrumented_files_info, OutputGroupInfo(**base_info.output_groups), ] + base_info.extra_providers java_library = create_rule( _java_library_rule_impl, attrs = dict( { "licenses": attr.license() if hasattr(attr, "license") else attr.string_list(), }, **dict( semantics.EXTRA_ATTRIBUTES, **({ "classjar": attr.output(), "sourcejar": attr.output(), } if semantics.EXPERIMENTAL_USE_OUTPUTATTR_IN_JAVALIBRARY else {}) ) ), deps = [JAVA_COMMON_DEP, VALIDATE_PROGUARD_SPECS] + semantics.EXTRA_DEPS, provides = [JavaInfo], outputs = {} if semantics.EXPERIMENTAL_USE_FILEGROUPS_IN_JAVALIBRARY or semantics.EXPERIMENTAL_USE_OUTPUTATTR_IN_JAVALIBRARY else { "classjar": "lib%{name}.jar", "sourcejar": "lib%{name}-src.jar", }, compile_one_filetype = ".java", )
"""************************************************************************** Author : Rohit Kumar | r.k2962002@gmail.com | https://rohitkumar.ml Domain : Python Language | May Long Challenge 2021 (CodeChef) Programs : Golf (LKDNGOLF) URL : https://www.codechef.com/MAY21C/problems/LKDNGOLF/ **************************************************************************""" for t in range(int(input())): n, x, k = map(int, input().split()) if x%k == 0: print("YES") elif (n+1-x)%k == 0: print("YES") else: print("NO") """**************************************************************************"""
def ds(array): minv = 0 maxv = len(array) - 1 current = 0 while minv <= maxv: current = (maxv + minv) // 2 if (array[current - 1], array[current]) == ("🚿", "🍽️"): return current elif (array[current - 1], array[current]) == ("🚿", "🚿"): minv = current + 1 else: maxv = current - 1 return -1 do_the_dishes = ["🚿", "🚿", "🚿", "🚿", "🍽️", "🍽️"] print(f"Oops - dishes were left at T+{ds(do_the_dishes)}.")
#!/usr/bin/env python3 def day5(filename): with open("input.txt", "r") as rd: data = rd.readlines() nice = [s for s in data if nice_string(s)] print("Step 1:", len(nice)) def nice_string(string): vowels = "aeiou" forbidden = ("ab", "cd", "pq", "xy") if len([l for l in string if l in vowels]) < 3: return False for x in range(len(string)-1): if string[x] == string[x+1]: break else: return False for x in forbidden: if x in string: return False return True if __name__ == "__main__": assert nice_string("ugknbfddgicrmopn") assert nice_string("aaa") assert not nice_string("jchzalrnumimnmhp") assert not nice_string("haegwjzuvuyypxyu") assert not nice_string("dvszwmarrgswjxmb") day5("input.txt")
#!usr/bin/env python3 # python provides a way for specifying function parameters using keywords. # we can define a function that takes positional arguments along with keyword # arguments that take optional values. Then, when you want to call the # function, you can specify values by position or by keyword. # sometimes we want to enforce calling a function by specifying parameters by # keyword, since it can improve the readability of the code and can make it # safer in case the parameter has a significant effect on how the program runs. # This way, the function caller is aware of the significance of the parameter # and others who read the code can easily see and understand what's happening. # To accomplish this we can separate the positional arguments with a single # asterisk character followed by parameters that are keyword-only. # if we really need to make sure that someone using a particular function # clearly understands what they're doing and why they're doing it, we can use # keyword-only arguments to help ensure clarity in the code. # use keyword-only arguments to help ensure code clarity def my_function(arg1, arg2, *, suppress_exceptions=False): print(arg1, arg2, suppress_exceptions) def my_function2(*, arg1, arg2): print(arg1, arg2) def main(): # if we try to call the function without the keyword we'll get # "TypeError: my_function() takes 2 positional arguments but 3 were given" # my_function(1, 2, True) my_function(1, 2, suppress_exceptions=True) my_function(arg2=1, arg1=2, suppress_exceptions=True) # my_function2(1,2) # will throw # TypeError: my_function2() takes 0 positional arguments but 2 were given my_function2(arg1=1, arg2=2) if __name__ == "__main__": main() # CONSOLE OUTPUT: # 1 2 True # 2 1 True # 1 2
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool: if not p and not q: return True elif (p and not q) or (not p and q): return False else: stack=[(p, q)] while(stack): cur_p, cur_q = stack.pop(0) if cur_p.val!=cur_q.val: return False if cur_p.left and cur_q.left: stack.append((cur_p.left, cur_q.left)) if cur_p.right and cur_q.right: stack.append((cur_p.right, cur_q.right)) if (cur_p.left and not cur_q.left) or (not cur_p.left and cur_q.left): return False if (cur_p.right and not cur_q.right) or (not cur_p.right and cur_q.right): return False return True
""" 关键是如何实现 getMin(),使得 getMin 为时间复杂度为线性 """ class MinStack: def __init__(self): """ initialize your data structure here. """ self.stack = [] def push(self, x): """ :type x: int :rtype: void """ last_min = self.getMin() if last_min is not None: cur_min = min(x, last_min) else: cur_min = x # 每次 push 保存当前 stack 的最小值 self.stack.append((x, cur_min)) def pop(self): """ :rtype: void """ if len(self.stack) != 0: self.stack.pop() def top(self): """ :rtype: int """ if len(self.stack) != 0: return self.stack[-1][0] else: return None def getMin(self): """ :rtype: int """ if len(self.stack) != 0: return self.stack[-1][1] else: return None class MinStack2: def __init__(self): """ initialize your data structure here. """ self.min = float('inf') self.val = [] def push(self, x): """ :type x: int :rtype: void """ if x <= self.min: # 保存上一个 stack 状态的最小值 self.val.append(self.min) # 设置当前最小值 self.min = x # 添加 stack 值 self.val.append(x) def pop(self): """ :rtype: void """ tmp = self.val.pop() # 如果 tmp 是 保存的最小值,则需要再做一次 pop,获得上一个状态的最小值 if tmp == self.min: self.min = self.val.pop() def top(self): """ :rtype: int """ return self.val[-1] def getMin(self): """ :rtype: int """ return self.min if __name__ == "__main__": obj = MinStack2() obj.push(-2) obj.push(0) obj.push(-3) assert obj.getMin() == -3 obj.pop() assert obj.top() == 0 assert obj.getMin() == -2
# !/usr/bin/env python # -*- coding:utf-8 -*- """ Copyright 2020 Tianshu AI Platform. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ============================================================= """ delayTaskLua = """ local element = redis.call('zscore', KEYS[1],ARGV[1]) if element then redis.call('zadd',KEYS[1],ARGV[2],ARGV[1]) end """
class PeekPointers(GenericCommand): """Command to help find pointers belonging to other memory regions helpful in case of OOB Read when looking for specific pointers""" _cmdline_ = "peek-pointers" _syntax_ = "{:s} starting_address <object_name> <all>".format(_cmdline_) @only_if_gdb_running def do_invoke(self, argv): argc = len(argv) if argc not in (1, 2, 3): self.usage() return addr = lookup_address(int(argv[0], 16)) if (addr.value % DEFAULT_PAGE_SIZE): err("<starting_address> must be aligned to a page") return unique = True if "all" not in argv else False vmmap = get_process_maps() if argc >= 2 : section_name = argv[1].lower() if section_name == "stack": sections = [(s.path, s.page_start, s.page_end) for s in vmmap if s.path == "[stack]"] elif section_name == "heap": sections = [(s.path, s.page_start, s.page_end) for s in vmmap if s.path == "[heap]"] elif section_name != "all": sections = [ (s.path, s.page_start, s.page_end) for s in vmmap if section_name in s.path ] else: sections = [ (s.path, s.page_start, s.page_end) for s in vmmap ] else: sections = [ (s.path, s.page_start, s.page_end) for s in vmmap ] while addr.valid: addr_value = read_int_from_memory(addr.value) if lookup_address(addr_value): for i, section in enumerate(sections): name, start_addr, end_addr = section if start_addr <= addr_value < end_addr: sym = gdb_get_location_from_symbol(addr_value) sym = "<{:s}+{:04x}>".format(*sym) if sym else '' if name.startswith("/"): name = os.path.basename(name) elif len(name)==0: name = get_filename() ok(" Found pointer at 0x{:x} to 0x{:x} {:s} ('{:s}', perm: {:s})".format(addr.value, addr_value, sym, name, str(addr.section.permission), )) if unique: del sections[i] break addr = lookup_address(addr.value + current_arch.ptrsize) return if __name__ == "__main__": register_external_command(PeekPointers())
"""Miscellaneous utilities""" def get_remote_addr(req): """ Returns the remote IP address of a user """ return req.environ.get('HTTP_X_REAL_IP', req.remote_addr) def object_access_allowed(groups, path): """ Decide if a user is allowed to access a path """ for group in groups.split(','): if path.startswith(group): return True return False
# vim: fileencoding=utf-8 tabstop=2 softtabstop=2 shiftwidth=2 expandtab name = 'São Paulo' print(name.encode('utf_8')) print(name.encode('utf_16')) print(name.encode('iso8859_1')) # latin1 try: print(name.encode('cp437')) # the character set of the original IBM PC except UnicodeEncodeError: print('cp437: UnicodeEncodeError') # ignore: skip the character (bad practice) print(name.encode('cp437', errors='ignore')) # So Paulo # replace: show the character as '?' (causes the loss of data but noticeable) print(name.encode('cp437', errors='replace')) # S?o Paulo # xmlcharrefreplace: change the character to XML object print(name.encode('cp437', errors='xmlcharrefreplace')) # S&#227;o Paulo octets = b'Montr\xe9al' # cp1252: Windows 1252. Superset of latin1 print(octets.decode('cp1252')) # Montréal # iso8859-7: for the greek alphabet print(octets.decode('iso8859_7')) # Montrιal # koi8_r: for the cyrillic alphabet print(octets.decode('koi8_r')) # MontrИal try: octets.decode('utf-8') except UnicodeDecodeError as e: print(e) # changes \xe9 to � (U+FFFD) # which is the official replacement character of unicode print(octets.decode('utf-8', errors='replace'))
#Faça um programa que leia algo pelo teclado e mostre na tela o seu tipo primmitivo e todos os infumaçõess possiveis sobre ele. a=input('\033[1;36mDigite algo:\033[m') print('\033[1;34mO tipo primitivo desse valor é',type(a)) print('Só tem espaço?',a.isspace()) print('É um numero?',a.isnumeric()) print('É alfabético?',a.isalpha()) print('É alfanumérico?',a.isalnum()) print('Esta em maiúsculas?',a.isupper()) print('Esrá em minúsculas?',a.islower()) print('Esta capitalizada',a.istitle())
# The function for selection sort def SelectionSort(list): for i in range (0,len(list)): elem=list[i] pos=i for j in range(i+1,len(list)): if list[j]>=elem: elem=list[j] pos=j list[i], list[pos] = list[pos], list[i] return list def HybridSort(nlist): # If the length of the list is less than or equal to 4, then sort using selection sort if len(nlist)<=4: nlist=SelectionSort(nlist) # Otherwise sort using merge sort, unless the list is of length 1 if len(nlist)>1 and len(nlist)>4: # Find the middle of the list mid = len(nlist)//2 # Use this to create two lists lefthalf = nlist[:mid] righthalf = nlist[mid:] HybridSort(lefthalf) HybridSort(righthalf) # Merging i=j=k=0 # While the lists are not exhausted while i < len(lefthalf) and j < len(righthalf): # If the left half first index is greater than right half, add it to the output list if lefthalf[i] >= righthalf[j]: nlist[k]=lefthalf[i] # Increment the value of i so that the element would not be added multiple times i=i+1 else: # Other wise the right half first index is larger, so add that nlist[k]=righthalf[j] # And again increment the index j=j+1 # Increment k to jump to the next index in nlist k=k+1 # If the loop has broken out to here then one of the lists is empty # Loop adding all the remaining elements of the lefthalf list, if it is empty then just move on while i < len(lefthalf): nlist[k]=lefthalf[i] i=i+1 k=k+1 # Loop adding all the remaining elements of the righthalf list, again, if it is empty then just move on while j < len(righthalf): nlist[k]=righthalf[j] j=j+1 k=k+1
''' Python module to hold DNS processing exceptions ''' class SWAN_DNS_Exception(Exception): ''' General SWAN DNS exception ''' pass class SWAN_StopProcessingRequest(SWAN_DNS_Exception): ''' An exception which indicates to stop the processing of a dns request. This shuld be thrown from a dns processing modules in order to specify that processing is no longer needed and an answer should be returned to the sender ''' pass class SWAN_UnkownInetFamily(SWAN_DNS_Exception): ''' An exception which indicate that the server was started with unkown inet_family value ''' pass class SWAN_SkipProcessing(SWAN_DNS_Exception): ''' An exception which indicates that a module processing should be skipped. ''' pass class SWAN_ModuleConfigurationError(SWAN_DNS_Exception): ''' An exception which indicates that a module configuration is invalid ''' pass class SWAN_ModuleLoadError(SWAN_DNS_Exception): ''' An exception which indicate that there was a problem loading a module ''' pass class SWAN_NoSuchZoneError(SWAN_DNS_Exception): ''' An exception which indicate that a dns server can not resolve a specific zone. ''' pass class SWAN_DropAnswer(SWAN_DNS_Exception): ''' An exception which indicates to drop the response and not provide answers to the client ''' pass class SWAN_ConfigurationError(SWAN_DNS_Exception): ''' An exception which indicates that loading the configuration of a server is not valid ''' pass
def insertion_sort(A): n = len(A) for i in range(1,n): key = A[i] j = i-1 while (j >= 0) and (A[j] > key): A[j+1] = A[j] j -= 1 A[j + 1] = key return A u = [1,2,3,4,5,6] v = [6,5,4,3,2,1] print(insertion_sort(u)) print(insertion_sort(v))
prompt = "\nEnter cities you've visited" prompt += "\nEnter quit when you're finished! " cities = [] while True: place = input(prompt) if place == 'quit': break else: print(f"I've always wanted to go to {place.title()}!!") cities.append(prompt) for city in cities: print(city.title())
# -*- encoding: utf-8 -*- """ @File : __init__.py.py @Time : 2021/1/22 16:51 @Author : chise @Email : chise123@live.com @Software: PyCharm @info : """
"""Experiment 1, Analysis Group 3. Characterizing the relationship between respiration and global BOLD signal with and without denoising. RPV correlated with SD of mean cortical signal from: - TE30 - FIT-R2 - MEDN - MEDN+GODEC - MEDN+Nuis-Reg - MEDN+RVT-Reg - MEDN+RV-Reg - MEDN+aCompCor - MEDN+dGSR - MEDN+MIR - MEDN+GSR Plot respiration time series for deep breaths against mean signal from: - OC - MEDN - MEDN+GODEC - TE30 - FIT-R2 - MEDN+Nuis-Reg - MEDN+RVT-Reg - MEDN+RV-Reg - MEDN+aCompCor - MEDN+dGSR - MEDN+MIR - MEDN+GSR """ def correlate_rpv_with_cortical_sd( participants_file, target_file_patterns, mask_pattern ): """Perform analysis 1. Correlate RPV with standard deviation of mean cortical signal from each of the derivatives, across participants. Perform one-sided test of significance on correlation coefficient to determine if RPV is significantly, positively correlated with SD of mean cortical signal after each denoising approach. """ ... def plot_deep_breath_cortical_signal( participants_file, deep_breath_indices, target_file_patterns, dseg_pattern, ): """Generate plots for analysis 2. Use visually-identified indices of deep breaths from the respiratory trace to extract time series from 30 seconds before to 40 seconds after the breath from each of the derivatives, then plot the mean signals. """ ...
#2D Array matrix=[ [1,2,3], [4,5,6], [7,8,9] ] for row in matrix: for col in row: print(col)
# -*- Python -*- """Repository rule for arm compiler autoconfiguration.""" def _tpl(repository_ctx, tpl, substitutions = {}, out = None): if not out: out = tpl repository_ctx.template( out, Label("//third_party/toolchains/cpus/arm:%s.tpl" % tpl), substitutions, ) def _arm_compiler_configure_impl(repository_ctx): # We need to find a cross-compilation include directory for Python, so look # for an environment variable. Be warned, this crosstool template is only # regenerated on the first run of Bazel, so if you change the variable after # it may not be reflected in later builds. Doing a shutdown and clean of Bazel # doesn't fix this, you'll need to delete the generated file at something like: # external/local_config_arm_compiler/CROSSTOOL in your Bazel install. _tpl(repository_ctx, "CROSSTOOL", { "%{ARM_COMPILER_PATH}%": str(repository_ctx.path( repository_ctx.attr.remote_config_repo, )), }) repository_ctx.symlink(repository_ctx.attr.build_file, "BUILD") arm_compiler_configure = repository_rule( implementation = _arm_compiler_configure_impl, attrs = { "remote_config_repo": attr.string(mandatory = False, default = ""), "build_file": attr.label(), }, )
class Solution: def isPowerOfThree(self, n: int) -> bool: if n <= 0: return False num, remainder = n // 3, n % 3 if not remainder: return self.isPowerOfThree(num) else: return True if not num and remainder == 1 else False
with open ('text.txt', 'r') as f: names = sorted (name.rstrip ('\n') for name in f) print (names)
""" https://leetcode.com/problems/valid-palindrome/ """ class Solution: def isPalindrome(self, s: str) -> bool: sanitized_string = "".join(i.lower() for i in s if i.isalnum()) return sanitized_string == sanitized_string[::-1]
# # PySNMP MIB module CXQLLC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXQLLC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:17:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion") SapIndex, Alias, ThruputClass, cxQLLC = mibBuilder.importSymbols("CXProduct-SMI", "SapIndex", "Alias", "ThruputClass", "cxQLLC") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, iso, Counter32, TimeTicks, Counter64, NotificationType, ModuleIdentity, Gauge32, MibIdentifier, Integer32, Unsigned32, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "iso", "Counter32", "TimeTicks", "Counter64", "NotificationType", "ModuleIdentity", "Gauge32", "MibIdentifier", "Integer32", "Unsigned32", "Bits") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") class X25Address(DisplayString): subtypeSpec = DisplayString.subtypeSpec + ValueSizeConstraint(0, 15) class PacketSize(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(4, 5, 6, 7, 8, 9, 10, 11, 12)) namedValues = NamedValues(("bytes16", 4), ("bytes32", 5), ("bytes64", 6), ("bytes128", 7), ("bytes256", 8), ("bytes512", 9), ("bytes1024", 10), ("bytes2048", 11), ("bytes4096", 12)) qllcSapTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1), ) if mibBuilder.loadTexts: qllcSapTable.setStatus('mandatory') qllcSapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1), ).setIndexNames((0, "CXQLLC-MIB", "qllcSapNumber")) if mibBuilder.loadTexts: qllcSapEntry.setStatus('mandatory') qllcSapNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 1), SapIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcSapNumber.setStatus('mandatory') qllcSapRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcSapRowStatus.setStatus('mandatory') qllcSapType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("lower", 1), ("upper", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcSapType.setStatus('mandatory') qllcSapAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 4), Alias()).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcSapAlias.setStatus('mandatory') qllcSapCompanionAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 5), Alias()).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcSapCompanionAlias.setStatus('mandatory') qllcSapSnalcRef = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 8))).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcSapSnalcRef.setStatus('mandatory') qllcSapOperationalMode = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("offline", 1), ("online", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcSapOperationalMode.setStatus('mandatory') qllcDteTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2), ) if mibBuilder.loadTexts: qllcDteTable.setStatus('mandatory') qllcDteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1), ).setIndexNames((0, "CXQLLC-MIB", "qllcDteSap"), (0, "CXQLLC-MIB", "qllcDteIndex")) if mibBuilder.loadTexts: qllcDteEntry.setStatus('mandatory') qllcDteSap = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 1), SapIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteSap.setStatus('mandatory') qllcDteIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteIndex.setStatus('mandatory') qllcDteRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteRowStatus.setStatus('mandatory') qllcDteType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("terminalInterfaceUnit", 1), ("hostInterfaceUnit", 2))).clone('terminalInterfaceUnit')).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteType.setStatus('mandatory') qllcDteCalledAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 5), X25Address()).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteCalledAddress.setStatus('mandatory') qllcDteCallingAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 6), X25Address()).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteCallingAddress.setStatus('mandatory') qllcDteDBitCall = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2))).clone('yes')).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteDBitCall.setStatus('mandatory') qllcDteWindow = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 7)).clone(7)).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteWindow.setStatus('mandatory') qllcDtePacketSize = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 9), PacketSize().clone('bytes128')).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDtePacketSize.setStatus('mandatory') qllcDteThroughput = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 10), ThruputClass().clone('bps9600')).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteThroughput.setStatus('mandatory') qllcDteUserData = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 11), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 12))).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteUserData.setStatus('mandatory') qllcDteFacility = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 12), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteFacility.setStatus('mandatory') qllcDteMemotec = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("nonmemotec", 1), ("cx900", 2), ("legacy", 3), ("pvc", 4))).clone('cx900')).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteMemotec.setStatus('mandatory') qllcDtePvc = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2))).clone('no')).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDtePvc.setStatus('mandatory') qllcDteConnectMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("userdata", 1), ("callingaddress", 2))).clone('userdata')).setMaxAccess("readwrite") if mibBuilder.loadTexts: qllcDteConnectMethod.setStatus('mandatory') qllcDteControl = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("clearStats", 1)))).setMaxAccess("writeonly") if mibBuilder.loadTexts: qllcDteControl.setStatus('mandatory') qllcDteStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("connected", 1), ("pendingConnect", 2), ("disconnected", 3), ("pendingDisconnect", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteStatus.setStatus('mandatory') qllcDteOperationalMode = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("offline", 1), ("online", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteOperationalMode.setStatus('mandatory') qllcDteState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=NamedValues(("opened", 1), ("closed", 2), ("xidcmd", 3), ("tstcmd", 4), ("xidrsp", 5), ("tstrsp", 6), ("reset", 7), ("setmode", 8), ("disc", 9), ("reqdisc", 10), ("unknown", 11)))).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteState.setStatus('mandatory') qllcDteConnectionType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("svc", 2), ("pvc", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteConnectionType.setStatus('mandatory') qllcDteCalls = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 40), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteCalls.setStatus('mandatory') qllcDteClears = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 41), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteClears.setStatus('mandatory') qllcDteTxPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 42), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteTxPackets.setStatus('mandatory') qllcDteRxPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 43), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteRxPackets.setStatus('mandatory') qllcDteQdc = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 44), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteQdc.setStatus('mandatory') qllcDteQxid = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 45), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteQxid.setStatus('mandatory') qllcDteQua = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 46), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteQua.setStatus('mandatory') qllcDteQsm = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 47), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteQsm.setStatus('mandatory') qllcDteX25Reset = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 48), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteX25Reset.setStatus('mandatory') qllcDteSnalcRnr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 49), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteSnalcRnr.setStatus('mandatory') qllcDteSnalcRr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 50), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteSnalcRr.setStatus('mandatory') qllcDteX25Rnr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 51), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteX25Rnr.setStatus('mandatory') qllcDteX25Rr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 52), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcDteX25Rr.setStatus('mandatory') qllcMibLevel = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: qllcMibLevel.setStatus('mandatory') mibBuilder.exportSymbols("CXQLLC-MIB", qllcDteX25Rnr=qllcDteX25Rnr, qllcSapSnalcRef=qllcSapSnalcRef, qllcMibLevel=qllcMibLevel, qllcSapEntry=qllcSapEntry, qllcDteX25Reset=qllcDteX25Reset, qllcDteCallingAddress=qllcDteCallingAddress, qllcDteFacility=qllcDteFacility, qllcDteSnalcRnr=qllcDteSnalcRnr, qllcDtePvc=qllcDtePvc, qllcDteConnectMethod=qllcDteConnectMethod, qllcDteMemotec=qllcDteMemotec, qllcDteIndex=qllcDteIndex, qllcSapNumber=qllcSapNumber, qllcDteQdc=qllcDteQdc, qllcDteRowStatus=qllcDteRowStatus, qllcSapType=qllcSapType, qllcDteType=qllcDteType, PacketSize=PacketSize, qllcDteThroughput=qllcDteThroughput, qllcDteRxPackets=qllcDteRxPackets, qllcDteX25Rr=qllcDteX25Rr, qllcDteTable=qllcDteTable, qllcSapAlias=qllcSapAlias, qllcDteSap=qllcDteSap, qllcDteTxPackets=qllcDteTxPackets, qllcDteConnectionType=qllcDteConnectionType, qllcDtePacketSize=qllcDtePacketSize, qllcDteCalls=qllcDteCalls, qllcDteEntry=qllcDteEntry, qllcDteUserData=qllcDteUserData, qllcDteOperationalMode=qllcDteOperationalMode, qllcDteCalledAddress=qllcDteCalledAddress, qllcSapRowStatus=qllcSapRowStatus, qllcSapTable=qllcSapTable, qllcDteClears=qllcDteClears, qllcSapCompanionAlias=qllcSapCompanionAlias, qllcSapOperationalMode=qllcSapOperationalMode, qllcDteControl=qllcDteControl, qllcDteStatus=qllcDteStatus, qllcDteQsm=qllcDteQsm, qllcDteWindow=qllcDteWindow, qllcDteState=qllcDteState, qllcDteSnalcRr=qllcDteSnalcRr, qllcDteDBitCall=qllcDteDBitCall, qllcDteQua=qllcDteQua, qllcDteQxid=qllcDteQxid, X25Address=X25Address)
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def isPalindrome(self, head): """ :type head: ListNode :rtype: bool """ val = [] p_head = head if not head: return True if not head.next: return True while head: if val != []: last_val = val[-1] if last_val == head.val: break if head.next: if last_val == head.next.val: break val.append(head.val) head = head.next if head == None: return False else: if head.next: if last_val == head.next.val: head = head.next while head and val != []: if head.val != val.pop(): break head = head.next if head == None and val == []: return True else: return False
''' openarm Python library configurations ''' # protocol HEAD = 0x5a # debug DEBUG = False
# 记录生肖,根据年份来判断生肖 chinese_zodiac = '猴鸡狗猪鼠牛虎兔龙蛇马羊' # print(chinese_zodiac[0:4]) # print(chinese_zodiac[-1]) year = 2018 print(year % 12) print(chinese_zodiac[year % 12]) print('狗' in chinese_zodiac) print(chinese_zodiac + 'abcd') print(chinese_zodiac * 3) # 练习三列表的基本操作 # 定义一个含有5个数字的列表 # 为列表增加一个元素100 # 使用remove()删除一个元素后观察列表的变化 # 使用切片操作分别取出列表的前三个元素,取出列表的最后一个元素 list1 = [1, 2, 3, 4, 5] list1.append(100) print(list1) list1.remove(2) print(list1) print(list1[0:3]) print(list1[-1]) # 练习四元组的基本操作 # 定义一个任意元组,对元组使用append()查看错误信息 # 访问元组中的倒数第二个元素 # 定义一个新的元组,和1的元组连接成一个新的元组 # 计算元组元素个数 tuple1 = ("aa", "bb", "cc") # tuple1.append("dd") print(tuple1[-2]) tuple2 = ("dd", "ee", "ff") tuple3 = tuple1 + tuple2 print(tuple3) print(len(tuple3)) print(tuple3.__len__())
''' Navigator's kill board communicates over serial using the hex codes listed below. This should be the same as the codes on: http://docs.mil.ufl.edu/pages/viewpage.action?spaceKey=NAV&title=Kill+Communication+Commands The board can operate both in a request / response way, or it can be periodically pinged and will respond with many bytes indicating the status of all addresses. For the ping/Async method, send PING, than continue to read the buffer and parse the various response bytes below. For the sync / request method, send the REQUEST byte for whatever addresses you are interested in, then read a 1 byte response for either RESPONSE_FALSE or RESPONSE_TRUE The computer can also command a kill (for example, if ROS notices a criticaly low battery) by sending the COMPUTER.KILL.REQUEST and undone with COMPUTER.CLEAR.REQUEST ''' constants = { 'TIMEOUT_SECONDS': 8.0, # How often board must be pinged to not set HEARTBERAT_REMOTE True # Note: not official documented, this is just a guess 'RESPONSE_FALSE': '\x00', # True status for synchronous requests of individual addresses 'RESPONSE_TRUE': '\x01', # False status for synchronous requests of individual addresses 'PING': { 'REQUEST': '\x20', 'RESPONSE': '\x30' }, 'KILLS': ['OVERALL', 'BUTTON_FRONT_PORT', 'BUTTON_AFT_PORT', 'BUTTON_FRONT_STARBOARD',\ 'BUTTON_AFT_STARBOARD', 'HEARTBEAT_COMPUTER', 'BUTTON_REMOTE',\ 'HEARTBEAT_REMOTE', 'COMPUTER'], 'OVERALL': { # Should be True if any of the over are True 'REQUEST': '\x21', 'TRUE': '\x10', 'FALSE': '\x11' }, 'BUTTON_FRONT_PORT': { 'REQUEST': '\x22', 'TRUE': '\x12', 'FALSE': '\x13' }, 'BUTTON_AFT_PORT': { 'REQUEST': '\x23', 'TRUE': '\x14', 'FALSE': '\x15' }, 'BUTTON_FRONT_STARBOARD': { 'REQUEST': '\x24', 'TRUE': '\x16', 'FALSE': '\x17' }, 'BUTTON_AFT_STARBOARD': { 'REQUEST': '\x25', 'TRUE': '\x18', 'FALSE': '\x19' }, 'HEARTBEAT_COMPUTER': { # Will return True if board is not pinged by mobo often enough 'REQUEST': '\x26', 'TRUE': '\x1A', 'FALSE': '\x1B' }, 'BUTTON_REMOTE': { 'REQUEST': '\x28', 'TRUE': '\x3A', 'FALSE': '\x3B' }, 'HEARTBEAT_REMOTE': { # Will return True if board is not pinged by controller often enough 'REQUEST': '\x29', 'TRUE': '\x3C', 'FALSE': '\x3D' }, 'COMPUTER': { # Allows board to be killed over serial (like through ROS) 'KILL': { 'REQUEST': '\x45', 'RESPONSE': '\x55' }, 'CLEAR': { 'REQUEST': '\x46', 'RESPONSE': '\x56' }, 'REQUEST': '\x27', 'TRUE': '\x1C', 'FALSE': '\x1D' }, 'CONNECTED': { 'TRUE': '\x1E', 'FALSE': '\x1F' }, 'LIGHTS': { # Note: YELLOW turns off GREEN and visa versa 'OFF_REQUEST': '\x40', 'OFF_RESPONSE': '\x50', 'YELLOW_REQUEST': '\x41', 'YELLOW_RESPONSE': '\x51', 'GREEN_REQUEST': '\x42', 'GREEN_RESPONSE': '\x52', }, 'CONTROLLER': '\xA0', # Signifies the start of a controller message (joysticks & buttons) # Immediately followed by 8 bytes: 6 joystick bytes, 2 button bytes # Joystick message is 3 signed ints from -2048 to 2047 # Button message is 16 bits signifying up to 16 buttons on/off 'CTRL_STICKS': ['UD', 'LR', 'TQ'], # Up/Down, Left/Right, Torque 'CTRL_BUTTONS': ['X', 'Y', 'A', 'B', 'DL', 'DR', 'START'], 'CTRL_BUTTONS_VALUES': { # Amount of buttons and labels will be changed in the future # This currently mimics xbox controller labels and numbering 'X': '\x00\x04', # Button 2 'Y': '\x00\x08', # Button 3 'A': '\x00\x01', # Button 0 'B': '\x00\x02', # Button 1 'DL': '\x08\x00', # Dpad Left (Button 11) 'DR': '\x10\x00', # Dpad Right (Button 12) 'START': '\x00\x80', # Start (Button 7) } }
""" Separted classes and functions used by the api module. Note that these classes and variables are all imported higher up at the top of the api module. They can be referenced from there instead of digging in deeper to these submodules. """
# -*- coding: utf-8 class History(object): requests = [] responses = [] _instance = None @classmethod def instance(cls): if not cls._instance: cls._instance = cls() return cls._instance def add_response(self, response_obj): self.responses.append(response_obj) def add_request(self, request_obj): self.requests.append(request_obj) @property def request(self): if len(self.requests) == 0: return None else: return self.requests[-1] @property def response(self): if len(self.responses) == 0: return None else: return self.responses[-1] def clear(self): del self.requests[:] del self.responses[:]
# # PySNMP MIB module RADLAN-DOT1X-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-DOT1X-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:38:04 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection") MacAddress, = mibBuilder.importSymbols("BRIDGE-MIB", "MacAddress") PaeControlledPortStatus, dot1xAuthSessionStatsEntry, dot1xPaePortNumber = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "PaeControlledPortStatus", "dot1xAuthSessionStatsEntry", "dot1xPaePortNumber") PortList, dot1qFdbId, VlanIndex = mibBuilder.importSymbols("Q-BRIDGE-MIB", "PortList", "dot1qFdbId", "VlanIndex") rnd, = mibBuilder.importSymbols("RADLAN-MIB", "rnd") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") iso, ModuleIdentity, Integer32, Gauge32, ObjectIdentity, Counter64, IpAddress, Bits, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, NotificationType, TimeTicks, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "ModuleIdentity", "Integer32", "Gauge32", "ObjectIdentity", "Counter64", "IpAddress", "Bits", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "NotificationType", "TimeTicks", "Counter32") TextualConvention, TruthValue, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "RowStatus", "DisplayString") rldot1x = ModuleIdentity((1, 3, 6, 1, 4, 1, 89, 95)) rldot1x.setRevisions(('2007-01-02 00:00',)) if mibBuilder.loadTexts: rldot1x.setLastUpdated('200701020000Z') if mibBuilder.loadTexts: rldot1x.setOrganization('Radlan - a MARVELL company. Marvell Semiconductor, Inc.') rldot1xMibVersion = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xMibVersion.setStatus('current') rldot1xExtAuthSessionStatsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 2), ) if mibBuilder.loadTexts: rldot1xExtAuthSessionStatsTable.setStatus('current') rldot1xExtAuthSessionStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 2, 1), ) dot1xAuthSessionStatsEntry.registerAugmentions(("RADLAN-DOT1X-MIB", "rldot1xExtAuthSessionStatsEntry")) rldot1xExtAuthSessionStatsEntry.setIndexNames(*dot1xAuthSessionStatsEntry.getIndexNames()) if mibBuilder.loadTexts: rldot1xExtAuthSessionStatsEntry.setStatus('current') rlDot1xAuthSessionAuthenticMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("remoteAuthServer", 1), ("localAuthServer", 2), ("none", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rlDot1xAuthSessionAuthenticMethod.setStatus('current') rldot1xGuestVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 3), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xGuestVlanSupported.setStatus('current') rldot1xGuestVlanVID = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 4), VlanIndex()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xGuestVlanVID.setStatus('current') rldot1xGuestVlanPorts = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 5), PortList()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xGuestVlanPorts.setStatus('current') rldot1xUnAuthenticatedVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 6), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanSupported.setStatus('current') rldot1xUnAuthenticatedVlanTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 7), ) if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanTable.setStatus('current') rldot1xUnAuthenticatedVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 7, 1), ).setIndexNames((0, "Q-BRIDGE-MIB", "dot1qFdbId")) if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanEntry.setStatus('current') rldot1xUnAuthenticatedVlanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 7, 1, 1), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanStatus.setStatus('current') rldot1xUserBasedVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 8), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xUserBasedVlanSupported.setStatus('current') rldot1xUserBasedVlanPorts = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 9), PortList()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xUserBasedVlanPorts.setStatus('current') rldot1xAuthenticationPortTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 10), ) if mibBuilder.loadTexts: rldot1xAuthenticationPortTable.setStatus('current') rldot1xAuthenticationPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 10, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber")) if mibBuilder.loadTexts: rldot1xAuthenticationPortEntry.setStatus('current') rldot1xAuthenticationPortMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("eapolOnly", 1), ("macAndEapol", 2), ("macOnly", 3), ("webOnly", 4), ("webAndEapol", 5), ("webAndMac", 6), ("webAndMacAndEapol", 7))).clone('eapolOnly')).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xAuthenticationPortMethod.setStatus('current') rldot1xRadiusAttrVlanIdEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 2), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xRadiusAttrVlanIdEnabled.setStatus('current') rldot1xRadiusAttAclNameEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 3), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xRadiusAttAclNameEnabled.setStatus('current') rldot1xTimeBasedName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 4), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xTimeBasedName.setStatus('current') rldot1xTimeBasedActive = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 5), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xTimeBasedActive.setStatus('current') rldot1xRadiusAttrVlanIdentifier = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 6), VlanIndex()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xRadiusAttrVlanIdentifier.setStatus('current') rldot1xMaxHosts = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 7), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xMaxHosts.setStatus('current') rldot1xMaxLoginAttempts = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 10))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xMaxLoginAttempts.setStatus('current') rldot1xTimeoutSilencePeriod = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xTimeoutSilencePeriod.setStatus('current') rldot1xNumOfAuthorizedHosts = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xNumOfAuthorizedHosts.setStatus('current') rldot1xAuthenticationOpenEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 11), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xAuthenticationOpenEnabled.setStatus('current') rldot1xAuthMultiStatsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 11), ) if mibBuilder.loadTexts: rldot1xAuthMultiStatsTable.setStatus('current') rldot1xAuthMultiStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 11, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiStatsPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiStatsSourceMac")) if mibBuilder.loadTexts: rldot1xAuthMultiStatsEntry.setStatus('current') rldot1xAuthMultiStatsPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiStatsPortNumber.setStatus('current') rldot1xAuthMultiStatsSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 2), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiStatsSourceMac.setStatus('current') rldot1xAuthMultiEapolFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesRx.setStatus('current') rldot1xAuthMultiEapolFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesTx.setStatus('current') rldot1xAuthMultiEapolStartFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapolStartFramesRx.setStatus('current') rldot1xAuthMultiEapolLogoffFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapolLogoffFramesRx.setStatus('current') rldot1xAuthMultiEapolRespIdFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespIdFramesRx.setStatus('current') rldot1xAuthMultiEapolRespFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespFramesRx.setStatus('current') rldot1xAuthMultiEapolReqIdFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqIdFramesTx.setStatus('current') rldot1xAuthMultiEapolReqFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqFramesTx.setStatus('current') rldot1xAuthMultiInvalidEapolFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiInvalidEapolFramesRx.setStatus('current') rldot1xAuthMultiEapLengthErrorFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEapLengthErrorFramesRx.setStatus('current') rldot1xAuthMultiDiagTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 12), ) if mibBuilder.loadTexts: rldot1xAuthMultiDiagTable.setStatus('current') rldot1xAuthMultiDiagEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 12, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiDiagPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiDiagSourceMac")) if mibBuilder.loadTexts: rldot1xAuthMultiDiagEntry.setStatus('current') rldot1xAuthMultiDiagPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiDiagPortNumber.setStatus('current') rldot1xAuthMultiDiagSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 2), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiDiagSourceMac.setStatus('current') rldot1xAuthMultiEntersConnecting = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEntersConnecting.setStatus('current') rldot1xAuthMultiEntersAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiEntersAuthenticating.setStatus('current') rldot1xAuthMultiAuthSuccessWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiAuthSuccessWhileAuthenticating.setStatus('current') rldot1xAuthMultiAuthFailWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiAuthFailWhileAuthenticating.setStatus('current') rldot1xAuthMultiAuthReauthsWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticating.setStatus('current') rldot1xAuthMultiAuthEapStartsWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setStatus('current') rldot1xAuthMultiAuthReauthsWhileAuthenticated = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticated.setStatus('current') rldot1xAuthMultiAuthEapStartsWhileAuthenticated = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setStatus('current') rldot1xAuthMultiBackendResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiBackendResponses.setStatus('current') rldot1xAuthMultiBackendAccessChallenges = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiBackendAccessChallenges.setStatus('current') rldot1xAuthMultiBackendOtherRequestsToSupplicant = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiBackendOtherRequestsToSupplicant.setStatus('current') rldot1xAuthMultiBackendNonNakResponsesFromSupplicant = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setStatus('current') rldot1xAuthMultiBackendAuthSuccesses = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthSuccesses.setStatus('current') rldot1xAuthMultiSessionStatsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 13), ) if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsTable.setStatus('current') rldot1xAuthMultiSessionStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 13, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiSessionStatsPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiSessionStatsSourceMac")) if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsEntry.setStatus('current') rldot1xAuthMultiSessionStatsPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsPortNumber.setStatus('current') rldot1xAuthMultiSessionStatsSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 2), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsSourceMac.setStatus('current') rldot1xAuthMultiSessionOctetsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsRx.setStatus('current') rldot1xAuthMultiSessionOctetsTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsTx.setStatus('current') rldot1xAuthMultiSessionFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesRx.setStatus('current') rldot1xAuthMultiSessionFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesTx.setStatus('current') rldot1xAuthMultiSessionId = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 7), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionId.setStatus('current') rldot1xAuthMultiSessionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 8), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionTime.setStatus('current') rldot1xAuthMultiSessionUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 9), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionUserName.setStatus('current') rldot1xAuthMultiSessionRadiusAttrVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrVlan.setStatus('current') rldot1xAuthMultiSessionRadiusAttrFilterId = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 11), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrFilterId.setStatus('current') rldot1xAuthMultiSessionRadiusAttrSecondFilterId = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 12), SnmpAdminString()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrSecondFilterId.setStatus('current') rlDot1xAuthMultiSessionMonitorResultsReason = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24))).clone(namedValues=NamedValues(("notRejected", 0), ("aclNotExst", 1), ("aclOvrfl", 2), ("authErr", 3), ("fltrErr", 4), ("ipv6WithMac", 5), ("ipv6WithNotIp", 6), ("polBasicMode", 7), ("aclDel", 8), ("polDel", 9), ("vlanDfly", 10), ("vlanDynam", 11), ("vlanGuest", 12), ("vlanNoInMsg", 13), ("vlanNotExst", 14), ("vlanOvfl", 15), ("vlanVoice", 16), ("vlanUnauth", 17), ("frsMthDeny", 18), ("radApierr", 19), ("radInvlres", 20), ("radNoresp", 21), ("aclEgress", 22), ("maxHosts", 23), ("noActivity", 24)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rlDot1xAuthMultiSessionMonitorResultsReason.setStatus('current') rlDot1xAuthMultiSessionMethodType = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("eapol", 1), ("mac", 2), ("web", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rlDot1xAuthMultiSessionMethodType.setStatus('current') rldot1xAuthMultiConfigTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 14), ) if mibBuilder.loadTexts: rldot1xAuthMultiConfigTable.setStatus('current') rldot1xAuthMultiConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 14, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiSourceMac")) if mibBuilder.loadTexts: rldot1xAuthMultiConfigEntry.setStatus('current') rldot1xAuthMultiPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiPortNumber.setStatus('current') rldot1xAuthMultiSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 2), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiSourceMac.setStatus('current') rldot1xAuthMultiPaeState = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("initialize", 1), ("disconnected", 2), ("connecting", 3), ("authenticating", 4), ("authenticated", 5), ("aborting", 6), ("held", 7), ("forceAuth", 8), ("forceUnauth", 9)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiPaeState.setStatus('current') rldot1xAuthMultiBackendAuthState = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("request", 1), ("response", 2), ("success", 3), ("fail", 4), ("timeout", 5), ("idle", 6), ("initialize", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthState.setStatus('current') rldot1xAuthMultiControlledPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 5), PaeControlledPortStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xAuthMultiControlledPortStatus.setStatus('current') rldot1xBpduFilteringEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 15), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xBpduFilteringEnabled.setStatus('current') rldot1xRadiusAttributesErrorsAclReject = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 18), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xRadiusAttributesErrorsAclReject.setStatus('current') rldot1xGuestVlanTimeInterval = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 180))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xGuestVlanTimeInterval.setStatus('current') rldot1xMacAuthSuccessTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 20), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xMacAuthSuccessTrapEnabled.setStatus('current') rldot1xMacAuthFailureTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 21), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xMacAuthFailureTrapEnabled.setStatus('current') rldot1xLegacyPortTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 22), ) if mibBuilder.loadTexts: rldot1xLegacyPortTable.setStatus('current') rldot1xLegacyPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 22, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber")) if mibBuilder.loadTexts: rldot1xLegacyPortEntry.setStatus('current') rldot1xLegacyPortModeEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 22, 1, 1), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xLegacyPortModeEnabled.setStatus('current') rldot1xSystemAuthControlMonitorVlan = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xSystemAuthControlMonitorVlan.setStatus('current') rldot1xClearPortMibCounters = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 24), PortList()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xClearPortMibCounters.setStatus('current') rldot1xWebQuietFailureTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 25), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xWebQuietFailureTrapEnabled.setStatus('current') rldot1xMacWebAuthSuccessTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("none", 0), ("eapolOnly", 1), ("macAndEapol", 2), ("macOnly", 3), ("webOnly", 4), ("webAndEapol", 5), ("webAndMac", 6), ("webAndMacAndEapol", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xMacWebAuthSuccessTrapEnabled.setStatus('current') rldot1xMacWebAuthFailureTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 27), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("none", 0), ("eapolOnly", 1), ("macAndEapol", 2), ("macOnly", 3), ("webOnly", 4), ("webAndEapol", 5), ("webAndMac", 6), ("webAndMacAndEapol", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xMacWebAuthFailureTrapEnabled.setStatus('current') rldot1xLockedCientsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 28), ) if mibBuilder.loadTexts: rldot1xLockedCientsTable.setStatus('current') rldot1xLockedCientsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 28, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xLockedCientsPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xLockedCientsSourceMac")) if mibBuilder.loadTexts: rldot1xLockedCientsEntry.setStatus('current') rldot1xLockedCientsPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xLockedCientsPortNumber.setStatus('current') rldot1xLockedCientsSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 2), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xLockedCientsSourceMac.setStatus('current') rldot1xLockedCientsRemainedTime = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rldot1xLockedCientsRemainedTime.setStatus('current') rldot1xLockedCientsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 4), RowStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rldot1xLockedCientsRowStatus.setStatus('current') mibBuilder.exportSymbols("RADLAN-DOT1X-MIB", rldot1xAuthMultiAuthReauthsWhileAuthenticated=rldot1xAuthMultiAuthReauthsWhileAuthenticated, rldot1xAuthMultiStatsEntry=rldot1xAuthMultiStatsEntry, rldot1xAuthMultiStatsSourceMac=rldot1xAuthMultiStatsSourceMac, rldot1xWebQuietFailureTrapEnabled=rldot1xWebQuietFailureTrapEnabled, rlDot1xAuthSessionAuthenticMethod=rlDot1xAuthSessionAuthenticMethod, rldot1xAuthMultiEapolReqFramesTx=rldot1xAuthMultiEapolReqFramesTx, rldot1xAuthMultiEapolRespIdFramesRx=rldot1xAuthMultiEapolRespIdFramesRx, rldot1xAuthMultiDiagEntry=rldot1xAuthMultiDiagEntry, rldot1xAuthMultiSessionStatsSourceMac=rldot1xAuthMultiSessionStatsSourceMac, rldot1xAuthMultiAuthReauthsWhileAuthenticating=rldot1xAuthMultiAuthReauthsWhileAuthenticating, rldot1xLockedCientsRowStatus=rldot1xLockedCientsRowStatus, PYSNMP_MODULE_ID=rldot1x, rldot1xAuthMultiDiagTable=rldot1xAuthMultiDiagTable, rldot1xMacWebAuthSuccessTrapEnabled=rldot1xMacWebAuthSuccessTrapEnabled, rldot1xAuthenticationPortTable=rldot1xAuthenticationPortTable, rldot1xLockedCientsSourceMac=rldot1xLockedCientsSourceMac, rldot1xUnAuthenticatedVlanStatus=rldot1xUnAuthenticatedVlanStatus, rldot1xLockedCientsEntry=rldot1xLockedCientsEntry, rldot1xClearPortMibCounters=rldot1xClearPortMibCounters, rldot1xAuthMultiEapolRespFramesRx=rldot1xAuthMultiEapolRespFramesRx, rldot1xAuthMultiAuthFailWhileAuthenticating=rldot1xAuthMultiAuthFailWhileAuthenticating, rldot1xAuthMultiSessionStatsEntry=rldot1xAuthMultiSessionStatsEntry, rldot1xExtAuthSessionStatsEntry=rldot1xExtAuthSessionStatsEntry, rldot1xAuthMultiAuthSuccessWhileAuthenticating=rldot1xAuthMultiAuthSuccessWhileAuthenticating, rldot1xAuthMultiSessionTime=rldot1xAuthMultiSessionTime, rldot1xAuthMultiBackendAuthSuccesses=rldot1xAuthMultiBackendAuthSuccesses, rldot1xUnAuthenticatedVlanEntry=rldot1xUnAuthenticatedVlanEntry, rldot1xAuthMultiEapolStartFramesRx=rldot1xAuthMultiEapolStartFramesRx, rldot1xUserBasedVlanSupported=rldot1xUserBasedVlanSupported, rldot1xAuthMultiEapolReqIdFramesTx=rldot1xAuthMultiEapolReqIdFramesTx, rldot1xMaxLoginAttempts=rldot1xMaxLoginAttempts, rldot1xNumOfAuthorizedHosts=rldot1xNumOfAuthorizedHosts, rldot1xGuestVlanVID=rldot1xGuestVlanVID, rldot1xUnAuthenticatedVlanSupported=rldot1xUnAuthenticatedVlanSupported, rldot1xAuthMultiPortNumber=rldot1xAuthMultiPortNumber, rldot1xMaxHosts=rldot1xMaxHosts, rldot1xAuthMultiAuthEapStartsWhileAuthenticated=rldot1xAuthMultiAuthEapStartsWhileAuthenticated, rldot1xLegacyPortTable=rldot1xLegacyPortTable, rldot1xAuthMultiPaeState=rldot1xAuthMultiPaeState, rldot1xAuthMultiSessionId=rldot1xAuthMultiSessionId, rldot1xAuthMultiSessionRadiusAttrVlan=rldot1xAuthMultiSessionRadiusAttrVlan, rldot1xAuthMultiDiagPortNumber=rldot1xAuthMultiDiagPortNumber, rldot1xAuthMultiSessionUserName=rldot1xAuthMultiSessionUserName, rldot1xAuthMultiEntersAuthenticating=rldot1xAuthMultiEntersAuthenticating, rldot1xAuthMultiEntersConnecting=rldot1xAuthMultiEntersConnecting, rldot1xAuthMultiBackendNonNakResponsesFromSupplicant=rldot1xAuthMultiBackendNonNakResponsesFromSupplicant, rldot1x=rldot1x, rldot1xAuthMultiSessionFramesTx=rldot1xAuthMultiSessionFramesTx, rldot1xRadiusAttrVlanIdEnabled=rldot1xRadiusAttrVlanIdEnabled, rldot1xMibVersion=rldot1xMibVersion, rldot1xAuthMultiSessionRadiusAttrFilterId=rldot1xAuthMultiSessionRadiusAttrFilterId, rldot1xAuthenticationOpenEnabled=rldot1xAuthenticationOpenEnabled, rldot1xAuthMultiEapolFramesRx=rldot1xAuthMultiEapolFramesRx, rldot1xGuestVlanSupported=rldot1xGuestVlanSupported, rldot1xRadiusAttrVlanIdentifier=rldot1xRadiusAttrVlanIdentifier, rldot1xRadiusAttAclNameEnabled=rldot1xRadiusAttAclNameEnabled, rldot1xUserBasedVlanPorts=rldot1xUserBasedVlanPorts, rldot1xAuthMultiSessionRadiusAttrSecondFilterId=rldot1xAuthMultiSessionRadiusAttrSecondFilterId, rldot1xTimeoutSilencePeriod=rldot1xTimeoutSilencePeriod, rldot1xGuestVlanPorts=rldot1xGuestVlanPorts, rldot1xMacAuthFailureTrapEnabled=rldot1xMacAuthFailureTrapEnabled, rlDot1xAuthMultiSessionMonitorResultsReason=rlDot1xAuthMultiSessionMonitorResultsReason, rldot1xAuthMultiEapolFramesTx=rldot1xAuthMultiEapolFramesTx, rldot1xAuthMultiStatsPortNumber=rldot1xAuthMultiStatsPortNumber, rldot1xTimeBasedName=rldot1xTimeBasedName, rldot1xAuthMultiSessionOctetsRx=rldot1xAuthMultiSessionOctetsRx, rldot1xGuestVlanTimeInterval=rldot1xGuestVlanTimeInterval, rldot1xLegacyPortModeEnabled=rldot1xLegacyPortModeEnabled, rldot1xAuthMultiDiagSourceMac=rldot1xAuthMultiDiagSourceMac, rldot1xAuthMultiAuthEapStartsWhileAuthenticating=rldot1xAuthMultiAuthEapStartsWhileAuthenticating, rldot1xAuthMultiSessionStatsPortNumber=rldot1xAuthMultiSessionStatsPortNumber, rldot1xUnAuthenticatedVlanTable=rldot1xUnAuthenticatedVlanTable, rldot1xRadiusAttributesErrorsAclReject=rldot1xRadiusAttributesErrorsAclReject, rldot1xLockedCientsRemainedTime=rldot1xLockedCientsRemainedTime, rldot1xTimeBasedActive=rldot1xTimeBasedActive, rldot1xAuthMultiSourceMac=rldot1xAuthMultiSourceMac, rldot1xAuthMultiBackendAccessChallenges=rldot1xAuthMultiBackendAccessChallenges, rldot1xExtAuthSessionStatsTable=rldot1xExtAuthSessionStatsTable, rldot1xLockedCientsTable=rldot1xLockedCientsTable, rldot1xAuthMultiEapolLogoffFramesRx=rldot1xAuthMultiEapolLogoffFramesRx, rldot1xAuthMultiEapLengthErrorFramesRx=rldot1xAuthMultiEapLengthErrorFramesRx, rldot1xAuthMultiSessionOctetsTx=rldot1xAuthMultiSessionOctetsTx, rlDot1xAuthMultiSessionMethodType=rlDot1xAuthMultiSessionMethodType, rldot1xSystemAuthControlMonitorVlan=rldot1xSystemAuthControlMonitorVlan, rldot1xAuthMultiInvalidEapolFramesRx=rldot1xAuthMultiInvalidEapolFramesRx, rldot1xAuthMultiBackendOtherRequestsToSupplicant=rldot1xAuthMultiBackendOtherRequestsToSupplicant, rldot1xAuthMultiSessionFramesRx=rldot1xAuthMultiSessionFramesRx, rldot1xAuthMultiConfigEntry=rldot1xAuthMultiConfigEntry, rldot1xLockedCientsPortNumber=rldot1xLockedCientsPortNumber, rldot1xAuthMultiBackendAuthState=rldot1xAuthMultiBackendAuthState, rldot1xMacAuthSuccessTrapEnabled=rldot1xMacAuthSuccessTrapEnabled, rldot1xAuthMultiSessionStatsTable=rldot1xAuthMultiSessionStatsTable, rldot1xAuthMultiConfigTable=rldot1xAuthMultiConfigTable, rldot1xMacWebAuthFailureTrapEnabled=rldot1xMacWebAuthFailureTrapEnabled, rldot1xLegacyPortEntry=rldot1xLegacyPortEntry, rldot1xAuthMultiControlledPortStatus=rldot1xAuthMultiControlledPortStatus, rldot1xAuthenticationPortEntry=rldot1xAuthenticationPortEntry, rldot1xAuthMultiBackendResponses=rldot1xAuthMultiBackendResponses, rldot1xAuthMultiStatsTable=rldot1xAuthMultiStatsTable, rldot1xBpduFilteringEnabled=rldot1xBpduFilteringEnabled, rldot1xAuthenticationPortMethod=rldot1xAuthenticationPortMethod)
def find_minor(arr): minor = arr[0] minor_index = 0 for i in range(0, len(arr)): if arr[i] < minor: minor = arr[i] minor_index = i return minor_index def ordenation_by_selection(arr): new_arr = [] for i in range(0, len(arr)): minor = find_minor(arr) new_arr.append(arr.pop(minor)) return new_arr print(ordenation_by_selection([5, 2, 1, 4, 3, 6, 9, 7, 8]))
name = 'Phennyfyxata. http://phenny.venefyxatu.be' nick = 'Phennyfyxata' host = 'irc.freenode.net' channels = ['#dutchnano', '#venefyxatu'] #channels = ['#venefyxatu'] owner = 'venefyxatu' password = 'PLACEHOLDER_PASSWORD' # This isn't implemented yet: # serverpass = 'yourserverpassword' # These are people who will be able to use admin.py's functions... admins = [owner] # strings with other nicknames # But admin.py is disabled by default, as follows: #exclude = ['admin'] # If you want to enumerate a list of modules rather than disabling # some, use "enable = ['example']", which takes precedent over exclude # # enable = [] # Directories to load opt modules from extra = [] # Services to load: maps channel names to white or black lists external = { '#dutchnano': ['!'], # allow all '#venefyxatu': ['!'], '#conservative': [], # allow none '*': ['py', 'whois', 'glyph'], # default whitelist } # EOF tell_filename = "/home/venefyatu/tellfile"
""" Repositório Remoto : github.com/HugoItaloMC/PythonEstudos/Sources/ Python, versão : 3.10 Base : Curso : Programacão Python Essensial. Didática : Geek University. Plataforma : udemy.com Secão 10 : Expressões lambdas e funcões integradas. Map : Mapeamento de valores para funcão. .==============================================. | " " " " " " " " " " " " " " " " " " | | " Ordem alfabetica nas variáveis " | | " globais e locais : " | | " " | | " Examples Global : " | | " " | | " a = '' " | | " b = 0 " | | " c = True " | | " " | | " " | | " Examples Local : " | | " " | | " a = range(0, 10) " | | " " | | " for b, c in a: " | | " for d, in b: " | | " print(d) " | | " for e in c: " | | " print(e) " | | " " | | " " | | " Ordem válida para funcões " | | " e seus parametros : " | | " " | | " Examples: " | | " " | | " def d(da, db): " | | " return (da + db) * da " | | " " " " " " " " " " " " " " " " " " | .==============================================. # Iterando com listas ultilizando Map # exemplos: import math def area(r): " Calcula a area de um circulo com raio ' r ' " return math.pi * (r ** 2) raios = [1, 3, 5.1, 66.6, 10] areas = [] # Forma Comum raios = [1, 3, 5.1, 66.6, 10] areas = [] for r in raios: areas.append((area(r))) print(areas) # Map é uma funcão que recebe dois parametros: O primeiro a funcão, o segundo um iterável areas = map(area, raios) print(areas) # Retorna um map object print(list(areas)) # Refatorando print(f"{list(map(area, raios))}") print(list(map(lambda r: math.pi * (r ** 2), raios))) # OBS : Após ultilizar a funcão map, depois do primeiro retorno do resultado ele zera. """ # Fixando o map() : # Exemplos # Convertendo dados ' graus ceucius ' para ' firenight ' : # expressão da formula : (9 / 5 ) * c + 32 f = lambda x: (x[0], (9 / 5) * x[1] + 32) # Entrada de dados, -- neste exemplo uma list com tuple como ocorrencias : cidades = [('Sao Paulo', 29), ('Campinas', 26), ('Ribeirao Preto', 33), ('Sao Caetano', 31), ('Pilar do Sul', 23), ('Sao Caetano', 25), ('Santo andre', 31), ('Santos', 28)] # Processamento : ultilizando map(), lembrando que o map tem 2 ocorrencias como parametros, 1 uma funcao, 2 um iteravel print(list(map(f, cidades))) """ - Passamos a funcão na primeira ocorrencia como parametro no map() e logo após os dados """
expected_output = { "trustpoints": { "TP-self-signed-4146203551": { "associated_trustpoints": { "router_self_signed_certificate": { "issuer": {"cn": "IOS-Self-Signed-Certificate-4146203551"}, "serial_number_in_hex": "01", "status": "Available", "storage": "nvram:IOS-Self-Sig#1.cer", "subject": { "cn": "IOS-Self-Signed-Certificate-4146203551", "name": "IOS-Self-Signed-Certificate-4146203551", }, "usage": "General Purpose", "validity_date": { "end_date": "00:00:00 UTC Jan 1 2020", "start_date": "21:37:27 UTC Apr 23 2018", }, } } } } }
print('-------ATM-------\n---Caixa Automatico--') x = int(input('Val: ')) ced = [100,50,20,10,5,2,1] c = 0 for i in ced: d = x // i x = x % i c = c + 1 if d > 0: print(f'{d} ===> {i}')
def get_user_attributes(): """Get the user attributes of the currently-logged-in SAML user.The exact attributes available will depend on your SAML Identity Provider. """ pass def get_user_email(): """Get the email address of the currently-logged-in SAML user.To log in with SAML, call anvil.saml.auth.login() from form code. """ pass def login(): """Prompt the user to log in via SAML""" pass
''' * tendo os dados de altura de uma pessoa, construa: * algoritmo que calcule seu peso ideal * usando a formula: "((72.7 * altura) - 58)" ''' print('\nOlá! Vamos calcular seu peso ideal!\n') altura = float(input('Digite sua altura em centímetros: ')) pesoIdeal = (72.7 * altura) - 58 print(f'\nSeu peso ideal é: {altura:.2f} kilogramas\n') ''' * essa fórmula está bizarra e o resultado não é realista * conferi mais de uma vez e está tudo ok com a lógica dos operadores tanto para metros quanto para centímetros * usei o limitados de casas decimais para float na saída do dado '''
expected_output = { "policy_map": { "pm_hier2_child_0_2": { "class": { "cm_0": { "priority_levels": 1, "police": { "cir_percent": 5, "bc_ms": 2, "be_ms": 0, "conform_action": ["transmit"], "exceed_action": ["drop"], "violate_action": ["drop"], }, "queue_limit_packets": 77, }, "cm_1": { "average_rate_traffic_shaping": True, "cir_percent": 80, "bandwidth_remaining_ratio": 80, }, "class-default": { "average_rate_traffic_shaping": True, "cir_percent": 50, "bandwidth_remaining_ratio": 20, }, } } } }
list1 = range(2, 20, 3) list1_len = len(list1) print(list1_len)
class Solution: def flatten(self, head: 'Node') -> 'Node': def flatten(head: 'Node', rest: 'Node') -> 'Node': if not head: return rest head.next = flatten(head.child, flatten(head.next, rest)) if head.next: head.next.prev = head head.child = None return head return flatten(head, None)
while True: print("this phrase will always print") break print("Does this phrase print?") print("We are done with the while loop.") x = 0 while x < 10: print("we are incrementing x") if x % 2 == 0: x += 3 continue if x % 3 == 0: x += 5 x += 1 print("Done with our loop! X has the value: " + str(x))
for _i in range(100000): str(_i) JS_CODE = ''' for (var i = 0; i < 100000; i++) { new String(i); } '''
bin = [] def decToBin(dec): while(True): if((dec % 2) == 0): bin.append(0) else: bin.append(1) dec = dec // 2 if(dec == 0): break decToBin(10) while bin: print(str(bin.pop()), end= '')
slate_config ={'layers': [{'encoder': {'button': (1, 205), 'decrement': (1, 234), 'increment': (1, 233)}, 'joystick': {'button': (7, 1), 'x+': (8, [100, 0, 0]), 'x-': (8, [-100, 0, 0]), 'y+': (8, [0, 100, 0]), 'y-': (8, [0, -100, 0])}, 'key_shortcuts': [{'actions': (2, [224, 6]), 'assigned_key': 0}, {'actions': (2, [224, 25]), 'assigned_key': 1}, {'actions': (None, None), 'assigned_key': 2}, {'actions': (1, 111), 'assigned_key': 3}, {'actions': (2, [224, 4]), 'assigned_key': 4}, {'actions': (2, [224, 9]), 'assigned_key': 5}, {'actions': (None, None), 'assigned_key': 6}, {'actions': (1, 112), 'assigned_key': 7}], 'name': 'Slate', 'touch_shortcuts': [{'actions': (9, '"C:\\Program Files ' '(x86)\\Steam\\steam.exe"'), 'icon': 'icons/td_steam.bmp', 'label': 'Steam'}, {'actions': (9, '"C:\\Program ' 'Files\\Google\\Chrome\\Application\\chrome.exe"'), 'icon': 'icons/td_chrome.bmp', 'label': 'Chrome'}, {'actions': (9, 'C:\\Users\\Jacob\\AppData\\Local\\Discord\\Update.exe ' '--processStart Discord.exe'), 'icon': 'icons/td_discord.bmp', 'label': 'Discord'}, {'actions': (9, 'C:\\Users\\Jacob\\AppData\\Roaming\\Spotify\\Spotify.exe'), 'icon': 'icons/td_spotify.bmp', 'label': 'Spotify'}, {'actions': (9, '"C:\\Program ' 'Files\\Adobe\\Adobe Photoshop ' 'CC 2019\\Photoshop.exe"'), 'icon': 'icons/td_photoshop.bmp', 'label': 'Photoshop'}, {'actions': (9, '"C:\\Program ' 'Files\\Adobe\\Adobe Premiere ' 'Pro CC 2019\\Adobe Premiere ' 'Pro.exe"'), 'icon': 'icons/td_premiere.bmp', 'label': 'Premiere Pro'}, {'actions': (9, '"C:\\Program Files\\Microsoft ' 'VS Code\\Code.exe"'), 'icon': 'icons/td_vscode.bmp', 'label': 'VSCode'}, {'actions': (9, 'calc'), 'icon': 'icons/td_calc.bmp', 'label': 'Calculator'}, {'actions': (2, [227, 43]), 'icon': 'icons/td_switchapp.bmp', 'label': 'Task View'}, {'actions': (2, [224, 225, 41]), 'icon': 'icons/td_taskmanager.bmp', 'label': 'Task Manager'}, {'actions': (2, [227, 229, 22]), 'icon': 'icons/td_snip.bmp', 'label': 'Snipping Tool'}, {'actions': (3, 'Slate can type text for you!'), 'icon': 'icons/slate.bmp', 'label': 'Slate'}]}, {'encoder': {'button': (2, [14]), 'decrement': (2, [80]), 'increment': (2, [79])}, 'joystick': {'button': (None, None), 'x+': (None, None), 'x-': (None, None), 'y+': (None, None), 'y-': (None, None)}, 'key_shortcuts': [{'actions': (2, [14]), 'assigned_key': 0}, {'actions': (2, [14]), 'assigned_key': 1}, {'actions': (2, [80]), 'assigned_key': 2}, {'actions': (2, [79]), 'assigned_key': 3}, {'actions': (2, [9]), 'assigned_key': 4}, {'actions': (2, [54]), 'assigned_key': 5}, {'actions': (2, [55]), 'assigned_key': 6}, {'actions': (2, [16]), 'assigned_key': 7}], 'name': 'Youtube Controls', 'touch_shortcuts': [{'actions': (2, [14]), 'icon': 'icons/pr_play.bmp', 'label': 'Play'}, {'actions': (2, [14]), 'icon': 'icons/pr_pause.bmp', 'label': 'Pause'}, {'actions': (2, [80]), 'icon': 'icons/pr_rewind.bmp', 'label': 'Rewind'}, {'actions': (2, [79]), 'icon': 'icons/pr_ffwd.bmp', 'label': 'FastForward'}, {'actions': (2, [225, 19]), 'icon': 'icons/pr_previous.bmp', 'label': 'Previous'}, {'actions': (2, [225, 17]), 'icon': 'icons/pr_next.bmp', 'label': 'Next'}, {'actions': (1, 234), 'icon': 'icons/pr_voldown.bmp', 'label': 'Vol -'}, {'actions': (1, 233), 'icon': 'icons/pr_volup.bmp', 'label': 'Vol +'}, {'actions': (2, [9]), 'icon': 'icons/pr_fullscreen.bmp', 'label': 'Fullscreen'}, {'actions': (2, [225, 54]), 'icon': 'icons/pr_slow.bmp', 'label': 'Slow'}, {'actions': (2, [225, 55]), 'icon': 'icons/pr_fast.bmp', 'label': 'Fast'}, {'actions': (2, [16]), 'icon': 'icons/pr_mute.bmp', 'label': 'Mute'}]}]}
class Filenames: unicode = 'smörbröd.py' latin_1 = unicode.encode('latin-1') utf_8 = unicode.encode('utf-8')