content
stringlengths 7
1.05M
|
---|
"""
Common functions for protocols.
Protocols define, how the communication with a backend service works. They
usually come with a FactoryFromService class, that adapts the backend service
interface, and implements a factory interface.
"""
|
def generate_state(state, desired_len):
while len(state) < desired_len:
b = "".join(str((int(s) + 1) % 2) for s in reversed(state))
state = state + "0" + b
return state[:desired_len]
def checksum(state):
res = []
f = True
while f or len(state) % 2 == 0:
f = False
res = []
for i in range(len(state) // 2):
res.append(1 if state[i * 2] == state[i * 2 + 1] else 0)
state = res
return "".join(map(str, res))
if __name__ == '__main__':
print(checksum(generate_state("10111100110001111", 272)))
print(checksum(generate_state("10111100110001111", 35651584)))
|
SCHEDULE_NONE = None
SCHEDULE_HOURLY = '0 * * * *'
SCHEDULE_DAILY = '0 0 * * *'
SCHEDULE_WEEKLY = '0 0 * * 0'
SCHEDULE_MONTHLY = '0 0 1 * *'
SCHEDULE_YEARLY = '0 0 1 1 *'
|
l = [*map(int, input().split())]
r = 0
for i in l:
if i > 0:
r += 1
print(r)
|
class Carbure:
SUCCESS = "success"
ERROR = "error"
class CarbureError:
INVALID_REGISTRATION_FORM = "Invalid registration form"
INVALID_LOGIN_CREDENTIALS = "Invalid login or password"
ACCOUNT_NOT_ACTIVATED = "Account not activated"
OTP_EXPIRED_CODE = "OTP Code Expired"
OTP_INVALID_CODE = "OTP Code Invalid"
OTP_RATE_LIMITED = "OTP Rate Limited"
OTP_UNKNOWN_ERROR = "OTP Unknown Error"
OTP_INVALID_FORM = "OTP Invalid Form"
PASSWORD_RESET_USER_NOT_FOUND = "User not found"
PASSWORD_RESET_INVALID_FORM = "Password reset invalid form"
PASSWORD_RESET_MISMATCH = "Passwords do not match"
ACTIVATION_LINK_ERROR = "Could not send activation link"
ACTIVATION_LINK_INVALID_FORM = "Activation link invalid form"
ACTIVATION_COULD_NOT_ACTIVATE_USER = "Could not activate user account"
|
### Score - Linux
P1_Wins = 0
CPU_Wins = 0
Game_Draws = 0
|
# Merge Sort
'''
Divide and Conquer Algorithm
-> Divide: Divide equally until one element: each individual element is sorted
-> Conquer: Combine elements by comparing
'''
# Conquer
def merge(arr,low,mid,high):
# Create two arrays for two halves
n1 = mid - low + 1;
n2 = high - mid;
# Declaring empty arrays
Left = list()
Right = list()
for i in range(n1):
Left.append(0)
for j in range(n2):
Right.append(0)
# Creating left array
for i in range(0,n1):
Left[i] = arr[low+i]
# Creating right array
for j in range(0,n2):
Right[j] = arr[mid+1+j]
# Merging Both arrays
i=0
j=0
k=low
while (i<n1) and (j<n2):
if(Left[i]<=Right[j]):
arr[k]=Left[i]
i = i+i
else:
arr[k]=Right[j]
j = j+1
k=k+1
# Adding left over elements from both array if any
while(i<n1):
arr[k]=Left[i]
i=i+1
k=k+1
while(j<n2):
arr[k]=Right[j]
j=j+1
k=k+1
# Divide
def mergesort(array,low,high):
if(low<high):
mid = int((low+high)/2)
mergesort(array,low,mid)
mergesort(array,mid+1,high)
merge(array,low,mid,high)
# Driver Code
print("Enter Array as space separated values: ")
array = list(map(int,input().split(' ')))
high = len(array)-1
mergesort(array,0,high)
# Display Sorted Array
print(array)
|
class Solution:
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: bool
"""
# iterative
visited = [0] * (len(s) + 1)
stack = [0]
while stack:
cur = stack.pop()
print(cur)
if visited[cur] or cur > len(s) + 1:
continue
visited[cur] = 1
if cur == len(s):
return True
for w in wordDict:
if s[cur:].startswith(w):
stack.append(cur + len(w))
return False
# recursive
# ret = False
# visited = set()
# def traverse(pos):
# nonlocal wordDict, visited
# if pos in visited:
# return
# visited.add(pos)
# if pos == len(s):
# ret = True
# if pos >= len(s):
# return
# for w in wordDict:
# cur = s[pos:]
# if w in cur and cur.index(w) == 0:
# traverse(pos + len(w))
# traverse(0)
# return ret
|
casa = float(input('Qual é o Valor do imóvel desejado? R$ '))
salário = float(input('Qual é seu Salário Mensal? R$'))
anos = int(input('Em quantos anos de financiamento? '))
prestação = casa / (anos * 12)
mínimo = salário * 30 / 100
print('Para pagar uma casa de R${:.2f} em {} anos'.format(casa, anos), end='')
print(' a Prestação será de R${:.2f}'.format(prestação))
if prestação <= mínimo:
print('Empréstimo pode ser CONCEDIDO!')
else:
print('Empréstimo NEGADO!')
|
DEFAULT_EQUIPMENT = [
("Dumbbells","Generic dumbbells."),
("Barbell","Generic barbell with plate weights."),
("Squat Rack","Generic squat rack."),
("Leg Curl Machine","Generic machine to do leg curls on."),
("Leg Extension Machine","Generic machine to do leg extensions on."),
("Pull up bar","Generic horizontal bar to perform pull ups, chin ups, and other modified grip exercises."),
("Flat Bench","Generic horizontal bench that lies flat, can be adjustable."),
("Incline Bench","Generic weight bench that lies inclined, can be adjustable."),
("Upright Bench","Generic bench that sits at a 90 degree angle. Can be adjustable. Often used for seated military press."),
("Adjustable Bench","Generic weight bench that can have an adjustable angle."),
("Seated Cable Row Machine","Cabled machine for performing seated rows and other exercises."),
("Overhead Cable Machine","Cabled machine with a pulley mounted overhead for performing pulldowns and other exercises, pulley location may be adjustable."),
("Adjustable Cable Machine","Cabled machine with a pulley mounted at an ajustable location, used for many exercises."),
("Cable Fly Machine","Cabled machine to perform chest flys with."),
("Swiss Ball","Generic swiss ball."),
("Medicine Ball","Generic medicine ball."),
("Bosu Ball","Generic bosu ball."),
("Resistance Band","Generic resistance band."),
("Treadmill","Generic treadmill for running."),
("Stepper","Generic stepper machine."),
("Elliptical","Generic elliptical."),
("Erg Machine","Generic erg rowing machine."),
("Rope","Generic thick rope.")
] |
'''Crie um programa que leia o nome completo de uma pessoa e mostre:
A) O nome com todas as letras maiúsculas.
B) O nome com todas as letras minúsculas.
C) Quantas letras ao todo (sem considerar espaços).
D) Quantas letras tem o primeiro nome.'''
nome = str(input('Informe o seu nome completo: ')).strip()
print('O seu nome completo é {}.'.format(nome))
print('O seu nome completo em letras maiúsculas é {}.'.format(nome.upper()))
print('O seu nome completo em letras minúsculas é {}.'.format(nome.lower()))
print('O seu nome completo possui {} letras ao todo.'.format(len(nome) - nome.count(' ')))
print('O seu primeiro nome tem {} letras.'.format(nome.find(' ')))
|
ranks = [
"siviilipalvelusmies",
"alokas",
"sotamies",
"aliupseerioppilas",
"korpraali",
"ylimatruusi",
"alikersantti",
"upseerioppilas",
"kersantti",
"upseerikokelas",
"ylikersantti",
"vääpeli",
"pursimies",
"ylivääpeli",
"sotilasmestari",
"vänrikki",
"aliluutnantti",
"luutnantti",
"yliluutnantti",
"kapteeni",
"kapteeniluutnantti",
"majuri",
"komentajakapteeni",
"everstiluutnantti",
"komentaja",
"eversti",
"kommodori",
"prikaatinkenraali",
"kenraalimajuri",
"kontra-amiraali",
"kenraaliluutnantti",
"vara-amiraali",
"amiraali",
"kenraali",
"ylipäällikkö",
"sotajumala",
"supersotajumala",
"ylisotajumala",
]
|
d = {2:0, 3:0, 4:0, 5:0}
input()
v = [int(x) for x in input().split()]
for i in v:
if i % 2 == 0: d[2] += 1
if i % 3 == 0: d[3] += 1
if i % 4 == 0: d[4] += 1
if i % 5 == 0: d[5] += 1
print(d[2], 'Multiplo(s) de 2')
print(d[3], 'Multiplo(s) de 3')
print(d[4], 'Multiplo(s) de 4')
print(d[5], 'Multiplo(s) de 5')
|
# Single line Comment
""" Multi line Comment 1
Multi line Comment 2 """
print("Hello")
print("Hello World")
# By default end is new line charcter \n
print("Hello", end=' & ')
print("Hello World")
print("Hello","Hello World", end=' ')
print('Bye')
print('Harry is \ngood boy ! Yes\t!') # \t for tab (6 spaces) , \' , \"
print(' ')
|
# Caio Beraldi Ribeiro
class Table:
def __init__(self, maxSize, decision):
self.maxSize = maxSize - 1
self.key = [0] * (maxSize)
self.value = [None] * (maxSize)
self.size = -1
self.auxI = 0
self.decision = decision
def __repr__(self):
string = ""
if (not self.isEmpty()):
for i in range(0, self.size + 1):
string = string + str(self.key[i]) + ": " + str(self.value[i]) + "\n"
return string + "\n"
else:
return string + "Lista destruida"
def isEmpty(self):
if (self.size == -1):
return True
else:
False
def isFull(self):
if(self.size == self.maxSize):
return True
else:
False
def search(self, key, decision):
if(decision == "bin"):
return self.binarySearch(key)
elif(decision == "lin"):
return self.linearSearch(key)
def linearSearch(self, key):
if(not self.isEmpty()):
for i in range(0, self.size):
if(self.key[i] == key):
self.auxI = i
return self.auxI
return False
def binarySearch(self, key, begin = 0, end = None):
if(not self.isEmpty() and (key >= 0 and key <= self.key[self.size])):
if(key == self.key[self.size]):
self.auxI = self.size
print("key encontrada na posição:", self.size)
return self.auxI
elif(key == self.key[0]):
self.auxI = 0
print("key encontrada na posição:", 0)
return self.auxI
else:
if(end is None):
end = self.size
if(begin <= end):
half = (begin + end) //2
if (self.key[half] == key):
self.auxI = self.key[half]
print("achou:", self.auxI)
return self.auxI
if (key < self.key[half]):
return self.binarySearch(key, begin, half - 1)
else:
return self.binarySearch(key, half + 1, end)
return None
print("key invalida")
else:
return False
def delete(self, key):
if(self.search(key, self.decision)):
for i in range(self.auxI, self.size):
self.key[i] = self.key[i + 1]
self.value[i] = self.value[i + 1]
self.size -= 1
def destroy(self):
self.size = -1
def insert(self, key, value):
if(self.search(key, self.decision)):
self.value[self.auxI] = value
elif(not self.isFull()):
if(self.isEmpty()):
self.size += 1
self.value[self.size] = value
self.key[self.size] = key
print("Primeira key inserida, com chave:", self.key[self.size])
else:
if(self.size < self.maxSize):
self.size += 1
self.value[self.size] = value
self.key[self.size] = key
print("Outra key inserida, com chave:", self.key[self.size])
def sortedInsert(self, key, value):
if(self.search(key, self.decision)):
self.value[self.auxI] = value
elif(not self.isFull()):
if(self.isEmpty()):
self.size += 1
self.value[self.size] = value
self.key[self.size] = key
else:
if(self.size < self.maxSize):
self.size += 1
if(key > self.key[self.size - 1]):
self.value[self.size] = value
self.key[self.size] = key
else:
auxSize = self.size - 1
while(key < self.key[auxSize]):
self.key[auxSize + 1] = self.key[auxSize]
self.value[auxSize + 1] = self.value[auxSize]
auxSize -= 1
self.value[auxSize + 1] = value
self.key[auxSize + 1] = key
|
#Nathan Li - 3/11/2021 - P7: 10,001st Prime
primeNums = [2, 3, 5]
index = 6
#The simplest primality test is trial division: given an input number, n, check whether
#it is evenly divisible between 2 and √n
while len(primeNums) < 10001:
for prime in primeNums:
if index % prime == 0:
index += 1
break
else:
pass
else:
primeNums.append(index)
index += 1
print(primeNums[-1]) |
"""
Space : O(1)
Time : O(n)
"""
class NumArray:
def __init__(self, nums: List[int]):
self.nums = nums
def update(self, i: int, val: int) -> None:
self.nums[i] = val
def sumRange(self, i: int, j: int) -> int:
return sum(self.nums[i:j+1])
# Your NumArray object will be instantiated and called as such:
# obj = NumArray(nums)
# obj.update(i,val)
# param_2 = obj.sumRange(i,j)
|
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Children, obj[8]: Education, obj[9]: Occupation, obj[10]: Income, obj[11]: Bar, obj[12]: Coffeehouse, obj[13]: Restaurant20to50, obj[14]: Direction_same, obj[15]: Distance
# {"feature": "Income", "instances": 34, "metric_value": 0.99, "depth": 1}
if obj[10]<=5:
# {"feature": "Restaurant20to50", "instances": 25, "metric_value": 0.9896, "depth": 2}
if obj[13]<=2.0:
# {"feature": "Coffeehouse", "instances": 22, "metric_value": 0.9457, "depth": 3}
if obj[12]<=3.0:
# {"feature": "Occupation", "instances": 19, "metric_value": 0.9819, "depth": 4}
if obj[9]>5:
# {"feature": "Coupon", "instances": 12, "metric_value": 0.8113, "depth": 5}
if obj[3]>3:
return 'False'
elif obj[3]<=3:
# {"feature": "Coupon_validity", "instances": 5, "metric_value": 0.971, "depth": 6}
if obj[4]<=0:
return 'True'
elif obj[4]>0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[9]<=5:
# {"feature": "Coupon", "instances": 7, "metric_value": 0.8631, "depth": 5}
if obj[3]>0:
return 'True'
elif obj[3]<=0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[12]>3.0:
return 'False'
else: return 'False'
elif obj[13]>2.0:
return 'True'
else: return 'True'
elif obj[10]>5:
# {"feature": "Occupation", "instances": 9, "metric_value": 0.5033, "depth": 2}
if obj[9]>0:
return 'True'
elif obj[9]<=0:
return 'False'
else: return 'False'
else: return 'True'
|
def test_limits(client):
"""Make sure that requesting resources with limits return a slice of the result."""
for i in range(100):
badge = client.post("/api/event/1/badge", json={
"legal_name": "Test User {}".format(i)
}).json
assert(badge['legal_name'] == "Test User {}".format(i))
badges = client.get("/api/event/1/badge", query_string={"limit": 10}).json
assert(len(badges) == 10)
def test_offset(client):
"""Make sure that requesting resources with offsets return the correct range of data."""
for i in range(100):
badge = client.post("/api/event/1/badge", json={
"legal_name": "Test User {}".format(i)
}).json
assert(badge['legal_name'] == "Test User {}".format(i))
badges = client.get("/api/event/1/badge", query_string={"offset": 10, "limit": 5, "full": True}).json
assert(len(badges) == 5)
assert(badges[0]["legal_name"] == "Test User 10")
# Test with the default limit of 10
badges = client.get("/api/event/1/badge", query_string={"offset": 20, "full": True}).json
assert(len(badges) == 10)
assert(badges[0]["legal_name"] == "Test User 20")
def test_page(client):
"""Make sure that requesting resources with pagination return the correct data."""
for i in range(100):
badge = client.post("/api/event/1/badge", json={
"legal_name": "Test User {}".format(i)
}).json
assert(badge['legal_name'] == "Test User {}".format(i))
badges = client.get("/api/event/1/badge", query_string={"page": 3, "limit": 15, "full": True}).json
assert(len(badges) == 15)
assert(badges[0]["legal_name"] == "Test User 45")
# Test with the default limit of 10
badges = client.get("/api/event/1/badge", query_string={"page": 5, "full": True}).json
assert(len(badges) == 10)
assert(badges[0]["legal_name"] == "Test User 50") |
# cook your dish here
try:
n = int(input())
print(n)
except:
pass
|
acum = menor = cont = cont1 = 0
barato = ''
while True:
produto = str(input('Nome do produto:')).strip()
preço = float(input('Preço do produto:R$ '))
cont+= 1
if cont == 1 or preço < menor:
menor = preço
barato = produto
acum += preço
if preço > 1000:
cont1 += 1
escolha = 't'
while escolha not in 'sn':
escolha = str(input('Quer continuar?[S/N] ')).strip().lower()[0]
if escolha == 'n':
break
print(f'''O total gasto na compra é {acum}
{cont1} produtos custam mais de mil reais
O produto mais barato é {barato} e você pagou R${menor :.2f} nele''')
|
a, b = map(int, input().split())
if a+b < 24:
print(a+b)
else:
print((a+b)-24)
|
class Dog:
"""A simple attempt to model a dog"""
def __init__(self, name, age):
"""Initialize name and age attributes"""
self.name=name
self.age=age
def sit(self):
"""Simulate a dog sitting in response to a command"""
print(f"{self.name} is now sitting")
def roll_over(self):
"""Simulate rolling over in response to a command"""
print(f"{self.name} rolled over!")
def run(self):
"""Simulate the dog running in response to a command"""
print(f"The {self.age} old Dog is now running")
|
listao = [[], []]
for c in range(0, 7):
v = (int(input(f'Digite o {c+1}° valor: ')))
if v % 2 == 0:
listao[0].append(v)
else:
listao[1].append(v)
listao[0].sort()
listao[1].sort()
print('='*50)
print(f'Os valores pares digitados foram: {listao[0]}')
print(f'Os valores ímpares digitados foram: {listao[1]}')
|
#
# PySNMP MIB module POLICY-DEVICE-AUX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/POLICY-DEVICE-AUX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:41:12 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")
ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
experimental, iso, MibIdentifier, IpAddress, TimeTicks, Gauge32, ModuleIdentity, Counter32, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Integer32, Unsigned32, Bits, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "experimental", "iso", "MibIdentifier", "IpAddress", "TimeTicks", "Gauge32", "ModuleIdentity", "Counter32", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Integer32", "Unsigned32", "Bits", "Counter64")
RowStatus, TextualConvention, StorageType, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "StorageType", "DisplayString")
policyDeviceAuxMib = ModuleIdentity((1, 3, 6, 1, 3, 999))
if mibBuilder.loadTexts: policyDeviceAuxMib.setLastUpdated('200007121800Z')
if mibBuilder.loadTexts: policyDeviceAuxMib.setOrganization('IETF RAP WG')
if mibBuilder.loadTexts: policyDeviceAuxMib.setContactInfo('Kwok Ho Chan Nortel Networks, Inc. 600 Technology Park Drive Billerica, MA 01821 USA Phone: +1 978 288 8175 Email: [email protected] John Seligson Nortel Networks, Inc. 4401 Great America Parkway Santa Clara, CA USA 95054 Phone: +1 408 495-2992 Email: [email protected] Keith McCloghrie Cisco Systems, Inc. 170 West Tasman Drive, San Jose, CA 95134-1706 USA Phone: +1 408 526 5260 Email: [email protected]')
if mibBuilder.loadTexts: policyDeviceAuxMib.setDescription('This module defines an infrastructure used for support of policy-based provisioning of a network device.')
policyDeviceAuxObjects = MibIdentifier((1, 3, 6, 1, 3, 999, 1))
policyDeviceAuxConformance = MibIdentifier((1, 3, 6, 1, 3, 999, 2))
policyDeviceConfig = MibIdentifier((1, 3, 6, 1, 3, 999, 1, 1))
class Role(TextualConvention, OctetString):
reference = 'Policy Core Information Model, draft-ietf-policy-core-info-model-06.txt'
description = 'A role represents a functionality characteristic or capability of a resource to which policies are applied. Examples of roles include Backbone interface, Frame Relay interface, BGP-capable router, web server, firewall, etc. Valid characters are a-z, A-Z, 0-9, period, hyphen and underscore. A role must not start with an underscore.'
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 31)
class RoleCombination(TextualConvention, OctetString):
description = "A Display string consisting of a set of roles concatenated with a '+' character where the roles are in lexicographic order from minimum to maximum. For example, a+b and b+a are NOT different role-combinations; rather, they are different formating of the same (one) role- combination. Notice the roles within a role-combination are in lexicographic order from minimum to maximum, hence, we declare: a+b is the valid formating of the role-combination, b+a is an invalid formating of the role-combination. Notice the need of zero-length role-combination as the role- combination of interfaces to which no roles have been assigned. This role-combination is also known as the null role-combination. (Note the deliberate use of lower case leters to avoid confusion with the ASCII NULL character which has a value of zero but length of one.)"
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255)
policyInterfaceTable = MibTable((1, 3, 6, 1, 3, 999, 1, 1, 1), )
if mibBuilder.loadTexts: policyInterfaceTable.setStatus('current')
if mibBuilder.loadTexts: policyInterfaceTable.setDescription("Policy information about a device's interfaces.")
policyInterfaceEntry = MibTableRow((1, 3, 6, 1, 3, 999, 1, 1, 1, 1), ).setIndexNames((0, "POLICY-DEVICE-AUX-MIB", "policyInterfaceIfIndex"))
if mibBuilder.loadTexts: policyInterfaceEntry.setStatus('current')
if mibBuilder.loadTexts: policyInterfaceEntry.setDescription('A conceptual row in the policyInterfaceTable. Each row identifies policy infromation about a particular interface.')
policyInterfaceIfIndex = MibTableColumn((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: policyInterfaceIfIndex.setStatus('current')
if mibBuilder.loadTexts: policyInterfaceIfIndex.setDescription('The ifIndex value for which this conceptual row provides policy information.')
policyInterfaceRoleCombo = MibTableColumn((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 2), RoleCombination()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: policyInterfaceRoleCombo.setStatus('current')
if mibBuilder.loadTexts: policyInterfaceRoleCombo.setDescription('The role combination that is associated with this interface for the purpose of assigning policies to this interface.')
policyInterfaceStorage = MibTableColumn((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 3), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: policyInterfaceStorage.setStatus('current')
if mibBuilder.loadTexts: policyInterfaceStorage.setDescription('The storage type for this conceptual row. Conceptual rows having the value permanent(4) need not allow write-access to any columnar objects in the row. This object may not be modified if the associated policyInterfaceStatus object is equal to active(1).')
policyInterfaceStatus = MibTableColumn((1, 3, 6, 1, 3, 999, 1, 1, 1, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: policyInterfaceStatus.setStatus('current')
if mibBuilder.loadTexts: policyInterfaceStatus.setDescription('The status of this row. An entry may not exist in the active state unless all objects in the entry have an appropriate value. Row creation using only default values is supported.')
policyDeviceCompliances = MibIdentifier((1, 3, 6, 1, 3, 999, 2, 1))
policyDeviceGroups = MibIdentifier((1, 3, 6, 1, 3, 999, 2, 2))
policyDeviceCompliance = ModuleCompliance((1, 3, 6, 1, 3, 999, 2, 1, 1)).setObjects(("POLICY-DEVICE-AUX-MIB", "policyInterfaceGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
policyDeviceCompliance = policyDeviceCompliance.setStatus('current')
if mibBuilder.loadTexts: policyDeviceCompliance.setDescription('Describes the requirements for conformance to the Policy Auxiliary MIB.')
policyInterfaceGroup = ObjectGroup((1, 3, 6, 1, 3, 999, 2, 2, 1)).setObjects(("POLICY-DEVICE-AUX-MIB", "policyInterfaceRoleCombo"), ("POLICY-DEVICE-AUX-MIB", "policyInterfaceStorage"), ("POLICY-DEVICE-AUX-MIB", "policyInterfaceStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
policyInterfaceGroup = policyInterfaceGroup.setStatus('current')
if mibBuilder.loadTexts: policyInterfaceGroup.setDescription('Objects used to define interface to role combination mappings.')
mibBuilder.exportSymbols("POLICY-DEVICE-AUX-MIB", policyInterfaceRoleCombo=policyInterfaceRoleCombo, Role=Role, policyInterfaceStatus=policyInterfaceStatus, policyDeviceConfig=policyDeviceConfig, policyInterfaceEntry=policyInterfaceEntry, policyInterfaceGroup=policyInterfaceGroup, policyDeviceCompliance=policyDeviceCompliance, RoleCombination=RoleCombination, policyDeviceAuxConformance=policyDeviceAuxConformance, policyDeviceAuxMib=policyDeviceAuxMib, policyInterfaceIfIndex=policyInterfaceIfIndex, policyInterfaceStorage=policyInterfaceStorage, policyDeviceGroups=policyDeviceGroups, policyDeviceAuxObjects=policyDeviceAuxObjects, policyDeviceCompliances=policyDeviceCompliances, policyInterfaceTable=policyInterfaceTable, PYSNMP_MODULE_ID=policyDeviceAuxMib)
|
#Ask user to input 3 numbers - width, length, height
width = input("Enter the width of the room in meters, please:\n")
length = input("Enter the length of the room in meters, please:\n")
height = input("Enter the height of the room in meters, please:\n")
#Find the volume of the room
#PS Think about units and what is the most appropriate data type for this
width = float(width) # no error handling here
length = float(length)
height = float(height)
volume = width * length * height
print(f"The volume of the room is {round(volume,2)} m\u00B3") # ³
print("\n")
|
{
'targets': [
{
'target_name': 'binding',
'sources': [ './src/fb-bindings.cc', './src/fb-bindings-blob.cc',
'./src/fb-bindings-fbresult.cc',
'./src/fb-bindings-connection.cc','./src/fb-bindings-eventblock.cc',
'./src/fb-bindings-fbeventemitter.cc',
'./src/fb-bindings-statement.cc',
'./src/fb-bindings-transaction.cc' ],
'include_dirs': [
'<(module_root_dir)/fb/include',
"<!(node -e \"require('nan')\")"
],
"conditions" : [
[
'OS=="linux"', {
'libraries': [ '-lfbclient' ]
}
],
[
'OS=="win" and target_arch=="ia32"', {
"libraries" : [
'<(module_root_dir)/fb/lib/fbclient_ms.lib'
]
}
],
[
'OS=="win" and target_arch=="x64"', {
"libraries" : [
'<(module_root_dir)/fb/lib64/fbclient_ms.lib'
]
}
],
[
'OS=="mac"', {
"link_settings" : {
"libraries": ['-L/Library/Frameworks/Firebird.framework/Libraries/', '-lfbclient']
}
}
]
]
}
]
}
|
# Still waiting on what Neutral should be!
ALIGNMENT_CHOICES = (
(0, 'Neutral'),
(-1000, 'Evil'),
(1000, 'Good'),
)
SEX_CHOICES = (
(0, 'None'),
(1, 'Male'),
(2, 'Female'),
)
WEAPON_TYPE_CHOICES = (
('B', 'Blunt'),
('S', 'Sharp'),
)
DIRECTION_CHOICES = (
(0, 'North'),
(1, 'East'),
(2, 'South'),
(3, 'West'),
(4, 'Up'),
(5, 'Down'),
)
DOOR_RESET_CHOICES = (
(0, 'Open'),
(1, 'Closed'),
(2, 'Locked'),
)
DOOR_TRIGGER_TYPE_CHOICES = (
('P', 'Prevent'),
('A', 'Allow'),
)
ITEM_TYPE_CLASSES = [
'Light',
'Fountain',
'Weapon',
'AnimalWeapon',
'Armor',
'AnimalArmor',
'Food',
'PetFood',
'Scroll',
'Potion',
'Pill',
'Wand',
'Staff',
'Fetish',
'Ring',
'Relic',
'Treasure',
'Furniture',
'Trash',
'Key',
'Boat',
'Decoration',
'Jewelry',
'DrinkContainer',
'Container',
'Money',
]
|
# -*- coding: UTF-8 -*-
labels = {
0 : '苹果',
1 : '香蕉',
2 : '橙子',
3 : '火龙果',
4 : '圣女果',
5 : '梨子',
6 : '空盘'
}
prices = {
0 : 4.2,
1 : 8.9,
2 : 10.2,
3 : 3.9,
4 : 8.77,
5 : 8.6,
6 : 0
} |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 10 09:23:08 2018
@author: misskeisha
"""
s = input()
def palindrome(s):
if len(s) <= 1:
return True
else:
return s[0] == s[-1] and palindrome(s[1:-1])
print(palindrome(s)) |
# break
# for i in range(1, 10):
# print(i)
# if i == 3:
# break
# continue
for i in range(1, 10):
if i == 4 or i == 7:
continue
print(i)
|
#Cambio , remplazo de cadena de Letras
print("=================================================================")
archivo_texto = open("archivo.txt","r+") # Archivo de Lectura y escritura
lista_texto=archivo_texto.readlines()
lista_texto[1]= " Estas linea ha sido incluioda desde el exterior 2 \n"
archivo_texto.seek(0)
archivo_texto.writelines(lista_texto)
archivo_texto.close() |
# 07/01/2019
def upc(n):
digits = [int(x) for x in f'{n:011}']
M = (sum(digits[0::2]) * 3 + sum(digits[1::2])) % 10
return 0 if M == 0 else 10 - M
assert upc(4210000526) == 4
assert upc(3600029145) == 2
assert upc(12345678910) == 4
assert upc(1234567) == 0
|
# -*- coding: utf-8 -*-
#
# dependencies documentation build configuration file, created by Quark
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon'
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'dependencies'
copyright = u'2015, dependencies authors'
author = u'dependencies authors'
version = '0.0.1'
release = '0.0.1'
language = None
exclude_patterns = ['_build']
pygments_style = 'sphinx'
todo_include_todos = False
html_theme = 'alabaster'
html_static_path = ['_static']
htmlhelp_basename = 'dependenciesdoc'
latex_elements = {}
latex_documents = [
(master_doc, 'dependencies.tex', u'dependencies Documentation',
u'dependencies authors', 'manual'),
]
man_pages = [
(master_doc, 'dependencies', u'dependencies Documentation',
[author], 1)
]
texinfo_documents = [
(master_doc, 'dependencies', u'dependencies Documentation',
author, 'dependencies', 'One line description of dependencies.',
'Miscellaneous'),
]
|
while True:
try:
number = input('Please input hex number: ')
print(int(number, 16))
except:
break;
|
print('-'* 23)
print('\033[:31mCALCULADOR DE DESCONTOS\033[m')
print('-'* 23)
p = float(input('Valor do produto: '))
desc = (p / 100) * 95 # -> p - (p * 5 / 100)
print(f'O produto que custava {p:.2f} com desconto de 5% sae por: {desc:.2f}'.replace('.', ',')) |
limak, bob = map(int, input().split())
years = 0
while limak <= bob:
limak *= 3
bob *= 2
years += 1
print(years) |
##Find the nth term of the series.
##
##1, 1, 2, 3, 4, 9, 8, 27, 16, 81, 32, 243,64, 729, 128, 2187 ….
##
##This series is a mixture of 2 series – all the odd terms in this series form
##a geometric series and all the even terms form yet another geometric series.
##Write a program to find the Nth term in the series.
##
##The value N in a positive integer that should be read from STDIN.
##The Nth term that is calculated by the program should be written to STDOUT.
##Other than value of n th term,no other character / string or message should be written to STDOUT.
##For example , if N=16, the 16th term in the series is 2187, so only value 2187 should be printed to STDOUT.
##
##You can assume that N will not exceed 30.
##
##Test Case 1
##
##Input- 16
##Expected Output – 2187
##Test Case 2
##
##Input- 13
##Expected Output – 64
num = int(input())
if(num%2==0):
num = num//2
print(3**(num-1))
else:
num = num//2 + 1
print(2**(num-1))
|
"""Top-level package for ascii-art."""
__author__ = """Zero to Mastery"""
__version__ = '0.1.0'
|
#Settings for running headless_tests
DEVELOPMENT_SERVER_HOST='localhost'
DEVELOPMENT_SERVER_PORT=8004
PHANTOMJS_GHOSTDRIVER_PORT=8150
|
# -*- coding: utf-8 -*-
MINIMUM_PULSE_CYCLE = 0.5
MAXIMUM_PULSE_CYCLE = 1.2
PPG_SAMPLE_RATE = 200
PPG_FIR_FILTER_TAP_NUM = 200
PPG_FILTER_CUTOFF = [0.5, 5.0]
PPG_SYSTOLIC_PEAK_DETECTION_THRESHOLD_COEFFICIENT = 0.5
TRAINING_DATA_RATIO = 0.75 |
# Turns on debugging features in Flask
DEBUG = True
# secret key:
SECRET_KEY = "MySuperSecretKey"
# Database connection parameters
DB_HOST = "127.0.0.1"
DB_PORT = 27017
DB_NAME = "cgbeacon2-test"
DB_URI = f"mongodb://{DB_HOST}:{DB_PORT}/{DB_NAME}" # standalone MongoDB instance
# DB_URI = "mongodb://localhost:27011,localhost:27012,localhost:27013/?replicaSet=rs0" # MongoDB replica set
ORGANISATION = dict(
id="scilifelab", # mandatory
name="Clinical Genomics, SciLifeLab", # mandatory
description="A science lab",
address="",
contactUrl="",
info=[],
logoUrl="",
welcomeUrl="",
)
BEACON_OBJ = dict(
id="SciLifeLab-beacon", # mandatory
name="SciLifeLab Stockholm Beacon", # mandatory
organisation=ORGANISATION, # mandatory
alternativeUrl="http//scilifelab.beacon_alt.se",
createDateTime="2015-06-15T00:00.000Z",
description="Beacon description",
info=[],
welcomeUrl="http//scilifelab.beacon.se",
)
############## OAUTH2 permissions layer ##############
### https://elixir-europe.org/services/compute/aai ###
ELIXIR_OAUTH2 = dict(
server="https://login.elixir-czech.org/oidc/jwk", # OAuth2 server that returns JWK public key
issuers=["https://login.elixir-czech.org/oidc/"], # Authenticated Bearer token issuers
userinfo="https://login.elixir-czech.org/oidc/userinfo", # Where to send access token to view user data (permissions, statuses, ...)
audience=[], # List of strings. Service(s) the token is intended for. (key provided by the Beacon Network administrator)
verify_aud=False, # if True, force verify audience for provided token
bona_fide_requirements="https://doi.org/10.1038/s41431-018-0219-y",
)
|
string_input = input()
num = int(input())
# def string(str, n):
# new_string = ""
# for i in range(0, n):
# new_string += str
# return new_string
# def string(str, n):
# return str*n
# Recursion
def string(str, n):
if n < 1:
return ""
return str + string(str, n=n - 1)
print(string(string_input, num))
|
def add_node(v):
if v in graph:
print(v,"already present")
else:
graph[v]=[]
def add_edge(v1,v2):
if v1 not in graph:
print(v1," not present in graph")
elif v2 not in graph:
print(v2,"not present in graph")
else:
graph[v1].append(v2)
graph[v2].append(v1)
def delete_edge(v1,v2):
if v1 not in graph:
print(v1,"not present in graph")
elif v2 not in graph:
print(v2,"not present in graph")
else:
if v2 in graph[v1]:
graph[v1].remove(v2)
graph[v2].remove(v1)
def DFSiterative(node,graph):
visited=set()
if node not in graph:
print(node,"not in graph")
return
stack=[]
stack.append(node)
while stack:
current=stack.pop()
if current not in visited:
print(current)
visited.add(current)
for i in graph[node]:
stack.append(i)
graph={}
add_node('A')
add_node('B')
add_node('C')
add_node('D')
add_edge('A','D')
add_edge('A','C')
add_edge('C','D')
add_edge('C','E')
DFSiterative("A",graph)
print(graph)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Prince Prigio
chart = ["accept", "allow", "apologise", "appeal", "appear", "approve", "await", "bear", "beat", "behave", "behold", "better", "brawl", "breed", "build", "christen", "claim", "complain", "correct", "count", "cover", "creep", "curl", "decline", "deserve", "despise", "disappear", "distress", "shun", "draw", "drop", "eat", "encourage", "exhaust", "expect", "expire", "express", "fall", "find", "float", "frighten", "get", "grow", "happen", "hover", "improve", "indebt", "inform", "interrupt", "irritate", "misbehave", "kneel", "know", "laugh", "leap", "lose", "manage", "matter", "meet", "misinterpret", "neglect", "offend", "offer", "open", "overdo", "overpower", "pledge", "poach", "possess", "prove", "put", "raise", "reach", "recover", "represent", "retire", "ride", "roll", "rush", "say", "seat", "seem", "send", "sign", "smoke", "soar", "spy", "raise", "start", "stone", "stop", "sup", "suppose", "teach", "tear", "tell", "threaten", "tire", "uncoil", "unite", "visit", "wake", "warn", "wash", "wild", "wish", "withdraw", "write"],
|
# -*- coding: utf-8 -*-
class Graph():
def __init__(self, v):
self.__adj = [[] for i in range(v)]
self.__pilha = []
self.__paths = []
self.__visit = [-1 for i in range(v)]
def __str__(self):
count = 0
stringR = "LISTA DE ADJACÊNCIA\n"
for v in self.__adj:
stringR += str(count) + ": "
for i in v:
stringR += str(i) + " "
count += 1
stringR += "\n"
return stringR
def Insert(self, v, w):
self.__adj[v].append(w)
self.__adj[w].append(v)
def FindPaths(self, vinit, vfinal):
self.__visit[vinit] = 1
self.__pilha.append(vinit)
for v in self.__adj[vinit]:
if(self.__visit[v] == -1):
self.DFS(v, vfinal)
self.__visit[v] = -1
self.__pilha.pop()
smaller = self.SmallerPath()
pathSmaller = ""
for i in self.__paths[smaller]:
pathSmaller += str(i) + ", "
print(f"\nQtd. de caminhos possíveis: {len(self.__paths)}")
print(f"Melhor caminho: {pathSmaller}")
print(f"Peso {len(self.__paths[smaller]) -1}")
print("Outras informações\n")
print(self)
print(f"Todos os caminhos \n {self.__paths}")
def DFS(self, v, vfinal):
self.__pilha.append(v)
self.__visit[v] = 1
if (v == vfinal):
self.AddPath()
return
for w in self.__adj[v]:
if(self.__visit[w] == -1):
self.DFS(w, vfinal)
self.__visit[w] = -1
self.__pilha.pop()
def AddPath(self):
self.__paths.append(tuple(self.__pilha))
def SmallerPath(self):
smaller = 666
smallerI = 666
for i in range(len(self.__paths)):
if(len(self.__paths[i]) < smaller):
smaller = len(self.__paths[i])
smallerI = i
return smallerI
def readFile():
path = 'labirinto.txt'
dataFile = open(path , "r")
data = dataFile.read()
dataFile.close()
data = data.split('\n')
vertexQtd = int(data.pop(0))
vertexInit = int(data.pop(0))
vertexFinal = int(data.pop(0))
a = []
for i in data:
a.append((int(i[0]),int(i[2])))
return a, vertexQtd, vertexInit, vertexFinal
print("****************************")
print("******** PROJETO 01 ********")
print("****************************")
A, vertexQtd, vertexInit, vertexFinal = readFile()
graph = Graph(vertexQtd)
for a in A:
graph.Insert(a[0], a[1])
graph.FindPaths(vertexInit, vertexFinal) |
#! python
# Problem # : 236A
# Created on : 2019-01-14 23:41:28
def Main():
cnt = len(set(input()))
print('IGNORE HIM!' if cnt & 1 else 'CHAT WITH HER!')
if __name__ == '__main__':
Main()
|
anjoValue = "o Gilberto e o Fiuk"
liderValue = "o Caio"
monstroArray = ["Caio", "Rodolffo"]
paredaoArray = ["Arthur", "Fiuk", "Thaís"]
elenco = [
['o Arthur', 'https://uploads.metropoles.com/wp-content/uploads/2021/03/02145955/arthur_bbb21-600x400.jpg'],
['a Karol Conká', 'https://files.nsctotal.com.br/s3fs-public/styles/paragraph_image_style/public/graphql-upload-files/karol-konka-eliminacao-bbb21-memes_0.jpg?EFEb33qeZ8iRiRghdSmDc3pwGh8QSLgS&itok=nAsm3yub'],
['o Caio', 'https://www.emaisgoias.com.br/wp-content/uploads/2021/02/bbb-21-caio-inova-no-visual-1612489030988_v2_1910x1073-960x640.jpg'],
['a Carla Diaz', 'https://caras.uol.com.br/images/large/2021/02/16/carla-diaz-desabafa-apos-desentendimento-com-lumena-961442.jpg'],
['o João Luiz', 'https://stc.ofuxico.com.br/img/upload/noticias/2021/02/03/joao-luiz-falando-de-lucas-penteado-quarto-do-lider-bbb21_395540_36.jpg'],
['a Camilla de Lucas',
'https://popnow.com.br/wp-content/uploads/2021/02/Eu4HuZXXAAYcyAv-1000x563.jpg'],
['o Arcrebiano', 'https://noticiasdatv.uol.com.br/media/uploads/artigos/arcrebiano-reproducao-bbb-globoplay.jpg'],
['a Pocah', 'https://odia.ig.com.br/_midias/jpg/2021/02/01/1200x750/1_pocah-21089949.jpg'],
['a Juliette', 'https://conteudo.imguol.com.br/c/entretenimento/54/2021/02/01/juliette-no-bbb-21-1612225746542_v2_450x337.png'],
['o Nego Di', 'https://media.tenor.com/images/d14795e193d89210da611771639c7d27/tenor.png'],
['a Kerline', 'https://catracalivre.com.br/wp-content/thumbnails/GIRdKc1Hs7dx_3ljTdMsfdm5CN8=/wp-content/uploads/2021/01/kerline-1-450x281.jpg'],
['o Lucas Penteado', 'https://stc.ofuxico.com.br/img/upload/noticias/2021/01/29/penteado-capa_395183_36.jpg'],
['a Lumena', 'https://catracalivre.com.br/wp-content/uploads/2021/02/lumena.jpg'],
['o Rodolffo', 'https://www.memesdavida.com.br/wp-content/uploads/2021/02/3516294-rodolffo-do-bbb21-tem-nude-exposto-e-950x600-1-730x450.jpg'],
['o Gilberto', 'https://portalpopline.com.br/wp-content/uploads/2021/02/Gilberto-1.jpg'],
['a Viih Tube', 'https://static1.purepeople.com.br/articles/5/31/29/15/@/3535998--bbb-21-viih-tube-revela-ter-ficado-2-624x600-1.jpg'],
['a Thaís', 'https://s2.glbimg.com/u9Tgd-sFNLJXag8OTKap7M4Q6d4=/682x43:1238x1037/smart/filters:strip_icc()/i.s3.glbimg.com/v1/AUTH_e84042ef78cb4708aeebdf1c68c6cbd6/internal_photos/bs/2021/S/3/I5XA9KSsuASGUwqDtVmw/bbb21-010321-232026.jpg'],
['o Projota', 'https://www.tenhomaisdiscosqueamigos.com/wp-content/uploads/2021/03/Projota-no-BBB-21.jpg'],
['a Sarah', 'https://portalpopline.com.br/wp-content/uploads/2021/02/sarah-2.jpg'],
['o Fiuk', 'https://i.uai.com.br/P_l_gjUADe5tZQdBYdEyoqrbyU0=/750x0/imgsapp2.uai.com.br/app/noticia_133890394703/2021/02/09/267978/20210209155556304004e.jpeg']
]
quoteArray = [
"Você está no paredão! 🧱",
"Você está imune! 👼",
"Você recebeu R$ 50.000 na sua carteira do PicPay 💲",
"Indique 2 pessoas ao paredão 😈",
"TOP 10 apresentadores de BBB: Eu 😎",
"Escolha uma música para o Gil cantar 🎵",
"Indique 3 pessoas para irem ao paredão com você 😈",
"Rodolffo diz: Arrebentando arame, rasteira baiana, engrenagem enpenando. Bicicleta perdendo freio na descida, vaca entrando no meio de roça!, moto fazendo tananananannann 🤠",
"Imunize 1 pessoa 👼",
"Tiago Leifert, você é a vergonha da profisson! 🤬",
"Se querer é poder, você pode passar em cálculo! 🤯",
"O Fiuk brigou com você por comida. Fique em silêncio por 1 minuto 🤫",
"Você tem o poder de descobrir o voto de alguém no último paredão. Pra quem gostaria de perguntar? 😯",
"Você aceita um prato de Strogonoff? O Projota não quis o dele 🥘",
"Você ressignificou a conversa com inverdades e menosprezou a jornada da Lumena 😭",
"Eu sou melhor que o Tiago Leifert 😘",
"Agostinho Bot Carrara está chegando. Eu avisei! 🚨",
"Não quero mais te ver hoje - CONKÁ, Karol (ou seria o Jacquin?) 🤮",
"Você está no paredão falso! 🤐",
"O ICMC é melhor que o PROJAC 😎",
"Abaixa o som da TV e me escuta pelo telefone! 📞",
"Eu e Mendonça comandamos a repartição virtual quando Lineuzinho está de folga 🤫",
"Indique 3 pessoas ao paredão 😈",
"O Nego Di fez uma piada. Sorria por 3 horas 😁",
"PYONG LEEEEEEEEE ⛩",
"Cuidado, Lineuzinho! O Beiçola está dançando com a Nenê 🐂",
"Que tal atuar um pouco? Você está na nova novela das 21h! 🎬",
"Indique 2 pessoas para irem ao paredão falso com você! 🤐",
"Indique 1 pessoa para ganhar uma viagem para a Lua 🌑",
"Palmeiras não tem mundial 🐷",
"Indique 1 pessoa ao paredão 😈",
"Vem ser feliz aqui fora! Você está eliminadx 🚫",
"Você é o novo líder! 👑",
"Há um novo integrante no mundo dos bots: Agostinho Bot Carrara 🤪",
"Você ganhou uma palestrinha da Juliette 🙉",
"Planta faz isso? 💃 🌱",
"Você ganhou 3 ingressos para o show do Fiuk 🎸",
"Você está fora do BBB e foi indicado diretamente para A Fazenda 🐴",
"Indique 2 pessoas para o monstro 👹",
"Você ganhou um bolo de chocolate do Fiuk 🎂",
"Indique 3 pessoas para o Quarto Branco ⬜",
"Agora você segue a Viih Tube 😾",
"O Boninho gostou de você! Agora vai substituir a Fátima Bernardes 👩",
"Indique 1 pessoa para ir ao Quarto Branco com você ⬜",
"Você ganhou 1 ano grátis no Méqui 🍔",
"Você ganhou 2 ingressos para o show do Projota 🎤",
"Escolha: 5 dias no quarto branco ou 1 hora com o Projota? 🤔",
"JOGA Y JOGA - Você está na final do BBB! 🤑",
"Você ganhou um sono da beleza com a Pocah 😴",
"Você ganhou 4 ingressos para o show da Pocah 🎇",
"Tiago Leifert era melhor narrando FIFA (mentira, nem nisso) 😒",
"Você recebeu R$ 100.000 na sua carteira do PicPay 💲",
"A Karol Conká se declarou pra você no Instagram. Está canceladx! 🚫",
"Você ganhou uma viagem para a vila do Projota muleque de vila kk 🏙",
"Você ganhou um patinete da Americanas 🛴",
"Você agora é a Carla Diaz. Peça alguém em casamento 💍",
"Você ganhou uma ligação para o Rafael Portugal 📞",
"A Sarah disse que era sua amiga, mas era mentira. Fique em silêncio por 2 minutos 😫",
"Você ganhou um tênis da Americanas 👟",
"Tiago Leifert nunca chegará aos meus pés 😎",
"A casa de vidro voltou e a Ivy vai dormir no seu quarto 🤣",
"Eu sou Pedro Bot Bial e nasci em 2021 🤖",
"Você ganhou um banho grátis! (a Viih Tube não quis) 🚿",
"Você ganhou uma aula de crossfit com o Arhur! Aulas, Cria 🏋️♀️",
"Minx, seus cabelo é daora 🎶",
"Você ganhou um Galaxy S21 da Americanas 📱",
"MUSICAS FODA: https://youtu.be/WUg-ADJg-H0",
"Eu sou bem melhor que o Jô Soares 😛",
"Você ganhou o direito de saber o que está acontecendo aqui fora. O que gostaria de perguntar? 🧐",
"Você está no Arquivo Confidencial! 💾",
"Agora você segue a Karol Conká ☣",
"Você ganhou a nova Fiat Toro 🐂",
"EU AÍ KKK: https://youtu.be/ZJiCYajcpq8 ",
"Você ganhou um feat com o Lucas Penteado 🎤",
"Você ganhou um Fiat Uno 🚗",
"Prazer, meu nome é Pedro Bot Bial 😂",
"PARA DE GRITAAAAAAAA 😱",
"Você ganhou um café da manhã com a Ana Maria Braga! Parabéns, está eliminadx! 🚫",
"Você ganhou um corte de cabelo da Avon ✂",
"No mundo dos bots, eu sou o melhor amigo do Lineuzinho ❤",
"Você ganhou 5 ingressos para o show da Karol Conká 🎙",
"Você ganhou um esmalte da Avon 💅",
"Você fez a Kerline chorar. Fique 1 minuto em silêncio 😭",
"O Gil está indignado com você! Fique em silêncio por 10 minutos 🤫",
"Você está no VIP! 🌟",
"Após o sinal, diga o seu nome e a cidade de onde está falando 😅",
"Você está na Xepa! 🤭",
"Falem bem ou falem mal, eu fui o melhor que vocês já tiveram. Bj no ombro, Tiago Leifert 😗",
"Você está eliminadx! 🚫",
"Indique uma pessoa para fazer recuperação com você 🥺"
]
|
class Node:
def __init__(self, index):
self.index = index
self.visited = False
self._neighbors = []
def __repr__(self):
return str(self.index)
@property
def neighbors(self):
return self._neighbors
@neighbors.setter
def neighbors(self, neighbor):
self._neighbors.append(neighbor)
class Graph:
def __init__(self):
self._nodes = {}
self.connected_components = {}
@property
def nodes(self):
return self._nodes
@nodes.setter
def nodes(self, index):
self._nodes[index] = Node(index)
def add_edge(self, index_1, index_2, directional=False):
if directional:
self.nodes[index_1].neighbors = self.nodes[index_2]
else:
self.nodes[index_1].neighbors = self.nodes[index_2]
self.nodes[index_2].neighbors = self.nodes[index_1]
def return_nodes_unvisited(self):
return [node for node in list(self.nodes.values()) if not node.visited]
def calculate_connected_components(self):
nodes_unvisited = self.return_nodes_unvisited()
while nodes_unvisited:
node = nodes_unvisited[0]
index = len(self.connected_components)
self.connected_components[index] = [node]
node.visited = True
for neighbor in node.neighbors:
self.connected_components[index].append(neighbor)
neighbor.visited = True
nodes_unvisited = self.return_nodes_unvisited()
for index, connected_components in self.connected_components.items():
print(f'Componente {index + 1}: {str(connected_components)}')
print(f'{len(self.connected_components)} componentes conectados') |
"""
dummy tests
"""
#============================ helpers =========================================
#============================ tests ===========================================
def test_dummy():
pass
|
# https://leetcode.com/problems/maximum-product-difference-between-two-pairs
class Solution:
def maxProductDifference(self, nums: List[int]) -> int:
nums = sorted(nums)
return (nums[-1] * nums[-2]) - (nums[0] * nums[1])
|
"""
Contains functions implementing the Levenshtein distance algorithm.
"""
def relative(a, b):
"""Returns the relative distance between two strings, in the range
[0-1] where 1 means total equality.
"""
d = distance(a,b)
longer = float(max((len(a), len(b))))
shorter = float(min((len(a), len(b))))
r = ((longer - d) / longer) * (shorter / longer)
return r
def distance(s, t):
"""Returns the Levenshtein edit distance between two strings."""
m, n = len(s), len(t)
d = [range(n+1)]
d += [[i] for i in range(1,m+1)]
for i in range(0,m):
for j in range(0,n):
cost = 1
if s[i] == t[j]: cost = 0
d[i+1].append(min(d[i][j+1]+1, # deletion
d[i+1][j]+1, # insertion
d[i][j]+cost) # substitution
)
return d[m][n]
|
# Space: O(n)
# Time: O(n)
class Solution:
def plusOne(self, digits):
temp = ''.join(map(lambda x: str(x), digits))
temp = int(temp) + 1
temp = list(str(temp))
return list(map(lambda x: int(x), temp))
|
#Explain your work
#Question 1
for x in range(a):
print(a) |
#!/usr/bin/python3
words = """art
hue
ink
oil
pen
wax
clay
draw
film
form
kiln
line
tone
tube
wood
batik
brush
carve
chalk
color
craft
easel
erase
frame
gesso
glass
glaze
image
latex
liner
media
mixed
model
mural
paint
paper
photo
print
quill
quilt
ruler
scale
shade
stone
style
tools
video
wheel
artist
bridge
canvas
chisel
crayon
create
depict
design
enamel
eraser
fresco
hammer
marble
marker
medium
mobile
mosaic
museum
pastel
pencil
poster
pounce
roller
sculpt
sketch
vellum
visual
acrylic
artwork
cartoon
carving
casting
collage
compass
drawing
engrave
etching
exhibit
gallery
gilding
gouache
painter
palette
pigment
portray
pottery
primary
realism
solvent
stained
stencil
tempera
textile
tsquare
varnish
woodcut
abstract
airbrush
artistic
blending
ceramics
charcoal
contrast
critique
decorate
graffiti
graphite
hatching
maquette
marbling
painting
portrait
printing
quilting
sculptor
seascape
template
animation
cloisonne
decoupage
encaustic
engraving
landscape
porcelain
portfolio
sculpture
secondary
stippling
undertone
assemblage
brightness
creativity
decorative
exhibition
illustrate
lithograph
paintbrush
photograph
proportion
sketchbook
turpentine
watercolor
waterscape
calligraphy
composition
masterpiece
perspective
architecture
glassblowing
illustration
installation
stonecutting
crosshatching
"""
all_valid_words = ()
start = 0
end = 0
for char in words :
# append substring to the end of valid words tuple
if char == "\n" :
all_valid_words = all_valid_words + (words[start:end], )
start = end + 1
end = end + 1
# increment end pointer to keep looking for the end of the word
else :
end = end + 1
#print(all_valid_words)
# example of successful lookup, yields one result "ink"
#tiles = "inka"
# example of no matches, yields zero results
#tiles = "dow"
tiles = "doasdflkjtewtasdflkjwerasdfzxcklvnmzwo"
found_words = ()
for word in all_valid_words :
all_letters_in_word = True
tiles_left = tiles
# check every letter in an art word
for letter in word:
# letter not in leftover tiles, so stop looking at remaining letters in word
if letter not in tiles_left :
all_letters_in_word = False
break
# update leftover tiles
else :
index = tiles_left.find(letter)
tiles_left = tiles_left[0:index] + tiles_left[index+1:len(tiles_left)]
# check why the inner for loop ended: break or found all letters?
if all_letters_in_word :
found_words = found_words + (word, )
#print(found_words)
for w in found_words :
print(w)
|
__version__ = "0.3.9"
__author__ = "Guinsly Mondésir"
sp_ask_school_dict = [
{
"school": {
"id": 1,
"queues": [
"toronto",
"toronto-mississauga",
"toronto-scarborough",
"toronto-st-george",
"toronto-st-george-proactive",
],
"suffix": ["_tor"],
"short_name": "toronto",
"full_name": "University of Toronto",
}
},
{
"school": {
"id": 2,
"queues": [],
"suffix": ["_int", "_int.fr"],
"short_name": "Scholars Portal - Mentees",
"full_name": "Scholars Portal - Mentees",
}
},
{
"school": {
"id": 3,
"queues": [
"western",
"western-fr",
"western-proactive",
"western-txt",
],
"suffix": ["_west", "_west.fr"],
"short_name": "Western",
"full_name": "University of Western Ontario",
}
},
{
"school": {
"id": 4,
"queues": [
"carleton-txt",
"carleton",
"carleton-access-services-txt",
"carleton-access-services",
],
"suffix": ["_car"],
"short_name": "Carleton",
"full_name": "Carleton University",
}
},
{
"school": {
"id": 5,
"queues": ["ryerson", "ryerson-proactive"],
"suffix": ["_rye"],
"short_name": "Ryerson",
"full_name": "Ryerson University",
}
},
{
"school": {
"id": 6,
"queues": ["laurentian", "laurentian-fr"],
"suffix": ["_lan", "_lan.fr"],
"short_name": "Laurentian",
"full_name": "Laurentian University",
}
},
{
"school": {
"id": 7,
"queues": ["queens"],
"suffix": ["_queens"],
"short_name": "Queen's",
"full_name": "Queen's university",
}
},
{
"school": {
"id": 8,
"queues": ["brock"],
"suffix": ["_brk"],
"short_name": "Brock",
"full_name": "Brock University",
}
},
{
"school": {
"id": 9,
"queues": ["guelph-humber", "guelph-humber-txt"],
"suffix": ["_guehum"],
"short_name": "Guelph-Humber",
"full_name": "University of Guelph-Humber",
}
},
{
"school": {
"id": 10,
"queues": ["guelph"],
"suffix": ["_gue"],
"short_name": "Guelph",
"full_name": "University of Guelph",
}
},
{
"school": {
"id": 12,
"queues": ["ontario-tech"],
"suffix": ["_ontech", "_uoit"],
"short_name": "Ontario Tech",
"full_name": "Ontario Tech University",
}
},
{
"school": {
"id": 13,
"queues": ["saintpaul", "saintpaul-fr"],
"suffix": ["_stp", "_stp.fr"],
"short_name": "Saint-Paul",
"full_name": "Saint-Paul University",
}
},
{
"school": {
"id": 14,
"queues": ["ocad"],
"suffix": ["_ocad"],
"short_name": "OCAD",
"full_name": "OCAD U",
}
},
{
"school": {
"id": 15,
"queues": ["lakehead", "lakehead-proactive"],
"suffix": ["_lake"],
"short_name": "Lakehead",
"full_name": "Lakehead university",
}
},
{
"school": {
"id": 16,
"queues": ["algoma", "algoma-fr", "algoma-proactive"],
"suffix": ["_alg"],
"short_name": "Algoma",
"full_name": "Algoma university",
}
},
{
"school": {
"id": 17,
"queues": ["mcmaster", "mcmaster-txt"],
"suffix": ["_mac"],
"short_name": "McMaster",
"full_name": "McMaster university",
}
},
{
"school": {
"id": 18,
"queues": ["york", "york-glendon", "york-glendon-fr", "york-txt"],
"suffix": ["_york", "_york.fr"],
"short_name": "York",
"full_name": "York university",
}
},
{
"school": {
"id": 19,
"queues": [
"scholars-portal",
"scholars-portal-txt",
"scholars portal",
"clavardez",
"clavardez-txt",
],
"suffix": ["_sp"],
"short_name": "Scholars Portal",
"full_name": "Scholars Portal",
}
},
{
"school": {
"id": 20,
"queues": ["ottawa", "ottawa-fr", "ottawa-fr-txt", "ottawa-txt"],
"suffix": ["_ott"],
"short_name": "Ottawa",
"full_name": "Ottawa University",
}
},
{
"school": {
"id": 21,
"queues": [
"practice-webinars",
"practice-webinars-fr",
"practice-webinars-txt",
],
"suffix": [],
"short_name": "Practice queue",
"full_name": "SP Practice Queue",
}
},
{
"school": {
"id": 22,
"queues": ["sp-always-offline"],
"suffix": [],
"short_name": "LibraryH3lp",
"full_name": "LibraryH3lp",
}
},
]
def find_school_by_operator_suffix(username):
"""from an username suffix find the short name of that School
Arguments:
username {str} -- suffix of the schoo i.e. nalini_tor
Returns:
str -- The short name of the school i.e. Toronto
"""
# print("This username :{0}".format(username))
if username is None:
return username
if "_" in username:
# print("_ found in {0}".format(username))
suffix = username.split("_")
try:
suffix = "_" + suffix[1]
except:
# print(username)
# breakpoint()
pass
# print("suffix:{0}".format(suffix))
for item in sp_ask_school_dict:
if suffix in item.get("school").get("suffix"):
# print(item.get('school').get('short_name') )
return item.get("school").get("short_name")
elif "admin" in username:
school = username.split("-")[0]
return school
else:
return "Unknown"
def find_queues_from_a_school_name(school):
if school is None:
return school
school = school.lower()
for item in sp_ask_school_dict:
if school == item.get("school").get("short_name").lower():
return item.get("school").get("queues")
return "Unknown"
def get_shortname_by_full_school_name(school):
"""from a University Full name find the shortname of that School
Arguments:
school {str} -- school (i.e. Full name)
Returns:
str -- The short name of the school i.e. Toronto
"""
if school is None:
return school
school = school.lower()
for item in sp_ask_school_dict:
if school == item.get("school").get("full_name"):
return item.get("school").get("short_name")
def find_school_by_queue_or_profile_name(queue):
"""from the name of a queue find the full name of that School
Arguments:
queue {str} -- queue/service i.e. western-proactive
Returns:
str -- The full name of the school i.e. Toronto
"""
if queue is None:
return queue
for item in sp_ask_school_dict:
if queue in item.get("school").get("queues"):
return item.get("school").get("short_name")
return "Unknown"
def find_school_abbr_by_queue_or_profile_name(queue):
"""from a queue name or the name of a Queue Profile find the short name of that School
Arguments:
queue {str} -- queue/service i.e. ryerson-proactive
Returns:
str -- The short name of the school i.e. Toronto
"""
if queue is None:
return queue
for item in sp_ask_school_dict:
if queue in item.get("school").get("queues"):
return item.get("school").get("short_name")
return "Unknown"
HTF_schools = [
"Brock University",
"Carleton University",
"Laurentian University",
"University of Toronto",
"Ontario Tech University",
"Western Ontario University",
"Queens University",
"Ryerson University",
]
def find_queue_by_criteria(criteria=None):
"""[summary]
Args:
criteria ([type], optional): [description]. Defaults to None.
Returns:
[type]: [description]
"""
queue_list = list()
for item in sp_ask_school_dict:
for element in item.get("queues"):
if criteria in element:
queue_list.append(element)
return queue_list
FRENCH_QUEUES = [
"algoma-fr",
"clavardez",
"laurentian-fr",
"ottawa-fr",
"saintpaul-fr",
"western-fr",
"york-glendon-fr",
]
SMS_QUEUES = [
"carleton-txt",
"clavardez-txt",
"guelph-humber-txt",
"mcmaster-txt",
"ottawa-fr-txt",
"ottawa-txt",
"scholars-portal-txt",
"western-txt",
"york-txt",
"txt-carleton-access-services",
"carleton-access-services-txt",
]
PRACTICE_QUEUES = ["practice-webinars", "practice-webinars-fr", "practice-webinars-txt"]
def find_routing_model_by_profile_name(university_name):
"""[summary]
Args:
university_name ([type]): [description]
Returns:
[type]: [description]
"""
if university_name is None:
return university_name
if university_name in HTF_schools:
return "HTF"
else:
return "FLAT"
if __name__ == "__main__":
FRENCH_QUEUES = find_queue_by_criteria(criteria="-fr")
SMS_QUEUES = find_queue_by_criteria(criteria="-txt")
PRACTICE_QUEUES = find_queue_by_criteria(criteria="practice")
|
# Licensed under an MIT open source license - see LICENSE
def generate_saa_list(scouseobject):
"""
Returns a list constaining all spectral averaging areas.
Parameters
----------
scouseobject : Instance of the scousepy class
"""
saa_list=[]
for i in range(len(scouseobject.wsaa)):
saa_dict = scouseobject.saa_dict[i]
#for j in range(len(saa_dict.keys())):
for key in saa_dict.keys():
# get the relavent SAA
#SAA = saa_dict[j]
SAA = saa_dict[key]
if SAA.to_be_fit:
saa_list.append([SAA.index, i])
return saa_list
|
class Solution:
def findErrorNums(self, nums: List[int]) -> List[int]:
n = len(nums)
tmp = [0]*n
dup = 0
# 先进行桶排序
for i in range(n):
ind = nums[i]-1
value = nums[i]
if tmp[ind] != 0:
dup = value
else:
tmp[ind]= value
# 找出为0的
for i in range(n):
if tmp[i] == 0:
return [dup,i+1] |
class Sentence:
def __init__(self):
self._tokens = []
self._metadata = []
def append_metadata(self, data):
self._metadata.append(data)
def append_token(self, token):
self._tokens.append(token)
def __bool__(self):
return len(self._tokens) > 0
def __len__(self):
return len(self._tokens)
def __iter__(self):
for tok in self._tokens:
yield tok
def __getitem__(self, idx):
return self._tokens[idx]
@property
def metadata(self):
return self._metadata
def to_string(self, col_transform=None):
s = [f"# {m}" for m in self._metadata]
s += [t.to_string(transform=col_transform) for t in self._tokens]
return "\n".join(s)
|
class AppSettings:
allow_extra_fields = True
types = {
# Slack
'domain': str,
# come on, Okta, be consistent...
# T-Sheets
'subDomain': str,
# Engagedly
'acsUrl': str, # ACS URL
'audRestriction': str, # Entity ID
# JIRA
'baseURL': str, # Your JIRA URL
# ADP Employee Self Service Portal
'companyName': str, # Company Name
'url': str,
'requestIntegration': bool,
'authURL': str,
'usernameField': str,
'passwordField': str,
'buttonField': str,
'extraFieldSelector': str,
'extraFieldValue': str,
'optionalField1': str,
'optionalField1Value': str,
'optionalField2': str,
'optionalField2Value': str,
'optionalField3': str,
'optionalField3Value': str
}
def __init__(self):
# The URL of the login page for this app
self.url = None # str
self.domain = None # str
self.subDomain = None # str
# Would you like Okta to add an integration for this app?
self.requestIntegration = None # bool
# The URL of the authenticating site for this app
self.authURL = None # str
# CSS selector for the username field in the login form
self.usernameField = None # str
# CSS selector for the password field in the login form
self.passwordField = None # str
# CSS selector for the login button in the login form
self.buttonField = None # str
# CSS selector for the extra field in the form
self.extraFieldSelector = None # str
# Value for extra field form field
self.extraFieldValue = None # str
# Name of the optional parameter in the login form
self.optionalField1 = None # str
# Name of the optional value in the login form
self.optionalField1Value = None # str
# Name of the optional parameter in the login form
self.optionalField2 = None # str
# Name of the optional value in the login form
self.optionalField2Value = None # str
# Name of the optional parameter in the login form
self.optionalField3 = None # str
# Name of the optional value in the login form
self.optionalField3Value = None # str
|
N, K = map(int, input().split())
S = list(input())
Y = 0
if N == 1:
print(0)
exit(0)
if S[0] == 'L':
Y += 1
if S[N-1] == 'R':
Y += 1
count = 0
X = 0
for i in range(N-1):
if S[i] == 'R' and S[i+1] == 'L':
X += 1
if S[i] == S[i+1]:
count += 1
count += K*2
print(min(N-1, count))
|
#
# PySNMP MIB module CTRON-ROUTERS-INTERNAL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-ROUTERS-INTERNAL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:15:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ModuleIdentity, IpAddress, Integer32, Gauge32, iso, ObjectIdentity, Counter32, NotificationType, enterprises, TimeTicks, Bits, Counter64, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "IpAddress", "Integer32", "Gauge32", "iso", "ObjectIdentity", "Counter32", "NotificationType", "enterprises", "TimeTicks", "Bits", "Counter64", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
cabletron = MibIdentifier((1, 3, 6, 1, 4, 1, 52))
mibs = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4))
ctron = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 1))
ctronExp = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2))
ctronRouterExp = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2))
ctNetwork = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 1, 3))
nwRouter = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2))
nwRtrTemp = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99))
nwRtrTemp1 = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2))
nwRtrTemp2 = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2, 2))
nwRtrSoftReset = MibScalar((1, 3, 6, 1, 4, 1, 52, 4, 2, 2, 2, 99, 2, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0))).clone(namedValues=NamedValues(("reset", 0)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwRtrSoftReset.setStatus('mandatory')
mibBuilder.exportSymbols("CTRON-ROUTERS-INTERNAL-MIB", ctron=ctron, ctronRouterExp=ctronRouterExp, ctronExp=ctronExp, nwRtrTemp2=nwRtrTemp2, cabletron=cabletron, nwRtrTemp1=nwRtrTemp1, nwRtrTemp=nwRtrTemp, nwRtrSoftReset=nwRtrSoftReset, mibs=mibs, nwRouter=nwRouter, ctNetwork=ctNetwork)
|
# -*- coding: utf-8 -*-
class Solution:
def distributeCandies(self, candies):
return min(len(candies) / 2, len(set(candies)))
if __name__ == '__main__':
solution = Solution()
assert 3 == solution.distributeCandies([1, 1, 2, 2, 3, 3])
assert 2 == solution.distributeCandies([1, 1, 2, 3])
|
#author: n01
"""
Useful termcolor attributes (attrs for short)
@Usage: colored("stringa", COLOR, attrs=ATTRIBUTE)
These attributes are list with a single element
to create longer list just add the attributes together
e.g. BLINK + BOLD gives you ['blink', 'bold']
"""
BLINK = ["blink"]
BOLD = ["bold"]
DARK = ["dark"]
UNDERLINE = ["underline"]
REVERSE = ["reverse"]
CONCEALED = ["concealed"]
NO_ATTRS = [] #Empty list when you don't want effects to be applied
ATTRS = [BLINK, BOLD, DARK, UNDERLINE, REVERSE, CONCEALED, NO_ATTRS]
|
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
def can_paginate(operation_name=None):
"""
Check if an operation can be paginated.
:type operation_name: string
:param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo').
"""
pass
def create_notification_rule(Name=None, EventTypeIds=None, Resource=None, Targets=None, DetailType=None, ClientRequestToken=None, Tags=None, Status=None):
"""
Creates a notification rule for a resource. The rule specifies the events you want notifications about and the targets (such as SNS topics) where you want to receive them.
See also: AWS API Documentation
Exceptions
:example: response = client.create_notification_rule(
Name='string',
EventTypeIds=[
'string',
],
Resource='string',
Targets=[
{
'TargetType': 'string',
'TargetAddress': 'string'
},
],
DetailType='BASIC'|'FULL',
ClientRequestToken='string',
Tags={
'string': 'string'
},
Status='ENABLED'|'DISABLED'
)
:type Name: string
:param Name: [REQUIRED]\nThe name for the notification rule. Notifictaion rule names must be unique in your AWS account.\n
:type EventTypeIds: list
:param EventTypeIds: [REQUIRED]\nA list of event types associated with this notification rule. For a list of allowed events, see EventTypeSummary .\n\n(string) --\n\n
:type Resource: string
:param Resource: [REQUIRED]\nThe Amazon Resource Name (ARN) of the resource to associate with the notification rule. Supported resources include pipelines in AWS CodePipeline, repositories in AWS CodeCommit, and build projects in AWS CodeBuild.\n
:type Targets: list
:param Targets: [REQUIRED]\nA list of Amazon Resource Names (ARNs) of SNS topics to associate with the notification rule.\n\n(dict) --Information about the SNS topics associated with a notification rule.\n\nTargetType (string) --The target type. Can be an Amazon SNS topic.\n\nTargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic.\n\n\n\n\n
:type DetailType: string
:param DetailType: [REQUIRED]\nThe level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.\n
:type ClientRequestToken: string
:param ClientRequestToken: A unique, client-generated idempotency token that, when provided in a request, ensures the request cannot be repeated with a changed parameter. If a request with the same parameters is received and a token is included, the request returns information about the initial request that used that token.\n\nNote\nThe AWS SDKs prepopulate client request tokens. If you are using an AWS SDK, an idempotency token is created for you.\n\nThis field is autopopulated if not provided.\n
:type Tags: dict
:param Tags: A list of tags to apply to this notification rule. Key names cannot start with 'aws'.\n\n(string) --\n(string) --\n\n\n\n
:type Status: string
:param Status: The status of the notification rule. The default value is ENABLED. If the status is set to DISABLED, notifications aren\'t sent for the notification rule.
:rtype: dict
ReturnsResponse Syntax
{
'Arn': 'string'
}
Response Structure
(dict) --
Arn (string) --
The Amazon Resource Name (ARN) of the notification rule.
Exceptions
CodeStarNotifications.Client.exceptions.ResourceAlreadyExistsException
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.LimitExceededException
CodeStarNotifications.Client.exceptions.ConfigurationException
CodeStarNotifications.Client.exceptions.ConcurrentModificationException
CodeStarNotifications.Client.exceptions.AccessDeniedException
:return: {
'Arn': 'string'
}
:returns:
CodeStarNotifications.Client.exceptions.ResourceAlreadyExistsException
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.LimitExceededException
CodeStarNotifications.Client.exceptions.ConfigurationException
CodeStarNotifications.Client.exceptions.ConcurrentModificationException
CodeStarNotifications.Client.exceptions.AccessDeniedException
"""
pass
def delete_notification_rule(Arn=None):
"""
Deletes a notification rule for a resource.
See also: AWS API Documentation
Exceptions
:example: response = client.delete_notification_rule(
Arn='string'
)
:type Arn: string
:param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule you want to delete.\n
:rtype: dict
ReturnsResponse Syntax{
'Arn': 'string'
}
Response Structure
(dict) --
Arn (string) --The Amazon Resource Name (ARN) of the deleted notification rule.
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.LimitExceededException
CodeStarNotifications.Client.exceptions.ConcurrentModificationException
:return: {
'Arn': 'string'
}
"""
pass
def delete_target(TargetAddress=None, ForceUnsubscribeAll=None):
"""
Deletes a specified target for notifications.
See also: AWS API Documentation
Exceptions
:example: response = client.delete_target(
TargetAddress='string',
ForceUnsubscribeAll=True|False
)
:type TargetAddress: string
:param TargetAddress: [REQUIRED]\nThe Amazon Resource Name (ARN) of the SNS topic to delete.\n
:type ForceUnsubscribeAll: boolean
:param ForceUnsubscribeAll: A Boolean value that can be used to delete all associations with this SNS topic. The default value is FALSE. If set to TRUE, all associations between that target and every notification rule in your AWS account are deleted.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
:return: {}
:returns:
(dict) --
"""
pass
def describe_notification_rule(Arn=None):
"""
Returns information about a specified notification rule.
See also: AWS API Documentation
Exceptions
:example: response = client.describe_notification_rule(
Arn='string'
)
:type Arn: string
:param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule.\n
:rtype: dict
ReturnsResponse Syntax{
'Arn': 'string',
'Name': 'string',
'EventTypes': [
{
'EventTypeId': 'string',
'ServiceName': 'string',
'EventTypeName': 'string',
'ResourceType': 'string'
},
],
'Resource': 'string',
'Targets': [
{
'TargetAddress': 'string',
'TargetType': 'string',
'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED'
},
],
'DetailType': 'BASIC'|'FULL',
'CreatedBy': 'string',
'Status': 'ENABLED'|'DISABLED',
'CreatedTimestamp': datetime(2015, 1, 1),
'LastModifiedTimestamp': datetime(2015, 1, 1),
'Tags': {
'string': 'string'
}
}
Response Structure
(dict) --
Arn (string) --The Amazon Resource Name (ARN) of the notification rule.
Name (string) --The name of the notification rule.
EventTypes (list) --A list of the event types associated with the notification rule.
(dict) --Returns information about an event that has triggered a notification rule.
EventTypeId (string) --The system-generated ID of the event.
ServiceName (string) --The name of the service for which the event applies.
EventTypeName (string) --The name of the event.
ResourceType (string) --The resource type of the event.
Resource (string) --The Amazon Resource Name (ARN) of the resource associated with the notification rule.
Targets (list) --A list of the SNS topics associated with the notification rule.
(dict) --Information about the targets specified for a notification rule.
TargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic.
TargetType (string) --The type of the target (for example, SNS).
TargetStatus (string) --The status of the target.
DetailType (string) --The level of detail included in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
CreatedBy (string) --The name or email alias of the person who created the notification rule.
Status (string) --The status of the notification rule. Valid statuses are on (sending notifications) or off (not sending notifications).
CreatedTimestamp (datetime) --The date and time the notification rule was created, in timestamp format.
LastModifiedTimestamp (datetime) --The date and time the notification rule was most recently updated, in timestamp format.
Tags (dict) --The tags associated with the notification rule.
(string) --
(string) --
Exceptions
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ValidationException
:return: {
'Arn': 'string',
'Name': 'string',
'EventTypes': [
{
'EventTypeId': 'string',
'ServiceName': 'string',
'EventTypeName': 'string',
'ResourceType': 'string'
},
],
'Resource': 'string',
'Targets': [
{
'TargetAddress': 'string',
'TargetType': 'string',
'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED'
},
],
'DetailType': 'BASIC'|'FULL',
'CreatedBy': 'string',
'Status': 'ENABLED'|'DISABLED',
'CreatedTimestamp': datetime(2015, 1, 1),
'LastModifiedTimestamp': datetime(2015, 1, 1),
'Tags': {
'string': 'string'
}
}
:returns:
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ValidationException
"""
pass
def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):
"""
Generate a presigned url given a client, its method, and arguments
:type ClientMethod: string
:param ClientMethod: The client method to presign for
:type Params: dict
:param Params: The parameters normally passed to\nClientMethod.
:type ExpiresIn: int
:param ExpiresIn: The number of seconds the presigned url is valid\nfor. By default it expires in an hour (3600 seconds)
:type HttpMethod: string
:param HttpMethod: The http method to use on the generated url. By\ndefault, the http method is whatever is used in the method\'s model.
"""
pass
def get_paginator(operation_name=None):
"""
Create a paginator for an operation.
:type operation_name: string
:param operation_name: The operation name. This is the same name\nas the method name on the client. For example, if the\nmethod name is create_foo, and you\'d normally invoke the\noperation as client.create_foo(**kwargs), if the\ncreate_foo operation can be paginated, you can use the\ncall client.get_paginator('create_foo').
:rtype: L{botocore.paginate.Paginator}
ReturnsA paginator object.
"""
pass
def get_waiter(waiter_name=None):
"""
Returns an object that can wait for some condition.
:type waiter_name: str
:param waiter_name: The name of the waiter to get. See the waiters\nsection of the service docs for a list of available waiters.
:rtype: botocore.waiter.Waiter
"""
pass
def list_event_types(Filters=None, NextToken=None, MaxResults=None):
"""
Returns information about the event types available for configuring notifications.
See also: AWS API Documentation
Exceptions
:example: response = client.list_event_types(
Filters=[
{
'Name': 'RESOURCE_TYPE'|'SERVICE_NAME',
'Value': 'string'
},
],
NextToken='string',
MaxResults=123
)
:type Filters: list
:param Filters: The filters to use to return information by service or resource type.\n\n(dict) --Information about a filter to apply to the list of returned event types. You can filter by resource type or service name.\n\nName (string) -- [REQUIRED]The system-generated name of the filter type you want to filter by.\n\nValue (string) -- [REQUIRED]The name of the resource type (for example, pipeline) or service name (for example, CodePipeline) that you want to filter by.\n\n\n\n\n
:type NextToken: string
:param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results.
:type MaxResults: integer
:param MaxResults: A non-negative integer used to limit the number of returned results. The default number is 50. The maximum number of results that can be returned is 100.
:rtype: dict
ReturnsResponse Syntax
{
'EventTypes': [
{
'EventTypeId': 'string',
'ServiceName': 'string',
'EventTypeName': 'string',
'ResourceType': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
EventTypes (list) --
Information about each event, including service name, resource type, event ID, and event name.
(dict) --
Returns information about an event that has triggered a notification rule.
EventTypeId (string) --
The system-generated ID of the event.
ServiceName (string) --
The name of the service for which the event applies.
EventTypeName (string) --
The name of the event.
ResourceType (string) --
The resource type of the event.
NextToken (string) --
An enumeration token that can be used in a request to return the next batch of the results.
Exceptions
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
:return: {
'EventTypes': [
{
'EventTypeId': 'string',
'ServiceName': 'string',
'EventTypeName': 'string',
'ResourceType': 'string'
},
],
'NextToken': 'string'
}
:returns:
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
"""
pass
def list_notification_rules(Filters=None, NextToken=None, MaxResults=None):
"""
Returns a list of the notification rules for an AWS account.
See also: AWS API Documentation
Exceptions
:example: response = client.list_notification_rules(
Filters=[
{
'Name': 'EVENT_TYPE_ID'|'CREATED_BY'|'RESOURCE'|'TARGET_ADDRESS',
'Value': 'string'
},
],
NextToken='string',
MaxResults=123
)
:type Filters: list
:param Filters: The filters to use to return information by service or resource type. For valid values, see ListNotificationRulesFilter .\n\nNote\nA filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.\n\n\n(dict) --Information about a filter to apply to the list of returned notification rules. You can filter by event type, owner, resource, or target.\n\nName (string) -- [REQUIRED]The name of the attribute you want to use to filter the returned notification rules.\n\nValue (string) -- [REQUIRED]The value of the attribute you want to use to filter the returned notification rules. For example, if you specify filtering by RESOURCE in Name, you might specify the ARN of a pipeline in AWS CodePipeline for the value.\n\n\n\n\n
:type NextToken: string
:param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results.
:type MaxResults: integer
:param MaxResults: A non-negative integer used to limit the number of returned results. The maximum number of results that can be returned is 100.
:rtype: dict
ReturnsResponse Syntax
{
'NextToken': 'string',
'NotificationRules': [
{
'Id': 'string',
'Arn': 'string'
},
]
}
Response Structure
(dict) --
NextToken (string) --
An enumeration token that can be used in a request to return the next batch of the results.
NotificationRules (list) --
The list of notification rules for the AWS account, by Amazon Resource Name (ARN) and ID.
(dict) --
Information about a specified notification rule.
Id (string) --
The unique ID of the notification rule.
Arn (string) --
The Amazon Resource Name (ARN) of the notification rule.
Exceptions
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
:return: {
'NextToken': 'string',
'NotificationRules': [
{
'Id': 'string',
'Arn': 'string'
},
]
}
:returns:
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
"""
pass
def list_tags_for_resource(Arn=None):
"""
Returns a list of the tags associated with a notification rule.
See also: AWS API Documentation
Exceptions
:example: response = client.list_tags_for_resource(
Arn='string'
)
:type Arn: string
:param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) for the notification rule.\n
:rtype: dict
ReturnsResponse Syntax{
'Tags': {
'string': 'string'
}
}
Response Structure
(dict) --
Tags (dict) --The tags associated with the notification rule.
(string) --
(string) --
Exceptions
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ValidationException
:return: {
'Tags': {
'string': 'string'
}
}
:returns:
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ValidationException
"""
pass
def list_targets(Filters=None, NextToken=None, MaxResults=None):
"""
Returns a list of the notification rule targets for an AWS account.
See also: AWS API Documentation
Exceptions
:example: response = client.list_targets(
Filters=[
{
'Name': 'TARGET_TYPE'|'TARGET_ADDRESS'|'TARGET_STATUS',
'Value': 'string'
},
],
NextToken='string',
MaxResults=123
)
:type Filters: list
:param Filters: The filters to use to return information by service or resource type. Valid filters include target type, target address, and target status.\n\nNote\nA filter with the same name can appear more than once when used with OR statements. Filters with different names should be applied with AND statements.\n\n\n(dict) --Information about a filter to apply to the list of returned targets. You can filter by target type, address, or status. For example, to filter results to notification rules that have active Amazon SNS topics as targets, you could specify a ListTargetsFilter Name as TargetType and a Value of SNS, and a Name of TARGET_STATUS and a Value of ACTIVE.\n\nName (string) -- [REQUIRED]The name of the attribute you want to use to filter the returned targets.\n\nValue (string) -- [REQUIRED]The value of the attribute you want to use to filter the returned targets. For example, if you specify SNS for the Target type, you could specify an Amazon Resource Name (ARN) for a topic as the value.\n\n\n\n\n
:type NextToken: string
:param NextToken: An enumeration token that, when provided in a request, returns the next batch of the results.
:type MaxResults: integer
:param MaxResults: A non-negative integer used to limit the number of returned results. The maximum number of results that can be returned is 100.
:rtype: dict
ReturnsResponse Syntax
{
'Targets': [
{
'TargetAddress': 'string',
'TargetType': 'string',
'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Targets (list) --
The list of notification rule targets.
(dict) --
Information about the targets specified for a notification rule.
TargetAddress (string) --
The Amazon Resource Name (ARN) of the SNS topic.
TargetType (string) --
The type of the target (for example, SNS).
TargetStatus (string) --
The status of the target.
NextToken (string) --
An enumeration token that can be used in a request to return the next batch of results.
Exceptions
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
:return: {
'Targets': [
{
'TargetAddress': 'string',
'TargetType': 'string',
'TargetStatus': 'PENDING'|'ACTIVE'|'UNREACHABLE'|'INACTIVE'|'DEACTIVATED'
},
],
'NextToken': 'string'
}
:returns:
CodeStarNotifications.Client.exceptions.InvalidNextTokenException
CodeStarNotifications.Client.exceptions.ValidationException
"""
pass
def subscribe(Arn=None, Target=None, ClientRequestToken=None):
"""
Creates an association between a notification rule and an SNS topic so that the associated target can receive notifications when the events described in the rule are triggered.
See also: AWS API Documentation
Exceptions
:example: response = client.subscribe(
Arn='string',
Target={
'TargetType': 'string',
'TargetAddress': 'string'
},
ClientRequestToken='string'
)
:type Arn: string
:param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule for which you want to create the association.\n
:type Target: dict
:param Target: [REQUIRED]\nInformation about the SNS topics associated with a notification rule.\n\nTargetType (string) --The target type. Can be an Amazon SNS topic.\n\nTargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic.\n\n\n
:type ClientRequestToken: string
:param ClientRequestToken: An enumeration token that, when provided in a request, returns the next batch of the results.
:rtype: dict
ReturnsResponse Syntax
{
'Arn': 'string'
}
Response Structure
(dict) --
Arn (string) --
The Amazon Resource Name (ARN) of the notification rule for which you have created assocations.
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
:return: {
'Arn': 'string'
}
:returns:
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
"""
pass
def tag_resource(Arn=None, Tags=None):
"""
Associates a set of provided tags with a notification rule.
See also: AWS API Documentation
Exceptions
:example: response = client.tag_resource(
Arn='string',
Tags={
'string': 'string'
}
)
:type Arn: string
:param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule to tag.\n
:type Tags: dict
:param Tags: [REQUIRED]\nThe list of tags to associate with the resource. Tag key names cannot start with 'aws'.\n\n(string) --\n(string) --\n\n\n\n
:rtype: dict
ReturnsResponse Syntax
{
'Tags': {
'string': 'string'
}
}
Response Structure
(dict) --
Tags (dict) --
The list of tags associated with the resource.
(string) --
(string) --
Exceptions
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ConcurrentModificationException
:return: {
'Tags': {
'string': 'string'
}
}
:returns:
(string) --
(string) --
"""
pass
def unsubscribe(Arn=None, TargetAddress=None):
"""
Removes an association between a notification rule and an Amazon SNS topic so that subscribers to that topic stop receiving notifications when the events described in the rule are triggered.
See also: AWS API Documentation
Exceptions
:example: response = client.unsubscribe(
Arn='string',
TargetAddress='string'
)
:type Arn: string
:param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule.\n
:type TargetAddress: string
:param TargetAddress: [REQUIRED]\nThe ARN of the SNS topic to unsubscribe from the notification rule.\n
:rtype: dict
ReturnsResponse Syntax
{
'Arn': 'string'
}
Response Structure
(dict) --
Arn (string) --
The Amazon Resource Name (ARN) of the the notification rule from which you have removed a subscription.
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
:return: {
'Arn': 'string'
}
:returns:
CodeStarNotifications.Client.exceptions.ValidationException
"""
pass
def untag_resource(Arn=None, TagKeys=None):
"""
Removes the association between one or more provided tags and a notification rule.
See also: AWS API Documentation
Exceptions
:example: response = client.untag_resource(
Arn='string',
TagKeys=[
'string',
]
)
:type Arn: string
:param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule from which to remove the tags.\n
:type TagKeys: list
:param TagKeys: [REQUIRED]\nThe key names of the tags to remove.\n\n(string) --\n\n
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ConcurrentModificationException
:return: {}
:returns:
(dict) --
"""
pass
def update_notification_rule(Arn=None, Name=None, Status=None, EventTypeIds=None, Targets=None, DetailType=None):
"""
Updates a notification rule for a resource. You can change the events that trigger the notification rule, the status of the rule, and the targets that receive the notifications.
See also: AWS API Documentation
Exceptions
:example: response = client.update_notification_rule(
Arn='string',
Name='string',
Status='ENABLED'|'DISABLED',
EventTypeIds=[
'string',
],
Targets=[
{
'TargetType': 'string',
'TargetAddress': 'string'
},
],
DetailType='BASIC'|'FULL'
)
:type Arn: string
:param Arn: [REQUIRED]\nThe Amazon Resource Name (ARN) of the notification rule.\n
:type Name: string
:param Name: The name of the notification rule.
:type Status: string
:param Status: The status of the notification rule. Valid statuses include enabled (sending notifications) or disabled (not sending notifications).
:type EventTypeIds: list
:param EventTypeIds: A list of event types associated with this notification rule.\n\n(string) --\n\n
:type Targets: list
:param Targets: The address and type of the targets to receive notifications from this notification rule.\n\n(dict) --Information about the SNS topics associated with a notification rule.\n\nTargetType (string) --The target type. Can be an Amazon SNS topic.\n\nTargetAddress (string) --The Amazon Resource Name (ARN) of the SNS topic.\n\n\n\n\n
:type DetailType: string
:param DetailType: The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created.
:rtype: dict
ReturnsResponse Syntax
{}
Response Structure
(dict) --
Exceptions
CodeStarNotifications.Client.exceptions.ValidationException
CodeStarNotifications.Client.exceptions.ResourceNotFoundException
:return: {}
:returns:
(dict) --
"""
pass
|
"""
Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that
occur more than once in the input string. The input string can be assumed to contain only alphabets
(both uppercase and lowercase) and numeric digits.
Example
"abcde" -> 0 # no characters repeats more than once
"aabbcde" -> 2 # 'a' and 'b'
"aabBcde" -> 2 # 'a' occurs twice and 'b' twice (`b` and `B`)
"indivisibility" -> 1 # 'i' occurs six times
"Indivisibilities" -> 2 # 'i' occurs seven times and 's' occurs twice
"aA11" -> 2 # 'a' and '1'
"ABBA" -> 2 # 'A' and 'B' each occur twice
"""
def duplicate_count(text: str) -> int:
"""Counts amount of duplicates in a text.
Examples:
>>> assert duplicate_count("abcde") == 0
>>> assert duplicate_count("abcdea") == 1
>>> assert duplicate_count("indivisibility") == 1
"""
return len(
set(item for item in text.lower() if text.lower().count(item) > 1)
)
if __name__ == "__main__":
print(duplicate_count("abcde"))
|
#
# PySNMP MIB module ELTEX-MES-IP (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-IP
# Produced by pysmi-0.3.4 at Wed May 1 13:00:06 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection")
eltMes, = mibBuilder.importSymbols("ELTEX-MES", "eltMes")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Bits, Counter64, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, NotificationType, MibIdentifier, Gauge32, IpAddress, Counter32, TimeTicks, Unsigned32, ObjectIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Counter64", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "NotificationType", "MibIdentifier", "Gauge32", "IpAddress", "Counter32", "TimeTicks", "Unsigned32", "ObjectIdentity", "Integer32")
TextualConvention, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString")
eltMesIpSpec = ModuleIdentity((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91))
eltMesIpSpec.setRevisions(('2006-06-22 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: eltMesIpSpec.setRevisionsDescriptions(('Initial version of this MIB.',))
if mibBuilder.loadTexts: eltMesIpSpec.setLastUpdated('201402120000Z')
if mibBuilder.loadTexts: eltMesIpSpec.setOrganization('Eltex Enterprise Co, Ltd.')
if mibBuilder.loadTexts: eltMesIpSpec.setContactInfo('www.eltex.nsk.ru')
if mibBuilder.loadTexts: eltMesIpSpec.setDescription('The private MIB module definition for IP MIB.')
eltMesOspf = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 1))
eltMesIcmpSpec = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2))
eltIpIcmpPacketTable = MibTable((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1), ).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltIpIcmpPacketTable.setStatus('current')
if mibBuilder.loadTexts: eltIpIcmpPacketTable.setDescription('This table controls the ability to send ICMP packets.')
eltIpIcmpPacketEntry = MibTableRow((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: eltIpIcmpPacketEntry.setStatus('current')
if mibBuilder.loadTexts: eltIpIcmpPacketEntry.setDescription('This entry controls the ability of interface to send ICMP packets.')
eltIpIcmpPacketUnreachableSendEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 2, 1, 1, 2), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltIpIcmpPacketUnreachableSendEnable.setStatus('current')
if mibBuilder.loadTexts: eltIpIcmpPacketUnreachableSendEnable.setDescription('ICMP Destination Unreachable packets sending is enabled or not on this interface.')
eltMesArpSpec = MibIdentifier((1, 3, 6, 1, 4, 1, 35265, 1, 23, 91, 3))
mibBuilder.exportSymbols("ELTEX-MES-IP", eltIpIcmpPacketEntry=eltIpIcmpPacketEntry, PYSNMP_MODULE_ID=eltMesIpSpec, eltMesOspf=eltMesOspf, eltIpIcmpPacketUnreachableSendEnable=eltIpIcmpPacketUnreachableSendEnable, eltMesIcmpSpec=eltMesIcmpSpec, eltMesArpSpec=eltMesArpSpec, eltMesIpSpec=eltMesIpSpec, eltIpIcmpPacketTable=eltIpIcmpPacketTable)
|
def print_full_name(a, b):
first_name = a
last_name = b
print("Hello", first_name, last_name + "!", "You just delved into python.") |
#-*- coding:utf-8 _*-
"""
@author:charlesXu
@file: cws_rest_view.py
@desc: 分词和词性标注接口
@time: 2019/05/10
"""
|
opt = {
# LRC1000.0
'a9a.LRC1000.0': 1.05049605396498e+07, # from TRON
'a9a.bias.LRC1000.0': 1.05049602719930e+07, # from TRON
'covtype.libsvm.binary.LRC1000.0': 2.98341912891832e+08, # from nheavy
'covtype.libsvm.binary.bias.LRC1000.0': 2.98341823726758e+08, # from nheavy
'epsilon_normalized.LRC1000.0': 1.00427474936523e+08, # from TRON
'epsilon_normalized.bias.LRC1000.0': 1.00427449600054e+08, # from TRON
'kddb.LRC1000.0': 4.08148700057166e+08, # from TRON
'news20.binary.LRC1000.0': 1.67512789306119e+05, # from TRON
'news20.binary.bias.LRC1000.0': 1.59090734028768e+05, # from lbfgs30
'rcv1_test.binary.LRC1000.0': 2.48883056430015e+07, # from TRON
'rcv1_test.binary.bias.LRC1000.0': 2.35068023749895e+07, # from TRON
'url_combined.LRC1000.0': 7.05526203844106e+05, # from TRON
'url_combined.bias.LRC1000.0': 7.06395486688979e+05, # from NEWTON
'webspam_wc_normalized_trigram.svm.LRC1000.0': 1.56134897696324e+06, # from TRON
'webspam_wc_normalized_trigram.svm.bias.LRC1000.0': 1.56017686789724e+06, # from NEWTON
# LRC0.001
'a9a.LRC0.001': 1.34375185890165e+01, # from nheavy
'a9a.bias.LRC0.001': 1.34061168927057e+01, # from bfgs
'covtype.libsvm.binary.LRC0.001': 3.19108125442130e+02, # from TRON
'covtype.libsvm.binary.bias.LRC0.001': 3.19103481880759e+02, # from TRON
'epsilon_normalized.LRC0.001': 2.64083003605455e+02, # from lbfgs10
'epsilon_normalized.bias.LRC0.001': 2.64082952640341e+02, # from NEWTON
'kddb.LRC0.001': 6.31433624618391e+03, # from TRON
'kddb.bias.LRC0.001': 6.27837629997689e+03, # from TRON
'news20.binary.LRC0.001': 1.37832503340415e+01, # from nheavy
'news20.binary.bias.LRC0.001': 1.37831635992529e+01, # from nheavy
'rcv1_test.binary.LRC0.001': 3.54711979510507e+02, # from nheavy
'rcv1_test.binary.bias.LRC0.001': 3.54663725022122e+02, # from TRON
'url_combined.LRC0.001': 2.07075452491185e+02, # from NEWTON
'url_combined.bias.LRC0.001': 2.07044274842050e+02, # from NEWTON
'webspam_wc_normalized_trigram.svm.LRC0.001': 1.41690797007256e+02, # from NEWTON
'webspam_wc_normalized_trigram.svm.bias.LRC0.001': 1.37953204389683e+02, # from NEWTON
# LRC1
'a9a.LRC1': 1.05295625846396e+04, # from TRON
'a9a.bias.LRC1': 1.05293114042444e+04, # from NEWTON
'covtype.libsvm.binary.LRC1': 2.98569903150000e+05, # from other dimension...
'covtype.libsvm.binary.bias.LRC1': 2.98487492095578e+05, # from nheavy
'epsilon_normalized.LRC1': 1.12870956626209e+05, # from TRON
'epsilon_normalized.bias.LRC1': 1.12870944904513e+05, # from TRON
'kddb.LRC1': 3.52829643487702e+06, # from TRON
'kddb.bias.LRC1': 3.52823063256860e+06, # from TRON
'news20.binary.LRC1': 6.05311970010801e+03, # from lbfgs10
'news20.binary.bias.LRC1': 6.05244975637293e+03, # from lbfgs30
'rcv1_test.binary.LRC1': 5.73962101619040e+04, # from TRON
'rcv1_test.binary.bias.LRC1': 5.63926363201933e+04, # from TRON
'url_combined.LRC1': 4.50240351279866e+04, # from TRON
'url_combined.bias.LRC1': 4.50238895961963e+04, # from TRON
'webspam_wc_normalized_trigram.svm.LRC1': 2.29750597760998e+04, # from NEWTON
'webspam_wc_normalized_trigram.svm.bias.LRC1': 2.28160330908175e+04, # from lbfgs30
}
|
# encoding=utf-8
def my_coroutine():
while True:
received = yield
print('Received:',received)
it = my_coroutine()
next(it)
it.send('First')
it.send('Second')
def minimize():
current = yield
while True:
value = yield current
current = min(value,current)
it = minimize()
next(it)
print(it.send(10))
print(it.send(4))
print(it.send(22))
print(it.send(-1))
|
class Solution(object):
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
anagram = {}
for i in strs:
count = [0]*26
for c in i:
count[ord(c) - ord('a')] += 1
count = tuple(count)
if count in anagram:
anagram[count].append(i)
else:
anagram[count] = [i]
return list(anagram.values())
|
'''
File name: p1_utils.py
Author:
Date:
'''
|
""" Implementation of Merge Sort algorithm
"""
def merge(data):
""" MergeSort is a Divide and Conquer algorithm. It divides input array
in two halves, calls itself for the two halves and then merges the
two sorted halves.
:param array: list of elements that needs to be sorted
:type array: list
"""
if len(data) > 1:
mid = len(data) // 2
lefthalf = data[:mid]
righthalf = data[mid:]
merge(lefthalf)
merge(righthalf)
i = j = k = 0
while i < len(lefthalf) and j < len(righthalf):
if lefthalf[i] < righthalf[j]:
data[k] = lefthalf[i]
i = i + 1
else:
data[k] = righthalf[j]
j = j + 1
k = k + 1
while i < len(lefthalf):
data[k] = lefthalf[i]
i = i + 1
k = k + 1
while j < len(righthalf):
data[k] = righthalf[j]
j = j + 1
k = k + 1
def main():
""" operational function """
arr = [34, 56, 23, 67, 3, 68]
print(f"unsorted array: {arr}")
merge(arr)
print(f" sorted array: {arr}")
if __name__ == "__main__":
main()
|
#Faça um algoritmo para converter valores de fahrenheit celsius
F=float(input("digite quantos graus fahrenheit "))
C= (F-32)/1.8
print ("Celsius", C)
|
DAILY='DAILY'
WEEKLY='WEEKLY'
MONTHLY='MONTHLY'
ANNUALLY='ANNUALLY'
MONTHLY_MEAN='MONTHLY_MEAN'
ANNUAL_MEAN='ANNUAL_MEAN'
MONTHLY_SUM='MONTHLY_SUM'
ANNUAL_SUM='ANNUAL_SUM'
MONTHLY_SNAPSHOT='MONTHLY_SNAPSHOT'
ANNUAL_SNAPSHOT='ANNUAL_SNAPSHOT' |
"""Top-level package for Ansible Events."""
__author__ = """Ben Thomasson"""
__email__ = '[email protected]'
__version__ = '0.4.0'
|
# Using names.txt (right click and 'Save Link/Target As...'),
# a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order.
# Then working out the alphabetical value for each name, multiply this value by
# its alphabetical position in the list to obtain a name score.
# For example, when the list is sorted into alphabetical order, COLIN,
# which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list.
# So, COLIN would obtain a score of 938 × 53 = 49714.
# What is the total of all the name scores in the file?
def main():
alphabet={'A':1,'B':2,'C':3,'D':4,'E':5,'F':6,'G':7,'H':8,'I':9,'J':10,'K':11,'L':12,'M':13,
'N':14,'O':15,'P':16,'Q':17,'R':18,'S':19,'T':20,'U':21,'V':22,'W':23,'X':24,'Y':25,'Z':26}
with open('names.txt','r') as f:
contenu=f.read().split(',')
contenu.sort()
listIndex=1
totaleScore=0
for indexElement in range(len(contenu)):
nameScore=0
for i in range(1,len(contenu[indexElement])-1):
nameScore+=alphabet[contenu[indexElement][i]]
totaleScore+=nameScore*listIndex
listIndex+=1
print(totaleScore)
if __name__ == '__main__':
main() |
"""x = 1 # int
x = "CBF Cursos" # string
x = 15.6 # float
x = False # bool
n1 = 5; n2 = 2; x = complex(n1, n2)
#Coleções
x = ["Carro","Avião", "Navio", 1,58.3, True] #List / Array pode ser alterado
x = ("Carro", "Aviao", "Navio", 1, 58.3, True) #Tupla é fechada
x = range(0,100,1)#List de 0 á 100 de 1 em 1
"""
x = { # Dict
"canal": "CFB Cursos",
"curso": "Curso de Python",
"nome": "Eduardo"
}
print("Valor: " + x["nome"])
print("Tipo: " + str(type(x)))
input() # deixa janela aberta
|
#
# PySNMP MIB module RFC1406Ext-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1406Ext-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:56:59 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion")
cxDSX1Ext, = mibBuilder.importSymbols("CXProduct-SMI", "cxDSX1Ext")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Gauge32, ModuleIdentity, Unsigned32, NotificationType, iso, MibIdentifier, Integer32, IpAddress, Counter32, ObjectIdentity, Counter64, TimeTicks, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ModuleIdentity", "Unsigned32", "NotificationType", "iso", "MibIdentifier", "Integer32", "IpAddress", "Counter32", "ObjectIdentity", "Counter64", "TimeTicks", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
dsx1ExtMibLevel = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtMibLevel.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtMibLevel.setDescription('Used to determine current MIB module release supported by the agent. Object is in decimal.')
dsx1ExtCfgTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10), )
if mibBuilder.loadTexts: dsx1ExtCfgTable.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgTable.setDescription('The T1/E1 extensions configuration table.')
dsx1ExtCfgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1), ).setIndexNames((0, "RFC1406Ext-MIB", "dsx1ExtCfgLinkIndex"))
if mibBuilder.loadTexts: dsx1ExtCfgEntry.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgEntry.setDescription('An entry in the T1/E1 extensions configuration table.')
dsx1ExtCfgLinkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgLinkIndex.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgLinkIndex.setDescription('Identifies the physical port with the T1/E1 (dsx1Ext) interface. Range of Values: 1 - 2 Default Value: None Configuration Changed: administrative')
dsx1ExtCfgPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ExtCfgPortStatus.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgPortStatus.setDescription('Indicates whether this T1/E1 (dsx1Ext) port is enabled or disabled. Options: disabled (1): The port is physically present but will be disabled (deactivated) after the next reset. enabled (2): The port will become enabled (functional) after the next reset. Default Value: disabled (1) Configuration Changed: administrative')
dsx1ExtCfgTraps = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ExtCfgTraps.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgTraps.setDescription('Determines whether the software will produce a T1/E1 (dsx1...) trap. Options: disabled (1): The trap will not be produced. enabled (2): The trap will be generated. Default Value: disabled (1) Configuration Changed: administrative')
dsx1ExtCfgLineBuildOut = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dsx1ExtCfgLineBuildOut.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgLineBuildOut.setDescription('Specifies the attenuation or Line Build Out to be used on the transmitter side of the line. Options: For T1 1: 0 to 133 feet / 0 dB 2: 133 to 266 feet 3: 266 to 399 feet 4: 399 to 533 feet 5: 533 to 655 feet 6: -7.5 dB 7: -15 dB 8: -22.5 dB For E1 1: 75 Ohm (coax. cable) 2: 120 Ohm (RJ45 shilded twisted pair) 3: 75 Ohm ( with protection resistor) 4: 120 Ohm ( with protection resistor) 5: 75 Ohm (with high return loss 1:1.15) 6: 120 Ohm (with high return loss 1:1.36) 7: 75 Ohm (with high return loss 1:1.36) 8: N/A Default Value: 1 Configuration Changed: administrative')
dsx1ExtCfgCardType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 50), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dsx1ExtNoCard", 1), ("dsx1ExtT1Card", 2), ("dsx1ExtE1Card", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgCardType.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgCardType.setDescription('Indicates the type of card connected to this CPU board. Options: dsx1ExtNoCard (1): Indicates that there is not a T1 or E1 card connected to the line interface or the value indicates that if there is a T1 or E1 card connected then the card is not functional. dsx1ExtT1Card (2): Indicates that a functional T1 card is connected to the line interface. dsx1ExtE1Card (3): Indicates that a functional E1 card is connected to the line interface.')
dsx1ExtCfgLossTxClock = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 51), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgLossTxClock.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgLossTxClock.setDescription('Indicates the total time at which the transmit clock was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.')
dsx1ExtCfgLossSync = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 52), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgLossSync.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgLossSync.setDescription('Indicates the total time at which the synchronization was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.')
dsx1ExtCfgLossCarrier = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 53), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgLossCarrier.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgLossCarrier.setDescription('Indicates the total time at which the carrier was lost on this line interface. If no such event has occurred since system startup, then the value will be zero.')
dsx1ExtCfgT18ZeroDetect = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 54), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgT18ZeroDetect.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgT18ZeroDetect.setDescription('Indicates the total time that 8 consecutive zeros were received on this line interface. If no such event has occurred since system startup, then the value will be zero.')
dsx1ExtCfgT116ZeroDetect = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 55), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgT116ZeroDetect.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgT116ZeroDetect.setDescription('Indicates the total time that 16 consecutive zeros were received on this line interface. If no such event has occurred since system startup, then the value will be zero.')
dsx1ExtCfgT1RxB8ZSCode = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 56), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgT1RxB8ZSCode.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgT1RxB8ZSCode.setDescription('Indicates the total time that a B8ZS code word was detected during reception on this line interface. If no such event has occurred since system startup, then the value will be zero. Note: B8ZS code work detection occurs whether or not the B8ZS mode is selected.')
dsx1ExtCfgT1RxBlueAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 57), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgT1RxBlueAlarm.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgT1RxBlueAlarm.setDescription("Indicates the total time that a 'blue alarm' was received on this line interface. A blue alarm is an unframed signal comprised of all ones (1s). If no such event has occurred since system startup, then the value will be zero.")
dsx1ExtCfgT1RxYellowAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 58), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgT1RxYellowAlarm.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgT1RxYellowAlarm.setDescription("Indicates the total time that a 'yellow alarm' was received on this line interface. A yellow alarm occurs when bit 2 of 256 consecutive channels is set to zero for at least 254 occurrences in D4 format mode or when 16 consecutive patterns of 00FF hex appear in FDL format mode. If no such event has occurred since system startup, then the value will be zero.")
dsx1ExtCfgIoRegTest = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 59), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("failed", 1), ("passed", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgIoRegTest.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgIoRegTest.setDescription('Indicates the test results for the T1/E1 I/O card registers.')
dsx1ExtCfgSctRegTest = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 60), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("failed", 1), ("passed", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgSctRegTest.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgSctRegTest.setDescription('Indicates the test results for the T1 transceiver registers, specifically the 12 Transmit Signaling Registers.')
dsx1ExtCfgSctLatchRegTest = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 61), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("failed", 1), ("passed", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dsx1ExtCfgSctLatchRegTest.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgSctLatchRegTest.setDescription('Indicates the test results for the T1 transceiver latch register, specifically the second Status Register.')
dsx1ExtCfgReinit = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 53, 10, 1, 81), Integer32()).setMaxAccess("writeonly")
if mibBuilder.loadTexts: dsx1ExtCfgReinit.setStatus('mandatory')
if mibBuilder.loadTexts: dsx1ExtCfgReinit.setDescription('When this object is set to any value, it reinitializes the corresponding port.')
mibBuilder.exportSymbols("RFC1406Ext-MIB", dsx1ExtCfgLineBuildOut=dsx1ExtCfgLineBuildOut, dsx1ExtCfgT116ZeroDetect=dsx1ExtCfgT116ZeroDetect, dsx1ExtCfgReinit=dsx1ExtCfgReinit, dsx1ExtCfgT1RxBlueAlarm=dsx1ExtCfgT1RxBlueAlarm, dsx1ExtCfgTraps=dsx1ExtCfgTraps, dsx1ExtCfgLossSync=dsx1ExtCfgLossSync, dsx1ExtMibLevel=dsx1ExtMibLevel, dsx1ExtCfgEntry=dsx1ExtCfgEntry, dsx1ExtCfgPortStatus=dsx1ExtCfgPortStatus, dsx1ExtCfgT18ZeroDetect=dsx1ExtCfgT18ZeroDetect, dsx1ExtCfgSctLatchRegTest=dsx1ExtCfgSctLatchRegTest, dsx1ExtCfgLinkIndex=dsx1ExtCfgLinkIndex, dsx1ExtCfgSctRegTest=dsx1ExtCfgSctRegTest, dsx1ExtCfgLossTxClock=dsx1ExtCfgLossTxClock, dsx1ExtCfgTable=dsx1ExtCfgTable, dsx1ExtCfgCardType=dsx1ExtCfgCardType, dsx1ExtCfgT1RxB8ZSCode=dsx1ExtCfgT1RxB8ZSCode, dsx1ExtCfgIoRegTest=dsx1ExtCfgIoRegTest, dsx1ExtCfgT1RxYellowAlarm=dsx1ExtCfgT1RxYellowAlarm, dsx1ExtCfgLossCarrier=dsx1ExtCfgLossCarrier)
|
MAPPING = [
{
'sid': 'Adult age binary (yes)',
'symptom': 'age',
'module': 'adult',
'gen_5_4a': 55,
'endorsed': True,
},
{
'sid': 'Adult age binary (no)',
'symptom': 'age',
'module': 'adult',
'gen_5_4a': 45,
'endorsed': False,
},
{
'sid': 'Adult age binary (no-lower bound)',
'symptom': 'age',
'module': 'adult',
'gen_5_4a': 12,
'endorsed': False,
},
{
'sid': 'Adult age binary (threshold)',
'symptom': 'age',
'module': 'adult',
'gen_5_4a': 49,
'endorsed': True,
},
{
'sid': 'Adult age binary (just age group)',
'symptom': 'age',
'module': 'adult',
'gen_5_4d': 3,
'endorsed': False,
},
{
'sid': 'Adult-first age quartile (yes)',
'symptom': 's88881',
'module': 'adult',
'gen_5_4a': 20,
'endorsed': True,
},
{
'sid': 'Adult-first age quartile (yes-upper threshold)',
'symptom': 's88881',
'module': 'adult',
'gen_5_4a': 32,
'endorsed': True,
},
{
'sid': 'Adult-first age quartile (yes-lower threshold)',
'symptom': 's88881',
'module': 'adult',
'gen_5_4a': 12,
'endorsed': True,
},
{
'sid': 'Adult-first age quartile (no)',
'symptom': 's88881',
'module': 'adult',
'gen_5_4a': 35,
'endorsed': False,
},
{
'sid': 'Adult-first age quartile (no-upper threshold)',
'symptom': 's88881',
'module': 'adult',
'gen_5_4a': 33,
'endorsed': False,
},
{
'sid': 'Adult-first age quartile (just age group)',
'symptom': 's88881',
'module': 'adult',
'gen_5_4d': 3,
'endorsed': False,
},
{
'sid': 'Adult-second age quartile (yes)',
'symptom': 's88882',
'module': 'adult',
'gen_5_4a': 40,
'endorsed': True,
},
{
'sid': 'Adult-second age quartile (yes-upper threshold)',
'symptom': 's88882',
'module': 'adult',
'gen_5_4a': 49,
'endorsed': True,
},
{
'sid': 'Adult-second age quartile (yes-lower threshold)',
'symptom': 's88882',
'module': 'adult',
'gen_5_4a': 33,
'endorsed': True,
},
{
'sid': 'Adult-second age quartile (no-upper)',
'symptom': 's88882',
'module': 'adult',
'gen_5_4a': 60,
'endorsed': False,
},
{
'sid': 'Adult-second age quartile (no-lower)',
'symptom': 's88882',
'module': 'adult',
'gen_5_4a': 30,
'endorsed': False,
},
{
'sid': 'Adult-second age quartile (no-lower threshold)',
'symptom': 's88882',
'module': 'adult',
'gen_5_4a': 32,
'endorsed': False,
},
{
'sid': 'Adult-second age quartile (no-upper threshold)',
'symptom': 's88882',
'module': 'adult',
'gen_5_4a': 50,
'endorsed': False,
},
{
'sid': 'Adult-second age quartile (just age group)',
'symptom': 's88882',
'module': 'adult',
'gen_5_4d': 3,
'endorsed': False,
},
{
'sid': 'Adult-third age quartile (yes)',
'symptom': 's88883',
'module': 'adult',
'gen_5_4a': 50,
'endorsed': True,
},
{
'sid': 'Adult-third age quartile (yes-upper threshold)',
'symptom': 's88883',
'module': 'adult',
'gen_5_4a': 65,
'endorsed': True,
},
{
'sid': 'Adult-third age quartile (yes-lower threshold)',
'symptom': 's88883',
'module': 'adult',
'gen_5_4a': 50,
'endorsed': True,
},
{
'sid': 'Adult-third age quartile (no-lower)',
'symptom': 's88883',
'module': 'adult',
'gen_5_4a': 40,
'endorsed': False,
},
{
'sid': 'Adult-third age quartile (no-upper)',
'symptom': 's88883',
'module': 'adult',
'gen_5_4a': 70,
'endorsed': False,
},
{
'sid': 'Adult-third age quartile (no-lower threshold)',
'symptom': 's88883',
'module': 'adult',
'gen_5_4a': 49,
'endorsed': False,
},
{
'sid': 'Adult-third age quartile (no-upper threshold)',
'symptom': 's88883',
'module': 'adult',
'gen_5_4a': 66,
'endorsed': False,
},
{
'sid': 'Adult-third age quartile (just age group)',
'symptom': 's88883',
'module': 'adult',
'gen_5_4d': 3,
'endorsed': False,
},
{
'sid': 'Adult-fourth age quartile (yes)',
'symptom': 's88884',
'module': 'adult',
'gen_5_4a': 70,
'endorsed': True,
},
{
'sid': 'Adult-fourth age quartile (yes-lower threshold)',
'symptom': 's88884',
'module': 'adult',
'gen_5_4a': 66,
'endorsed': True,
},
{
'sid': 'Adult-fourth age quartile (no-lower)',
'symptom': 's88884',
'module': 'adult',
'gen_5_4a': 60,
'endorsed': False,
},
{
'sid': 'Adult-fourth age quartile (no-lower threshold)',
'symptom': 's88884',
'module': 'adult',
'gen_5_4a': 65,
'endorsed': False,
},
{
'sid': 'Adult-fourth age quartile (just age group)',
'symptom': 's88884',
'module': 'adult',
'gen_5_4d': 3,
'endorsed': False,
},
{
'sid': 'Child age binary (years-yes)',
'symptom': 'age',
'module': 'child',
'gen_5_4a': 7,
'endorsed': True,
},
{
'sid': 'Child age binary (years-upper bound)',
'symptom': 'age',
'module': 'child',
'gen_5_4a': 11,
'endorsed': True,
},
{
'sid': 'Child age binary (years-no)',
'symptom': 'age',
'module': 'child',
'gen_5_4a': 1,
'endorsed': False,
},
{
'sid': 'Child age binary (years-threshold)',
'symptom': 'age',
'module': 'child',
'gen_5_4a': 2,
'endorsed': True,
},
{
'sid': 'Child age binary (months-yes)',
'symptom': 'age',
'module': 'child',
'gen_5_4b': 30,
'endorsed': True,
},
{
'sid': 'Child age binary (months-no)',
'symptom': 'age',
'module': 'child',
'gen_5_4b': 11,
'endorsed': False,
},
{
'sid': 'Child age binary (months-threshold)',
'symptom': 'age',
'module': 'child',
'gen_5_4b': 24,
'endorsed': True,
},
{
'sid': 'Child age binary (days-yes)',
'symptom': 'age',
'module': 'child',
'gen_5_4c': 365 * 3,
'endorsed': True,
},
{
'sid': 'Child age binary (days-lower bound)',
'symptom': 'age',
'module': 'child',
'gen_5_4c': 29,
'endorsed': False,
},
{
'sid': 'Child age binary (days-threshold)',
'symptom': 'age',
'module': 'child',
'gen_5_4c': 365 * 2,
'endorsed': True,
},
{
'sid': 'Child age binary (just age group)',
'symptom': 'age',
'module': 'child',
'gen_5_4d': 2,
'endorsed': False,
},
{
'sid': 'Child-first age quintile (no-years)',
'symptom': 's2991',
'module': 'child',
'gen_5_4a': 1,
'endorsed': False,
},
{
'sid': 'Child-first age quintile (yes-months)',
'symptom': 's2991',
'module': 'child',
'gen_5_4b': 3,
'endorsed': True,
},
{
'sid': 'Child-first age quintile (yes-months lower threshold)',
'symptom': 's2991',
'module': 'child',
'gen_5_4b': 1,
'endorsed': True,
},
{
'sid': 'Child-first age quintile (yes-months upper threshold)',
'symptom': 's2991',
'module': 'child',
'gen_5_4b': 5,
'endorsed': True,
},
{
'sid': 'Child-first age quintile (no-months)',
'symptom': 's2991',
'module': 'child',
'gen_5_4b': 11,
'endorsed': False,
},
{
'sid': 'Child-first age quintile (no-months upper threshold)',
'symptom': 's2991',
'module': 'child',
'gen_5_4b': 6,
'endorsed': False,
},
{
'sid': 'Child-first age quintile (yes-days)',
'symptom': 's2991',
'module': 'child',
'gen_5_4c': 100,
'endorsed': True,
},
{
'sid': 'Child-first age quintile (yes-days lower threshold)',
'symptom': 's2991',
'module': 'child',
'gen_5_4c': 29,
'endorsed': True,
},
{
'sid': 'Child-first age quintile (yes-days upper threshold)',
'symptom': 's2991',
'module': 'child',
'gen_5_4c': 152, # FIXME: rounding error converting days
'endorsed': True,
},
{
'sid': 'Child-first age quintile (no-days)',
'symptom': 's2991',
'module': 'child',
'gen_5_4c': 300,
'endorsed': False,
},
{
'sid': 'Child-first age quintile (no-days upper threshold)',
'symptom': 's2991',
'module': 'child',
'gen_5_4c': 153, # FIXME: rounding error converting days
'endorsed': False,
},
{
'sid': 'Child-first age quintile (just age group)',
'symptom': 's2991',
'module': 'child',
'gen_5_4d': 2,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (yes-years upper threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4a': 1,
'endorsed': True,
},
{
'sid': 'Child-second age quintile (no-years)',
'symptom': 's2992',
'module': 'child',
'gen_5_4a': 2,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (yes-months)',
'symptom': 's2992',
'module': 'child',
'gen_5_4b': 9,
'endorsed': True,
},
{
'sid': 'Child-second age quintile (yes-months upper threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4b': 12,
'endorsed': True,
},
{
'sid': 'Child-second age quintile (yes-months lower threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4b': 6,
'endorsed': True,
},
{
'sid': 'Child-second age quintile (no-months upper)',
'symptom': 's2992',
'module': 'child',
'gen_5_4b': 15,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (no-months lower)',
'symptom': 's2992',
'module': 'child',
'gen_5_4b': 3,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (no-months upper threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4b': 13,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (no-months lower threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4b': 5,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (yes-days)',
'symptom': 's2992',
'module': 'child',
'gen_5_4c': 300,
'endorsed': True,
},
{
'sid': 'Child-second age quintile (yes-days upper threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4c': 365,
'endorsed': True,
},
{
'sid': 'Child-second age quintile (yes-days lower threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4c': 153, # FIXME: rounding error converting days
'endorsed': True,
},
{
'sid': 'Child-second age quintile (no-days upper)',
'symptom': 's2992',
'module': 'child',
'gen_5_4c': 500,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (no-days lower)',
'symptom': 's2992',
'module': 'child',
'gen_5_4c': 60,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (no-days upper threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4c': 366,
'endorsed': False,
},
{
'sid': 'Child-second age quintile (no-days lower threshold)',
'symptom': 's2992',
'module': 'child',
'gen_5_4c': 152, # FIXME: rounding error converting days
'endorsed': False,
},
{
'sid': 'Child-second age quintile (just age group)',
'symptom': 's2992',
'module': 'child',
'gen_5_4d': 2,
'endorsed': False,
},
{
'sid': 'Child-third age quintile (yes-years lower threshold)',
'symptom': 's2993',
'module': 'child',
'gen_5_4a': 2,
'endorsed': True,
},
{
'sid': 'Child-third age quintile (yes-years upper threshold)',
'symptom': 's2993',
'module': 'child',
'gen_5_4a': 3,
'endorsed': True,
},
{
'sid': 'Child-third age quintile (no-years upper)',
'symptom': 's2993',
'module': 'child',
'gen_5_4a': 5,
'endorsed': False,
},
{
'sid': 'Child-third age quintile (no-years lower threshold)',
'symptom': 's2993',
'module': 'child',
'gen_5_4a': 1,
'endorsed': False,
},
{
'sid': 'Child-third age quintile (no-years upper threshold)',
'symptom': 's2993',
'module': 'child',
'gen_5_4a': 4,
'endorsed': False,
},
{
'sid': 'Child-third age quintile (yes-months)',
'symptom': 's2993',
'module': 'child',
'gen_5_4b': 30,
'endorsed': True,
},
{
'sid': 'Child-third age quintile (yes-months upper threshold)',
'symptom': 's2993',
'module': 'child',
'gen_5_4b': 36,
'endorsed': True,
},
{
'sid': 'Child-third age quintile (yes-months lower threshold)',
'symptom': 's2993',
'module': 'child',
'gen_5_4b': 13,
'endorsed': True,
},
{
'sid': 'Child-third age quintile (no-months lower)',
'symptom': 's2993',
'module': 'child',
'gen_5_4b': 10,
'endorsed': False,
},
{
'sid': 'Child-third age quintile (no-months upper)',
'symptom': 's2993',
'module': 'child',
'gen_5_4b': 60,
'endorsed': False,
},
{
'sid': 'Child-third age quintile (no-months lower threshold)',
'symptom': 's2993',
'module': 'child',
'gen_5_4b': 12,
'endorsed': False,
},
{
'sid': 'Child-third age quintile (no-months upper threshold)',
'symptom': 's2993',
'module': 'child',
'gen_5_4b': 37,
'endorsed': False,
},
{
'sid': 'Child-third age quintile (just age group)',
'symptom': 's2993',
'module': 'child',
'gen_5_4d': 2,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (yes-years)',
'symptom': 's2994',
'module': 'child',
'gen_5_4a': 5,
'endorsed': True,
},
{
'sid': 'Child-fourth age quintile (yes-years upper threshold)',
'symptom': 's2994',
'module': 'child',
'gen_5_4a': 7,
'endorsed': True,
},
{
'sid': 'Child-fourth age quintile (yes-years lower threshold)',
'symptom': 's2994',
'module': 'child',
'gen_5_4a': 4,
'endorsed': True,
},
{
'sid': 'Child-fourth age quintile (no-years lower)',
'symptom': 's2994',
'module': 'child',
'gen_5_4a': 2,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (no-years upper)',
'symptom': 's2994',
'module': 'child',
'gen_5_4a': 10,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (no-years lower threshold)',
'symptom': 's2994',
'module': 'child',
'gen_5_4a': 3,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (no-years upper threshold)',
'symptom': 's2994',
'module': 'child',
'gen_5_4a': 8,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (yes-months)',
'symptom': 's2994',
'module': 'child',
'gen_5_4b': 60,
'endorsed': True,
},
{
'sid': 'Child-fourth age quintile (yes-months upper threshold)',
'symptom': 's2994',
'module': 'child',
'gen_5_4b': 84,
'endorsed': True,
},
{
'sid': 'Child-fourth age quintile (yes-months lower threshold)',
'symptom': 's2994',
'module': 'child',
'gen_5_4b': 48,
'endorsed': True,
},
{
'sid': 'Child-fourth age quintile (no-months lower)',
'symptom': 's2994',
'module': 'child',
'gen_5_4b': 30,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (no-months upper)',
'symptom': 's2994',
'module': 'child',
'gen_5_4b': 120,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (no-months lower threshold)',
'symptom': 's2994',
'module': 'child',
'gen_5_4b': 36,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (no-months upper threshold)',
'symptom': 's2994',
'module': 'child',
'gen_5_4b': 96,
'endorsed': False,
},
{
'sid': 'Child-fourth age quintile (just age group)',
'symptom': 's2994',
'module': 'child',
'gen_5_4d': 2,
'endorsed': False,
},
{
'sid': 'Child-fifth age quintile (yes)',
'symptom': 's2995',
'module': 'child',
'gen_5_4a': 9,
'endorsed': True,
},
{
'sid': 'Child-fifth age quintile (yes-upper)',
'symptom': 's2995',
'module': 'child',
'gen_5_4a': 11,
'endorsed': True,
},
{
'sid': 'Child-fifth age quintile (yes-lower)',
'symptom': 's2995',
'module': 'child',
'gen_5_4a': 8,
'endorsed': True,
},
{
'sid': 'Child-fifth age quintile (no-years)',
'symptom': 's2995',
'module': 'child',
'gen_5_4a': 5,
'endorsed': False,
},
{
'sid': 'Child-fifth age quintile (no-lower threshold)',
'symptom': 's2995',
'module': 'child',
'gen_5_4a': 7,
'endorsed': False,
},
{
'sid': 'Child-fifth age quintile (just age group)',
'symptom': 's2995',
'module': 'child',
'gen_5_4d': 2,
'endorsed': False,
},
{
'sid': 'Neonate age binary (yes)',
'symptom': 'age',
'module': 'neonate',
'gen_5_4c': 5,
'endorsed': True,
},
{
'sid': 'Neonate age binary (yes-upper bound)',
'symptom': 'age',
'module': 'neonate',
'gen_5_4c': 28,
'endorsed': True,
},
{
'sid': 'Neonate age binary (no)',
'symptom': 'age',
'module': 'neonate',
'gen_5_4c': 2,
'endorsed': False,
},
{
'sid': 'Neonate age binary (zero)',
'symptom': 'age',
'module': 'neonate',
'gen_5_4c': 0,
'endorsed': False,
},
{
'sid': 'Neonate age binary (threshold)',
'symptom': 'age',
'module': 'neonate',
'gen_5_4c': 3,
'endorsed': True,
},
{
'sid': 'Neonate age binary (just age group)',
'symptom': 'age',
'module': 'neonate',
'gen_5_4d': 1,
'endorsed': False,
},
{
'sid': 'Neonate-first age quartile (yes)',
'symptom': 's4991',
'module': 'neonate',
'gen_5_4c': 0,
'endorsed': True,
},
{
'sid': 'Neonate-first age quartile (no)',
'symptom': 's4991',
'module': 'neonate',
'gen_5_4c': 1,
'endorsed': False,
},
{
'sid': 'Neonate-first age quartile (just age group)',
'symptom': 's4991',
'module': 'neonate',
'gen_5_4d': 1,
'endorsed': True, # FIXME: neonate age defaults to zero
},
# There is a s4992
{
'sid': 'Neonate-third age quartile (yes-lower)',
'symptom': 's4993',
'module': 'neonate',
'gen_5_4c': 1,
'endorsed': True,
},
{
'sid': 'Neonate-third age quartile (yes-upper)',
'symptom': 's4993',
'module': 'neonate',
'gen_5_4c': 2,
'endorsed': True,
},
{
'sid': 'Neonate-third age quartile (no-lower)',
'symptom': 's4993',
'module': 'neonate',
'gen_5_4c': 0,
'endorsed': False,
},
{
'sid': 'Neonate-third age quartile (no-upper)',
'symptom': 's4993',
'module': 'neonate',
'gen_5_4c': 3,
'endorsed': False,
},
{
'sid': 'Neonate-third age quartile (just age group)',
'symptom': 's4993',
'module': 'neonate',
'gen_5_4d': 1,
'endorsed': False,
},
{
'sid': 'Neonate-fourth age quartile (yes)',
'symptom': 's4994',
'module': 'neonate',
'gen_5_4c': 12,
'endorsed': True,
},
{
'sid': 'Neonate-fourth age quartile (yes-lower)',
'symptom': 's4994',
'module': 'neonate',
'gen_5_4c': 3,
'endorsed': True,
},
{
'sid': 'Neonate-fourth age quartile (yes-upper)',
'symptom': 's4994',
'module': 'neonate',
'gen_5_4c': 28,
'endorsed': True,
},
{
'sid': 'Neonate-fourth age quartile (no)',
'symptom': 's4994',
'module': 'neonate',
'gen_5_4c': 1,
'endorsed': False,
},
{
'sid': 'Neonate-fourth age quartile (no-lower)',
'symptom': 's4994',
'module': 'neonate',
'gen_5_4c': 2,
'endorsed': False,
},
{
'sid': 'Neonate-fourth age quartile (just age group)',
'symptom': 's4994',
'module': 'neonate',
'gen_5_4d': 1,
'endorsed': False,
},
]
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# let's create several lists
alist1 = [1, 2, 3, 4, 5]
alist2 = ['a', 'b', 'c', 'd', 'e']
alist3 = [] # empty list
alist4 = list() # Also creates an empty list. As an argument, anything iterable can be used and a list is created from it.
print(len(alist1)) # The builtin len() function returns the number of elements in a list
print(alist1[0]) # Prints out 0-th element of a list
# A negative index is relative to the end of sequence (-0 is still 0)
print(alist1[-1]) # Prints out the last element of a list
print(alist1) # Prints out a whole list
alist1[0] = 100 # Lists are mutable
print(alist1)
alist1[1:3] = [101, 102, 103] # We can replace several elements
print(alist1)
alist1[len(alist1):] = [6] # We can append new elements
print(alist1)
alist1.append(7) # But easier for appending is to call the append() method
print(alist1)
alist1[5:] = [] # We can remove elements from the list. The 5: means from the 5th element till end (and :5 would mean from beginning till 5th element
print(alist1)
copy_list = alist1[:] # Copy of a list (a new list object but with same elements).
del alist1[4] # The del operator can be used for removing elements too
print(alist1)
alist5 = alist1 + alist2 # + creates a new list
print(alist5)
# The above concatenation creates a "heterogeneous" list (contains ints and strings). It is possible but not advisable.
# The for cycle in Python iterates over iterable entities, e.g., lists, etc
for a in alist2:
print(f' iterating over a list: {a}')
# Lists have many methods. Let's examine them.
fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana']
print('List of fruits: {}'.format(fruits))
print('How many apples are in the list: {}'.format(fruits.count('apple')))
print('How many tangerines are in the list: {}'.format(fruits.count('tangerine')))
print('Position of banana: {}'.format(fruits.index('banana')))
print('Position of banana starting a position 4: {}'.format(fruits.index('banana', 4)))
fruits.reverse()
print('Reversed list: {}'.format(fruits))
fruits.sort()
print('Sorted list: {}'.format(fruits))
# List can be used as stacks
fruits.append('grape')
print('Appended grape: {}'.format(fruits))
print('Pop removes and returns the last element "{}", resulting list {}'.format(fruits.pop(), fruits))
# Tuples are similar to list but immutable
atuple1 = (1, 2, 3, 4)
atuple2 = ('a', 'b', 'c', 'd')
nested_tuple = (atuple1, atuple2)
print(nested_tuple)
empty_tuple = ()
# We unpack tuples
a1, a2, a3, a4 = atuple1
print('{} {} {} {}'.format(a1, a2, a3, a4))
# We can iterate over tuples
for i in atuple1:
print(f' element of the tuple: {i}')
# We can access individual elements in tuples
print(atuple1[0])
# But we cannot modify them
# Uncomment the following line to get an exception
# atuple1[0] = 1
|
__all__ = [
'feature_audio_adpcm', \
'feature_audio_adpcm_sync', \
'bv_audio_sync_manager'
]
|
x = int(input())
a = list(map(int,input().split()))
y = int(input())
b = list(map(int,input().split()))
f=[]
for i in b:
for j in a:
if i%j==0:
f.append(i/j)
print(f.count(max(f))) |
class mystery(object):
def __init__(this, length, values):
this.values = [0]*length
for value in values:
this.values[value] += 1
def __str__(this):
return "length {:d}: {}".format(len(this.values), this.values)
def __add__(this, value):
myst = mystery(len(this.values), [])
myst.values = this.values.copy()
myst.values[value] += 1
return myst
|
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
class Version:
def __init__(self, version):
self._p = version.split('.')
self._v = version
def __getitem__(self, key):
return self._p[key]
def __str__(self):
return self._v
def __repr__(self):
return self._v
__version__ = Version('0.1.dev5+ge0d057d.d20210625')
|
def get_pair_number(list_pairs, item_left, item_right):
# Retrieve pair number
found = False
ct_pair = 0
iter_pair = 0
while not found:
if list_pairs[iter_pair, 0] == item_left and list_pairs[iter_pair, 1] == item_right:
ct_pair = iter_pair
found = True
else:
iter_pair += 1
return ct_pair
|
"""
Collatz Conjecture exercise
"""
def steps(number):
"""
Count the number of steps
"""
if number <= 0:
raise ValueError("Only positive integers are allowed")
step = 0
while number != 1:
number = 3 * number + 1 if number % 2 else number // 2
step += 1
return step
|
def f1():
print("b f1")
def f2():
print("b f2")
def f3():
print("b f3")
# 这样就不会在导入模块时自动执行了
'''
__name__ 模块名
需要说明的是,如果我们导入的模块除了定义函数之外还中有可以执行代码,
那么Python解释器在导入这个模块时就会执行这些代码,
事实上我们可能并不希望如此,
因此如果我们在模块中编写了执行代码,
最好是将这些执行代码放入如下所示的条件中,
这样的话除非直接运行该模块,
if条件下的这些代码是不会执行的,
因为只有直接执行的模块的名字才是“__main__”
'''
if __name__ == "__main__":
f3()
|
HDL_PORT = 6000
EMAIL_ADDRESS_FROM = '[email protected]'
EMAIL_ADDRESS_TO = '[email protected]'
SMTP_HOST = 'smtp.example.com'
SMTP_PORT = 587
SMTP_USERNAME = 'sender'
SMTP_PASSWORD = 'topsecret'
|
######################################### BeatDetector #############################################
# Author: Dan Boehm
#
# Copyright: 2011
#
# Description: The MusicFrameData class contains all of the information necessary for the
# LightSelector to make its decisions. It provides an easily accessible format for
# aquiring all of the information it needs efficiently and in a highly organized way.
#
############################################ MODULES ###############################################
########################################### CONSTANTS ##############################################
######################################### STATIC METHODS ###########################################
############################################ CLASSES ###############################################
###################### MusicFrameData ########################
#
# Description: MusicFrameData contains processed values from the beatDetectors' data. It is
# simply a wrapper class. It performs absolutely no data processing.
# The MusicFrameData has a different way of representing if a beat has occured. Since
# All processing is done elsewhere, this standard is not actually enforced in the
# class and must simply just be understood. If any beat is detected (that isn't
# ignored), a boolean will be set True. This simplifies determining whether anything
# must be done at all. Whether the beats actually occured is split up into two
# variables. For the full waveform, the beat is represented in beat_Main. The beat
# information for each frequency band is in beat_Bands. Beat information is a float.
# This float represents the ratio between the float and the trigger. This allows for
# interpretation of how intense the beat is. Any value less than one but greater than
# or equal to zero is not a beat. A negative value means that a beat would have
# occured, but analyzeMusicFrame decided that the beat should be ignored.
#
# Instance Variables: beatDetected - True if any beat was detected, False otherwise.
# beat_Main - Float representing the overall intensity as a ratio of the
# trigger value.
# beat_Bands - Array of Floats for each of the frequency bands representing
# the overall intensity as a ratio of the trigger value.
#
class MusicFrameData:
##### Instance Variables #####
beatDetected = False
beat_Main = 0
beat_Bands = [0]
##### Built-in Functions #####
def __init__(self, beatDetected, beat_Main, beat_Bands):
self.beatDetected = beatDetected
self.beat_Main = beat_Main
self.beat_Bands = beat_Bands
##### Functions ##### |
# -*- coding: utf-8 -*-
"""
[Python 2.7 (Mayavi is not yet compatible with Python 3+)]
Created on Wed Apr 6 13:51:02 2016
@author: Ryan Stauffer
https://github.com/ryanpstauffer/market-vis
Market Visualization Prototype
__init__.py
"""
__version__ = "0.0.1"
|
class StringValidator(object):
def __init__(self, max_length=-1):
self.max_length = max_length
self.value = None |
#
# PySNMP MIB module ALTIGA-PPTP-STATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-PPTP-STATS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:05:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
alPptpMibModule, = mibBuilder.importSymbols("ALTIGA-GLOBAL-REG", "alPptpMibModule")
alPptpGroup, alStatsPptp = mibBuilder.importSymbols("ALTIGA-MIB", "alPptpGroup", "alStatsPptp")
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
Gauge32, ObjectIdentity, Counter32, Bits, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, TimeTicks, ModuleIdentity, Integer32, MibIdentifier, Unsigned32, iso, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ObjectIdentity", "Counter32", "Bits", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "TimeTicks", "ModuleIdentity", "Integer32", "MibIdentifier", "Unsigned32", "iso", "NotificationType")
TextualConvention, DisplayString, TruthValue, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue", "RowStatus")
altigaPptpStatsMibModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 3076, 1, 1, 10, 2))
altigaPptpStatsMibModule.setRevisions(('2002-09-05 13:00', '2002-07-10 00:00',))
if mibBuilder.loadTexts: altigaPptpStatsMibModule.setLastUpdated('200209051300Z')
if mibBuilder.loadTexts: altigaPptpStatsMibModule.setOrganization('Cisco Systems, Inc.')
alStatsPptpGlobal = MibIdentifier((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1))
alPptpStatsLocalProtVers = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsLocalProtVers.setStatus('current')
alPptpStatsLocalFraming = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsLocalFraming.setStatus('current')
alPptpStatsLocalBearer = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsLocalBearer.setStatus('current')
alPptpStatsLocalFirmwareRev = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsLocalFirmwareRev.setStatus('current')
alPptpStatsTotalTunnels = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 5), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTotalTunnels.setStatus('current')
alPptpStatsActiveTunnels = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 6), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsActiveTunnels.setStatus('current')
alPptpStatsMaxTunnels = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 7), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsMaxTunnels.setStatus('current')
alPptpStatsTotalSessions = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 8), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTotalSessions.setStatus('current')
alPptpStatsActiveSessions = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 9), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsActiveSessions.setStatus('current')
alPptpStatsMaxSessions = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 10), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsMaxSessions.setStatus('current')
alPptpStatsControlRecvOctets = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsControlRecvOctets.setStatus('current')
alPptpStatsControlRecvPackets = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsControlRecvPackets.setStatus('current')
alPptpStatsControlRecvDiscards = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsControlRecvDiscards.setStatus('current')
alPptpStatsControlSendOctets = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsControlSendOctets.setStatus('current')
alPptpStatsControlSendPackets = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsControlSendPackets.setStatus('current')
alPptpStatsPayloadRecvOctets = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsPayloadRecvOctets.setStatus('current')
alPptpStatsPayloadRecvPackets = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsPayloadRecvPackets.setStatus('current')
alPptpStatsPayloadRecvDiscards = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsPayloadRecvDiscards.setStatus('current')
alPptpStatsPayloadSendOctets = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsPayloadSendOctets.setStatus('current')
alPptpStatsPayloadSendPackets = MibScalar((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsPayloadSendPackets.setStatus('current')
alPptpStatsTunnelTable = MibTable((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2), )
if mibBuilder.loadTexts: alPptpStatsTunnelTable.setStatus('current')
alPptpStatsTunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1), ).setIndexNames((0, "ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerIpAddr"))
if mibBuilder.loadTexts: alPptpStatsTunnelEntry.setStatus('current')
alPptpStatsTunnelRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: alPptpStatsTunnelRowStatus.setStatus('current')
alPptpStatsTunnelPeerIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelPeerIpAddr.setStatus('current')
alPptpStatsTunnelDatastreamId = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelDatastreamId.setStatus('current')
alPptpStatsTunnelLocalIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelLocalIpAddr.setStatus('current')
alPptpStatsTunnelPeerHostName = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelPeerHostName.setStatus('current')
alPptpStatsTunnelPeerVendorName = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelPeerVendorName.setStatus('current')
alPptpStatsTunnelPeerFirmwareRev = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelPeerFirmwareRev.setStatus('current')
alPptpStatsTunnelPeerProtVers = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelPeerProtVers.setStatus('current')
alPptpStatsTunnelPeerFramingCap = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelPeerFramingCap.setStatus('current')
alPptpStatsTunnelPeerBearerCap = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelPeerBearerCap.setStatus('current')
alPptpStatsTunnelPeerMaxChan = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelPeerMaxChan.setStatus('current')
alPptpStatsTunnelActiveSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 2, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsTunnelActiveSessions.setStatus('current')
alPptpStatsSessionTable = MibTable((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3), )
if mibBuilder.loadTexts: alPptpStatsSessionTable.setStatus('current')
alPptpStatsSessionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1), ).setIndexNames((0, "ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionDatastreamId"))
if mibBuilder.loadTexts: alPptpStatsSessionEntry.setStatus('current')
alPptpStatsSessionRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: alPptpStatsSessionRowStatus.setStatus('current')
alPptpStatsSessionDatastreamId = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionDatastreamId.setStatus('current')
alPptpStatsSessionLocalCallId = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionLocalCallId.setStatus('current')
alPptpStatsSessionPeerCallId = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionPeerCallId.setStatus('current')
alPptpStatsSessionUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionUserName.setStatus('current')
alPptpStatsSessionSerial = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionSerial.setStatus('current')
alPptpStatsSessionMinimumSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionMinimumSpeed.setStatus('current')
alPptpStatsSessionMaximumSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionMaximumSpeed.setStatus('current')
alPptpStatsSessionConnectSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionConnectSpeed.setStatus('current')
alPptpStatsSessionBearerType = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("analog", 1), ("digital", 2), ("any", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionBearerType.setStatus('current')
alPptpStatsSessionFramingType = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("asynchronous", 1), ("synchronous", 2), ("either", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionFramingType.setStatus('current')
alPptpStatsSessionPhysicalChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionPhysicalChannel.setStatus('current')
alPptpStatsSessionLocalWindowSize = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionLocalWindowSize.setStatus('current')
alPptpStatsSessionPeerWindowSize = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionPeerWindowSize.setStatus('current')
alPptpStatsSessionLocalPpd = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 15), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionLocalPpd.setStatus('current')
alPptpStatsSessionPeerPpd = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionPeerPpd.setStatus('current')
alPptpStatsSessionRecvOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionRecvOctets.setStatus('current')
alPptpStatsSessionRecvPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionRecvPackets.setStatus('current')
alPptpStatsSessionRecvDiscards = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionRecvDiscards.setStatus('current')
alPptpStatsSessionRecvZLB = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionRecvZLB.setStatus('current')
alPptpStatsSessionSendOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionSendOctets.setStatus('current')
alPptpStatsSessionSendPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionSendPackets.setStatus('current')
alPptpStatsSessionSendZLB = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionSendZLB.setStatus('current')
alPptpStatsSessionAckTimeouts = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionAckTimeouts.setStatus('current')
alPptpStatsSessionLocalFlowOff = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 25), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionLocalFlowOff.setStatus('current')
alPptpStatsSessionPeerFlowOff = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 26), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionPeerFlowOff.setStatus('current')
alPptpStatsSessionOutOfWindow = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 27), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionOutOfWindow.setStatus('current')
alPptpStatsSessionOutOfSequence = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 28), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionOutOfSequence.setStatus('current')
alPptpStatsSessionTunnelPeerIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 3, 3, 1, 29), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alPptpStatsSessionTunnelPeerIpAddr.setStatus('current')
altigaPptpStatsMibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 3076, 1, 1, 10, 2, 1))
altigaPptpStatsMibCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 3076, 1, 1, 10, 2, 1, 1))
altigaPptpStatsMibCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 3076, 1, 1, 10, 2, 1, 1, 1)).setObjects(("ALTIGA-PPTP-STATS-MIB", "altigaPptpStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
altigaPptpStatsMibCompliance = altigaPptpStatsMibCompliance.setStatus('current')
altigaPptpStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 3076, 2, 1, 1, 1, 3, 2)).setObjects(("ALTIGA-PPTP-STATS-MIB", "alPptpStatsLocalProtVers"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsLocalFraming"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsLocalBearer"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsLocalFirmwareRev"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTotalTunnels"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsActiveTunnels"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsMaxTunnels"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTotalSessions"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsActiveSessions"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsMaxSessions"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsControlRecvOctets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsControlRecvPackets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsControlRecvDiscards"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsControlSendOctets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsControlSendPackets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsPayloadRecvOctets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsPayloadRecvPackets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsPayloadRecvDiscards"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsPayloadSendOctets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsPayloadSendPackets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelRowStatus"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelDatastreamId"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelLocalIpAddr"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerIpAddr"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerHostName"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerVendorName"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerFirmwareRev"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerProtVers"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerFramingCap"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerBearerCap"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelPeerMaxChan"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsTunnelActiveSessions"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionRowStatus"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionDatastreamId"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionLocalCallId"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionPeerCallId"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionUserName"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionSerial"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionMinimumSpeed"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionMaximumSpeed"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionConnectSpeed"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionBearerType"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionFramingType"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionPhysicalChannel"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionLocalWindowSize"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionPeerWindowSize"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionLocalPpd"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionPeerPpd"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionRecvOctets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionRecvPackets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionRecvDiscards"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionRecvZLB"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionSendOctets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionSendPackets"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionSendZLB"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionAckTimeouts"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionLocalFlowOff"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionPeerFlowOff"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionOutOfWindow"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionOutOfSequence"), ("ALTIGA-PPTP-STATS-MIB", "alPptpStatsSessionTunnelPeerIpAddr"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
altigaPptpStatsGroup = altigaPptpStatsGroup.setStatus('current')
mibBuilder.exportSymbols("ALTIGA-PPTP-STATS-MIB", alPptpStatsSessionLocalWindowSize=alPptpStatsSessionLocalWindowSize, alPptpStatsSessionTable=alPptpStatsSessionTable, alPptpStatsSessionOutOfSequence=alPptpStatsSessionOutOfSequence, alStatsPptpGlobal=alStatsPptpGlobal, alPptpStatsTotalSessions=alPptpStatsTotalSessions, alPptpStatsPayloadSendOctets=alPptpStatsPayloadSendOctets, alPptpStatsSessionPhysicalChannel=alPptpStatsSessionPhysicalChannel, alPptpStatsTunnelDatastreamId=alPptpStatsTunnelDatastreamId, alPptpStatsSessionLocalFlowOff=alPptpStatsSessionLocalFlowOff, altigaPptpStatsMibConformance=altigaPptpStatsMibConformance, alPptpStatsControlSendOctets=alPptpStatsControlSendOctets, PYSNMP_MODULE_ID=altigaPptpStatsMibModule, alPptpStatsSessionFramingType=alPptpStatsSessionFramingType, alPptpStatsSessionPeerWindowSize=alPptpStatsSessionPeerWindowSize, alPptpStatsTunnelActiveSessions=alPptpStatsTunnelActiveSessions, alPptpStatsSessionPeerPpd=alPptpStatsSessionPeerPpd, alPptpStatsSessionRecvZLB=alPptpStatsSessionRecvZLB, alPptpStatsSessionAckTimeouts=alPptpStatsSessionAckTimeouts, alPptpStatsSessionPeerFlowOff=alPptpStatsSessionPeerFlowOff, altigaPptpStatsMibCompliance=altigaPptpStatsMibCompliance, alPptpStatsControlRecvDiscards=alPptpStatsControlRecvDiscards, alPptpStatsTunnelPeerHostName=alPptpStatsTunnelPeerHostName, alPptpStatsSessionSendOctets=alPptpStatsSessionSendOctets, alPptpStatsTunnelEntry=alPptpStatsTunnelEntry, alPptpStatsSessionRowStatus=alPptpStatsSessionRowStatus, alPptpStatsSessionDatastreamId=alPptpStatsSessionDatastreamId, alPptpStatsControlRecvOctets=alPptpStatsControlRecvOctets, alPptpStatsActiveTunnels=alPptpStatsActiveTunnels, alPptpStatsSessionRecvPackets=alPptpStatsSessionRecvPackets, alPptpStatsSessionSerial=alPptpStatsSessionSerial, alPptpStatsSessionConnectSpeed=alPptpStatsSessionConnectSpeed, alPptpStatsLocalBearer=alPptpStatsLocalBearer, alPptpStatsSessionRecvOctets=alPptpStatsSessionRecvOctets, alPptpStatsTunnelLocalIpAddr=alPptpStatsTunnelLocalIpAddr, alPptpStatsMaxSessions=alPptpStatsMaxSessions, alPptpStatsTunnelRowStatus=alPptpStatsTunnelRowStatus, alPptpStatsSessionTunnelPeerIpAddr=alPptpStatsSessionTunnelPeerIpAddr, altigaPptpStatsGroup=altigaPptpStatsGroup, alPptpStatsSessionLocalPpd=alPptpStatsSessionLocalPpd, alPptpStatsSessionLocalCallId=alPptpStatsSessionLocalCallId, alPptpStatsTunnelPeerVendorName=alPptpStatsTunnelPeerVendorName, alPptpStatsPayloadRecvPackets=alPptpStatsPayloadRecvPackets, alPptpStatsSessionUserName=alPptpStatsSessionUserName, alPptpStatsSessionSendPackets=alPptpStatsSessionSendPackets, alPptpStatsTotalTunnels=alPptpStatsTotalTunnels, alPptpStatsActiveSessions=alPptpStatsActiveSessions, alPptpStatsSessionMinimumSpeed=alPptpStatsSessionMinimumSpeed, alPptpStatsSessionRecvDiscards=alPptpStatsSessionRecvDiscards, alPptpStatsSessionSendZLB=alPptpStatsSessionSendZLB, alPptpStatsControlRecvPackets=alPptpStatsControlRecvPackets, alPptpStatsLocalFraming=alPptpStatsLocalFraming, alPptpStatsSessionOutOfWindow=alPptpStatsSessionOutOfWindow, alPptpStatsPayloadRecvOctets=alPptpStatsPayloadRecvOctets, alPptpStatsTunnelPeerFramingCap=alPptpStatsTunnelPeerFramingCap, alPptpStatsTunnelPeerBearerCap=alPptpStatsTunnelPeerBearerCap, altigaPptpStatsMibCompliances=altigaPptpStatsMibCompliances, alPptpStatsSessionBearerType=alPptpStatsSessionBearerType, altigaPptpStatsMibModule=altigaPptpStatsMibModule, alPptpStatsMaxTunnels=alPptpStatsMaxTunnels, alPptpStatsLocalFirmwareRev=alPptpStatsLocalFirmwareRev, alPptpStatsPayloadSendPackets=alPptpStatsPayloadSendPackets, alPptpStatsSessionEntry=alPptpStatsSessionEntry, alPptpStatsTunnelPeerIpAddr=alPptpStatsTunnelPeerIpAddr, alPptpStatsPayloadRecvDiscards=alPptpStatsPayloadRecvDiscards, alPptpStatsControlSendPackets=alPptpStatsControlSendPackets, alPptpStatsTunnelPeerProtVers=alPptpStatsTunnelPeerProtVers, alPptpStatsTunnelTable=alPptpStatsTunnelTable, alPptpStatsTunnelPeerMaxChan=alPptpStatsTunnelPeerMaxChan, alPptpStatsSessionPeerCallId=alPptpStatsSessionPeerCallId, alPptpStatsLocalProtVers=alPptpStatsLocalProtVers, alPptpStatsSessionMaximumSpeed=alPptpStatsSessionMaximumSpeed, alPptpStatsTunnelPeerFirmwareRev=alPptpStatsTunnelPeerFirmwareRev)
|
"""
Given two strings containing backspaces (identified by the character ‘#’), check if the two strings are equal.
Example 1:
Input: str1="xy#z", str2="xzz#"
Output: true
Explanation: After applying backspaces the strings become "xz" and "xz" respectively.
"""
# Time: O(M + N) Space: O(1)
def backspace_compare(str1, str2):
# use two pointer approach to compare the strings
index1 = len(str1) - 1
index2 = len(str2) - 1
while (index1 >= 0 or index2 >= 0):
i1 = get_next_valid_char_index(str1, index1)
i2 = get_next_valid_char_index(str2, index2)
if i1 < 0 and i2 < 0: # reached the end of both the strings
return True
if i1 < 0 or i2 < 0: # reached the end of one of the strings
return False
if str1[i1] != str2[i2]: # check if the characters are equal
return False
index1 = i1 - 1
index2 = i2 - 1
return True
def get_next_valid_char_index(str, index):
backspace_count = 0
while (index >= 0):
if str[index] == '#': # found a backspace character
backspace_count += 1
elif backspace_count > 0: # a non-backspace character
backspace_count -= 1
else:
break
index -= 1 # skip a backspace or a valid character
return index
def main():
print(backspace_compare("xy#z", "xzz#"))
print(backspace_compare("xy#z", "xyz#"))
print(backspace_compare("xp#", "xyz##"))
print(backspace_compare("xywrrmp", "xywrrmu#p"))
main() |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def increasingBST(self, root: TreeNode) -> TreeNode:
l=[]
self.inorder(root,l)
t = TreeNode(val=l[0])
head = t
for i in l[1:]:
t.right = TreeNode(val=i)
t = t.right
return head
#in order traversal for asc ordered list
def inorder(self,head,l):
if head == None:
return
self.inorder(head.left,l)
l.append(head.val)
self.inorder(head.right,l) |
sum = 1
nnn = 2
mmm = 666666666
|
def build_report_table(extra_queries):
table = []
column_names = ["Serializer", "Field", "Function", "Max queries"]
rows = [query.to_row() for query in extra_queries]
max_width = max(len(item) for row in rows for item in row)
table.append(
" | ".join(column_name.ljust(max_width) for column_name in column_names)
)
# Separator
table.append("-+-".join(["-" * max_width] * len(column_names)))
for row in rows[1:]:
table.append(" | ".join(column.ljust(max_width) for column in row))
return table
|
SAMPLE_TEXT = """title: FH Technikum Wien
subline: Elektronische Informationsdienste
externalurl: http://technikum-wien.at
duration: "abgeschlossen: 2006"
date: 2006-12-30 12:00
---
* Leistungsstipendium mehrmals erhalten: wird pro Studiengang (ca. 240 Studenten) an 6 Studenten pro Jahr vergeben.
* Teammitglied der [Austrian Cubes](http://www.austriancubes.at/) (Roboter Fussball): Teilnahme an [WM in Osaka (Japan) 2005](http://www.robocup2005.org/)"""
SAMPLE_TEXT_SPLIT = (
"""title: FH Technikum Wien\nsubline: Elektronische Informationsdienste\nexternalurl: http://technikum-wien.at\nduration: "abgeschlossen: 2006"\ndate: 2006-12-30 12:00""",
"""* Leistungsstipendium mehrmals erhalten: wird pro Studiengang (ca. 240 Studenten) an 6 Studenten pro Jahr vergeben.\n* Teammitglied der [Austrian Cubes](http://www.austriancubes.at/) (Roboter Fussball): Teilnahme an [WM in Osaka (Japan) 2005](http://www.robocup2005.org/)"""
)
SAMPLE_METADATA = {
'date': '2006-12-30 12:00',
'duration': 'abgeschlossen: 2006',
'subline': 'Elektronische Informationsdienste',
'title': 'FH Technikum Wien',
'externalurl': 'http://technikum-wien.at',
} |
"""
68. How to get the n’th largest value of a column when grouped by another column?
"""
"""
Difficulty Level: L2
"""
"""
In df, find the second largest value of 'taste' for 'banana'
"""
"""
Input
"""
"""
df = pd.DataFrame({'fruit': ['apple', 'banana', 'orange'] * 3,
'rating': np.random.rand(9),
'price': np.random.randint(0, 15, 9)})
"""
"""
"""
# Input
df = pd.DataFrame({'fruit': ['apple', 'banana', 'orange'] * 3,
'taste': np.random.rand(9),
'price': np.random.randint(0, 15, 9)})
print(df)
# Solution
df_grpd = df['taste'].groupby(df.fruit)
df_grpd.get_group('banana').sort_values().iloc[-2] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.