content
stringlengths
7
1.05M
# MQTT certificates CA_CERT = "./../keys/ca/ca.crt" CLIENT_CERT = "./../keys/client/client.crt" CLIENT_KEY = "./../keys/client/client.key" TLS_VERSION = 2 # MQTT broker options TOPIC_NAME = "sensors/Temp" HOSTNAME = "mqtt.sandyuraz.com" PORT = 8883 # MQTT user options CLIENT_ID = "sandissa-secret-me" USERNAME = "kitty" PASSWORD = None # MQTT publish/subscribe options QOS_PUBLISH = 2 QOS_SUBSCRIBE = 2
class AccessStruct(object): _size_to_width = [None, 0, 1, None, 2] def __init__(self, mem, struct_def, struct_addr): self.mem = mem self.struct = struct_def(mem, struct_addr) self.trace_mgr = getattr(self.mem, "trace_mgr", None) def w_s(self, name, val): struct, field = self.struct.write_field(name, val) if self.trace_mgr is not None: off = field.offset addr = struct.get_addr() + off tname = struct.get_type_name() addon = "%s+%d = %s" % (tname, off, name) width = self._size_to_width[field.size] self.trace_mgr.trace_int_mem( "W", width, addr, val, text="Struct", addon=addon ) def r_s(self, name): struct, field, val = self.struct.read_field_ext(name) if self.trace_mgr is not None: off = field.offset addr = struct.get_addr() + off tname = struct.get_type_name() addon = "%s+%d = %s" % (tname, off, name) width = self._size_to_width[field.size] self.trace_mgr.trace_int_mem( "R", width, addr, val, text="Struct", addon=addon ) return val def s_get_addr(self, name): return self.struct.get_addr_for_name(name) def r_all(self): """return a namedtuple with all values of the struct""" return self.struct.read_data() def w_all(self, nt): """set values stored in a named tuple""" self.struct.write_data(nt) def get_size(self): return self.struct.get_size()
#crie um programa que leia varios numeros e coloque em uma lista. #Depois disso crie 2 listas extras que vao conter apenas os valores pares e eu outra lista os valores impares #Ao final mostre o conteudo das 3 listas geradas #minha resposta lista = [] par = [] impar = [] while True: lista.append(int(input('Digite um numero: '))) resp = str(input('Quer continuar? [S/N] ')).strip().upper()[0] while resp not in 'SN': resp = str(input('Quer continuar? [S/N] ')).strip().upper()[0] if resp == 'N': break print('-='*20) print(f'A lista completa é {lista}') for c, v in enumerate(lista): if v % 2 == 0: par.append(v) else: impar.append(v) print(f'A lista de pares é {par}') print(f'A lista de impares é {impar}') #resposta do Gustavo num = list() pares = list() impares = list() while True: num.append(int(input('Digite um numero: '))) resp = str(input('Quer continuar? [S/N] ')) if resp in 'Nn': break for i, v in enumerate(num): if v % 2 == 0: pares.append(v) elif v % 2 == 1: impares.append(v) print('-='*30) print(f'A lista completa é {num}') print(f'A lista de pares é {pares}') print(f'A lista de impares é {impares}')
x,y = input().split() a = int(x) b = int(y) if a < b and (b-a) == 1: print("Dr. Chaz will have " + str(b-a) + " piece of chicken left over!") elif a < b: print("Dr. Chaz will have " + str(b - a) + " pieces of chicken left over!") elif a > b and (a-b) == 1: print("Dr. Chaz needs " + str(a - b) + " more piece of chicken!") else: print("Dr. Chaz needs " + str(a-b) + " more pieces of chicken!")
n=int(input()) sh=5 li=0 cum=0 for i in range(n): li = sh // 2 sh=(li*3) cum+=li print(cum)
def damage(skill1,skill2): damage1 = skill1 * 3 damage2 = skill2 * 2 + 10 return damage1,damage2 damages = damage(3,6) print(damages[0],damages[1]) print(type(damages)) # 元组 tuple skill1_damage,skill2_damage = damage(3,6) print(skill1_damage,skill2_damage)
n=1 s=0 while(n<50): cn=n mdx=0 mposfl=0 pos=0 nod=0 while(cn>0): ld=cn%10 nod=nod+1 if(ld>mdx): mdx=ld mposfl=pos cn=cn/10 pos=pos+1 apos=nod-mposfl i=0 sr=0 while(n>0): if(i==apos): continue else: sr=sr+(n%10) n=n/10 if(sr==mdx): print(mdx) n=n+1 n=n+1
class Solution: def romanToInt(self, s: str) -> int: num = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} val, pre = 0, 0 for key in s: n = num[key] if key in num else 0 val += -pre if n > pre else pre pre = n val += pre return val
''' 给定单向链表的头指针和一个要删除的节点的值,定义一个函数删除该节点。 返回删除后的链表的头节点。 注意:此题对比原题有改动 示例 1: 输入: head = [4,5,1,9], val = 5 输出: [4,1,9] 解释: 给定你链表中值为 5 的第二个节点,那么在调用了你的函数之后,该链表应变为 4 -> 1 -> 9. 示例 2: 输入: head = [4,5,1,9], val = 1 输出: [4,5,9] 解释: 给定你链表中值为 1 的第三个节点,那么在调用了你的函数之后,该链表应变为 4 -> 5 -> 9. 说明: - 题目保证链表中节点的值互不相同 - 若使用 C 或 C++ 语言,你不需要 free 或 delete 被删除的节点 ''' # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def deleteNode(self, head: ListNode, val: int) -> ListNode: curr_pointer = head if curr_pointer.val == val: # if the first node matches the val return head.next while curr_pointer.next: if curr_pointer.next.val == val: curr_pointer.next = curr_pointer.next.next break else: curr_pointer = curr_pointer.next return head
lb = { "loadBalancer": { "name": "mani-test-lb", "port": 80, "protocol": "HTTP", "virtualIps": [ { "type": "PUBLIC" } ] } } nodes = { "nodes": [ { "address": "10.2.2.3", "port": 80, "condition": "ENABLED", "type":"PRIMARY" } ] } metadata = { "metadata": [ { "key":"color", "value":"red" } ] } config = { "name": "lbaas", "description": "Racksapce Load Balancer", "uriprefix": { "regex": "/v1.0/\d+/", "env": "LB_URI_PREFIX" }, "headers": { "X-Auth-Token": {"env": "RS_AUTH_TOKEN"}, "Content-Type": "application/json" }, "tempfile": "/tmp/lb_req.json", "resources": { "loadbalancers/?$": { "templates": {"default": lb}, "aliases": { "name": "loadBalancer.name" }, "help": "Load balancers" }, "loadBalancers/[\d\-]+/?$": { "post": nodes }, "loadBalancers/[\d\-]+/nodes/?$": { "templates": {"default": nodes}, "help": "Load balancer's nodes. Format: loadBalancers/<load balancer ID>/nodes" }, "loadBalancers/[\d\-]+/nodes/[\d\-]+/?$": { "help": "Load balancer's node. Format: loadBalancers/<load balancer ID>/nodes/<nodeID>" }, "loadBalancers/[\d\-]+/metadata/?$": { "templates": {"default": metadata}, "help": "Load balancer's metadata. Format: loadBalancers/<load balancer ID>/metadata" } } }
def includeme(config): config.add_static_view('js', 'static/js', cache_max_age=3600) config.add_static_view('css', 'static/css', cache_max_age=3600) config.add_static_view('static', 'static', cache_max_age=3600) config.add_static_view('dz', 'static/dropzone', cache_max_age=3600) config.add_route('add-image', '/api/1.0/add-image') config.add_route('image-upload', '/upload') config.add_route('login', '/login') config.add_route('home', '/')
def last_minute_enhancements(nodes): count = 0 current_node = 0 for node in nodes: if node > current_node: count += 1 current_node = node elif node == current_node: count += 1 current_node = node + 1 return count if __name__ == "__main__": num_test = int(input()) for i in range(num_test): num_node = int(input()) nodes = [int(i) for i in input().split()] print(last_minute_enhancements(nodes))
# Opencast server address and credentials for api user OPENCAST_URL = 'OPENCAST_URL' OPENCAST_USER = 'OPENCAST_API_USER' OPENCAST_PASSWD = 'OPENCAST_PASSWORD_USER' # Timezone for the messages and from the XML file MESSAGES_TIMEZONE = 'Europe/Berlin' # Capture agent Klips dictionary # # Here you have to put the dictionary that links the room name # with the name of the capture agent registered in opencast. # # Example: # CAPTURE_AGENT_DICT = {'Room 12C, Building E' : 'agent1', # 'room2' : 'agent2', # 'room3' : 'agent3'} # CAPTURE_AGENT_DICT = {}
# # PySNMP MIB module NHRP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NHRP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:51:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint") AddressFamilyNumbers, = mibBuilder.importSymbols("IANA-ADDRESS-FAMILY-NUMBERS-MIB", "AddressFamilyNumbers") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") Counter64, MibIdentifier, Counter32, Integer32, Unsigned32, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, NotificationType, IpAddress, ObjectIdentity, mib_2, TimeTicks, ModuleIdentity, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "MibIdentifier", "Counter32", "Integer32", "Unsigned32", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "NotificationType", "IpAddress", "ObjectIdentity", "mib-2", "TimeTicks", "ModuleIdentity", "Gauge32") StorageType, TextualConvention, RowStatus, TimeStamp, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "StorageType", "TextualConvention", "RowStatus", "TimeStamp", "TruthValue", "DisplayString") nhrpMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 71)) nhrpMIB.setRevisions(('1999-08-26 00:00',)) if mibBuilder.loadTexts: nhrpMIB.setLastUpdated('9908260000Z') if mibBuilder.loadTexts: nhrpMIB.setOrganization('Internetworking Over NBMA (ion) Working Group') class NhrpGenAddr(TextualConvention, OctetString): status = 'current' subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 64) nhrpObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 71, 1)) nhrpGeneralObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 71, 1, 1)) nhrpNextIndex = MibScalar((1, 3, 6, 1, 2, 1, 71, 1, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpNextIndex.setStatus('current') nhrpCacheTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 1, 2), ) if mibBuilder.loadTexts: nhrpCacheTable.setStatus('current') nhrpCacheEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpCacheInternetworkAddrType"), (0, "NHRP-MIB", "nhrpCacheInternetworkAddr"), (0, "IF-MIB", "ifIndex"), (0, "NHRP-MIB", "nhrpCacheIndex")) if mibBuilder.loadTexts: nhrpCacheEntry.setStatus('current') nhrpCacheInternetworkAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 1), AddressFamilyNumbers()) if mibBuilder.loadTexts: nhrpCacheInternetworkAddrType.setStatus('current') nhrpCacheInternetworkAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 2), NhrpGenAddr()) if mibBuilder.loadTexts: nhrpCacheInternetworkAddr.setStatus('current') nhrpCacheIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: nhrpCacheIndex.setStatus('current') nhrpCachePrefixLength = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpCachePrefixLength.setStatus('current') nhrpCacheNextHopInternetworkAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 5), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpCacheNextHopInternetworkAddr.setStatus('current') nhrpCacheNbmaAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 6), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpCacheNbmaAddrType.setStatus('current') nhrpCacheNbmaAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 7), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpCacheNbmaAddr.setStatus('current') nhrpCacheNbmaSubaddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 8), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpCacheNbmaSubaddr.setStatus('current') nhrpCacheType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("other", 1), ("register", 2), ("resolveAuthoritative", 3), ("resoveNonauthoritative", 4), ("transit", 5), ("administrativelyAdded", 6), ("atmarp", 7), ("scsp", 8)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpCacheType.setStatus('current') nhrpCacheState = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("incomplete", 1), ("ackReply", 2), ("nakReply", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpCacheState.setStatus('current') nhrpCacheHoldingTimeValid = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 11), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpCacheHoldingTimeValid.setStatus('current') nhrpCacheHoldingTime = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpCacheHoldingTime.setStatus('current') nhrpCacheNegotiatedMtu = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpCacheNegotiatedMtu.setStatus('current') nhrpCachePreference = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpCachePreference.setStatus('current') nhrpCacheStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 15), StorageType().clone('nonVolatile')).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpCacheStorageType.setStatus('current') nhrpCacheRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 2, 1, 16), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpCacheRowStatus.setStatus('current') nhrpPurgeReqTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 1, 3), ) if mibBuilder.loadTexts: nhrpPurgeReqTable.setStatus('current') nhrpPurgeReqEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 1, 3, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpPurgeIndex")) if mibBuilder.loadTexts: nhrpPurgeReqEntry.setStatus('current') nhrpPurgeIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: nhrpPurgeIndex.setStatus('current') nhrpPurgeCacheIdentifier = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 3, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpPurgeCacheIdentifier.setStatus('current') nhrpPurgePrefixLength = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpPurgePrefixLength.setStatus('current') nhrpPurgeRequestID = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 3, 1, 4), Unsigned32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpPurgeRequestID.setStatus('current') nhrpPurgeReplyExpected = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 3, 1, 5), TruthValue()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpPurgeReplyExpected.setStatus('current') nhrpPurgeRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 1, 3, 1, 6), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpPurgeRowStatus.setStatus('current') nhrpClientObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 71, 1, 2)) nhrpClientTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 2, 1), ) if mibBuilder.loadTexts: nhrpClientTable.setStatus('current') nhrpClientEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpClientIndex")) if mibBuilder.loadTexts: nhrpClientEntry.setStatus('current') nhrpClientIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: nhrpClientIndex.setStatus('current') nhrpClientInternetworkAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 2), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientInternetworkAddrType.setStatus('current') nhrpClientInternetworkAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 3), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientInternetworkAddr.setStatus('current') nhrpClientNbmaAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 4), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNbmaAddrType.setStatus('current') nhrpClientNbmaAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 5), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNbmaAddr.setStatus('current') nhrpClientNbmaSubaddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 6), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNbmaSubaddr.setStatus('current') nhrpClientInitialRequestTimeout = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 900)).clone(10)).setUnits('seconds').setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientInitialRequestTimeout.setStatus('current') nhrpClientRegistrationRequestRetries = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(3)).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientRegistrationRequestRetries.setStatus('current') nhrpClientResolutionRequestRetries = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(3)).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientResolutionRequestRetries.setStatus('current') nhrpClientPurgeRequestRetries = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(3)).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientPurgeRequestRetries.setStatus('current') nhrpClientDefaultMtu = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(9180)).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientDefaultMtu.setStatus('current') nhrpClientHoldTime = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(900)).setUnits('seconds').setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientHoldTime.setStatus('current') nhrpClientRequestID = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 13), Unsigned32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientRequestID.setStatus('current') nhrpClientStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 14), StorageType().clone('nonVolatile')).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientStorageType.setStatus('current') nhrpClientRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 1, 1, 15), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientRowStatus.setStatus('current') nhrpClientRegistrationTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 2, 2), ) if mibBuilder.loadTexts: nhrpClientRegistrationTable.setStatus('current') nhrpClientRegistrationEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 2, 2, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpClientIndex"), (0, "NHRP-MIB", "nhrpClientRegIndex")) if mibBuilder.loadTexts: nhrpClientRegistrationEntry.setStatus('current') nhrpClientRegIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: nhrpClientRegIndex.setStatus('current') nhrpClientRegUniqueness = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("requestUnique", 1), ("requestNotUnique", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientRegUniqueness.setStatus('current') nhrpClientRegState = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("registering", 2), ("ackRegisterReply", 3), ("nakRegisterReply", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientRegState.setStatus('current') nhrpClientRegRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientRegRowStatus.setStatus('current') nhrpClientNhsTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 2, 3), ) if mibBuilder.loadTexts: nhrpClientNhsTable.setStatus('current') nhrpClientNhsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpClientIndex"), (0, "NHRP-MIB", "nhrpClientNhsIndex")) if mibBuilder.loadTexts: nhrpClientNhsEntry.setStatus('current') nhrpClientNhsIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: nhrpClientNhsIndex.setStatus('current') nhrpClientNhsInternetworkAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1, 2), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNhsInternetworkAddrType.setStatus('current') nhrpClientNhsInternetworkAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1, 3), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNhsInternetworkAddr.setStatus('current') nhrpClientNhsNbmaAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1, 4), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNhsNbmaAddrType.setStatus('current') nhrpClientNhsNbmaAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1, 5), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNhsNbmaAddr.setStatus('current') nhrpClientNhsNbmaSubaddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1, 6), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNhsNbmaSubaddr.setStatus('current') nhrpClientNhsInUse = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1, 7), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientNhsInUse.setStatus('current') nhrpClientNhsRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 3, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpClientNhsRowStatus.setStatus('current') nhrpClientStatTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 2, 4), ) if mibBuilder.loadTexts: nhrpClientStatTable.setStatus('current') nhrpClientStatEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpClientIndex")) if mibBuilder.loadTexts: nhrpClientStatEntry.setStatus('current') nhrpClientStatTxResolveReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatTxResolveReq.setStatus('current') nhrpClientStatRxResolveReplyAck = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxResolveReplyAck.setStatus('current') nhrpClientStatRxResolveReplyNakProhibited = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxResolveReplyNakProhibited.setStatus('current') nhrpClientStatRxResolveReplyNakInsufResources = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxResolveReplyNakInsufResources.setStatus('current') nhrpClientStatRxResolveReplyNakNoBinding = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxResolveReplyNakNoBinding.setStatus('current') nhrpClientStatRxResolveReplyNakNotUnique = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxResolveReplyNakNotUnique.setStatus('current') nhrpClientStatTxRegisterReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatTxRegisterReq.setStatus('current') nhrpClientStatRxRegisterAck = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxRegisterAck.setStatus('current') nhrpClientStatRxRegisterNakProhibited = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxRegisterNakProhibited.setStatus('current') nhrpClientStatRxRegisterNakInsufResources = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxRegisterNakInsufResources.setStatus('current') nhrpClientStatRxRegisterNakAlreadyReg = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxRegisterNakAlreadyReg.setStatus('current') nhrpClientStatRxPurgeReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxPurgeReq.setStatus('current') nhrpClientStatTxPurgeReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatTxPurgeReq.setStatus('current') nhrpClientStatRxPurgeReply = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxPurgeReply.setStatus('current') nhrpClientStatTxPurgeReply = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatTxPurgeReply.setStatus('current') nhrpClientStatTxErrorIndication = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatTxErrorIndication.setStatus('current') nhrpClientStatRxErrUnrecognizedExtension = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxErrUnrecognizedExtension.setStatus('current') nhrpClientStatRxErrLoopDetected = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxErrLoopDetected.setStatus('current') nhrpClientStatRxErrProtoAddrUnreachable = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxErrProtoAddrUnreachable.setStatus('current') nhrpClientStatRxErrProtoError = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxErrProtoError.setStatus('current') nhrpClientStatRxErrSduSizeExceeded = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxErrSduSizeExceeded.setStatus('current') nhrpClientStatRxErrInvalidExtension = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxErrInvalidExtension.setStatus('current') nhrpClientStatRxErrAuthenticationFailure = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxErrAuthenticationFailure.setStatus('current') nhrpClientStatRxErrHopCountExceeded = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatRxErrHopCountExceeded.setStatus('current') nhrpClientStatDiscontinuityTime = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 2, 4, 1, 25), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpClientStatDiscontinuityTime.setStatus('current') nhrpServerObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 71, 1, 3)) nhrpServerTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 3, 1), ) if mibBuilder.loadTexts: nhrpServerTable.setStatus('current') nhrpServerEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpServerIndex")) if mibBuilder.loadTexts: nhrpServerEntry.setStatus('current') nhrpServerIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: nhrpServerIndex.setStatus('current') nhrpServerInternetworkAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1, 2), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerInternetworkAddrType.setStatus('current') nhrpServerInternetworkAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1, 3), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerInternetworkAddr.setStatus('current') nhrpServerNbmaAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1, 4), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNbmaAddrType.setStatus('current') nhrpServerNbmaAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1, 5), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNbmaAddr.setStatus('current') nhrpServerNbmaSubaddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1, 6), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNbmaSubaddr.setStatus('current') nhrpServerStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1, 7), StorageType().clone('nonVolatile')).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerStorageType.setStatus('current') nhrpServerRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 1, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerRowStatus.setStatus('current') nhrpServerCacheTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 3, 2), ) if mibBuilder.loadTexts: nhrpServerCacheTable.setStatus('current') nhrpServerCacheEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 3, 2, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpCacheInternetworkAddrType"), (0, "NHRP-MIB", "nhrpCacheInternetworkAddr"), (0, "IF-MIB", "ifIndex"), (0, "NHRP-MIB", "nhrpCacheIndex")) if mibBuilder.loadTexts: nhrpServerCacheEntry.setStatus('current') nhrpServerCacheAuthoritative = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 2, 1, 1), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerCacheAuthoritative.setStatus('current') nhrpServerCacheUniqueness = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 2, 1, 2), TruthValue()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerCacheUniqueness.setStatus('current') nhrpServerNhcTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 3, 3), ) if mibBuilder.loadTexts: nhrpServerNhcTable.setStatus('current') nhrpServerNhcEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpServerIndex"), (0, "NHRP-MIB", "nhrpServerNhcIndex")) if mibBuilder.loadTexts: nhrpServerNhcEntry.setStatus('current') nhrpServerNhcIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: nhrpServerNhcIndex.setStatus('current') nhrpServerNhcPrefixLength = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNhcPrefixLength.setStatus('current') nhrpServerNhcInternetworkAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 3), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNhcInternetworkAddrType.setStatus('current') nhrpServerNhcInternetworkAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 4), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNhcInternetworkAddr.setStatus('current') nhrpServerNhcNbmaAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 5), AddressFamilyNumbers()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNhcNbmaAddrType.setStatus('current') nhrpServerNhcNbmaAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 6), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNhcNbmaAddr.setStatus('current') nhrpServerNhcNbmaSubaddr = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 7), NhrpGenAddr()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNhcNbmaSubaddr.setStatus('current') nhrpServerNhcInUse = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 8), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerNhcInUse.setStatus('current') nhrpServerNhcRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 3, 1, 9), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: nhrpServerNhcRowStatus.setStatus('current') nhrpServerStatTable = MibTable((1, 3, 6, 1, 2, 1, 71, 1, 3, 4), ) if mibBuilder.loadTexts: nhrpServerStatTable.setStatus('current') nhrpServerStatEntry = MibTableRow((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1), ).setIndexNames((0, "NHRP-MIB", "nhrpServerIndex")) if mibBuilder.loadTexts: nhrpServerStatEntry.setStatus('current') nhrpServerStatRxResolveReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxResolveReq.setStatus('current') nhrpServerStatTxResolveReplyAck = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxResolveReplyAck.setStatus('current') nhrpServerStatTxResolveReplyNakProhibited = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxResolveReplyNakProhibited.setStatus('current') nhrpServerStatTxResolveReplyNakInsufResources = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxResolveReplyNakInsufResources.setStatus('current') nhrpServerStatTxResolveReplyNakNoBinding = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxResolveReplyNakNoBinding.setStatus('current') nhrpServerStatTxResolveReplyNakNotUnique = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxResolveReplyNakNotUnique.setStatus('current') nhrpServerStatRxRegisterReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxRegisterReq.setStatus('current') nhrpServerStatTxRegisterAck = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxRegisterAck.setStatus('current') nhrpServerStatTxRegisterNakProhibited = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxRegisterNakProhibited.setStatus('current') nhrpServerStatTxRegisterNakInsufResources = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxRegisterNakInsufResources.setStatus('current') nhrpServerStatTxRegisterNakAlreadyReg = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxRegisterNakAlreadyReg.setStatus('current') nhrpServerStatRxPurgeReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxPurgeReq.setStatus('current') nhrpServerStatTxPurgeReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxPurgeReq.setStatus('current') nhrpServerStatRxPurgeReply = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxPurgeReply.setStatus('current') nhrpServerStatTxPurgeReply = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxPurgeReply.setStatus('current') nhrpServerStatRxErrUnrecognizedExtension = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrUnrecognizedExtension.setStatus('current') nhrpServerStatRxErrLoopDetected = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrLoopDetected.setStatus('current') nhrpServerStatRxErrProtoAddrUnreachable = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrProtoAddrUnreachable.setStatus('current') nhrpServerStatRxErrProtoError = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrProtoError.setStatus('current') nhrpServerStatRxErrSduSizeExceeded = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrSduSizeExceeded.setStatus('current') nhrpServerStatRxErrInvalidExtension = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrInvalidExtension.setStatus('current') nhrpServerStatRxErrInvalidResReplyReceived = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrInvalidResReplyReceived.setStatus('current') nhrpServerStatRxErrAuthenticationFailure = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrAuthenticationFailure.setStatus('current') nhrpServerStatRxErrHopCountExceeded = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatRxErrHopCountExceeded.setStatus('current') nhrpServerStatTxErrUnrecognizedExtension = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxErrUnrecognizedExtension.setStatus('current') nhrpServerStatTxErrLoopDetected = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxErrLoopDetected.setStatus('current') nhrpServerStatTxErrProtoAddrUnreachable = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 27), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxErrProtoAddrUnreachable.setStatus('current') nhrpServerStatTxErrProtoError = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxErrProtoError.setStatus('current') nhrpServerStatTxErrSduSizeExceeded = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxErrSduSizeExceeded.setStatus('current') nhrpServerStatTxErrInvalidExtension = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 30), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxErrInvalidExtension.setStatus('current') nhrpServerStatTxErrAuthenticationFailure = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 31), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxErrAuthenticationFailure.setStatus('current') nhrpServerStatTxErrHopCountExceeded = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 32), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatTxErrHopCountExceeded.setStatus('current') nhrpServerStatFwResolveReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 33), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatFwResolveReq.setStatus('current') nhrpServerStatFwResolveReply = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 34), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatFwResolveReply.setStatus('current') nhrpServerStatFwRegisterReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 35), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatFwRegisterReq.setStatus('current') nhrpServerStatFwRegisterReply = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 36), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatFwRegisterReply.setStatus('current') nhrpServerStatFwPurgeReq = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 37), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatFwPurgeReq.setStatus('current') nhrpServerStatFwPurgeReply = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 38), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatFwPurgeReply.setStatus('current') nhrpServerStatFwErrorIndication = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 39), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatFwErrorIndication.setStatus('current') nhrpServerStatDiscontinuityTime = MibTableColumn((1, 3, 6, 1, 2, 1, 71, 1, 3, 4, 1, 40), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: nhrpServerStatDiscontinuityTime.setStatus('current') nhrpConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 71, 2)) nhrpCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 71, 2, 1)) nhrpGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 71, 2, 2)) nhrpModuleCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 71, 2, 1, 1)).setObjects(("NHRP-MIB", "nhrpGeneralGroup"), ("NHRP-MIB", "nhrpClientGroup"), ("NHRP-MIB", "nhrpServerGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): nhrpModuleCompliance = nhrpModuleCompliance.setStatus('current') nhrpGeneralGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 71, 2, 2, 1)).setObjects(("NHRP-MIB", "nhrpNextIndex"), ("NHRP-MIB", "nhrpCachePrefixLength"), ("NHRP-MIB", "nhrpCacheNextHopInternetworkAddr"), ("NHRP-MIB", "nhrpCacheNbmaAddrType"), ("NHRP-MIB", "nhrpCacheNbmaAddr"), ("NHRP-MIB", "nhrpCacheNbmaSubaddr"), ("NHRP-MIB", "nhrpCacheType"), ("NHRP-MIB", "nhrpCacheState"), ("NHRP-MIB", "nhrpCacheHoldingTimeValid"), ("NHRP-MIB", "nhrpCacheHoldingTime"), ("NHRP-MIB", "nhrpCacheNegotiatedMtu"), ("NHRP-MIB", "nhrpCachePreference"), ("NHRP-MIB", "nhrpCacheStorageType"), ("NHRP-MIB", "nhrpCacheRowStatus"), ("NHRP-MIB", "nhrpPurgeCacheIdentifier"), ("NHRP-MIB", "nhrpPurgePrefixLength"), ("NHRP-MIB", "nhrpPurgeRequestID"), ("NHRP-MIB", "nhrpPurgeReplyExpected"), ("NHRP-MIB", "nhrpPurgeRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): nhrpGeneralGroup = nhrpGeneralGroup.setStatus('current') nhrpClientGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 71, 2, 2, 2)).setObjects(("NHRP-MIB", "nhrpClientInternetworkAddrType"), ("NHRP-MIB", "nhrpClientInternetworkAddr"), ("NHRP-MIB", "nhrpClientNbmaAddrType"), ("NHRP-MIB", "nhrpClientNbmaAddr"), ("NHRP-MIB", "nhrpClientNbmaSubaddr"), ("NHRP-MIB", "nhrpClientInitialRequestTimeout"), ("NHRP-MIB", "nhrpClientRegistrationRequestRetries"), ("NHRP-MIB", "nhrpClientResolutionRequestRetries"), ("NHRP-MIB", "nhrpClientPurgeRequestRetries"), ("NHRP-MIB", "nhrpClientDefaultMtu"), ("NHRP-MIB", "nhrpClientHoldTime"), ("NHRP-MIB", "nhrpClientRequestID"), ("NHRP-MIB", "nhrpClientStorageType"), ("NHRP-MIB", "nhrpClientRowStatus"), ("NHRP-MIB", "nhrpClientRegUniqueness"), ("NHRP-MIB", "nhrpClientRegState"), ("NHRP-MIB", "nhrpClientRegRowStatus"), ("NHRP-MIB", "nhrpClientNhsInternetworkAddrType"), ("NHRP-MIB", "nhrpClientNhsInternetworkAddr"), ("NHRP-MIB", "nhrpClientNhsNbmaAddrType"), ("NHRP-MIB", "nhrpClientNhsNbmaAddr"), ("NHRP-MIB", "nhrpClientNhsNbmaSubaddr"), ("NHRP-MIB", "nhrpClientNhsInUse"), ("NHRP-MIB", "nhrpClientNhsRowStatus"), ("NHRP-MIB", "nhrpClientStatTxResolveReq"), ("NHRP-MIB", "nhrpClientStatRxResolveReplyAck"), ("NHRP-MIB", "nhrpClientStatRxResolveReplyNakProhibited"), ("NHRP-MIB", "nhrpClientStatRxResolveReplyNakInsufResources"), ("NHRP-MIB", "nhrpClientStatRxResolveReplyNakNoBinding"), ("NHRP-MIB", "nhrpClientStatRxResolveReplyNakNotUnique"), ("NHRP-MIB", "nhrpClientStatTxRegisterReq"), ("NHRP-MIB", "nhrpClientStatRxRegisterAck"), ("NHRP-MIB", "nhrpClientStatRxRegisterNakProhibited"), ("NHRP-MIB", "nhrpClientStatRxRegisterNakInsufResources"), ("NHRP-MIB", "nhrpClientStatRxRegisterNakAlreadyReg"), ("NHRP-MIB", "nhrpClientStatRxPurgeReq"), ("NHRP-MIB", "nhrpClientStatTxPurgeReq"), ("NHRP-MIB", "nhrpClientStatRxPurgeReply"), ("NHRP-MIB", "nhrpClientStatTxPurgeReply"), ("NHRP-MIB", "nhrpClientStatTxErrorIndication"), ("NHRP-MIB", "nhrpClientStatRxErrUnrecognizedExtension"), ("NHRP-MIB", "nhrpClientStatRxErrLoopDetected"), ("NHRP-MIB", "nhrpClientStatRxErrProtoAddrUnreachable"), ("NHRP-MIB", "nhrpClientStatRxErrProtoError"), ("NHRP-MIB", "nhrpClientStatRxErrSduSizeExceeded"), ("NHRP-MIB", "nhrpClientStatRxErrInvalidExtension"), ("NHRP-MIB", "nhrpClientStatRxErrAuthenticationFailure"), ("NHRP-MIB", "nhrpClientStatRxErrHopCountExceeded"), ("NHRP-MIB", "nhrpClientStatDiscontinuityTime")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): nhrpClientGroup = nhrpClientGroup.setStatus('current') nhrpServerGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 71, 2, 2, 3)).setObjects(("NHRP-MIB", "nhrpServerInternetworkAddrType"), ("NHRP-MIB", "nhrpServerInternetworkAddr"), ("NHRP-MIB", "nhrpServerNbmaAddrType"), ("NHRP-MIB", "nhrpServerNbmaAddr"), ("NHRP-MIB", "nhrpServerNbmaSubaddr"), ("NHRP-MIB", "nhrpServerStorageType"), ("NHRP-MIB", "nhrpServerRowStatus"), ("NHRP-MIB", "nhrpServerCacheAuthoritative"), ("NHRP-MIB", "nhrpServerCacheUniqueness"), ("NHRP-MIB", "nhrpServerNhcPrefixLength"), ("NHRP-MIB", "nhrpServerNhcInternetworkAddrType"), ("NHRP-MIB", "nhrpServerNhcInternetworkAddr"), ("NHRP-MIB", "nhrpServerNhcNbmaAddrType"), ("NHRP-MIB", "nhrpServerNhcNbmaAddr"), ("NHRP-MIB", "nhrpServerNhcNbmaSubaddr"), ("NHRP-MIB", "nhrpServerNhcInUse"), ("NHRP-MIB", "nhrpServerNhcRowStatus"), ("NHRP-MIB", "nhrpServerStatRxResolveReq"), ("NHRP-MIB", "nhrpServerStatTxResolveReplyAck"), ("NHRP-MIB", "nhrpServerStatTxResolveReplyNakProhibited"), ("NHRP-MIB", "nhrpServerStatTxResolveReplyNakInsufResources"), ("NHRP-MIB", "nhrpServerStatTxResolveReplyNakNoBinding"), ("NHRP-MIB", "nhrpServerStatTxResolveReplyNakNotUnique"), ("NHRP-MIB", "nhrpServerStatRxRegisterReq"), ("NHRP-MIB", "nhrpServerStatTxRegisterAck"), ("NHRP-MIB", "nhrpServerStatTxRegisterNakProhibited"), ("NHRP-MIB", "nhrpServerStatTxRegisterNakInsufResources"), ("NHRP-MIB", "nhrpServerStatTxRegisterNakAlreadyReg"), ("NHRP-MIB", "nhrpServerStatRxPurgeReq"), ("NHRP-MIB", "nhrpServerStatTxPurgeReq"), ("NHRP-MIB", "nhrpServerStatRxPurgeReply"), ("NHRP-MIB", "nhrpServerStatTxPurgeReply"), ("NHRP-MIB", "nhrpServerStatRxErrUnrecognizedExtension"), ("NHRP-MIB", "nhrpServerStatRxErrLoopDetected"), ("NHRP-MIB", "nhrpServerStatRxErrProtoAddrUnreachable"), ("NHRP-MIB", "nhrpServerStatRxErrProtoError"), ("NHRP-MIB", "nhrpServerStatRxErrSduSizeExceeded"), ("NHRP-MIB", "nhrpServerStatRxErrInvalidExtension"), ("NHRP-MIB", "nhrpServerStatRxErrInvalidResReplyReceived"), ("NHRP-MIB", "nhrpServerStatRxErrAuthenticationFailure"), ("NHRP-MIB", "nhrpServerStatRxErrHopCountExceeded"), ("NHRP-MIB", "nhrpServerStatTxErrUnrecognizedExtension"), ("NHRP-MIB", "nhrpServerStatTxErrLoopDetected"), ("NHRP-MIB", "nhrpServerStatTxErrProtoAddrUnreachable"), ("NHRP-MIB", "nhrpServerStatTxErrProtoError"), ("NHRP-MIB", "nhrpServerStatTxErrSduSizeExceeded"), ("NHRP-MIB", "nhrpServerStatTxErrInvalidExtension"), ("NHRP-MIB", "nhrpServerStatTxErrAuthenticationFailure"), ("NHRP-MIB", "nhrpServerStatTxErrHopCountExceeded"), ("NHRP-MIB", "nhrpServerStatFwResolveReq"), ("NHRP-MIB", "nhrpServerStatFwResolveReply"), ("NHRP-MIB", "nhrpServerStatFwRegisterReq"), ("NHRP-MIB", "nhrpServerStatFwRegisterReply"), ("NHRP-MIB", "nhrpServerStatFwPurgeReq"), ("NHRP-MIB", "nhrpServerStatFwPurgeReply"), ("NHRP-MIB", "nhrpServerStatFwErrorIndication"), ("NHRP-MIB", "nhrpServerStatDiscontinuityTime")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): nhrpServerGroup = nhrpServerGroup.setStatus('current') mibBuilder.exportSymbols("NHRP-MIB", nhrpClientStatTxErrorIndication=nhrpClientStatTxErrorIndication, nhrpClientStatRxResolveReplyNakNoBinding=nhrpClientStatRxResolveReplyNakNoBinding, nhrpClientStatRxResolveReplyAck=nhrpClientStatRxResolveReplyAck, nhrpCacheNbmaSubaddr=nhrpCacheNbmaSubaddr, nhrpPurgeCacheIdentifier=nhrpPurgeCacheIdentifier, nhrpClientPurgeRequestRetries=nhrpClientPurgeRequestRetries, nhrpServerStatTxResolveReplyAck=nhrpServerStatTxResolveReplyAck, nhrpServerStatTxPurgeReply=nhrpServerStatTxPurgeReply, nhrpServerStatFwResolveReq=nhrpServerStatFwResolveReq, nhrpCacheInternetworkAddrType=nhrpCacheInternetworkAddrType, nhrpClientNhsEntry=nhrpClientNhsEntry, nhrpServerObjects=nhrpServerObjects, nhrpServerStatFwErrorIndication=nhrpServerStatFwErrorIndication, nhrpGeneralObjects=nhrpGeneralObjects, nhrpServerStorageType=nhrpServerStorageType, nhrpClientStatRxErrInvalidExtension=nhrpClientStatRxErrInvalidExtension, nhrpClientRegUniqueness=nhrpClientRegUniqueness, nhrpClientStatRxErrUnrecognizedExtension=nhrpClientStatRxErrUnrecognizedExtension, nhrpCacheInternetworkAddr=nhrpCacheInternetworkAddr, nhrpServerStatFwPurgeReply=nhrpServerStatFwPurgeReply, nhrpCacheNextHopInternetworkAddr=nhrpCacheNextHopInternetworkAddr, nhrpClientInternetworkAddr=nhrpClientInternetworkAddr, nhrpServerStatRxRegisterReq=nhrpServerStatRxRegisterReq, nhrpCacheTable=nhrpCacheTable, nhrpServerStatDiscontinuityTime=nhrpServerStatDiscontinuityTime, nhrpServerStatEntry=nhrpServerStatEntry, nhrpServerStatTxRegisterNakAlreadyReg=nhrpServerStatTxRegisterNakAlreadyReg, nhrpPurgeIndex=nhrpPurgeIndex, nhrpClientStatRxPurgeReq=nhrpClientStatRxPurgeReq, nhrpServerNbmaAddr=nhrpServerNbmaAddr, nhrpClientNhsIndex=nhrpClientNhsIndex, nhrpServerNhcIndex=nhrpServerNhcIndex, nhrpServerStatRxPurgeReply=nhrpServerStatRxPurgeReply, nhrpServerNbmaSubaddr=nhrpServerNbmaSubaddr, nhrpClientStatRxResolveReplyNakNotUnique=nhrpClientStatRxResolveReplyNakNotUnique, nhrpServerStatFwPurgeReq=nhrpServerStatFwPurgeReq, nhrpConformance=nhrpConformance, nhrpNextIndex=nhrpNextIndex, nhrpClientNhsNbmaSubaddr=nhrpClientNhsNbmaSubaddr, nhrpServerNhcTable=nhrpServerNhcTable, nhrpServerStatTxResolveReplyNakNotUnique=nhrpServerStatTxResolveReplyNakNotUnique, nhrpClientRegState=nhrpClientRegState, nhrpClientResolutionRequestRetries=nhrpClientResolutionRequestRetries, nhrpCacheState=nhrpCacheState, nhrpClientStatRxResolveReplyNakInsufResources=nhrpClientStatRxResolveReplyNakInsufResources, nhrpServerStatRxErrInvalidExtension=nhrpServerStatRxErrInvalidExtension, nhrpServerStatRxErrHopCountExceeded=nhrpServerStatRxErrHopCountExceeded, nhrpServerStatFwResolveReply=nhrpServerStatFwResolveReply, nhrpCacheStorageType=nhrpCacheStorageType, PYSNMP_MODULE_ID=nhrpMIB, nhrpCacheHoldingTime=nhrpCacheHoldingTime, nhrpClientStatRxRegisterAck=nhrpClientStatRxRegisterAck, nhrpClientStatTxResolveReq=nhrpClientStatTxResolveReq, nhrpServerNhcNbmaSubaddr=nhrpServerNhcNbmaSubaddr, nhrpServerStatFwRegisterReply=nhrpServerStatFwRegisterReply, nhrpServerTable=nhrpServerTable, nhrpServerCacheAuthoritative=nhrpServerCacheAuthoritative, nhrpServerStatTxRegisterAck=nhrpServerStatTxRegisterAck, nhrpClientNhsTable=nhrpClientNhsTable, nhrpMIB=nhrpMIB, nhrpClientStatRxErrSduSizeExceeded=nhrpClientStatRxErrSduSizeExceeded, nhrpServerStatTxErrProtoAddrUnreachable=nhrpServerStatTxErrProtoAddrUnreachable, nhrpClientStatDiscontinuityTime=nhrpClientStatDiscontinuityTime, nhrpServerStatTxErrHopCountExceeded=nhrpServerStatTxErrHopCountExceeded, nhrpClientTable=nhrpClientTable, nhrpServerInternetworkAddr=nhrpServerInternetworkAddr, nhrpClientStatRxErrProtoAddrUnreachable=nhrpClientStatRxErrProtoAddrUnreachable, nhrpServerRowStatus=nhrpServerRowStatus, nhrpServerStatTxResolveReplyNakProhibited=nhrpServerStatTxResolveReplyNakProhibited, nhrpServerStatTxResolveReplyNakNoBinding=nhrpServerStatTxResolveReplyNakNoBinding, nhrpCacheRowStatus=nhrpCacheRowStatus, nhrpServerStatRxErrAuthenticationFailure=nhrpServerStatRxErrAuthenticationFailure, nhrpClientNhsInternetworkAddr=nhrpClientNhsInternetworkAddr, nhrpClientInternetworkAddrType=nhrpClientInternetworkAddrType, nhrpServerNhcNbmaAddr=nhrpServerNhcNbmaAddr, nhrpServerStatTxErrLoopDetected=nhrpServerStatTxErrLoopDetected, nhrpServerEntry=nhrpServerEntry, nhrpClientRegistrationEntry=nhrpClientRegistrationEntry, nhrpClientNhsNbmaAddrType=nhrpClientNhsNbmaAddrType, nhrpServerStatRxErrProtoAddrUnreachable=nhrpServerStatRxErrProtoAddrUnreachable, nhrpServerIndex=nhrpServerIndex, nhrpServerStatRxErrInvalidResReplyReceived=nhrpServerStatRxErrInvalidResReplyReceived, nhrpClientNbmaSubaddr=nhrpClientNbmaSubaddr, nhrpClientNhsNbmaAddr=nhrpClientNhsNbmaAddr, NhrpGenAddr=NhrpGenAddr, nhrpClientStatTxPurgeReply=nhrpClientStatTxPurgeReply, nhrpClientStatTable=nhrpClientStatTable, nhrpServerStatRxErrSduSizeExceeded=nhrpServerStatRxErrSduSizeExceeded, nhrpClientRegRowStatus=nhrpClientRegRowStatus, nhrpClientRequestID=nhrpClientRequestID, nhrpServerCacheUniqueness=nhrpServerCacheUniqueness, nhrpClientStatRxErrLoopDetected=nhrpClientStatRxErrLoopDetected, nhrpClientStatRxRegisterNakInsufResources=nhrpClientStatRxRegisterNakInsufResources, nhrpServerStatRxPurgeReq=nhrpServerStatRxPurgeReq, nhrpServerStatRxErrLoopDetected=nhrpServerStatRxErrLoopDetected, nhrpCacheIndex=nhrpCacheIndex, nhrpPurgeRequestID=nhrpPurgeRequestID, nhrpServerStatTxErrProtoError=nhrpServerStatTxErrProtoError, nhrpCompliances=nhrpCompliances, nhrpCacheNbmaAddrType=nhrpCacheNbmaAddrType, nhrpServerStatTxErrUnrecognizedExtension=nhrpServerStatTxErrUnrecognizedExtension, nhrpObjects=nhrpObjects, nhrpClientStatRxRegisterNakAlreadyReg=nhrpClientStatRxRegisterNakAlreadyReg, nhrpClientStatRxRegisterNakProhibited=nhrpClientStatRxRegisterNakProhibited, nhrpClientNbmaAddrType=nhrpClientNbmaAddrType, nhrpServerStatTxRegisterNakProhibited=nhrpServerStatTxRegisterNakProhibited, nhrpServerCacheTable=nhrpServerCacheTable, nhrpClientStatRxPurgeReply=nhrpClientStatRxPurgeReply, nhrpServerStatTxErrAuthenticationFailure=nhrpServerStatTxErrAuthenticationFailure, nhrpServerNhcInUse=nhrpServerNhcInUse, nhrpServerNhcNbmaAddrType=nhrpServerNhcNbmaAddrType, nhrpPurgeReqEntry=nhrpPurgeReqEntry, nhrpClientRegistrationRequestRetries=nhrpClientRegistrationRequestRetries, nhrpClientEntry=nhrpClientEntry, nhrpClientStatRxErrProtoError=nhrpClientStatRxErrProtoError, nhrpClientObjects=nhrpClientObjects, nhrpClientRowStatus=nhrpClientRowStatus, nhrpClientHoldTime=nhrpClientHoldTime, nhrpCacheType=nhrpCacheType, nhrpServerStatTxRegisterNakInsufResources=nhrpServerStatTxRegisterNakInsufResources, nhrpCacheEntry=nhrpCacheEntry, nhrpCachePreference=nhrpCachePreference, nhrpServerNhcInternetworkAddr=nhrpServerNhcInternetworkAddr, nhrpClientRegistrationTable=nhrpClientRegistrationTable, nhrpServerStatTxPurgeReq=nhrpServerStatTxPurgeReq, nhrpServerStatTxErrInvalidExtension=nhrpServerStatTxErrInvalidExtension, nhrpPurgeRowStatus=nhrpPurgeRowStatus, nhrpModuleCompliance=nhrpModuleCompliance, nhrpPurgePrefixLength=nhrpPurgePrefixLength, nhrpPurgeReqTable=nhrpPurgeReqTable, nhrpGeneralGroup=nhrpGeneralGroup, nhrpClientStatRxErrAuthenticationFailure=nhrpClientStatRxErrAuthenticationFailure, nhrpServerCacheEntry=nhrpServerCacheEntry, nhrpClientNbmaAddr=nhrpClientNbmaAddr, nhrpServerStatRxErrProtoError=nhrpServerStatRxErrProtoError, nhrpClientNhsInUse=nhrpClientNhsInUse, nhrpClientStatTxRegisterReq=nhrpClientStatTxRegisterReq, nhrpServerNhcEntry=nhrpServerNhcEntry, nhrpServerGroup=nhrpServerGroup, nhrpClientNhsInternetworkAddrType=nhrpClientNhsInternetworkAddrType, nhrpServerNhcPrefixLength=nhrpServerNhcPrefixLength, nhrpServerStatTxResolveReplyNakInsufResources=nhrpServerStatTxResolveReplyNakInsufResources, nhrpCachePrefixLength=nhrpCachePrefixLength, nhrpClientStatTxPurgeReq=nhrpClientStatTxPurgeReq, nhrpClientStorageType=nhrpClientStorageType, nhrpServerStatTable=nhrpServerStatTable, nhrpCacheNegotiatedMtu=nhrpCacheNegotiatedMtu, nhrpServerStatRxResolveReq=nhrpServerStatRxResolveReq, nhrpClientGroup=nhrpClientGroup, nhrpClientStatRxErrHopCountExceeded=nhrpClientStatRxErrHopCountExceeded, nhrpClientIndex=nhrpClientIndex, nhrpServerStatRxErrUnrecognizedExtension=nhrpServerStatRxErrUnrecognizedExtension, nhrpCacheNbmaAddr=nhrpCacheNbmaAddr, nhrpCacheHoldingTimeValid=nhrpCacheHoldingTimeValid, nhrpClientInitialRequestTimeout=nhrpClientInitialRequestTimeout, nhrpGroups=nhrpGroups, nhrpServerNhcInternetworkAddrType=nhrpServerNhcInternetworkAddrType, nhrpServerStatTxErrSduSizeExceeded=nhrpServerStatTxErrSduSizeExceeded, nhrpClientRegIndex=nhrpClientRegIndex, nhrpClientStatRxResolveReplyNakProhibited=nhrpClientStatRxResolveReplyNakProhibited, nhrpServerStatFwRegisterReq=nhrpServerStatFwRegisterReq, nhrpPurgeReplyExpected=nhrpPurgeReplyExpected, nhrpServerNhcRowStatus=nhrpServerNhcRowStatus, nhrpClientStatEntry=nhrpClientStatEntry, nhrpClientNhsRowStatus=nhrpClientNhsRowStatus, nhrpClientDefaultMtu=nhrpClientDefaultMtu, nhrpServerInternetworkAddrType=nhrpServerInternetworkAddrType, nhrpServerNbmaAddrType=nhrpServerNbmaAddrType)
env_name = 'BreakoutDeterministic-v4' input_shape = [84, 84, 4] output_size = 4 ''' env_name = 'SeaquestDeterministic-v4' input_shape = [84, 84, 4] output_size = 18 ''' ''' env_name = 'PongDeterministic-v4 input_shape = [84, 84, 4] output_size = 6 '''
""" Geometry settings """ """Stack Settings""" # number of cells in the stack cell_number = 1 """"Cell Geometry """ # length of the cell, a side of the active area [m] cell_length = 0.5 # height of the cell, b side of the active area [m] cell_width = 0.1 # thickness of the bipolar plate [m] cathode_bipolar_plate_thickness = 2.0e-3 anode_bipolar_plate_thickness = 2.0e-3 # thickness of the membrane [m] membrane_thickness = 15.e-6 # thickness of the catalyst layer [m] cathode_catalyst_layer_thickness = 10.e-6 anode_catalyst_layer_thickness = 10.e-6 # catalyst layer porosity (ionomer considered as porous volume) [-] cathode_catalyst_layer_porosity = 0.5 anode_catalyst_layer_porosity = 0.5 # thickness of the gas diffusion layer [m] cathode_gdl_thickness = 200.e-6 anode_gdl_thickness = 200.e-6 # gas diffusion layer porosity [-] cathode_gdl_porosity = 0.8 anode_gdl_porosity = 0.8 """Flow Field Geometry""" # channel length [m] cathode_channel_length = 0.5 anode_channel_length = 0.5 # channel width [m] cathode_channel_width = 1.e-3 anode_channel_width = 1.e-3 # rib width [m] cathode_channel_rib_width = cathode_channel_width anode_channel_rib_width = anode_channel_width # channel height [m] cathode_channel_height = 1.e-3 anode_channel_height = 1.e-3 # number of channels cathode_channel_number = 50 anode_channel_number = 50 # shape of channel (rectangular, trapezoidal, triangular) cathode_channel_shape = 'rectangular' anode_channel_shape = 'rectangular' # width of channel at its base (only for trapezoidal) [m] cathode_channel_base_width = 0.8 * cathode_channel_width anode_channel_base_width = 0.8 * anode_channel_width # channel bends [n] cathode_channel_bends = 0 anode_channel_bends = 0 # bend pressure loss coefficient of the channel bends bend_pressure_loss_coefficient = 0.1 # flow direction in channel along x-axis cathode_flow_direction = 1 anode_flow_direction = -1 """Coolant Settings""" # set boolean to calculate coolant flow coolant_circuit = True # set boolean for coolant flow between the edge cells and endplates cooling_bc = False # channel length [m] coolant_channel_length = 0.5 # height of the coolant channel [m] coolant_channel_height = 1.e-3 # width of the coolant channel [m] coolant_channel_width = 2.e-3 # coolant channel shape cool_channel_shape = 'rectangular' cool_channel_base_width = 0.8 * coolant_channel_width # number of coolant channels per cell coolant_channel_number = 20 # channel bends [n] coolant_channel_bends = 0.0 # bend pressure loss coefficient of the channel bends coolant_bend_pressure_loss_coefficient = 0.1 """Manifold Geometry""" # set boolean for calculation of the flow distribution calc_cathode_distribution = True calc_anode_distribution = True calc_coolant_distribution = True # Configuration: U- or Z-shape anode_manifold_configuration = 'U' cathode_manifold_configuration = 'U' coolant_manifold_configuration = 'U' # manifold cross-sectional shape ('circular', 'rectangular') cathode_manifold_cross_shape = 'circular' anode_manifold_cross_shape = 'circular' coolant_manifold_cross_shape = 'circular' # manifold diameters [m] (for circular shape) cathode_in_manifold_diameter = 40e-3 cathode_out_manifold_diameter = 40e-3 anode_in_manifold_diameter = 40e-3 anode_out_manifold_diameter = 40e-3 coolant_in_manifold_diameter = 40e-3 coolant_out_manifold_diameter = 40e-3 # manifold height [m] (for rectangular shape) cathode_in_manifold_height = 10e-3 cathode_out_manifold_height = 10e-3 anode_in_manifold_height = 10e-3 anode_out_manifold_height = 10e-3 coolant_in_manifold_height = 10e-3 coolant_out_manifold_height = 10e-3 # manifold width [m] (for rectangular shape) cathode_in_manifold_width = 10e-3 cathode_out_manifold_width = 10e-3 anode_in_manifold_width = 10e-3 anode_out_manifold_width = 10e-3 coolant_in_manifold_width = 10e-3 coolant_out_manifold_width = 10e-3 # geometrical pressure loss coefficient of the manifolds general_loss_coefficient = 0.4 cathode_in_manifold_pressure_loss_coefficient = general_loss_coefficient cathode_out_manifold_pressure_loss_coefficient = general_loss_coefficient anode_in_manifold_pressure_loss_coefficient = general_loss_coefficient anode_out_manifold_pressure_loss_coefficient = general_loss_coefficient coolant_in_manifold_pressure_loss_coefficient = general_loss_coefficient coolant_out_manifold_pressure_loss_coefficient = general_loss_coefficient # Model type model_name = 'UpdatedKoh' anode_manifold_model = model_name cathode_manifold_model = model_name coolant_manifold_model = model_name # anode_manifold_model = 'Koh' # cathode_manifold_model = 'Koh' # coolant_manifold_model = 'Koh'
def metade(valor=0, formato=False): res = valor/2 return res if formato is False else moeda(res) def dobro(valor=0, formato=False): res = valor*2 return res if formato is False else moeda(res) def aumentar(valor=0, porcentagem=0, formato=False): res = valor+(valor * porcentagem/100) return res if formato is False else moeda(res) def diminuir(valor=0, porcentagem=0, formato=False): res = valor-(valor * porcentagem/100) return res if not formato else moeda(res) # aqui moeda fica como segundo parametro pois o primeiro a ser importado é o valor def moeda(valor=0, moeda='R$'): # Posso mudar a moeda apenas informando outra lá na hora de importar return f'{moeda}{valor:.2f}'.replace('.', ',') #! lembra que if formato: => formato = True ||| if not formato: => formato = False
# Leetcode 200. Number of Islands # # Link: https://leetcode.com/problems/number-of-islands/ # Difficulty: Medium # Solution using BFS and visited set. # Complexity: # O(M*N) time | where M and N represent the rows and cols of the input matrix # O(M*N) space | where M and N represent the rows and cols of the input matrix class Solution: def numIslands(self, grid: List[List[str]]) -> int: ROWS, COLS = len(grid), len(grid[0]) DIRECTIONS = ((0,1), (0,-1), (1,0), (-1,0)) count = 0 visited = set() def bfs(r, c): q = deque() q.append((r,c)) while q: r, c = q.popleft() for dr, dc in DIRECTIONS: newR, newC = r + dr, c + dc if (newR in range(ROWS) and newC in range(COLS) and (newR, newC) not in visited): visited.add((newR, newC)) if grid[newR][newC] == "1": q.append((newR, newC)) for r in range(ROWS): for c in range(COLS): if (r,c) not in visited and grid[r][c] == "1": count += 1 bfs(r, c) return count # Solution using DFS and changing grid values instead of visited set. # Complexity: # O(M*N) time | where M and N represent the rows and cols of the input matrix # O(1) space class Solution: def numIslands(self, grid: List[List[str]]) -> int: ROWS, COLS = len(grid), len(grid[0]) DIRECTIONS = ((0,1), (0,-1), (1,0), (-1,0)) count = 0 def dfs(r, c): stack = [(r, c)] while stack: r, c = stack.pop() grid[r][c] = '0' for dr, dc in DIRECTIONS: newR, newC = r + dr, c + dc if (newR in range(ROWS) and newC in range(COLS) and grid[newR][newC] == '1'): stack.append((newR, newC)) for r in range(ROWS): for c in range(COLS): if grid[r][c] == '1': dfs(r, c) count += 1 return count
BUNDLES = [ #! if api: 'flask_unchained.bundles.api', #! endif #! if mail: 'flask_unchained.bundles.mail', #! endif #! if celery: 'flask_unchained.bundles.celery', # move before mail to send emails synchronously #! endif #! if oauth: 'flask_unchained.bundles.oauth', #! endif #! if security or oauth: 'flask_unchained.bundles.security', #! endif #! if security or session: 'flask_unchained.bundles.session', #! endif #! if security or sqlalchemy: 'flask_unchained.bundles.sqlalchemy', #! endif #! if webpack: 'flask_unchained.bundles.webpack', #! endif #! if any(set(requirements) - {'dev', 'docs'}): #! endif 'app', # your app bundle *must* be last ]
class RequestFailedError(Exception): pass class DOIFormatIncorrect(Exception): pass
# By submitting this assignment, I agree to the following: # “Aggies do not lie, cheat, or steal, or tolerate those who do” # “I have not given or received any unauthorized aid on this assignment” # # Name: Jonathan Samuel # Section: 510 # Assignment: Quiz2 # Date: 9 20 2018 # Get Time from User Input and convert into minutes def getTime(): time = input("In minutes, what time is the fight at?") time = float(time) time = time * 60 print(time) return time # Get part of stage or return empty if it doesn't fall into constraints def getStage(time): if 0.0 <= time <= 100.0: return "Stage 1" elif 100.0 <= time <= 170.0: return "Stage 2" elif 170.0 <= time <= 260.0: return "Stage 3" elif time > 260.0: return "Free Flight" else: return "" # Start Program by getting time time = getTime() # Set Boolean to check if the number that has been entered is valid done = False # Make sure the loop runs until it's done while not done: flight = getStage(time) if flight != "": print("The rocket is in " + flight) done = True else: print("Try again - You can't input a negative number") time = getTime()
N, M, P, Q = map(int, input().split()) result = (N // (M * (12 + Q))) * 12 N %= M * (12 + Q) if N <= M * (P - 1): result += (N + (M - 1)) // M else: result += P - 1 N -= M * (P - 1) if N <= 2 * M * Q: result += (N + (2 * M - 1)) // (2 * M) else: result += Q N -= 2 * M * Q result += (N + (M - 1)) // M print(result)
# This is a line comment ''' This is a block comment ''' def main(): print("Hello world!\n"); main()
# global progViewWidth ProgEntryFieldW=10 ProgButX=160 progViewWidth=60 stopProgButX=200 comportlabelx=270 comPortEntryFieldX=390 comPortEntryFieldw=12 comPortButx=495 calibration_entryjoinx=520 calibration_entrydhx=745 calibration_joinx=600 calibration_alphax=800 calibrate_buttoncol2x=210 tab1_instructionbuttonw=16 jogbuttonwidth=1 manualprogramentryx=650 manualprogramentryw=50
######################################################################### # # # C R A N F I E L D U N I V E R S I T Y # # 2 0 1 9 / 2 0 2 0 # # # # MSc in Aerospace Computational Engineering # # # # Group Design Project # # # # Driver File for the OpenFoam Automated Tool Chain # # Flow Past Cylinder Test Case # # # #-----------------------------------------------------------------------# # # # Main Contributors: # # Vadim Maltsev (Email: [email protected]) # # Samali Liyanage (Email: [email protected]) # # Elias Farah (Email: [email protected]) # # Supervisor: # # Dr. Tom-Robin Teschner (Email: [email protected] ) # # # ######################################################################### class genCuttingPlaneFile: #fileName: name of the singleGraph file #planeName: name given to plane #point: the point given as a string in the form (x0 y0 z0) #normal: the normal given as a string in the form (x1 y1 z1) #fields: the fields taken for plotting given in the form (U p) def __init__(self, fileName, planeName, point, normal, fields): self.fileName = fileName self.planeName = planeName self.point = point self.normal = normal self.fields = fields def writeCuttingPlaneFile(self): cuttingPlaneFile = open("cuttingPlane"+str(self.fileName), "w") cuttingPlaneFile.write("/*--------------------------------*-C++-*------------------------------*\\") cuttingPlaneFile.write("\n| ========== | |") cuttingPlaneFile.write("\n| \\\\ / F ield | OpenFoam: The Open Source CFD Tooolbox |") cuttingPlaneFile.write("\n| \\\\ / O peration | Version: check the installation |") cuttingPlaneFile.write("\n| \\\\ / A nd | Website: www.openfoam.com |") cuttingPlaneFile.write("\n| \\\\/ M anipulation | |") cuttingPlaneFile.write("\n\\*---------------------------------------------------------------------*/") cuttingPlaneFile.write("\n\ncuttingPlane"+str(self.fileName)+"\n{") cuttingPlaneFile.write("\n type surfaces;") cuttingPlaneFile.write("\n libs (\"libsampling.so\");") cuttingPlaneFile.write("\n writeControl writeTime;") cuttingPlaneFile.write("\n surfaceFormat vtk;") cuttingPlaneFile.write("\n fields "+str(self.fields)+";") cuttingPlaneFile.write("\n interpolationScheme cellPoint;") cuttingPlaneFile.write("\n surfaces") cuttingPlaneFile.write("\n (") cuttingPlaneFile.write("\n "+str(self.planeName)) cuttingPlaneFile.write("\n {") cuttingPlaneFile.write("\n type cuttingPlane;") cuttingPlaneFile.write("\n planeType pointAndNormal;") cuttingPlaneFile.write("\n pointAndNormalDict") cuttingPlaneFile.write("\n {") cuttingPlaneFile.write("\n point "+str(self.point)+";") cuttingPlaneFile.write("\n normal "+str(self.normal)+";") cuttingPlaneFile.write("\n }") cuttingPlaneFile.write("\n interpolate true;") cuttingPlaneFile.write("\n }") cuttingPlaneFile.write("\n );") cuttingPlaneFile.write("\n}") cuttingPlaneFile.write("\n\n// ******************************************************************* //")
N_FEATURES = 5 def filter_on_geolocation(df_in, ne_lat, ne_lng, sw_lat, sw_lng): return df_in.loc[lambda df: (df["lat"] >= sw_lat) & (df["lat"] < ne_lat)].loc[ lambda df: (df["lng"] >= sw_lng) & (df["lng"] < ne_lng) ] def select_top_features(place_id, df_in, top_x=N_FEATURES): """ Selects top X features with the highes scores and returns them in a list. """ return df_in.loc[place_id].sort_values(ascending=False)[:top_x].index.tolist()
# Strings with apostrophes and new lines # If you want to include apostrophes in your string, # it's easiest to wrap it in double quotes. niceday = "It's a nice day!" print(niceday)
#encoding:utf-8 subreddit = 'chessmemes' t_channel = '@chessmemesenglish' def send_post(submission, r2t): return r2t.send_simple(submission)
# On the first line, you will be given a positive number, which will serve as a divisor. # On the second line, you will receive a positive number that will be the boundary. # You should find the largest integer N, that is: # • divisible by the given divisor # • less than or equal to the given bound # • greater than 0 # Note: it is guaranteed that N is found. div = int(input()) bound = int(input()) for i in reversed(range(bound)): if i == 0: break if ((i+1) % div) == 0: print(i+1) break
# Faça um programa que leia um número Inteiro qualquer e mostre na tela a sua tabuada. t = int(input('Digite um número para visualizar a tabuada: ')) cont = 1 while cont <= 10: print(f'{t} X {cont} = {t*cont}') cont += 1
def decodeRules(string): rules = [] # Remove comments while string.find('%') != -1: subStringBeforeComment = string[:string.find('%')] subStringAfterComment = string[string.find('%'):] if subStringAfterComment.find('\n') != -1: string = subStringBeforeComment + subStringAfterComment[subStringAfterComment.find('\n')+1:] else: string = subStringBeforeComment # Remove whitespaces and endlines string = "".join(string.split()) # Split in single rules while len(string) > 0: rule = "" if string.startswith(':~'): rule = string[:string.find(']')+1] string = string[string.find(']')+1:] else: posToCut = -1 posQMark = string.find('?') posDot = string.find('.') if posQMark != -1 and posDot != -1: if posQMark < posDot: posToCut = posQMark else: posToCut = posDot elif posDot != -1: posToCut = posDot elif posQMark != -1: posToCut = posQMark else: posToCut = len(string)-1 rule = string[:posToCut+1] string = string[posToCut+1:] #print(rule) if len(rule) > 0: rules.append(rule) return sorted(rules) def checker(actualOutput, actualError): global output expectedRules = decodeRules(output) actualRules = decodeRules(actualOutput) #print(expectedRules) #print(actualRules) if expectedRules != actualRules: reportFailure(expectedRules, actualRules) else: reportSuccess(expectedRules, actualRules)
lists = ['dwq', 'bql', 'xx', 'txo'] inquier = {'bql': 'java', 'xx': 'xx', 'dwq': 'java'} for ren in lists : for name in inquier.keys(): if ren == str(name): print ("thank you " + ren) break else: print ("you hava a inquire " + ren) break #注意循环的中断的位置,怪事,有个值没取到 #遍历字典的逻辑问题? 未解决
APPLICATION_ID = "vvMc0yrmqU1kbU2nOieYTQGV0QzzfVQg4kHhQWWL" REST_API_KEY = "waZK2MtE4TMszpU0mYSbkB9VmgLdLxfYf8XCuN7D" MASTER_KEY = "YPyRj37OFlUjHmmpE8YY3pfbZs7FqnBngxX4tezk" TWILIO_SID = "AC5e947e28bfef48a9859c33fec7278ee8" TWILIO_AUTH_TOKEN = "02c707399042a867303928beb261e990"
#Assume hot dogs come in packages of 10, and hot dog buns come in packages of 8. hotdogs_perpack = 10 hotdogs_bunsperpack = 8 #program should ask the user for the number of people attending the cookout and the number of hot dogs each person will be given. ppl_attending = int(input('Enter the number of people attending the cookout: ')) hotdogs_pp = int(input('Enter the number of hot dogs for each person: ')) #calculations hotdog_total = ppl_attending * hotdogs_pp hotdog_packs_needed = hotdog_total / hotdogs_perpack hotdog_bun_packs_needed = hotdog_total / hotdogs_bunsperpack hotdogs_leftover = hotdog_total / hotdogs_perpack hotdog_buns_leftover = hotdog_total / hotdogs_bunsperpack if hotdogs_leftover: hotdog_packs_needed += 1 hotdogs_leftover = hotdogs_perpack - hotdogs_leftover if hotdog_buns_leftover: hotdog_bun_packs_needed += 1 hotdog_buns_leftover = hotdogs_bunsperpack - hotdog_buns_leftover #The minimum number of packages of hot dogs required print('Minimum packages of hot dogs needed: ', hotdog_packs_needed) #The minimum number of packages of hot dog buns required print('Minimum packages of hot dog buns needed: ', hotdog_bun_packs_needed) #The number of hot dogs that will be left over print('Hot dogs left over: ', hotdogs_leftover) #The number of hot dog buns that will be left over print('Hot dog buns left over: ', hotdog_buns_leftover)
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'solo-tests.db', } } INSTALLED_APPS = ( 'solo', 'solo.tests', ) SECRET_KEY = 'any-key' CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': '127.0.0.1:11211', }, } SOLO_CACHE = 'default'
#Author : 5hifaT #Github : https://github.com/jspw #Gists : https://gist.github.com/jspw #linkedin : https://www.linkedin.com/in/mehedi-hasan-shifat-2b10a4172/ #Stackoverflow : https://stackoverflow.com/story/jspw #Dev community : https://dev.to/mhshifat def binary_search(ar, value): start = 0 end = len(ar)-1 while(start <= end): mid = (start+end)//2 # print("start : {},end : {},mid {}".format(start, end, mid), end=" ") if(ar[mid] == value): return mid if(ar[mid] > value): end = mid-1 else: start = mid+1 return -1 def main(): for _ in range(int(input())): l = list(map(int,input().split())) value = int(input()) check = False for i in range(0,len(l)) : if l[i] == value: print("{} found at {}".format(value,i),end="\n") check=True if(check == False): print("{} not found".format(value),end="\n") if __name__ == "__main__": main()
###exercicio 76 produtos = ('lapis', 1.5, 'borracha', 2.00, 'caderno', 15.00, 'livro', 50.00, 'mochila', 75.00) print ('='*60) print ('{:^60}'.format('Lista de produtos')) print ('='*60) for c in range (0, len(produtos), 2): print ('{:<50}R$ {:>7}'.format(produtos[c], produtos[c+1])) print ('-'*60)
# Programacion orientada a objetos (POO o OOP) # Definir una clase (molde para crear mas objetos de ese tipo) # (Coche) con caracteristicas similares class Coche: # Atributos o propiedades (variables) # caracteristicas del coche color = "Rojo" marca = "Ferrari" modelo = "Aventador" velocidad = 300 caballaje = 500 plazas = 2 # Metodos, son acciones que hace el objeto (coche) (Conocidas como funciones) def setColor(self, color): self.color = color def getColor(self): return self.color def setModelo(self, modelo): self.modelo = modelo def getModelo(self): return self.modelo def acelerar(self): self.velocidad += 1 def frenar(self): self.velocidad -= 1 def getVelocidad(self): return self.velocidad # fin definicion clase # Crear objeto // Instanciar clase coche = Coche() coche.setColor("Amarillo") coche.setModelo("Murcielago") print("COCHE 1:") print(coche.marca, coche.getModelo(), coche.getColor() ) print("Velocidad actual: ", coche.getVelocidad() ) coche.acelerar() coche.acelerar() coche.acelerar() coche.acelerar() coche.frenar() print("Velocidad nueva: ", coche.velocidad ) # Crear mas objetos. coche2 = Coche() coche2.setColor("Verde") coche2.setModelo("Gallardo") print("------------------------------") print("COCHE 2:") print(coche2.marca, coche2.getModelo(), coche2.getColor() ) print("Velocidad actual: ", coche2.getVelocidad() ) print(type(coche2))
class Solution: def calculate(self, s: str) -> int: stacks = [[0, 1]] val = "" sign = 1 for i, ch in enumerate(s): if ch == ' ': continue if ch == '(': stacks[-1][-1] = sign stacks.append([0, 1]) sign = 1 elif ch in "+-": if val: stacks[-1][0] += sign * int(val) val = "" sign = 1 if ch == '+' else -1 elif ch == ')': if val: stacks[-1][0] += sign * int(val) val = "" sign = 1 top = stacks.pop()[0] stacks[-1][0] += stacks[-1][1] * top else: val += ch if val: stacks[-1][0] += sign * int(val) return stacks[-1][0]
class Solution(object): def frequencySort(self, s): """ :type s: str :rtype: str """ freq = dict() for char in s: if char in freq: freq[char] += 1 else: freq[char] = 1 sortedList = sorted(freq.items(),key = lambda x: x[1],reverse=True) return "".join(x[0]*x[1] for x in sortedList)
# -*- coding: utf-8 -*- urls = ( "/", "Home", )
#!/usr/bin/env python3 BUS = 'http://m.bus.go.kr/mBus/bus/' SUBWAY = 'http://m.bus.go.kr/mBus/subway/' PATH = 'http://m.bus.go.kr/mBus/path/' all_bus_routes = BUS + 'getBusRouteList.bms' bus_route_search = all_bus_routes + '?strSrch={0}' bus_route_by_id = BUS + 'getRouteInfo.bms?busRouteId={0}' all_low_bus_routes = BUS + 'getLowBusRoute.bms' low_bus_route_search = all_low_bus_routes + 'strSrch={0}' all_night_bus_routes = BUS + 'getNBusRoute.bms' night_bus_route_search = all_night_bus_routes + 'strSrch={0}' all_airport_bus_routes = BUS + 'getAirBusRoute.bms' bus_routes_by_type = BUS + 'getRttpRoute.bms?strSrch={0}&stRttp={1}' route_path_by_id = BUS + 'getRoutePath.bms?busRouteId={0}' route_path_detailed_by_id = BUS + 'getStaionByRoute.bms?busRouteId={0}' route_path_realtime_by_id = BUS + 'getRttpRouteAndPos.bms?busRouteId={0}' low_route_path_realtime_by_id = BUS + 'getLowRouteAndPos.bms?busRouteId={0}' bus_arrival_info_by_route = BUS + 'getArrInfoByRouteAll.bms?busRouteId={0}' bus_arrival_info_by_route_and_station = BUS + 'getArrInfoByRoute.bms?busRouteId={0}&stId={1}&ord=1' bus_stations_by_position = BUS + 'getStationByPos.bms?tmX={0}&tmY={1}&radius={2}' routes_by_position = BUS + 'getNearRouteByPos.bms?tmX={0}&tmY={1}&radius={2}' bus_stations_by_name = BUS + 'getStationByName.bms?stSrch={0}' low_bus_stations_by_name = BUS + 'getLowStationByName.bms?stSrch={0}' routes_by_bus_station = BUS + 'getRouteByStation.bms?arsId={0}' arrival_info_by_bus_station = BUS + 'getStationByUid.bms?arsId{0}' low_arrival_info_by_bus_station = BUS + 'getLowStationByUid.bms?arsId{0}' operating_times_by_bus_station_and_route = BUS + 'getBustimeByStation.bms?arsId={0}&busRouteId={1}' bus_position_by_route = BUS + 'getBusPosByRtid.bms?busRouteId={0}' low_bus_position_by_route = BUS + 'getLowBusPosByRtid.bms?busRouteId={0}' bus_position_by_id = BUS + 'getBusPosByVehId.bms?vehId={0}' closest_station_by_position = PATH + 'getNearStationByPos.bms?tmX={0}&tmY={1}&radius={2}' location_by_name = PATH + 'getLocationInfo.bms?stSrch={0}' path_by_bus = PATH + 'getPathInfoByBus.bms?startX={0}&startY={1}&endX={2}&endY={3}' path_by_subway = PATH + 'getPathInfoBySubway.bms?startX={0}&startY={1}&endX={2}&endY={3}' path_by_bus_and_subway = PATH + 'getPathInfoByBusNSub.bms?startX={0}&startY={1}&endX={2}&endY={3}' all_subway_stations = SUBWAY + 'getStatnByNm.bms' subway_stations_by_name = all_subway_stations + '?statnNm={0}' subway_stations_by_route = SUBWAY + 'getStatnByRoute.bms?subwayId={0}' subway_arrival_info_by_route_and_station = SUBWAY + 'getArvlByInfo.bms?subwayId={0}&statnId={1}' subway_station_by_route_and_id = SUBWAY + 'getStatnById.bms?subwayId={0}&statnId={1}' subway_timetable_by_route_and_station = SUBWAY + 'getPlanyByStatn.bms?subwayId={0}&statnId={1}&tabType={2}' first_and_last_subway_by_route_and_station = SUBWAY + 'getLastcarByStatn.bms?subwayId={0}&statnId={1}' bus_stations_by_subway_station = SUBWAY + 'getBusByStation.bms?statnId={0}' subway_entrance_info_by_station = SUBWAY + 'getEntrcByInfo.bms?statnId={0}' subway_station_position_by_id = SUBWAY + 'getStatnByIdPos.bms?statnId={0}' train_info_by_subway_route_and_station = SUBWAY + 'getStatnTrainInfo.bms?subwayId={0}&statnId={1}'
def config_record_on_account(request,account_id): pass def config_record_on_channel(request, channel_id): pass
def gen_primes(): current_number = 2 primes = [] while True: is_prime = True for prime in primes: if prime*prime > current_number: ## This is saying it's a prime if prime * prime > current_testing_number # print("Caught here") break # I'd love to see the original proof to this if current_number % prime == 0: # if divisable by a known prime, then it's not a prime is_prime = False break if is_prime: primes.append(current_number) yield current_number current_number += 1 # primes: 2, 3, 5, 7, 11 # not p : 4, 6, 8, 9, 10 x = 2 for p in gen_primes(): if x > 10001: print(p) break x += 1
# coding=utf-8 """ Filename: introduction Author: Tanyee Date: 2020/3/25 Original: https://docs.python.org/3.7/tutorial/index.html Description: A brief introduction to the main content of this getting started tutorial. """ """ Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. ## Python是一种易于学习又功能强大的编程语言。 它提供了高效的高层次的数据结构,还有简单有效的面向对象编程。 Python优雅的语法和动态类型,以及解释型语言的本质,使它成为在很多领域多数平台上写脚本和快速开发应用的理想语言。## [[ Python是一门简单易学且功能强大的编程语言。 它有着高效的高级数据结构和简单而有效的实现面向对象编程的方法。 Python的优雅语法和动态类型以及自然的解释, 使它成为编写脚本以及在大多数平台上快速开发应用的理想语言。]] """ """ The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, https://www.python.org/, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation. ## 多数平台上的 Python 解释器以及丰富的标准库的源码和可执行文件,都可以在 Python 官网 https://www.python.org/ 免费自由地下载并分享。 这个网站上也提供一些链接,包括第三方 Python 模块、程序、工具等,以及额外的文档。## [[ Python解释器和大量的标准库以源代码或二进制的形式对所有主流的平台都免费提供,网址是https://www.python.org/,而且可以免费发布。 这个网站也包括了许多免费第三方Python模块,程序,工具和附加的文档。]] """ """ The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications. ## Python解释器易于扩展,可以使用C或C++(或者其他可以从C调用的语言)扩展新的功能和数据类型。Python也可用作可定制化软件中的扩展程序语言。## [[ Python解释器易于用C或者C++的新的方法和数据类型做扩展(或者通过C调用的别的语言)。Python也适于作为一种扩展语言用在定制的应用程序中。]] """ """ This tutorial introduces the reader informally to the basic concepts and features of the Python language and system. It helps to have a Python interpreter handy for hands-on experience, but all examples are self-contained, so the tutorial can be read off-line as well. ## 这个教程非正式地介绍Python语言和系统的基本概念和功能。最好在阅读的时候有一个 Python 解释器做一些练习, 不过所有的例子都是相互独立的,所以这个教程也可以离线阅读。## [[ 这个教程为读者通俗地介绍了Python语言的基本概念和特色。它有助于用手上的Python解释器亲自动手体验一番,而且所有的例子 都包含在内,所以这个教程也可以线下阅读。]] """ """ For a description of standard objects and modules, see The Python Standard Library. The Python Language Reference gives a more formal definition of the language. To write extensions in C or C++, read Extending and Embedding the Python Interpreter and Python/C API Reference Manual. There are also several books covering Python in depth. ## 有关标准的对象和模块,参阅Python标准库。Python语言参考提供了更正式的语言定义。要写C或者C++扩展, 参考扩展和嵌入Python解释器和Python/C API参考手册。也有不少书籍深入讲解 Python。## [[ 对于标准的对象和模块,去看Python标准库。Python语言索引给出了语言更多的正式的定义。用C或C++来写扩展库时, 去读扩展和嵌入Python解释器和Python/C的API索引手册。同样有一些深度解析Python的书。]] """ """ This tutorial does not attempt to be comprehensive and cover every single feature, or even every commonly used feature. Instead, it introduces many of Python’s most noteworthy features, and will give you a good idea of the language’s flavor and style. After reading it, you will be able to read and write Python modules and programs, and you will be ready to learn more about the various Python library modules described in The Python Standard Library. ## 这个教程并不试图完整包含每一个功能,甚至常用功能可能也没有全部涉及。这个教程只介绍 Python 中最值得注意的功能,也会让你体会到这个语言的风格特色。 学习完这个教程,你将能够阅读和编写 Python 模块和程序,也可以开始学习更多的 Python 库模块,详见 Python 标准库。## [[ 这个教程不会试图理解和覆盖每一个单独的特点,以及甚至每一个通常用到的特点。但是,它介绍了Python最值得注意的许多特点,而且将让你很好地思考 这门语言的风格和偏好。阅读完毕之后,你将可以读写Python的模块和程序,然后你就可以准备学习用Python标准库所描述的更多的Python模块。]] """ """ [VOCABULARY] elegant: 高雅的;优雅的 extensive: 广泛的;广大的 suitable: 合适的 hands-on: 亲自动手的 self-contained: 独立的 manual: 手工的;手册 noteworthy: 值得注意的;显著的 flavor and style: 风格特色 """
def isPrime(x): for i in range(2,x): if x%i == 0: return False return True def findPrime(beginning, finish): for j in range(beginning,finish): if isPrime(j): return j def encrypt(): print("Provide two integers") x = int(input()) y = int(input()) prime1 = findPrime(x,y) print("Provide two more integers") x = int(input()) y = int(input()) prime2 = findPrime(x,y) return prime1*prime2 print(encrypt(), encrypt()) # print("What is the number?") # x=int(input()) # if isPrime(x): # print(f"The number {x} is prime!") # else: # print("The number was not prime!")
'''import math n = float(input('Digite um nº: ')) print('O valor digitado foi {}, tendo sua parte inteira {}, e decimal {:.3f}'.format(n,math.trunc(n), n - math.trunc(n)))''' '''from math import trunc n = float(input('Digite um nº: ')) print('O valor digitado foi {}, tendo sua parte inteira {}, e decimal {:.3f}'.format(n, trunc(n), n - trunc(n)))''' n = float(input('Digite um nº: ')) print('O valor digitado foi {}, tendo sua parte inteira {}'.format(n, int(n)))
# Gegeven zijn twee lijsten: lijst1 en lijst2 # Zoek alle elementen die beide lijsten gemeenschappelijk hebben # Stop deze elementen in een nieuwe lijst # Print de lijst met gemeenschappelijke elementen lijst1 = [1, 45, 65, 24, 87, 45, 23, 24, 56] lijst2 = [10, 76, 34, 1, 56, 22, 33, 77, 1]
class iterator: def __init__(self,data): self.data=data self.index=-2 def __iter__(self): return self def __next__(self): if self.index>=len(self.data): raise StopIteration self.index+=2 return self.data[self.index] liczby=iterator([0,1,2,3,4,5,6,7]) print(next(liczby),end=', ') print(next(liczby),end=', ') print(next(liczby),end=', ') print(next(liczby))
vezes = int(input('quantos números vc quer digitar?: ')) todos_os_numeros = [] pares = [] impares = [] for c in range(vezes): valor = int(input('digite {}° número: '.format(c + 1))) todos_os_numeros.append(valor) print(f'valor é {valor}') if valor % 2 == 0: pares.append(valor) else: impares.append(valor) # if todos_os_numeros[0] % 2 == 0: # pares.append(todos_os_numeros[0]) # else: # impares.append(todos_os_numeros[0]) # if todos_os_numeros[1] % 2 == 0: # pares.append(todos_os_numeros[1]) # if todos_os_numeros[2] % 2 == 0: # pares.append(todos_os_numeros[2]) # if todos_os_numeros[3] % 2 == 0: # pares.append(todos_os_numeros[3]) # if todos_os_numeros[4] % 2 == 0: # pares.append(todos_os_numeros[4]) # # if not todos_os_numeros[1] % 2 == 0: # impares.append(todos_os_numeros[1]) # if not todos_os_numeros[2] % 2 == 0: # impares.append(todos_os_numeros[2]) # if not todos_os_numeros[3] % 2 == 0: # impares.append(todos_os_numeros[3]) # if not todos_os_numeros[4] % 2 == 0: # impares.append(todos_os_numeros[4]) print('esses foram os números digitados: {}'.format(todos_os_numeros)) print('esses foram os pares digitados: {} '.format(pares)) print('esses foram os ímpares digitados: {} '.format(impares))
class RemovedInWagtail21Warning(DeprecationWarning): pass removed_in_next_version_warning = RemovedInWagtail21Warning class RemovedInWagtail22Warning(PendingDeprecationWarning): pass
class ListNode(object): """ Definition fro singly-linked list. """ def __init__(self, val=0, next=None) -> None: self.val = val self.next = next
""" # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children """ class Solution: def postorder(self, root: 'Node') -> List[int]: if root == None: return [] res = [] for index in range(len(root.children)): res += self.postorder(root.children[index]) res += [root.val] return res
arr = list(map(int, input().split())) n = int(input()) for i in range(len(arr)): one = arr[i] for j in range(i+1,len(arr)): two = arr[j] s = one + two if s == n: print(f'{one} {two}')
""" # 以下方法都可以从网页中提取出'你好,蜘蛛侠!'这段文字 find_element_by_tag_name:通过元素的名称选择 # 如<h1>你好,蜘蛛侠!</h1> # 可以使用find_element_by_tag_name('h1') find_element_by_class_name:通过元素的class属性选择 # 如<h1 class="title">你好,蜘蛛侠!</h1> # 可以使用find_element_by_class_name('title') find_element_by_id:通过元素的id选择 # 如<h1 id="title">你好,蜘蛛侠!</h1> # 可以使用find_element_by_id('title') find_element_by_name:通过元素的name属性选择 # 如<h1 name="hello">你好,蜘蛛侠!</h1> # 可以使用find_element_by_name('hello') # 以下两个方法可以提取出超链接 find_element_by_link_text:通过链接文本获取超链接 # 如<a href="spidermen.html">你好,蜘蛛侠!</a> # 可以使用find_element_by_link_text('你好,蜘蛛侠!') find_element_by_partial_link_text:通过链接的部分文本获取超链接 # 如<a href="https://localprod.pandateacher.com/python-manuscript/hello-spiderman/">你好,蜘蛛侠!</a> # 可以使用find_element_by_partial_link_text('你好') """
""" Error Message for REST API """ CUSTOM_VISION_ACCESS_ERROR = \ ('Training key or Endpoint is invalid. Please change the settings') CUSTOM_VISION_MISSING_FIELD = \ ('Either Namespace or Key is missing or incorrect. Please check again')
def format(string): ''' Formats the docstring. ''' # reStructuredText formatting? # Remove all \n and replace all spaces with a single space string = ' '.join(list(filter(None, string.replace('\n', ' ').split(' ')))) return string class DocString: def __init__(self, string): self.string = format(string) def __str__(self): return self.string def __add__(self, other): return str(self) + other def __radd__(self, other): return other + str(self)
class Solution: def longestCommonPrefix(self, strs): if strs == []: return "" ans = "" for i, ch in enumerate(strs[0]): # iterate over the characters of first word for j, s in enumerate(strs): # iterate over the list of words if i >= len(strs[j]) or ch != s[i]: # IF the first word is longer return ans # OR the characters do not match return answer string ans += ch # ELSE add the current character to answer return ans # all words are identical or longer than first obj = Solution() l = ["flower","flow","flight", "flipped"] print("List of Words: {}" .format(l)) print("Answer: {}" .format(obj.longestCommonPrefix(l)))
# ---------------- User Configuration Settings for speed-cam.py --------------------------------- # Ver 8.4 speed-cam.py webcam720 Stream Variable Configuration Settings ####################################### # speed-cam.py plugin settings ####################################### # Calibration Settings # =================== cal_obj_px = 310 # Length of a calibration object in pixels cal_obj_mm = 4330.0 # Length of the calibration object in millimetres # Motion Event Settings # --------------------- MIN_AREA = 100 # Default= 100 Exclude all contours less than or equal to this sq-px Area x_diff_max = 200 # Default= 200 Exclude if max px away >= last motion event x pos x_diff_min = 1 # Default= 1 Exclude if min px away <= last event x pos track_timeout = 0.0 # Default= 0.0 Optional seconds to wait after track End (Avoid dual tracking) event_timeout = 0.4 # Default= 0.4 seconds to wait for next motion event before starting new track log_data_to_CSV = True # Default= True True= Save log data as CSV comma separated values # Camera Settings # --------------- WEBCAM = True # Default= False False=PiCamera True=USB WebCamera # Web Camera Settings # ------------------- WEBCAM_SRC = 0 # Default= 0 USB opencv connection number WEBCAM_WIDTH = 1280 # Default= 1280 USB Webcam Image width WEBCAM_HEIGHT = 720 # Default= 720 USB Webcam Image height # Camera Image Settings # --------------------- image_font_size = 20 # Default= 20 Font text height in px for text on images image_bigger = 1 # Default= 1 Resize saved speed image by value # ---------------------------------------------- End of User Variables -----------------------------------------------------
def busca(lista, elemento): for i in range(len(lista)): if lista[i] == elemento: return i return False o = busca([0,7,8,5,10], 10) print(o)
gem3 = ( (79, ("ING")), ) gem2 = ( (5, ("TH")), (41, ("EO")), (79, ("NG")), (83, ("OE")), (101, ("AE")), (107, ("IA", "IO")), (109, ("EA")), ) gem = ( (2, ("F")), (3, ("U", "V")), (7, ("O")), (11, ("R")), (13, ("C", "K")), (17, ("G")), (19, ("W")), (23, ("H")), (29, ("N")), (31, ("I")), (37, ("J")), (43, ("P")), (47, ("X")), (53, ("S", "Z")), (59, ("T")), (61, ("B")), (67, ("E")), (71, ("M")), (73, ("L")), (89, ("D")), (97, ("A")), (103, ("Y")), ) def enc_2(c, arr): for g in arr: if c.upper() in g[1]: return g[0] def enc(s): sum = 0 i = 0 while i < len(s): if i < len(s) - 2: c = s[i] + s[i + 1] + s[i + 2] o = enc_2(c, gem3) if o > 0: print("{0}, {1}".format(c, o)) sum += o i += 3 continue if i < len(s) - 1: c = s[i] + s[i + 1] o = enc_2(c, gem2) if o > 0: print("{0}, {1}".format(c, o)) sum += o i += 2 continue o = enc_2(s[i], gem) if o > 0: print("{0}, {1}".format(s[i], o)) sum += o i += 1 return sum sum = 0 for line in ["Like the instar, tunneling to the surface", "We must shed our own circumferences;", "Find the divinity within and emerge." ]: o = enc(line) print(o) if sum == 0: sum = o else: sum *= o print(sum)
def part_1(data): blah = {'n': (0, 1), 'ne': (1, 0), 'se': (1, -1), 's': (0, -1), 'sw': (-1, 0), 'nw': (-1, 1)} x, y = 0, 0 for step in data.split(","): x, y = x + blah[step][0], y + blah[step][1] distance = (abs(x) + abs(y) + abs(-x-y)) // 2 return distance def part_2(data): blah = {'n': (0, 1), 'ne': (1, 0), 'se': (1, -1), 's': (0, -1), 'sw': (-1, 0), 'nw': (-1, 1)} x, y = 0, 0 max_distance = 0 for step in data.split(','): x, y = x + blah[step][0], y + blah[step][1] distance = (abs(x) + abs(y) + abs(-x-y)) // 2 max_distance = max(max_distance, distance) return max_distance if __name__ == '__main__': with open('day_11_input.txt') as f: inp = f.readlines()[0] print("Part 1 answer: " + str(part_1(inp))) print("Part 2 answer: " + str(part_2(inp)))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 18 12:00:00 2020 @author: divyanshvinayak """ for _ in range(int(input())): N, K = map(int, input().split()) A = list(map(int, input().split())) print(sum(A) % K)
'''Escreva um progrma que leia um n inteiro qualquer e mostra na tela os n primeiros elementos de uma sequencia de Fibonacci. Ex: 0 1 1 2 3 5 8''' n = int(input('Informe um número: ')) t1 = 0 t2 = 1 print('{} > {}'.format(t1, t2), end=' ') cont = 3 while cont <= n: t3 = t1 + t2 print(' > {}'.format(t3), end=' ') t1 = t2 t2 = t3 cont += 1 print('> FIM!')
# -*- coding: utf-8 -*- """ Global tables and re-usable fields """ # ============================================================================= # Representations for Auth Users & Groups def shn_user_represent(id): table = db.auth_user user = db(table.id == id).select(table.email, limitby=(0, 1), cache=(cache.ram, 10)).first() if user: return user.email return None def shn_role_represent(id): table = db.auth_group role = db(table.id == id).select(table.role, limitby=(0, 1), cache=(cache.ram, 10)).first() if role: return role.role return None # ============================================================================= # "Reusable" fields for table meta-data # ----------------------------------------------------------------------------- # Record identity meta-fields # Use URNs according to http://tools.ietf.org/html/rfc4122 s3uuid = SQLCustomType( type = "string", native = "VARCHAR(128)", encoder = (lambda x: "'%s'" % (uuid.uuid4().urn if x == "" else str(x).replace("'", "''"))), decoder = (lambda x: x) ) # Universally unique identifier for a record meta_uuid = S3ReusableField("uuid", type=s3uuid, length=128, notnull=True, unique=True, readable=False, writable=False, default="") # Master-Copy-Index (for Sync) meta_mci = S3ReusableField("mci", "integer", default=0, readable=False, writable=False) def s3_uid(): return (meta_uuid(), meta_mci()) # ----------------------------------------------------------------------------- # Record soft-deletion meta-fields # "Deleted"-flag meta_deletion_status = S3ReusableField("deleted", "boolean", readable=False, writable=False, default=False) # Parked foreign keys of a deleted record # => to be restored upon "un"-delete meta_deletion_fk = S3ReusableField("deleted_fk", #"text", readable=False, writable=False) def s3_deletion_status(): return (meta_deletion_status(), meta_deletion_fk()) # ----------------------------------------------------------------------------- # Record timestamp meta-fields meta_created_on = S3ReusableField("created_on", "datetime", readable=False, writable=False, default=request.utcnow) meta_modified_on = S3ReusableField("modified_on", "datetime", readable=False, writable=False, default=request.utcnow, update=request.utcnow) def s3_timestamp(): return (meta_created_on(), meta_modified_on()) # ----------------------------------------------------------------------------- # Record authorship meta-fields # Author of a record meta_created_by = S3ReusableField("created_by", db.auth_user, readable=False, # Enable when needed, not by default writable=False, requires=None, default=session.auth.user.id if auth.is_logged_in() else None, represent=lambda id: id and shn_user_represent(id) or UNKNOWN_OPT, ondelete="RESTRICT") # Last author of a record meta_modified_by = S3ReusableField("modified_by", db.auth_user, readable=False, # Enable when needed, not by default writable=False, requires=None, default=session.auth.user.id if auth.is_logged_in() else None, update=session.auth.user.id if auth.is_logged_in() else None, represent=lambda id: id and shn_user_represent(id) or UNKNOWN_OPT, ondelete="RESTRICT") def s3_authorstamp(): return (meta_created_by(), meta_modified_by()) # ----------------------------------------------------------------------------- # Record ownership meta-fields # Individual user who owns the record meta_owned_by_user = S3ReusableField("owned_by_user", db.auth_user, readable=False, # Enable when needed, not by default writable=False, requires=None, default=session.auth.user.id if auth.is_logged_in() else None, represent=lambda id: id and shn_user_represent(id) or UNKNOWN_OPT, ondelete="RESTRICT") # Role of users who collectively own the record meta_owned_by_role = S3ReusableField("owned_by_role", db.auth_group, readable=False, # Enable when needed, not by default writable=False, requires=None, default=None, represent=lambda id: id and shn_role_represent(id) or UNKNOWN_OPT, ondelete="RESTRICT") def s3_ownerstamp(): return (meta_owned_by_user(), meta_owned_by_role()) # ----------------------------------------------------------------------------- # Common meta-fields def s3_meta_fields(): fields = (meta_uuid(), meta_mci(), meta_deletion_status(), meta_deletion_fk(), meta_created_on(), meta_modified_on(), meta_created_by(), meta_modified_by(), meta_owned_by_user(), meta_owned_by_role()) return fields # ============================================================================= # Reusable roles fields for map layer permissions management (GIS) role_required = S3ReusableField("role_required", db.auth_group, sortby="role", requires = IS_NULL_OR(IS_ONE_OF(db, "auth_group.id", "%(role)s", zero=T("Public"))), widget = S3AutocompleteWidget(request, "auth", "group", fieldname="role"), represent = lambda id: shn_role_represent(id), label = T("Role Required"), comment = DIV(_class="tooltip", _title=T("Role Required") + "|" + T("If this record should be restricted then select which role is required to access the record here.")), ondelete = "RESTRICT") roles_permitted = S3ReusableField("roles_permitted", db.auth_group, sortby="role", requires = IS_NULL_OR(IS_ONE_OF(db, "auth_group.id", "%(role)s", multiple=True)), # @ToDo #widget = S3CheckboxesWidget(db, # lookup_table_name = "auth_group", # lookup_field_name = "role", # multiple = True), represent = lambda id: shn_role_represent(id), label = T("Roles Permitted"), comment = DIV(_class="tooltip", _title=T("Roles Permitted") + "|" + T("If this record should be restricted then select which role(s) are permitted to access the record here.")), ondelete = "RESTRICT") # ============================================================================= # Other reusable fields # ----------------------------------------------------------------------------- # comments field to include in other table definitions comments = S3ReusableField("comments", "text", label = T("Comments"), comment = DIV(_class="tooltip", _title=T("Comments") + "|" + T("Please use this field to record any additional information, including a history of the record if it is updated."))) # ----------------------------------------------------------------------------- # Reusable currency field to include in other table definitions currency_type_opts = { 1:T("Dollars"), 2:T("Euros"), 3:T("Pounds") } currency_type = S3ReusableField("currency_type", "integer", notnull=True, requires = IS_IN_SET(currency_type_opts, zero=None), #default = 1, label = T("Currency"), represent = lambda opt: \ currency_type_opts.get(opt, UNKNOWN_OPT)) # ============================================================================= # Default CRUD strings ADD_RECORD = T("Add Record") LIST_RECORDS = T("List Records") s3.crud_strings = Storage( title_create = ADD_RECORD, title_display = T("Record Details"), title_list = LIST_RECORDS, title_update = T("Edit Record"), title_search = T("Search Records"), subtitle_create = T("Add New Record"), subtitle_list = T("Available Records"), label_list_button = LIST_RECORDS, label_create_button = ADD_RECORD, label_delete_button = T("Delete Record"), msg_record_created = T("Record added"), msg_record_modified = T("Record updated"), msg_record_deleted = T("Record deleted"), msg_list_empty = T("No Records currently available"), msg_no_match = T("No Records matching the query")) # ============================================================================= # Common tables # ----------------------------------------------------------------------------- # Theme module = "admin" resource = "theme" tablename = "%s_%s" % (module, resource) table = db.define_table(tablename, Field("name"), Field("logo"), Field("header_background"), Field("col_background"), Field("col_txt"), Field("col_txt_background"), Field("col_txt_border"), Field("col_txt_underline"), Field("col_menu"), Field("col_highlight"), Field("col_input"), Field("col_border_btn_out"), Field("col_border_btn_in"), Field("col_btn_hover"), migrate=migrate) table.name.requires = [IS_NOT_EMPTY(), IS_NOT_ONE_OF(db, "%s.name" % tablename)] table.col_background.requires = IS_HTML_COLOUR() table.col_txt.requires = IS_HTML_COLOUR() table.col_txt_background.requires = IS_HTML_COLOUR() table.col_txt_border.requires = IS_HTML_COLOUR() table.col_txt_underline.requires = IS_HTML_COLOUR() table.col_menu.requires = IS_HTML_COLOUR() table.col_highlight.requires = IS_HTML_COLOUR() table.col_input.requires = IS_HTML_COLOUR() table.col_border_btn_out.requires = IS_HTML_COLOUR() table.col_border_btn_in.requires = IS_HTML_COLOUR() table.col_btn_hover.requires = IS_HTML_COLOUR() # ----------------------------------------------------------------------------- # Settings - systemwide module = "s3" s3_setting_security_policy_opts = { 1:T("simple"), 2:T("editor"), 3:T("full") } # @ToDo Move these to deployment_settings resource = "setting" tablename = "%s_%s" % (module, resource) table = db.define_table(tablename, meta_uuid(), Field("admin_name"), Field("admin_email"), Field("admin_tel"), Field("theme", db.admin_theme), migrate=migrate, *s3_timestamp()) table.theme.requires = IS_IN_DB(db, "admin_theme.id", "admin_theme.name", zero=None) table.theme.represent = lambda name: db(db.admin_theme.id == name).select(db.admin_theme.name, limitby=(0, 1)).first().name # Define CRUD strings (NB These apply to all Modules' "settings" too) ADD_SETTING = T("Add Setting") LIST_SETTINGS = T("List Settings") s3.crud_strings[resource] = Storage( title_create = ADD_SETTING, title_display = T("Setting Details"), title_list = LIST_SETTINGS, title_update = T("Edit Setting"), title_search = T("Search Settings"), subtitle_create = T("Add New Setting"), subtitle_list = T("Settings"), label_list_button = LIST_SETTINGS, label_create_button = ADD_SETTING, msg_record_created = T("Setting added"), msg_record_modified = T("Setting updated"), msg_record_deleted = T("Setting deleted"), msg_list_empty = T("No Settings currently defined")) # =============================================================================
#!/bin/zsh class Person: def __init__(self, name, age): mysillyobject.name = name mysillyobject.age = age def myfunc(abc): print("Hello my name is " + abc.name) p1 = Person("John", 36) p1.myfunc()
class SmRestartEnum(basestring): """ always|never|default Possible values: <ul> <li> "always" , <li> "never" , <li> "default" </ul> """ @staticmethod def get_api_name(): return "sm-restart-enum"
def TrimmedMean(UpCoverage): nonzero_count = 0 for i in range(1,50): if (UpCoverage[-i]>0): nonzero_count += 1 total = 0 count=0 for cov in UpCoverage: if(cov>0): total += cov count += 1 trimMean = 0 if nonzero_count > 0 and count >20: #if count >20: trimMean = total/count; return trimMean
N = int(input()) gradeReal = list(map(int, input().split())) M = max(gradeReal) gradeNew = 0 for i in gradeReal: gradeNew += (i / M * 100) print(gradeNew / N)
# -*- coding: utf-8 -*- """Entry point for the Nessie Airflow provider. Contains important descriptions for registering to Airflow """ __version__ = "0.1.2" def get_provider_info() -> dict: """Hook for Airflow.""" return { "package-name": "airflow-provider-nessie", "name": "Nessie Airflow Provider", "description": "An Airflow provider for Project Nessie", "hook-class-names": ["airflow_provider_nessie.hooks.nessie_hook.NessieHook"], "versions": [__version__], }
var = 's' while var != 'n': temperatura = float(input('Informe a temperatura em °C: ')) far = 9/5*temperatura+32 print('A temperatura de {:.1f}°C corresponde a {:.1f}°F'.format(temperatura, far)) var = input('Deseja continunar (s/n)? ')
universalSet={23,32,12,45,56,67,7,89,80,96} subSetList=[{23,32,12,45},{32,12,45,56},{56,67,7,89},{80,96},{12,45,56,67,7,89},{7,89,80,96},{89,80,96}] def getMinSubSetList(universalSet,subSetList): SetDs=[[i,len(i)] for i in subSetList] tempSet=set() setList=[] while(len(universalSet)!=0): print("\n++++++++++++++++++++++++++++++++\n") SetDs=sorted(SetDs,key=lambda x :x[1]) print("@@@@@@\n",SetDs,"\n@@@@@@@@@@@@|\n") tmpSet=SetDs.pop()[0] print(tmpSet) setList.append(tmpSet) tempSet=tempSet.union(tmpSet) print(tempSet) universalSet.difference_update(tempSet) SetDsi=SetDs SetDs=[] for elem in SetDsi: tmp=len(elem[0])-len(elem[0].intersection(tempSet)) print("#############\n",elem[0],tempSet,elem[1],tmp,universalSet,"\n############") SetDs.append([elem[0],tmp]) print("\n########DSI\n",SetDs,"\n########\n") return setList print(getMinSubSetList(universalSet,subSetList))
class RMCError(Exception): def __init__(self, message): Exception.__init__(self, message) self.__line_number=None def set_line_number(self, new_line_number): self.__line_number=new_line_number def get_line_number(self): return self.__line_number #operations throws RMCError if not successful #throws also for +1, +2 and so on (but also -1) def asNonnegInt(literal, must_be_positive=False, lit_name="unknown"): condition="positive" if must_be_positive else "nonnegative" if not literal.isdigit(): raise RMCError(lit_name+" must be a "+condition+" integer, found "+literal) res=int(literal) if must_be_positive and res==0: raise RMCError(lit_name+" must be a "+condition+" integer, found "+literal) return res
TO_BIN = {'0': '0000', '1': '0001', '2': '0010', '3': '0011', '4': '0100', '5': '0101', '6': '0110', '7': '0111', '8': '1000', '9': '1001', 'a': '1010', 'b': '1011', 'c': '1100', 'd': '1101', 'e': '1110', 'f': '1111'} TO_HEX = {v: k for k, v in TO_BIN.iteritems()} def hex_to_bin(hex_string): return ''.join(TO_BIN[a] for a in hex_string.lower()).lstrip('0') or '0' # return '{:b}'.format(int(hex_string, 16)) def bin_to_hex(binary_string): length = len(binary_string) q, r = divmod(length, 4) if r > 0: length = 4 * (q + 1) binary_string = binary_string.zfill(length) return ''.join(TO_HEX[binary_string[a:a + 4]] for a in xrange(0, length, 4)).lstrip('0') or '0' # return '{:x}'.format(int(binary_string, 2))
def table(positionsList): print("\n\t Tic-Tac-Toe") print("\t~~~~~~~~~~~~~~~~~") print("\t|| {} || {} || {} ||".format(positionsList[0], positionsList[1], positionsList[2])) print("\t|| {} || {} || {} ||".format(positionsList[3], positionsList[4], positionsList[5])) print("\t|| {} || {} || {} ||".format(positionsList[6], positionsList[7], positionsList[8])) print("\t~~~~~~~~~~~~~~~~~") def playerMove(playerLetter, positionsList): while True: playerPos = int(input("{}: Where would you like to place your piece (1-9): ".format(playerLetter))) if playerPos > 0 and playerPos < 10: if positionsList[playerPos - 1] == "_": return playerPos else: print("That position is already chosen. Try another spot.") else: print("That is not a right option. Try a number between (1-9).") def placePlayerTable(playerLetter, playerPos, positionsList): positionsList[playerPos - 1] = playerLetter def winner(pLet, posList): return ((posList[0] == pLet and posList[1] == pLet and posList[2] == pLet) or (posList[3] == pLet and posList[4] == pLet and posList[5] == pLet) or (posList[6] == pLet and posList[7] == pLet and posList[8] == pLet) or (posList[0] == pLet and posList[3] == pLet and posList[6] == pLet) or (posList[1] == pLet and posList[4] == pLet and posList[7] == pLet) or (posList[2] == pLet and posList[5] == pLet and posList[8] == pLet) or (posList[0] == pLet and posList[4] == pLet and posList[8] == pLet) or (posList[2] == pLet and posList[4] == pLet and posList[6] == pLet)) listGame = ["_"]*9 exampleTab = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] player1 = "X" player2 = "O" table(exampleTab) table(listGame) while True: #player 1 move = playerMove(player1, listGame) placePlayerTable(player1, move, listGame) table(exampleTab) table(listGame) if winner(player1, listGame): print("Player 1 wins!") break elif "_" not in listGame: print("Was a tie!") break #player 2 move = playerMove(player2, listGame) placePlayerTable(player2, move, listGame) table(exampleTab) table(listGame) if winner(player2, listGame): print("Player 2 wins!") break
def Spline(*points): assert len(points) >= 2 return _SplineEval(points, _SplineNormal(points)) def Spline1(points, s0, sn): assert len(points) >= 2 points = tuple(points) s0 = float(s0) sn = float(sn) return _SplineEval(points, _SplineFirstDeriv(points, s0, sn)) def _IPolyMult(prod, poly): if not prod: return if not poly: prod[:] = [] return for i in xrange(len(poly)-1): prod.append(0) for i in xrange(len(prod)-1, -1, -1): for j in xrange(len(poly)): if j == 0: prod[i] = poly[j]*prod[i] elif i >= j: prod[i] += poly[j]*prod[i-j] def _IPolyAdd(sum, poly): for i in xrange(len(poly)): if i == len(sum): sum.append(poly[i]) else: sum[i] += poly[i] def _PolyCompose(f, g): sum = [] for i in xrange(len(f) - 1, -1, -1): _IPolyMult(sum, g) _IPolyAdd(sum, [f[i]]) return sum def _PolyEval(f, x): sum = 0 for i in xrange(len(f) - 1, -1, -1): sum = sum*x + f[i] return sum def _IPoly3Fit(poly3, x, y): actual = _PolyEval(poly3, x) poly3[3] = float(y - actual) / x**3 def _Poly3Shift(poly3, x): result = _PolyCompose(poly3, [x, 1.0]) result[3] = 0.0 return result def _Spline(points, x, x2): assert points cubic = [float(points[0][1]), x, x2, 0.0] result = [] for i in xrange(len(points)-1): xdiff = float(points[i+1][0]-points[i][0]) _IPoly3Fit(cubic, xdiff, float(points[i+1][1])) result.append(cubic) cubic = _Poly3Shift(cubic, xdiff) result.append(cubic) return result def _SplineNormal(points): splines0 = _Spline(points, 0.0, 0.0) splines1 = _Spline(points, 1.0, 0.0) plen = len(points) end2nd0 = splines0[plen-1][2] end2nd1 = splines1[plen-1][2] start1st = -end2nd0 / (end2nd1-end2nd0) return _Spline(points, start1st, 0.0) def _SplineFirstDeriv(points, s0, sn): splines0 = _Spline(points, s0, 0.0) splines1 = _Spline(points, s0, 1.0) plen = len(points) end1st0 = splines0[plen-1][1] end1st1 = splines1[plen-1][1] start2nd = (sn - end1st0) / (end1st1 - end1st0) return _Spline(points, s0, start2nd) class _SplineEval(object): def __init__(self, points, splines): self._points = points self._splines = splines def __call__(self, x): plen = len(self._points) assert x >= self._points[0][0] assert x <= self._points[plen-1][0] first = 0 last = plen-1 while first + 1 < last: mid = (first + last) / 2 if x >= self._points[mid][0]: first = mid else: last = mid return _PolyEval(self._splines[first], x - self._points[first][0])
def find_missing_number(c): b = max(c) d = min(c + [0]) if min(c) == 1 else min(c) v = set(range(d, b)) - set(c) return list(v)[0] if v != set() else None print(find_missing_number([1, 3, 2, 4])) print(find_missing_number([0, 2, 3, 4, 5])) print(find_missing_number([9, 7, 5, 8]))
load("@bazel_skylib//lib:dicts.bzl", "dicts") # load("//ocaml:providers.bzl", "CcDepsProvider") load("//ocaml/_functions:module_naming.bzl", "file_to_lib_name") ## see: https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/common/cc/cc_import.bzl ## does this still apply? # "Library outputs of cc_library shouldn't be relied on, and should be considered as a implementation detail and are toolchain dependent (e.g. if you're using gold linker, we don't produce .a libs at all and use lib-groups instead, also linkstatic=0 on cc_test is something that might change in the future). Ideally you should wait for cc_shared_library (https://docs.google.com/document/d/1d4SPgVX-OTCiEK_l24DNWiFlT14XS5ZxD7XhttFbvrI/edit#heading=h.jwrigiapdkr2) or use cc_binary(name="libfoo.so", linkshared=1) with the hack you mentioned in the meantime. The actual location of shared library dependencies should be available from Skyalrk. Eventually." ## src: https://github.com/bazelbuild/bazel/issues/4218 ## DefaultInfo.files will be empty for cc_import deps, so in ## that case use CcInfo. ## For cc_library, DefaultInfo.files will contain the ## generated files (usually .a, .so, unless linkstatic is set) ## At the end we'll have one CcInfo whose entire depset will go ## on cmd line. This includes indirect deps like the .a files ## in @//ocaml/csdk and @rules_ocaml//cfg/lib/ctypes. ######################### def dump_library_to_link(ctx, idx, lib): print(" alwayslink[{i}]: {al}".format(i=idx, al = lib.alwayslink)) flds = ["static_library", "pic_static_library", "interface_library", "dynamic_library",] for fld in flds: if hasattr(lib, fld): if getattr(lib, fld): print(" lib[{i}].{f}: {p}".format( i=idx, f=fld, p=getattr(lib,fld).path)) else: print(" lib[{i}].{f} == None".format(i=idx, f=fld)) # if lib.dynamic_library: # print(" lib[{i}].dynamic_library: {lib}".format( # i=idx, lib=lib.dynamic_library.path)) # else: # print(" lib[{i}].dynamic_library == None".format(i=idx)) ######################### def dump_CcInfo(ctx, cc_info): # dep): # print("DUMP_CCINFO for %s" % ctx.label) # print("CcInfo dep: {d}".format(d = dep)) # dfiles = dep[DefaultInfo].files.to_list() # if len(dfiles) > 0: # for f in dfiles: # print(" %s" % f) ## ASSUMPTION: all files in DefaultInfo are also in CcInfo # print("dep[CcInfo].linking_context:") # cc_info = dep[CcInfo] compilation_ctx = cc_info.compilation_context linking_ctx = cc_info.linking_context linker_inputs = linking_ctx.linker_inputs.to_list() # print("linker_inputs count: %s" % len(linker_inputs)) lidx = 0 for linput in linker_inputs: # print(" linker_input[{i}]".format(i=lidx)) # print(" linkflags[{i}]: {f}".format(i=lidx, f= linput.user_link_flags)) libs = linput.libraries # print(" libs count: %s" % len(libs)) if len(libs) > 0: i = 0 for lib in linput.libraries: dump_library_to_link(ctx, i, lib) i = i+1 lidx = lidx + 1 # else: # for dep in dfiles: # print(" Default f: %s" % dep) ################################################################ ## to be called from {ocaml,ppx}_executable ## tasks: ## - construct args ## - construct inputs_depset ## - extract runfiles def link_ccdeps(ctx, default_linkmode, # platform default args, ccInfo): # print("link_ccdeps %s" % ctx.label) inputs_list = [] runfiles = [] compilation_ctx = ccInfo.compilation_context linking_ctx = ccInfo.linking_context linker_inputs = linking_ctx.linker_inputs.to_list() for linput in linker_inputs: libs = linput.libraries if len(libs) > 0: for lib in libs: if lib.pic_static_library: inputs_list.append(lib.pic_static_library) args.add(lib.pic_static_library.path) if lib.static_library: inputs_list.append(lib.static_library) args.add(lib.static_library.path) if lib.dynamic_library: inputs_list.append(lib.dynamic_library) args.add("-ccopt", "-L" + lib.dynamic_library.dirname) args.add("-cclib", lib.dynamic_library.path) return [inputs_list, runfiles] ################################################################ def x(ctx, cc_deps_dict, default_linkmode, args, includes, cclib_deps, cc_runfiles): dfiles = dep[DefaultInfo].files.to_list() # print("dep[DefaultInfo].files count: %s" % len(dfiles)) if len(dfiles) > 0: for f in dfiles: print(" %s" % f) # print("dep[CcInfo].linking_context:") cc_info = dep[CcInfo] compilation_ctx = cc_info.compilation_context linking_ctx = cc_info.linking_context linker_inputs = linking_ctx.linker_inputs.to_list() # print("linker_inputs count: %s" % len(linker_inputs)) # for linput in linker_inputs: # print("NEW LINKER_INPUT") # print(" LINKFLAGS: %s" % linput.user_link_flags) # print(" LINKLIB[0]: %s" % linput.libraries[0].static_library.path) ## ?filter on prefix for e.g. csdk: example/ocaml # for lib in linput.libraries: # print(" LINKLIB: %s" % lib.static_library.path) # else: # for dep in dfiles: # print(" Default f: %s" % dep) ## FIXME: static v. dynamic linking of cc libs in bytecode mode # see https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#ss%3Adynlink-c-code # default linkmode for toolchain is determined by platform # see @rules_ocaml//cfg/toolchain:BUILD.bazel, ocaml/_toolchains/*.bzl # dynamic linking does not currently work on the mac - ocamlrun # wants a file named 'dllfoo.so', which rust cannot produce. to # support this we would need to rename the file using install_name_tool # for macos linkmode is dynamic, so we need to override this for bytecode mode debug = False # if ctx.attr._rule == "ocaml_executable": # debug = True if debug: print("EXEC _handle_cc_deps %s" % ctx.label) print("CC_DEPS_DICT: %s" % cc_deps_dict) # first dedup ccdeps = {} for ccdict in cclib_deps: for [dep, linkmode] in ccdict.items(): if dep in ccdeps.keys(): if debug: print("CCDEP DUP? %s" % dep) else: ccdeps.update({dep: linkmode}) for [dep, linkmode] in cc_deps_dict.items(): if debug: print("CCLIB DEP: ") print(dep) if linkmode == "default": if debug: print("DEFAULT LINKMODE: %s" % default_linkmode) for depfile in dep.files.to_list(): if default_linkmode == "static": if (depfile.extension == "a"): args.add(depfile) cclib_deps.append(depfile) includes.append(depfile.dirname) else: for depfile in dep.files.to_list(): if (depfile.extension == "so"): libname = file_to_lib_name(depfile) args.add("-ccopt", "-L" + depfile.dirname) args.add("-cclib", "-l" + libname) cclib_deps.append(depfile) elif (depfile.extension == "dylib"): libname = file_to_lib_name(depfile) args.add("-cclib", "-l" + libname) args.add("-ccopt", "-L" + depfile.dirname) cclib_deps.append(depfile) cc_runfiles.append(dep.files) elif linkmode == "static": if debug: print("STATIC lib: %s:" % dep) for depfile in dep.files.to_list(): if (depfile.extension == "a"): args.add(depfile) cclib_deps.append(depfile) includes.append(depfile.dirname) elif linkmode == "static-linkall": if debug: print("STATIC LINKALL lib: %s:" % dep) for depfile in dep.files.to_list(): if (depfile.extension == "a"): cclib_deps.append(depfile) includes.append(depfile.dirname) if ctx.toolchains["@rules_ocaml//ocaml:toolchain"].cc_toolchain == "clang": args.add("-ccopt", "-Wl,-force_load,{path}".format(path = depfile.path)) elif ctx.toolchains["@rules_ocaml//ocaml:toolchain"].cc_toolchain == "gcc": libname = file_to_lib_name(depfile) args.add("-ccopt", "-L{dir}".format(dir=depfile.dirname)) args.add("-ccopt", "-Wl,--push-state,-whole-archive") args.add("-ccopt", "-l{lib}".format(lib=libname)) args.add("-ccopt", "-Wl,--pop-state") else: fail("NO CC") elif linkmode == "dynamic": if debug: print("DYNAMIC lib: %s" % dep) for depfile in dep.files.to_list(): if (depfile.extension == "so"): libname = file_to_lib_name(depfile) print("so LIBNAME: %s" % libname) args.add("-ccopt", "-L" + depfile.dirname) args.add("-cclib", "-l" + libname) cclib_deps.append(depfile) elif (depfile.extension == "dylib"): libname = file_to_lib_name(depfile) print("LIBNAME: %s:" % libname) args.add("-cclib", "-l" + libname) args.add("-ccopt", "-L" + depfile.dirname) cclib_deps.append(depfile) cc_runfiles.append(dep.files) ################################################################ ## returns: ## depset to be added to action_inputs ## updated args ## a CcDepsProvider containing cclibs dictionary {dep: linkmode} ## a depset containing ccdeps files, for OutputGroups ## FIXME: what about cc_runfiles? # def handle_ccdeps(ctx, # # for_pack, # default_linkmode, # in # # cc_deps_dict, ## list of dicts # args, ## in/out # # includes, # # cclib_deps, # # cc_runfiles): # ): # debug = False # ## steps: # ## 1. accumulate all ccdep dictionaries = direct + indirect # ## a. remove duplicate dict entries? # ## 2. construct action_inputs list # ## 3. derive cmd line args # ## 4. construct CcDepsProvider # # 1. accumulate # # a. direct cc deps # direct_ccdeps_maps_list = [] # if hasattr(ctx.attr, "cc_deps"): # direct_ccdeps_maps_list = [ctx.attr.cc_deps] # ## FIXME: ctx.attr._cc_deps is a label_flag attr, cannot be a dict # # all_ccdeps_maps_list.update(ctx.attr._cc_deps) # # print("CCDEPS DIRECT: %s" % direct_ccdeps_maps_list) # # b. indirect cc deps # all_deps = [] # if hasattr(ctx.attr, "deps"): # all_deps.extend(ctx.attr.deps) # if hasattr(ctx.attr, "_deps"): # all_deps.append(ctx.attr._deps) # if hasattr(ctx.attr, "deps_deferred"): # all_deps.extend(ctx.attr.deps_deferred) # if hasattr(ctx.attr, "sig"): # all_deps.append(ctx.attr.sig) # ## for ocaml_library # if hasattr(ctx.attr, "modules"): # all_deps.extend(ctx.attr.modules) # ## for ocaml_ns_library # if hasattr(ctx.attr, "submodules"): # all_deps.extend(ctx.attr.submodules) # ## [ocaml/ppx]_executable # if hasattr(ctx.attr, "main"): # all_deps.append(ctx.attr.main) # indirect_ccdeps_maps_list = [] # for dep in all_deps: # if None == dep: continue # e.g. attr.sig may be missing # if CcDepsProvider in dep: # if dep[CcDepsProvider].ccdeps_map: # skip empty maps # indirect_ccdeps_maps_list.append(dep[CcDepsProvider].ccdeps_map) # # print("CCDEPS INDIRECT: %s" % indirect_ccdeps_maps_list) # ## depsets cannot contain dictionaries so we use a list # all_ccdeps_maps_list = direct_ccdeps_maps_list + indirect_ccdeps_maps_list # ## now merge the maps and remove duplicate entries # all_ccdeps_map = {} # merged ccdeps maps # for ccdeps_map in all_ccdeps_maps_list: # # print("CCDEPS_MAP ITEM: %s" % ccdeps_map) # for [ccdep, cclinkmode] in ccdeps_map.items(): # if ccdep in all_ccdeps_map: # if cclinkmode == all_ccdeps_map[ccdep]: # ## duplicate # # print("Removing duplicate ccdep: {k}: {v}".format( # # k = ccdep, v = cclinkmode # # )) # continue # else: # # duplicate key, different linkmode # fail("CCDEP: duplicate dep {dep} with different linkmodes: {lm1}, {lm2}".format( # dep = dep, # lm1 = all_ccdeps_map[ccdep], # lm2 = cclinkmode # )) # else: # ## accum # all_ccdeps_map.update({ccdep: cclinkmode}) # ## end: accumulate # # print("ALLCCDEPS: %s" % all_ccdeps_map) # # print("ALLCCDEPS KEYS: %s" % all_ccdeps_map.keys()) # # 2. derive action inputs # action_inputs_ccdep_filelist = [] # for tgt in all_ccdeps_map.keys(): # action_inputs_ccdep_filelist.extend(tgt.files.to_list()) # # print("ACTION_INPUTS_ccdep_filelist: %s" % action_inputs_ccdep_filelist) # ## 3. derive cmd line args # ## FIXME: static v. dynamic linking of cc libs in bytecode mode # # see https://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#ss%3Adynlink-c-code # # default linkmode for toolchain is determined by platform # # see @rules_ocaml//cfg/toolchain:BUILD.bazel, ocaml/_toolchains/*.bzl # # dynamic linking does not currently work on the mac - ocamlrun # # wants a file named 'dllfoo.so', which rust cannot produce. to # # support this we would need to rename the file using install_name_tool # # for macos linkmode is dynamic, so we need to override this for bytecode mode # cc_runfiles = [] # FIXME? # debug = True # ## FIXME: always pass -fvisibility=hidden? see https://stackoverflow.com/questions/9894961/strange-warnings-from-the-linker-ld # for [dep, linkmode] in all_ccdeps_map.items(): # if debug: # print("CCLIB DEP: ") # print(dep) # for f in dep.files.to_list(): # print(" f: %s" % f) # if CcInfo in dep: # print(" CcInfo: %s" % dep[CcInfo]) # if linkmode == "default": # if debug: print("DEFAULT LINKMODE: %s" % default_linkmode) # for depfile in dep.files.to_list(): # if default_linkmode == "static": # if (depfile.extension == "a"): # args.add(depfile) # # cclib_deps.append(depfile) # # includes.append(depfile.dirname) # else: # for depfile in dep.files.to_list(): # if debug: # print("DEPFILE dir: %s" % depfile.dirname) # print("DEPFILE path: %s" % depfile.path) # if (depfile.extension == "so"): # libname = file_to_lib_name(depfile) # args.add("-ccopt", "-L" + depfile.dirname) # args.add("-cclib", "-l" + libname) # # cclib_deps.append(depfile) # elif (depfile.extension == "dylib"): # libname = file_to_lib_name(depfile) # args.add("-cclib", "-l" + libname) # args.add("-ccopt", "-L" + depfile.dirname) # # cclib_deps.append(depfile) # cc_runfiles.append(dep.files) # elif linkmode == "static": # if debug: # print("STATIC LINK: %s:" % dep) # lctx = dep[CcInfo].linking_context # for linputs in lctx.linker_inputs.to_list(): # for lib in linputs.libraries: # print(" LINKLIB: %s" % lib.static_library) # for depfile in dep.files.to_list(): # if debug: # print(" LIB: %s" % depfile) # fail("xxxx") # if (depfile.extension == "a"): # # for .a files we do not need --cclib etc. just # # add directly to command line: # args.add(depfile) # elif linkmode == "static-linkall": # if debug: # print("STATIC LINKALL lib: %s:" % dep) # for depfile in dep.files.to_list(): # if (depfile.extension == "a"): # # cclib_deps.append(depfile) # # includes.append(depfile.dirname) # if ctx.toolchains["@rules_ocaml//ocaml:toolchain"].cc_toolchain == "clang": # args.add("-ccopt", "-Wl,-force_load,{path}".format(path = depfile.path)) # elif ctx.toolchains["@rules_ocaml//ocaml:toolchain"].cc_toolchain == "gcc": # libname = file_to_lib_name(depfile) # args.add("-ccopt", "-L{dir}".format(dir=depfile.dirname)) # args.add("-ccopt", "-Wl,--push-state,-whole-archive") # args.add("-ccopt", "-l{lib}".format(lib=libname)) # args.add("-ccopt", "-Wl,--pop-state") # else: # fail("NO CC") # elif linkmode == "dynamic": # if debug: # print("DYNAMIC lib: %s" % dep) # for depfile in dep.files.to_list(): # if (depfile.extension == "so"): # libname = file_to_lib_name(depfile) # if debug: # print("so LIBNAME: %s" % libname) # print("so dir: %s" % depfile.dirname) # args.add("-ccopt", "-L" + depfile.dirname) # args.add("-cclib", "-l" + libname) # # cclib_deps.append(depfile) # elif (depfile.extension == "dylib"): # libname = file_to_lib_name(depfile) # if debug: # print("LIBNAME: %s:" % libname) # args.add("-cclib", "-l" + libname) # args.add("-ccopt", "-L" + depfile.dirname) # # cclib_deps.append(depfile) # cc_runfiles.append(dep.files) # ## end: derive cmd options # ## now derive CcDepsProvider: # # for OutputGroups: use action_inputs_ccdep_filelist # ccDepsProvider = CcDepsProvider( # ccdeps_map = all_ccdeps_map # ) # return [action_inputs_ccdep_filelist, ccDepsProvider]
''' Python中Exception的处理 例子:输入一个数字并进行除法运算 异常1:不是数字 异常2:不能除0 其他异常:结束 finally:必须执行 ''' while True: try: number =int(input("what's your fav number hoss?\n")) print(10/number) break except ValueError: print("Make sure and enter a number.") except ZeroDivisionError: print("Don't pick zero") except: break finally: print("loop complete")
''' Created on Jan 22, 2013 @author: sesuskic ''' __all__ = ["ch_flt"] def ch_flt(filter_k): chflt_coe_list = { 1 : [-3, -4, 1, 15, 30, 27, -4, -55, -87, -49, 81, 271, 442, 511], # 305k BW (decim-8*3) original PRO2 # 1: [13 17 -8 -15 14 20 -27 -23 48 27 -94 -29 303 511 ]'; # 464k BW (decim-8*3, fil-1) for EZR2 tracking # 1: [9 -6 -26 -35 -13 29 50 13 -64 -101 -15 192 415 511]'; # 378k BW (decim-8*3, fil-3) for EZR2 tracking # 1: [-16 -9 8 34 51 38 -9 -69 -96 -44 95 284 447 511 ]'; # 302k BW (decim-8*3, fil-5) for EZR2 tracking 2 : [ 0, 3, 12, 22, 23, 5, -34, -72, -75, -11, 127, 304, 452, 511], 3 : [ 4, 10, 17, 18, 5, -22, -55, -71, -47, 33, 160, 304, 417, 460], 4 : [ 3, 7, 8, 2, -14, -37, -57, -56, -18, 63, 175, 294, 385, 418], 5 : [ 3, 3, 0, -10, -26, -42, -50, -35, 11, 88, 186, 283, 356, 382], 6 : [ 1, -2, -9, -20, -33, -42, -37, -12, 37, 109, 192, 271, 327, 347], 7 : [-3, -10, -19, -29, -36, -36, -20, 12, 63, 127, 195, 256, 299, 313], 8 : [-5, -10, -18, -24, -26, -20, -1, 33, 80, 136, 194, 244, 279, 291], 9 : [-4, -8, -14, -17, -17, -8, 11, 43, 85, 134, 185, 228, 257, 268], 10 : [-4, -7, -10, -12, -9, 1, 21, 51, 89, 134, 177, 215, 240, 249], 11 : [-3, -6, -7, -7, -2, 10, 30, 58, 93, 132, 170, 202, 223, 231], #11: [2 13 26 50 83 126 179 240 304 367 424 469 498 508 ]'; # for ETSI class-1 169MHz 12.5k channel 12 : [-3, -3, -3, -1, 6, 19, 39, 65, 97, 130, 163, 190, 208, 214], 13 : [-2, -1, 0, 5, 14, 27, 47, 71, 99, 128, 156, 178, 193, 198], 14 : [-1, 2, 5, 2, 22, 37, 55, 77, 101, 125, 147, 165, 176, 180], 15 : [ 2, 6, 11, 20, 31, 46, 63, 82, 102, 121, 138, 151, 160, 162] } return [x+2**10 for x in chflt_coe_list.get(filter_k, chflt_coe_list[1])][::-1]
N = int(input()) A = [0] + [int(a) for a in input().split()] B = [0] + [int(a) for a in input().split()] C = [0] + [int(a) for a in input().split()] previous = -1 satisfaction = 0 for a in A[1:]: satisfaction += B[a] if previous == a-1: satisfaction += C[a-1] previous = a print(satisfaction)
#!/usr/bin/python # Filename: ex_for_before.py print('Hello') print('Hello') print('Hello') print('Hello') print('Hello')
class InvalidDataDirectory(Exception): """ Error raised when the chosen intput directory for the dataset is not valid. """
#Este programa tem a função de mostrar a mensagem "alo mundo na tela". """ Assim se faz um comentário em várias linhas. Pode-se usar aspas simples ou duplas! """ print("Alô mundo na tela");
""" 0340. Longest Substring with At Most K Distinct Characters Medium Given a string s and an integer k, return the length of the longest substring of s that contains at most k distinct characters. Example 1: Input: s = "eceba", k = 2 Output: 3 Explanation: The substring is "ece" with length 3. Example 2: Input: s = "aa", k = 1 Output: 2 Explanation: The substring is "aa" with length 2. Constraints: 1 <= s.length <= 5 * 104 0 <= k <= 50 """ class Solution: def lengthOfLongestSubstringKDistinct(self, s: str, k: int) -> int: d = {} low, res = 0, 0 for i, c in enumerate(s): d[c] = i if len(d) > k: low = min(d.values()) del d[s[low]] low += 1 res = max(i - low + 1, res) return res
print('-' * 20) print(' LOJA SUPER BARATÃO') print('-' * 20) totpreço = prod1000 = menor = cont = 0 barato = '' while True: produto = str(input('Nome do produto: ')) preço = float(input('Preço: R$ ')) cont += 1 totpreço += preço if preço > 1000: prod1000 += 1 if cont == 1 or preço < menor: menor = preço barato = produto continuar = ' ' while continuar not in 'SN': continuar = str(input('Quer continuar? [S/N] ')).upper()[0].strip() if continuar == 'N': break print('-' * 20, 'FIM DO PROGRAMA', '-' * 20) print(f'O total de compra foi R${totpreço:.2f}') print(f'Temos {prod1000} produtos custando mais de R$1000.00') print(f'O produto mais barato foi {barato} que custa R${menor:.2f}')
# Exercício Python 093: # Crie um programa que gerencie o aproveitamento de um jogador de futebol. # O programa vai ler o nome do jogador e quantas partidas ele jogou. # Depois vai ler a quantidade de gols feitos em cada partida. # No final, tudo isso será guardado em um dicionário, incluindo o total de gols feitos durante o campeonato. dados = dict() dados['nome'] = str(input('Nome do Jogador: ')) par = int(input(f'Quantas partidas {dados["nome"]} jogou? ')) gols = list() for i in range(0, par): gols.append(int(input(f' Quantos gols na partida {i}? '))) dados['gols'] = gols[:] dados['total'] = sum(gols) print('-=' * 30) print(dados) print('-=' * 30) for k, v in dados.items(): print(f'O campo {k} tem o valor {v}') print('-=' * 30) print(f'O jogador {dados["nome"]} jogou {len(dados["gols"])}.') for i, v in enumerate(dados["gols"]): print(f' => Na partida {i}, fez {v} gols.') print(f'Foi um total de {dados["total"]} gols.')
"""from kivy.app import App from kivy.uix.scrollview import ScrollView from kivy.uix.label import Label from kivy.uix.boxlayout import BoxLayout class Tarefas(ScrollView): def __init__(self, tarefas, **kwargs): super().__init__(**kwargs) for tarefa in tarefas: self.ids.box.add_widget(Label(text=tarefa, font_size=30)) class Application(App): def build(self): return Tarefas(['fazer compras', 'buscar crianças', 'lavar louça', 'correr', 'brincar']) from kivy.app import App from kivy.uix.scrollview import ScrollView from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from ControleDeVeiculos import ControleDeVeiculos controle = ControleDeVeiculos() class Prinpcipal(ScrollView): def __init__(self, veiculos, **kwargs): super().__init__(**kwargs) sair = Button(text='Sair.') add_carro = Button(text='Adicionar carro') self.ids.topo.add_widget(sair) self.ids.topo.add_widget(add_carro) if(veiculos == []): for carro in veiculos: self.ids.carros.add_widget(Button(text=carro.__str__())) class Application(App): def build(self): return Prinpcipal(controle.veiculos, orientation='horizontal') app = Application app.run() """
class Solution: def smallestRange(self, nums: List[List[int]]) -> List[int]: lo, hi = -100000, 100000 pq = [(lst[0], i, 1) for i, lst in enumerate(nums)] heapq.heapify(pq) right = max(lst[0] for lst in nums) while len(pq) == len(nums): mn, idx, nxt = heapq.heappop(pq) if right - mn < hi - lo: lo = mn hi = right if nxt < len(nums[idx]): right = max(right, nums[idx][nxt]) heapq.heappush(pq, (nums[idx][nxt], idx, nxt + 1)) return [lo, hi]
def snail(arr): """ Inspired by a solution on Codewars by MMMAAANNN """ matrix = list(arr) result = [] while matrix: result.extend(matrix.pop(0)) matrix = zip(*matrix) matrix.reverse() return result
# Copyright (C) 2021 Anthony Harrison # SPDX-License-Identifier: MIT VERSION: str = "0.1"
''' File: structures.py Description: Defines the structures used by socket handler Date: 26/09/2017 Author: Saurabh Badhwar <[email protected]> ''' class ClientList(object): """ClientList structure. Used for holding the connected clients list The general structure looks like: client_list: {'topic': [clients]} """ client_list = {} #Initialize the client list def __init__(self): """ClientList constructor Initializes the ClientList for use in the socket handler """ self.topic_count = 0 self.error_count = 0 def add_topic(self, topic): """Add a new topic to the client list Keyword arguments: topic -- the topic to be added to the client list Returns: count The number of keys in list """ if topic in self.client_list.keys(): return self.topic_count self.client_list[topic] = [] self.topic_count = len(self.client_list) return self.topic_count def add_client(self, topic, client): """Add a new client to the client list Keyword arguments: topic -- The topic to which the client should be added client -- The callable socket object for the client Returns: True on success False on Failure """ if topic not in self.client_list.keys(): self.add_topic(topic) if client in self.client_list[topic]: return False self.client_list[topic].append(client) return True def get_topics(self): """Get the list of topics Returns: List of topics """ return self.client_list.keys() def get_clients(self, topic): """Return the list of clients associated with the provided topic Keyword arguments: topic -- The topic for which to return the client list Returns: list on Success False on Failure """ if topic not in self.client_list.keys(): return False return self.client_list[topic] def is_topic(self, topic): """Check if a topic is present in the client list or not Keyword arguments: topic -- The topic to be checked for presence Returns: Bool """ if topic in self.client_list.keys(): return True return False def remove_client(self, client, topic=''): """Remove the provided client from the client list If the topic is not provided, client will be removed from all the topics it is present in. Keyword arguments: topic -- The topic to be searched for the client (Default: '') client -- The client to be removed Return: True """ if topic == '': for t in self.client_list: if client in self.client_list[t]: self.client_list[t].remove(client) else: self.client_list[topic].remove(client) return True def remove_topic(self, topic, force=False): """Removes the mentioned topics from the client list Removes the topics from the client list if the client list for that topic is empty. The optional force parameter if set to true will cause the topic to be removed even if the client list contains clients subscribed to that topic. Keyword arguments: topic -- The topic to be removed force -- Force the removal of the topic (Default: False) Raises: RuntimeError if the user tries to remove a topic which has active clients Returns: True """ if topic in self.client_list.keys(): if len(self.client_list[topic]) != 0 and force==False: raise RuntimeError("Can't remove a topic with active clients") else: del self.client_list[topic] return True
# coding: utf-8 """ Created on 30.07.2018 :author: Polianok Bogdan """ class Item: """ Class represented Item object in skyskanner website response """ def __init__(self, jsonItem): self.agent_id = jsonItem['agent_id'] self.url = jsonItem['url'] self.transfer_protection = jsonItem['transfer_protection']
NEGATIVE_CONSTRUCTS = set([ "ain't", "can't", "cannot" "don't" "isn't" "mustn't", "needn't", "neither", "never", "no", "nobody", "none", "nothing", "nowhere" "shan't", "shouldn't", "wasn't" "weren't", "won't" ]) URLS = r'(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+' \ '[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+' \ '[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]\.' \ '[^\s]{2,}|www\.[a-zA-Z0-9]\.[^\s]{2,})' POSITIVE_EMOTICONS = set([ ':-)', ':)', ':-]', ':-3', ':3', ':^)', '8-)', '8)', '=]', '=)', ':-D', ':D', ':-))' ]) NEGATIVE_EMOTICONS = set([ ':-(', ':(', ':-c', ':c', ':<', ':[', ':''-(', ':-[', ':-||', '>:[', ':{', '>:(', ':-|', ':|', ':/', ':-/', ':\'', '>:/', ':S' ])
class Configuration: port = 5672 security_mechanisms = 'PLAIN' version_major = 0 version_minor = 9 amqp_version = (0, 0, 9, 1) secure_response = '' client_properties = {'client': 'amqpsfw:0.1'} server_properties = {'server': 'amqpsfw:0.1'} secure_challenge = 'tratata'
#Faça um programa que leia nome e peso de várias pessoas, guardando tudo em uma lista. # No final, mostre: #A) Quantas pessoas foram cadastradas. #B) Uma listagem com as pessoas mais pesadas. #C) Uma listagem com as pessoas mais leves. lista = [] pessoas = [] maior = menor = 0 opc = '' while True: pessoas.append(str(input('Nome: '))) pessoas.append(float(input('Peso: '))) if len(lista) == 0: maior = menor = pessoas[1] else: if pessoas[1] > maior: maior = pessoas[1] if pessoas [1] < menor: menor = pessoas[1] lista.append(pessoas[:]) pessoas.clear() opc = str(input('Quer continuar: [S/N]: ')).upper().strip() if opc == 'N': break while opc not in 'SN': print('Opção inválida') opc = str(input('Quer continuar: [S/N]: ')).upper().strip() if opc == 'N': break print(f'O total de pessoas cadastradas são: {len(lista)}') print(f'o maior peso foi de {maior} kg de : ' , end='') for p in lista: if p[1] == maior: print(f'{p[0]}',end=' ') print() print(f'O menor peso foi de {menor}kg de: ', end='') for p in lista: if p[1] == menor: print(f'{p[0]}', end=' ') print()
class TrieNode: def __init__(self): self.flag = False self.children = {} class Trie(object): def __init__(self): """ Initialize your data structure here. """ self.root = TrieNode() def insert(self, word): """ Inserts a word into the trie. :type word: str :rtype: None """ current = self.root for character in word: if character not in current.children: current.children[character] = TrieNode() current = current.children[character] current.flag = True def search(self, word): """ Returns if the word is in the trie. :type word: str :rtype: bool """ result, node = self.childSearch(word) if result: return node.flag return False def startsWith(self, prefix): """ Returns if there is any word in the trie that starts with the given prefix. :type prefix: str :rtype: bool """ result, node = self.childSearch(prefix) return result def childSearch(self, word): current = self.root for character in word: if character in current.children: current = current.children[character] else: return False, None return True, current # Your Trie object will be instantiated and called as such: # obj = Trie() # obj.insert(word) # param_2 = obj.search(word) # param_3 = obj.startsWith(prefix)
class Solution(object): def getRow(self, rowIndex): """ :type rowIndex: int :rtype: List[int] """ pascal_triangle = [None] * 2 for i in range(rowIndex + 1): row = [0] * (i + 1) row[0] = 1 row[-1] = 1 for j in range(1, len(row) - 1): row[j] = pascal_triangle[(i - 1) % 2][j - 1] + pascal_triangle[(i - 1) % 2][j] pascal_triangle[i % 2] = row return pascal_triangle[i % 2]
# -*- coding: utf-8 -*- class MissingSender(Exception): pass class WrongSenderSecret(Exception): pass class NotAllowed(Exception): pass class MissingProject(Exception): pass class MissingAction(Exception): pass
# O(j +d) Time and space def topologicalSort(jobs, deps): # We will use a class to define the graph: jobGraph = createJobGraph(jobs, deps) # Helper function: return getOrderedJobs(jobGraph) def getOrderedJobs(jobGraph): orderedJobs = [] # In this case, we need to take the nodes with NO prereqs nodesWithNoPrereqs = list(filter(lambda node: node.numbOfPrereqs == 0, jobGraph.nodes)) # so long as we have a list with elements of no prereqs, we append it directly to ordered jobs, # AND remove the deps while len(nodesWithNoPrereqs): node = nodesWithNoPrereqs.pop() orderedJobs.append(node.jobs) removeDeps(node, nodesWithNoPrereqs) # here, we know for a fact that we will have at least one node where the num of dependecies is zero # therefore if any of the nodes have a truthy value, return graphHasEdges = any(node.numbOfPrereqs for node in jobGraph.nodes) return [] if graphHasEdges else orderedJobs def removeDeps(node, nodesWithNoPrereqs): # remove the deps of the current node, since we are deleting it while len(node.deps): dep = node.deps.pop() # same technique; we pop the deps and do -1 to all of them until finished dep.numbOfPrereqs -= 1 if dep.numbOfPrereqs == 0: nodesWithNoPrereqs.append(dep) def createJobGraph(jobs, deps): # initialize graph with: list of JobNodes and a dictionary that maps the the jobNode with a job graph = JobGraph(jobs) # (x,y) -> y depends on x, so we use this approach now, and using the addDep the pre-reqs of x is +1 for job, deps in deps: #add a prereq in the job seen graph.addDep(job, deps) return graph class JobGraph: # IMPORTANT: Job is the element itself; the Node contains more info, such as prereqs, if visited or not, etc. def __init__(self,jobs): self.nodes = [] # will contain the graph itself, with the edges and dependencies self.graph = {} # will map values to other values, map jobs to their nodes # basically graph lists {1: <JobNode 1>, 2: <JobNode 2>,...} and node=[<JobNode 1>, <JobNode 2>...] for job in jobs: # for each job [1,2,...] we will add the nodes , which contains the info of the job and pre-requisites # from a JobNode object. self.addNode(job) def addNode(self, job): self.graph[job] = JobNode(job) self.nodes.append(self.graph[job]) def addDep(self, job, dep): # get the node from job; get the node that reference to the prereq and simply append the latter to the job prereq field. jobNode = self.getNode(job) depNode = self.getNode(dep) jobNode.deps.append(depNode) # include the new prereq number depNode.numbOfPrereqs += 1 def getNode(self, job): if job not in self.graph: self.addNode(job) # the method simply serves a lookup dictionary # and returns a JobNode object return self.graph[job] class JobNode: def __init__(self, job): self.jobs = job # now, we use dependencies instead of pre-reqs (is an inversion of what we had before) self.deps = [] # we define the number of pre-reqs of the current Node self.numbOfPrereqs = 0