content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Canister:
def __init__(self, agent, canister_id, candid):
self.agent = agent
self.canister_id = canister_id
self.candid = candid
| class Canister:
def __init__(self, agent, canister_id, candid):
self.agent = agent
self.canister_id = canister_id
self.candid = candid |
expected_output = {
"configuration": {
"vpg_name": "VirtualPortGroup2",
"vpg_ip_addr": "192.168.2.1",
"vpg_ip_mask": "255.255.255.0",
"sng_name": "SNG-APPQOE",
"sng_ip_addr": "192.168.2.2",
},
"status": {"operational_state": "RUNNING"},
}
| expected_output = {'configuration': {'vpg_name': 'VirtualPortGroup2', 'vpg_ip_addr': '192.168.2.1', 'vpg_ip_mask': '255.255.255.0', 'sng_name': 'SNG-APPQOE', 'sng_ip_addr': '192.168.2.2'}, 'status': {'operational_state': 'RUNNING'}} |
# Based on the user's input
print("Give me any 2 numbers! I'll find how many y is in x percent!")
x = input("Enter the first number: ");
y = input("Enter the second nubmer: ")
def percentage(x, y):
return (float(x) * float(y)) / 100.0
print("{0}% of {1} is equal to {2}".format(x, y, percentage(x, y)));
| print("Give me any 2 numbers! I'll find how many y is in x percent!")
x = input('Enter the first number: ')
y = input('Enter the second nubmer: ')
def percentage(x, y):
return float(x) * float(y) / 100.0
print('{0}% of {1} is equal to {2}'.format(x, y, percentage(x, y))) |
def print_msg(number):
def printer():
"Here we are using the nonlocal keyword"
nonlocal number
number=3
print(number)
printer()
print(number)
print_msg(9)
def transmit_to_space(message):
"This is the enclosing function"
def data_transmitter():
"The nested function"
print(message)
return data_transmitter
fun2 = transmit_to_space("Burn the Sun!")
fun2()
def multiplier_of(n):
def multiplier(number):
return number*n
return multiplier
multiplywith5 = multiplier_of(5)
print(multiplywith5(9)) | def print_msg(number):
def printer():
"""Here we are using the nonlocal keyword"""
nonlocal number
number = 3
print(number)
printer()
print(number)
print_msg(9)
def transmit_to_space(message):
"""This is the enclosing function"""
def data_transmitter():
"""The nested function"""
print(message)
return data_transmitter
fun2 = transmit_to_space('Burn the Sun!')
fun2()
def multiplier_of(n):
def multiplier(number):
return number * n
return multiplier
multiplywith5 = multiplier_of(5)
print(multiplywith5(9)) |
a,b = input().split(" ")
x = float(a)
y = float(b)
if x > 0.00 and y > 0.00:
print("Q1")
elif x > 0.00 and y < 0.00:
print("Q4")
elif x < 0.00 and y > 0.00:
print("Q2")
elif x < 0.00 and y < 0.00:
print("Q3")
elif x == 0.00 and y ==0.00:
print("Origem")
elif x == 0.00 and y > 0.0:
print("Eixo Y")
elif x == 0.00 and y < 0.00:
print("Eixo Y")
elif x > 0.00 and y == 0.00:
print("Eixo X")
elif x < 0.00 and y == 0.00:
print("Eixo X")
| (a, b) = input().split(' ')
x = float(a)
y = float(b)
if x > 0.0 and y > 0.0:
print('Q1')
elif x > 0.0 and y < 0.0:
print('Q4')
elif x < 0.0 and y > 0.0:
print('Q2')
elif x < 0.0 and y < 0.0:
print('Q3')
elif x == 0.0 and y == 0.0:
print('Origem')
elif x == 0.0 and y > 0.0:
print('Eixo Y')
elif x == 0.0 and y < 0.0:
print('Eixo Y')
elif x > 0.0 and y == 0.0:
print('Eixo X')
elif x < 0.0 and y == 0.0:
print('Eixo X') |
class Singleton:
__instance = None
@staticmethod
def getinstance():
if Singleton.__instance is None:
raise Exception("Singleton does not exist!")
return Singleton.__instance
def __init__(self, name):
if Singleton.__instance is not None:
raise Exception("This class is a username!")
else:
self.name = name
Singleton.__instance = self.name
@staticmethod
def reset():
Singleton.__instance = None
| class Singleton:
__instance = None
@staticmethod
def getinstance():
if Singleton.__instance is None:
raise exception('Singleton does not exist!')
return Singleton.__instance
def __init__(self, name):
if Singleton.__instance is not None:
raise exception('This class is a username!')
else:
self.name = name
Singleton.__instance = self.name
@staticmethod
def reset():
Singleton.__instance = None |
class Row(list):
def __init__(self, values=None):
self.labels = []
self.values = []
if values:
for idx in values:
self.__setitem__(idx, values[idx])
def __setitem__(self, idx, value):
if type(idx) is str:
if idx in self.labels:
self.values[self.labels.index(idx)] = value
else:
self.labels.append(idx)
self.values.append(value)
else:
self.values[idx] = value
def __getitem__(self, idx):
if type(idx) is str:
return self.values[self.labels.index(idx)]
else:
return self.values[idx]
def __iter__(self):
return self.values.__iter__()
| class Row(list):
def __init__(self, values=None):
self.labels = []
self.values = []
if values:
for idx in values:
self.__setitem__(idx, values[idx])
def __setitem__(self, idx, value):
if type(idx) is str:
if idx in self.labels:
self.values[self.labels.index(idx)] = value
else:
self.labels.append(idx)
self.values.append(value)
else:
self.values[idx] = value
def __getitem__(self, idx):
if type(idx) is str:
return self.values[self.labels.index(idx)]
else:
return self.values[idx]
def __iter__(self):
return self.values.__iter__() |
#from subprocess import call
__all__ = [
'check_numbers',
'command_line',
'match_spaces',
'split_conflict',
'wrap_sentences',
]
| __all__ = ['check_numbers', 'command_line', 'match_spaces', 'split_conflict', 'wrap_sentences'] |
numbers = str(input("Input a list of coma-separated numbers: "))
numbers = ''.join(numbers.split())
numList = numbers.split(",")
numListClean = list(dict.fromkeys(numList))
print(f"\n{numListClean}") | numbers = str(input('Input a list of coma-separated numbers: '))
numbers = ''.join(numbers.split())
num_list = numbers.split(',')
num_list_clean = list(dict.fromkeys(numList))
print(f'\n{numListClean}') |
H = [[0, -1, [68.16,1]], [0, -1, [10.2465,1]], [0, -1, [2.34648,1]],
[0, -1, [0.67332,1]], [0, -1, [0.22466,1]], [0, -1, [0.082217,1]],
[1, 0, [1.3,1]], [1, 0, [0.33,1]],
[2, 0, [1.0,1]], ]
C = [[0, -1, [16371.074,1]], [0, -1, [2426.9925,1]], [0, -1, [544.54418,1]],
[0, -1, [150.80487,1]], [0, -1, [47.708143,1]], [0, -1, [16.457241,1]],
[0, -1, [6.0845578,1]], [0, -1, [2.3824631,1]], [0, -1, [0.6619866,1]],
[0, -1, [0.24698997,1]], [0, -1, [0.0949873,1]],
[1, 0, [40.790423,1]], [1, 0, [9.5034633,1]], [1, 0, [2.9408357,1]],
[1, 0, [1.0751115,1]], [1, 0, [0.4267024,1]], [1, 0, [0.17481926,1]],
[1, 0, [0.07113054,1]],
[2, 0, [0.35,1]], [2, 0, [1.4,1]], ]
F = [[0, -1, [37736.0,1]], [0, -1, [5867.0791,1]], [0, -1, [1332.4679,1]],
[0, -1, [369.4406,1]], [0, -1, [116.843,1]], [0, -1, [40.34877,1]],
[0, -1, [14.96627,1]], [0, -1, [5.8759295,1]], [0, -1, [1.6533352,1]],
[0, -1, [0.61083583,1]], [0, -1, [0.23328922,1]],
[1, 0, [102.26192,1]], [1, 0, [23.938381,1]], [1, 0, [7.5205914,1]],
[1, 0, [2.7724566,1]], [1, 0, [1.1000514,1]], [1, 0, [0.44677512,1]],
[1, 0, [0.17187009,1]],
[2, 0, [1.4,1]], [2, 0, [0.35,1]],]
Cl = [[0, -1, [105818.82,1]], [0, -1, [15872.006,1]], [0, -1, [3619.6548,1]],
[0, -1, [1030.8038,1]], [0, -1, [339.90788,1]], [0, -1, [124.5381,1]],
[0, -1, [49.513502,1]], [0, -1, [20.805604,1]], [0, -1, [6.4648238,1]],
[0, -1, [2.5254537,1]], [0, -1, [1.16544849,1]], [0, -1, [0.53783215,1]],
[0, -1, [0.19349716,1]],
[1, 0, [622.02736,1]], [1, 0, [145.49719,1]], [1, 0, [45.008659,1]],
[1, 0, [15.900889,1]], [1, 0, [5.9259437,1]], [1, 0, [2.2943822,1]],
[1, 0, [0.6280655,1]], [1, 0, [0.18123318,1]],
[2, 0, [2.5,1]], [2, 0, [0.8,1]], [2, 0, [0.25,1]], ]
| h = [[0, -1, [68.16, 1]], [0, -1, [10.2465, 1]], [0, -1, [2.34648, 1]], [0, -1, [0.67332, 1]], [0, -1, [0.22466, 1]], [0, -1, [0.082217, 1]], [1, 0, [1.3, 1]], [1, 0, [0.33, 1]], [2, 0, [1.0, 1]]]
c = [[0, -1, [16371.074, 1]], [0, -1, [2426.9925, 1]], [0, -1, [544.54418, 1]], [0, -1, [150.80487, 1]], [0, -1, [47.708143, 1]], [0, -1, [16.457241, 1]], [0, -1, [6.0845578, 1]], [0, -1, [2.3824631, 1]], [0, -1, [0.6619866, 1]], [0, -1, [0.24698997, 1]], [0, -1, [0.0949873, 1]], [1, 0, [40.790423, 1]], [1, 0, [9.5034633, 1]], [1, 0, [2.9408357, 1]], [1, 0, [1.0751115, 1]], [1, 0, [0.4267024, 1]], [1, 0, [0.17481926, 1]], [1, 0, [0.07113054, 1]], [2, 0, [0.35, 1]], [2, 0, [1.4, 1]]]
f = [[0, -1, [37736.0, 1]], [0, -1, [5867.0791, 1]], [0, -1, [1332.4679, 1]], [0, -1, [369.4406, 1]], [0, -1, [116.843, 1]], [0, -1, [40.34877, 1]], [0, -1, [14.96627, 1]], [0, -1, [5.8759295, 1]], [0, -1, [1.6533352, 1]], [0, -1, [0.61083583, 1]], [0, -1, [0.23328922, 1]], [1, 0, [102.26192, 1]], [1, 0, [23.938381, 1]], [1, 0, [7.5205914, 1]], [1, 0, [2.7724566, 1]], [1, 0, [1.1000514, 1]], [1, 0, [0.44677512, 1]], [1, 0, [0.17187009, 1]], [2, 0, [1.4, 1]], [2, 0, [0.35, 1]]]
cl = [[0, -1, [105818.82, 1]], [0, -1, [15872.006, 1]], [0, -1, [3619.6548, 1]], [0, -1, [1030.8038, 1]], [0, -1, [339.90788, 1]], [0, -1, [124.5381, 1]], [0, -1, [49.513502, 1]], [0, -1, [20.805604, 1]], [0, -1, [6.4648238, 1]], [0, -1, [2.5254537, 1]], [0, -1, [1.16544849, 1]], [0, -1, [0.53783215, 1]], [0, -1, [0.19349716, 1]], [1, 0, [622.02736, 1]], [1, 0, [145.49719, 1]], [1, 0, [45.008659, 1]], [1, 0, [15.900889, 1]], [1, 0, [5.9259437, 1]], [1, 0, [2.2943822, 1]], [1, 0, [0.6280655, 1]], [1, 0, [0.18123318, 1]], [2, 0, [2.5, 1]], [2, 0, [0.8, 1]], [2, 0, [0.25, 1]]] |
pessoas = []
dados = []
while True:
dados.append(input('Digite seu nome: '))
dados.append(float(input('Digite seu peso: ')))
pessoas.append(dados[:])
dados.clear()
r = input('Quer continuar? [S/N]: ')
if r in 'Nn':
break
print(f'{len(pessoas)} pessoas foram cadastradas!')
pesado = 0
leve = 0
nome_pesado = nome_leve = ''
for c in pessoas:
if pesado == 0 and leve == 0:
leve = c[1]
pesado = c[1]
nome_pesado = c[0]
nome_leve = c[0]
elif c[1] >= pesado:
pesado = c[1]
nome_pesado = c[0]
elif c[1] <= leve:
leve = c[1]
nome_leve = c[0]
print(f'O maior peso foi de {pesado}kg. Peso de ', end='')
for cont in pessoas:
if cont[1] == pesado:
print(f'[{cont[0]}] ', end='')
print(f'\nO menor peso foi de {leve}kg. Peso de ', end='')
for p in pessoas:
if p[1] == leve:
print(f'[{p[0] }] ', end='')
| pessoas = []
dados = []
while True:
dados.append(input('Digite seu nome: '))
dados.append(float(input('Digite seu peso: ')))
pessoas.append(dados[:])
dados.clear()
r = input('Quer continuar? [S/N]: ')
if r in 'Nn':
break
print(f'{len(pessoas)} pessoas foram cadastradas!')
pesado = 0
leve = 0
nome_pesado = nome_leve = ''
for c in pessoas:
if pesado == 0 and leve == 0:
leve = c[1]
pesado = c[1]
nome_pesado = c[0]
nome_leve = c[0]
elif c[1] >= pesado:
pesado = c[1]
nome_pesado = c[0]
elif c[1] <= leve:
leve = c[1]
nome_leve = c[0]
print(f'O maior peso foi de {pesado}kg. Peso de ', end='')
for cont in pessoas:
if cont[1] == pesado:
print(f'[{cont[0]}] ', end='')
print(f'\nO menor peso foi de {leve}kg. Peso de ', end='')
for p in pessoas:
if p[1] == leve:
print(f'[{p[0]}] ', end='') |
a = [1,2,3,4,5]
def getMinList(numbers):
minNumber = numbers[0]
for i in numbers:
if i < minNumber:
minNumber = i
return minNumber
print(getMinList(a))
print(getMinList([9,3,8,9])) | a = [1, 2, 3, 4, 5]
def get_min_list(numbers):
min_number = numbers[0]
for i in numbers:
if i < minNumber:
min_number = i
return minNumber
print(get_min_list(a))
print(get_min_list([9, 3, 8, 9])) |
def q3(datas: List[int]) -> int:
'''find the best time point to buy and sell stocks(at most one transaction)'''
max_profit = 0
min_price = None
for item in datas:
if min_price is None:
min_price = item
continue
if item > min_price:
if item - min_price > max_profit:
max_profit = item - min_price
elif item < min_price:
min_price = item
return max_profit
test_list1 = [7, 1, 5, 3, 6, 4]
print(q3(test_list1))
test_list2 = [7, 6, 4, 3, 1]
print(q3(test_list2))
| def q3(datas: List[int]) -> int:
"""find the best time point to buy and sell stocks(at most one transaction)"""
max_profit = 0
min_price = None
for item in datas:
if min_price is None:
min_price = item
continue
if item > min_price:
if item - min_price > max_profit:
max_profit = item - min_price
elif item < min_price:
min_price = item
return max_profit
test_list1 = [7, 1, 5, 3, 6, 4]
print(q3(test_list1))
test_list2 = [7, 6, 4, 3, 1]
print(q3(test_list2)) |
'''
Created on Jul 10, 2012
@author: Chris
'''
class Node(object):
def __init__(self):
self.next = None
self.previous = None
self.element = None
class LinkedList(object):
def __init__(self):
self.n = 0
self.last = Node()
self.first = self.last
def append(self, element):
self.last.element = element
self.last.next = Node()
tmp = self.last
self.last = self.last.next
self.last.previous = tmp
self.n += 1
def front(self):
if self.n == 0: return None
e = self.first.element
self.first = self.first.next
self.n -= 1
return e
def back(self):
if self.n == 0: return None
e = self.last.previous.element
self.last = self.last.previous
self.last.next = Node()
self.n -= 1
return e
def size(self):
return self.n
def elements(self):
i = self.first
while i.element:
yield i.element
i = i.next
class LinkedQueue(object):
def __init__(self):
self.l = LinkedList()
def clear(self):
while not self.empty():
self.l.front()
def enqueue(self, element):
self.l.append(element)
def dequeue(self):
return self.l.front()
def empty(self):
return self.l.size() == 0
def size(self):
return self.l.size()
def elements(self):
return [x for x in self.l.elements()] | """
Created on Jul 10, 2012
@author: Chris
"""
class Node(object):
def __init__(self):
self.next = None
self.previous = None
self.element = None
class Linkedlist(object):
def __init__(self):
self.n = 0
self.last = node()
self.first = self.last
def append(self, element):
self.last.element = element
self.last.next = node()
tmp = self.last
self.last = self.last.next
self.last.previous = tmp
self.n += 1
def front(self):
if self.n == 0:
return None
e = self.first.element
self.first = self.first.next
self.n -= 1
return e
def back(self):
if self.n == 0:
return None
e = self.last.previous.element
self.last = self.last.previous
self.last.next = node()
self.n -= 1
return e
def size(self):
return self.n
def elements(self):
i = self.first
while i.element:
yield i.element
i = i.next
class Linkedqueue(object):
def __init__(self):
self.l = linked_list()
def clear(self):
while not self.empty():
self.l.front()
def enqueue(self, element):
self.l.append(element)
def dequeue(self):
return self.l.front()
def empty(self):
return self.l.size() == 0
def size(self):
return self.l.size()
def elements(self):
return [x for x in self.l.elements()] |
class Member:
def __init__(self, name , age):
self.name = name
self.age=age
self.id=0
def __str__(self):
return "name:{} ,age: {},id:{}".format(self.name,self.age,self.id)
class Post:
def __init__(self , title , content):
self.title = title
self.content = content
self.id=0
def __str__(self):
return "post title:{},\n post content:{} ".format(self.title,self.content)
| class Member:
def __init__(self, name, age):
self.name = name
self.age = age
self.id = 0
def __str__(self):
return 'name:{} ,age: {},id:{}'.format(self.name, self.age, self.id)
class Post:
def __init__(self, title, content):
self.title = title
self.content = content
self.id = 0
def __str__(self):
return 'post title:{},\n post content:{} '.format(self.title, self.content) |
class Solution:
def solve(self, heights):
stack = []
for i in range(len(heights)):
while stack and heights[stack[-1]] <= heights[i]:
stack.pop()
stack.append(i)
return stack
| class Solution:
def solve(self, heights):
stack = []
for i in range(len(heights)):
while stack and heights[stack[-1]] <= heights[i]:
stack.pop()
stack.append(i)
return stack |
'''
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Eg.
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
if not head.next:
return None
length = 0
cur = head
while cur:
length += 1
cur = cur.next
index = length - n
if index == 0:
head = head.next
return head
cur = head
prev = None
while index != 0 and cur:
prev = cur
cur = cur.next
index -= 1
prev.next = cur.next
return head
| """
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Eg.
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
"""
class Solution:
def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode:
if not head.next:
return None
length = 0
cur = head
while cur:
length += 1
cur = cur.next
index = length - n
if index == 0:
head = head.next
return head
cur = head
prev = None
while index != 0 and cur:
prev = cur
cur = cur.next
index -= 1
prev.next = cur.next
return head |
#!/usr/bin/env python3
'''
Write a function called gcd that takes parameters a and b and returns
their greatest common divisor
'''
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
print(gcd(12, 8))
| """
Write a function called gcd that takes parameters a and b and returns
their greatest common divisor
"""
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
print(gcd(12, 8)) |
t = int(input())
while t > 0:
t -= 1
n, m = input().split()
blocos = [int(x) for x in input().split()]
blocos.sort()
qt = 0
n = int(n)-1
m = int(m)
while m > 0:
while m < blocos[n]:
n -= 1
m -= blocos[n]
qt += 1
print(qt)
| t = int(input())
while t > 0:
t -= 1
(n, m) = input().split()
blocos = [int(x) for x in input().split()]
blocos.sort()
qt = 0
n = int(n) - 1
m = int(m)
while m > 0:
while m < blocos[n]:
n -= 1
m -= blocos[n]
qt += 1
print(qt) |
def grade(arg, key):
if "flag{crash}".lower() == key.lower():
return True, "Denial of service attacks are boring."
else:
return False, "Try crashing the program."
| def grade(arg, key):
if 'flag{crash}'.lower() == key.lower():
return (True, 'Denial of service attacks are boring.')
else:
return (False, 'Try crashing the program.') |
# Copyright: Copyright (c) 2020., Adam Jakab
#
# Author: Adam Jakab <adam at jakab dot pro>
# Created: 2/24/20, 12:09 AM
# License: See LICENSE.txt
__version__ = '1.3.4'
| __version__ = '1.3.4' |
# START LAB EXERCISE 06
print('Lab Exercise 06 \n')
#SETUP
chinese_desserts = [
["Wheat Flour Cake", 190],
["Egg Yolk", 260],
["Green Bean Cake", 100],
["Taro Pastry", 227],
["Durian Cake", 360],
["Flower Pastry", 130],
["Sun Cake", 172]
]
# END SETUP
# PROBLEM 1 (3 points)
# TODO Implement function
name = None # call function
print(f"\n1. First dessert item: {name}")
# PROBLEM 2 (3 points)
# TODO Implement function
calories = None # call function
print(f"\n2A. Calories of the second dessert item: {calories}")
# PROBLEM 3 (5 points)
# TODO Implement function
# TODO call function
print(f"\n3. {chinese_desserts}")
# Problem 4 (6 points)
# TODO Create variable
# TODO call function
print(f"\n4. {chinese_desserts}")
# Problem 5 (3 points)
# TODO Implement function
# TODO call function
print(f"\n5. {chinese_desserts}")
# END LAB EXERCISE
| print('Lab Exercise 06 \n')
chinese_desserts = [['Wheat Flour Cake', 190], ['Egg Yolk', 260], ['Green Bean Cake', 100], ['Taro Pastry', 227], ['Durian Cake', 360], ['Flower Pastry', 130], ['Sun Cake', 172]]
name = None
print(f'\n1. First dessert item: {name}')
calories = None
print(f'\n2A. Calories of the second dessert item: {calories}')
print(f'\n3. {chinese_desserts}')
print(f'\n4. {chinese_desserts}')
print(f'\n5. {chinese_desserts}') |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
load("//antlir/bzl:query.bzl", "query")
# Find the feature JSON belonging to this layer.
def layer_features_json_query(layer):
return "$(query_targets_and_outputs '{query}')".format(
query = query.attrfilter(
label = "type",
value = "image_feature",
expr = query.deps(
expr = query.set(layer),
# Limit depth to 1 to get just the `__layer-feature` target.
# All other features are at distance 2+.
depth = 1,
),
),
)
# Find features JSONs and fetched package targets/outputs for the transitive
# deps of `layer`. We need this to construct the full set of features for
# the layer and its parent layers.
def layer_included_features_query(layer):
return "$(query_targets_and_outputs '{query}')".format(
query = query.attrregexfilter(
label = "type",
pattern = "|".join([
"image_layer",
"image_feature",
"image_layer_from_package",
"fetched_package_with_nondeterministic_fs_metadata",
]),
expr = query.deps(
expr = query.set(layer),
depth = query.UNBOUNDED,
),
),
)
# Any "layer package builder" implementations need to tag themselves with
# this label to be included when packaging a layer for replay deployment.
ANTLIR_BUILD_PKG_LABEL = "antlir_build_pkg"
# Find all package builders for any mounted packages in `layer` (and its
# parents). We use these to package the mounts when we package the layer.
def layer_included_builders_query(layer):
return "$(query_targets_and_outputs '{query}')".format(
query = query.attrfilter(
label = "labels",
value = ANTLIR_BUILD_PKG_LABEL,
expr = query.deps(
expr = query.set(layer),
depth = query.UNBOUNDED,
),
),
)
def _location(target):
return "$(location {})".format(target)
# A convenient way to access the results of the above queries in Python
# unit tests. Use the Python function `build_env_map` to deserialize.
def test_env_map(infix_to_layer):
return {
"antlir_test__{}__{}".format(infix, env_name): query_fn(target)
for infix, target in infix_to_layer
for env_name, query_fn in [
("builders", layer_included_builders_query),
("layer_feature_json", layer_features_json_query),
("layer_output", _location),
("target_path_pairs", layer_included_features_query),
]
}
| load('//antlir/bzl:query.bzl', 'query')
def layer_features_json_query(layer):
return "$(query_targets_and_outputs '{query}')".format(query=query.attrfilter(label='type', value='image_feature', expr=query.deps(expr=query.set(layer), depth=1)))
def layer_included_features_query(layer):
return "$(query_targets_and_outputs '{query}')".format(query=query.attrregexfilter(label='type', pattern='|'.join(['image_layer', 'image_feature', 'image_layer_from_package', 'fetched_package_with_nondeterministic_fs_metadata']), expr=query.deps(expr=query.set(layer), depth=query.UNBOUNDED)))
antlir_build_pkg_label = 'antlir_build_pkg'
def layer_included_builders_query(layer):
return "$(query_targets_and_outputs '{query}')".format(query=query.attrfilter(label='labels', value=ANTLIR_BUILD_PKG_LABEL, expr=query.deps(expr=query.set(layer), depth=query.UNBOUNDED)))
def _location(target):
return '$(location {})'.format(target)
def test_env_map(infix_to_layer):
return {'antlir_test__{}__{}'.format(infix, env_name): query_fn(target) for (infix, target) in infix_to_layer for (env_name, query_fn) in [('builders', layer_included_builders_query), ('layer_feature_json', layer_features_json_query), ('layer_output', _location), ('target_path_pairs', layer_included_features_query)]} |
###############################################################
VERSION = '0.11.11'
###############################################################
default_app_config = 'swingtime.apps.SwingtimeConfig'
###############################################################
| version = '0.11.11'
default_app_config = 'swingtime.apps.SwingtimeConfig' |
class Card:
def __init__(self, name, team, active):
self.name = name
self.team = team # "teamid :: black=0, team1=1, team2=2, grey=3"
self.active = active # "known=False, unknown=True"
self.toggle = True
def __str__(self):
return "[" + '{:^15}'.format(self.name) + '{:3}'.format(str(self.team)) + '{:6}'.format(str(self.active))+"]"
| class Card:
def __init__(self, name, team, active):
self.name = name
self.team = team
self.active = active
self.toggle = True
def __str__(self):
return '[' + '{:^15}'.format(self.name) + '{:3}'.format(str(self.team)) + '{:6}'.format(str(self.active)) + ']' |
# Ejercicio 1
# https://leetcode.com/problems/unique-paths-ii/
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid):
if obstacleGrid[0][0] != 0:
return 0
rows, colums = len(obstacleGrid), len(obstacleGrid[0])
dp = []
for i in range(rows):
arr = []
for j in range(colums):
arr.append(0)
dp.append(arr)
dp[0][0] = 1
for i in range(rows):
for j in range(colums):
if obstacleGrid[i][j] != 0 or (i == 0 and j == 0):
continue
if i != 0:
dp[i][j] += dp[i-1][j]
if j != 0:
dp[i][j] += dp[i][j-1]
return dp[rows-1][colums-1] | class Solution:
def unique_paths_with_obstacles(self, obstacleGrid):
if obstacleGrid[0][0] != 0:
return 0
(rows, colums) = (len(obstacleGrid), len(obstacleGrid[0]))
dp = []
for i in range(rows):
arr = []
for j in range(colums):
arr.append(0)
dp.append(arr)
dp[0][0] = 1
for i in range(rows):
for j in range(colums):
if obstacleGrid[i][j] != 0 or (i == 0 and j == 0):
continue
if i != 0:
dp[i][j] += dp[i - 1][j]
if j != 0:
dp[i][j] += dp[i][j - 1]
return dp[rows - 1][colums - 1] |
num1 =10
num2 = 20
num3 = 30
num4 = 100
num5 = 'orz'
| num1 = 10
num2 = 20
num3 = 30
num4 = 100
num5 = 'orz' |
latest_block_redis_key = "latest_block_from_chain"
latest_block_hash_redis_key = "latest_blockhash_from_chain"
most_recent_indexed_block_redis_key = "most_recently_indexed_block_from_db"
most_recent_indexed_block_hash_redis_key = "most_recently_indexed_block_hash_from_db"
most_recent_indexed_ipld_block_redis_key = "most_recent_indexed_ipld_block_redis_key"
most_recent_indexed_ipld_block_hash_redis_key = (
"most_recent_indexed_ipld_block_hash_redis_key"
)
most_recent_indexed_aggregate_user_block_redis_key = (
"most_recent_indexed_aggregate_user_block"
)
index_aggregate_user_last_refresh_completion_redis_key = (
"index_aggregate_user:last-refresh-completion"
)
trending_tracks_last_completion_redis_key = "trending:tracks:last-completion"
trending_playlists_last_completion_redis_key = "trending-playlists:last-completion"
challenges_last_processed_event_redis_key = "challenges:last-processed-event"
user_balances_refresh_last_completion_redis_key = "user_balances:last-completion"
latest_legacy_play_db_key = "latest_legacy_play_db_key"
index_eth_last_completion_redis_key = "index_eth:last-completion"
# Solana latest program keys
latest_sol_play_program_tx_key = "latest_sol_program_tx:play:chain"
latest_sol_play_db_tx_key = "latest_sol_program_tx:play:db"
latest_sol_rewards_manager_program_tx_key = (
"latest_sol_program_tx:rewards_manager:chain"
)
latest_sol_rewards_manager_db_tx_key = "latest_sol_program_tx:rewards_manager:db"
latest_sol_user_bank_program_tx_key = "latest_sol_program_tx:user_bank:chain"
latest_sol_user_bank_db_tx_key = "latest_sol_program_tx:user_bank:db"
| latest_block_redis_key = 'latest_block_from_chain'
latest_block_hash_redis_key = 'latest_blockhash_from_chain'
most_recent_indexed_block_redis_key = 'most_recently_indexed_block_from_db'
most_recent_indexed_block_hash_redis_key = 'most_recently_indexed_block_hash_from_db'
most_recent_indexed_ipld_block_redis_key = 'most_recent_indexed_ipld_block_redis_key'
most_recent_indexed_ipld_block_hash_redis_key = 'most_recent_indexed_ipld_block_hash_redis_key'
most_recent_indexed_aggregate_user_block_redis_key = 'most_recent_indexed_aggregate_user_block'
index_aggregate_user_last_refresh_completion_redis_key = 'index_aggregate_user:last-refresh-completion'
trending_tracks_last_completion_redis_key = 'trending:tracks:last-completion'
trending_playlists_last_completion_redis_key = 'trending-playlists:last-completion'
challenges_last_processed_event_redis_key = 'challenges:last-processed-event'
user_balances_refresh_last_completion_redis_key = 'user_balances:last-completion'
latest_legacy_play_db_key = 'latest_legacy_play_db_key'
index_eth_last_completion_redis_key = 'index_eth:last-completion'
latest_sol_play_program_tx_key = 'latest_sol_program_tx:play:chain'
latest_sol_play_db_tx_key = 'latest_sol_program_tx:play:db'
latest_sol_rewards_manager_program_tx_key = 'latest_sol_program_tx:rewards_manager:chain'
latest_sol_rewards_manager_db_tx_key = 'latest_sol_program_tx:rewards_manager:db'
latest_sol_user_bank_program_tx_key = 'latest_sol_program_tx:user_bank:chain'
latest_sol_user_bank_db_tx_key = 'latest_sol_program_tx:user_bank:db' |
def check_i_islarger2(i, last_i):
islarger = i > last_i
last_i = i
return islarger, last_i
def omp_parallel_for_ordered():
sum = 0
is_larger = True
last_i = 0
'omp parallel for schedule(static, 1) ordered'
for i in range(1,100):
ii = i
if 'omp ordered':
tmp_is_larger, last_i = check_i_islarger2(i, last_i)
is_larger = tmp_is_larger and is_larger
sum += ii
known_sum = (99 * 100) / 2
return known_sum == sum and is_larger
| def check_i_islarger2(i, last_i):
islarger = i > last_i
last_i = i
return (islarger, last_i)
def omp_parallel_for_ordered():
sum = 0
is_larger = True
last_i = 0
'omp parallel for schedule(static, 1) ordered'
for i in range(1, 100):
ii = i
if 'omp ordered':
(tmp_is_larger, last_i) = check_i_islarger2(i, last_i)
is_larger = tmp_is_larger and is_larger
sum += ii
known_sum = 99 * 100 / 2
return known_sum == sum and is_larger |
sal_info= dict ()
sal_info={'Austin':911985, 'Dallas': 89999, 'San Jose': 100989, 'Atlanta': 89286,'Portland':101367}
#reassigns the salary for Atlanta
sal_info['Atlanta']= 92340
print (sal_info)
#del sal_info['Atlanta']
#print (sal_info)
#print (sal_info['Atlanta'])
#del sal_info
#sal_info.clear()
#print (sal_info)
if ('Seattle' not in sal_info):
sal_info['Seattle']= 110340
else:
print ("key exists")
print (sal_info)
#if ("Austin" in sal_db):
# print (sal_db['Austin'])
#if ("Seattle" not in sal_db):
# sal_db['Seattle']= 100010
#print (sal_db)
#del sal_db['Dallas']
#print (sal_db['Dallas'])
#del sal_db
#print (sal_db)
| sal_info = dict()
sal_info = {'Austin': 911985, 'Dallas': 89999, 'San Jose': 100989, 'Atlanta': 89286, 'Portland': 101367}
sal_info['Atlanta'] = 92340
print(sal_info)
if 'Seattle' not in sal_info:
sal_info['Seattle'] = 110340
else:
print('key exists')
print(sal_info) |
expected_output = {
"instance": {
"default": {
"vrf": {
"blue": {
"address_family": {
"vpnv4": {
"prefixes": {
"10.144.0.0/24": {
"table_version": "88",
"available_path": "4",
"best_path": "1",
"paths": "4 available, best #1, table blue",
"index": {
1: {
"next_hop": "10.3.3.3",
"gateway": "10.6.6.6",
"imported_path_from": "12:23:10.144.0.0/24",
"originator": "10.6.6.6",
"route_info": "1",
"next_hop_igp_metric": "21",
"localpref": 200,
"metric": 0,
"mpls_labels": {
"in": "nolabel",
"out": "37",
},
"origin_codes": "?",
"status_codes": "*>",
"ext_community": "RT:12:23",
"update_group": 6,
},
2: {
"next_hop": "10.13.13.13",
"gateway": "10.13.13.13",
"imported_path_from": "12:23:10.144.0.0/24",
"originator": "10.0.0.2",
"route_info": "1",
"next_hop_via": "green",
"localpref": 100,
"metric": 0,
"origin_codes": "?",
"status_codes": "* ",
"ext_community": "RT:12:23 ",
"recursive_via_connected": True,
"update_group": 6,
},
3: {
"next_hop": "10.3.3.3",
"gateway": "10.7.7.7",
"imported_path_from": "12:23:10.144.0.0/24",
"originator": "10.7.7.7",
"next_hop_igp_metric": "21",
"localpref": 200,
"metric": 0,
"mpls_labels": {
"in": "nolabel",
"out": "37",
},
"origin_codes": "?",
"route_info": "1",
"status_codes": "* i",
"ext_community": "RT:12:23",
"update_group": 6,
},
4: {
"next_hop": "10.11.11.11",
"gateway": "10.11.11.11",
"originator": "10.1.0.1",
"ext_community": "RT:11:12 ",
"recursive_via_connected": True,
"update_group": 6,
},
},
}
}
}
}
}
}
}
}
}
| expected_output = {'instance': {'default': {'vrf': {'blue': {'address_family': {'vpnv4': {'prefixes': {'10.144.0.0/24': {'table_version': '88', 'available_path': '4', 'best_path': '1', 'paths': '4 available, best #1, table blue', 'index': {1: {'next_hop': '10.3.3.3', 'gateway': '10.6.6.6', 'imported_path_from': '12:23:10.144.0.0/24', 'originator': '10.6.6.6', 'route_info': '1', 'next_hop_igp_metric': '21', 'localpref': 200, 'metric': 0, 'mpls_labels': {'in': 'nolabel', 'out': '37'}, 'origin_codes': '?', 'status_codes': '*>', 'ext_community': 'RT:12:23', 'update_group': 6}, 2: {'next_hop': '10.13.13.13', 'gateway': '10.13.13.13', 'imported_path_from': '12:23:10.144.0.0/24', 'originator': '10.0.0.2', 'route_info': '1', 'next_hop_via': 'green', 'localpref': 100, 'metric': 0, 'origin_codes': '?', 'status_codes': '* ', 'ext_community': 'RT:12:23 ', 'recursive_via_connected': True, 'update_group': 6}, 3: {'next_hop': '10.3.3.3', 'gateway': '10.7.7.7', 'imported_path_from': '12:23:10.144.0.0/24', 'originator': '10.7.7.7', 'next_hop_igp_metric': '21', 'localpref': 200, 'metric': 0, 'mpls_labels': {'in': 'nolabel', 'out': '37'}, 'origin_codes': '?', 'route_info': '1', 'status_codes': '* i', 'ext_community': 'RT:12:23', 'update_group': 6}, 4: {'next_hop': '10.11.11.11', 'gateway': '10.11.11.11', 'originator': '10.1.0.1', 'ext_community': 'RT:11:12 ', 'recursive_via_connected': True, 'update_group': 6}}}}}}}}}}} |
def example_1():
l = [1, 2, 3]
print(l * 5)
print(5 * 'abcd')
def example_2():
board = [['_'] * 3 for i in range(3)]
print(board)
board[1][2] = 'X'
print(board)
def example_3():
weird_board = [['_'] * 3] * 3
print(weird_board)
weird_board[1][2] = '0'
print(weird_board)
def example_4():
row = ['_'] * 3
board = []
for i in range(3):
board.append(row)
print(board)
board[2][0] = 'X'
print(board)
board = []
for i in range(3):
row = ['_'] * 3
board.append(row)
print(board)
board[2][0] = 'X'
print(board)
if __name__ == '__main__':
example_1()
example_2()
example_3()
example_4()
| def example_1():
l = [1, 2, 3]
print(l * 5)
print(5 * 'abcd')
def example_2():
board = [['_'] * 3 for i in range(3)]
print(board)
board[1][2] = 'X'
print(board)
def example_3():
weird_board = [['_'] * 3] * 3
print(weird_board)
weird_board[1][2] = '0'
print(weird_board)
def example_4():
row = ['_'] * 3
board = []
for i in range(3):
board.append(row)
print(board)
board[2][0] = 'X'
print(board)
board = []
for i in range(3):
row = ['_'] * 3
board.append(row)
print(board)
board[2][0] = 'X'
print(board)
if __name__ == '__main__':
example_1()
example_2()
example_3()
example_4() |
t = int(input())
for _ in range(t):
s = input()
a = list(s).count('A')
b = list(s).count('B'); #print(a, b)
i = 1
while(i < len(s) - 1):
if s[i] == '.':
start = i
j = i + 1
for j in range(len(s) - 1):
if s[j] != '.':
end = j - 1
break
i = j
else:
i += 1
print(j, start, end)
if s[start - 1] == 'A' and s[end + 1] == 'A':
a += end - start + 1
continue
if s[start - 1] == 'B' and s[end + 1] == 'B':
b += end - start + 1
print(a, b) | t = int(input())
for _ in range(t):
s = input()
a = list(s).count('A')
b = list(s).count('B')
i = 1
while i < len(s) - 1:
if s[i] == '.':
start = i
j = i + 1
for j in range(len(s) - 1):
if s[j] != '.':
end = j - 1
break
i = j
else:
i += 1
print(j, start, end)
if s[start - 1] == 'A' and s[end + 1] == 'A':
a += end - start + 1
continue
if s[start - 1] == 'B' and s[end + 1] == 'B':
b += end - start + 1
print(a, b) |
# page on website that serves as base for archives.
BASE_URL = \
'https://awebsite.org/index'
# only extract the links that have these strings
# as part of the urls.
BASE_MUST_CONTAIN = '/someword/'
PAGE_MUST_CONTAIN = '/someword/'
# urls to use for testing.
TEST_SINGLE_PAGE_URL = \
'https://awebsite.org/2019'
TEST_SINGLE_PAGE_CONTENT = \
'https://awebsite.org/2019/experience1'
TEST_SINGLE_PAGE_CONTAINS = '/someword/'
# AWS resource settings.
AWS_REGION = 'your-region'
DB_TABLE = 'your-dynamodb-table' | base_url = 'https://awebsite.org/index'
base_must_contain = '/someword/'
page_must_contain = '/someword/'
test_single_page_url = 'https://awebsite.org/2019'
test_single_page_content = 'https://awebsite.org/2019/experience1'
test_single_page_contains = '/someword/'
aws_region = 'your-region'
db_table = 'your-dynamodb-table' |
def solve(polymer, rules,values,steps = 10):
for step in range(steps):
new_polymer={}
# Efficiently this can be done with the idea that we do not need to keep the order,
# we just need to represent that if NN -> C then #NN == #NC and #NN == #CN
for key in polymer:
value = polymer[key]
try:
values[rules[key]] += value
except:
values[rules[key]] = value
try:
new_polymer [key[0] + rules[key]] += value
except:
new_polymer [key[0] + rules[key]] = value
try:
new_polymer [rules[key] + key[1]] += value
except:
new_polymer [rules[key] + key[1]] = value
polymer = new_polymer
return max(values.values()) - min(values.values())
polymer = "SCSCSKKVVBKVFKSCCSOV"
values = {key: polymer.count(key) for key in set(polymer) }
polymer_dict = {}
for i in range(len(polymer)-1):
try:
polymer_dict[polymer[i:i+2]] += 1
except:
polymer_dict[polymer[i:i+2]] = 1
rules = {}
with open("Day14_input.txt",'r') as inputfile:
for line in inputfile:
line = line.split(" -> ")
rules[line[0]] = line[1] [:-1]
part1_sol = solve(polymer_dict,rules,values)
print("Part 1 solution: ", part1_sol)
polymer = "SCSCSKKVVBKVFKSCCSOV"
values = {key: polymer.count(key) for key in set(polymer) }
polymer_dict = {}
for i in range(len(polymer)-1):
try:
polymer_dict[polymer[i:i+2]] += 1
except:
polymer_dict[polymer[i:i+2]] = 1
part2_sol = solve(polymer_dict,rules,values,steps=40)
print("Part 2 solution: ", part2_sol) | def solve(polymer, rules, values, steps=10):
for step in range(steps):
new_polymer = {}
for key in polymer:
value = polymer[key]
try:
values[rules[key]] += value
except:
values[rules[key]] = value
try:
new_polymer[key[0] + rules[key]] += value
except:
new_polymer[key[0] + rules[key]] = value
try:
new_polymer[rules[key] + key[1]] += value
except:
new_polymer[rules[key] + key[1]] = value
polymer = new_polymer
return max(values.values()) - min(values.values())
polymer = 'SCSCSKKVVBKVFKSCCSOV'
values = {key: polymer.count(key) for key in set(polymer)}
polymer_dict = {}
for i in range(len(polymer) - 1):
try:
polymer_dict[polymer[i:i + 2]] += 1
except:
polymer_dict[polymer[i:i + 2]] = 1
rules = {}
with open('Day14_input.txt', 'r') as inputfile:
for line in inputfile:
line = line.split(' -> ')
rules[line[0]] = line[1][:-1]
part1_sol = solve(polymer_dict, rules, values)
print('Part 1 solution: ', part1_sol)
polymer = 'SCSCSKKVVBKVFKSCCSOV'
values = {key: polymer.count(key) for key in set(polymer)}
polymer_dict = {}
for i in range(len(polymer) - 1):
try:
polymer_dict[polymer[i:i + 2]] += 1
except:
polymer_dict[polymer[i:i + 2]] = 1
part2_sol = solve(polymer_dict, rules, values, steps=40)
print('Part 2 solution: ', part2_sol) |
sexo = str(input('digite seu sexo [M/F]: ')).strip().upper()
while sexo not in 'MF':
sexo = str(input('\033[31mdados invalidos.\n\033[mpor favor, informe seu sexo [M/F]: ')).strip().upper()
print(f'sexo {sexo[0]} registrado com sucesso')
| sexo = str(input('digite seu sexo [M/F]: ')).strip().upper()
while sexo not in 'MF':
sexo = str(input('\x1b[31mdados invalidos.\n\x1b[mpor favor, informe seu sexo [M/F]: ')).strip().upper()
print(f'sexo {sexo[0]} registrado com sucesso') |
WOQL_AND_JSON = {
"@type": "woql:And",
"woql:query_list": [
{
"@type": "woql:QueryListElement",
"woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 0},
"woql:query": {
"@type": "woql:Triple",
"woql:subject": {"@type": "woql:Node", "woql:node": "doc:a"},
"woql:predicate": {"@type": "woql:Node", "woql:node": "scm:b"},
"woql:object": {
"@type": "woql:Datatype",
"woql:datatype": {"@type": "xsd:string", "@value": "c"},
},
},
},
{
"@type": "woql:QueryListElement",
"woql:index": {"@type": "xsd:nonNegativeInteger", "@value": 1},
"woql:query": {
"@type": "woql:Triple",
"woql:subject": {"@type": "woql:Node", "woql:node": "doc:1"},
"woql:predicate": {"@type": "woql:Node", "woql:node": "scm:2"},
"woql:object": {
"@type": "woql:Datatype",
"woql:datatype": {"@type": "xsd:string", "@value": "3"},
},
},
},
],
}
| woql_and_json = {'@type': 'woql:And', 'woql:query_list': [{'@type': 'woql:QueryListElement', 'woql:index': {'@type': 'xsd:nonNegativeInteger', '@value': 0}, 'woql:query': {'@type': 'woql:Triple', 'woql:subject': {'@type': 'woql:Node', 'woql:node': 'doc:a'}, 'woql:predicate': {'@type': 'woql:Node', 'woql:node': 'scm:b'}, 'woql:object': {'@type': 'woql:Datatype', 'woql:datatype': {'@type': 'xsd:string', '@value': 'c'}}}}, {'@type': 'woql:QueryListElement', 'woql:index': {'@type': 'xsd:nonNegativeInteger', '@value': 1}, 'woql:query': {'@type': 'woql:Triple', 'woql:subject': {'@type': 'woql:Node', 'woql:node': 'doc:1'}, 'woql:predicate': {'@type': 'woql:Node', 'woql:node': 'scm:2'}, 'woql:object': {'@type': 'woql:Datatype', 'woql:datatype': {'@type': 'xsd:string', '@value': '3'}}}}]} |
#Switch database
SPINE_SWITCH_TYPE = ["NX3164Q","NX9332PQ", "NX3132Q", "NX9504", "NX9508", "NX9516"]
LEAF_SWITCH_TYPE = ["NX9372PX", "NX9372TX", "NX9396PX", "NX9396TX", "NX93120TX", "NX93128TX", "NX3172Q"]
#Leaf Switch Interfaces
SWITCH_HOST_IF_MAP = {"NX9372PX":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32", "e1/33", "e1/34", "e1/35","e1/36", "e1/37", "e1/38", "e1/39", "e1/40","e1/41", "e1/42", "e1/43", "e1/44", "e1/45","e1/46", "e1/47", "e1/48"],\
"NX9372TX":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32", "e1/33", "e1/34", "e1/35","e1/36", "e1/37", "e1/38", "e1/39", "e1/40","e1/41", "e1/42", "e1/43", "e1/44", "e1/45","e1/46", "e1/47", "e1/48"],\
"NX9396PX":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32", "e1/33", "e1/34", "e1/35","e1/36", "e1/37", "e1/38", "e1/39", "e1/40","e1/41", "e1/42", "e1/43", "e1/44", "e1/45","e1/46", "e1/47", "e1/48"],\
"NX9396TX":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32", "e1/33", "e1/34", "e1/35","e1/36", "e1/37", "e1/38", "e1/39", "e1/40","e1/41", "e1/42", "e1/43", "e1/44", "e1/45","e1/46", "e1/47", "e1/48"],\
"NX93120PX":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32", "e1/33", "e1/34", "e1/35","e1/36", "e1/37", "e1/38", "e1/39", "e1/40","e1/41", "e1/42", "e1/43", "e1/44", "e1/45","e1/46", "e1/47", "e1/48"],\
"NX93128TX":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32", "e1/33", "e1/34", "e1/35","e1/36", "e1/37", "e1/38", "e1/39", "e1/40","e1/41", "e1/42", "e1/43", "e1/44", "e1/45","e1/46", "e1/47", "e1/48"],\
"NX3172Q":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32", "e1/33", "e1/34", "e1/35","e1/36", "e1/37", "e1/38", "e1/39", "e1/40","e1/41", "e1/42", "e1/43", "e1/44", "e1/45","e1/46", "e1/47", "e1/48"],\
"NX3164Q":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32"],\
"NX9332PQ":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32"],\
"NX3132Q":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32"],\
"NX9504":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32"],\
"NX9508":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32"],\
"NX9516":["e1/1", "e1/2", "e1/3", "e1/4", "e1/5","e1/6", "e1/7", "e1/8", "e1/9", "e1/10","e1/11", "e1/12", "e1/13", "e1/14", "e1/15","e1/16", "e1/17", "e1/18", "e1/19", "e1/20","e1/21", "e1/22", "e1/23", "e1/24", "e1/25","e1/26", "e1/27", "e1/28", "e1/29", "e1/30", "e1/31", "e1/32"]}
#Link Types
TOPOLOGY_LINK_TYPES = ['Linkset-[1-9]+Link','VPC-[1-9]+Link']
| spine_switch_type = ['NX3164Q', 'NX9332PQ', 'NX3132Q', 'NX9504', 'NX9508', 'NX9516']
leaf_switch_type = ['NX9372PX', 'NX9372TX', 'NX9396PX', 'NX9396TX', 'NX93120TX', 'NX93128TX', 'NX3172Q']
switch_host_if_map = {'NX9372PX': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32', 'e1/33', 'e1/34', 'e1/35', 'e1/36', 'e1/37', 'e1/38', 'e1/39', 'e1/40', 'e1/41', 'e1/42', 'e1/43', 'e1/44', 'e1/45', 'e1/46', 'e1/47', 'e1/48'], 'NX9372TX': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32', 'e1/33', 'e1/34', 'e1/35', 'e1/36', 'e1/37', 'e1/38', 'e1/39', 'e1/40', 'e1/41', 'e1/42', 'e1/43', 'e1/44', 'e1/45', 'e1/46', 'e1/47', 'e1/48'], 'NX9396PX': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32', 'e1/33', 'e1/34', 'e1/35', 'e1/36', 'e1/37', 'e1/38', 'e1/39', 'e1/40', 'e1/41', 'e1/42', 'e1/43', 'e1/44', 'e1/45', 'e1/46', 'e1/47', 'e1/48'], 'NX9396TX': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32', 'e1/33', 'e1/34', 'e1/35', 'e1/36', 'e1/37', 'e1/38', 'e1/39', 'e1/40', 'e1/41', 'e1/42', 'e1/43', 'e1/44', 'e1/45', 'e1/46', 'e1/47', 'e1/48'], 'NX93120PX': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32', 'e1/33', 'e1/34', 'e1/35', 'e1/36', 'e1/37', 'e1/38', 'e1/39', 'e1/40', 'e1/41', 'e1/42', 'e1/43', 'e1/44', 'e1/45', 'e1/46', 'e1/47', 'e1/48'], 'NX93128TX': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32', 'e1/33', 'e1/34', 'e1/35', 'e1/36', 'e1/37', 'e1/38', 'e1/39', 'e1/40', 'e1/41', 'e1/42', 'e1/43', 'e1/44', 'e1/45', 'e1/46', 'e1/47', 'e1/48'], 'NX3172Q': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32', 'e1/33', 'e1/34', 'e1/35', 'e1/36', 'e1/37', 'e1/38', 'e1/39', 'e1/40', 'e1/41', 'e1/42', 'e1/43', 'e1/44', 'e1/45', 'e1/46', 'e1/47', 'e1/48'], 'NX3164Q': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32'], 'NX9332PQ': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32'], 'NX3132Q': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32'], 'NX9504': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32'], 'NX9508': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32'], 'NX9516': ['e1/1', 'e1/2', 'e1/3', 'e1/4', 'e1/5', 'e1/6', 'e1/7', 'e1/8', 'e1/9', 'e1/10', 'e1/11', 'e1/12', 'e1/13', 'e1/14', 'e1/15', 'e1/16', 'e1/17', 'e1/18', 'e1/19', 'e1/20', 'e1/21', 'e1/22', 'e1/23', 'e1/24', 'e1/25', 'e1/26', 'e1/27', 'e1/28', 'e1/29', 'e1/30', 'e1/31', 'e1/32']}
topology_link_types = ['Linkset-[1-9]+Link', 'VPC-[1-9]+Link'] |
class Solution:
def XXX(self, nums):
ret = []
path = []
def dfs(li):
if len(li) == len(path):
ret.append(path[:])
for i in li:
if i not in path:
path.append(i)
dfs(li)
path.remove(i)
dfs(nums)
return ret
| class Solution:
def xxx(self, nums):
ret = []
path = []
def dfs(li):
if len(li) == len(path):
ret.append(path[:])
for i in li:
if i not in path:
path.append(i)
dfs(li)
path.remove(i)
dfs(nums)
return ret |
# Assignment 1
def assignment_1():
for counter in range (1,11):
print (counter)
# Assignment 2
def assignment_2():
goOn = True
number = 0
half = 0
while(goOn):
print ("Please type a whole number and if you want to end please type 0:")
number = input() # input() method automatically assigns string in variable
print(type(number))
if (number == '0'):
goOn = False
else:
half = number//2
print ("Number is ", number, "half is", half)
def main():
assignment_1()
assignment_2()
print("End of assignments")
if __name__ == '__main__':
main()
| def assignment_1():
for counter in range(1, 11):
print(counter)
def assignment_2():
go_on = True
number = 0
half = 0
while goOn:
print('Please type a whole number and if you want to end please type 0:')
number = input()
print(type(number))
if number == '0':
go_on = False
else:
half = number // 2
print('Number is ', number, 'half is', half)
def main():
assignment_1()
assignment_2()
print('End of assignments')
if __name__ == '__main__':
main() |
f = open("mbox.txt")
cnt = 0
for line in f.readlines():
if line.startswith('From'):
print(line.split()[1])
cnt += 1
print ("there was {} people.".format(cnt))
| f = open('mbox.txt')
cnt = 0
for line in f.readlines():
if line.startswith('From'):
print(line.split()[1])
cnt += 1
print('there was {} people.'.format(cnt)) |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/BoundingBox.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeographicMapChanges.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeographicMap.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPath.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPoint.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPointStamped.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPose.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPoseStamped.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/KeyValue.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/MapFeature.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/RouteNetwork.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/RoutePath.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/RouteSegment.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/WayPoint.msg"
services_str = "/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/srv/GetGeographicMap.srv;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/srv/GetGeoPath.srv;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/srv/GetRoutePlan.srv;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/srv/UpdateGeographicMap.srv"
pkg_name = "geographic_msgs"
dependencies_str = "geometry_msgs;std_msgs;uuid_msgs"
langs = "gencpp;geneus;genlisp;gennodejs;genpy"
dep_include_paths_str = "geographic_msgs;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg;geometry_msgs;/opt/ros/melodic/share/geometry_msgs/cmake/../msg;std_msgs;/opt/ros/melodic/share/std_msgs/cmake/../msg;uuid_msgs;/xavier_ssd/TrekBot/TrekBot2_WS/src/unique_identifier/uuid_msgs/msg"
PYTHON_EXECUTABLE = "/usr/bin/python2"
package_has_static_sources = '' == 'TRUE'
genmsg_check_deps_script = "/opt/ros/melodic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py"
| messages_str = '/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/BoundingBox.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeographicMapChanges.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeographicMap.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPath.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPoint.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPointStamped.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPose.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/GeoPoseStamped.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/KeyValue.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/MapFeature.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/RouteNetwork.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/RoutePath.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/RouteSegment.msg;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg/WayPoint.msg'
services_str = '/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/srv/GetGeographicMap.srv;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/srv/GetGeoPath.srv;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/srv/GetRoutePlan.srv;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/srv/UpdateGeographicMap.srv'
pkg_name = 'geographic_msgs'
dependencies_str = 'geometry_msgs;std_msgs;uuid_msgs'
langs = 'gencpp;geneus;genlisp;gennodejs;genpy'
dep_include_paths_str = 'geographic_msgs;/xavier_ssd/TrekBot/TrekBot2_WS/src/geographic_info/geographic_msgs/msg;geometry_msgs;/opt/ros/melodic/share/geometry_msgs/cmake/../msg;std_msgs;/opt/ros/melodic/share/std_msgs/cmake/../msg;uuid_msgs;/xavier_ssd/TrekBot/TrekBot2_WS/src/unique_identifier/uuid_msgs/msg'
python_executable = '/usr/bin/python2'
package_has_static_sources = '' == 'TRUE'
genmsg_check_deps_script = '/opt/ros/melodic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py' |
# -*- coding: utf-8 -*-
dict1 = {'Name':'Zara','Age': 18, 'Gender': ['Female','Les']}
print(len(dict1))
print(dict1['Name'])
del dict1['Name']
dict1['Name'] = "none" #change the factor
print(dict1['Name'])
print(dict1)
print(str(dict1)) #same
list1 = list(range(20)) # a list 0-19
print(list1)
print(dict.keys(dict1)) #print the keys of dict1
dict2 = {} #list updating
dict2.update(dict1)
print(dict2) | dict1 = {'Name': 'Zara', 'Age': 18, 'Gender': ['Female', 'Les']}
print(len(dict1))
print(dict1['Name'])
del dict1['Name']
dict1['Name'] = 'none'
print(dict1['Name'])
print(dict1)
print(str(dict1))
list1 = list(range(20))
print(list1)
print(dict.keys(dict1))
dict2 = {}
dict2.update(dict1)
print(dict2) |
def largest(test):
largest = []
for i in range(test):
size = int(input())
elements = input().split(" ", size)
lst = []
for j in elements:
lst.append(int(j))
largest.append(max(lst))
for i in largest:
print(i)
Test_cases = int(input())
largest(Test_cases)
| def largest(test):
largest = []
for i in range(test):
size = int(input())
elements = input().split(' ', size)
lst = []
for j in elements:
lst.append(int(j))
largest.append(max(lst))
for i in largest:
print(i)
test_cases = int(input())
largest(Test_cases) |
class Node(object):
def __init__(self, key, value, left=None, right=None, parent=None):
self.key = key
self.value = value
self.parent = parent
self.right_child = right
self.left_child = left
self.balance_factor = 0
def has_right_child(self):
return self.right_child is not None
def has_left_child(self):
return self.left_child is not None
def is_right_child(self):
return self.parent is not None and self.parent.right_child == self
def is_left_child(self):
return self.parent is not None and self.parent.left_child == self
def is_root(self):
return self.parent is None
def is_leaf(self):
return not self.is_root()
def has_any_children(self):
return self.left_child is not None or self.right_child is not None
def has_both_children(self):
return self.has_right_child() and self.has_left_child()
def get_only_child(self):
# quick note:
# assertions are supposed to be used in this context.
# their purpose is to make my assumptions about the use of this api known to outsiders
assert self.has_any_children() and not self.has_both_children()
if self.right_child is not None:
return self.right_child
else:
return self.left_child
def __repr__(self):
return "<Node key: {}>".format(self.key)
| class Node(object):
def __init__(self, key, value, left=None, right=None, parent=None):
self.key = key
self.value = value
self.parent = parent
self.right_child = right
self.left_child = left
self.balance_factor = 0
def has_right_child(self):
return self.right_child is not None
def has_left_child(self):
return self.left_child is not None
def is_right_child(self):
return self.parent is not None and self.parent.right_child == self
def is_left_child(self):
return self.parent is not None and self.parent.left_child == self
def is_root(self):
return self.parent is None
def is_leaf(self):
return not self.is_root()
def has_any_children(self):
return self.left_child is not None or self.right_child is not None
def has_both_children(self):
return self.has_right_child() and self.has_left_child()
def get_only_child(self):
assert self.has_any_children() and (not self.has_both_children())
if self.right_child is not None:
return self.right_child
else:
return self.left_child
def __repr__(self):
return '<Node key: {}>'.format(self.key) |
if __name__ == '__main__':
N = int(input())
arr = []
for _ in range(N):
s = input()
l = s.split(" ")
if l[0] == "print":
print(arr)
elif l[0] == "sort":
arr.sort()
elif l[0] == "append":
arr.append(int(l[1]))
elif l[0] == "reverse":
arr.reverse()
elif l[0] == "insert":
arr.insert(int(l[1]), int(l[2]))
elif l[0] == "pop":
arr.pop()
elif l[0] == "remove":
arr.remove(int(l[1]))
| if __name__ == '__main__':
n = int(input())
arr = []
for _ in range(N):
s = input()
l = s.split(' ')
if l[0] == 'print':
print(arr)
elif l[0] == 'sort':
arr.sort()
elif l[0] == 'append':
arr.append(int(l[1]))
elif l[0] == 'reverse':
arr.reverse()
elif l[0] == 'insert':
arr.insert(int(l[1]), int(l[2]))
elif l[0] == 'pop':
arr.pop()
elif l[0] == 'remove':
arr.remove(int(l[1])) |
gdbsettings=[
"set follow-fork-mode child",
"catch fork"
]
pipe_write_retries=5 | gdbsettings = ['set follow-fork-mode child', 'catch fork']
pipe_write_retries = 5 |
#from const import cw
#from const import ccw
cw,ccw = 1,-1
class Point:
x = 0
y = 0
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
def __add__(self, p):
return Point(self.x + p.x, self.y + p.y)
def __sub__(self, p):
return Point(self.x - p.x, self.y - p.y)
def translate(self, x, y):
self.x += x
self.y += y
return self
def dup(self):
return Point(self.x, self.y)
# def _rotcw(self):
# x,y = self.x,self.y
# self.x, self.y = y, -x
# return self
#
# def _rotccw(self):
# x,y = self.x,self.y
# self.x,self.y = -y, x
# return self
def rotate(self, pivot, cdir = cw):
x = self.x
y = self.y
if cdir == cw:
self.x = y - pivot.y + pivot.x
self.y = pivot.x - x + pivot.y
return self
# return (self - pivot)._rotcw() + pivot
else:
self.x = pivot.y - y + pivot.x
self.y = x - pivot.x + pivot.y
# return (self - pivot)._rotccw() + pivot
| (cw, ccw) = (1, -1)
class Point:
x = 0
y = 0
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def __add__(self, p):
return point(self.x + p.x, self.y + p.y)
def __sub__(self, p):
return point(self.x - p.x, self.y - p.y)
def translate(self, x, y):
self.x += x
self.y += y
return self
def dup(self):
return point(self.x, self.y)
def rotate(self, pivot, cdir=cw):
x = self.x
y = self.y
if cdir == cw:
self.x = y - pivot.y + pivot.x
self.y = pivot.x - x + pivot.y
return self
else:
self.x = pivot.y - y + pivot.x
self.y = x - pivot.x + pivot.y |
x = input("Type a number: ")
y = input("Type another number: ")
sum = int(x) + int(y)
print("The sum is: ", sum)
| x = input('Type a number: ')
y = input('Type another number: ')
sum = int(x) + int(y)
print('The sum is: ', sum) |
brd = {
'name': ('StickIt! V1', 'StickIt! V2', 'StickIt! V3'),
'port': {
'pmod' : {
'pm1' : {
'd0': 'ch15',
'd1': 'ch11',
'd2': 'chclk',
'd3': 'ch28',
'd4': 'ch16',
'd5': 'ch13',
'd6': 'ch0',
'd7': 'ch14',
},
'pm2' : {
'd0': 'ch17',
'd1': 'ch15',
'd2': 'ch1',
'd3': 'chclk',
'd4': 'ch18',
'd5': 'ch16',
'd6': 'ch3',
'd7': 'ch0',
},
'pm3' : {
'd0': 'ch20',
'd1': 'ch17',
'd2': 'ch4',
'd3': 'ch1',
'd4': 'ch21',
'd5': 'ch18',
'd6': 'ch5',
'd7': 'ch3',
},
'pm4' : {
'd0': 'ch22',
'd1': 'ch20',
'd2': 'ch6',
'd3': 'ch4',
'd4': 'ch23',
'd5': 'ch21',
'd6': 'ch7',
'd7': 'ch5',
},
'pm5' : {
'd0': 'ch8',
'd1': 'ch22',
'd2': 'ch25',
'd3': 'ch6',
'd4': 'ch26',
'd5': 'ch23',
'd6': 'ch10',
'd7': 'ch7',
},
'pm6' : {
'd0': 'ch11',
'd1': 'ch8',
'd2': 'ch28',
'd3': 'ch25',
'd4': 'ch13',
'd5': 'ch26',
'd6': 'ch14',
'd7': 'ch10',
}
},
'dualpmod' : {
'pm1+pm2' : {
'd0': 'ch15',
'd1': 'ch11',
'd2': 'chclk',
'd3': 'ch28',
'd4': 'ch16',
'd5': 'ch13',
'd6': 'ch0',
'd7': 'ch14',
'd8': 'ch17',
'd9': 'ch15',
'd10': 'ch1',
'd11': 'chclk',
'd12': 'ch18',
'd13': 'ch16',
'd14': 'ch3',
'd15': 'ch0',
},
'pm2+pm3' : {
'd0': 'ch17',
'd1': 'ch15',
'd2': 'ch1',
'd3': 'chclk',
'd4': 'ch18',
'd5': 'ch16',
'd6': 'ch3',
'd7': 'ch0',
'd8': 'ch20',
'd9': 'ch17',
'd10': 'ch4',
'd11': 'ch1',
'd12': 'ch21',
'd13': 'ch18',
'd14': 'ch5',
'd15': 'ch3',
},
'pm4+pm5' : {
'd0': 'ch22',
'd1': 'ch20',
'd2': 'ch6',
'd3': 'ch4',
'd4': 'ch23',
'd5': 'ch21',
'd6': 'ch7',
'd7': 'ch5',
'd8': 'ch8',
'd9': 'ch22',
'd10': 'ch25',
'd11': 'ch6',
'd12': 'ch26',
'd13': 'ch23',
'd14': 'ch10',
'd15': 'ch7',
},
'pm5+pm6' : {
'd0': 'ch8',
'd1': 'ch22',
'd2': 'ch25',
'd3': 'ch6',
'd4': 'ch26',
'd5': 'ch23',
'd6': 'ch10',
'd7': 'ch7',
'd8': 'ch11',
'd9': 'ch8',
'd10': 'ch28',
'd11': 'ch25',
'd12': 'ch13',
'd13': 'ch26',
'd14': 'ch14',
'd15': 'ch10',
}
},
'wing' : {
'wing1' : {
'd0': 'ch3',
'd1': 'ch18',
'd2': 'ch1',
'd3': 'ch17',
'd4': 'ch0',
'd5': 'ch16',
'd6': 'chclk',
'd7': 'ch15',
},
'wing2' : {
'd0': 'ch7',
'd1': 'ch23',
'd2': 'ch6',
'd3': 'ch22',
'd4': 'ch5',
'd5': 'ch21',
'd6': 'ch4',
'd7': 'ch20',
},
'wing3' : {
'd0': 'ch14',
'd1': 'ch13',
'd2': 'ch28',
'd3': 'ch11',
'd4': 'ch10',
'd5': 'ch26',
'd6': 'ch25',
'd7': 'ch8',
}
},
'dualwing' : {
'wing1+wing2' : {
'd0': 'ch7',
'd1': 'ch23',
'd2': 'ch6',
'd3': 'ch22',
'd4': 'ch5',
'd5': 'ch21',
'd6': 'ch4',
'd7': 'ch20',
'd8': 'ch3',
'd9': 'ch18',
'd10': 'ch1',
'd11': 'ch17',
'd12': 'ch0',
'd13': 'ch16',
'd14': 'chclk',
'd15': 'ch15',
},
'wing2+wing3' : {
'd0': 'ch14',
'd1': 'ch13',
'd2': 'ch28',
'd3': 'ch11',
'd4': 'ch10',
'd5': 'ch26',
'd6': 'ch25',
'd7': 'ch8',
'd8': 'ch7',
'd9': 'ch23',
'd10': 'ch6',
'd11': 'ch22',
'd12': 'ch5',
'd13': 'ch21',
'd14': 'ch4',
'd15': 'ch20',
}
},
'xula' : {
'default' : {
'chclk' : 'chclk',
'ch0' : 'ch0',
'ch1' : 'ch1',
'ch2' : 'ch2',
'ch3' : 'ch3',
'ch4' : 'ch4',
'ch5' : 'ch5',
'ch6' : 'ch6',
'ch7' : 'ch7',
'ch8' : 'ch8',
'ch9' : 'ch9',
'ch10' : 'ch10',
'ch11' : 'ch11',
'ch12' : 'ch12',
'ch13' : 'ch13',
'ch14' : 'ch14',
'ch15' : 'ch15',
'ch16' : 'ch16',
'ch17' : 'ch17',
'ch18' : 'ch18',
'ch19' : 'ch19',
'ch20' : 'ch20',
'ch21' : 'ch21',
'ch22' : 'ch22',
'ch23' : 'ch23',
'ch24' : 'ch24',
'ch25' : 'ch25',
'ch26' : 'ch26',
'ch27' : 'ch27',
'ch28' : 'ch28',
'ch29' : 'ch29',
'ch30' : 'ch30',
'ch31' : 'ch31',
'ch32' : 'ch32',
'ch33' : 'ch33'
}
}
}
}
| brd = {'name': ('StickIt! V1', 'StickIt! V2', 'StickIt! V3'), 'port': {'pmod': {'pm1': {'d0': 'ch15', 'd1': 'ch11', 'd2': 'chclk', 'd3': 'ch28', 'd4': 'ch16', 'd5': 'ch13', 'd6': 'ch0', 'd7': 'ch14'}, 'pm2': {'d0': 'ch17', 'd1': 'ch15', 'd2': 'ch1', 'd3': 'chclk', 'd4': 'ch18', 'd5': 'ch16', 'd6': 'ch3', 'd7': 'ch0'}, 'pm3': {'d0': 'ch20', 'd1': 'ch17', 'd2': 'ch4', 'd3': 'ch1', 'd4': 'ch21', 'd5': 'ch18', 'd6': 'ch5', 'd7': 'ch3'}, 'pm4': {'d0': 'ch22', 'd1': 'ch20', 'd2': 'ch6', 'd3': 'ch4', 'd4': 'ch23', 'd5': 'ch21', 'd6': 'ch7', 'd7': 'ch5'}, 'pm5': {'d0': 'ch8', 'd1': 'ch22', 'd2': 'ch25', 'd3': 'ch6', 'd4': 'ch26', 'd5': 'ch23', 'd6': 'ch10', 'd7': 'ch7'}, 'pm6': {'d0': 'ch11', 'd1': 'ch8', 'd2': 'ch28', 'd3': 'ch25', 'd4': 'ch13', 'd5': 'ch26', 'd6': 'ch14', 'd7': 'ch10'}}, 'dualpmod': {'pm1+pm2': {'d0': 'ch15', 'd1': 'ch11', 'd2': 'chclk', 'd3': 'ch28', 'd4': 'ch16', 'd5': 'ch13', 'd6': 'ch0', 'd7': 'ch14', 'd8': 'ch17', 'd9': 'ch15', 'd10': 'ch1', 'd11': 'chclk', 'd12': 'ch18', 'd13': 'ch16', 'd14': 'ch3', 'd15': 'ch0'}, 'pm2+pm3': {'d0': 'ch17', 'd1': 'ch15', 'd2': 'ch1', 'd3': 'chclk', 'd4': 'ch18', 'd5': 'ch16', 'd6': 'ch3', 'd7': 'ch0', 'd8': 'ch20', 'd9': 'ch17', 'd10': 'ch4', 'd11': 'ch1', 'd12': 'ch21', 'd13': 'ch18', 'd14': 'ch5', 'd15': 'ch3'}, 'pm4+pm5': {'d0': 'ch22', 'd1': 'ch20', 'd2': 'ch6', 'd3': 'ch4', 'd4': 'ch23', 'd5': 'ch21', 'd6': 'ch7', 'd7': 'ch5', 'd8': 'ch8', 'd9': 'ch22', 'd10': 'ch25', 'd11': 'ch6', 'd12': 'ch26', 'd13': 'ch23', 'd14': 'ch10', 'd15': 'ch7'}, 'pm5+pm6': {'d0': 'ch8', 'd1': 'ch22', 'd2': 'ch25', 'd3': 'ch6', 'd4': 'ch26', 'd5': 'ch23', 'd6': 'ch10', 'd7': 'ch7', 'd8': 'ch11', 'd9': 'ch8', 'd10': 'ch28', 'd11': 'ch25', 'd12': 'ch13', 'd13': 'ch26', 'd14': 'ch14', 'd15': 'ch10'}}, 'wing': {'wing1': {'d0': 'ch3', 'd1': 'ch18', 'd2': 'ch1', 'd3': 'ch17', 'd4': 'ch0', 'd5': 'ch16', 'd6': 'chclk', 'd7': 'ch15'}, 'wing2': {'d0': 'ch7', 'd1': 'ch23', 'd2': 'ch6', 'd3': 'ch22', 'd4': 'ch5', 'd5': 'ch21', 'd6': 'ch4', 'd7': 'ch20'}, 'wing3': {'d0': 'ch14', 'd1': 'ch13', 'd2': 'ch28', 'd3': 'ch11', 'd4': 'ch10', 'd5': 'ch26', 'd6': 'ch25', 'd7': 'ch8'}}, 'dualwing': {'wing1+wing2': {'d0': 'ch7', 'd1': 'ch23', 'd2': 'ch6', 'd3': 'ch22', 'd4': 'ch5', 'd5': 'ch21', 'd6': 'ch4', 'd7': 'ch20', 'd8': 'ch3', 'd9': 'ch18', 'd10': 'ch1', 'd11': 'ch17', 'd12': 'ch0', 'd13': 'ch16', 'd14': 'chclk', 'd15': 'ch15'}, 'wing2+wing3': {'d0': 'ch14', 'd1': 'ch13', 'd2': 'ch28', 'd3': 'ch11', 'd4': 'ch10', 'd5': 'ch26', 'd6': 'ch25', 'd7': 'ch8', 'd8': 'ch7', 'd9': 'ch23', 'd10': 'ch6', 'd11': 'ch22', 'd12': 'ch5', 'd13': 'ch21', 'd14': 'ch4', 'd15': 'ch20'}}, 'xula': {'default': {'chclk': 'chclk', 'ch0': 'ch0', 'ch1': 'ch1', 'ch2': 'ch2', 'ch3': 'ch3', 'ch4': 'ch4', 'ch5': 'ch5', 'ch6': 'ch6', 'ch7': 'ch7', 'ch8': 'ch8', 'ch9': 'ch9', 'ch10': 'ch10', 'ch11': 'ch11', 'ch12': 'ch12', 'ch13': 'ch13', 'ch14': 'ch14', 'ch15': 'ch15', 'ch16': 'ch16', 'ch17': 'ch17', 'ch18': 'ch18', 'ch19': 'ch19', 'ch20': 'ch20', 'ch21': 'ch21', 'ch22': 'ch22', 'ch23': 'ch23', 'ch24': 'ch24', 'ch25': 'ch25', 'ch26': 'ch26', 'ch27': 'ch27', 'ch28': 'ch28', 'ch29': 'ch29', 'ch30': 'ch30', 'ch31': 'ch31', 'ch32': 'ch32', 'ch33': 'ch33'}}}} |
def move(x=0, dx=10, y=0, dy=10):
x = x + dx
y = y + dy
return x, y
x = 50
y = 50
new_x, new_y = move(x, 50, y, -25)
print("The new coords are: ", new_x, ",", new_y)
print("Call with missing x and y...")
missing_x, missing_y = move(dx=50, dy=50)
print("The new coords are: ", missing_x, ",", missing_y)
| def move(x=0, dx=10, y=0, dy=10):
x = x + dx
y = y + dy
return (x, y)
x = 50
y = 50
(new_x, new_y) = move(x, 50, y, -25)
print('The new coords are: ', new_x, ',', new_y)
print('Call with missing x and y...')
(missing_x, missing_y) = move(dx=50, dy=50)
print('The new coords are: ', missing_x, ',', missing_y) |
class Name_list:
def __init__(self):
self.PREMIER_URL = 'https://www.footballwebpages.co.uk/premier-league'
self.PREMIER_URL_H = 'https://www.footballwebpages.co.uk/premier-league/league-table/home'
self.PREMIER_URL_A = 'https://www.footballwebpages.co.uk/premier-league/league-table/away'
self.LEAGUE_LISTS = ["Premier League"]
self.PREMIER_RESULTS = 'https://www.goal.com/en/results/'# + YYYY-MM-DD
| class Name_List:
def __init__(self):
self.PREMIER_URL = 'https://www.footballwebpages.co.uk/premier-league'
self.PREMIER_URL_H = 'https://www.footballwebpages.co.uk/premier-league/league-table/home'
self.PREMIER_URL_A = 'https://www.footballwebpages.co.uk/premier-league/league-table/away'
self.LEAGUE_LISTS = ['Premier League']
self.PREMIER_RESULTS = 'https://www.goal.com/en/results/' |
expected_output = {
"services-accounting-information": {
"flow-aggregate-template-detail": {
"flow-aggregate-template-detail-ipv4": {
"detail-entry": {
"source-address": "27.93.202.64",
"destination-address": "106.187.14.158",
"source-port": "8",
"destination-port": "0",
"protocol": {"#text": "1"},
"tos": "0",
"tcp-flags": "0",
"source-mask": "32",
"destination-mask": "30",
"input-snmp-interface-index": "618",
"output-snmp-interface-index": "620",
"start-time": "79167425",
"end-time": "79167425",
"packet-count": "1",
"byte-count": "84",
}
}
}
}
}
| expected_output = {'services-accounting-information': {'flow-aggregate-template-detail': {'flow-aggregate-template-detail-ipv4': {'detail-entry': {'source-address': '27.93.202.64', 'destination-address': '106.187.14.158', 'source-port': '8', 'destination-port': '0', 'protocol': {'#text': '1'}, 'tos': '0', 'tcp-flags': '0', 'source-mask': '32', 'destination-mask': '30', 'input-snmp-interface-index': '618', 'output-snmp-interface-index': '620', 'start-time': '79167425', 'end-time': '79167425', 'packet-count': '1', 'byte-count': '84'}}}}} |
_HAS_COLORS = False
COLOR_LOGO = 1
COLOR_LOGO_ALT = 2
COLOR_FOCUSED = 3
COLOR_SCROLLBAR_TRACK = 4
COLOR_SCROLLBAR_THUMB = 5
COLOR_PROGRESSBAR = 6
COLOR_HIGHLIGHT = 7
def has_colors() -> bool:
return _HAS_COLORS
def set_colors(has_colors: bool) -> None:
global _HAS_COLORS
_HAS_COLORS = has_colors
| _has_colors = False
color_logo = 1
color_logo_alt = 2
color_focused = 3
color_scrollbar_track = 4
color_scrollbar_thumb = 5
color_progressbar = 6
color_highlight = 7
def has_colors() -> bool:
return _HAS_COLORS
def set_colors(has_colors: bool) -> None:
global _HAS_COLORS
_has_colors = has_colors |
'''10. Write a Python program to print without newline or space.'''
print("This is a sentence", end='')
print("This is a new line that will not show")
| """10. Write a Python program to print without newline or space."""
print('This is a sentence', end='')
print('This is a new line that will not show') |
def pair(relation, human_readable = None):
'''
Creates a dictionary pair of a relation uri in string form and a human readable equivalent.
Args:
relation (str): This should be preformated so generate_uri works on it
human_readable (str): a plain-text description of the uri
Return:
d (dictionary)
'''
d = {
'relation': relation,
'human_readable': human_readable
}
return d
# In this mapping, outer dictionary key represents the column header in the csv.
# We use the same header as the human-readable description so users are
# familiar with what they're selecting on group comparisons.
# Note: we don't handle "serotype" here as it has to be split into O and H type.
mapping = {
'primary_dbxref': pair('ge:0001800', 'primary_dbxref'),
'secondary_sample_accession': pair(':secondary_sample_accession', 'secondary_sample_accession'),
'study_accession': pair('obi:0001628', 'study_accession'),
'secondary_study_accession': pair(':secondary_study_accession', 'secondary_study_accession'),
'strain': pair(':0001429', 'strain'),
'serotype': '',
'O-Type': pair('ge:0001076', 'O-Type'),
'H-Type': pair('ge:0001077', 'H-Type'),
'stx1_subtype': pair('subt:stx1', 'stx1_subtype'),
'stx2_subtype': pair('subt:stx2', 'stx2_subtype'),
'syndrome': pair('ge:0001613', 'syndrome'),
'isolation_host': pair('ge:0001567', 'isolation_host'),
'isolation_source': pair('ge:0000025', 'isolation_source'),
'isolation_date': pair('ge:0000020', 'isolation_date'),
'isolation_location': pair('ge:0000117', 'isolation_location'),
'contact': pair('ge:0001642', 'contact')
}
| def pair(relation, human_readable=None):
"""
Creates a dictionary pair of a relation uri in string form and a human readable equivalent.
Args:
relation (str): This should be preformated so generate_uri works on it
human_readable (str): a plain-text description of the uri
Return:
d (dictionary)
"""
d = {'relation': relation, 'human_readable': human_readable}
return d
mapping = {'primary_dbxref': pair('ge:0001800', 'primary_dbxref'), 'secondary_sample_accession': pair(':secondary_sample_accession', 'secondary_sample_accession'), 'study_accession': pair('obi:0001628', 'study_accession'), 'secondary_study_accession': pair(':secondary_study_accession', 'secondary_study_accession'), 'strain': pair(':0001429', 'strain'), 'serotype': '', 'O-Type': pair('ge:0001076', 'O-Type'), 'H-Type': pair('ge:0001077', 'H-Type'), 'stx1_subtype': pair('subt:stx1', 'stx1_subtype'), 'stx2_subtype': pair('subt:stx2', 'stx2_subtype'), 'syndrome': pair('ge:0001613', 'syndrome'), 'isolation_host': pair('ge:0001567', 'isolation_host'), 'isolation_source': pair('ge:0000025', 'isolation_source'), 'isolation_date': pair('ge:0000020', 'isolation_date'), 'isolation_location': pair('ge:0000117', 'isolation_location'), 'contact': pair('ge:0001642', 'contact')} |
# coding: utf-8
# Copyright 2020. ThingsBoard
# #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class File:
def __init__(self, path: str, filename: str, version: str):
self._path = path
self._filename = filename
self._version = version
self._class_name = None
@property
def full_file_path(self):
return self._path + self._filename
@property
def filename(self):
return self._filename
@property
def version(self):
return self._version
@property
def class_name(self):
return self._class_name
@class_name.setter
def class_name(self, value):
self._class_name = value
def __str__(self):
return f'{self._path}{self._filename}'
| class File:
def __init__(self, path: str, filename: str, version: str):
self._path = path
self._filename = filename
self._version = version
self._class_name = None
@property
def full_file_path(self):
return self._path + self._filename
@property
def filename(self):
return self._filename
@property
def version(self):
return self._version
@property
def class_name(self):
return self._class_name
@class_name.setter
def class_name(self, value):
self._class_name = value
def __str__(self):
return f'{self._path}{self._filename}' |
# Number letter counts
# Problem 17
# If the numbers 1 to 5 are written out in words: one, two, three,
# four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in
# total.
#
# If all the numbers from 1 to 1000 (one thousand) inclusive were
# written out in words, how many letters would be used?
#
#
# NOTE: Do not count spaces or hyphens. For example, 342
# (three hundred and forty-two) contains 23 letters and 115 (one hundred and
# fifteen) contains 20 letters. The use of "and" when writing out
# numbers is in compliance with British usage.
#
dictionary = {
1: len('one'),
2: len('two'),
3: len('three'),
4: len('four'),
5: len('five'),
6: len('six'),
7: len('seven'),
8: len('eight'),
9: len('nine'),
10: len('ten'),
11: len('eleven'),
12: len('twelve'),
13: len('thirteen'),
14: len('fourteen'),
15: len('fifteen'),
16: len('sixteen'),
17: len('seventeen'),
18: len('eighteen'),
19: len('nineteen'),
20: len('twenty'),
30: len('thirty'),
40: len('forty'),
50: len('fifty'),
60: len('sixty'),
70: len('seventy'),
80: len('eighty'),
90: len('ninety'),
100: len('hundred'),
1000: len('thousand')
}
def count_number_letters_0_99():
count_0_9 = sum(dictionary.get(n) for n in range(1, 10))
count = sum(dictionary.get(n) for n in range(1, 20)) # 1 - 19
count += sum(dictionary.get(tens * 10) * 10 for tens in range(2, 10)) # 20, 30, 40, 50, 60, 70, 80, 90
return count + count_0_9 * 8
# @WARNING: UNREADABLE
def solve():
count_0_99 = count_number_letters_0_99()
count_hundreds = len('and') * 99 + dictionary.get(100) * 100 + count_0_99
total = sum(dictionary.get(h) for h in range(1, 10)) * 100 + count_hundreds * 9
return dictionary.get(1) + dictionary.get(1000) + count_0_99 + total
if __name__ == '__main__':
print(__file__ + ": %d" % solve())
| dictionary = {1: len('one'), 2: len('two'), 3: len('three'), 4: len('four'), 5: len('five'), 6: len('six'), 7: len('seven'), 8: len('eight'), 9: len('nine'), 10: len('ten'), 11: len('eleven'), 12: len('twelve'), 13: len('thirteen'), 14: len('fourteen'), 15: len('fifteen'), 16: len('sixteen'), 17: len('seventeen'), 18: len('eighteen'), 19: len('nineteen'), 20: len('twenty'), 30: len('thirty'), 40: len('forty'), 50: len('fifty'), 60: len('sixty'), 70: len('seventy'), 80: len('eighty'), 90: len('ninety'), 100: len('hundred'), 1000: len('thousand')}
def count_number_letters_0_99():
count_0_9 = sum((dictionary.get(n) for n in range(1, 10)))
count = sum((dictionary.get(n) for n in range(1, 20)))
count += sum((dictionary.get(tens * 10) * 10 for tens in range(2, 10)))
return count + count_0_9 * 8
def solve():
count_0_99 = count_number_letters_0_99()
count_hundreds = len('and') * 99 + dictionary.get(100) * 100 + count_0_99
total = sum((dictionary.get(h) for h in range(1, 10))) * 100 + count_hundreds * 9
return dictionary.get(1) + dictionary.get(1000) + count_0_99 + total
if __name__ == '__main__':
print(__file__ + ': %d' % solve()) |
num = 10
num = 22
a= 2
def main():
pass
if __name__ == '__main__':
main()
b = 3
aa = 33
ss = 334
| num = 10
num = 22
a = 2
def main():
pass
if __name__ == '__main__':
main()
b = 3
aa = 33
ss = 334 |
def has_attachment(ctx):
return bool(len(ctx.message.attachments))
def has_embed(ctx):
return bool(len(ctx.message.embeds))
def file_type(ctx, filetype, attnum = 0):
if not has_attachment(ctx): return False
return ctx.message.attachments[attnum].endswith(filetype) | def has_attachment(ctx):
return bool(len(ctx.message.attachments))
def has_embed(ctx):
return bool(len(ctx.message.embeds))
def file_type(ctx, filetype, attnum=0):
if not has_attachment(ctx):
return False
return ctx.message.attachments[attnum].endswith(filetype) |
# Every two consecutive numbers add up to 1
n = int(input())
if n % 2 == 0:
print(n // 2)
else:
print(n // 2 + -n)
| n = int(input())
if n % 2 == 0:
print(n // 2)
else:
print(n // 2 + -n) |
def xor_2_bytes(input1,input2):
xor_bytes = b''
for b1, b2 in zip(input1, input2):
xor_bytes += (bytes([b1 ^ b2]))
print(xor_bytes)
return xor_bytes.hex()
if __name__ == "__main__":
byte_string1 = bytes.fromhex('1c0111001f010100061a024b53535009181c')
byte_string2 = bytes.fromhex('686974207468652062756c6c277320657965')
print(byte_string1)
print(byte_string2)
print(xor_2_bytes(byte_string1,byte_string2)) | def xor_2_bytes(input1, input2):
xor_bytes = b''
for (b1, b2) in zip(input1, input2):
xor_bytes += bytes([b1 ^ b2])
print(xor_bytes)
return xor_bytes.hex()
if __name__ == '__main__':
byte_string1 = bytes.fromhex('1c0111001f010100061a024b53535009181c')
byte_string2 = bytes.fromhex('686974207468652062756c6c277320657965')
print(byte_string1)
print(byte_string2)
print(xor_2_bytes(byte_string1, byte_string2)) |
# converting vehicle age to inter
def process_vehicule_age(df):
ds = df.copy()
ds["Vehicle_Age"] = ds["Vehicle_Age"].map(
lambda x: 0 if x == "< 1 Year" else 1 if x == "1-2 Year" else 2
)
ds["Vehicle_Age"] = ds["Vehicle_Age"].astype("int")
return ds
# changing the column type for different columns
def change_type(df):
cols_types = {
"str": [
"Gender",
"Driving_License",
"Region_Code",
"Previously_Insured",
"Vehicle_Damage",
"Policy_Sales_Channel",
],
"float": ["Age", "Annual_Premium", "Vehicle_Age", "Vintage"],
"int": ["id", "Response"],
}
for k, v in cols_types.items():
for c in v:
df[c] = df[c].astype(k)
return df
# prepocessing steps for one hot encoding
| def process_vehicule_age(df):
ds = df.copy()
ds['Vehicle_Age'] = ds['Vehicle_Age'].map(lambda x: 0 if x == '< 1 Year' else 1 if x == '1-2 Year' else 2)
ds['Vehicle_Age'] = ds['Vehicle_Age'].astype('int')
return ds
def change_type(df):
cols_types = {'str': ['Gender', 'Driving_License', 'Region_Code', 'Previously_Insured', 'Vehicle_Damage', 'Policy_Sales_Channel'], 'float': ['Age', 'Annual_Premium', 'Vehicle_Age', 'Vintage'], 'int': ['id', 'Response']}
for (k, v) in cols_types.items():
for c in v:
df[c] = df[c].astype(k)
return df |
class Solution:
def lengthOfLastWord(self, s: str) -> int:
p, length = len(s) - 1, 0
while p >= 0:
if s[p] != ' ':
length += 1
else:
if length > 0:
return length
p -= 1
return length | class Solution:
def length_of_last_word(self, s: str) -> int:
(p, length) = (len(s) - 1, 0)
while p >= 0:
if s[p] != ' ':
length += 1
elif length > 0:
return length
p -= 1
return length |
#!/usr/bin/python3
# author: Karel Fiala
# email: fiala.karel@gmail.com
# config
SERVER_IP = "0.0.0.0"
SERVER_PORT = 5556
CLIENT_LISTEN_IP = "dev.haut.local"
CLIENT_LISTEN_PORT = 5555
BUFFER_SIZE = 1024
WEBSERVER_IP_BIND = "0.0.0.0"
WEBSERVER_PORT_BIND = 5557 | server_ip = '0.0.0.0'
server_port = 5556
client_listen_ip = 'dev.haut.local'
client_listen_port = 5555
buffer_size = 1024
webserver_ip_bind = '0.0.0.0'
webserver_port_bind = 5557 |
while True:
try:
entrada = int(input())
print('Y' if entrada % 6 == 0 else 'N')
except:
break | while True:
try:
entrada = int(input())
print('Y' if entrada % 6 == 0 else 'N')
except:
break |
def once(function):
function_has_been_called = False
def wrapper(*args, **kwargs):
if not function_has_been_called:
function_has_been_called = True
return wrapper(*args, **kwargs)
return wrapper
| def once(function):
function_has_been_called = False
def wrapper(*args, **kwargs):
if not function_has_been_called:
function_has_been_called = True
return wrapper(*args, **kwargs)
return wrapper |
'''2. Write a Python program to create a sequence where the first four members
of the sequence are equal to one, and each successive term of the sequence is equal to the
sum of the four previous ones. Find the Nth member of the sequence.'''
num = int(input("Enter the number of terms: "))
| """2. Write a Python program to create a sequence where the first four members
of the sequence are equal to one, and each successive term of the sequence is equal to the
sum of the four previous ones. Find the Nth member of the sequence."""
num = int(input('Enter the number of terms: ')) |
## AUTHOR: Vamsi Krishna Reddy Satti
##################################################################################
# Optimizers
##################################################################################
class SGD:
def __init__(self, model, lr):
self.model = model
self.lr = lr
def step(self):
for layer in self.model.layers:
for name in layer.params:
layer.params[name] -= self.lr * layer.grad[name]
| class Sgd:
def __init__(self, model, lr):
self.model = model
self.lr = lr
def step(self):
for layer in self.model.layers:
for name in layer.params:
layer.params[name] -= self.lr * layer.grad[name] |
if sm.hasQuest(2566):
if sm.hasItem(4032985):
sm.chatScript("You already have the Ignition Device.")
else:
sm.giveItem(4032985)
sm.chatScript("Ignition Device. Bring ") | if sm.hasQuest(2566):
if sm.hasItem(4032985):
sm.chatScript('You already have the Ignition Device.')
else:
sm.giveItem(4032985)
sm.chatScript('Ignition Device. Bring ') |
# http://www.codewars.com/kata/554b4ac871d6813a03000035/
def high_and_low(numbers):
lst = [int(num) for num in numbers.split()]
return "{0} {1}".format(max(lst), min(lst))
| def high_and_low(numbers):
lst = [int(num) for num in numbers.split()]
return '{0} {1}'.format(max(lst), min(lst)) |
# Coding Challenge 2
### Chelsea Lizardo
### NRS 528
#
#
string = 'hi dee hi how are you mr dee'
#Count the occurrence of each word, and print the word plus the count.
def word_count(str):
counts = dict()
words = str.split()
for w in words:
if w in counts:
counts[w] += 1
else:
counts[w] = 1
return counts
print( word_count('hi dee hi how are you mr dee')) | string = 'hi dee hi how are you mr dee'
def word_count(str):
counts = dict()
words = str.split()
for w in words:
if w in counts:
counts[w] += 1
else:
counts[w] = 1
return counts
print(word_count('hi dee hi how are you mr dee')) |
def xo(s):
xcount = 0
ocount = 0
for i in s.lower():
if (i == 'x'):
xcount += 1
elif (i == 'o'):
ocount += 1
return xcount == ocount
print(xo('ooxx'))
# Using count()
def xo2(s):
s = s.lower()
return s.count('x') == s.count('o') | def xo(s):
xcount = 0
ocount = 0
for i in s.lower():
if i == 'x':
xcount += 1
elif i == 'o':
ocount += 1
return xcount == ocount
print(xo('ooxx'))
def xo2(s):
s = s.lower()
return s.count('x') == s.count('o') |
#
# PySNMP MIB module Nortel-Magellan-Passport-CallRedirectionMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-CallRedirectionMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:26:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint")
RowStatus, Integer32, StorageType, Unsigned32, DisplayString, Counter32 = mibBuilder.importSymbols("Nortel-Magellan-Passport-StandardTextualConventionsMIB", "RowStatus", "Integer32", "StorageType", "Unsigned32", "DisplayString", "Counter32")
AsciiString, Link, AsciiStringIndex, NonReplicated = mibBuilder.importSymbols("Nortel-Magellan-Passport-TextualConventionsMIB", "AsciiString", "Link", "AsciiStringIndex", "NonReplicated")
components, passportMIBs = mibBuilder.importSymbols("Nortel-Magellan-Passport-UsefulDefinitionsMIB", "components", "passportMIBs")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
IpAddress, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Integer32, NotificationType, Gauge32, Unsigned32, Bits, ModuleIdentity, Counter32, Counter64, ObjectIdentity, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Integer32", "NotificationType", "Gauge32", "Unsigned32", "Bits", "ModuleIdentity", "Counter32", "Counter64", "ObjectIdentity", "TimeTicks")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
callRedirectionMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132))
crs = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132))
crsRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1), )
if mibBuilder.loadTexts: crsRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsRowStatusTable.setDescription('This entry controls the addition and deletion of crs components.')
crsRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"))
if mibBuilder.loadTexts: crsRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsRowStatusEntry.setDescription('A single entry in the table represents a single crs component.')
crsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts: crsRowStatus.setDescription('This variable is used as the basis for SNMP naming of crs components. These components can be added and deleted.')
crsComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsComponentName.setStatus('mandatory')
if mibBuilder.loadTexts: crsComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crsStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1, 4), StorageType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsStorageType.setStatus('mandatory')
if mibBuilder.loadTexts: crsStorageType.setDescription('This variable represents the storage type value for the crs tables.')
crsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1, 10), NonReplicated())
if mibBuilder.loadTexts: crsIndex.setStatus('mandatory')
if mibBuilder.loadTexts: crsIndex.setDescription('This variable represents the index for the crs tables.')
crsProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 10), )
if mibBuilder.loadTexts: crsProvTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsProvTable.setDescription('The Provisioned group contains provisionable attributes of the CallRedirectionServer component.')
crsProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 10, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"))
if mibBuilder.loadTexts: crsProvEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsProvEntry.setDescription('An entry in the crsProvTable.')
crsLogicalProcessor = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 10, 1, 2), Link()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsLogicalProcessor.setStatus('mandatory')
if mibBuilder.loadTexts: crsLogicalProcessor.setDescription('This attribute specifies the logical processor on which the call redirection server process is to run.')
crsStateTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11), )
if mibBuilder.loadTexts: crsStateTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsStateTable.setDescription('This group contains the three OSI State attributes. The descriptions generically indicate what each state attribute implies about the component. Note that not all the values and state combinations described here are supported by every component which uses this group. For component-specific information and the valid state combinations, refer to NTP 241-7001-150, Passport Operations and Maintenance Guide.')
crsStateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"))
if mibBuilder.loadTexts: crsStateEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsStateEntry.setDescription('An entry in the crsStateTable.')
crsAdminState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("locked", 0), ("unlocked", 1), ("shuttingDown", 2))).clone('unlocked')).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsAdminState.setStatus('mandatory')
if mibBuilder.loadTexts: crsAdminState.setDescription('This attribute indicates the OSI Administrative State of the component. The value locked indicates that the component is administratively prohibited from providing services for its users. A Lock or Lock - force command has been previously issued for this component. When the value is locked, the value of usageState must be idle. The value shuttingDown indicates that the component is administratively permitted to provide service to its existing users only. A Lock command was issued against the component and it is in the process of shutting down. The value unlocked indicates that the component is administratively permitted to provide services for its users. To enter this state, issue an Unlock command to this component.')
crsOperationalState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1))).clone('disabled')).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsOperationalState.setStatus('mandatory')
if mibBuilder.loadTexts: crsOperationalState.setDescription('This attribute indicates the OSI Operational State of the component. The value enabled indicates that the component is available for operation. Note that if adminState is locked, it would still not be providing service. The value disabled indicates that the component is not available for operation. For example, something is wrong with the component itself, or with another component on which this one depends. If the value is disabled, the usageState must be idle.')
crsUsageState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("idle", 0), ("active", 1), ("busy", 2))).clone('idle')).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsUsageState.setStatus('mandatory')
if mibBuilder.loadTexts: crsUsageState.setDescription('This attribute indicates the OSI Usage State of the component. The value idle indicates that the component is not currently in use. The value active indicates that the component is in use and has spare capacity to provide for additional users. The value busy indicates that the component is in use and has no spare operating capacity for additional users at this time.')
crsStatTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12), )
if mibBuilder.loadTexts: crsStatTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsStatTable.setDescription('The Statistics operational group defines the statistics associated with the CallRedirectionServer component.')
crsStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"))
if mibBuilder.loadTexts: crsStatEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsStatEntry.setDescription('An entry in the crsStatTable.')
crsTotalAddresses = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsTotalAddresses.setStatus('mandatory')
if mibBuilder.loadTexts: crsTotalAddresses.setDescription('The totalAddresses attribute indicates the number of PrimaryAddress components associated with the CallRedirectionServer component.')
crsRequestsReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsRequestsReceived.setStatus('mandatory')
if mibBuilder.loadTexts: crsRequestsReceived.setDescription('The requestsReceived attribute counts the number of redirection requests received by the CallRedirectionServer component. This counter wraps to 0 when it exceeds its maximum value.')
crsPrimaryMatches = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsPrimaryMatches.setStatus('mandatory')
if mibBuilder.loadTexts: crsPrimaryMatches.setDescription('The primaryMatches attribute counts the Call Redirection Server attempts to find a matching PrimaryAddress where the lookup attempt was successful. This counter wraps to 0 when it exceeds its maximum value.')
crsSecAddressListExhausted = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsSecAddressListExhausted.setStatus('mandatory')
if mibBuilder.loadTexts: crsSecAddressListExhausted.setDescription('The secAddressListExhausted attribute counts the Call Redirection Server attempts to find a SecondaryAddress component given a PrimaryAddress component where the lookup attempt resulted in the exhaustion of the secondary redirection list. This counter wraps to 0 when it exceeds its maximum value.')
crsMaxAddrLenExceeded = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsMaxAddrLenExceeded.setStatus('mandatory')
if mibBuilder.loadTexts: crsMaxAddrLenExceeded.setDescription('The maxAddrLenExceeded attribute counts how often the concatenation of the secondary address and the suffix digits from the original called address have exceeded the maximum of 15 digits. The suffix digits can be determined by removing the primary address digits from the front of the original called address. If appending the suffix digits to a secondary address causes the resulting address to exceed 15 digits, this secondary member is skipped and the next secondary member is tried.')
crsSecRidMidUnsuccessful = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsSecRidMidUnsuccessful.setStatus('mandatory')
if mibBuilder.loadTexts: crsSecRidMidUnsuccessful.setDescription('The secRidMidUnsuccessful attribute counts the number of RID/ MID redirections resulting in the destination address not being reached. This situation could occur when the destination address does not exist on the specified module or the specified module could not be reached.')
crsSecAddrUnsuccessful = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsSecAddrUnsuccessful.setStatus('mandatory')
if mibBuilder.loadTexts: crsSecAddrUnsuccessful.setDescription('The secAddrUnsuccessful attribute counts the number of Address redirections resulting in the destination user not being reached. This situation could occur when the destination user line is disabled, the destination address does not exist on the specified module, or the specified module could not be reached.')
crsRidRedirected = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsRidRedirected.setStatus('mandatory')
if mibBuilder.loadTexts: crsRidRedirected.setDescription('The ridRedirected attribute counts requests received by the Call Redirection Server resulting in the request being redirected to another RID specified by the AlternateRid component. This counter wraps to 0 when it exceeds its maximum value.')
crsRidMidRedirected = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsRidMidRedirected.setStatus('mandatory')
if mibBuilder.loadTexts: crsRidMidRedirected.setDescription('The ridMidRedirected attribute counts requests received by the Call Redirection Server resulting in the request being redirected to another RID/MID specified by the SecondaryRidMid component. This counter wraps to 0 when it exceeds its maximum value.')
crsAddressRedirected = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsAddressRedirected.setStatus('mandatory')
if mibBuilder.loadTexts: crsAddressRedirected.setDescription('The addressRedirected attribute counts requests received by the Call Redirection Server resulting in the request being redirected to another Address specified by the SecondaryAddress component. This counter wraps to 0 when it exceeds its maximum value.')
crsAltRidUnsuccessful = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsAltRidUnsuccessful.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidUnsuccessful.setDescription('The altRidUnsuccessful attribute counts the number of RID redirections resulting in the destination address not being reached. This situation could occur when the alternate RID cannot be reached, the module hosting the destination address is isolated, or the port associated with the secondary address is unavailable at the alternate RID.')
crsPAddr = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2))
crsPAddrRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1), )
if mibBuilder.loadTexts: crsPAddrRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrRowStatusTable.setDescription('This entry controls the addition and deletion of crsPAddr components.')
crsPAddrRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrIndex"))
if mibBuilder.loadTexts: crsPAddrRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrRowStatusEntry.setDescription('A single entry in the table represents a single crsPAddr component.')
crsPAddrRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsPAddrRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrRowStatus.setDescription('This variable is used as the basis for SNMP naming of crsPAddr components. These components can be added and deleted.')
crsPAddrComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsPAddrComponentName.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crsPAddrStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1, 4), StorageType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsPAddrStorageType.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrStorageType.setDescription('This variable represents the storage type value for the crsPAddr tables.')
crsPAddrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1, 10), AsciiStringIndex().subtype(subtypeSpec=ValueSizeConstraint(1, 17)))
if mibBuilder.loadTexts: crsPAddrIndex.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrIndex.setDescription('This variable represents the index for the crsPAddr tables.')
crsPAddrSRidMid = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2))
crsPAddrSRidMidRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1), )
if mibBuilder.loadTexts: crsPAddrSRidMidRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidRowStatusTable.setDescription('This entry controls the addition and deletion of crsPAddrSRidMid components.')
crsPAddrSRidMidRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrSRidMidIndex"))
if mibBuilder.loadTexts: crsPAddrSRidMidRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidRowStatusEntry.setDescription('A single entry in the table represents a single crsPAddrSRidMid component.')
crsPAddrSRidMidRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsPAddrSRidMidRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidRowStatus.setDescription('This variable is used as the basis for SNMP naming of crsPAddrSRidMid components. These components can be added and deleted.')
crsPAddrSRidMidComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsPAddrSRidMidComponentName.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crsPAddrSRidMidStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1, 4), StorageType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsPAddrSRidMidStorageType.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidStorageType.setDescription('This variable represents the storage type value for the crsPAddrSRidMid tables.')
crsPAddrSRidMidIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1, 10), NonReplicated())
if mibBuilder.loadTexts: crsPAddrSRidMidIndex.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidIndex.setDescription('This variable represents the index for the crsPAddrSRidMid tables.')
crsPAddrSRidMidRidMidProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 10), )
if mibBuilder.loadTexts: crsPAddrSRidMidRidMidProvTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidRidMidProvTable.setDescription('The SecRidMidProv group defines the secondary RID/MID pair associated with a specific primary address.')
crsPAddrSRidMidRidMidProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 10, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrSRidMidIndex"))
if mibBuilder.loadTexts: crsPAddrSRidMidRidMidProvEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidRidMidProvEntry.setDescription('An entry in the crsPAddrSRidMidRidMidProvTable.')
crsPAddrSRidMidRoutingId = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 10, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 126))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsPAddrSRidMidRoutingId.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidRoutingId.setDescription('This attribute specifies a group of one or more interconnected nodes (called a subnet) to which the primary address is redirected.')
crsPAddrSRidMidModuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 10, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 1909))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsPAddrSRidMidModuleId.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSRidMidModuleId.setDescription('This attribute specifies a Passport node to which the primary address is redirected.')
crsPAddrSAddr = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3))
crsPAddrSAddrRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1), )
if mibBuilder.loadTexts: crsPAddrSAddrRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrRowStatusTable.setDescription('This entry controls the addition and deletion of crsPAddrSAddr components.')
crsPAddrSAddrRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrSAddrIndex"))
if mibBuilder.loadTexts: crsPAddrSAddrRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrRowStatusEntry.setDescription('A single entry in the table represents a single crsPAddrSAddr component.')
crsPAddrSAddrRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsPAddrSAddrRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrRowStatus.setDescription('This variable is used as the basis for SNMP naming of crsPAddrSAddr components. These components can be added and deleted.')
crsPAddrSAddrComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsPAddrSAddrComponentName.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crsPAddrSAddrStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1, 4), StorageType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsPAddrSAddrStorageType.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrStorageType.setDescription('This variable represents the storage type value for the crsPAddrSAddr tables.')
crsPAddrSAddrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 7)))
if mibBuilder.loadTexts: crsPAddrSAddrIndex.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrIndex.setDescription('This variable represents the index for the crsPAddrSAddr tables.')
crsPAddrSAddrSecAddrProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 10), )
if mibBuilder.loadTexts: crsPAddrSAddrSecAddrProvTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrSecAddrProvTable.setDescription('The SecAddrProv group defines one of the secondary addresses associated with a specific primary address.')
crsPAddrSAddrSecAddrProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 10, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsPAddrSAddrIndex"))
if mibBuilder.loadTexts: crsPAddrSAddrSecAddrProvEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrSecAddrProvEntry.setDescription('An entry in the crsPAddrSAddrSecAddrProvTable.')
crsPAddrSAddrAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 10, 1, 3), AsciiString().subtype(subtypeSpec=ValueSizeConstraint(1, 17))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsPAddrSAddrAddress.setStatus('mandatory')
if mibBuilder.loadTexts: crsPAddrSAddrAddress.setDescription('This attribute specifies a secondary address to which the primary address is redirected. The address attribute includes the Numbering Plan Indicator (NPI) and the digits which form a unique identifier of the customer interface. The address may belong to the X.121 or E.164 addressing plan. Address digits are selected and assigned by network operators. The address attribute takes the form: x.<X.121 address> or e.<E.164 address>')
crsAltRid = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3))
crsAltRidRowStatusTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1), )
if mibBuilder.loadTexts: crsAltRidRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidRowStatusTable.setDescription('This entry controls the addition and deletion of crsAltRid components.')
crsAltRidRowStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsAltRidIndex"))
if mibBuilder.loadTexts: crsAltRidRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidRowStatusEntry.setDescription('A single entry in the table represents a single crsAltRid component.')
crsAltRidRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsAltRidRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidRowStatus.setDescription('This variable is used as the basis for SNMP naming of crsAltRid components. These components can be added and deleted.')
crsAltRidComponentName = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsAltRidComponentName.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crsAltRidStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1, 4), StorageType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: crsAltRidStorageType.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidStorageType.setDescription('This variable represents the storage type value for the crsAltRid tables.')
crsAltRidIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1, 10), NonReplicated())
if mibBuilder.loadTexts: crsAltRidIndex.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidIndex.setDescription('This variable represents the index for the crsAltRid tables.')
crsAltRidAltRidProvTable = MibTable((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 10), )
if mibBuilder.loadTexts: crsAltRidAltRidProvTable.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidAltRidProvTable.setDescription('The AltRidProv group defines the alternate RID associated with the Crs component.')
crsAltRidAltRidProvEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 10, 1), ).setIndexNames((0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsIndex"), (0, "Nortel-Magellan-Passport-CallRedirectionMIB", "crsAltRidIndex"))
if mibBuilder.loadTexts: crsAltRidAltRidProvEntry.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidAltRidProvEntry.setDescription('An entry in the crsAltRidAltRidProvTable.')
crsAltRidRoutingId = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 10, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 126))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: crsAltRidRoutingId.setStatus('mandatory')
if mibBuilder.loadTexts: crsAltRidRoutingId.setDescription('This attribute specifies a group of one or more interconnected nodes (called a subnet) to which the request is redirected.')
callRedirectionGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 1))
callRedirectionGroupBE = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 1, 5))
callRedirectionGroupBE01 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 1, 5, 2))
callRedirectionGroupBE01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 1, 5, 2, 2))
callRedirectionCapabilities = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 3))
callRedirectionCapabilitiesBE = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 3, 5))
callRedirectionCapabilitiesBE01 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 3, 5, 2))
callRedirectionCapabilitiesBE01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 3, 5, 2, 2))
mibBuilder.exportSymbols("Nortel-Magellan-Passport-CallRedirectionMIB", crsIndex=crsIndex, crsSecAddressListExhausted=crsSecAddressListExhausted, crsAltRid=crsAltRid, crsPAddrSRidMidRowStatusTable=crsPAddrSRidMidRowStatusTable, crsStorageType=crsStorageType, crsAddressRedirected=crsAddressRedirected, crsTotalAddresses=crsTotalAddresses, crsAltRidUnsuccessful=crsAltRidUnsuccessful, crsPAddrComponentName=crsPAddrComponentName, crsPrimaryMatches=crsPrimaryMatches, crsPAddrSRidMidRowStatus=crsPAddrSRidMidRowStatus, crsAltRidComponentName=crsAltRidComponentName, crsAltRidIndex=crsAltRidIndex, callRedirectionCapabilitiesBE01=callRedirectionCapabilitiesBE01, crsPAddrSRidMid=crsPAddrSRidMid, crsStateEntry=crsStateEntry, crsSecAddrUnsuccessful=crsSecAddrUnsuccessful, crsAltRidAltRidProvTable=crsAltRidAltRidProvTable, callRedirectionGroupBE01A=callRedirectionGroupBE01A, crsPAddrSRidMidStorageType=crsPAddrSRidMidStorageType, crsRowStatusEntry=crsRowStatusEntry, crsPAddrSRidMidIndex=crsPAddrSRidMidIndex, crsSecRidMidUnsuccessful=crsSecRidMidUnsuccessful, crsProvTable=crsProvTable, crsPAddrSRidMidModuleId=crsPAddrSRidMidModuleId, crsAltRidRoutingId=crsAltRidRoutingId, callRedirectionCapabilitiesBE=callRedirectionCapabilitiesBE, crsRowStatus=crsRowStatus, crsRowStatusTable=crsRowStatusTable, crsPAddrRowStatusEntry=crsPAddrRowStatusEntry, crsPAddrSAddrIndex=crsPAddrSAddrIndex, crsPAddrSRidMidRowStatusEntry=crsPAddrSRidMidRowStatusEntry, crsComponentName=crsComponentName, crsAltRidRowStatus=crsAltRidRowStatus, crsPAddrSRidMidRoutingId=crsPAddrSRidMidRoutingId, crsPAddrSAddrRowStatus=crsPAddrSAddrRowStatus, callRedirectionGroup=callRedirectionGroup, crsRidRedirected=crsRidRedirected, crs=crs, callRedirectionGroupBE=callRedirectionGroupBE, crsMaxAddrLenExceeded=crsMaxAddrLenExceeded, crsStateTable=crsStateTable, crsPAddr=crsPAddr, crsPAddrRowStatus=crsPAddrRowStatus, crsPAddrSAddrRowStatusEntry=crsPAddrSAddrRowStatusEntry, crsPAddrSAddr=crsPAddrSAddr, crsPAddrSAddrSecAddrProvTable=crsPAddrSAddrSecAddrProvTable, crsAltRidAltRidProvEntry=crsAltRidAltRidProvEntry, crsRidMidRedirected=crsRidMidRedirected, crsPAddrStorageType=crsPAddrStorageType, crsAltRidRowStatusTable=crsAltRidRowStatusTable, crsPAddrSRidMidRidMidProvTable=crsPAddrSRidMidRidMidProvTable, crsStatTable=crsStatTable, callRedirectionCapabilitiesBE01A=callRedirectionCapabilitiesBE01A, crsAltRidStorageType=crsAltRidStorageType, crsOperationalState=crsOperationalState, crsPAddrSAddrAddress=crsPAddrSAddrAddress, crsProvEntry=crsProvEntry, crsAdminState=crsAdminState, crsPAddrSAddrRowStatusTable=crsPAddrSAddrRowStatusTable, callRedirectionMIB=callRedirectionMIB, crsLogicalProcessor=crsLogicalProcessor, crsPAddrSRidMidRidMidProvEntry=crsPAddrSRidMidRidMidProvEntry, callRedirectionCapabilities=callRedirectionCapabilities, crsPAddrSRidMidComponentName=crsPAddrSRidMidComponentName, crsPAddrSAddrStorageType=crsPAddrSAddrStorageType, crsPAddrSAddrSecAddrProvEntry=crsPAddrSAddrSecAddrProvEntry, callRedirectionGroupBE01=callRedirectionGroupBE01, crsPAddrRowStatusTable=crsPAddrRowStatusTable, crsRequestsReceived=crsRequestsReceived, crsPAddrSAddrComponentName=crsPAddrSAddrComponentName, crsAltRidRowStatusEntry=crsAltRidRowStatusEntry, crsStatEntry=crsStatEntry, crsPAddrIndex=crsPAddrIndex, crsUsageState=crsUsageState)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint')
(row_status, integer32, storage_type, unsigned32, display_string, counter32) = mibBuilder.importSymbols('Nortel-Magellan-Passport-StandardTextualConventionsMIB', 'RowStatus', 'Integer32', 'StorageType', 'Unsigned32', 'DisplayString', 'Counter32')
(ascii_string, link, ascii_string_index, non_replicated) = mibBuilder.importSymbols('Nortel-Magellan-Passport-TextualConventionsMIB', 'AsciiString', 'Link', 'AsciiStringIndex', 'NonReplicated')
(components, passport_mi_bs) = mibBuilder.importSymbols('Nortel-Magellan-Passport-UsefulDefinitionsMIB', 'components', 'passportMIBs')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(ip_address, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, integer32, notification_type, gauge32, unsigned32, bits, module_identity, counter32, counter64, object_identity, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'Integer32', 'NotificationType', 'Gauge32', 'Unsigned32', 'Bits', 'ModuleIdentity', 'Counter32', 'Counter64', 'ObjectIdentity', 'TimeTicks')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
call_redirection_mib = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132))
crs = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132))
crs_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1))
if mibBuilder.loadTexts:
crsRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsRowStatusTable.setDescription('This entry controls the addition and deletion of crs components.')
crs_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'))
if mibBuilder.loadTexts:
crsRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsRowStatusEntry.setDescription('A single entry in the table represents a single crs component.')
crs_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1, 1), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
crsRowStatus.setDescription('This variable is used as the basis for SNMP naming of crs components. These components can be added and deleted.')
crs_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsComponentName.setStatus('mandatory')
if mibBuilder.loadTexts:
crsComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crs_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1, 4), storage_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsStorageType.setStatus('mandatory')
if mibBuilder.loadTexts:
crsStorageType.setDescription('This variable represents the storage type value for the crs tables.')
crs_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 1, 1, 10), non_replicated())
if mibBuilder.loadTexts:
crsIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
crsIndex.setDescription('This variable represents the index for the crs tables.')
crs_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 10))
if mibBuilder.loadTexts:
crsProvTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsProvTable.setDescription('The Provisioned group contains provisionable attributes of the CallRedirectionServer component.')
crs_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 10, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'))
if mibBuilder.loadTexts:
crsProvEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsProvEntry.setDescription('An entry in the crsProvTable.')
crs_logical_processor = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 10, 1, 2), link()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsLogicalProcessor.setStatus('mandatory')
if mibBuilder.loadTexts:
crsLogicalProcessor.setDescription('This attribute specifies the logical processor on which the call redirection server process is to run.')
crs_state_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11))
if mibBuilder.loadTexts:
crsStateTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsStateTable.setDescription('This group contains the three OSI State attributes. The descriptions generically indicate what each state attribute implies about the component. Note that not all the values and state combinations described here are supported by every component which uses this group. For component-specific information and the valid state combinations, refer to NTP 241-7001-150, Passport Operations and Maintenance Guide.')
crs_state_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'))
if mibBuilder.loadTexts:
crsStateEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsStateEntry.setDescription('An entry in the crsStateTable.')
crs_admin_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('locked', 0), ('unlocked', 1), ('shuttingDown', 2))).clone('unlocked')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsAdminState.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAdminState.setDescription('This attribute indicates the OSI Administrative State of the component. The value locked indicates that the component is administratively prohibited from providing services for its users. A Lock or Lock - force command has been previously issued for this component. When the value is locked, the value of usageState must be idle. The value shuttingDown indicates that the component is administratively permitted to provide service to its existing users only. A Lock command was issued against the component and it is in the process of shutting down. The value unlocked indicates that the component is administratively permitted to provide services for its users. To enter this state, issue an Unlock command to this component.')
crs_operational_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('disabled', 0), ('enabled', 1))).clone('disabled')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsOperationalState.setStatus('mandatory')
if mibBuilder.loadTexts:
crsOperationalState.setDescription('This attribute indicates the OSI Operational State of the component. The value enabled indicates that the component is available for operation. Note that if adminState is locked, it would still not be providing service. The value disabled indicates that the component is not available for operation. For example, something is wrong with the component itself, or with another component on which this one depends. If the value is disabled, the usageState must be idle.')
crs_usage_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 11, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('idle', 0), ('active', 1), ('busy', 2))).clone('idle')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsUsageState.setStatus('mandatory')
if mibBuilder.loadTexts:
crsUsageState.setDescription('This attribute indicates the OSI Usage State of the component. The value idle indicates that the component is not currently in use. The value active indicates that the component is in use and has spare capacity to provide for additional users. The value busy indicates that the component is in use and has no spare operating capacity for additional users at this time.')
crs_stat_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12))
if mibBuilder.loadTexts:
crsStatTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsStatTable.setDescription('The Statistics operational group defines the statistics associated with the CallRedirectionServer component.')
crs_stat_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'))
if mibBuilder.loadTexts:
crsStatEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsStatEntry.setDescription('An entry in the crsStatTable.')
crs_total_addresses = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(0, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsTotalAddresses.setStatus('mandatory')
if mibBuilder.loadTexts:
crsTotalAddresses.setDescription('The totalAddresses attribute indicates the number of PrimaryAddress components associated with the CallRedirectionServer component.')
crs_requests_received = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsRequestsReceived.setStatus('mandatory')
if mibBuilder.loadTexts:
crsRequestsReceived.setDescription('The requestsReceived attribute counts the number of redirection requests received by the CallRedirectionServer component. This counter wraps to 0 when it exceeds its maximum value.')
crs_primary_matches = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsPrimaryMatches.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPrimaryMatches.setDescription('The primaryMatches attribute counts the Call Redirection Server attempts to find a matching PrimaryAddress where the lookup attempt was successful. This counter wraps to 0 when it exceeds its maximum value.')
crs_sec_address_list_exhausted = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsSecAddressListExhausted.setStatus('mandatory')
if mibBuilder.loadTexts:
crsSecAddressListExhausted.setDescription('The secAddressListExhausted attribute counts the Call Redirection Server attempts to find a SecondaryAddress component given a PrimaryAddress component where the lookup attempt resulted in the exhaustion of the secondary redirection list. This counter wraps to 0 when it exceeds its maximum value.')
crs_max_addr_len_exceeded = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsMaxAddrLenExceeded.setStatus('mandatory')
if mibBuilder.loadTexts:
crsMaxAddrLenExceeded.setDescription('The maxAddrLenExceeded attribute counts how often the concatenation of the secondary address and the suffix digits from the original called address have exceeded the maximum of 15 digits. The suffix digits can be determined by removing the primary address digits from the front of the original called address. If appending the suffix digits to a secondary address causes the resulting address to exceed 15 digits, this secondary member is skipped and the next secondary member is tried.')
crs_sec_rid_mid_unsuccessful = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsSecRidMidUnsuccessful.setStatus('mandatory')
if mibBuilder.loadTexts:
crsSecRidMidUnsuccessful.setDescription('The secRidMidUnsuccessful attribute counts the number of RID/ MID redirections resulting in the destination address not being reached. This situation could occur when the destination address does not exist on the specified module or the specified module could not be reached.')
crs_sec_addr_unsuccessful = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsSecAddrUnsuccessful.setStatus('mandatory')
if mibBuilder.loadTexts:
crsSecAddrUnsuccessful.setDescription('The secAddrUnsuccessful attribute counts the number of Address redirections resulting in the destination user not being reached. This situation could occur when the destination user line is disabled, the destination address does not exist on the specified module, or the specified module could not be reached.')
crs_rid_redirected = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsRidRedirected.setStatus('mandatory')
if mibBuilder.loadTexts:
crsRidRedirected.setDescription('The ridRedirected attribute counts requests received by the Call Redirection Server resulting in the request being redirected to another RID specified by the AlternateRid component. This counter wraps to 0 when it exceeds its maximum value.')
crs_rid_mid_redirected = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsRidMidRedirected.setStatus('mandatory')
if mibBuilder.loadTexts:
crsRidMidRedirected.setDescription('The ridMidRedirected attribute counts requests received by the Call Redirection Server resulting in the request being redirected to another RID/MID specified by the SecondaryRidMid component. This counter wraps to 0 when it exceeds its maximum value.')
crs_address_redirected = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsAddressRedirected.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAddressRedirected.setDescription('The addressRedirected attribute counts requests received by the Call Redirection Server resulting in the request being redirected to another Address specified by the SecondaryAddress component. This counter wraps to 0 when it exceeds its maximum value.')
crs_alt_rid_unsuccessful = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 12, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsAltRidUnsuccessful.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidUnsuccessful.setDescription('The altRidUnsuccessful attribute counts the number of RID redirections resulting in the destination address not being reached. This situation could occur when the alternate RID cannot be reached, the module hosting the destination address is isolated, or the port associated with the secondary address is unavailable at the alternate RID.')
crs_p_addr = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2))
crs_p_addr_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1))
if mibBuilder.loadTexts:
crsPAddrRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrRowStatusTable.setDescription('This entry controls the addition and deletion of crsPAddr components.')
crs_p_addr_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrIndex'))
if mibBuilder.loadTexts:
crsPAddrRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrRowStatusEntry.setDescription('A single entry in the table represents a single crsPAddr component.')
crs_p_addr_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1, 1), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsPAddrRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrRowStatus.setDescription('This variable is used as the basis for SNMP naming of crsPAddr components. These components can be added and deleted.')
crs_p_addr_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsPAddrComponentName.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crs_p_addr_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1, 4), storage_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsPAddrStorageType.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrStorageType.setDescription('This variable represents the storage type value for the crsPAddr tables.')
crs_p_addr_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 1, 1, 10), ascii_string_index().subtype(subtypeSpec=value_size_constraint(1, 17)))
if mibBuilder.loadTexts:
crsPAddrIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrIndex.setDescription('This variable represents the index for the crsPAddr tables.')
crs_p_addr_s_rid_mid = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2))
crs_p_addr_s_rid_mid_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1))
if mibBuilder.loadTexts:
crsPAddrSRidMidRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidRowStatusTable.setDescription('This entry controls the addition and deletion of crsPAddrSRidMid components.')
crs_p_addr_s_rid_mid_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrSRidMidIndex'))
if mibBuilder.loadTexts:
crsPAddrSRidMidRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidRowStatusEntry.setDescription('A single entry in the table represents a single crsPAddrSRidMid component.')
crs_p_addr_s_rid_mid_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1, 1), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsPAddrSRidMidRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidRowStatus.setDescription('This variable is used as the basis for SNMP naming of crsPAddrSRidMid components. These components can be added and deleted.')
crs_p_addr_s_rid_mid_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsPAddrSRidMidComponentName.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crs_p_addr_s_rid_mid_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1, 4), storage_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsPAddrSRidMidStorageType.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidStorageType.setDescription('This variable represents the storage type value for the crsPAddrSRidMid tables.')
crs_p_addr_s_rid_mid_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 1, 1, 10), non_replicated())
if mibBuilder.loadTexts:
crsPAddrSRidMidIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidIndex.setDescription('This variable represents the index for the crsPAddrSRidMid tables.')
crs_p_addr_s_rid_mid_rid_mid_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 10))
if mibBuilder.loadTexts:
crsPAddrSRidMidRidMidProvTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidRidMidProvTable.setDescription('The SecRidMidProv group defines the secondary RID/MID pair associated with a specific primary address.')
crs_p_addr_s_rid_mid_rid_mid_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 10, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrSRidMidIndex'))
if mibBuilder.loadTexts:
crsPAddrSRidMidRidMidProvEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidRidMidProvEntry.setDescription('An entry in the crsPAddrSRidMidRidMidProvTable.')
crs_p_addr_s_rid_mid_routing_id = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 10, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 126))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsPAddrSRidMidRoutingId.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidRoutingId.setDescription('This attribute specifies a group of one or more interconnected nodes (called a subnet) to which the primary address is redirected.')
crs_p_addr_s_rid_mid_module_id = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 2, 10, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 1909))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsPAddrSRidMidModuleId.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSRidMidModuleId.setDescription('This attribute specifies a Passport node to which the primary address is redirected.')
crs_p_addr_s_addr = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3))
crs_p_addr_s_addr_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1))
if mibBuilder.loadTexts:
crsPAddrSAddrRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrRowStatusTable.setDescription('This entry controls the addition and deletion of crsPAddrSAddr components.')
crs_p_addr_s_addr_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrSAddrIndex'))
if mibBuilder.loadTexts:
crsPAddrSAddrRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrRowStatusEntry.setDescription('A single entry in the table represents a single crsPAddrSAddr component.')
crs_p_addr_s_addr_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1, 1), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsPAddrSAddrRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrRowStatus.setDescription('This variable is used as the basis for SNMP naming of crsPAddrSAddr components. These components can be added and deleted.')
crs_p_addr_s_addr_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsPAddrSAddrComponentName.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crs_p_addr_s_addr_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1, 4), storage_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsPAddrSAddrStorageType.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrStorageType.setDescription('This variable represents the storage type value for the crsPAddrSAddr tables.')
crs_p_addr_s_addr_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 1, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(1, 7)))
if mibBuilder.loadTexts:
crsPAddrSAddrIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrIndex.setDescription('This variable represents the index for the crsPAddrSAddr tables.')
crs_p_addr_s_addr_sec_addr_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 10))
if mibBuilder.loadTexts:
crsPAddrSAddrSecAddrProvTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrSecAddrProvTable.setDescription('The SecAddrProv group defines one of the secondary addresses associated with a specific primary address.')
crs_p_addr_s_addr_sec_addr_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 10, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsPAddrSAddrIndex'))
if mibBuilder.loadTexts:
crsPAddrSAddrSecAddrProvEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrSecAddrProvEntry.setDescription('An entry in the crsPAddrSAddrSecAddrProvTable.')
crs_p_addr_s_addr_address = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 2, 3, 10, 1, 3), ascii_string().subtype(subtypeSpec=value_size_constraint(1, 17))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsPAddrSAddrAddress.setStatus('mandatory')
if mibBuilder.loadTexts:
crsPAddrSAddrAddress.setDescription('This attribute specifies a secondary address to which the primary address is redirected. The address attribute includes the Numbering Plan Indicator (NPI) and the digits which form a unique identifier of the customer interface. The address may belong to the X.121 or E.164 addressing plan. Address digits are selected and assigned by network operators. The address attribute takes the form: x.<X.121 address> or e.<E.164 address>')
crs_alt_rid = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3))
crs_alt_rid_row_status_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1))
if mibBuilder.loadTexts:
crsAltRidRowStatusTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidRowStatusTable.setDescription('This entry controls the addition and deletion of crsAltRid components.')
crs_alt_rid_row_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsAltRidIndex'))
if mibBuilder.loadTexts:
crsAltRidRowStatusEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidRowStatusEntry.setDescription('A single entry in the table represents a single crsAltRid component.')
crs_alt_rid_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1, 1), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsAltRidRowStatus.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidRowStatus.setDescription('This variable is used as the basis for SNMP naming of crsAltRid components. These components can be added and deleted.')
crs_alt_rid_component_name = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsAltRidComponentName.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidComponentName.setDescription("This variable provides the component's string name for use with the ASCII Console Interface")
crs_alt_rid_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1, 4), storage_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
crsAltRidStorageType.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidStorageType.setDescription('This variable represents the storage type value for the crsAltRid tables.')
crs_alt_rid_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 1, 1, 10), non_replicated())
if mibBuilder.loadTexts:
crsAltRidIndex.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidIndex.setDescription('This variable represents the index for the crsAltRid tables.')
crs_alt_rid_alt_rid_prov_table = mib_table((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 10))
if mibBuilder.loadTexts:
crsAltRidAltRidProvTable.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidAltRidProvTable.setDescription('The AltRidProv group defines the alternate RID associated with the Crs component.')
crs_alt_rid_alt_rid_prov_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 10, 1)).setIndexNames((0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsIndex'), (0, 'Nortel-Magellan-Passport-CallRedirectionMIB', 'crsAltRidIndex'))
if mibBuilder.loadTexts:
crsAltRidAltRidProvEntry.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidAltRidProvEntry.setDescription('An entry in the crsAltRidAltRidProvTable.')
crs_alt_rid_routing_id = mib_table_column((1, 3, 6, 1, 4, 1, 562, 2, 4, 1, 132, 3, 10, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 126))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
crsAltRidRoutingId.setStatus('mandatory')
if mibBuilder.loadTexts:
crsAltRidRoutingId.setDescription('This attribute specifies a group of one or more interconnected nodes (called a subnet) to which the request is redirected.')
call_redirection_group = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 1))
call_redirection_group_be = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 1, 5))
call_redirection_group_be01 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 1, 5, 2))
call_redirection_group_be01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 1, 5, 2, 2))
call_redirection_capabilities = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 3))
call_redirection_capabilities_be = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 3, 5))
call_redirection_capabilities_be01 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 3, 5, 2))
call_redirection_capabilities_be01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 2, 4, 2, 132, 3, 5, 2, 2))
mibBuilder.exportSymbols('Nortel-Magellan-Passport-CallRedirectionMIB', crsIndex=crsIndex, crsSecAddressListExhausted=crsSecAddressListExhausted, crsAltRid=crsAltRid, crsPAddrSRidMidRowStatusTable=crsPAddrSRidMidRowStatusTable, crsStorageType=crsStorageType, crsAddressRedirected=crsAddressRedirected, crsTotalAddresses=crsTotalAddresses, crsAltRidUnsuccessful=crsAltRidUnsuccessful, crsPAddrComponentName=crsPAddrComponentName, crsPrimaryMatches=crsPrimaryMatches, crsPAddrSRidMidRowStatus=crsPAddrSRidMidRowStatus, crsAltRidComponentName=crsAltRidComponentName, crsAltRidIndex=crsAltRidIndex, callRedirectionCapabilitiesBE01=callRedirectionCapabilitiesBE01, crsPAddrSRidMid=crsPAddrSRidMid, crsStateEntry=crsStateEntry, crsSecAddrUnsuccessful=crsSecAddrUnsuccessful, crsAltRidAltRidProvTable=crsAltRidAltRidProvTable, callRedirectionGroupBE01A=callRedirectionGroupBE01A, crsPAddrSRidMidStorageType=crsPAddrSRidMidStorageType, crsRowStatusEntry=crsRowStatusEntry, crsPAddrSRidMidIndex=crsPAddrSRidMidIndex, crsSecRidMidUnsuccessful=crsSecRidMidUnsuccessful, crsProvTable=crsProvTable, crsPAddrSRidMidModuleId=crsPAddrSRidMidModuleId, crsAltRidRoutingId=crsAltRidRoutingId, callRedirectionCapabilitiesBE=callRedirectionCapabilitiesBE, crsRowStatus=crsRowStatus, crsRowStatusTable=crsRowStatusTable, crsPAddrRowStatusEntry=crsPAddrRowStatusEntry, crsPAddrSAddrIndex=crsPAddrSAddrIndex, crsPAddrSRidMidRowStatusEntry=crsPAddrSRidMidRowStatusEntry, crsComponentName=crsComponentName, crsAltRidRowStatus=crsAltRidRowStatus, crsPAddrSRidMidRoutingId=crsPAddrSRidMidRoutingId, crsPAddrSAddrRowStatus=crsPAddrSAddrRowStatus, callRedirectionGroup=callRedirectionGroup, crsRidRedirected=crsRidRedirected, crs=crs, callRedirectionGroupBE=callRedirectionGroupBE, crsMaxAddrLenExceeded=crsMaxAddrLenExceeded, crsStateTable=crsStateTable, crsPAddr=crsPAddr, crsPAddrRowStatus=crsPAddrRowStatus, crsPAddrSAddrRowStatusEntry=crsPAddrSAddrRowStatusEntry, crsPAddrSAddr=crsPAddrSAddr, crsPAddrSAddrSecAddrProvTable=crsPAddrSAddrSecAddrProvTable, crsAltRidAltRidProvEntry=crsAltRidAltRidProvEntry, crsRidMidRedirected=crsRidMidRedirected, crsPAddrStorageType=crsPAddrStorageType, crsAltRidRowStatusTable=crsAltRidRowStatusTable, crsPAddrSRidMidRidMidProvTable=crsPAddrSRidMidRidMidProvTable, crsStatTable=crsStatTable, callRedirectionCapabilitiesBE01A=callRedirectionCapabilitiesBE01A, crsAltRidStorageType=crsAltRidStorageType, crsOperationalState=crsOperationalState, crsPAddrSAddrAddress=crsPAddrSAddrAddress, crsProvEntry=crsProvEntry, crsAdminState=crsAdminState, crsPAddrSAddrRowStatusTable=crsPAddrSAddrRowStatusTable, callRedirectionMIB=callRedirectionMIB, crsLogicalProcessor=crsLogicalProcessor, crsPAddrSRidMidRidMidProvEntry=crsPAddrSRidMidRidMidProvEntry, callRedirectionCapabilities=callRedirectionCapabilities, crsPAddrSRidMidComponentName=crsPAddrSRidMidComponentName, crsPAddrSAddrStorageType=crsPAddrSAddrStorageType, crsPAddrSAddrSecAddrProvEntry=crsPAddrSAddrSecAddrProvEntry, callRedirectionGroupBE01=callRedirectionGroupBE01, crsPAddrRowStatusTable=crsPAddrRowStatusTable, crsRequestsReceived=crsRequestsReceived, crsPAddrSAddrComponentName=crsPAddrSAddrComponentName, crsAltRidRowStatusEntry=crsAltRidRowStatusEntry, crsStatEntry=crsStatEntry, crsPAddrIndex=crsPAddrIndex, crsUsageState=crsUsageState) |
def make_adder(x):
def adder(y):
return x + y
return adder
inc = make_adder(1)
plus10 = make_adder(10)
___assertEqual(inc(1), 2)
___assertEqual(plus10(-2), 8)
| def make_adder(x):
def adder(y):
return x + y
return adder
inc = make_adder(1)
plus10 = make_adder(10)
___assert_equal(inc(1), 2)
___assert_equal(plus10(-2), 8) |
class Solution:
def powerfulIntegers(self, x: int, y: int, bound: int) -> List[int]:
if x == 1:
i_max = 0
else:
i_max = int(math.log(bound,x))
if y == 1:
j_max = 0
else:
j_max = int(math.log(bound,y))
res = []
for i in range(i_max+1):
for j in range(j_max+1):
tmp = x**i + y**j
if tmp <= bound and tmp not in res:
res.append(tmp)
return res
| class Solution:
def powerful_integers(self, x: int, y: int, bound: int) -> List[int]:
if x == 1:
i_max = 0
else:
i_max = int(math.log(bound, x))
if y == 1:
j_max = 0
else:
j_max = int(math.log(bound, y))
res = []
for i in range(i_max + 1):
for j in range(j_max + 1):
tmp = x ** i + y ** j
if tmp <= bound and tmp not in res:
res.append(tmp)
return res |
# Programacion orientada a objetos 1
# https://www.youtube.com/watch?v=lg9p0yWgXYk&list=PLh7JzoyIyU4JVOeKkiNYPkAWBq0Aszxc-&index=2
class Persona:
def __init__(self, nombre_persona, calle=1):
self.nombre = nombre_persona
self.calle = calle
def moverse(self, velocidad):
self.calle += velocidad
jose = Persona("Jose")
juan = Persona("Juan", 2)
print(jose.nombre)
print(juan.nombre)
print(jose.calle)
print(juan.calle)
jose.moverse(5)
print(jose.calle)
| class Persona:
def __init__(self, nombre_persona, calle=1):
self.nombre = nombre_persona
self.calle = calle
def moverse(self, velocidad):
self.calle += velocidad
jose = persona('Jose')
juan = persona('Juan', 2)
print(jose.nombre)
print(juan.nombre)
print(jose.calle)
print(juan.calle)
jose.moverse(5)
print(jose.calle) |
# simplified linked list
class Node:
def __init__ (self, value, next=None):
self.value = value
self.next = next
L = Node('a', Node('b', Node('c', Node('d'))))
# print('L', L.value)
# print(L.next.next.value)
| class Node:
def __init__(self, value, next=None):
self.value = value
self.next = next
l = node('a', node('b', node('c', node('d')))) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def bstToGst(self, root: TreeNode) -> TreeNode:
def f(root, val = 0):
if root is None:
return 0
rightValue = f(root.right, val)
leftValue = f(root.left, root.val + rightValue + val)
t = root.val
root.val += rightValue + val
return t + leftValue + rightValue
f(root)
return root
| class Solution:
def bst_to_gst(self, root: TreeNode) -> TreeNode:
def f(root, val=0):
if root is None:
return 0
right_value = f(root.right, val)
left_value = f(root.left, root.val + rightValue + val)
t = root.val
root.val += rightValue + val
return t + leftValue + rightValue
f(root)
return root |
tokens = {
"WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"DAI": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"BAT": "0x0D8775F648430679A709E98d2b0Cb6250d2887EF",
"WBTC": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"UNI": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
}
| tokens = {'WETH': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 'DAI': '0x6B175474E89094C44Da98b954EedeAC495271d0F', 'BAT': '0x0D8775F648430679A709E98d2b0Cb6250d2887EF', 'WBTC': '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', 'UNI': '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984'} |
# -*- coding: utf-8 -*-
casos = int(input())
result = []
for i in range(casos):
num1, num2, indice1, indice2 = input().split(" ")
num1 = int(num1)
num2 = int(num2)
indice1 = float(indice1)
indice2 = float(indice2)
anos = 0
while num1 <= num2:
num1 += int(num1*indice1/100)
num2 += int(num2*indice2/100)
anos +=1
if anos > 100:
result.append('Mais de 1 seculo.')
break
if anos <= 100:
result.append('{} anos.'.format(anos))
for i in result:
print(i) | casos = int(input())
result = []
for i in range(casos):
(num1, num2, indice1, indice2) = input().split(' ')
num1 = int(num1)
num2 = int(num2)
indice1 = float(indice1)
indice2 = float(indice2)
anos = 0
while num1 <= num2:
num1 += int(num1 * indice1 / 100)
num2 += int(num2 * indice2 / 100)
anos += 1
if anos > 100:
result.append('Mais de 1 seculo.')
break
if anos <= 100:
result.append('{} anos.'.format(anos))
for i in result:
print(i) |
if __name__ == '__main__':
arr = []
for _ in range(int(input())):
name = input()
score = float(input())
arr.append([name,score])
arr.sort()
first = 100000
second = 100000
for i in range(len(arr)):
if (arr[i][1] < first):
second = first
first = arr[i][1]
elif (arr[i][1] < second and arr[i][1] != first):
second = arr[i][1]
for x in range(len(arr)):
if(arr[x][1] == second):
print(arr[x][0])
| if __name__ == '__main__':
arr = []
for _ in range(int(input())):
name = input()
score = float(input())
arr.append([name, score])
arr.sort()
first = 100000
second = 100000
for i in range(len(arr)):
if arr[i][1] < first:
second = first
first = arr[i][1]
elif arr[i][1] < second and arr[i][1] != first:
second = arr[i][1]
for x in range(len(arr)):
if arr[x][1] == second:
print(arr[x][0]) |
# Find First and Last Position of Element in Sorted Array
class Solution:
def binSearch(self, nums, target):
length = len(nums)
left, right = 0, length - 1
while left <= right:
mid = (left + right) // 2
if nums[mid] == target:
while mid >= 0 and nums[mid] == target:
mid -= 1
return mid + 1
elif nums[mid] > target:
right = mid - 1
else:
left = mid + 1
return -1
def searchRange(self, nums, target):
found = self.binSearch(nums, target)
if found == -1:
return [-1, -1]
start = found
while found < len(nums) and nums[found] == target:
found += 1
return [start, found - 1]
if __name__ == "__main__":
sol = Solution()
nums = [1, 1]
target = 1
print(sol.searchRange(nums, target))
| class Solution:
def bin_search(self, nums, target):
length = len(nums)
(left, right) = (0, length - 1)
while left <= right:
mid = (left + right) // 2
if nums[mid] == target:
while mid >= 0 and nums[mid] == target:
mid -= 1
return mid + 1
elif nums[mid] > target:
right = mid - 1
else:
left = mid + 1
return -1
def search_range(self, nums, target):
found = self.binSearch(nums, target)
if found == -1:
return [-1, -1]
start = found
while found < len(nums) and nums[found] == target:
found += 1
return [start, found - 1]
if __name__ == '__main__':
sol = solution()
nums = [1, 1]
target = 1
print(sol.searchRange(nums, target)) |
# def find_all_index(text, pattern):
# pattern_index = 0
# match = []
# # if pattern is empty, then return all indices
# if pattern == '':
# for index in range(len(text)):
# match.append(index)
# return match
# for index, charc in enumerate(text):
# # check if letters are the same
# if charc == pattern[pattern_index]:
# pattern_index += 1
# # if we've reached the end of the pattern index return the start of
# # the pattern in the text
# if pattern_index == len(pattern):
# match.append(index - (pattern_index - 1))
# pattern_index = 0
# # they are not the same
# else:
# pattern_index = 0
# if not match: # list is empty
# return None
# return match
def find_all_index(text, pattern):
match = []
if pattern == '':
for index in range(len(text)):
match.append(index)
return match
for t_index, t_char in enumerate(text):
print("t_index: ", t_index)
for p_index, p_char in enumerate(pattern):
# check if more characters in the text match characters in the
# pattern
print(" p_index {}, p_char {}".format(p_index, p_char))
# check if it is a valid index of the text
if t_index + p_index > (len(text)-1):
break # not a valid index
text_char = text[t_index + p_index]
# check if letters are the same
if text_char == p_char:
# check if the letters are the same and we've reached the last
# index of the pattern
if p_index == (len(pattern) - 1):
# append the position of the charc where the pattern and text
# first matched
match.append(t_index)
# append the text index minus the pattern index
continue
# they are not the same
else:
break
if not match: # check if match is empty # Really helpful resource to find solution: https://www.python-course.eu/python3_for_loop.php
# tried all possible starting indexes in text, never found a perfect match
return None
# all characters in the pattern matched in the text
return match
if __name__ == '__main__':
print(find_all_index('aaa', 'aa'))
| def find_all_index(text, pattern):
match = []
if pattern == '':
for index in range(len(text)):
match.append(index)
return match
for (t_index, t_char) in enumerate(text):
print('t_index: ', t_index)
for (p_index, p_char) in enumerate(pattern):
print(' p_index {}, p_char {}'.format(p_index, p_char))
if t_index + p_index > len(text) - 1:
break
text_char = text[t_index + p_index]
if text_char == p_char:
if p_index == len(pattern) - 1:
match.append(t_index)
continue
else:
break
if not match:
return None
return match
if __name__ == '__main__':
print(find_all_index('aaa', 'aa')) |
def mergeSort(list):
if len(list) <= 1:
return list
# Find the middle point and devide it
middle = len(list) // 2
left_list = list[:middle]
right_list = list[middle:]
left_list = mergeSort(left_list)
right_list = mergeSort(right_list)
return merge(left_list, right_list)
# Merge the sorted halves
def merge(left_half,right_half):
res = []
while len(left_half) != 0 and len(right_half) != 0:
if left_half[0] < right_half[0]:
res.append(left_half[0])
left_half.remove(left_half[0])
else:
res.append(right_half[0])
right_half.remove(right_half[0])
if len(left_half) == 0:
res = res + right_half
else:
res = res + left_half
return res
| def merge_sort(list):
if len(list) <= 1:
return list
middle = len(list) // 2
left_list = list[:middle]
right_list = list[middle:]
left_list = merge_sort(left_list)
right_list = merge_sort(right_list)
return merge(left_list, right_list)
def merge(left_half, right_half):
res = []
while len(left_half) != 0 and len(right_half) != 0:
if left_half[0] < right_half[0]:
res.append(left_half[0])
left_half.remove(left_half[0])
else:
res.append(right_half[0])
right_half.remove(right_half[0])
if len(left_half) == 0:
res = res + right_half
else:
res = res + left_half
return res |
class HTTPException(Exception):
def __init__(self, request, data):
msg = f"HTTP request returned {request.status} status code."
self.request = request
for k, v in data.items():
setattr(self, k, v)
msg += f"\nIn {k}: {v}"
return super().__init__(msg)
class TooManyRequests(HTTPException):
pass
class BadRequest(HTTPException):
pass
| class Httpexception(Exception):
def __init__(self, request, data):
msg = f'HTTP request returned {request.status} status code.'
self.request = request
for (k, v) in data.items():
setattr(self, k, v)
msg += f'\nIn {k}: {v}'
return super().__init__(msg)
class Toomanyrequests(HTTPException):
pass
class Badrequest(HTTPException):
pass |
CARD_VALUES = {
'2': 1,
'3': 1,
'4': 1,
'5': 1,
'6': 1,
'7': 0,
'8': 0,
'9': 0,
'0': -1,
'1': -1,
'J': -1,
'Q': -1,
'K': -1,
'A': -1,
'*': -1
}
DECKS = 8
def main():
count = 0
cards = 0
user_input = True
decks_played = 0
while user_input:
user_input = input('CARDS >> ')
user_input = user_input.upper()
if user_input == "DONE":
break
cards += len(user_input)
for card in user_input:
count += CARD_VALUES[card]
decks_played = cards / 52.0
true_count = count / (DECKS - decks_played)
print('Count: {}'.format(count))
print('True Count: {:2.2f}'.format(true_count))
print('Decks Played: {:1.2f}'.format(decks_played))
if __name__ == '__main__':
main()
| card_values = {'2': 1, '3': 1, '4': 1, '5': 1, '6': 1, '7': 0, '8': 0, '9': 0, '0': -1, '1': -1, 'J': -1, 'Q': -1, 'K': -1, 'A': -1, '*': -1}
decks = 8
def main():
count = 0
cards = 0
user_input = True
decks_played = 0
while user_input:
user_input = input('CARDS >> ')
user_input = user_input.upper()
if user_input == 'DONE':
break
cards += len(user_input)
for card in user_input:
count += CARD_VALUES[card]
decks_played = cards / 52.0
true_count = count / (DECKS - decks_played)
print('Count: {}'.format(count))
print('True Count: {:2.2f}'.format(true_count))
print('Decks Played: {:1.2f}'.format(decks_played))
if __name__ == '__main__':
main() |
################### EXERCISE 1 ###############################################
# Constants
METER_PER_INCH = 0.0254
INCHES_PER_FEET = 12
feet = int(input('Enter the number of feet:'))
inches = int(input('Enter the number of inches:'))
number_meters = (feet * INCHES_PER_FEET + inches) * METER_PER_INCH
print(feet,'feet',inches,'inches is equivalent to', number_meters,'meters')
metres = float(input('Enter the number of metres:'))
number_inches = int(metres/METER_PER_INCH)
feet = number_inches//INCHES_PER_FEET
inches = number_inches % INCHES_PER_FEET
print(metres,'metres is equivalent to', feet, 'feet and',inches,'inches.')
################### EXERCISE 3 ###############################################
weight = float(input('Enter the number of Kg of banana you want to order: '))
cost = 3 * weight
if cost >50:
cost += 4.99 - 1.50
else:
cost += 4.99
print('The cost of the order is:', cost)
################### EXERCISE 4 ###############################################
age = int(input('Enter your age: '))
max_rate = 208 - 0.7 * age
rate = int(input('Enter your current heart rate: '))
# Be careful, the order of the conditions in the if-elif-else does matter. If I
# swap the second and third condition, the logic will be incorrect. The program
# will return something, but it will be incorrect.
if rate >= 0.9 * max_rate:
print('Interval training')
elif rate >= 0.7 * max_rate:
print('Threshold training')
elif rate >= 0.5 * max_rate:
print('Aerobic training')
else:
print('Couch potato')
################### EXERCISE 5 ###############################################
size_a = float(input('Enter the length of the first side of the triangle: '))
size_b = float(input('Enter the length of the second side of the triangle: '))
size_c = float(input('Enter the length of the third side of the triangle: '))
semi_perimeter = (size_a + size_b + size_c)/2
area = pow(semi_perimeter
* (semi_perimeter - size_a)
* (semi_perimeter - size_b)
* (semi_perimeter - size_c),
0.5)
print('The area of the triangle is', area)
| meter_per_inch = 0.0254
inches_per_feet = 12
feet = int(input('Enter the number of feet:'))
inches = int(input('Enter the number of inches:'))
number_meters = (feet * INCHES_PER_FEET + inches) * METER_PER_INCH
print(feet, 'feet', inches, 'inches is equivalent to', number_meters, 'meters')
metres = float(input('Enter the number of metres:'))
number_inches = int(metres / METER_PER_INCH)
feet = number_inches // INCHES_PER_FEET
inches = number_inches % INCHES_PER_FEET
print(metres, 'metres is equivalent to', feet, 'feet and', inches, 'inches.')
weight = float(input('Enter the number of Kg of banana you want to order: '))
cost = 3 * weight
if cost > 50:
cost += 4.99 - 1.5
else:
cost += 4.99
print('The cost of the order is:', cost)
age = int(input('Enter your age: '))
max_rate = 208 - 0.7 * age
rate = int(input('Enter your current heart rate: '))
if rate >= 0.9 * max_rate:
print('Interval training')
elif rate >= 0.7 * max_rate:
print('Threshold training')
elif rate >= 0.5 * max_rate:
print('Aerobic training')
else:
print('Couch potato')
size_a = float(input('Enter the length of the first side of the triangle: '))
size_b = float(input('Enter the length of the second side of the triangle: '))
size_c = float(input('Enter the length of the third side of the triangle: '))
semi_perimeter = (size_a + size_b + size_c) / 2
area = pow(semi_perimeter * (semi_perimeter - size_a) * (semi_perimeter - size_b) * (semi_perimeter - size_c), 0.5)
print('The area of the triangle is', area) |
expected_output = {
'ikev2_session': {
'IPv4':{
1:{
'session_id': 3,
'status': 'UP-ACTIVE',
'ike_count': 1,
'child_count': 1,
'tunnel_id': 1,
'local_ip': '1.1.1.1',
'local_port': 500,
'remote_ip': '1.1.1.2',
'remote_port': 500,
'fvrf': 'none',
'ivrf': 'none',
'session_status': 'READY',
'encryption': 'AES-CBC',
'key_length': 256,
'prf': 'SHA256',
'hash_algo': 'SHA256',
'dh_group': 14,
'auth_sign': 'PSK',
'auth_verify': 'PSK',
'lifetime': 86400,
'activetime': 38157,
'ce_id': 1008,
'id': 3,
'local_spi': '6F86196AB2C574E3',
'remote_spi': '74AD695CF23C4805',
'local_id': '1.1.1.1',
'remote_id': '1.1.1.2',
'local_mesg_id': 2,
'remote_mesg_id': 0,
'local_next_id': 2,
'remote_next_id': 0,
'local_queued': 2,
'remote_queued': 0,
'local_window': 5,
'remote_window': 5,
'dpd_time': 0,
'dpd_retry': 0,
'fragmentation': 'no',
'dynamic_route': 'enabled',
'nat_detected': 'no',
'cts_sgt': 'disabled',
'initiator_of_sa': 'Yes',
'child_sa':{
1:{
'local_selectors': ['30.10.10.0/0 - 50.10.10.255/65535','20.10.10.0/0 - 40.10.10.255/65535'],
'remote_selectors': ['172.17.2.0/0 - 172.17.2.255/65535','172.17.2.0/0 - 172.17.3.255/65535'],
'esp_spi_in': '0x232CB82D',
'esp_spi_out': '0x30767B6E',
'ah_spi_in': '0x0',
'ah_spi_out': '0x0',
'cpi_in': '0x0',
'cpi_out': '0x0',
'child_encr': 'AES-CBC',
'keysize': 256,
'esp_hmac': 'SHA256',
'ah_hmac': 'None',
'compression': 'IPCOMP_NONE',
'mode': 'tunnel',
},
2:{
'local_selectors': ['20.10.10.0/0 - 40.10.10.255/65535'],
'remote_selectors': ['50.20.20.0/0 - 60.20.20.255/65535'],
'esp_spi_in': '0x232CB82D',
'esp_spi_out': '0x30767B6E',
'ah_spi_in': '0x0',
'ah_spi_out': '0x0',
'cpi_in': '0x0',
'cpi_out': '0x0',
'child_encr': 'AES-CBC',
'keysize': 256,
'esp_hmac': 'SHA256',
'ah_hmac': 'None',
'compression': 'IPCOMP_NONE',
'mode': 'tunnel',
},
},
},
},
'IPv6':{
1:{
'session_id': 5,
'status': 'UP-ACTIVE',
'ike_count': 1,
'child_count': 1,
'tunnel_id': 1,
'local_ip': '1.1.1::1',
'local_port': 500,
'remote_ip': '1.1.1::2',
'remote_port': 500,
'fvrf': 'none',
'ivrf': 'none',
'session_status': 'READY',
'encryption': 'AES-CBC',
'key_length': 256,
'prf': 'SHA256',
'hash_algo': 'SHA256',
'dh_group': 14,
'auth_sign': 'PSK',
'auth_verify': 'PSK',
'lifetime': 86400,
'activetime': 38157,
'ce_id': 1008,
'id': 3,
'local_spi': '6F86196AB2C574E5',
'remote_spi': '74AD695CF23C4806',
'local_id': '1.1.1::1',
'remote_id': '1.1.1::2',
'local_mesg_id': 2,
'remote_mesg_id': 0,
'local_next_id': 2,
'remote_next_id': 0,
'local_queued': 2,
'remote_queued': 0,
'local_window': 5,
'remote_window': 5,
'dpd_time': 0,
'dpd_retry': 0,
'fragmentation': 'no',
'dynamic_route': 'enabled',
'nat_detected': 'no',
'cts_sgt': 'disabled',
'initiator_of_sa': 'Yes',
'child_sa':{
1:{
'local_selectors': ['30.10.10::0/0 - 50.10.10::255/65535','20.10.10::0/0 - 40.10.10::255/65535'],
'remote_selectors': ['172.17.2::0/0 - 172.17.2::255/65535','172.17.2::0/0 - 172.17.3::255/65535'],
'esp_spi_in': '0x232CB82D',
'esp_spi_out': '0x30767B6E',
'ah_spi_in': '0x0',
'ah_spi_out': '0x0',
'cpi_in': '0x0',
'cpi_out': '0x0',
'child_encr': 'AES-CBC',
'keysize': 256,
'esp_hmac': 'SHA256',
'ah_hmac': 'None',
'compression': 'IPCOMP_NONE',
'mode': 'tunnel',
},
2:{
'local_selectors': ['20.10.10::0/0 - 40.10.10::255/65535'],
'remote_selectors': ['50.20.20::0/0 - 60.20.20::255/65535'],
'esp_spi_in': '0x232CB82D',
'esp_spi_out': '0x30767B6E',
'ah_spi_in': '0x0',
'ah_spi_out': '0x0',
'cpi_in': '0x0',
'cpi_out': '0x0',
'child_encr': 'AES-CBC',
'keysize': 256,
'esp_hmac': 'SHA256',
'ah_hmac': 'None',
'compression': 'IPCOMP_NONE',
'mode': 'tunnel',
},
},
},
},
},
} | expected_output = {'ikev2_session': {'IPv4': {1: {'session_id': 3, 'status': 'UP-ACTIVE', 'ike_count': 1, 'child_count': 1, 'tunnel_id': 1, 'local_ip': '1.1.1.1', 'local_port': 500, 'remote_ip': '1.1.1.2', 'remote_port': 500, 'fvrf': 'none', 'ivrf': 'none', 'session_status': 'READY', 'encryption': 'AES-CBC', 'key_length': 256, 'prf': 'SHA256', 'hash_algo': 'SHA256', 'dh_group': 14, 'auth_sign': 'PSK', 'auth_verify': 'PSK', 'lifetime': 86400, 'activetime': 38157, 'ce_id': 1008, 'id': 3, 'local_spi': '6F86196AB2C574E3', 'remote_spi': '74AD695CF23C4805', 'local_id': '1.1.1.1', 'remote_id': '1.1.1.2', 'local_mesg_id': 2, 'remote_mesg_id': 0, 'local_next_id': 2, 'remote_next_id': 0, 'local_queued': 2, 'remote_queued': 0, 'local_window': 5, 'remote_window': 5, 'dpd_time': 0, 'dpd_retry': 0, 'fragmentation': 'no', 'dynamic_route': 'enabled', 'nat_detected': 'no', 'cts_sgt': 'disabled', 'initiator_of_sa': 'Yes', 'child_sa': {1: {'local_selectors': ['30.10.10.0/0 - 50.10.10.255/65535', '20.10.10.0/0 - 40.10.10.255/65535'], 'remote_selectors': ['172.17.2.0/0 - 172.17.2.255/65535', '172.17.2.0/0 - 172.17.3.255/65535'], 'esp_spi_in': '0x232CB82D', 'esp_spi_out': '0x30767B6E', 'ah_spi_in': '0x0', 'ah_spi_out': '0x0', 'cpi_in': '0x0', 'cpi_out': '0x0', 'child_encr': 'AES-CBC', 'keysize': 256, 'esp_hmac': 'SHA256', 'ah_hmac': 'None', 'compression': 'IPCOMP_NONE', 'mode': 'tunnel'}, 2: {'local_selectors': ['20.10.10.0/0 - 40.10.10.255/65535'], 'remote_selectors': ['50.20.20.0/0 - 60.20.20.255/65535'], 'esp_spi_in': '0x232CB82D', 'esp_spi_out': '0x30767B6E', 'ah_spi_in': '0x0', 'ah_spi_out': '0x0', 'cpi_in': '0x0', 'cpi_out': '0x0', 'child_encr': 'AES-CBC', 'keysize': 256, 'esp_hmac': 'SHA256', 'ah_hmac': 'None', 'compression': 'IPCOMP_NONE', 'mode': 'tunnel'}}}}, 'IPv6': {1: {'session_id': 5, 'status': 'UP-ACTIVE', 'ike_count': 1, 'child_count': 1, 'tunnel_id': 1, 'local_ip': '1.1.1::1', 'local_port': 500, 'remote_ip': '1.1.1::2', 'remote_port': 500, 'fvrf': 'none', 'ivrf': 'none', 'session_status': 'READY', 'encryption': 'AES-CBC', 'key_length': 256, 'prf': 'SHA256', 'hash_algo': 'SHA256', 'dh_group': 14, 'auth_sign': 'PSK', 'auth_verify': 'PSK', 'lifetime': 86400, 'activetime': 38157, 'ce_id': 1008, 'id': 3, 'local_spi': '6F86196AB2C574E5', 'remote_spi': '74AD695CF23C4806', 'local_id': '1.1.1::1', 'remote_id': '1.1.1::2', 'local_mesg_id': 2, 'remote_mesg_id': 0, 'local_next_id': 2, 'remote_next_id': 0, 'local_queued': 2, 'remote_queued': 0, 'local_window': 5, 'remote_window': 5, 'dpd_time': 0, 'dpd_retry': 0, 'fragmentation': 'no', 'dynamic_route': 'enabled', 'nat_detected': 'no', 'cts_sgt': 'disabled', 'initiator_of_sa': 'Yes', 'child_sa': {1: {'local_selectors': ['30.10.10::0/0 - 50.10.10::255/65535', '20.10.10::0/0 - 40.10.10::255/65535'], 'remote_selectors': ['172.17.2::0/0 - 172.17.2::255/65535', '172.17.2::0/0 - 172.17.3::255/65535'], 'esp_spi_in': '0x232CB82D', 'esp_spi_out': '0x30767B6E', 'ah_spi_in': '0x0', 'ah_spi_out': '0x0', 'cpi_in': '0x0', 'cpi_out': '0x0', 'child_encr': 'AES-CBC', 'keysize': 256, 'esp_hmac': 'SHA256', 'ah_hmac': 'None', 'compression': 'IPCOMP_NONE', 'mode': 'tunnel'}, 2: {'local_selectors': ['20.10.10::0/0 - 40.10.10::255/65535'], 'remote_selectors': ['50.20.20::0/0 - 60.20.20::255/65535'], 'esp_spi_in': '0x232CB82D', 'esp_spi_out': '0x30767B6E', 'ah_spi_in': '0x0', 'ah_spi_out': '0x0', 'cpi_in': '0x0', 'cpi_out': '0x0', 'child_encr': 'AES-CBC', 'keysize': 256, 'esp_hmac': 'SHA256', 'ah_hmac': 'None', 'compression': 'IPCOMP_NONE', 'mode': 'tunnel'}}}}}} |
class Solution:
def addNegabinary(self, arr1: List[int], arr2: List[int]) -> List[int]:
p1, p2 = len(arr1)-1, len(arr2)-1
carry = 0
result = []
while p1 >= 0 or p2 >= 0 or carry:
bit_sum = 0
if p1 >= 0:
bit_sum += arr1[p1]
p1 -= 1
if p2 >= 0:
bit_sum += arr2[p2]
p2 -= 1
bit_sum += carry
result.append(bit_sum % 2)
# the difference between base 2 and base -2
# The parenthese (bit_sum // 2) is absolutely necessary!
carry = - (bit_sum // 2)
# remove the leading zeros
while len(result) > 1 and result[-1] == 0:
result.pop()
return result[::-1]
| class Solution:
def add_negabinary(self, arr1: List[int], arr2: List[int]) -> List[int]:
(p1, p2) = (len(arr1) - 1, len(arr2) - 1)
carry = 0
result = []
while p1 >= 0 or p2 >= 0 or carry:
bit_sum = 0
if p1 >= 0:
bit_sum += arr1[p1]
p1 -= 1
if p2 >= 0:
bit_sum += arr2[p2]
p2 -= 1
bit_sum += carry
result.append(bit_sum % 2)
carry = -(bit_sum // 2)
while len(result) > 1 and result[-1] == 0:
result.pop()
return result[::-1] |
class FourCal:
def setdata(self,first,second):
self.first=first
self.second=second
def add(self):
result=self.first+self.second
return result
def mul(self):
result=self.first*self.second
return result
def sub(self):
result=self.first-self.second
return result
def div(self):
result=self.first/self.second
return result
print("/////////////////")
calculator=FourCal()
calculator.setdata(4,2)
print(calculator.add())
print(calculator.div())
print(calculator.sub())
print(calculator.mul())
Char=str(calculator.add())
print(Char)
f=open("/git/test.txt",'w')
data=str(calculator.mul())
f.write(data)
f.close()
| class Fourcal:
def setdata(self, first, second):
self.first = first
self.second = second
def add(self):
result = self.first + self.second
return result
def mul(self):
result = self.first * self.second
return result
def sub(self):
result = self.first - self.second
return result
def div(self):
result = self.first / self.second
return result
print('/////////////////')
calculator = four_cal()
calculator.setdata(4, 2)
print(calculator.add())
print(calculator.div())
print(calculator.sub())
print(calculator.mul())
char = str(calculator.add())
print(Char)
f = open('/git/test.txt', 'w')
data = str(calculator.mul())
f.write(data)
f.close() |
# pyre-ignore-all-errors
# TODO: Change `pyre-ignore-all-errors` to `pyre-strict` on line 1, so we get
# to see all type errors in this file.
# TypeVars can also take a "bound" argument. Suppose we have a class hierachy like this:
class Pet:
name: str
def __init__(self, name: str) -> None:
self.name = name
class Dog(Pet):
pass
class Cat(Pet):
pass
# And we have a function that is supposed to operate on any subclasses of Pet:
def make_cute(pet):
original_name = pet.name
new_name = f"Cute {original_name}"
pet.name = new_name
return pet
# It's apparent that the function has the same parameter and return type, so we
# might want to use a type var.
# TODO: Try annotating the function above with a simple typevar and see what
# happens -- why do you think the type checker complains?
# TODO: Now, add a "bound" argument to your typevar like this:
# T = TypeVar("T", bound=Pet)
# This basically tells the type checker that within the function body, T is
# guaranteed to be a subclass of Pet, which makes it possible for us to access
# its `name` field within the function. Try invoking the function with an int
# or string and see what happens!
# Such trick is often useful, for example, when you use the builder pattern.
def verify_dog(dog: Dog) -> None:
...
def verify_cat(cat: Cat) -> None:
...
def test() -> None:
verify_dog(make_cute(Dog("Fido")))
verify_cat(make_cute(Dog("Fido")))
| class Pet:
name: str
def __init__(self, name: str) -> None:
self.name = name
class Dog(Pet):
pass
class Cat(Pet):
pass
def make_cute(pet):
original_name = pet.name
new_name = f'Cute {original_name}'
pet.name = new_name
return pet
def verify_dog(dog: Dog) -> None:
...
def verify_cat(cat: Cat) -> None:
...
def test() -> None:
verify_dog(make_cute(dog('Fido')))
verify_cat(make_cute(dog('Fido'))) |
def part_1():
file = open('input.txt', 'r')
highest_id = 0
for lineWithOptionNewLine in file:
line = lineWithOptionNewLine.strip('\n')
left = 0
right = 127
for letter in line[:-3]:
mid = (left + right) // 2
if letter == "F":
right = mid
else:
left = mid + 1
row = left
left = 0
right = 7
for letter in line[-3:]:
mid = (left + right) // 2
if letter == "L":
right = mid
else:
left = mid + 1
col = left
id = row * 8 + col
highest_id = max(highest_id, id)
return highest_id
print(part_1()) | def part_1():
file = open('input.txt', 'r')
highest_id = 0
for line_with_option_new_line in file:
line = lineWithOptionNewLine.strip('\n')
left = 0
right = 127
for letter in line[:-3]:
mid = (left + right) // 2
if letter == 'F':
right = mid
else:
left = mid + 1
row = left
left = 0
right = 7
for letter in line[-3:]:
mid = (left + right) // 2
if letter == 'L':
right = mid
else:
left = mid + 1
col = left
id = row * 8 + col
highest_id = max(highest_id, id)
return highest_id
print(part_1()) |
fac_no_faction = 0
fac_commoners = 1
fac_outlaws = 2
fac_neutral = 3
fac_player_faction = 4
fac_player_supporters_faction = 5
fac_britain = 6
fac_france = 7
fac_prussia = 8
fac_russia = 9
fac_austria = 10
fac_kingdoms_end = 11
fac_kingdom_6 = 12
fac_kingdom_7 = 13
fac_kingdom_8 = 14
fac_kingdom_9 = 15
fac_kingdom_10 = 16
fac_british_ranks = 17
fac_french_ranks = 18
fac_prussian_ranks = 19
fac_russian_ranks = 20
fac_austrian_ranks = 21
| fac_no_faction = 0
fac_commoners = 1
fac_outlaws = 2
fac_neutral = 3
fac_player_faction = 4
fac_player_supporters_faction = 5
fac_britain = 6
fac_france = 7
fac_prussia = 8
fac_russia = 9
fac_austria = 10
fac_kingdoms_end = 11
fac_kingdom_6 = 12
fac_kingdom_7 = 13
fac_kingdom_8 = 14
fac_kingdom_9 = 15
fac_kingdom_10 = 16
fac_british_ranks = 17
fac_french_ranks = 18
fac_prussian_ranks = 19
fac_russian_ranks = 20
fac_austrian_ranks = 21 |
# -*- coding: utf-8 -*-
def main():
one = plus(2,3)
print("Hello Python!:"&str(one))
def plus(x,y):
return x+y
if __name__ == "__main__":
main()
| def main():
one = plus(2, 3)
print('Hello Python!:' & str(one))
def plus(x, y):
return x + y
if __name__ == '__main__':
main() |
pkgname = "evince"
pkgver = "42.1"
pkgrel = 0
build_style = "meson"
# dvi needs kpathsea, which is in texlive
# does anyone actually need dvi?
configure_args = [
"-Dintrospection=true", "-Dgtk_doc=false",
"-Dcomics=enabled", "-Dps=enabled", "-Ddvi=disabled",
]
hostmakedepends = [
"meson", "pkgconf", "gobject-introspection", "glib-devel", "itstool",
"gettext-tiny", "perl-xml-parser", "adwaita-icon-theme",
]
makedepends = [
"gtk+3-devel", "libglib-devel", "libhandy-devel", "nautilus-devel",
"dbus-devel", "libsecret-devel", "gstreamer-devel", "libspectre-devel",
"libarchive-devel", "libpoppler-glib-devel", "gst-plugins-base-devel",
"gsettings-desktop-schemas-devel", "libtiff-devel", "libgxps-devel",
"gspell-devel", "djvulibre-devel", "adwaita-icon-theme",
]
depends = ["hicolor-icon-theme"]
pkgdesc = "GNOME document viewer"
maintainer = "q66 <q66@chimera-linux.org>"
license = "GPL-2.0-or-later"
url = "https://wiki.gnome.org/Apps/Evince"
source = f"$(GNOME_SITE)/{pkgname}/{pkgver[:-2]}/{pkgname}-{pkgver}.tar.xz"
sha256 = "b24767bb3d5103b4e35b0e15cf033dbe2488f88700cdd882d22a43adeec2e80a"
@subpackage("evince-libs")
def _libs(self):
return self.default_libs()
@subpackage("evince-devel")
def _devel(self):
return self.default_devel()
| pkgname = 'evince'
pkgver = '42.1'
pkgrel = 0
build_style = 'meson'
configure_args = ['-Dintrospection=true', '-Dgtk_doc=false', '-Dcomics=enabled', '-Dps=enabled', '-Ddvi=disabled']
hostmakedepends = ['meson', 'pkgconf', 'gobject-introspection', 'glib-devel', 'itstool', 'gettext-tiny', 'perl-xml-parser', 'adwaita-icon-theme']
makedepends = ['gtk+3-devel', 'libglib-devel', 'libhandy-devel', 'nautilus-devel', 'dbus-devel', 'libsecret-devel', 'gstreamer-devel', 'libspectre-devel', 'libarchive-devel', 'libpoppler-glib-devel', 'gst-plugins-base-devel', 'gsettings-desktop-schemas-devel', 'libtiff-devel', 'libgxps-devel', 'gspell-devel', 'djvulibre-devel', 'adwaita-icon-theme']
depends = ['hicolor-icon-theme']
pkgdesc = 'GNOME document viewer'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'GPL-2.0-or-later'
url = 'https://wiki.gnome.org/Apps/Evince'
source = f'$(GNOME_SITE)/{pkgname}/{pkgver[:-2]}/{pkgname}-{pkgver}.tar.xz'
sha256 = 'b24767bb3d5103b4e35b0e15cf033dbe2488f88700cdd882d22a43adeec2e80a'
@subpackage('evince-libs')
def _libs(self):
return self.default_libs()
@subpackage('evince-devel')
def _devel(self):
return self.default_devel() |
def gcd(a, b):
if (b == 0):
return a
else:
return gcd(b, a%b)
T = input('')
for _ in xrange(T):
b,a = map(int, raw_input('').split())
print(gcd(a, b))
| def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
t = input('')
for _ in xrange(T):
(b, a) = map(int, raw_input('').split())
print(gcd(a, b)) |
# -*- coding: utf-8 -*-
#
# Copyright 2019 SoloKeys Developers
#
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distributed except according to those terms.
def to_websafe(data):
data = data.replace("+", "-")
data = data.replace("/", "_")
data = data.replace("=", "")
return data
def from_websafe(data):
data = data.replace("-", "+")
data = data.replace("_", "/")
return data + "=="[: (3 * len(data)) % 4]
| def to_websafe(data):
data = data.replace('+', '-')
data = data.replace('/', '_')
data = data.replace('=', '')
return data
def from_websafe(data):
data = data.replace('-', '+')
data = data.replace('_', '/')
return data + '=='[:3 * len(data) % 4] |
def numberOfSubarrays(nums, k: int):
odd_indices = []
for idx, x in enumerate(nums):
if x % 2 == 1:
odd_indices.append(idx)
count_over_odds = 0
for start in range(len(odd_indices) - k + 1):
valid_slice = odd_indices[start: start + k]
count = 1
head = 1
tail = 1
if start != 0:
head = odd_indices[start] - odd_indices[start - 1]
else:
head += odd_indices[0]
if start + k != len(odd_indices):
tail = odd_indices[start + k] - odd_indices[start + k - 1]
else:
tail += (len(nums) - odd_indices[-1] - 1)
count *= head
count *= tail
count_over_odds += count
return count_over_odds
if __name__ == "__main__":
print(numberOfSubarrays([45627,50891,94884,11286,35337,46414,62029,20247,72789,89158,54203,79628,25920,16832,47469,80909], 1))
| def number_of_subarrays(nums, k: int):
odd_indices = []
for (idx, x) in enumerate(nums):
if x % 2 == 1:
odd_indices.append(idx)
count_over_odds = 0
for start in range(len(odd_indices) - k + 1):
valid_slice = odd_indices[start:start + k]
count = 1
head = 1
tail = 1
if start != 0:
head = odd_indices[start] - odd_indices[start - 1]
else:
head += odd_indices[0]
if start + k != len(odd_indices):
tail = odd_indices[start + k] - odd_indices[start + k - 1]
else:
tail += len(nums) - odd_indices[-1] - 1
count *= head
count *= tail
count_over_odds += count
return count_over_odds
if __name__ == '__main__':
print(number_of_subarrays([45627, 50891, 94884, 11286, 35337, 46414, 62029, 20247, 72789, 89158, 54203, 79628, 25920, 16832, 47469, 80909], 1)) |
#Question Link <https://leetcode.com/problems/trapping-rain-water/>
class Solution:
def trap(self, height):
left, right = 0, len(height) - 1
ans = left_max = right_max = 0
while left < right:
if height[left] < height[right]:
left_max = max(left_max, height[left])
ans += left_max - height[left]
left += 1
else:
right_max = max(right_max, height[right])
ans += right_max - height[right]
right -= 1
return ans | class Solution:
def trap(self, height):
(left, right) = (0, len(height) - 1)
ans = left_max = right_max = 0
while left < right:
if height[left] < height[right]:
left_max = max(left_max, height[left])
ans += left_max - height[left]
left += 1
else:
right_max = max(right_max, height[right])
ans += right_max - height[right]
right -= 1
return ans |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.