content
stringlengths 7
1.05M
|
|---|
# Execute o programa 4.4 e experimente alguns valores. Verifique se os resultados foram os mesmos do programa 4.2.
# Abaixo cópia do programa 4.4.
idade = int(input('Digite a idade do seu carro: '))
if idade <= 3:
print('O seu carro é novo!')
else:
print('O seu carro é velho!')
|
def diameter_of_binary_tree(root):
return diameter_of_binary_tree_func(root)[1]
def diameter_of_binary_tree_func(root):
"""
Diameter for a particular BinaryTree Node will be:
1. Either diameter of left subtree
2. Or diameter of a right subtree
3. Sum of left-height and right-height
:param root:
:return: [height, diameter]
"""
if root is None:
return 0, 0
left_height, left_diameter = diameter_of_binary_tree_func(root.left)
right_height, right_diameter = diameter_of_binary_tree_func(root.right)
current_height = max(left_height, right_height) + 1
height_diameter = left_height + right_height
current_diameter = max(left_diameter, right_diameter, height_diameter)
return current_height, current_diameter
|
#Aula 12
#Condição Aninhada
nome = str(input('Olá, qual é o seu nome? '))
print ('Seja Bem-Vindo {}!'.format(nome))
nota1 = int(input('{}, Qual foi 1º nota da sua Ac1? '.format(nome)))
nota2 = int(input('E da Ac2? '))
nota3 = int(input('E da Ac3? '))
nota4 = int(input('E da Ac4? '))
resultado = ((nota1 + nota2 + nota3 + nota4) / 4) * 0.5
if resultado >= 4:
print('A soma deu {}, Parabéns {}, você passou no semestre !'.format(resultado, nome))
else:
print('A Soma deu {}, Você foi reprovado {}, estude mais.'.format(resultado, nome))
|
debian_os = ['debian', 'ubuntu']
rhel_os = ['redhat', 'centos']
def test_repo_file(host):
f = None
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/sources.list.d/powerdns-rec-42.list')
if host.system_info.distribution.lower() in rhel_os:
f = host.file('/etc/yum.repos.d/powerdns-rec-42.repo')
assert f.exists
assert f.user == 'root'
assert f.group == 'root'
def test_pdns_repo(host):
f = None
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/sources.list.d/powerdns-rec-42.list')
if host.system_info.distribution.lower() in rhel_os:
f = host.file('/etc/yum.repos.d/powerdns-rec-42.repo')
assert f.exists
assert f.contains('rec-42')
def test_pdns_version(host):
cmd = host.run('/usr/sbin/pdns_recursor --version')
assert 'PowerDNS Recursor' in cmd.stderr
assert '4.2' in cmd.stderr
def systemd_override(host):
fname = '/etc/systemd/system/pdns-recursor.service.d/override.conf'
f = host.file(fname)
assert not f.contains('User=')
assert not f.contains('Group=')
|
class Empty(object):
def __bool__(self):
return False
def __nonzero__(self):
return False
empty = Empty()
|
# -*- coding: utf-8 -*-
"""Provides all the data related to text."""
SAFE_COLORS = [
"#1abc9c",
"#16a085",
"#2ecc71",
"#27ae60",
"#3498db",
"#2980b9",
"#9b59b6",
"#8e44ad",
"#34495e",
"#2c3e50",
"#f1c40f",
"#f39c12",
"#e67e22",
"#d35400",
"#e74c3c",
"#c0392b",
"#ecf0f1",
"#bdc3c7",
"#95a5a6",
"#7f8c8d",
]
|
"""
Pipeline defines all steps required by an algorithm to obtain predictions.
Pipelines are typically a chain of sklearn compatible transformers and end
with an sklearn compatible estimator.
"""
|
# Network parameters
IMAGE_WIDTH = 84
IMAGE_HEIGHT = 84
NUM_CHANNELS = 4 # dqn inputs 4 image at same time as state
|
class MyCircularDeque:
def __init__(self, k: int):
"""
Initialize your data structure here. Set the size of the deque to be k.
"""
self.nums = [0] * k
self.k = k
self.size = 0
self.front = -1
self.back = 0
def insertFront(self, value: int) -> bool:
"""
Adds an item at the front of Deque. Return true if the operation is successful.
"""
if not self.isFull():
self.size += 1
self.front = (self.front + 1) % self.k
self.nums[self.front] = value
return True
else:
return False
def insertLast(self, value: int) -> bool:
"""
Adds an item at the rear of Deque. Return true if the operation is successful.
"""
if not self.isFull():
self.size += 1
self.back -= 1
if self.back < 0:
self.back += self.k
self.nums[self.back] = value
return True
else:
return False
def deleteFront(self) -> bool:
"""
Deletes an item from the front of Deque. Return true if the operation is successful.
"""
if not self.isEmpty():
self.size -= 1
self.front = self.front - 1
if self.front < 0:
self.front += self.k
return True
else:
return False
def deleteLast(self) -> bool:
"""
Deletes an item from the rear of Deque. Return true if the operation is successful.
"""
if not self.isEmpty():
self.size -= 1
self.back = (self.back + 1) % self.k
return True
else:
return False
def getFront(self) -> int:
"""
Get the front item from the deque.
"""
return self.nums[self.front] if not self.isEmpty() else -1
def getRear(self) -> int:
"""
Get the last item from the deque.
"""
return self.nums[self.back] if not self.isEmpty() else -1
def isEmpty(self) -> bool:
"""
Checks whether the circular deque is empty or not.
"""
return not self.size
def isFull(self) -> bool:
"""
Checks whether the circular deque is full or not.
"""
return self.size == self.k
# Your MyCircularDeque object will be instantiated and called as such:
# obj = MyCircularDeque(k)
# param_1 = obj.insertFront(value)
# param_2 = obj.insertLast(value)
# param_3 = obj.deleteFront()
# param_4 = obj.deleteLast()
# param_5 = obj.getFront()
# param_6 = obj.getRear()
# param_7 = obj.isEmpty()
# param_8 = obj.isFull()
|
"""
Name: Josh Hickman
Pawprint: hickmanjv
Assignment: Challenge: Cipher
Date: 04/17/20
"""
# Cipher based on assignment requirements
CIPHER = {'a' : '0', 'b' : '1', 'c' : '2', 'd' : '3', 'e' : '4', 'f' : '5',
'g' : '6', 'h' : '7', 'i' : '8', 'j' : '9', 'k' : '!', 'l' : '@',
'm' : '#', 'n' : '$', 'o' : '%', 'p' : '^', 'q' : '&', 'r' : '*',
's' : '(', 't' : ')', 'u' : '-', 'v' : '+', 'w' : '<', 'x' : '>',
'y' : '?', 'z' : '=', ' ' : ' '}
def encode_message(message):
"""
Function that will take in a string of alphabetic characters
and swap them out for the corresponding character in the
CIPHER dictionary
"""
new_message = ""
# convert the message to a list for character swap
char_list = list(message)
# loop through the list exchanging the value and key of
# the CIPHER dictionary
for char in char_list:
char_list[char_list.index(char)] = CIPHER[char]
# put the message list back into a string
new_message = new_message.join(char_list)
print('Encoded message: ' + new_message)
def decode_message(message):
"""
This function will take in a message of digits and symbols and
convert it back to plain text based on the CIPHER dictionary
"""
new_message = ""
# convert the message to a list for character swap
char_list = list(message)
# Invert the key/value pairs in the CIPHER to make it easier
# to exchange the characters for decoding
inverted_cipher = dict([i, j] for j, i in CIPHER.items())
# loop through the list exchanging the key and value with
# the inverted CIPHER dictionary
for char in char_list:
char_list[char_list.index(char)] = inverted_cipher[char]
# put the message list back into a string
new_message = new_message.join(char_list)
print('Decoded message: ' + new_message)
def main():
"""
This is the main function of the program, it will display a selection menu to
the user and accept proper input to make the CIPHER work properly
"""
# loop variable
option = True
while option:
# Main program selection menu
print('\nWelcome to the Secret Message Encoder/Decoder')
print('1. Encode a message')
print('2. Decode a message')
print('3. Exit')
while True:
# Preventing invalid input from the user
try:
menu_option = int(input('\nWhat would you like to do? ' ))
if menu_option < 1 or menu_option > 3:
raise Exception
break
except ValueError:
print('\nOnly enter a number specified by the selection menu, try again.')
except Exception as e:
print('\nOnly enter a number specified by the selection menu, try again.')
if menu_option == 1:
while True:
# Ensures the user only enters digits or symbols so that the
# inverted CIPHER and decode function will work properly
try:
message = input(str('\nEnter a message to encode: '))
# loop through each character checking, throwing an exception
# if a digit or symbol is found
# Found the use of all() on W3Schools.com for Python
if not all(char.isalpha() or char.isspace() for char in message):
raise Exception
break
except Exception as e:
print('\nPlease enter a message that only has letters to encode.')
encode_message(message.lower())
elif menu_option == 2:
while True:
# Ensures the user only enters digits or symbols so that the
# inverted CIPHER and decode function will work properly
try:
message = input(str('\nEnter a message to decode: '))
# loop through each character checking, throwing an exception
# if an alphabetic character is found
for char in message:
if char.isalpha():
raise Exception
break
break
except Exception as e:
print('\nPlease enter a message that only has numbers and/or symbols to decode.')
decode_message(message)
else:
# else option 3 is the only option that could have been selected based on valid menu input
option = False
# call the main function
main()
|
def parse_input(raw_input):
return [
# strip multiline strings when testing
[line.strip() for line in group.split('\n')]
for group in raw_input.split('\n\n')
]
with open('inputs/input6.txt') as file:
input6 = parse_input(file.read())
def count_any_yeses(groups):
return sum(
len(set(''.join(g)))
for g in groups
)
def count_every_yeses(groups):
return sum(
len(set.intersection(*(set(p) for p in g)))
for g in groups
if g
)
answer1 = count_any_yeses(input6)
answer2 = count_every_yeses(input6)
def test():
raw = '''
abc
a
b
c
ab
ac
a
a
a
a
b
'''
sample = parse_input(raw)
assert count_any_yeses(sample) == 11
assert count_every_yeses(sample) == 6
|
game_name = input("The name of the game:")
num_timesteps = input("The num of timesteps:")
total_gpu_num = 3
gpu_use_index = 0
print('conda activate openaivezen; cd baselines; ' +
'CUDA_VISIBLE_DEVICES={} '.format(gpu_use_index) +
'python -m baselines.run --alg=deepq ' +
'--env={}NoFrameskip-v4 --num_timesteps={} '.format(game_name, num_timesteps) +
'--save_path=models/{}_{}/{}{} '.format(game_name, num_timesteps, 'baseline', '') +
'--log_path=logs/{}_{}/{}{} '.format(game_name, num_timesteps, 'baseline', '') +
'--print_freq=1 ' +
'--dpsr_replay=False ' +
'--prioritized_replay=False ' +
'--state_recycle_freq=10000 ' +
'--dpsr_replay_candidates_size=32')
gpu_use_index = (gpu_use_index + 1) % total_gpu_num
print('conda activate openaivezen; cd baselines; ' +
'CUDA_VISIBLE_DEVICES={} '.format(gpu_use_index) +
'python -m baselines.run --alg=deepq ' +
'--env={}NoFrameskip-v4 --num_timesteps={} '.format(game_name, num_timesteps) +
'--save_path=models/{}_{}/{}{} '.format(game_name, num_timesteps, 'prio', '') +
'--log_path=logs/{}_{}/{}{} '.format(game_name, num_timesteps, 'prio', '') +
'--print_freq=1 ' +
'--dpsr_replay=False ' +
'--prioritized_replay=True ' +
'--state_recycle_freq=10000 ' +
'--dpsr_replay_candidates_size=32')
gpu_use_index = (gpu_use_index + 1) % total_gpu_num
print('conda activate openaivezen; cd baselines; ' +
'CUDA_VISIBLE_DEVICES={} '.format(gpu_use_index) +
'python -m baselines.run --alg=deepq ' +
'--env={}NoFrameskip-v4 --num_timesteps={} '.format(game_name, num_timesteps) +
'--save_path=models/{}_{}/{} '.format(game_name, num_timesteps, 'dpsr0') +
'--log_path=logs/{}_{}/{} '.format(game_name, num_timesteps, 'dpsr0') +
'--print_freq=1 ' +
'--dpsr_replay=True ' +
'--prioritized_replay=False ' +
'--state_recycle_freq=0 ' +
'--dpsr_replay_candidates_size=32')
gpu_use_index = (gpu_use_index + 1) % total_gpu_num
recycle_freq_list = [500, 1000, 1500, 2000, 2500]
cand_size_list = [8, 16, 32, 64, 128]
state_recycle_max_priority_set_list = [True, False]
# 5 * 5 * 2 = 50
for recycle_freq in recycle_freq_list:
for cand_size in cand_size_list:
for state_recycle_max_priority_set in state_recycle_max_priority_set_list:
print(
# 'conda activate openaivezen; cd baselines; ' +
'CUDA_VISIBLE_DEVICES={} '.format(gpu_use_index) +
'python -m baselines.run --alg=deepq ' +
'--env={}NoFrameskip-v4 --num_timesteps={} '.format(game_name, num_timesteps) +
'--save_path=models/{}_{}/dpsr{}_{}cand_MAX_prio_set_{} '.format(game_name,
num_timesteps,
recycle_freq,
cand_size,
state_recycle_max_priority_set) +
'--log_path=logs/{}_{}/dpsr{}_{}cand_MAX_prio_set_{} '.format(game_name,
num_timesteps,
recycle_freq,
cand_size,
state_recycle_max_priority_set) +
'--print_freq=1 ' +
'--dpsr_replay=False ' +
'--prioritized_replay=True ' +
'--state_recycle_freq={} '.format(recycle_freq) +
'--dpsr_replay_candidates_size={} '.format(cand_size) +
'--dpsr_state_recycle_max_priority_set={}'.format(state_recycle_max_priority_set))
gpu_use_index = (gpu_use_index + 1) % total_gpu_num
|
# Crie um programa que leia o nome e o preço de vários produtos. O programa devera perguntar
# se o utilizador vai continuar. No final, mostre:
#
# a) Qual é o total gasto na compra
# b) Quantos produtos custam mais de 1000 reais
# c) Qual é o nome do produto mais barato
nome_barato = ' '
cont_produtos = preço_barato = total = quant_1000 = 0
while True:
produto = str(input('Nome do produto: '))
preço = float(input('preço do produto: R$ '))
total += preço
cont_produtos += 1
if preço > 1000:
quant_1000 += 1
if cont_produtos == 1 or preço < preço_barato:
nome_barato = produto
preço_barato = preço
resposta = ' '
while resposta not in 'SN':
resposta = str(input('Quer continuar (S/N): ')).strip().upper()
if resposta == 'N':
break
print('========= FIM DAS COMPRAS ===========')
print(f'Total gasto: {total}')
print(f'Produtos que custam mais de R$ 1000,00: {quant_1000} produtos')
print(f'O roduto mais barato foi: {nome_barato}')
|
print(" Calculator \n")
print(" ")
num1 = float(input("Please enter your first number: "))
op = input("Please enter your operator(+ or - or / or *): ")
num2 = float(input("Please enter your second number: "))
if op == "+":
print(num1 + num2)
elif op == "-":
print(num1 - num2)
elif op == "/":
print(num1 / num2)
elif op == "*":
print(num1*num2)
else:
print("Invalid expression. Read instructions carefully.")
|
class PrimesBelow:
def __init__(self, bound):
self.candidate_numbers = list(range(2,bound))
def __iter__(self):
return self
def __next__(self):
if len(self.candidate_numbers) == 0:
raise StopIteration
next_prime = self.candidate_numbers[0]
self.candidate_numbers = [x for x in self.candidate_numbers if x % next_prime != 0]
return next_prime
|
# -*- coding: utf-8 -*-
def Mag_V_L(I, RL, Ro, w, C):
return I * (1/(1/RL + 1/Ro)) / (1 + (w * (1/(1/RL + 1/Ro)) * C)**2)**.5
def Mag_I_L(I, RL, Ro, w, C):
I_L = 1 / RL * I / (1 / Ro + 1 / RL + 1j * w * C)
return abs(I_L)
def Z_o_from_VLa_VLb(RLa, RLb, VLa, VLb):
Z_o = (RLa * RLb * (VLb - VLa)) / (VLa * RLb - VLb * RLa)
return Z_o
def Z_o_from_ILa_ILb(RLa, RLb, ILa, ILb):
if abs(ILa - ILb) < 1E-12:
return float("nan")
Z_o = (ILb * RLb - ILa * RLa) / (ILa - ILb)
return Z_o
|
# Sage version information for Python scripts
# This file is auto-generated by the sage-update-version script, do not edit!
version = '9.6.beta6'
date = '2022-03-27'
banner = 'SageMath version 9.6.beta6, Release Date: 2022-03-27'
|
w_dic = {'example': 'eg', 'Example': 'eg', 'important': 'imp', 'Important': 'Imp',
'mathematics': 'math', 'Mathematics': 'Math', 'algorithm': 'algo',
'Algorithm': 'Algo', 'frequency': 'freq', 'Frequency': 'Freq', 'input': 'i/p',
'Input': 'i/p', 'output': 'o/p', 'Output': 'o/p', 'software': 's/w', 'Software': 's/w',
'hardware': 'h/w', 'Hardware': 'h/w', 'network': 'n/w', 'Network': 'n/w', 'machine learning': 'ML',
'machine Learning': 'ML', 'Machine learning': 'ML', 'Machine Learning': 'ML', 'Data Mining': 'DM',
'Data mining': 'DM', 'data Mining': 'DM', 'data mining': 'DM', 'database': 'DB', 'Database': 'DB',
'management': 'mgmt', 'Management': 'mgmt', 'Artificial Intelligence': 'AI', 'artificial Intelligence': 'AI',
'Artificial intelligence': 'AI', 'artificial intelligence': 'AI', 'laptop': 'LP', 'Computer Science': 'CS'}
def shortF(text):
def replace_all(text, dic):
for i, j in dic.items():
text = text.replace(i, j)
print (text)
return text
text = replace_all(text, w_dic)
# print result
return text
|
# -*- coding: utf-8 -*-
"""
meraki_sdk
This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ).
"""
class UpdateOrganizationBrandingPoliciesPrioritiesModel(object):
"""Implementation of the 'updateOrganizationBrandingPoliciesPriorities' model.
TODO: type model description here.
Attributes:
branding_policy_ids (list of string): A list of branding policy IDs
arranged in ascending priority order (IDs later in the array have
higher priority).
"""
# Create a mapping from Model property names to API property names
_names = {
"branding_policy_ids":'brandingPolicyIds'
}
def __init__(self,
branding_policy_ids=None):
"""Constructor for the UpdateOrganizationBrandingPoliciesPrioritiesModel class"""
# Initialize members of the class
self.branding_policy_ids = branding_policy_ids
@classmethod
def from_dictionary(cls,
dictionary):
"""Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
object: An instance of this structure class.
"""
if dictionary is None:
return None
# Extract variables from the dictionary
branding_policy_ids = dictionary.get('brandingPolicyIds')
# Return an object of this model
return cls(branding_policy_ids)
|
class Edge:
def __init__(self, dest, capa):
self.dest = dest
self.capa = capa
self.rmng = capa
class Node:
def __init__(self, name, level=0, edges=None):
self.name = name
self.level = level
if edges is None:
self.edges = []
def add_edge(self, dest, weight):
self.edges.append(Edge(dest, weight))
def get_children(self):
res = []
for edge in self.edges:
res.append(edge.dest)
return res
def __str__(self):
res = str(self.name) + " ({})".format(str(self.level))
for edge in self.edges:
res = res + " --> {} ({})".format(str(edge.dest), str(edge.rmng))
return res
class Graph:
nodes = []
flow = []
perma_dead = []
levels = []
def __init__(self, entrances, exits, matrix):
self.entrances = entrances
self.exits = exits
self.matrix = matrix
for i in range(0, len(self.matrix)):
self.nodes.append(Node(i))
def create(self):
for i in range(0, len(self.matrix)):
if self.nodes[i].name in self.exits:
continue
for j in range(0, len(self.matrix[i])):
if self.matrix[i][j] != 0:
self.nodes[i].add_edge(j, self.matrix[i][j])
def bfs(self):
queue = self.entrances[:]
seen = self.entrances[:]
level = 0
self.levels = [-1] * len(self.matrix)
for entrance in self.entrances:
self.nodes[entrance].level = level
self.levels[entrance] = level
while len(queue) > 0:
to_remove = []
i = queue.pop(0)
level = self.nodes[i].level + 1
for edge in self.nodes[i].edges:
if edge.dest in self.perma_dead:
to_remove.append(edge)
elif edge.rmng > 0:
if edge.dest not in seen:
self.nodes[edge.dest].level = self.levels[edge.dest] = level
queue.append(edge.dest)
seen.append(edge.dest)
else:
to_remove.append(edge)
for edge in to_remove:
self.nodes[i].edges.remove(edge)
if self.is_finished():
return False
return True
def is_finished(self):
for ex in self.exits:
if self.levels[ex] != -1:
return False
return True
def choose_next_node(self, candidates, dead_ends):
for i in candidates:
previous_level = self.nodes[i].level
for edge in self.nodes[i].edges:
if (edge.rmng > 0) \
and (previous_level < self.nodes[edge.dest].level)\
and (edge.dest not in dead_ends):
return i, edge, edge.rmng
return None, None, None
def dfs(self):
paths, capas, edges = [], [], []
dead_ends = self.perma_dead[:]
entr = self.entrances[:]
current_node, edge, capa = self.choose_next_node(entr, dead_ends)
next_node = None
if edge is not None:
next_node = edge.dest
edges.append(edge)
paths.append(current_node)
if next_node in self.exits:
paths.append(next_node)
capas.append(capa)
else:
return
while next_node not in self.exits and len(paths) > 0:
if next_node != paths[-1]:
paths.append(next_node)
capas.append(capa)
current_node, edge, capa = self.choose_next_node([next_node], dead_ends)
if edge is not None:
next_node = edge.dest
edges.append(edge)
if next_node in self.exits:
paths.append(next_node)
capas.append(capa)
else:
if len(paths) > 1:
dead_ends.append(paths[-1])
paths, edges, capas = paths[:-1], edges[:-1], capas[:-1]
next_node = paths[-1]
else:
entr.remove(paths[0])
paths, capas = [], []
current_node, edge, capa = self.choose_next_node(entr, dead_ends)
next_node = None
if edge is not None:
next_node = edge.dest
edges.append(edge)
paths.append(current_node)
if next_node in self.exits:
paths.append(next_node)
capas.append(capa)
else:
return
if len(paths) < 1:
return False
capa = min(capas)
self.flow.append(capa)
i = 0
for edge in edges:
edge.rmng -= capa
if not edge.rmng:
self.nodes[paths[i]].edges.remove(edge)
if len(self.nodes[paths[i]].edges) < 1:
self.perma_dead.append(self.nodes[paths[i]].name)
i += 1
return False
def solution(entrances, exits, matrix):
graph = Graph(entrances, exits, matrix)
graph.create()
while graph.bfs():
graph.dfs()
return sum(graph.flow)
entrances = [0, 1]
exits = [4, 5]
path = [
[0, 0, 4, 6, 0, 0], # Room 0: Bunnies
[0, 0, 5, 2, 0, 0], # Room 1: Bunnies
[0, 0, 0, 0, 4, 4], # Room 2: Intermediate room
[0, 0, 0, 0, 6, 6], # Room 3: Intermediate room
[0, 0, 0, 0, 0, 0], # Room 4: Escape pods
[0, 0, 0, 0, 0, 0], # Room 5: Escape pods
]
print(solution(entrances, exits, path))
|
def insertion_sort(lst):
"""Returns a sorted array.
A provided list will be sorted out of place. Returns a new list sorted smallest to largest."""
for i in range (1, len(lst)):
current_idx = i
temp_vlaue = lst[i]
while current_idx > 0 and lst[current_idx - 1] > temp_vlaue:
lst[current_idx] = lst[current_idx - 1]
current_idx = current_idx - 1
lst[current_idx] = temp_vlaue
return lst
|
src = Split('''
cli.c
dumpsys.c
''')
component = aos_component('cli', src)
component.add_component_dependencis('kernel/hal')
component.add_global_macro('HAVE_NOT_ADVANCED_FORMATE')
component.add_global_macro('CONFIG_AOS_CLI')
component.add_global_includes('include')
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 16 10:32:58 2019
@author: allen
"""
|
# USITTAsciiParser
#
# by Claude Heintz
# copyright 2014 by Claude Heintz Design
#
# see license included with this distribution or
# https://www.claudeheintzdesign.com/lx/opensource.html
##### This is an abstract class for parsing strings to extract
# data formatted as specified in:
#
# ASCII Text Representation for Lighting Console Data
# http://old.usitt.org/documents/nf/a03asciitextreps.pdf
######
class USITTAsciiParser:
END_DATA = -1
NO_PRIMARY = 0
CUE_COLLECT = 1
GROUP_COLLECT = 2
SUB_COLLECT = 3
MFG_COLLECT = 5
def __init__(self):
self.line = 0
self.state = USITTAsciiParser.NO_PRIMARY
self.startedLine = False
self.tokens = []
self.cstring = ""
self.message = ""
self.console = None
self.manufacturer = None
self.cue = None
self.part = None
self.group = None
self.sub = None
self.cuepage = None
self.grouppage = None
self.subpage = None
self.console = None
self.manufacturer = None
##### processString(string) parses the string passed to it character by character
# it returns True unless there is an error in the string
# for the most part, exceptions are noted and ignored
# printing the .message after calling parseString will list any exceptions
#
# As the string is read and data is extracted, there are a number of
# implementation specific methods that are called. A subclass should override
# these methods and do something with the data. For instance, as individual channel
# levels are extracted, doChannelForCue(self, cue, page, channel, level) is called.
# An implementing subclass would override this method to set channel@level in cue.
#
##### look at the bottom of the file for all the methods that can be overridden
def processString(self, s):
valid = True
for i in range(len(s)):
self.processCharacter(s[i])
if not valid or self.state == USITTAsciiParser.END_DATA:
break
if self.startedLine:
self.addTokenWithCurrentString()
self.processLine()
if valid and self.state != USITTAsciiParser.END_DATA:
self.addMessage("ER 0100 unexpected termination: ENDDATA missing")
valid = self.finishUnfinished()
else:
self.addMessage("0000 processing complete")
if valid:
self.doFinalCleanup()
return valid;
##### processCharacter takes a character and determines if it ends the current line.
# If so, the entire line is processed.
# Otherwise, the character is added to the current string unless
# it is a delimiter, in which case, the current string is added to the tokens list
##### A '!' character puts processing in comment mode until the end of the line is reached
def processCharacter(self, c):
# check to see if the character is a line termination character
if c == '\n' or c == '\r':
if not ( len(self.cstring) == 0 and len(self.tokens) == 0 ):
if not ( self.cstring == "!" or len(self.cstring) == 0 ):
self.addTokenWithCurrentString()
if self.processLine():
self.endLine()
else:
return False
elif not self.cstring == "!":
if c == '\t' or ( ord(c) > 31 and ord(c) <127 ):
if self.isDelimiter(c):
if not ( self.cstring == "!" or len(self.cstring) == 0 ):
self.addTokenWithCurrentString()
else:
if c == "!":
self.cstring = c
else:
self.cstring += c
if not self.startedLine:
self.beginLine()
else:
self.addMessage("Invalid Character (ignored)")
return True
##### addTokenWithCurrentString() self.tokens is a list of small strings that
# that make up the current line. each token is separated by one or more
# of the delimiter characters defined in
# ASCII Text Representation for Lighting Console Data 5.4, page 13
#####
def addTokenWithCurrentString(self):
self.tokens.append(self.cstring)
self.cstring = ""
##### beginLine is called when the first non-delimiter character
# of a line is encountered
#####
def beginLine(self):
self.startedLine = True
self.line += 1
##### endLine resets the current string and tokens list
#
#####
def endLine(self):
self.cstring = ""
self.tokens = []
self.startedLine = False
self.finishProcessingLine()
##### finishProcessingLine (for override if needed)
def finishProcessingLine(self):
test = True
##### finishUnfinished (for override if needed)
def finishUnfinished(self):
test = True
##### doFinalCleanup (for override if needed)
def doFinalCleanup(self):
test = True
##### processLine takes a complete line and calls the appropriate keyword function
# processLine returns True as long as there is no error to stop processing
#####
def processLine(self):
if len(self.tokens) > 0:
keyword = self.tokens[0]
# check for manufacturer specific keywords
if keyword.startswith("$"):
if keyword.startswith("$$"):
if self.recognizedMfgBasic(keyword):
return self.keywordMfgBasic(keyword)
else:
return self.keywordMfgPrimary(keyword)
#keywords are limited to 10 characters
if len(keyword) > 10:
keyword = keyword[0:10]
if keyword.lower() == "clear":
return self.keywordClear()
if keyword.lower() == "console":
return self.keywordConsole()
if keyword.lower() == "enddata":
self.state = USITTAsciiParser.END_DATA
return True
if keyword.lower() == "ident":
return self.keywordIdent()
if keyword.lower() == "manufactur":
return self.keywordManufacturer()
if keyword.lower() == "patch":
return self.keywordPatch()
if keyword.lower() == "set":
return self.keywordSet()
if keyword.lower() == "cue":
return self.keywordCue()
if keyword.lower() == "group":
return self.keywordGroup()
if keyword.lower() == "sub":
return self.keywordSub()
if self.state > USITTAsciiParser.MFG_COLLECT -1:
return self.keywordMfgSecondary(keyword)
if self.state == USITTAsciiParser.CUE_COLLECT:
return self.keywordCueSecondary(keyword)
if self.state == USITTAsciiParser.GROUP_COLLECT:
return self.keywordGroupSecondary(keyword)
if self.state == USITTAsciiParser.SUB_COLLECT:
return self.keywordSubSecondary(keyword)
return True #any other keyword is simply ignored
##### addMessage is used to report exceptions that may change how the ASCII
# data is interpreted, but not necessarily enough to stop processing.
# After processString has been called the message can be read
#####
def addMessage(self, message):
self.message = self.message +"Line " + str(self.line) + ": " + message + "\n"
def tokenStringForText(self, delimiter=" "):
tc = len(self.tokens)
if tc > 1:
ti = 1;
rs = self.tokens[ti];
ti += 1
while ti < tc:
rs = rs + delimiter + self.tokens[ti];
ti += 1
return rs
return None
##### process keyword functions
# each of these functions is called in response to a specific keyword
# keywords are found at the beginning of a line ie. self.tokens[0]
# each keyword function should return True if there are no errors
# These functions set the parse state and various other values.
#
# To implement the functionality of these keywords, override the
# corresponding "do" function
#####
def keywordClear(self):
if len(self.tokens) == 2:
return self.doClearItem(self.tokens[1], "")
if len(self.tokens) == 3:
return self.doClearItem(self.tokens[1], self.tokens[2])
self.addMessage("bad CLEAR (ignored)")
return True
def keywordConsole(self):
if len(self.tokens) == 2:
self.console = self.tokens[1]
return True
self.addMessage("bad CONSOLE(ignored)")
return True
def keywordIdent(self):
if len(self.tokens) == 2:
if self.tokens[1] == "3:0":
return True
if self.tokens[1] == "3.0":
return True
return False
def keywordManufacturer(self):
if len(self.tokens) == 2:
self.manufacturer = self.tokens[1]
return True
self.addMessage("bad MANUFACTUR (ignored)")
return True
def keywordPatch(self):
tc = len(self.tokens)
if tc > 4:
rs = 5;
valid = True
while valid and tc >= rs:
valid = self.doPatch(self.tokens[1], self.tokens[rs-3], self.tokens[rs-2], self.tokens[rs-1])
rs += 3
if valid:
return True
self.addMessage("bad PATCH (ignored)")
return True
def keywordSet(self):
if len(self.tokens) == 3:
self.doSet(self.tokens[1], self.tokens[2])
return True
self.addMessage("bad SET (ignored)")
return True
def keywordCue(self):
self.state = USITTAsciiParser.CUE_COLLECT
self.part = None
if len(self.tokens) == 2:
self.cue = self.tokens[1]
self.cuepage = ""
return True
if len(self.tokens) == 3:
self.cue = self.tokens[1]
self.cuepage = self.tokens[2]
return True
self.cue = None
self.cuepage = None
self.addMessage("bad CUE (ignored)")
return True
def keywordGroup(self):
self.state = USITTAsciiParser.GROUP_COLLECT
self.part = None
if len(self.tokens) == 2:
self.group = self.tokens[1]
self.grouppage = ""
return True
if len(self.tokens) == 3:
self.group = self.tokens[1]
self.grouppage = self.tokens[2]
return True
self.group = None
self.grouppage = None
self.addMessage("bad GROUP (ignored)")
return True
def keywordSub(self):
self.state = USITTAsciiParser.SUB_COLLECT
self.part = None
if len(self.tokens) == 2:
self.sub = self.tokens[1]
self.subpage = ""
return True
if len(self.tokens) == 3:
self.sub = self.tokens[1]
self.subpage = self.tokens[2]
return True
self.sub = None
self.subpage = None
self.addMessage("bad SUB (ignored)")
return True
def keywordMfgBasic(self, keyword):
return True;
def keywordMfgPrimary(self, keyword):
self.state = USITTAsciiParser.MFG_COLLECT
if self.recognizedMfgPrimary(keyword):
return self.doMfgPrimary(keyword)
return True;
def keywordMfgSecondary(self, keyword):
if self.recognizedMfgSecondary(keyword):
return self.doMfgSecondary(keyword)
return True;
##### secondary keywords are similar to primary keywords
# when cue, group or sub primary keywords are encountered
# the state is set so that secondary keywords modify
# the current cue, group or sub
#####
def keywordCueSecondary(self, keyword):
if self.cue != None and self.cue != "" and len(self.tokens) > 1:
if keyword.startswith("$$"):
return self.keywordMfgForCue(keyword)
if keyword.lower() == "chan":
return self.keywordChannelForCue()
if keyword.lower() == "down":
return self.keywordDownForCue()
if keyword.lower() == "followon":
return self.keywordFollowonForCue()
if keyword.lower() == "link":
return self.keywordLinkForCue()
if keyword.lower() == "part":
return self.keywordPartForCue()
if keyword.lower() == "text":
return self.keywordTextForCue()
if keyword.lower() == "up":
return self.keywordUpForCue()
self.addMessage("(ignored) unknown or out of place " + keyword )
return True
def keywordGroupSecondary(self, keyword):
if self.group != None and self.group != "" and len(self.tokens) > 1:
if keyword.startswith("$$"):
return self.keywordMfgForGroup(keyword)
if keyword.lower() == "chan":
return self.keywordChannelForGroup()
if keyword.lower() == "part":
return self.keywordPartForGroup()
if keyword.lower() == "text":
return self.keywordTextForGroup()
return True
def keywordSubSecondary(self, keyword):
if self.sub != None and self.sub != "" and len(self.tokens) > 1:
if keyword.startswith("$$"):
return self.keywordMfgForGroup(keyword)
if keyword.lower() == "chan":
return self.keywordChannelForSub()
if keyword.lower() == "down":
return self.keywordDownForSub()
if keyword.lower() == "text":
return self.keywordTextForSub()
if keyword.lower() == "up":
return self.keywordUpForCue()
return True
##### handle each specific secondary keyword
# these methods check that the number of tokens is correct for the keyword
# and then pass them along to a specific "do" method.
# All "do" methods are meant to be overridden by an implementing subclass
##### cue keywords
def keywordChannelForCue(self):
lt = len(self.tokens)
v = True
rs = 3
while v and rs <= lt:
v = self.doChannelForCue(self.cue, self.cuepage, self.tokens[rs-2], self.tokens[rs-1])
rs += 2
if v:
return True
self.addMessage("bad CHAN (ignored)")
return True
def keywordDownForCue(self):
if len(self.tokens) == 2:
self.doDownForCue(self.cue, self.cuepage, self.tokens[1], "0")
return True
if len(self.tokens) == 3:
self.doDownForCue(self.cue, self.cuepage, self.tokens[1], self.tokens[2])
return True
self.addMessage("bad DOWN (ignored)")
return True
def keywordFollowonForCue(self):
if len(self.tokens) == 2:
self.doFollowonForCue(self.cue, self.cuepage, self.tokens[1])
return True
self.addMessage("bad FOLLOWON (ignored)")
return True
def keywordlinkForCue(self):
if len(self.tokens) == 2:
self.doLinkForCue(self.cue, self.cuepage, self.tokens[1])
return True
self.addMessage("bad LINK (ignored)")
return True
def keywordPartForCue(self):
if len(self.tokens) == 2:
self.doPartForCue(self.cue, self.cuepage, self.tokens[1])
return True
self.addMessage("bad PART (ignored)")
return True
def keywordTextForCue(self):
if len(self.tokens) > 1:
self.doTextForCue(self.cue, self.cuepage, self.tokenStringForText())
return True
self.addMessage("bad TEXT (ignored)")
return True
def keywordUpForCue(self):
if len(self.tokens) == 2:
self.doUpForCue(self.cue, self.cuepage, self.tokens[1], "0")
return True
if len(self.tokens) == 3:
self.doUpForCue(self.cue, self.cuepage, self.tokens[1], self.tokens[2])
return True
self.addMessage("bad UP (ignored)")
return True
##### group keywords
def keywordChannelForGroup(self):
lt = len(self.tokens)
v = True
rs = 3
while v and rs <= lt:
v = self.doChannelForGroup(self.group, self.grouppage, self.tokens[rs-2], self.tokens[rs-1])
rs += 2
if v:
return True
self.addMessage("Warning: bad CHAN (ignored)")
return True
def keywordPartForGroup(self):
if len(self.tokens) == 2:
self.doPartForGroup(self.group, self.grouppage, self.tokens[1])
return True
self.addMessage("bad PART (ignored)")
return True
def keywordTextForGroup(self):
if len(self.tokens) > 1:
self.doTextForGroup(self.group, self.grouppage, self.tokenStringForText())
return True
self.addMessage("bad TEXT (ignored)")
return True
##### sub keywords
def keywordChannelForSub(self):
lt = len(self.tokens)
v = True
rs = 3
while v and rs <= lt:
v = self.doChannelForSub(self.sub, self.subpage, self.tokens[rs-2], self.tokens[rs-1])
rs += 2
if v:
return True
self.addMessage("Warning: bad CHAN (ignored)")
return True
def keywordDownForSub(self):
if len(self.tokens) == 2:
self.doDownForSub(self.sub, self.subpage, self.tokens[1], "0")
return True
if len(self.tokens) == 3:
self.doDownForSub(self.sub, self.subpage, self.tokens[1], self.tokens[2])
return True
self.addMessage("bad UP (ignored)")
return True
def keywordTextForSub(self):
if len(self.tokens) > 1:
self.doTextForSub(self.sub, self.subpage, self.tokenStringForText())
return True
self.addMessage("bad TEXT (ignored)")
return True
def keywordUpForSub(self):
if len(self.tokens) == 2:
self.doUpForSub(self.sub, self.subpage, self.tokens[1], "0")
return True
if len(self.tokens) == 3:
self.doUpForSub(self.sub, self.subpage, self.tokens[1], self.tokens[2])
return True
self.addMessage("bad UP (ignored)")
return True
########################################################################
#
# override these functions to actually implement whatever action is appropriate
#
########################################################################
##### primary actions
def doClearItem(self, what, page):
test = True
def doSet(self, item, value):
test = True
def doPatch(self, page, channel, dimmer, level):
return True
##### cue actions
def doChannelForCue(self, cue, page, channel, level):
return True
def doDownForCue(self, cue, page, down, waitdown):
test = True
def doFollowonForCue(self, cue, page, follow):
test = True
def doLinkForCue(self, cue, page, link):
test = True
def doPartForCue(self, cue, page, part):
self.part = part
test = True
def doTextForCue(self, cue, page, text):
test = True
def doUpForCue(self, cue, page, up, waitup):
test = True
##### group actions
def doChannelForGroup(self, group, page, channel, level):
return True
def doPartForGroup(self, group, page, part):
self.part = part
test = True
def doTextForGroup(self, group, page, text):
test = True
##### sub actions
def doChannelForSub(self, sub, page, channel, level):
return True
def doDownForSub(self, sub, page, down, waitdown):
test = True
def doTextForSub(self, sub, page, text):
test = True
def doUpForSub(self, sub, page, up, waitup):
test = True
########################################################################
#
# override these functions to handle manufacturer keywords
#
########################################################################
def recognizedMfgBasic(self, keyword):
return False
def recognizedMfgPrimary(self, keyword):
return False
def recognizedMfgSecondary(self, keyword):
return False
def doMfgPrimary(self, keyword):
return True
def doMfgPrimary(self, keyword):
return True
def keywordMfgForCue(self, keyword):
return True
def keywordMfgForGroup(self, keyword):
return True
def keywordMfgForSub(self, keyword):
return True
##### utility method isDelimiter(c)
# test to see if character is one of the standard delimiter characters
# ASCII Text Representation for Lighting Console Data 5.4, page 13
#####
def isDelimiter(self, c):
if c == '\t':
return True
if c == ' ':
return True
if c == ',':
return True
if c == '/':
return True
if c == ';':
return True
if c == '<':
return True
if c == '=':
return True
if c == '>':
return True
if c == '@':
return True
return False
|
SUCCESS_RESPONSE_CODE = 'Success'
METHOD_NOT_ALLOWED = 'Failure'
UNAUTHORIZED = 'Warning'
SUCCESS_RESPONSE_CREATED = 'Success'
PAGE_NOT_FOUND = 'Error'
INTERNAL_SERVER_ERROR = 'Error'
BAD_REQUEST_CODE = 'Error'
SUCCESS_MESSAGE = 'Success'
FAILURE_MESSAGE = 'Failure'
|
class Stream(MarshalByRefObject):
""" Provides a generic view of a sequence of bytes. """
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return Stream()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
def BeginRead(self,buffer,offset,count,callback,state):
"""
BeginRead(self: Stream,buffer: Array[Byte],offset: int,count: int,callback: AsyncCallback,state: object) -> IAsyncResult
Begins an asynchronous read operation.
buffer: The buffer to read the data into.
offset: The byte offset in buffer at which to begin writing data read from the stream.
count: The maximum number of bytes to read.
callback: An optional asynchronous callback,to be called when the read is complete.
state: A user-provided object that distinguishes this particular asynchronous read request from other requests.
Returns: An System.IAsyncResult that represents the asynchronous read,which could still be pending.
"""
pass
def BeginWrite(self,buffer,offset,count,callback,state):
"""
BeginWrite(self: Stream,buffer: Array[Byte],offset: int,count: int,callback: AsyncCallback,state: object) -> IAsyncResult
Begins an asynchronous write operation.
buffer: The buffer to write data from.
offset: The byte offset in buffer from which to begin writing.
count: The maximum number of bytes to write.
callback: An optional asynchronous callback,to be called when the write is complete.
state: A user-provided object that distinguishes this particular asynchronous write request from other requests.
Returns: An IAsyncResult that represents the asynchronous write,which could still be pending.
"""
pass
def Close(self):
"""
Close(self: Stream)
Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.
"""
pass
def CopyTo(self,destination,bufferSize=None):
"""
CopyTo(self: Stream,destination: Stream)
Reads the bytes from the current stream and writes them to the destination stream.
destination: The stream that will contain the contents of the current stream.
CopyTo(self: Stream,destination: Stream,bufferSize: int)
Reads all the bytes from the current stream and writes them to a destination stream,using a specified buffer size.
destination: The stream that will contain the contents of the current stream.
bufferSize: The size of the buffer. This value must be greater than zero. The default size is 4096.
"""
pass
def CopyToAsync(self,destination,bufferSize=None,cancellationToken=None):
"""
CopyToAsync(self: Stream,destination: Stream) -> Task
CopyToAsync(self: Stream,destination: Stream,bufferSize: int) -> Task
CopyToAsync(self: Stream,destination: Stream,bufferSize: int,cancellationToken: CancellationToken) -> Task
"""
pass
def CreateWaitHandle(self,*args):
"""
CreateWaitHandle(self: Stream) -> WaitHandle
Allocates a System.Threading.WaitHandle object.
Returns: A reference to the allocated WaitHandle.
"""
pass
def Dispose(self):
"""
Dispose(self: Stream)
Releases all resources used by the System.IO.Stream.
"""
pass
def EndRead(self,asyncResult):
"""
EndRead(self: Stream,asyncResult: IAsyncResult) -> int
Waits for the pending asynchronous read to complete.
asyncResult: The reference to the pending asynchronous request to finish.
Returns: The number of bytes read from the stream,between zero (0) and the number of bytes you requested. Streams return zero (0) only at the end of the stream,otherwise,they
should block until at least one byte is available.
"""
pass
def EndWrite(self,asyncResult):
"""
EndWrite(self: Stream,asyncResult: IAsyncResult)
Ends an asynchronous write operation.
asyncResult: A reference to the outstanding asynchronous I/O request.
"""
pass
def Flush(self):
"""
Flush(self: Stream)
When overridden in a derived class,clears all buffers for this stream and causes any buffered data to be written to the underlying device.
"""
pass
def FlushAsync(self,cancellationToken=None):
"""
FlushAsync(self: Stream) -> Task
FlushAsync(self: Stream,cancellationToken: CancellationToken) -> Task
"""
pass
def MemberwiseClone(self,*args):
"""
MemberwiseClone(self: MarshalByRefObject,cloneIdentity: bool) -> MarshalByRefObject
Creates a shallow copy of the current System.MarshalByRefObject object.
cloneIdentity: false to delete the current System.MarshalByRefObject object's identity,which will cause the object to be assigned a new identity when it is marshaled across a remoting
boundary. A value of false is usually appropriate. true to copy the current System.MarshalByRefObject object's identity to its clone,which will cause remoting client calls
to be routed to the remote server object.
Returns: A shallow copy of the current System.MarshalByRefObject object.
MemberwiseClone(self: object) -> object
Creates a shallow copy of the current System.Object.
Returns: A shallow copy of the current System.Object.
"""
pass
def ObjectInvariant(self,*args):
"""
ObjectInvariant(self: Stream)
Provides support for a System.Diagnostics.Contracts.Contract.
"""
pass
def Read(self,buffer,offset,count):
"""
Read(self: Stream,offset: int,count: int) -> (int,Array[Byte])
When overridden in a derived class,reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
offset: The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
count: The maximum number of bytes to be read from the current stream.
Returns: The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available,or zero (0) if the end
of the stream has been reached.
"""
pass
def ReadAsync(self,buffer,offset,count,cancellationToken=None):
"""
ReadAsync(self: Stream,buffer: Array[Byte],offset: int,count: int) -> Task[int]
ReadAsync(self: Stream,buffer: Array[Byte],offset: int,count: int,cancellationToken: CancellationToken) -> Task[int]
"""
pass
def ReadByte(self):
"""
ReadByte(self: Stream) -> int
Reads a byte from the stream and advances the position within the stream by one byte,or returns -1 if at the end of the stream.
Returns: The unsigned byte cast to an Int32,or -1 if at the end of the stream.
"""
pass
def Seek(self,offset,origin):
"""
Seek(self: Stream,offset: Int64,origin: SeekOrigin) -> Int64
When overridden in a derived class,sets the position within the current stream.
offset: A byte offset relative to the origin parameter.
origin: A value of type System.IO.SeekOrigin indicating the reference point used to obtain the new position.
Returns: The new position within the current stream.
"""
pass
def SetLength(self,value):
"""
SetLength(self: Stream,value: Int64)
When overridden in a derived class,sets the length of the current stream.
value: The desired length of the current stream in bytes.
"""
pass
@staticmethod
def Synchronized(stream):
"""
Synchronized(stream: Stream) -> Stream
Creates a thread-safe (synchronized) wrapper around the specified System.IO.Stream object.
stream: The System.IO.Stream object to synchronize.
Returns: A thread-safe System.IO.Stream object.
"""
pass
def Write(self,buffer,offset,count):
"""
Write(self: Stream,buffer: Array[Byte],offset: int,count: int)
When overridden in a derived class,writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
buffer: An array of bytes. This method copies count bytes from buffer to the current stream.
offset: The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
count: The number of bytes to be written to the current stream.
"""
pass
def WriteAsync(self,buffer,offset,count,cancellationToken=None):
"""
WriteAsync(self: Stream,buffer: Array[Byte],offset: int,count: int) -> Task
WriteAsync(self: Stream,buffer: Array[Byte],offset: int,count: int,cancellationToken: CancellationToken) -> Task
"""
pass
def WriteByte(self,value):
"""
WriteByte(self: Stream,value: Byte)
Writes a byte to the current position in the stream and advances the position within the stream by one byte.
value: The byte to write to the stream.
"""
pass
def __enter__(self,*args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self,*args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __reduce_ex__(self,*args):
pass
CanRead=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current stream supports reading.
Get: CanRead(self: Stream) -> bool
"""
CanSeek=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current stream supports seeking.
Get: CanSeek(self: Stream) -> bool
"""
CanTimeout=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value that determines whether the current stream can time out.
Get: CanTimeout(self: Stream) -> bool
"""
CanWrite=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets a value indicating whether the current stream supports writing.
Get: CanWrite(self: Stream) -> bool
"""
Length=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets the length in bytes of the stream.
Get: Length(self: Stream) -> Int64
"""
Position=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""When overridden in a derived class,gets or sets the position within the current stream.
Get: Position(self: Stream) -> Int64
Set: Position(self: Stream)=value
"""
ReadTimeout=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value,in miliseconds,that determines how long the stream will attempt to read before timing out.
Get: ReadTimeout(self: Stream) -> int
Set: ReadTimeout(self: Stream)=value
"""
WriteTimeout=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value,in miliseconds,that determines how long the stream will attempt to write before timing out.
Get: WriteTimeout(self: Stream) -> int
Set: WriteTimeout(self: Stream)=value
"""
Null=None
|
class Solution(object):
def intToRoman(self, num):
"""
:type num: int
:rtype: str
"""
roman = {1: 'I', 5: 'V', 10: 'X', 50: 'L', 100: 'C', 500: 'D', 1000: 'M', 5000: ''}
ret = ''
for i, s in enumerate(str(num)[::-1]):
if s in ['4', '9']:
ret = roman[10**i] + roman[(int(s)+1)*10**i] + ret
elif s != '0':
ret = roman[5 * 10**i] * (int(s) >= 5) + roman[10**i] * (int(s) % 5) + ret
return ret
if __name__ == '__main__':
s = Solution()
for i in range(20):
print(i+1, s.intToRoman(i+1))
|
#!/usr/bin/env python
"""Docstring"""
__author__ = "Petar Stoyanov"
def main():
"""Docstring"""
text = input().lower()
search_term = input().lower()
counter = 0
index = 0
while True:
if text.find(search_term, index) == -1:
break
else:
counter += 1
index = text.find(search_term, index) + 1
print(counter)
if __name__ == '__main__':
main()
|
"""Test data files."""
def test():
pass
|
#!/usr/bin/env python
"""
https://leetcode.com/problems/implement-strstr/description/
Created on 2018-11-13
@author: 'Jiezhi.G@gmail.com'
Reference:
"""
class Solution:
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
if not needle or haystack == needle:
return 0
len_n = len(needle)
for i in range(len(haystack) - len_n + 1):
if haystack[i:i + len_n] == needle:
return i
return -1
def test():
assert Solution().strStr("test", "") == 0
assert Solution().strStr("hello", "ll") == 2
assert Solution().strStr("hello", "k") == -1
assert Solution().strStr("hello", "hello") == 0
assert Solution().strStr("mississippi", "pi") == 9
|
def phonehome():
relax()
sleep(1)
i01.setHeadSpeed(1.0,1.0,1.0,1.0,1.0)
i01.setArmSpeed("left",1.0,1.0,1.0,1.0)
i01.setArmSpeed("right",1.0,1.0,1.0,1.0)
i01.setHandSpeed("left",1.0,1.0,1.0,1.0,1.0,1.0)
i01.setHandSpeed("right",1.0,1.0,1.0,1.0,1.0,1.0)
i01.setTorsoSpeed(1.0,1.0,1.0)
i01.moveHead(160,68)
i01.moveArm("left",5,86,30,20)
i01.moveArm("right",86,140,83,80)
i01.moveHand("left",99,140,173,167,130,26)
i01.moveHand("right",135,6,170,145,168,180)
i01.moveTorso(25,80,90)
sleep(2)
#i01.mouth.speakBlocking("E,T phone the big home of the inmoov nation")
AudioPlayer.playFile(RuningFolder+'/system/sounds/E,T phone the big home of the inmoov nation.mp3')
sleep(2)
rest()
sleep(1)
relax()
|
class Script(object):
START_MSG = """<b>Hy {},എന്റെ പേര് Carla ◢ ◤!
🤭 എന്നെ നിർമിച്ചിരിക്കുന്നത് മൂവി ക്ലബ് ഗ്രൂപ്പിലേക്ക് ആണ്.
എന്തായാലും സ്റ്റാർട്ട് അടിച്ചതല്ലെ ഇനി ആ താഴെ കാണുന്ന നമ്മുടെ ഒഫീഷ്യൽ ചന്നെൽ കൂടി Subscribe ചെയ്തിട്ട് പൊക്കോ...🤣🤣</b>
"""
HELP_MSG = """
<b>നീ ഏതാ..... ഒന്ന് പോടെയ് അവൻ help ചോയ്ച്ച് വന്നിരിക്കുന്നു😤...I'm Different Bot U Know. </b>
"""
ABOUT_MSG = """<b>Bot Info</b>
⭕️<b>My Name : Carla ◢ ◤</b>
⭕️<b>Creater :</b> @NickxFury
⭕️<b>Language :</b> <code>Python3</code>
⭕️<b>Library :</b> <a href='https://docs.pyrogram.org/'>Pyrogram 1.0.7</a>
<b>Note :</b> <code>നിങ്ങൾക്ക് എന്നെ വേറെ ഒരിടത്തും ഉപയോഗിക്കാൻ പറ്റൂല വേണേൽ നിങ്ങൾക്ക് Start,Help,About ഒക്കെ അടിച്ച് കളിക്കാം അത്ര മാത്രം..ഇത്രേ എനിക്ക് ചെയ്ത് തരാൻ പറ്റൂ🤭.</code>
"""
|
n1 = int(input('Digite um Valor: '))
n2 = int(input('Digite outro valor: '))
n = n1 + n2
print('A soma entre {} e {} resulta em: {} !'.format(n1,n2,n))
print(type(n1))
|
class JUMP_GE:
def __init__(self, stack):
self.phase = 0
self.ip = 0
self.stack = stack
self.a = 0
def exec(self, ip, data):
if (self.phase == 0):
self.ip = ip + 1
self.a = self.stack.pop()
self.phase = 1
return False
elif (self.phase == 1):
b = self.stack.pop()
if b > self.a:
self.phase = 2
return False
else:
self.phase = 0
return True
elif (self.phase == 2):
self.ip = data - 1
self.phase = 3
return False
else:
assert(self.phase == 3)
self.phase = 0
return True
|
class TriggerListener(object):
def __init__(self, state_machine, **kwargs):
self._state_machine = state_machine
def __call__(self, msg):
self._state_machine.trigger(msg.data)
|
# 78. Subsets
# Runtime: 32 ms, faster than 85.43% of Python3 online submissions for Subsets.
# Memory Usage: 14.3 MB, less than 78.59% of Python3 online submissions for Subsets.
class Solution:
# Cascading
def subsets(self, nums: list[int]) -> list[list[int]]:
res = [[]]
for n in nums:
res += [curr + [n] for curr in res]
return res
|
def on_enter(event_data):
""" """
pocs = event_data.model
# Clear any current observation
pocs.observatory.current_observation = None
pocs.observatory.current_offset_info = None
pocs.next_state = 'parked'
if pocs.observatory.has_dome:
pocs.say('Closing dome')
if not pocs.observatory.close_dome():
pocs.logger.critical('Unable to close dome!')
pocs.say('Unable to close dome!')
pocs.say("I'm takin' it on home and then parking.")
pocs.observatory.mount.home_and_park()
|
"""
Nothing, but in a friendly way. Good for filling in for objects you want to
hide. If $form.f1 is a RecursiveNull object, then
$form.f1.anything["you"].might("use") will resolve to the empty string.
This module was contributed by Ian Bicking.
"""
class RecursiveNull(object):
def __getattr__(self, attr):
return self
def __getitem__(self, item):
return self
def __call__(self, *args, **kwargs):
return self
def __str__(self):
return ''
def __repr__(self):
return ''
def __nonzero__(self):
return 0
def __eq__(self, x):
if x:
return False
return True
def __ne__(self, x):
return x and True or False
|
class BitVector(object):
"""docstring for BitVector"""
"""infinite array of bits is present in bitvector"""
def __init__(self):
self.BitNum=0
self.length=0
def set(self,i):
self.BitNum=self.BitNum | 1 << i
self.length=self.BitNum.bit_length()
def reset(self,i):
resetValue=1<<i
self.BitNum=self.BitNum - resetValue
self.length=self.BitNum.bit_length()
def at(self,i):
if(i<0):
raise ValueError
if(i >=self.length):
return 0
return int(bin(self.BitNum)[-(i+1)])
def __repr__(self):
return bin(self.BitNum)[2:]
def __str__(self):
return bin(self.BitNum)[2:]
|
class Constand_Hs:
HEADERSIZE=1024
Dangkyvantay=str('FDK')
Dangkythetu=str('CDK')
Van_tay_mo_tu_F=str('Fopen\n')
Van_tay_dong_tu_F=str('Fclose\n')
Van_Tay_Su_Dung_Tu=str('Fused\n')
The_Tu_Su_Dung_Tu=str('Cused\n')
Van_tay_mo_tu_C=str('Copen')
Van_tay_dong_tu_C=str('Cclose')
Server=('192.168.1.128',3003)
lstouputtemp = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
lstinputtemp = [7,6,5,4,3,2,1,0,11,10,9,8,15,14,13,12]
dooropen=str('Dooropen')
Dongtu=False
Motu=True
def __init__(self):
pass
|
'''Задание 25 № 27422
Напишите программу, которая ищет среди целых чисел, принадлежащих числовому отрезку [174457; 174505],
числа, имеющие ровно два различных натуральных делителя, не считая единицы и самого числа. Для каждого
найденного числа запишите эти два делителя в две соседних столбца на экране с новой строки в порядке возрастания
произведения этих двух делителей. Делители в строке также должны следовать в порядке возрастания.
Ответ:
3 58153
7 24923
59 2957
13 13421
149 1171
5 34897
211 827
2 87251
'''
lst = []
for i in range(174457, 174505):
numDel1 = 0
numDel2 = 0
flag = False
for j in range(2,i):
if i % j == 0:
if numDel1 == 0:
numDel1 = j
elif numDel2 == 0:
numDel2 = j
flag = True
else:
numDel1 = 0
numDel2 = 0
flag = False
break
if flag:
lst.append([numDel1, numDel2])
lst.sort(key = lambda x: [x[0] * x[1]])
for i in lst:
print(i[0],i[1])
|
list1 = ['phisics','chemistry',1997,2000]
print("Value available at index 2 is ", list1[2])
list1[2] = 2003
print("New Value available at index 2 is ", list1[2])
|
expected_output = {
'mst_instances': {
6: {
'bridge_address': '5897.bdff.3b3a',
'bridge_priority': 20486,
'interfaces': {
'GigabitEthernet1/7': {
'cost': 20000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 836828,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.7',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 1,
'message_expires': 0,
'name': 'GigabitEthernet1/7',
'port_id': '128.7',
'port_priority': 128,
'status': 'designated forwarding',
},
'TenGigabitEthernet2/10': {
'cost': 2000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 1285480,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.138',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 2,
'message_expires': 0,
'name': 'TenGigabitEthernet2/10',
'port_id': '128.138',
'port_priority': 128,
'status': 'designated forwarding',
},
'TenGigabitEthernet2/3': {
'cost': 2000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 1285495,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.131',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 2,
'message_expires': 0,
'name': 'TenGigabitEthernet2/3',
'port_id': '128.131',
'port_priority': 128,
'status': 'designated forwarding',
},
'TenGigabitEthernet2/4': {
'cost': 2000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 1285500,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.132',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 2,
'message_expires': 0,
'name': 'TenGigabitEthernet2/4',
'port_id': '128.132',
'port_priority': 128,
'status': 'designated forwarding',
},
'TenGigabitEthernet2/5': {
'cost': 2000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 1285475,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.133',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 2,
'message_expires': 0,
'name': 'TenGigabitEthernet2/5',
'port_id': '128.133',
'port_priority': 128,
'status': 'designated forwarding',
},
'TenGigabitEthernet2/6': {
'cost': 2000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 1285487,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.134',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 2,
'message_expires': 0,
'name': 'TenGigabitEthernet2/6',
'port_id': '128.134',
'port_priority': 128,
'status': 'designated forwarding',
},
'TenGigabitEthernet2/7': {
'cost': 2000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 1285497,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.135',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 2,
'message_expires': 0,
'name': 'TenGigabitEthernet2/7',
'port_id': '128.135',
'port_priority': 128,
'status': 'designated forwarding',
},
'TenGigabitEthernet2/8': {
'cost': 2000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 1285497,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.136',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 2,
'message_expires': 0,
'name': 'TenGigabitEthernet2/8',
'port_id': '128.136',
'port_priority': 128,
'status': 'designated forwarding',
},
'TenGigabitEthernet2/9': {
'cost': 2000,
'counters': {
'bpdu_received': 0,
'bpdu_sent': 1285494,
},
'designated_bridge_address': '5897.bdff.3b3a',
'designated_bridge_port_id': '128.137',
'designated_bridge_priority': 20486,
'designated_root_address': '58ac.78ff.c3f5',
'designated_root_cost': 2000,
'designated_root_priority': 8198,
'forward_delay': 0,
'forward_transitions': 2,
'message_expires': 0,
'name': 'TenGigabitEthernet2/9',
'port_id': '128.137',
'port_priority': 128,
'status': 'designated forwarding',
},
},
'mst_id': 6,
'root_address': '58ac.78ff.c3f5',
'root_priority': 8198,
'sysid': 6,
'vlan': '500-501,504-505,507-554,556-599',
},
},
}
|
#It is highly recommended that you check your code first in IDLE first for syntax errors and then Test it here.
#If your code has syntax errors ,Open-Palm will freeze. You have to restart it in that case
def check_even(n):
if n%2 == 0:
return True
else:
return False
|
def expand(maze, fill):
length=len(maze)
res=[[fill]*(length*2) for i in range(length*2)]
for i in range(length//2, length//2+length):
for j in range(length//2, length//2+length):
res[i][j]=maze[i-length//2][j-length//2]
return res
|
# -*- coding: utf-8 -*-
"""
Branca plugins
--------------
Add different objects/effects in a branca webpage.
"""
__all__ = []
|
def print_id(**kwarg):
return ' '.join(kwarg.values())
print(print_id(name=input('Введите своё имя '),
surname=input('Введите свою фамилию '),
date=input('Введите свой год рождения '),
city=input('Введите свой город проживания '),
email=input('Введите свой email '),
number=input('Введите свой номер телефона ')))
|
number = int(input())
if any(number % int(i) for i in input().split()):
print('not divisible by all')
else:
print('divisible by all')
|
num = []
imp = []
par = []
while True:
num.append(int(input('Digite um número: ')))
r = input('Você quer continuar? [S/N]: ') .strip().upper()[0]
if r in 'N':
break
print(f'Todos os números digitados: {num}')
for c in num:
if c % 2 == 0:
par.append(c)
else:
imp.append(c)
print(f'Os números pares digitados: {par}')
print(f'Os números ímpares digitados: {imp}')
|
#
# PySNMP MIB module ALTIGA-MULTILINK-STATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-MULTILINK-STATS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:05:49 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)
#
alMultiLinkMibModule, = mibBuilder.importSymbols("ALTIGA-GLOBAL-REG", "alMultiLinkMibModule")
alMultiLinkGroup, alStatsMultiLink = mibBuilder.importSymbols("ALTIGA-MIB", "alMultiLinkGroup", "alStatsMultiLink")
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
MibIdentifier, IpAddress, ObjectIdentity, Counter32, TimeTicks, Bits, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, ModuleIdentity, Gauge32, NotificationType, iso, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "IpAddress", "ObjectIdentity", "Counter32", "TimeTicks", "Bits", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "ModuleIdentity", "Gauge32", "NotificationType", "iso", "Counter64")
DisplayString, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "RowStatus")
altigaMultiLinkStatsMibModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 3076, 1, 1, 39, 2))
altigaMultiLinkStatsMibModule.setRevisions(('2002-09-05 13:00', '2002-07-10 00:00',))
if mibBuilder.loadTexts: altigaMultiLinkStatsMibModule.setLastUpdated('200209051300Z')
if mibBuilder.loadTexts: altigaMultiLinkStatsMibModule.setOrganization('Cisco Systems, Inc.')
alStatsMultiLinkGlobal = MibIdentifier((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 1))
alMultiLinkStatsTable = MibTable((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2), )
if mibBuilder.loadTexts: alMultiLinkStatsTable.setStatus('current')
alMultiLinkStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1), ).setIndexNames((0, "ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsIndex"))
if mibBuilder.loadTexts: alMultiLinkStatsEntry.setStatus('current')
alMultiLinkStatsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 1), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: alMultiLinkStatsRowStatus.setStatus('current')
alMultiLinkStatsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsIndex.setStatus('current')
alMultiLinkStatsTxOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsTxOctets.setStatus('current')
alMultiLinkStatsTxPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsTxPackets.setStatus('current')
alMultiLinkStatsTxMlpFragments = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsTxMlpFragments.setStatus('current')
alMultiLinkStatsTxMlpPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 6), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsTxMlpPackets.setStatus('current')
alMultiLinkStatsTxNonMlpPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsTxNonMlpPackets.setStatus('current')
alMultiLinkStatsTxThroughput = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 8), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsTxThroughput.setStatus('current')
alMultiLinkStatsRxOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 9), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxOctets.setStatus('current')
alMultiLinkStatsRxPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxPackets.setStatus('current')
alMultiLinkStatsRxMlpFragments = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxMlpFragments.setStatus('current')
alMultiLinkStatsRxMlpPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxMlpPackets.setStatus('current')
alMultiLinkStatsRxNonMlpPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 13), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxNonMlpPackets.setStatus('current')
alMultiLinkStatsRxThroughput = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 14), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxThroughput.setStatus('current')
alMultiLinkStatsRxLostEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 15), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxLostEnd.setStatus('current')
alMultiLinkStatsRxStalePackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 16), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxStalePackets.setStatus('current')
alMultiLinkStatsRxStaleFragments = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 17), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxStaleFragments.setStatus('current')
alMultiLinkStatsRxDroppedFragments = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 18), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxDroppedFragments.setStatus('current')
alMultiLinkStatsRxOOSFragments = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 19), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsRxOOSFragments.setStatus('current')
alMultiLinkStatsIdleTmrCleanup = MibTableColumn((1, 3, 6, 1, 4, 1, 3076, 2, 1, 2, 34, 2, 1, 20), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: alMultiLinkStatsIdleTmrCleanup.setStatus('current')
altigaMultiLinkStatsMibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 3076, 1, 1, 39, 2, 1))
altigaMultiLinkStatsMibCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 3076, 1, 1, 39, 2, 1, 1))
altigaMultiLinkStatsMibCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 3076, 1, 1, 39, 2, 1, 1, 1)).setObjects(("ALTIGA-MULTILINK-STATS-MIB", "altigaMultiLinkStatsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
altigaMultiLinkStatsMibCompliance = altigaMultiLinkStatsMibCompliance.setStatus('current')
altigaMultiLinkStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 3076, 2, 1, 1, 1, 34, 2)).setObjects(("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRowStatus"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsIndex"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsTxOctets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsTxPackets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsTxMlpFragments"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsTxMlpPackets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsTxNonMlpPackets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsTxThroughput"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxOctets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxPackets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxMlpFragments"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxMlpPackets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxNonMlpPackets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxThroughput"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxLostEnd"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxStalePackets"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxStaleFragments"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxDroppedFragments"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsRxOOSFragments"), ("ALTIGA-MULTILINK-STATS-MIB", "alMultiLinkStatsIdleTmrCleanup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
altigaMultiLinkStatsGroup = altigaMultiLinkStatsGroup.setStatus('current')
mibBuilder.exportSymbols("ALTIGA-MULTILINK-STATS-MIB", altigaMultiLinkStatsMibConformance=altigaMultiLinkStatsMibConformance, altigaMultiLinkStatsMibModule=altigaMultiLinkStatsMibModule, alMultiLinkStatsRxOctets=alMultiLinkStatsRxOctets, alMultiLinkStatsTxMlpFragments=alMultiLinkStatsTxMlpFragments, alMultiLinkStatsRowStatus=alMultiLinkStatsRowStatus, alMultiLinkStatsTxPackets=alMultiLinkStatsTxPackets, alMultiLinkStatsRxThroughput=alMultiLinkStatsRxThroughput, alMultiLinkStatsRxStalePackets=alMultiLinkStatsRxStalePackets, alMultiLinkStatsTxThroughput=alMultiLinkStatsTxThroughput, alMultiLinkStatsEntry=alMultiLinkStatsEntry, alMultiLinkStatsIndex=alMultiLinkStatsIndex, alMultiLinkStatsRxNonMlpPackets=alMultiLinkStatsRxNonMlpPackets, alMultiLinkStatsRxMlpFragments=alMultiLinkStatsRxMlpFragments, alMultiLinkStatsTxOctets=alMultiLinkStatsTxOctets, alMultiLinkStatsRxLostEnd=alMultiLinkStatsRxLostEnd, alMultiLinkStatsRxOOSFragments=alMultiLinkStatsRxOOSFragments, PYSNMP_MODULE_ID=altigaMultiLinkStatsMibModule, altigaMultiLinkStatsMibCompliance=altigaMultiLinkStatsMibCompliance, altigaMultiLinkStatsGroup=altigaMultiLinkStatsGroup, alMultiLinkStatsTxMlpPackets=alMultiLinkStatsTxMlpPackets, alMultiLinkStatsTxNonMlpPackets=alMultiLinkStatsTxNonMlpPackets, altigaMultiLinkStatsMibCompliances=altigaMultiLinkStatsMibCompliances, alStatsMultiLinkGlobal=alStatsMultiLinkGlobal, alMultiLinkStatsRxDroppedFragments=alMultiLinkStatsRxDroppedFragments, alMultiLinkStatsRxMlpPackets=alMultiLinkStatsRxMlpPackets, alMultiLinkStatsTable=alMultiLinkStatsTable, alMultiLinkStatsRxPackets=alMultiLinkStatsRxPackets, alMultiLinkStatsRxStaleFragments=alMultiLinkStatsRxStaleFragments, alMultiLinkStatsIdleTmrCleanup=alMultiLinkStatsIdleTmrCleanup)
|
class Solution:
def isPalindrome(self, s: str) -> bool:
l,r = 0, len(s)-1
while l<r:
if not s[l].isalnum():
l+=1
elif not s[r].isalnum():
r-=1
elif s[l].lower() == s[r].lower():
l+=1
r-=1
else:
return False
return True
|
"""
Entrez is an API that provides access to many databases, with most databases
dealing with the biomedical and molecular fields.
In this project we are concerned with the PubMed and the PubMed Central
databases that hold biomedical literature.
See:
- Links to API documentation & examples: https://www.ncbi.nlm.nih.gov/pmc/tools/developers/
- Documentation about the E-utilities APIs: https://www.ncbi.nlm.nih.gov/books/NBK25501/
- List of the databases available through Entrez: https://www.ncbi.nlm.nih.gov/books/NBK3837/
"""
|
class Solution:
def rankTeams(self, votes: List[str]) -> str:
# Create 2D data structure A : 0, 0, 0, 'A', C: 0, 0, 0, 'B'
rnk = {v:[0] * len(votes[0]) + [v] for v in votes[0]}
# Tally votes in reverse because sort defaults ascending
for v in votes:
for i, c in enumerate(v):
rnk[c][i] -= 1
# Sort
return "".join(sorted(rnk, key = lambda x: rnk[x]))
|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findMode(self, root: TreeNode) -> List[int]:
if not root:
return
dic = {}
def record(node):
if not node:
return
if node.val not in dic:
dic[node.val] = 1
else:
dic[node.val] += 1
record(node.left)
record(node.right)
record(root)
self.modes = []
max_count = None
for key, val in dic.items():
if not max_count:
self.modes.append(key)
max_count = val
elif val == max_count:
self.modes.append(key)
elif val > max_count:
self.modes = [key]
max_count = val
return self.modes
|
#
# PySNMP MIB module TPT-DDOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-DDOS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:26:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
NotificationType, Unsigned32, Counter32, Bits, ModuleIdentity, TimeTicks, Gauge32, ObjectIdentity, IpAddress, Integer32, iso, MibIdentifier, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "NotificationType", "Unsigned32", "Counter32", "Bits", "ModuleIdentity", "TimeTicks", "Gauge32", "ObjectIdentity", "IpAddress", "Integer32", "iso", "MibIdentifier", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
tpt_tpa_objs, = mibBuilder.importSymbols("TPT-TPAMIBS-MIB", "tpt-tpa-objs")
tpt_ddos = ModuleIdentity((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9)).setLabel("tpt-ddos")
tpt_ddos.setRevisions(('2016-05-25 18:54',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: tpt_ddos.setRevisionsDescriptions(('Updated copyright information. Minor MIB syntax fixes.',))
if mibBuilder.loadTexts: tpt_ddos.setLastUpdated('201605251854Z')
if mibBuilder.loadTexts: tpt_ddos.setOrganization('Trend Micro, Inc.')
if mibBuilder.loadTexts: tpt_ddos.setContactInfo('www.trendmicro.com')
if mibBuilder.loadTexts: tpt_ddos.setDescription("DDoS management (statistics). Copyright (C) 2016 Trend Micro Incorporated. All Rights Reserved. Trend Micro makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Trend Micro shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material. This document contains proprietary information, which is protected by copyright. No part of this document may be photocopied, reproduced, or translated into another language without the prior written consent of Trend Micro. The information is provided 'as is' without warranty of any kind and is subject to change without notice. The only warranties for Trend Micro products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. Trend Micro shall not be liable for technical or editorial errors or omissions contained herein. TippingPoint(R), the TippingPoint logo, and Digital Vaccine(R) are registered trademarks of Trend Micro. All other company and product names may be trademarks of their respective holders. All rights reserved. This document contains confidential information, trade secrets or both, which are the property of Trend Micro. No part of this documentation may be reproduced in any form or by any means or used to make any derivative work (such as translation, transformation, or adaptation) without written permission from Trend Micro or one of its subsidiaries. All other company and product names may be trademarks of their respective holders. ")
rejectSynHistSecondsTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 5), )
if mibBuilder.loadTexts: rejectSynHistSecondsTable.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistSecondsTable.setDescription('Historical (sampled) data every second for a minute.')
rejectSynHistSecondsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 5, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectSynHistSecondsGlobalID"), (0, "TPT-DDOS-MIB", "rejectSynHistSecondsIndex"))
if mibBuilder.loadTexts: rejectSynHistSecondsEntry.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistSecondsEntry.setDescription('An entry in the rejected SYNs per second history seconds table. Rows cannot be created or deleted. ')
rejectSynHistSecondsGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 5, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectSynHistSecondsGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistSecondsGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectSynHistSecondsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 5, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectSynHistSecondsIndex.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistSecondsIndex.setDescription('The index (0-59) of the second.')
rejectSynHistSecondsUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 5, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectSynHistSecondsUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistSecondsUnitCount.setDescription('The count of filter-specific units matching the criteria for this filter in the specified second.')
rejectSynHistSecondsTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 5, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectSynHistSecondsTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistSecondsTimestamp.setDescription('The time SecondsUnitCount was updated (in seconds since January 1, 1970).')
rejectSynHistMinutesTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 6), )
if mibBuilder.loadTexts: rejectSynHistMinutesTable.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistMinutesTable.setDescription('Historical (sampled) data every minute for an hour.')
rejectSynHistMinutesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 6, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectSynHistMinutesGlobalID"), (0, "TPT-DDOS-MIB", "rejectSynHistMinutesIndex"))
if mibBuilder.loadTexts: rejectSynHistMinutesEntry.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistMinutesEntry.setDescription('An entry in the rejected SYNs per second history minutes table. Rows cannot be created or deleted. ')
rejectSynHistMinutesGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 6, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectSynHistMinutesGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistMinutesGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectSynHistMinutesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 6, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectSynHistMinutesIndex.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistMinutesIndex.setDescription('The index (0-59) of the minute.')
rejectSynHistMinutesUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 6, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectSynHistMinutesUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistMinutesUnitCount.setDescription('The average of the SecondsUnitCount values corresponding to this minute.')
rejectSynHistMinutesTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 6, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectSynHistMinutesTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistMinutesTimestamp.setDescription('The time MinutesUnitCount was updated (in seconds since January 1, 1970).')
rejectSynHistHoursTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 7), )
if mibBuilder.loadTexts: rejectSynHistHoursTable.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistHoursTable.setDescription('Historical (sampled) data every hour for a day.')
rejectSynHistHoursEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 7, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectSynHistHoursGlobalID"), (0, "TPT-DDOS-MIB", "rejectSynHistHoursIndex"))
if mibBuilder.loadTexts: rejectSynHistHoursEntry.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistHoursEntry.setDescription('An entry in the rejected SYNs per second history hours table. Rows cannot be created or deleted. ')
rejectSynHistHoursGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 7, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectSynHistHoursGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistHoursGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectSynHistHoursIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 7, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectSynHistHoursIndex.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistHoursIndex.setDescription('The index (0-23) of the hour.')
rejectSynHistHoursUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 7, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectSynHistHoursUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistHoursUnitCount.setDescription('The average of the MinutesUnitCount values corresponding to this hour.')
rejectSynHistHoursTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 7, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectSynHistHoursTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistHoursTimestamp.setDescription('The time HoursUnitCount was updated (in seconds since January 1, 1970).')
rejectSynHistDaysTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 8), )
if mibBuilder.loadTexts: rejectSynHistDaysTable.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistDaysTable.setDescription('Historical (sampled) data every day for 35 days.')
rejectSynHistDaysEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 8, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectSynHistDaysGlobalID"), (0, "TPT-DDOS-MIB", "rejectSynHistDaysIndex"))
if mibBuilder.loadTexts: rejectSynHistDaysEntry.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistDaysEntry.setDescription('An entry in the rejected SYNs per second history days table. Rows cannot be created or deleted. ')
rejectSynHistDaysGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 8, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectSynHistDaysGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistDaysGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectSynHistDaysIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 8, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectSynHistDaysIndex.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistDaysIndex.setDescription('The index (0-34) of the day.')
rejectSynHistDaysUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 8, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectSynHistDaysUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistDaysUnitCount.setDescription('The average of the HoursUnitCount values corresponding to this day.')
rejectSynHistDaysTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 8, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectSynHistDaysTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectSynHistDaysTimestamp.setDescription('The time DaysUnitCount was updated (in seconds since January 1, 1970).')
proxyConnHistSecondsTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 9), )
if mibBuilder.loadTexts: proxyConnHistSecondsTable.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistSecondsTable.setDescription('Historical (sampled) data every second for a minute.')
proxyConnHistSecondsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 9, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "proxyConnHistSecondsGlobalID"), (0, "TPT-DDOS-MIB", "proxyConnHistSecondsIndex"))
if mibBuilder.loadTexts: proxyConnHistSecondsEntry.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistSecondsEntry.setDescription('An entry in the proxied connections per second history seconds table. Rows cannot be created or deleted. ')
proxyConnHistSecondsGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 9, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: proxyConnHistSecondsGlobalID.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistSecondsGlobalID.setDescription('The global identifier of a DDoS filter group.')
proxyConnHistSecondsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 9, 1, 2), Unsigned32())
if mibBuilder.loadTexts: proxyConnHistSecondsIndex.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistSecondsIndex.setDescription('The index (0-59) of the second.')
proxyConnHistSecondsUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 9, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: proxyConnHistSecondsUnitCount.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistSecondsUnitCount.setDescription('The count of filter-specific units matching the traffic criteria for this filter in the specified second.')
proxyConnHistSecondsTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 9, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: proxyConnHistSecondsTimestamp.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistSecondsTimestamp.setDescription('The time SecondsUnitCount was updated (in seconds since January 1, 1970).')
proxyConnHistMinutesTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 10), )
if mibBuilder.loadTexts: proxyConnHistMinutesTable.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistMinutesTable.setDescription('Historical (sampled) data every minute for an hour.')
proxyConnHistMinutesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 10, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "proxyConnHistMinutesGlobalID"), (0, "TPT-DDOS-MIB", "proxyConnHistMinutesIndex"))
if mibBuilder.loadTexts: proxyConnHistMinutesEntry.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistMinutesEntry.setDescription('An entry in the proxied connections per second history minutes table. Rows cannot be created or deleted. ')
proxyConnHistMinutesGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 10, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: proxyConnHistMinutesGlobalID.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistMinutesGlobalID.setDescription('The global identifier of a DDoS filter group.')
proxyConnHistMinutesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 10, 1, 2), Unsigned32())
if mibBuilder.loadTexts: proxyConnHistMinutesIndex.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistMinutesIndex.setDescription('The index (0-59) of the minute.')
proxyConnHistMinutesUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 10, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: proxyConnHistMinutesUnitCount.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistMinutesUnitCount.setDescription('The average of the SecondsUnitCount values corresponding to this minute.')
proxyConnHistMinutesTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 10, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: proxyConnHistMinutesTimestamp.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistMinutesTimestamp.setDescription('The time MinutesUnitCount was updated (in seconds since January 1, 1970).')
proxyConnHistHoursTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 11), )
if mibBuilder.loadTexts: proxyConnHistHoursTable.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistHoursTable.setDescription('Historical (sampled) data every hour for a day.')
proxyConnHistHoursEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 11, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "proxyConnHistHoursGlobalID"), (0, "TPT-DDOS-MIB", "proxyConnHistHoursIndex"))
if mibBuilder.loadTexts: proxyConnHistHoursEntry.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistHoursEntry.setDescription('An entry in the proxied connections per second history hours table. Rows cannot be created or deleted. ')
proxyConnHistHoursGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 11, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: proxyConnHistHoursGlobalID.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistHoursGlobalID.setDescription('The global identifier of a DDoS filter group.')
proxyConnHistHoursIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 11, 1, 2), Unsigned32())
if mibBuilder.loadTexts: proxyConnHistHoursIndex.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistHoursIndex.setDescription('The index (0-23) of the hour.')
proxyConnHistHoursUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 11, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: proxyConnHistHoursUnitCount.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistHoursUnitCount.setDescription('The average of the MinutesUnitCount values corresponding to this hour.')
proxyConnHistHoursTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 11, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: proxyConnHistHoursTimestamp.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistHoursTimestamp.setDescription('The time HoursUnitCount was updated (in seconds since January 1, 1970).')
proxyConnHistDaysTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 12), )
if mibBuilder.loadTexts: proxyConnHistDaysTable.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistDaysTable.setDescription('Historical (sampled) data every day for 35 days.')
proxyConnHistDaysEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 12, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "proxyConnHistDaysGlobalID"), (0, "TPT-DDOS-MIB", "proxyConnHistDaysIndex"))
if mibBuilder.loadTexts: proxyConnHistDaysEntry.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistDaysEntry.setDescription('An entry in the proxied connections per second history days table. Rows cannot be created or deleted. ')
proxyConnHistDaysGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 12, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: proxyConnHistDaysGlobalID.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistDaysGlobalID.setDescription('The global identifier of a DDoS filter group.')
proxyConnHistDaysIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 12, 1, 2), Unsigned32())
if mibBuilder.loadTexts: proxyConnHistDaysIndex.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistDaysIndex.setDescription('The index (0-34) of the day.')
proxyConnHistDaysUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 12, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: proxyConnHistDaysUnitCount.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistDaysUnitCount.setDescription('The average of the HoursUnitCount values corresponding to this day.')
proxyConnHistDaysTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 12, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: proxyConnHistDaysTimestamp.setStatus('current')
if mibBuilder.loadTexts: proxyConnHistDaysTimestamp.setDescription('The time DaysUnitCount was updated (in seconds since January 1, 1970).')
rejectCpsHistSecondsTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 15), )
if mibBuilder.loadTexts: rejectCpsHistSecondsTable.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistSecondsTable.setDescription('Historical (sampled) data every second for a minute.')
rejectCpsHistSecondsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 15, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectCpsHistSecondsGlobalID"), (0, "TPT-DDOS-MIB", "rejectCpsHistSecondsIndex"))
if mibBuilder.loadTexts: rejectCpsHistSecondsEntry.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistSecondsEntry.setDescription('An entry in the rejected connections per sec (CPS) history seconds table. Rows cannot be created or deleted. ')
rejectCpsHistSecondsGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 15, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectCpsHistSecondsGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistSecondsGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectCpsHistSecondsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 15, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectCpsHistSecondsIndex.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistSecondsIndex.setDescription('The index (0-59) of the second.')
rejectCpsHistSecondsUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 15, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectCpsHistSecondsUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistSecondsUnitCount.setDescription('The count of filter-specific units matching the criteria for this filter in the specified second.')
rejectCpsHistSecondsTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 15, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectCpsHistSecondsTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistSecondsTimestamp.setDescription('The time SecondsUnitCount was updated (in seconds since January 1, 1970).')
rejectCpsHistMinutesTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 16), )
if mibBuilder.loadTexts: rejectCpsHistMinutesTable.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistMinutesTable.setDescription('Historical (sampled) data every minute for an hour.')
rejectCpsHistMinutesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 16, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectCpsHistMinutesGlobalID"), (0, "TPT-DDOS-MIB", "rejectCpsHistMinutesIndex"))
if mibBuilder.loadTexts: rejectCpsHistMinutesEntry.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistMinutesEntry.setDescription('An entry in the rejected connections per sec (CPS) history minutes table. Rows cannot be created or deleted. ')
rejectCpsHistMinutesGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 16, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectCpsHistMinutesGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistMinutesGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectCpsHistMinutesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 16, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectCpsHistMinutesIndex.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistMinutesIndex.setDescription('The index (0-59) of the minute.')
rejectCpsHistMinutesUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 16, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectCpsHistMinutesUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistMinutesUnitCount.setDescription('The average of the SecondsUnitCount values corresponding to this minute.')
rejectCpsHistMinutesTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 16, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectCpsHistMinutesTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistMinutesTimestamp.setDescription('The time MinutesUnitCount was updated (in seconds since January 1, 1970).')
rejectCpsHistHoursTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 17), )
if mibBuilder.loadTexts: rejectCpsHistHoursTable.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistHoursTable.setDescription('Historical (sampled) data every hour for a day.')
rejectCpsHistHoursEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 17, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectCpsHistHoursGlobalID"), (0, "TPT-DDOS-MIB", "rejectCpsHistHoursIndex"))
if mibBuilder.loadTexts: rejectCpsHistHoursEntry.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistHoursEntry.setDescription('An entry in the rejected connections per sec (CPS) history hours table. Rows cannot be created or deleted. ')
rejectCpsHistHoursGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 17, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectCpsHistHoursGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistHoursGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectCpsHistHoursIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 17, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectCpsHistHoursIndex.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistHoursIndex.setDescription('The index (0-23) of the hour.')
rejectCpsHistHoursUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 17, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectCpsHistHoursUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistHoursUnitCount.setDescription('The average of the MinutesUnitCount values corresponding to this hour.')
rejectCpsHistHoursTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 17, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectCpsHistHoursTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistHoursTimestamp.setDescription('The time HoursUnitCount was updated (in seconds since January 1, 1970).')
rejectCpsHistDaysTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 18), )
if mibBuilder.loadTexts: rejectCpsHistDaysTable.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistDaysTable.setDescription('Historical (sampled) data every day for 35 days.')
rejectCpsHistDaysEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 18, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectCpsHistDaysGlobalID"), (0, "TPT-DDOS-MIB", "rejectCpsHistDaysIndex"))
if mibBuilder.loadTexts: rejectCpsHistDaysEntry.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistDaysEntry.setDescription('An entry in the rejected connections per sec (CPS) history days table. Rows cannot be created or deleted. ')
rejectCpsHistDaysGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 18, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectCpsHistDaysGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistDaysGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectCpsHistDaysIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 18, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectCpsHistDaysIndex.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistDaysIndex.setDescription('The index (0-34) of the day.')
rejectCpsHistDaysUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 18, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectCpsHistDaysUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistDaysUnitCount.setDescription('The average of the HoursUnitCount values corresponding to this day.')
rejectCpsHistDaysTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 18, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectCpsHistDaysTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectCpsHistDaysTimestamp.setDescription('The time DaysUnitCount was updated (in seconds since January 1, 1970).')
acceptCpsHistSecondsTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 19), )
if mibBuilder.loadTexts: acceptCpsHistSecondsTable.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistSecondsTable.setDescription('Historical (sampled) data every second for a minute.')
acceptCpsHistSecondsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 19, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "acceptCpsHistSecondsGlobalID"), (0, "TPT-DDOS-MIB", "acceptCpsHistSecondsIndex"))
if mibBuilder.loadTexts: acceptCpsHistSecondsEntry.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistSecondsEntry.setDescription('An entry in the accepted connections per sec (CPS) history seconds table. Rows cannot be created or deleted. ')
acceptCpsHistSecondsGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 19, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: acceptCpsHistSecondsGlobalID.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistSecondsGlobalID.setDescription('The global identifier of a DDoS filter group.')
acceptCpsHistSecondsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 19, 1, 2), Unsigned32())
if mibBuilder.loadTexts: acceptCpsHistSecondsIndex.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistSecondsIndex.setDescription('The index (0-59) of the second.')
acceptCpsHistSecondsUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 19, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptCpsHistSecondsUnitCount.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistSecondsUnitCount.setDescription('The count of filter-specific units matching the criteria for this filter in the specified second.')
acceptCpsHistSecondsTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 19, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptCpsHistSecondsTimestamp.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistSecondsTimestamp.setDescription('The time SecondsUnitCount was updated (in seconds since January 1, 1970).')
acceptCpsHistMinutesTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 20), )
if mibBuilder.loadTexts: acceptCpsHistMinutesTable.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistMinutesTable.setDescription('Historical (sampled) data every minute for an hour.')
acceptCpsHistMinutesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 20, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "acceptCpsHistMinutesGlobalID"), (0, "TPT-DDOS-MIB", "acceptCpsHistMinutesIndex"))
if mibBuilder.loadTexts: acceptCpsHistMinutesEntry.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistMinutesEntry.setDescription('An entry in the accepted connections per sec (CPS) history minutes table. Rows cannot be created or deleted. ')
acceptCpsHistMinutesGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 20, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: acceptCpsHistMinutesGlobalID.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistMinutesGlobalID.setDescription('The global identifier of a DDoS filter group.')
acceptCpsHistMinutesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 20, 1, 2), Unsigned32())
if mibBuilder.loadTexts: acceptCpsHistMinutesIndex.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistMinutesIndex.setDescription('The index (0-59) of the minute.')
acceptCpsHistMinutesUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 20, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptCpsHistMinutesUnitCount.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistMinutesUnitCount.setDescription('The average of the SecondsUnitCount values corresponding to this minute.')
acceptCpsHistMinutesTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 20, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptCpsHistMinutesTimestamp.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistMinutesTimestamp.setDescription('The time MinutesUnitCount was updated (in seconds since January 1, 1970).')
acceptCpsHistHoursTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 21), )
if mibBuilder.loadTexts: acceptCpsHistHoursTable.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistHoursTable.setDescription('Historical (sampled) data every hour for a day.')
acceptCpsHistHoursEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 21, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "acceptCpsHistHoursGlobalID"), (0, "TPT-DDOS-MIB", "acceptCpsHistHoursIndex"))
if mibBuilder.loadTexts: acceptCpsHistHoursEntry.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistHoursEntry.setDescription('An entry in the accepted connections per sec (CPS) history hours table. Rows cannot be created or deleted. ')
acceptCpsHistHoursGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 21, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: acceptCpsHistHoursGlobalID.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistHoursGlobalID.setDescription('The global identifier of a DDoS filter group.')
acceptCpsHistHoursIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 21, 1, 2), Unsigned32())
if mibBuilder.loadTexts: acceptCpsHistHoursIndex.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistHoursIndex.setDescription('The index (0-23) of the hour.')
acceptCpsHistHoursUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 21, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptCpsHistHoursUnitCount.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistHoursUnitCount.setDescription('The average of the MinutesUnitCount values corresponding to this hour.')
acceptCpsHistHoursTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 21, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptCpsHistHoursTimestamp.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistHoursTimestamp.setDescription('The time HoursUnitCount was updated (in seconds since January 1, 1970).')
acceptCpsHistDaysTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 22), )
if mibBuilder.loadTexts: acceptCpsHistDaysTable.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistDaysTable.setDescription('Historical (sampled) data every day for 35 days.')
acceptCpsHistDaysEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 22, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "acceptCpsHistDaysGlobalID"), (0, "TPT-DDOS-MIB", "acceptCpsHistDaysIndex"))
if mibBuilder.loadTexts: acceptCpsHistDaysEntry.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistDaysEntry.setDescription('An entry in the accepted connections per sec (CPS) history days table. Rows cannot be created or deleted. ')
acceptCpsHistDaysGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 22, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: acceptCpsHistDaysGlobalID.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistDaysGlobalID.setDescription('The global identifier of a DDoS filter group.')
acceptCpsHistDaysIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 22, 1, 2), Unsigned32())
if mibBuilder.loadTexts: acceptCpsHistDaysIndex.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistDaysIndex.setDescription('The index (0-34) of the day.')
acceptCpsHistDaysUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 22, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptCpsHistDaysUnitCount.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistDaysUnitCount.setDescription('The average of the HoursUnitCount values corresponding to this day.')
acceptCpsHistDaysTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 22, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptCpsHistDaysTimestamp.setStatus('current')
if mibBuilder.loadTexts: acceptCpsHistDaysTimestamp.setDescription('The time DaysUnitCount was updated (in seconds since January 1, 1970).')
rejectEstHistSecondsTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 25), )
if mibBuilder.loadTexts: rejectEstHistSecondsTable.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistSecondsTable.setDescription('Historical (sampled) data every second for a minute.')
rejectEstHistSecondsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 25, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectEstHistSecondsGlobalID"), (0, "TPT-DDOS-MIB", "rejectEstHistSecondsIndex"))
if mibBuilder.loadTexts: rejectEstHistSecondsEntry.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistSecondsEntry.setDescription('An entry in the rejected connections per sec (EST) history seconds table. Rows cannot be created or deleted. ')
rejectEstHistSecondsGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 25, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectEstHistSecondsGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistSecondsGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectEstHistSecondsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 25, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectEstHistSecondsIndex.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistSecondsIndex.setDescription('The index (0-59) of the second.')
rejectEstHistSecondsUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 25, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectEstHistSecondsUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistSecondsUnitCount.setDescription('The count of filter-specific units matching the criteria for this filter in the specified second.')
rejectEstHistSecondsTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 25, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectEstHistSecondsTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistSecondsTimestamp.setDescription('The time SecondsUnitCount was updated (in seconds since January 1, 1970).')
rejectEstHistMinutesTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 26), )
if mibBuilder.loadTexts: rejectEstHistMinutesTable.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistMinutesTable.setDescription('Historical (sampled) data every minute for an hour.')
rejectEstHistMinutesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 26, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectEstHistMinutesGlobalID"), (0, "TPT-DDOS-MIB", "rejectEstHistMinutesIndex"))
if mibBuilder.loadTexts: rejectEstHistMinutesEntry.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistMinutesEntry.setDescription('An entry in the rejected connections per sec (EST) history minutes table. Rows cannot be created or deleted. ')
rejectEstHistMinutesGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 26, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectEstHistMinutesGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistMinutesGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectEstHistMinutesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 26, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectEstHistMinutesIndex.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistMinutesIndex.setDescription('The index (0-59) of the minute.')
rejectEstHistMinutesUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 26, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectEstHistMinutesUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistMinutesUnitCount.setDescription('The average of the SecondsUnitCount values corresponding to this minute.')
rejectEstHistMinutesTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 26, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectEstHistMinutesTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistMinutesTimestamp.setDescription('The time MinutesUnitCount was updated (in seconds since January 1, 1970).')
rejectEstHistHoursTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 27), )
if mibBuilder.loadTexts: rejectEstHistHoursTable.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistHoursTable.setDescription('Historical (sampled) data every hour for a day.')
rejectEstHistHoursEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 27, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectEstHistHoursGlobalID"), (0, "TPT-DDOS-MIB", "rejectEstHistHoursIndex"))
if mibBuilder.loadTexts: rejectEstHistHoursEntry.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistHoursEntry.setDescription('An entry in the rejected connections per sec (EST) history hours table. Rows cannot be created or deleted. ')
rejectEstHistHoursGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 27, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectEstHistHoursGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistHoursGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectEstHistHoursIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 27, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectEstHistHoursIndex.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistHoursIndex.setDescription('The index (0-23) of the hour.')
rejectEstHistHoursUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 27, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectEstHistHoursUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistHoursUnitCount.setDescription('The average of the MinutesUnitCount values corresponding to this hour.')
rejectEstHistHoursTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 27, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectEstHistHoursTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistHoursTimestamp.setDescription('The time HoursUnitCount was updated (in seconds since January 1, 1970).')
rejectEstHistDaysTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 28), )
if mibBuilder.loadTexts: rejectEstHistDaysTable.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistDaysTable.setDescription('Historical (sampled) data every day for 35 days.')
rejectEstHistDaysEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 28, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "rejectEstHistDaysGlobalID"), (0, "TPT-DDOS-MIB", "rejectEstHistDaysIndex"))
if mibBuilder.loadTexts: rejectEstHistDaysEntry.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistDaysEntry.setDescription('An entry in the rejected connections per sec (EST) history days table. Rows cannot be created or deleted. ')
rejectEstHistDaysGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 28, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: rejectEstHistDaysGlobalID.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistDaysGlobalID.setDescription('The global identifier of a DDoS filter group.')
rejectEstHistDaysIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 28, 1, 2), Unsigned32())
if mibBuilder.loadTexts: rejectEstHistDaysIndex.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistDaysIndex.setDescription('The index (0-34) of the day.')
rejectEstHistDaysUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 28, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectEstHistDaysUnitCount.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistDaysUnitCount.setDescription('The average of the HoursUnitCount values corresponding to this day.')
rejectEstHistDaysTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 28, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rejectEstHistDaysTimestamp.setStatus('current')
if mibBuilder.loadTexts: rejectEstHistDaysTimestamp.setDescription('The time DaysUnitCount was updated (in seconds since January 1, 1970).')
acceptEstHistSecondsTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 29), )
if mibBuilder.loadTexts: acceptEstHistSecondsTable.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistSecondsTable.setDescription('Historical (sampled) data every second for a minute.')
acceptEstHistSecondsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 29, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "acceptEstHistSecondsGlobalID"), (0, "TPT-DDOS-MIB", "acceptEstHistSecondsIndex"))
if mibBuilder.loadTexts: acceptEstHistSecondsEntry.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistSecondsEntry.setDescription('An entry in the accepted connections per sec (EST) history seconds table. Rows cannot be created or deleted. ')
acceptEstHistSecondsGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 29, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: acceptEstHistSecondsGlobalID.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistSecondsGlobalID.setDescription('The global identifier of a DDoS filter group.')
acceptEstHistSecondsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 29, 1, 2), Unsigned32())
if mibBuilder.loadTexts: acceptEstHistSecondsIndex.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistSecondsIndex.setDescription('The index (0-59) of the second.')
acceptEstHistSecondsUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 29, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptEstHistSecondsUnitCount.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistSecondsUnitCount.setDescription('The count of filter-specific units matching the criteria for this filter in the specified second.')
acceptEstHistSecondsTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 29, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptEstHistSecondsTimestamp.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistSecondsTimestamp.setDescription('The time SecondsUnitCount was updated (in seconds since January 1, 1970).')
acceptEstHistMinutesTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 30), )
if mibBuilder.loadTexts: acceptEstHistMinutesTable.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistMinutesTable.setDescription('Historical (sampled) data every minute for an hour.')
acceptEstHistMinutesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 30, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "acceptEstHistMinutesGlobalID"), (0, "TPT-DDOS-MIB", "acceptEstHistMinutesIndex"))
if mibBuilder.loadTexts: acceptEstHistMinutesEntry.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistMinutesEntry.setDescription('An entry in the accepted connections per sec (EST) history minutes table. Rows cannot be created or deleted. ')
acceptEstHistMinutesGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 30, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: acceptEstHistMinutesGlobalID.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistMinutesGlobalID.setDescription('The global identifier of a DDoS filter group.')
acceptEstHistMinutesIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 30, 1, 2), Unsigned32())
if mibBuilder.loadTexts: acceptEstHistMinutesIndex.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistMinutesIndex.setDescription('The index (0-59) of the minute.')
acceptEstHistMinutesUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 30, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptEstHistMinutesUnitCount.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistMinutesUnitCount.setDescription('The average of the SecondsUnitCount values corresponding to this minute.')
acceptEstHistMinutesTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 30, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptEstHistMinutesTimestamp.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistMinutesTimestamp.setDescription('The time MinutesUnitCount was updated (in seconds since January 1, 1970).')
acceptEstHistHoursTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 31), )
if mibBuilder.loadTexts: acceptEstHistHoursTable.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistHoursTable.setDescription('Historical (sampled) data every hour for a day.')
acceptEstHistHoursEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 31, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "acceptEstHistHoursGlobalID"), (0, "TPT-DDOS-MIB", "acceptEstHistHoursIndex"))
if mibBuilder.loadTexts: acceptEstHistHoursEntry.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistHoursEntry.setDescription('An entry in the accepted connections per sec (EST) history hours table. Rows cannot be created or deleted. ')
acceptEstHistHoursGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 31, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: acceptEstHistHoursGlobalID.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistHoursGlobalID.setDescription('The global identifier of a DDoS filter group.')
acceptEstHistHoursIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 31, 1, 2), Unsigned32())
if mibBuilder.loadTexts: acceptEstHistHoursIndex.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistHoursIndex.setDescription('The index (0-23) of the hour.')
acceptEstHistHoursUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 31, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptEstHistHoursUnitCount.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistHoursUnitCount.setDescription('The average of the MinutesUnitCount values corresponding to this hour.')
acceptEstHistHoursTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 31, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptEstHistHoursTimestamp.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistHoursTimestamp.setDescription('The time HoursUnitCount was updated (in seconds since January 1, 1970).')
acceptEstHistDaysTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 32), )
if mibBuilder.loadTexts: acceptEstHistDaysTable.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistDaysTable.setDescription('Historical (sampled) data every day for 35 days.')
acceptEstHistDaysEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 32, 1), ).setIndexNames((0, "TPT-DDOS-MIB", "acceptEstHistDaysGlobalID"), (0, "TPT-DDOS-MIB", "acceptEstHistDaysIndex"))
if mibBuilder.loadTexts: acceptEstHistDaysEntry.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistDaysEntry.setDescription('An entry in the accepted connections per sec (EST) history days table. Rows cannot be created or deleted. ')
acceptEstHistDaysGlobalID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 32, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40)))
if mibBuilder.loadTexts: acceptEstHistDaysGlobalID.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistDaysGlobalID.setDescription('The global identifier of a DDoS filter group.')
acceptEstHistDaysIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 32, 1, 2), Unsigned32())
if mibBuilder.loadTexts: acceptEstHistDaysIndex.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistDaysIndex.setDescription('The index (0-34) of the day.')
acceptEstHistDaysUnitCount = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 32, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptEstHistDaysUnitCount.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistDaysUnitCount.setDescription('The average of the HoursUnitCount values corresponding to this day.')
acceptEstHistDaysTimestamp = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 9, 32, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: acceptEstHistDaysTimestamp.setStatus('current')
if mibBuilder.loadTexts: acceptEstHistDaysTimestamp.setDescription('The time DaysUnitCount was updated (in seconds since January 1, 1970).')
mibBuilder.exportSymbols("TPT-DDOS-MIB", rejectEstHistMinutesTable=rejectEstHistMinutesTable, proxyConnHistHoursGlobalID=proxyConnHistHoursGlobalID, rejectCpsHistSecondsTable=rejectCpsHistSecondsTable, proxyConnHistDaysGlobalID=proxyConnHistDaysGlobalID, acceptEstHistDaysUnitCount=acceptEstHistDaysUnitCount, acceptCpsHistMinutesGlobalID=acceptCpsHistMinutesGlobalID, proxyConnHistHoursEntry=proxyConnHistHoursEntry, acceptCpsHistHoursIndex=acceptCpsHistHoursIndex, acceptEstHistDaysTimestamp=acceptEstHistDaysTimestamp, rejectEstHistDaysEntry=rejectEstHistDaysEntry, acceptEstHistSecondsTable=acceptEstHistSecondsTable, rejectEstHistHoursEntry=rejectEstHistHoursEntry, acceptEstHistDaysGlobalID=acceptEstHistDaysGlobalID, rejectEstHistSecondsTable=rejectEstHistSecondsTable, rejectEstHistSecondsEntry=rejectEstHistSecondsEntry, acceptCpsHistSecondsEntry=acceptCpsHistSecondsEntry, acceptCpsHistSecondsUnitCount=acceptCpsHistSecondsUnitCount, proxyConnHistSecondsUnitCount=proxyConnHistSecondsUnitCount, acceptCpsHistDaysTable=acceptCpsHistDaysTable, acceptEstHistMinutesIndex=acceptEstHistMinutesIndex, rejectSynHistHoursUnitCount=rejectSynHistHoursUnitCount, rejectEstHistDaysTable=rejectEstHistDaysTable, rejectSynHistMinutesEntry=rejectSynHistMinutesEntry, acceptEstHistDaysTable=acceptEstHistDaysTable, acceptCpsHistHoursEntry=acceptCpsHistHoursEntry, rejectEstHistMinutesEntry=rejectEstHistMinutesEntry, acceptCpsHistDaysIndex=acceptCpsHistDaysIndex, acceptEstHistHoursGlobalID=acceptEstHistHoursGlobalID, rejectEstHistHoursGlobalID=rejectEstHistHoursGlobalID, acceptEstHistSecondsTimestamp=acceptEstHistSecondsTimestamp, rejectCpsHistDaysUnitCount=rejectCpsHistDaysUnitCount, rejectEstHistSecondsUnitCount=rejectEstHistSecondsUnitCount, acceptEstHistSecondsGlobalID=acceptEstHistSecondsGlobalID, proxyConnHistHoursIndex=proxyConnHistHoursIndex, rejectEstHistSecondsGlobalID=rejectEstHistSecondsGlobalID, rejectSynHistMinutesTable=rejectSynHistMinutesTable, rejectSynHistSecondsIndex=rejectSynHistSecondsIndex, acceptCpsHistMinutesIndex=acceptCpsHistMinutesIndex, acceptEstHistMinutesTimestamp=acceptEstHistMinutesTimestamp, rejectEstHistDaysTimestamp=rejectEstHistDaysTimestamp, acceptCpsHistDaysGlobalID=acceptCpsHistDaysGlobalID, rejectCpsHistSecondsIndex=rejectCpsHistSecondsIndex, acceptCpsHistMinutesUnitCount=acceptCpsHistMinutesUnitCount, proxyConnHistMinutesUnitCount=proxyConnHistMinutesUnitCount, acceptCpsHistDaysEntry=acceptCpsHistDaysEntry, proxyConnHistMinutesEntry=proxyConnHistMinutesEntry, rejectCpsHistMinutesGlobalID=rejectCpsHistMinutesGlobalID, acceptEstHistHoursEntry=acceptEstHistHoursEntry, rejectEstHistHoursIndex=rejectEstHistHoursIndex, rejectSynHistMinutesGlobalID=rejectSynHistMinutesGlobalID, acceptCpsHistHoursTable=acceptCpsHistHoursTable, rejectEstHistDaysIndex=rejectEstHistDaysIndex, rejectSynHistSecondsTable=rejectSynHistSecondsTable, rejectEstHistSecondsTimestamp=rejectEstHistSecondsTimestamp, rejectSynHistDaysGlobalID=rejectSynHistDaysGlobalID, rejectEstHistHoursTimestamp=rejectEstHistHoursTimestamp, acceptCpsHistSecondsGlobalID=acceptCpsHistSecondsGlobalID, rejectCpsHistSecondsUnitCount=rejectCpsHistSecondsUnitCount, rejectSynHistHoursTimestamp=rejectSynHistHoursTimestamp, acceptEstHistMinutesTable=acceptEstHistMinutesTable, rejectSynHistDaysUnitCount=rejectSynHistDaysUnitCount, acceptEstHistMinutesUnitCount=acceptEstHistMinutesUnitCount, PYSNMP_MODULE_ID=tpt_ddos, rejectEstHistHoursUnitCount=rejectEstHistHoursUnitCount, rejectCpsHistSecondsEntry=rejectCpsHistSecondsEntry, proxyConnHistMinutesIndex=proxyConnHistMinutesIndex, rejectCpsHistHoursEntry=rejectCpsHistHoursEntry, rejectEstHistMinutesIndex=rejectEstHistMinutesIndex, acceptEstHistSecondsUnitCount=acceptEstHistSecondsUnitCount, rejectSynHistSecondsUnitCount=rejectSynHistSecondsUnitCount, rejectCpsHistMinutesIndex=rejectCpsHistMinutesIndex, acceptCpsHistMinutesTimestamp=acceptCpsHistMinutesTimestamp, rejectSynHistMinutesTimestamp=rejectSynHistMinutesTimestamp, rejectCpsHistMinutesTable=rejectCpsHistMinutesTable, rejectEstHistMinutesUnitCount=rejectEstHistMinutesUnitCount, rejectSynHistDaysTable=rejectSynHistDaysTable, proxyConnHistDaysTimestamp=proxyConnHistDaysTimestamp, acceptCpsHistSecondsTable=acceptCpsHistSecondsTable, acceptCpsHistDaysTimestamp=acceptCpsHistDaysTimestamp, acceptCpsHistSecondsTimestamp=acceptCpsHistSecondsTimestamp, acceptEstHistDaysIndex=acceptEstHistDaysIndex, rejectSynHistSecondsTimestamp=rejectSynHistSecondsTimestamp, rejectCpsHistMinutesEntry=rejectCpsHistMinutesEntry, rejectEstHistHoursTable=rejectEstHistHoursTable, rejectCpsHistMinutesTimestamp=rejectCpsHistMinutesTimestamp, proxyConnHistDaysIndex=proxyConnHistDaysIndex, acceptEstHistSecondsIndex=acceptEstHistSecondsIndex, rejectCpsHistMinutesUnitCount=rejectCpsHistMinutesUnitCount, proxyConnHistSecondsTable=proxyConnHistSecondsTable, acceptCpsHistDaysUnitCount=acceptCpsHistDaysUnitCount, rejectEstHistDaysUnitCount=rejectEstHistDaysUnitCount, rejectCpsHistHoursIndex=rejectCpsHistHoursIndex, proxyConnHistMinutesGlobalID=proxyConnHistMinutesGlobalID, tpt_ddos=tpt_ddos, proxyConnHistSecondsGlobalID=proxyConnHistSecondsGlobalID, rejectCpsHistHoursGlobalID=rejectCpsHistHoursGlobalID, proxyConnHistDaysUnitCount=proxyConnHistDaysUnitCount, acceptEstHistDaysEntry=acceptEstHistDaysEntry, rejectSynHistSecondsEntry=rejectSynHistSecondsEntry, acceptCpsHistHoursTimestamp=acceptCpsHistHoursTimestamp, rejectCpsHistSecondsGlobalID=rejectCpsHistSecondsGlobalID, rejectCpsHistHoursUnitCount=rejectCpsHistHoursUnitCount, proxyConnHistSecondsTimestamp=proxyConnHistSecondsTimestamp, acceptEstHistHoursUnitCount=acceptEstHistHoursUnitCount, rejectCpsHistDaysTable=rejectCpsHistDaysTable, rejectSynHistHoursIndex=rejectSynHistHoursIndex, proxyConnHistSecondsIndex=proxyConnHistSecondsIndex, acceptEstHistMinutesGlobalID=acceptEstHistMinutesGlobalID, acceptEstHistHoursTimestamp=acceptEstHistHoursTimestamp, rejectSynHistSecondsGlobalID=rejectSynHistSecondsGlobalID, rejectCpsHistDaysIndex=rejectCpsHistDaysIndex, rejectEstHistDaysGlobalID=rejectEstHistDaysGlobalID, rejectSynHistDaysEntry=rejectSynHistDaysEntry, rejectSynHistMinutesUnitCount=rejectSynHistMinutesUnitCount, rejectSynHistHoursEntry=rejectSynHistHoursEntry, proxyConnHistSecondsEntry=proxyConnHistSecondsEntry, rejectCpsHistHoursTable=rejectCpsHistHoursTable, rejectSynHistHoursTable=rejectSynHistHoursTable, rejectCpsHistDaysEntry=rejectCpsHistDaysEntry, acceptEstHistSecondsEntry=acceptEstHistSecondsEntry, rejectSynHistDaysTimestamp=rejectSynHistDaysTimestamp, rejectEstHistMinutesGlobalID=rejectEstHistMinutesGlobalID, acceptEstHistHoursIndex=acceptEstHistHoursIndex, rejectSynHistMinutesIndex=rejectSynHistMinutesIndex, rejectSynHistHoursGlobalID=rejectSynHistHoursGlobalID, rejectCpsHistHoursTimestamp=rejectCpsHistHoursTimestamp, proxyConnHistHoursTimestamp=proxyConnHistHoursTimestamp, acceptEstHistMinutesEntry=acceptEstHistMinutesEntry, proxyConnHistDaysEntry=proxyConnHistDaysEntry, acceptCpsHistSecondsIndex=acceptCpsHistSecondsIndex, rejectEstHistSecondsIndex=rejectEstHistSecondsIndex, proxyConnHistMinutesTable=proxyConnHistMinutesTable, rejectCpsHistDaysTimestamp=rejectCpsHistDaysTimestamp, proxyConnHistMinutesTimestamp=proxyConnHistMinutesTimestamp, rejectSynHistDaysIndex=rejectSynHistDaysIndex, proxyConnHistHoursUnitCount=proxyConnHistHoursUnitCount, rejectCpsHistSecondsTimestamp=rejectCpsHistSecondsTimestamp, acceptEstHistHoursTable=acceptEstHistHoursTable, proxyConnHistHoursTable=proxyConnHistHoursTable, proxyConnHistDaysTable=proxyConnHistDaysTable, acceptCpsHistMinutesTable=acceptCpsHistMinutesTable, acceptCpsHistHoursGlobalID=acceptCpsHistHoursGlobalID, acceptCpsHistHoursUnitCount=acceptCpsHistHoursUnitCount, rejectEstHistMinutesTimestamp=rejectEstHistMinutesTimestamp, acceptCpsHistMinutesEntry=acceptCpsHistMinutesEntry, rejectCpsHistDaysGlobalID=rejectCpsHistDaysGlobalID)
|
#
# PySNMP MIB module CNT251-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CNT251-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:09:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection")
cnt2CfgSystemProbe, = mibBuilder.importSymbols("CNT25-MIB", "cnt2CfgSystemProbe")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Bits, MibIdentifier, Unsigned32, IpAddress, ModuleIdentity, Integer32, iso, Counter64, NotificationType, Gauge32, Counter32, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "MibIdentifier", "Unsigned32", "IpAddress", "ModuleIdentity", "Integer32", "iso", "Counter64", "NotificationType", "Gauge32", "Counter32", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
cnt2SysChassisType = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 6, 12, 13, 14, 15, 16, 17))).clone(namedValues=NamedValues(("slot-2", 2), ("slot-6", 6), ("slot-12", 12), ("osg", 13), ("usg", 14), ("usd6", 15), ("usd12", 16), ("tm", 17)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysChassisType.setStatus('mandatory')
cnt2SysZachCardType = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("not-present", 1), ("rs232", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysZachCardType.setStatus('mandatory')
cnt2SysHmbFirmwareRevision = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysHmbFirmwareRevision.setStatus('mandatory')
cnt2SysScnrcVersion = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysScnrcVersion.setStatus('mandatory')
cnt2SysDatPresent = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysDatPresent.setStatus('mandatory')
cnt2SysCdRomPresent = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCdRomPresent.setStatus('mandatory')
cnt2SysProbeDateTime = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysProbeDateTime.setStatus('mandatory')
cnt2SysSlotCount = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysSlotCount.setStatus('mandatory')
cnt2SysPowerSupplyTable = MibTable((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 9), )
if mibBuilder.loadTexts: cnt2SysPowerSupplyTable.setStatus('mandatory')
cnt2SysPowerSupplyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 9, 1), ).setIndexNames((0, "CNT251-MIB", "cnt2SysPowerSupplyIndex"))
if mibBuilder.loadTexts: cnt2SysPowerSupplyEntry.setStatus('mandatory')
cnt2SysPowerSupplyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 9, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysPowerSupplyIndex.setStatus('mandatory')
cnt2SysPowerSupplyPresent = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 9, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysPowerSupplyPresent.setStatus('mandatory')
cnt2SysFanTable = MibTable((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 10), )
if mibBuilder.loadTexts: cnt2SysFanTable.setStatus('mandatory')
cnt2SysFanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 10, 1), ).setIndexNames((0, "CNT251-MIB", "cnt2SysFanIndex"))
if mibBuilder.loadTexts: cnt2SysFanEntry.setStatus('mandatory')
cnt2SysFanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 10, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysFanIndex.setStatus('mandatory')
cnt2SysFanPresent = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 10, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysFanPresent.setStatus('mandatory')
cnt2SysAdapterTable = MibTable((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11), )
if mibBuilder.loadTexts: cnt2SysAdapterTable.setStatus('mandatory')
cnt2SysAdapterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1), ).setIndexNames((0, "CNT251-MIB", "cnt2SysAdapterIndex"))
if mibBuilder.loadTexts: cnt2SysAdapterEntry.setStatus('mandatory')
cnt2SysAdapterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterIndex.setStatus('mandatory')
cnt2SysAdapterType = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("absent", 2), ("sparc", 3), ("escon", 4), ("ppc", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterType.setStatus('mandatory')
cnt2SysAdapterName = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15))).clone(namedValues=NamedValues(("absent", 1), ("unknown", 2), ("zsp1", 3), ("zen1", 4), ("zap1", 5), ("zsp2", 6), ("zen2", 7), ("zap2", 8), ("zen3", 9), ("usg1", 10), ("usg2", 11), ("zap3", 12), ("zap4", 13), ("zen4", 14), ("o1x1", 15)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterName.setStatus('mandatory')
cnt2SysAdapterPartNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterPartNumber.setStatus('mandatory')
cnt2SysAdapterSerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterSerialNumber.setStatus('mandatory')
cnt2SysAdapterHostId = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterHostId.setStatus('mandatory')
cnt2SysAdapterBoardRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterBoardRevision.setStatus('mandatory')
cnt2SysAdapterFirmwareMajorRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterFirmwareMajorRevision.setStatus('mandatory')
cnt2SysAdapterFirmwareMinorRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterFirmwareMinorRevision.setStatus('mandatory')
cnt2SysAdapterHostName = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 10), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterHostName.setStatus('mandatory')
cnt2SysAdapterOsName = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 11), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterOsName.setStatus('mandatory')
cnt2SysAdapterOsMajorVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterOsMajorVersion.setStatus('mandatory')
cnt2SysAdapterOsMinorVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterOsMinorVersion.setStatus('mandatory')
cnt2SysAdapterServiceMonitorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 11, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("primary", 2), ("secondary", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysAdapterServiceMonitorStatus.setStatus('mandatory')
cnt2SysBusTable = MibTable((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 12), )
if mibBuilder.loadTexts: cnt2SysBusTable.setStatus('mandatory')
cnt2SysBusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 12, 1), ).setIndexNames((0, "CNT251-MIB", "cnt2SysBusAdapterIndex"), (0, "CNT251-MIB", "cnt2SysBusIndex"))
if mibBuilder.loadTexts: cnt2SysBusEntry.setStatus('mandatory')
cnt2SysBusAdapterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 12, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysBusAdapterIndex.setStatus('mandatory')
cnt2SysBusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 12, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysBusIndex.setStatus('mandatory')
cnt2SysBusType = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 12, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("sbus", 2), ("pci", 3), ("vme", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysBusType.setStatus('mandatory')
cnt2SysCardTable = MibTable((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13), )
if mibBuilder.loadTexts: cnt2SysCardTable.setStatus('mandatory')
cnt2SysCardEntry = MibTableRow((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1), ).setIndexNames((0, "CNT251-MIB", "cnt2SysCardAdapterIndex"), (0, "CNT251-MIB", "cnt2SysCardBusIndex"), (0, "CNT251-MIB", "cnt2SysCardIndex"))
if mibBuilder.loadTexts: cnt2SysCardEntry.setStatus('mandatory')
cnt2SysCardAdapterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCardAdapterIndex.setStatus('mandatory')
cnt2SysCardBusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCardBusIndex.setStatus('mandatory')
cnt2SysCardIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCardIndex.setStatus('mandatory')
cnt2SysCardFunction = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("interface", 2), ("compression", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCardFunction.setStatus('mandatory')
cnt2SysCardFirmwareMajorRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCardFirmwareMajorRevision.setStatus('mandatory')
cnt2SysCardFirmwareMinorRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCardFirmwareMinorRevision.setStatus('mandatory')
cnt2SysCardVendorOctetString = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCardVendorOctetString.setStatus('mandatory')
cnt2SysCardVendorDisplayString = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 13, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysCardVendorDisplayString.setStatus('mandatory')
cnt2SysIfTable = MibTable((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14), )
if mibBuilder.loadTexts: cnt2SysIfTable.setStatus('mandatory')
cnt2SysIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1), ).setIndexNames((0, "CNT251-MIB", "cnt2SysIfAdapterIndex"), (0, "CNT251-MIB", "cnt2SysIfBusIndex"), (0, "CNT251-MIB", "cnt2SysIfIndex"))
if mibBuilder.loadTexts: cnt2SysIfEntry.setStatus('mandatory')
cnt2SysIfAdapterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysIfAdapterIndex.setStatus('mandatory')
cnt2SysIfBusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysIfBusIndex.setStatus('mandatory')
cnt2SysIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysIfIndex.setStatus('mandatory')
cnt2SysIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13))).clone(namedValues=NamedValues(("unknown", 1), ("ethernetCsmacd", 2), ("async", 3), ("escon", 4), ("atm", 5), ("fibreChannel", 6), ("scsi-2", 7), ("scsi-3", 8), ("ds3", 9), ("fddi", 10), ("fastEther", 11), ("isdn", 12), ("gigabitEthernet", 13)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysIfType.setStatus('mandatory')
cnt2SysIfCardIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysIfCardIndex.setStatus('mandatory')
cnt2SysIfName = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysIfName.setStatus('mandatory')
cnt2SysIfConnector = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("absent", 1), ("unknown", 2), ("micro-d15", 3), ("scsi-2", 4), ("scsi-3", 5), ("sc-duplex", 6), ("rj45", 7), ("bnc", 8), ("hssdc", 9), ("rsd-duplex", 10)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysIfConnector.setStatus('mandatory')
cnt2SysIfSnmpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 14, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysIfSnmpIndex.setStatus('mandatory')
cnt2SysSerialNumber = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 15), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysSerialNumber.setStatus('mandatory')
cnt2SysOsVersion = MibScalar((1, 3, 6, 1, 4, 1, 333, 2, 5, 1, 16), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cnt2SysOsVersion.setStatus('mandatory')
mibBuilder.exportSymbols("CNT251-MIB", cnt2SysZachCardType=cnt2SysZachCardType, cnt2SysBusTable=cnt2SysBusTable, cnt2SysAdapterEntry=cnt2SysAdapterEntry, cnt2SysCardFirmwareMinorRevision=cnt2SysCardFirmwareMinorRevision, cnt2SysFanIndex=cnt2SysFanIndex, cnt2SysChassisType=cnt2SysChassisType, cnt2SysFanPresent=cnt2SysFanPresent, cnt2SysIfEntry=cnt2SysIfEntry, cnt2SysIfConnector=cnt2SysIfConnector, cnt2SysBusType=cnt2SysBusType, cnt2SysFanEntry=cnt2SysFanEntry, cnt2SysAdapterType=cnt2SysAdapterType, cnt2SysCardBusIndex=cnt2SysCardBusIndex, cnt2SysSlotCount=cnt2SysSlotCount, cnt2SysAdapterTable=cnt2SysAdapterTable, cnt2SysPowerSupplyIndex=cnt2SysPowerSupplyIndex, cnt2SysAdapterName=cnt2SysAdapterName, cnt2SysProbeDateTime=cnt2SysProbeDateTime, cnt2SysCardIndex=cnt2SysCardIndex, cnt2SysAdapterFirmwareMinorRevision=cnt2SysAdapterFirmwareMinorRevision, cnt2SysIfAdapterIndex=cnt2SysIfAdapterIndex, cnt2SysOsVersion=cnt2SysOsVersion, cnt2SysIfType=cnt2SysIfType, cnt2SysPowerSupplyEntry=cnt2SysPowerSupplyEntry, cnt2SysCardEntry=cnt2SysCardEntry, cnt2SysAdapterOsMajorVersion=cnt2SysAdapterOsMajorVersion, cnt2SysCardVendorDisplayString=cnt2SysCardVendorDisplayString, cnt2SysCardVendorOctetString=cnt2SysCardVendorOctetString, cnt2SysCardFunction=cnt2SysCardFunction, cnt2SysDatPresent=cnt2SysDatPresent, cnt2SysAdapterFirmwareMajorRevision=cnt2SysAdapterFirmwareMajorRevision, cnt2SysIfBusIndex=cnt2SysIfBusIndex, cnt2SysPowerSupplyPresent=cnt2SysPowerSupplyPresent, cnt2SysAdapterHostId=cnt2SysAdapterHostId, cnt2SysAdapterBoardRevision=cnt2SysAdapterBoardRevision, cnt2SysIfName=cnt2SysIfName, cnt2SysCardFirmwareMajorRevision=cnt2SysCardFirmwareMajorRevision, cnt2SysAdapterSerialNumber=cnt2SysAdapterSerialNumber, cnt2SysFanTable=cnt2SysFanTable, cnt2SysBusIndex=cnt2SysBusIndex, cnt2SysIfSnmpIndex=cnt2SysIfSnmpIndex, cnt2SysAdapterOsMinorVersion=cnt2SysAdapterOsMinorVersion, cnt2SysAdapterIndex=cnt2SysAdapterIndex, cnt2SysAdapterServiceMonitorStatus=cnt2SysAdapterServiceMonitorStatus, cnt2SysBusAdapterIndex=cnt2SysBusAdapterIndex, cnt2SysSerialNumber=cnt2SysSerialNumber, cnt2SysPowerSupplyTable=cnt2SysPowerSupplyTable, cnt2SysCardTable=cnt2SysCardTable, cnt2SysAdapterHostName=cnt2SysAdapterHostName, cnt2SysScnrcVersion=cnt2SysScnrcVersion, cnt2SysBusEntry=cnt2SysBusEntry, cnt2SysCardAdapterIndex=cnt2SysCardAdapterIndex, cnt2SysIfIndex=cnt2SysIfIndex, cnt2SysHmbFirmwareRevision=cnt2SysHmbFirmwareRevision, cnt2SysAdapterOsName=cnt2SysAdapterOsName, cnt2SysIfCardIndex=cnt2SysIfCardIndex, cnt2SysCdRomPresent=cnt2SysCdRomPresent, cnt2SysIfTable=cnt2SysIfTable, cnt2SysAdapterPartNumber=cnt2SysAdapterPartNumber)
|
# Time: O(n)
# Space: O(h)
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def btreeGameWinningMove(self, root, n, x):
"""
:type root: TreeNode
:type n: int
:type x: int
:rtype: bool
"""
def count(node, x, left_right):
if not node:
return 0
left, right = count(node.left, x, left_right), count(node.right, x, left_right)
if node.val == x:
left_right[0], left_right[1] = left, right
return left + right + 1
left_right = [0, 0]
count(root, x, left_right)
blue = max(max(left_right), n-(sum(left_right)+1))
return blue > n-blue
|
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def sumNumbers(self, root):
"""
:type root: TreeNode
:rtype: int
"""
return self.dfs(root, 0)
def dfs(self, root, sum):
if not root:
return 0
sum = sum * 10 + root.val
if not root.left and not root.right:
return sum
return self.dfs(root.left, sum) + self.dfs(root.right, sum)
|
"""
Open511 Orlando
"""
# List of attribute keys which correspond to event descriptions
DESC = ('Closure', 'Location')
mapping = (
('event_type', 'type'),
('geometry', 'geometry')
)
class Event(object):
def __init__(self, data, source: str = 'cityoforlando.net'):
self.data = data
self.source = source
def dynamic(self) -> dict:
"""Returns dynamic data based on the given data"""
out = {}
for outkey, key in mapping:
if key in self.data:
out[outkey] = self.data[key]
# Parse attributes
if 'attributes' in self.data:
attrs = self.data['attributes']
for key in DESC:
if key in attrs:
out['description'] = attrs[key]
return out
def static(self) -> dict:
"""Returns static data based on the source"""
return {
'jurisdiction_url': f'/jurisdictions/{self.source}',
'status': 'ACTIVE'
}
def export(self) -> {str: object}:
"""Exports the Event in JSON compatible format"""
return {**self.static(), **self.dynamic()}
|
def sanitize(time_string):
if '-' in time_string:
splitter = '-'
elif ':' in time_string:
splitter = ':'
else:
return(time_string)
(mins, secs) = time_string.split(splitter)
return(mins + '.' + secs)
with open('james.txt') as jaf:
data = jaf.readline()
james = data.strip().split(',')
with open('julie.txt') as juf:
data = juf.readline()
julie = data.strip().split(',')
with open('mikey.txt') as mif:
data = mif.readline()
mikey = data.strip().split(',')
with open('sarah.txt') as saf:
data = saf.readline()
sarah = data.strip().split(',')
print(sorted(set([sanitize(t) for t in james]))[0:3])
print(sorted(set([sanitize(t) for t in julie]))[0:3])
print(sorted(set([sanitize(t) for t in mikey]))[0:3])
print(sorted(set([sanitize(t) for t in sarah]))[0:3])
|
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 19:36:03 2020
@author: Administrator
"""
"""
有一个由大小写字母组成的字符串,请对它进行重新组合,使得其中的所有小写字母排在大写字母的前面
(大写字母或小写字母之间不要求保持原来的次序)
"""
def SortStr(s):
i = 0 ; j = len(s) - 1
while i < j:
if s[i].isupper():
pass
else:
i += 1
if s[j].islower():
pass
else:
j -= 1
if s[i].isupper() and s[j].islower():
if j < len(s) - 1:
s = s[0:i] + s[j] + s[i+1:j] + s[i] + s[j+1:]
else:
s = s[0:i] + s[j] + s[i+1:j] + s[i]
i+=1 ; j-=1
return s
if __name__ == "__main__":
s = "AbcDefa"
s = SortStr(s)
print("The string after sorting is : " , s)
|
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://opensource.org/licenses/MIT
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.
"""
host_list_data = [
{
'InnerIP': '1.1.1.1',
'HostID': 'Host1',
'Source': 'Source1',
'SetID': 'Set1',
'SetName': 'SetName1',
'ModuleID': 'ModuleID1',
'ModuleName': 'ModuleName1',
},
{
'InnerIP': '2.2.2.2',
'HostID': 'Host2',
'Source': 'Source2',
'SetID': 'SetID2',
'SetName': 'SetName2',
'ModuleID': 'ModuleID2',
'ModuleName': 'ModuleName2',
}
]
def mock_get_client_by_user(username):
class MockCC(object):
def __init__(self, success):
self.success = success
def create_set(self, kwargs):
return {
'result': self.success,
'data': {'bk_set_id': 1},
'message': 'error'
}
def update_set(self, kwargs):
return {
'result': self.success,
'data': {},
'message': 'error'
}
def batch_delete_set(self, kwargs):
return {
'result': self.success,
'message': 'error'
}
def transfer_sethost_to_idle_module(self, kwargs):
return {
'result': self.success,
'message': 'error'
}
def update_module(self, kwargs):
return {
'result': self.success,
'message': 'error'
}
def search_biz_inst_topo(self, kwargs):
return {
'result': self.success,
'data': [
{
"default": 0,
"bk_obj_name": u"业务",
"bk_obj_id": "biz",
"child": [
{
"default": 0,
"bk_obj_name": u"集群",
"bk_obj_id": "set",
"child": [
{
"default": 0,
"bk_obj_name": u"模块",
"bk_obj_id": "module",
"bk_inst_id": 5,
"bk_inst_name": "test1"
},
{
"default": 0,
"bk_obj_name": u"模块",
"bk_obj_id": "module",
"bk_inst_id": 6,
"bk_inst_name": "test2"
},
{
"default": 0,
"bk_obj_name": u"模块",
"bk_obj_id": "module",
"bk_inst_id": 7,
"bk_inst_name": "test3"
},
],
"bk_inst_id": 3,
"bk_inst_name": "set2"
},
{
"default": 0,
"bk_obj_name": u"集群",
"bk_obj_id": "set",
"child": [
{
"default": 0,
"bk_obj_name": u"模块",
"bk_obj_id": "module",
"bk_inst_id": 8,
"bk_inst_name": "test1"
},
{
"default": 0,
"bk_obj_name": u"模块",
"bk_obj_id": "module",
"bk_inst_id": 9,
"bk_inst_name": "test2"
},
],
"bk_inst_id": 4,
"bk_inst_name": "set3"
},
],
"bk_inst_id": 2,
"bk_inst_name": u"蓝鲸"
}
],
'message': 'error'
}
def get_biz_internal_module(self, kwargs):
return {
'result': self.success,
'data': {
'bk_set_id': 2,
'bk_set_name': u'空闲机池',
'module': [
{
"default": 1,
"bk_obj_id": "module",
"bk_module_id": 3,
"bk_obj_name": u"模块",
"bk_module_name": u"空闲机"
},
{
"default": 1,
"bk_obj_id": "module",
"bk_module_id": 4,
"bk_obj_name": u"模块",
"bk_module_name": u"故障机"
}
],
},
'message': 'error'
}
def update_host(self, kwargs):
return {
'result': self.success,
'message': 'error'
}
def transfer_host_module(self, kwargs):
return {
'result': self.success,
'message': 'error'
}
def clone_host_property(self, kwargs):
return {
'result': self.success,
'message': 'error'
}
def transfer_host_to_faultmodule(self, kwargs):
return {
'result': self.success,
'message': 'error'
}
def search_host(self, kwargs):
info = [
{
'host': {
'bk_host_innerip': '1.1.1.1,1.1.1.2',
'bk_host_outerip': '1.1.1.1',
'bk_host_name': '1.1.1.1',
'bk_host_id': 1,
'bk_cloud_id': [{
'bk_obj_name': '',
'id': '0',
'bk_obj_id': 'plat',
'bk_obj_icon': '',
'bk_inst_id': 0,
'bk_inst_name': 'default area'
}]
},
'module': [
{
'bk_module_id': 3,
'bk_module_name': u"空闲机"
}
]
},
{
'host': {
'bk_host_innerip': '2.2.2.2',
'bk_host_outerip': '2.2.2.2',
'bk_host_name': '2.2.2.2',
'bk_host_id': 1,
'bk_cloud_id': [{
'bk_obj_name': '',
'id': '0',
'bk_obj_id': 'plat',
'bk_obj_icon': '',
'bk_inst_id': 0,
'bk_inst_name': 'default area'
}]
},
'module': [
{
'bk_module_id': 5,
'bk_module_name': 'test1'
}
]
}
]
if kwargs.get('condition', []):
for cond in kwargs['condition']:
if cond['bk_obj_id'] == 'module' and cond.get('condition') \
and cond['condition'][0]['operator'] == '$in':
in_module = set(cond['condition'][0]['value'])
info = [host for host in info
if (set([mod['bk_module_id'] for mod in host['module']]) & in_module)]
if cond['bk_obj_id'] == 'host' and cond.get('condition') \
and cond['condition'][0]['operator'] == '$in':
in_host = cond['condition'][0]['value']
info = [host for host in info
if [single_ip for single_ip in host['host']['bk_host_innerip'].split(',')
if single_ip in in_host]]
return {
'result': self.success,
'data': {
'info': info
},
'message': 'error'
}
def get_sets_by_property(self, kwargs):
return {
'result': self.success,
'data': [
{
'SetName': 'name1',
'SetID': '1'
},
{
'SetName': 'name2',
'SetID': '2'
}
],
'message': 'error'
}
def get_hosts_by_property(self, kwargs):
return {
'result': self.success,
'data': 'data',
'message': 'error'
}
def get_app_by_id(self, kwargs):
return {
'result': self.success,
'data': [
{
'role1': 'a,b,c,d',
'role2': 'e;f;g;h'
}
],
'message': 'get_app_by_id_message'
}
def get_app_host_list(self, kwargs):
return {
'result': self.success,
'data': host_list_data
}
class MockJOB(object):
def __init__(self, success):
self.success = success
self.result = {
'result': self.success,
'data': {
'job_instance_id': 1,
'job_instance_name': 'xx',
},
'message': 'error'
}
def execute_job(self, kwargs):
return self.result
def fast_push_file(self, kwargs):
return self.result
def fast_execute_script(self, kwargs):
return self.result
class MockCMSI(object):
def __init__(self, success):
self.success = success
self.result = {
'result': self.success,
'code': 0,
'message': 'error'
}
def send_weixin(self, kwargs):
return self.result
def send_mail(self, kwargs):
return self.result
def send_sms(self, kwargs):
return self.result
class MockGSE(object):
def __init__(self, success):
self.success = success
self.result = {
'result': self.success,
'code': 0,
'message': 'error'
}
def get_agent_status(self, kwargs):
return {
'result': self.success,
'data': {
'0:3.3.3.3': {
'ip': '3.3.3.3',
'bk_cloud_id': 0,
'bk_agent_alive': 1
}
},
'message': 'error'
}
class MockUser(object):
def __init__(self, username):
self.username = username
class MockClient(object):
def __init__(self, success):
self.ver = None
self.cc = MockCC(success)
self.job = MockJOB(success)
self.cmsi = MockCMSI(success)
self.gse = MockGSE(success)
self.user = MockUser('admin')
def set_bk_api_ver(self, ver):
self.ver = ver
return MockClient(mock_get_client_by_user.success)
mock_get_client_by_request = mock_get_client_by_user
|
def top3(products, amounts, prices):
revenue_index_product = [ (amo*pri,-idx,pro) for (pro,amo,pri,idx) in zip(products,amounts,prices,range(len(prices))) ]
revenue_index_product = sorted(revenue_index_product, reverse=True )
return [ pro for (rev,idx,pro) in revenue_index_product[0:3] ]
|
__all__ = [ 'XDict' ]
class XDict(dict):
__slots__ = ()
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
__getitem__ = dict.get
__getattr__ = dict.get
__getnewargs__ = lambda self: getattr(dict,self).__getnewargs__(self)
__repr__ = lambda self: '<XDict %s>' % dict.__repr__(self)
__getstate__ = lambda self: None
__copy__ = lambda self: Storage(self)
|
class Node:
def __init__(self, data = None, next = None):
self.data = data
self.next = next
def setNext(self,next):
self.next=next
def setData(self, data):
self.data=data
class LinkedList:
def __init__(self):
self.head = None
def add(self, data):
if self.head==None:
self.head=Node(data=data,next=None)
else:
temp=self.head
while temp.next!=None:
temp=temp.next
nuevo=Node(data=data,next=None)
temp.setNext(nuevo)
def delete(self, key):
temp = self.head
prev = None
while temp.next!= None and temp.data != key:
prev = temp
temp = temp.next
if prev is None:
self.head = temp.next
elif temp:
prev.next = temp.next
temp.next = None
def search(self,key):
temp=self.head
while temp.next!=None and temp.data!=key:
temp=temp.next
return temp
def print(self):
temp = self.head
while temp.next != None:
print(temp.data, end =" => ")
temp =temp.next
def replace(self,data,index):
temp=self.head
count=0
while temp.next!=None and count<index:
temp=temp.next
temp.setData(data)
|
class cached_property(object):
"""
Decorator that creates converts a method with a single
self argument into a property cached on the instance.
"""
def __init__(self, func):
self.func = func
self.__doc__ = getattr(func, '__doc__')
def __get__(self, instance, type):
res = instance.__dict__[self.func.__name__] = self.func(instance)
return res
|
AddrSize = 8
Out = open("Template.txt", "w")
Out.write(">->+\n[>\n" + ">" * AddrSize + "+" + "<" * AddrSize + "\n\n")
def Mark(C, L):
if C == L:
Out.write("\t" * 0 + "[-\n")
Out.write("\t" * 0 + "#\n")
Out.write("\t" * 0 + "]\n")
return
Out.write("\t" * 0 + "[>\n")
Mark(C+1, L)
Out.write("\t" * 0 + "]>\n")
Mark(C+1, L)
Mark(0,AddrSize)
Out.write("+[-<+]-\n>]")
Out.close()
|
length = int(input())
width = int(input())
height = int(input())
occupied = float(input())
occupied_percent = occupied / 100
full_capacity = length * width * height
occupied_total = occupied_percent * full_capacity
remaining = full_capacity - occupied_total
capacity_in_dm = remaining / 1000
water = capacity_in_dm
print(water)
|
module_id = 'gl'
report_name = 'tb_bf_maj'
table_name = 'gl_totals'
report_type = 'bf_cf'
groups = []
groups.append([
'code', # dim
['code_maj', []], # grp_name, filter
])
include_zeros = True
# allow_select_loc_fun = True
expand_subledg = True
columns = [
['op_date', 'op_date', 'Op date', 'DTE', 85, None, 'Total:'],
['cl_date', 'cl_date', 'Cl date', 'DTE', 85, None, False],
['code_maj', 'code_maj', 'Maj', 'TEXT', 80, None, False],
['op_bal', 'op_bal', 'Op bal', 'DEC', 100, None, True],
['mvmt', 'cl_bal - op_bal', 'Mvmt', 'DEC', 100, None, True],
['cl_bal', 'cl_bal', 'Cl bal', 'DEC', 100, None, True],
]
|
"""
class TestNewOffsets(unittest.TestCase):
def test_yearoffset(self):
off = lib.YearOffset(dayoffset=0, biz=0, anchor=datetime(2002,1,1))
for i in range(500):
t = lib.Timestamp(off.ts)
self.assert_(t.day == 1)
self.assert_(t.month == 1)
self.assert_(t.year == 2002 + i)
next(off)
for i in range(499, -1, -1):
off.prev()
t = lib.Timestamp(off.ts)
self.assert_(t.day == 1)
self.assert_(t.month == 1)
self.assert_(t.year == 2002 + i)
off = lib.YearOffset(dayoffset=-1, biz=0, anchor=datetime(2002,1,1))
for i in range(500):
t = lib.Timestamp(off.ts)
self.assert_(t.month == 12)
self.assert_(t.day == 31)
self.assert_(t.year == 2001 + i)
next(off)
for i in range(499, -1, -1):
off.prev()
t = lib.Timestamp(off.ts)
self.assert_(t.month == 12)
self.assert_(t.day == 31)
self.assert_(t.year == 2001 + i)
off = lib.YearOffset(dayoffset=-1, biz=-1, anchor=datetime(2002,1,1))
stack = []
for i in range(500):
t = lib.Timestamp(off.ts)
stack.append(t)
self.assert_(t.month == 12)
self.assert_(t.day == 31 or t.day == 30 or t.day == 29)
self.assert_(t.year == 2001 + i)
self.assert_(t.weekday() < 5)
next(off)
for i in range(499, -1, -1):
off.prev()
t = lib.Timestamp(off.ts)
self.assert_(t == stack.pop())
self.assert_(t.month == 12)
self.assert_(t.day == 31 or t.day == 30 or t.day == 29)
self.assert_(t.year == 2001 + i)
self.assert_(t.weekday() < 5)
def test_monthoffset(self):
off = lib.MonthOffset(dayoffset=0, biz=0, anchor=datetime(2002,1,1))
for i in range(12):
t = lib.Timestamp(off.ts)
self.assert_(t.day == 1)
self.assert_(t.month == 1 + i)
self.assert_(t.year == 2002)
next(off)
for i in range(11, -1, -1):
off.prev()
t = lib.Timestamp(off.ts)
self.assert_(t.day == 1)
self.assert_(t.month == 1 + i)
self.assert_(t.year == 2002)
off = lib.MonthOffset(dayoffset=-1, biz=0, anchor=datetime(2002,1,1))
for i in range(12):
t = lib.Timestamp(off.ts)
self.assert_(t.day >= 28)
self.assert_(t.month == (12 if i == 0 else i))
self.assert_(t.year == 2001 + (i != 0))
next(off)
for i in range(11, -1, -1):
off.prev()
t = lib.Timestamp(off.ts)
self.assert_(t.day >= 28)
self.assert_(t.month == (12 if i == 0 else i))
self.assert_(t.year == 2001 + (i != 0))
off = lib.MonthOffset(dayoffset=-1, biz=-1, anchor=datetime(2002,1,1))
stack = []
for i in range(500):
t = lib.Timestamp(off.ts)
stack.append(t)
if t.month != 2:
self.assert_(t.day >= 28)
else:
self.assert_(t.day >= 26)
self.assert_(t.weekday() < 5)
next(off)
for i in range(499, -1, -1):
off.prev()
t = lib.Timestamp(off.ts)
self.assert_(t == stack.pop())
if t.month != 2:
self.assert_(t.day >= 28)
else:
self.assert_(t.day >= 26)
self.assert_(t.weekday() < 5)
for i in (-2, -1, 1, 2):
for j in (-1, 0, 1):
off1 = lib.MonthOffset(dayoffset=i, biz=j, stride=12,
anchor=datetime(2002,1,1))
off2 = lib.YearOffset(dayoffset=i, biz=j,
anchor=datetime(2002,1,1))
for k in range(500):
self.assert_(off1.ts == off2.ts)
next(off1)
next(off2)
for k in range(500):
self.assert_(off1.ts == off2.ts)
off1.prev()
off2.prev()
def test_dayoffset(self):
off = lib.DayOffset(biz=0, anchor=datetime(2002,1,1))
us_in_day = 1e6 * 60 * 60 * 24
t0 = lib.Timestamp(off.ts)
for i in range(500):
next(off)
t1 = lib.Timestamp(off.ts)
self.assert_(t1.value - t0.value == us_in_day)
t0 = t1
t0 = lib.Timestamp(off.ts)
for i in range(499, -1, -1):
off.prev()
t1 = lib.Timestamp(off.ts)
self.assert_(t0.value - t1.value == us_in_day)
t0 = t1
off = lib.DayOffset(biz=1, anchor=datetime(2002,1,1))
t0 = lib.Timestamp(off.ts)
for i in range(500):
next(off)
t1 = lib.Timestamp(off.ts)
self.assert_(t1.weekday() < 5)
self.assert_(t1.value - t0.value == us_in_day or
t1.value - t0.value == 3 * us_in_day)
t0 = t1
t0 = lib.Timestamp(off.ts)
for i in range(499, -1, -1):
off.prev()
t1 = lib.Timestamp(off.ts)
self.assert_(t1.weekday() < 5)
self.assert_(t0.value - t1.value == us_in_day or
t0.value - t1.value == 3 * us_in_day)
t0 = t1
def test_dayofmonthoffset(self):
for week in (-1, 0, 1):
for day in (0, 2, 4):
off = lib.DayOfMonthOffset(week=-1, day=day,
anchor=datetime(2002,1,1))
stack = []
for i in range(500):
t = lib.Timestamp(off.ts)
stack.append(t)
self.assert_(t.weekday() == day)
next(off)
for i in range(499, -1, -1):
off.prev()
t = lib.Timestamp(off.ts)
self.assert_(t == stack.pop())
self.assert_(t.weekday() == day)
"""
|
class Calculator:
def __init__(self):
self.result = 0
def adder(self, num):
self.result += num
return self.result
cal1 = Calculator()
cal2 = Calculator()
print(cal1.adder(3)) # 3
print(cal1.adder(5)) # 8
print(cal2.adder(3)) # 3
print(cal2.adder(7)) # 10
# Empty Class
class Simple:
pass
# Variable
class Service:
text = "Hello world"
service = Service()
print(service.text) # Hello world
class Service2:
def __init__(self, name):
self.name = name
service2=Service2("hi")
print(service2.name) # hi
############
# inherit
class Car:
def __init__(self, sun_roof):
self.sun_roof = sun_roof
def drive(self):
print("Drive")
class Sonata(Car):
name = "sonata"
sonata=Sonata("Sun roof")
sonata.drive()
print(sonata.name, sonata.sun_roof)
# Drive
# sonata Sun roof
############
#############
# Overriding
class Genesis(Car):
def drive(self):
print("Genesis Drive")
genesis=Genesis("SunRoof")
genesis.drive() # Genesis Drive
#############
#############
# Operator overloading
class Pride(Car):
def __add__(self, other):
self.drive()
other.drive()
def __sub__(self, other):
return
def __mul__(self, other):
return
def __truediv__(self, other):
return
pride = Pride("SunRoof")
pride + genesis
# Drive
# Genesis Drive
#############
|
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-09-03 16:21:08
# Description:
class Solution:
def cloneGraph(self, node: 'Node') -> 'Node':
if not node:
return node
m = {node: Node(node.val)}
stack = [node]
while stack:
n = stack.pop()
for neigh in n.neighbors:
if neigh not in m:
stack.append(neigh)
m[neigh] = Node(neigh.val)
m[n].neighbors.append(m[neigh])
return m[node]
if __name__ == "__main__":
pass
|
N=int(input())
A=[int(input()) for i in range(N)]
B={a:i for (i,a) in enumerate(sorted(set(A)))}
for a in A:
print(B[a])
|
# List of strings/words
words = input().split()
word_one = words[0]
word_two = words[1]
total_sum = 0
shorter_word_length = min(len(word_one), len(word_two))
# Process shorter string
for i in range(shorter_word_length):
word_one_current = word_one[i]
word_two_current = word_two[i]
ch_multiplication = ord(word_one_current) * ord(word_two_current)
total_sum += ch_multiplication
# If the string have different lengths, we have to process characters of the longer one
longer_word_length = max(len(word_one), len(word_two))
for i in range(shorter_word_length, longer_word_length):
if len(word_one) > len(word_two):
current_word_char = word_one[i]
else:
current_word_char = word_two[i]
total_sum += ord(current_word_char)
print(total_sum)
|
class SomeClass:
pass
def simple_read_write():
x = SomeClass() # $tracked=foo
x.foo = tracked # $tracked tracked=foo
y = x.foo # $tracked=foo tracked
do_stuff(y) # $tracked
def foo():
x = SomeClass() # $tracked=attr
bar(x) # $tracked=attr
x.attr = tracked # $tracked=attr tracked
baz(x) # $tracked=attr
def bar(x): # $tracked=attr
z = x.attr # $tracked tracked=attr
do_stuff(z) # $tracked
def expects_int(x): # $int=field SPURIOUS: str=field
do_int_stuff(x.field) # $int int=field SPURIOUS: str str=field
def expects_string(x): # $ str=field SPURIOUS: int=field
do_string_stuff(x.field) # $str str=field SPURIOUS: int int=field
def test_incompatible_types():
x = SomeClass() # $int,str=field
x.field = int(5) # $int=field int SPURIOUS: str=field
expects_int(x) # $int=field SPURIOUS: str=field
x.field = str("Hello") # $str=field str SPURIOUS: int=field
expects_string(x) # $ str=field SPURIOUS: int=field
# set in different function
def set_foo(some_class_instance): # $ tracked=foo
some_class_instance.foo = tracked # $ tracked=foo tracked
def test_set_x():
x = SomeClass() # $ MISSING: tracked=foo
set_foo(x) # $ MISSING: tracked=foo
print(x.foo) # $ MISSING: tracked=foo tracked
# return from a different function
def create_with_foo():
x = SomeClass() # $ tracked=foo
x.foo = tracked # $ tracked=foo tracked
return x # $ tracked=foo
def test_create_with_foo():
x = create_with_foo() # $ tracked=foo
print(x.foo) # $ tracked=foo tracked
# ------------------------------------------------------------------------------
# Attributes assigned statically to a class
# ------------------------------------------------------------------------------
class MyClass: # $tracked=field
field = tracked # $tracked
lookup = MyClass.field # $tracked tracked=field
instance = MyClass() # $tracked=field
lookup2 = instance.field # MISSING: tracked
# ------------------------------------------------------------------------------
# Dynamic attribute access
# ------------------------------------------------------------------------------
# Via `getattr`/`setattr`
def setattr_immediate_write():
x = SomeClass() # $tracked=foo
setattr(x,"foo", tracked) # $tracked tracked=foo
y = x.foo # $tracked tracked=foo
do_stuff(y) # $tracked
def getattr_immediate_read():
x = SomeClass() # $tracked=foo
x.foo = tracked # $tracked tracked=foo
y = getattr(x,"foo") # $tracked tracked=foo
do_stuff(y) # $tracked
def setattr_indirect_write():
attr = "foo"
x = SomeClass() # $tracked=foo
setattr(x, attr, tracked) # $tracked tracked=foo
y = x.foo # $tracked tracked=foo
do_stuff(y) # $tracked
def getattr_indirect_read():
attr = "foo"
x = SomeClass() # $tracked=foo
x.foo = tracked # $tracked tracked=foo
y = getattr(x, attr) #$tracked tracked=foo
do_stuff(y) # $tracked
# Via `__dict__` -- not currently implemented.
def dunder_dict_immediate_write():
x = SomeClass() # $ MISSING: tracked=foo
x.__dict__["foo"] = tracked # $tracked MISSING: tracked=foo
y = x.foo # $ MISSING: tracked tracked=foo
do_stuff(y) # $ MISSING: tracked
def dunder_dict_immediate_read():
x = SomeClass() # $tracked=foo
x.foo = tracked # $tracked tracked=foo
y = x.__dict__["foo"] # $ tracked=foo MISSING: tracked
do_stuff(y) # $ MISSING: tracked
def dunder_dict_indirect_write():
attr = "foo"
x = SomeClass() # $ MISSING: tracked=foo
x.__dict__[attr] = tracked # $tracked MISSING: tracked=foo
y = x.foo # $ MISSING: tracked tracked=foo
do_stuff(y) # $ MISSING: tracked
def dunder_dict_indirect_read():
attr = "foo"
x = SomeClass() # $tracked=foo
x.foo = tracked # $tracked tracked=foo
y = x.__dict__[attr] # $ tracked=foo MISSING: tracked
do_stuff(y) # $ MISSING: tracked
# ------------------------------------------------------------------------------
# Tracking of attribute on class instance
# ------------------------------------------------------------------------------
# attribute set in method
# inspired by https://github.com/github/codeql/pull/6023
class MyClass2(object):
def __init__(self): # $ tracked=foo
self.foo = tracked # $ tracked=foo tracked
def print_foo(self): # $ MISSING: tracked=foo
print(self.foo) # $ MISSING: tracked=foo tracked
def possibly_uncalled_method(self): # $ MISSING: tracked=foo
print(self.foo) # $ MISSING: tracked=foo tracked
instance = MyClass2()
print(instance.foo) # $ MISSING: tracked=foo tracked
instance.print_foo() # $ MISSING: tracked=foo
# attribute set from outside of class
class MyClass3(object):
def print_self(self): # $ tracked=foo
print(self) # $ tracked=foo
def print_foo(self): # $ tracked=foo
print(self.foo) # $ tracked=foo tracked
def possibly_uncalled_method(self): # $ MISSING: tracked=foo
print(self.foo) # $ MISSING: tracked=foo tracked
instance = MyClass3() # $ tracked=foo
instance.print_self() # $ tracked=foo
instance.foo = tracked # $ tracked=foo tracked
instance.print_foo() # $ tracked=foo
|
def solution(n: int):
answer = 0
i = 1
while i * i < n + 1:
if n % i == 0:
if i == n // i:
answer += i
else:
answer += i + n // i
i += 1
return answer
if __name__ == "__main__":
i = 25
print(solution(i))
|
"""
Entradas
Horas trabajadas-->float-->ht
Pago por hora-->float-->ph
Salidas
Pago junto con la horas-->float-->pa=ht*ph
Descuento por los impuestos-->float-->des1=pa*0.20 y des2=pa-des1
"""
ht=float(input("Digite las horas que ha trabajado: "))
ph=float(input("Digite el pago por hora: "))
pa=ht*ph
des1=pa*0.20
des2=pa-des1
print("El pago que le daran es de: ", des2)
|
qst_deliver_message = 0
qst_deliver_message_to_enemy_lord = 1
qst_raise_troops = 2
qst_escort_lady = 3
qst_deal_with_bandits_at_lords_village = 4
qst_collect_taxes = 5
qst_hunt_down_fugitive = 6
qst_kill_local_merchant = 7
qst_bring_back_runaway_serfs = 8
qst_follow_spy = 9
qst_capture_enemy_hero = 10
qst_lend_companion = 11
qst_collect_debt = 12
qst_incriminate_loyal_commander = 13
qst_meet_spy_in_enemy_town = 14
qst_capture_prisoners = 15
qst_lend_surgeon = 16
qst_follow_army = 17
qst_report_to_army = 18
qst_deliver_cattle_to_army = 19
qst_join_siege_with_army = 20
qst_screen_army = 21
qst_scout_waypoints = 22
qst_rescue_lord_by_replace = 23
qst_deliver_message_to_prisoner_lord = 24
qst_duel_for_lady = 25
qst_duel_courtship_rival = 26
qst_duel_avenge_insult = 27
qst_move_cattle_herd = 28
qst_escort_merchant_caravan = 29
qst_deliver_wine = 30
qst_troublesome_bandits = 31
qst_kidnapped_girl = 32
qst_persuade_lords_to_make_peace = 33
qst_deal_with_looters = 34
qst_deal_with_night_bandits = 35
qst_deliver_grain = 36
qst_deliver_cattle = 37
qst_train_peasants_against_bandits = 38
qst_eliminate_bandits_infesting_village = 39
qst_visit_lady = 40
qst_formal_marriage_proposal = 41
qst_obtain_liege_blessing = 42
qst_wed_betrothed = 43
qst_wed_betrothed_female = 44
qst_join_faction = 45
qst_rebel_against_kingdom = 46
qst_consult_with_minister = 47
qst_organize_feast = 48
qst_resolve_dispute = 49
qst_offer_gift = 50
qst_denounce_lord = 51
qst_intrigue_against_lord = 52
qst_track_down_bandits = 53
qst_track_down_provocateurs = 54
qst_retaliate_for_border_incident = 55
qst_raid_caravan_to_start_war = 56
qst_cause_provocation = 57
qst_rescue_prisoner = 58
qst_destroy_bandit_lair = 59
qst_blank_quest_2 = 60
qst_blank_quest_3 = 61
qst_blank_quest_4 = 62
qst_blank_quest_5 = 63
qst_blank_quest_6 = 64
qst_blank_quest_7 = 65
qst_blank_quest_8 = 66
qst_blank_quest_9 = 67
qst_blank_quest_10 = 68
qst_blank_quest_11 = 69
qst_blank_quest_12 = 70
qst_blank_quest_13 = 71
qst_blank_quest_14 = 72
qst_blank_quest_15 = 73
qst_blank_quest_16 = 74
qst_blank_quest_17 = 75
qst_blank_quest_18 = 76
qst_blank_quest_19 = 77
qst_blank_quest_20 = 78
qst_blank_quest_21 = 79
qst_blank_quest_22 = 80
qst_blank_quest_23 = 81
qst_blank_quest_24 = 82
qst_blank_quest_25 = 83
qst_blank_quest_26 = 84
qst_blank_quest_27 = 85
qst_collect_men = 86
qst_learn_where_merchant_brother_is = 87
qst_save_relative_of_merchant = 88
qst_save_town_from_bandits = 89
qst_quests_end = 90
qsttag_deliver_message = 504403158265495552
qsttag_deliver_message_to_enemy_lord = 504403158265495553
qsttag_raise_troops = 504403158265495554
qsttag_escort_lady = 504403158265495555
qsttag_deal_with_bandits_at_lords_village = 504403158265495556
qsttag_collect_taxes = 504403158265495557
qsttag_hunt_down_fugitive = 504403158265495558
qsttag_kill_local_merchant = 504403158265495559
qsttag_bring_back_runaway_serfs = 504403158265495560
qsttag_follow_spy = 504403158265495561
qsttag_capture_enemy_hero = 504403158265495562
qsttag_lend_companion = 504403158265495563
qsttag_collect_debt = 504403158265495564
qsttag_incriminate_loyal_commander = 504403158265495565
qsttag_meet_spy_in_enemy_town = 504403158265495566
qsttag_capture_prisoners = 504403158265495567
qsttag_lend_surgeon = 504403158265495568
qsttag_follow_army = 504403158265495569
qsttag_report_to_army = 504403158265495570
qsttag_deliver_cattle_to_army = 504403158265495571
qsttag_join_siege_with_army = 504403158265495572
qsttag_screen_army = 504403158265495573
qsttag_scout_waypoints = 504403158265495574
qsttag_rescue_lord_by_replace = 504403158265495575
qsttag_deliver_message_to_prisoner_lord = 504403158265495576
qsttag_duel_for_lady = 504403158265495577
qsttag_duel_courtship_rival = 504403158265495578
qsttag_duel_avenge_insult = 504403158265495579
qsttag_move_cattle_herd = 504403158265495580
qsttag_escort_merchant_caravan = 504403158265495581
qsttag_deliver_wine = 504403158265495582
qsttag_troublesome_bandits = 504403158265495583
qsttag_kidnapped_girl = 504403158265495584
qsttag_persuade_lords_to_make_peace = 504403158265495585
qsttag_deal_with_looters = 504403158265495586
qsttag_deal_with_night_bandits = 504403158265495587
qsttag_deliver_grain = 504403158265495588
qsttag_deliver_cattle = 504403158265495589
qsttag_train_peasants_against_bandits = 504403158265495590
qsttag_eliminate_bandits_infesting_village = 504403158265495591
qsttag_visit_lady = 504403158265495592
qsttag_formal_marriage_proposal = 504403158265495593
qsttag_obtain_liege_blessing = 504403158265495594
qsttag_wed_betrothed = 504403158265495595
qsttag_wed_betrothed_female = 504403158265495596
qsttag_join_faction = 504403158265495597
qsttag_rebel_against_kingdom = 504403158265495598
qsttag_consult_with_minister = 504403158265495599
qsttag_organize_feast = 504403158265495600
qsttag_resolve_dispute = 504403158265495601
qsttag_offer_gift = 504403158265495602
qsttag_denounce_lord = 504403158265495603
qsttag_intrigue_against_lord = 504403158265495604
qsttag_track_down_bandits = 504403158265495605
qsttag_track_down_provocateurs = 504403158265495606
qsttag_retaliate_for_border_incident = 504403158265495607
qsttag_raid_caravan_to_start_war = 504403158265495608
qsttag_cause_provocation = 504403158265495609
qsttag_rescue_prisoner = 504403158265495610
qsttag_destroy_bandit_lair = 504403158265495611
qsttag_blank_quest_2 = 504403158265495612
qsttag_blank_quest_3 = 504403158265495613
qsttag_blank_quest_4 = 504403158265495614
qsttag_blank_quest_5 = 504403158265495615
qsttag_blank_quest_6 = 504403158265495616
qsttag_blank_quest_7 = 504403158265495617
qsttag_blank_quest_8 = 504403158265495618
qsttag_blank_quest_9 = 504403158265495619
qsttag_blank_quest_10 = 504403158265495620
qsttag_blank_quest_11 = 504403158265495621
qsttag_blank_quest_12 = 504403158265495622
qsttag_blank_quest_13 = 504403158265495623
qsttag_blank_quest_14 = 504403158265495624
qsttag_blank_quest_15 = 504403158265495625
qsttag_blank_quest_16 = 504403158265495626
qsttag_blank_quest_17 = 504403158265495627
qsttag_blank_quest_18 = 504403158265495628
qsttag_blank_quest_19 = 504403158265495629
qsttag_blank_quest_20 = 504403158265495630
qsttag_blank_quest_21 = 504403158265495631
qsttag_blank_quest_22 = 504403158265495632
qsttag_blank_quest_23 = 504403158265495633
qsttag_blank_quest_24 = 504403158265495634
qsttag_blank_quest_25 = 504403158265495635
qsttag_blank_quest_26 = 504403158265495636
qsttag_blank_quest_27 = 504403158265495637
qsttag_collect_men = 504403158265495638
qsttag_learn_where_merchant_brother_is = 504403158265495639
qsttag_save_relative_of_merchant = 504403158265495640
qsttag_save_town_from_bandits = 504403158265495641
qsttag_quests_end = 504403158265495642
|
class Chair:
"""Create a chair
Parameters
----------
chair_name : str
The name of the chair
professor: str
The name of the professor
employees : {array-like of shape (n,), []}, default=[]
List of all employees of the chair
See Also
--------
Employee
Notes
-----
Here you can add some notes
References
----------
.. [1] Add references here
Examples
--------
>>> from MyPackage.base import Employee, Chair
>>> andreas = Employee("Andreas","100")
>>> bwl11 = Chair("BWL11", "Richard", [andreas])
>>> bwl11.displayEmployees()
>>> niko = Employee("Niko",300)
>>> bwl11.hire_employee(niko)
>>> bwl11.displayEmployees()
"""
def __init__(self,
chair_name,
professor,
employees=[]):
self.chair_name = chair_name
self.professor = professor
self.employees = employees
def fire_employee(self, employee):
"""Fire employee
Parameters:
-----------
employee: employee
The employee to fire
"""
if employee in self.employees:
self.employees.remove(employee)
else:
print("There is not such a employee ")
def hire_employee(self, employee):
"""Hire employee
Parameters:
-----------
employee: employee
The employee to hire
"""
self.employees.append(employee)
def displayEmployees(self):
"""Display all employees"""
for employee in self.employees:
employee.displayEmployee()
class Employee:
"""Create a chair
Parameters
----------
name : str
The name of the employee
salary: int
The salary of the employee
See Also
--------
Chair
Notes
-----
Here you can add some notes
References
----------
.. [1] Add references here
Examples
--------
>>> from MyPackage.base import Employee
>>> andreas = Employee("Andreas","100")
>>> andreas.displayEmployee()
"""
def __init__(self, name, salary):
self.name = name
self.salary = salary
def displayEmployee(self):
"""Display employee"""
print("Name : ", self.name, ", Salary: ", self.salary)
|
# Aluguel de carros
k= (float(input('Total kilometragem percorrida: ')))
a= (int(input('Total de dias alugado: ')))
kr= (float(input('Valor por kilometro rodado: R$ ')))
ad = (float(input('Valor do dia de aluguel: R$ ')))
tk = k*kr # total de kilometros rodados
ta = a * ad # total dias de aluguel
total = tk + ta
print(f'Total a pagar por {k:.2f} kilometros rodados + {a} dias de aluguel: R$ {total:.2f}')
|
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"dimension": "00_core.ipynb",
"reshaped": "00_core.ipynb",
"show": "00_core.ipynb",
"makeThreatenedSquares": "00_core.ipynb",
"defence": "00_core.ipynb",
"attack": "00_core.ipynb",
"fetch": "01_data.ipynb",
"Game": "01_data.ipynb",
"fromGame": "01_data.ipynb",
"games": "01_data.ipynb",
"MoveSequencerResult": "01_data.ipynb",
"makeMoveSequencer": "01_data.ipynb",
"diffReduce": "01_data.ipynb",
"countZeros": "01_data.ipynb",
"makeDiffReduceAnalyzer": "01_data.ipynb",
"zerosDiffReduce": "01_data.ipynb",
"showGameUi": "02_ui.ipynb",
"download": "03_stockfish.ipynb",
"extract": "03_stockfish.ipynb",
"makeEngine": "03_stockfish.ipynb",
"playGame": "03_stockfish.ipynb",
"Processor": "04_processor.ipynb"}
modules = ["core.py",
"data.py",
"ui.py",
"stockfish.py",
"processor.py"]
doc_url = "https://mikhas.github.io/cheviz/"
git_url = "https://github.com/mikhas/cheviz/tree/master/"
def custom_doc_links(name): return None
|
# This file was generated by the "capture_real_responses.py" script.
# On Wed, 20 Nov 2019 19:34:18 +0000.
#
# To update it run:
# python -m tests.providers.capture_real_responses
captured_responses = [
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>01001000</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro>S\xe9</bairro><cep>01001000</cep><cidade>S\xe3o Paulo</cidade><complemento2>- lado \xedmpar</complemento2><end>Pra\xe7a da S\xe9</end><uf>SP</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=01001000&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"resultado":"1","resultado_txt":"sucesso - cep completo","uf":"SP","cidade":"S\\u00e3o Paulo","bairro":"S\\u00e9","tipo_logradouro":"Pra\\u00e7a","logradouro":"da S\\u00e9"}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/01001000/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "01001-000",\n "logradouro": "Pra\\u00e7a da S\\u00e9",\n "complemento": "lado \\u00edmpar",\n "bairro": "S\\u00e9",\n "localidade": "S\\u00e3o Paulo",\n "uf": "SP",\n "unidade": "",\n "ibge": "3550308",\n "gia": "1004"\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>57010240</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro>Prado</bairro><cep>57010240</cep><cidade>Macei\xf3</cidade><complemento2></complemento2><end>Rua Desembargador Inoc\xeancio Lins</end><uf>AL</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=57010240&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"resultado":"1","resultado_txt":"sucesso - cep completo","uf":"AL","cidade":"Macei\\u00f3","bairro":"Prado","tipo_logradouro":"Rua","logradouro":"Desembargador Inoc\\u00eancio Lins"}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/57010240/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "57010-240",\n "logradouro": "Rua Desembargador Inoc\\u00eancio Lins",\n "complemento": "",\n "bairro": "Prado",\n "localidade": "Macei\\u00f3",\n "uf": "AL",\n "unidade": "",\n "ibge": "2704302",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>18170000</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro></bairro><cep>18170000</cep><cidade>Piedade</cidade><complemento2></complemento2><end></end><uf>SP</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=18170000&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"resultado":"2","resultado_txt":"sucesso - cep \\u00fanico","uf":"SP","cidade":"Piedade","bairro":"","tipo_logradouro":"","logradouro":"","debug":" - encontrado via search_db cep unico - "}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/18170000/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "18170-000",\n "logradouro": "",\n "complemento": "",\n "bairro": "",\n "localidade": "Piedade",\n "uf": "SP",\n "unidade": "",\n "ibge": "3537800",\n "gia": "5265"\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>78175000</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro></bairro><cep>78175000</cep><cidade>Pocon\xe9</cidade><complemento2></complemento2><end></end><uf>MT</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=78175000&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"resultado":"2","resultado_txt":"sucesso - cep \\u00fanico","uf":"MT","cidade":"Pocon\\u00e9","bairro":"","tipo_logradouro":"","logradouro":"","debug":" - encontrado via search_db cep unico - "}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/78175000/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "78175-000",\n "logradouro": "",\n "complemento": "",\n "bairro": "",\n "localidade": "Pocon\\u00e9",\n "uf": "MT",\n "unidade": "",\n "ibge": "5106505",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>63200970</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro>Centro</bairro><cep>63200970</cep><cidade>Miss\xe3o Velha</cidade><complemento2></complemento2><end>Rua Jos\xe9 Sobreira da Cruz 271</end><uf>CE</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=63200970&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"1","resultado_txt":"sucesso - cep completo","uf":"CE","cidade":"Miss\\u00e3o Velha","bairro":"Centro\\u00a0","tipo_logradouro":"Rua","logradouro":"Jos\\u00e9 Sobreira da Cruz, 271 "}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/63200970/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "63200-970",\n "logradouro": "Rua Jos\\u00e9 Sobreira da Cruz 271",\n "complemento": "",\n "bairro": "Centro",\n "localidade": "Miss\\u00e3o Velha",\n "uf": "CE",\n "unidade": "",\n "ibge": "2308401",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>69096970</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro>Cidade Nova</bairro><cep>69096970</cep><cidade>Manaus</cidade><complemento2></complemento2><end>Avenida Noel Nutels 1350</end><uf>AM</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=69096970&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"1","resultado_txt":"sucesso - cep completo","uf":"AM","cidade":"Manaus","bairro":"Cidade Nova\\u00a0","tipo_logradouro":"Avenida","logradouro":"Noel Nutels, 1350 "}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/69096970/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "69096-970",\n "logradouro": "Avenida Noel Nutels 1350",\n "complemento": "",\n "bairro": "Cidade Nova",\n "localidade": "Manaus",\n "uf": "AM",\n "unidade": "",\n "ibge": "1302603",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>20010974</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro>Centro</bairro><cep>20010974</cep><cidade>Rio de Janeiro</cidade><complemento2></complemento2><end>Rua Primeiro de Mar\xe7o 64</end><uf>RJ</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=20010974&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"1","resultado_txt":"sucesso - cep completo","uf":"RJ","cidade":"Rio de Janeiro","bairro":"Centro\\u00a0","tipo_logradouro":"Rua","logradouro":"Primeiro de Mar\\u00e7o, 64 "}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/20010974/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "20010-974",\n "logradouro": "Rua Primeiro de Mar\\u00e7o",\n "complemento": "64",\n "bairro": "Centro",\n "localidade": "Rio de Janeiro",\n "uf": "RJ",\n "unidade": "",\n "ibge": "3304557",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>96010900</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro>Centro</bairro><cep>96010900</cep><cidade>Pelotas</cidade><complemento2></complemento2><end>Rua Tiradentes 2515</end><uf>RS</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=96010900&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"1","resultado_txt":"sucesso - cep completo","uf":"RS","cidade":"Pelotas","bairro":"Centro\\u00a0","tipo_logradouro":"Rua","logradouro":"Tiradentes, 2515 "}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/96010900/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "96010-900",\n "logradouro": "Rua Tiradentes",\n "complemento": "2515",\n "bairro": "Centro",\n "localidade": "Pelotas",\n "uf": "RS",\n "unidade": "",\n "ibge": "4314407",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>38101990</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro></bairro><cep>38101990</cep><cidade>Baixa (Uberaba)</cidade><complemento2></complemento2><end>Rua Bas\xedlio Eug\xeanio dos Santos</end><uf>MG</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=38101990&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"1","resultado_txt":"sucesso - cep completo","uf":"MG - Distrito","cidade":"Baixa (Uberaba)","bairro":"\\u00a0","tipo_logradouro":"Rua","logradouro":"Bas\\u00edlio Eug\\u00eanio dos Santos "}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/38101990/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "38101-990",\n "logradouro": "Rua Bas\\u00edlio Eug\\u00eanio dos Santos",\n "complemento": "",\n "bairro": "Baixa",\n "localidade": "Uberaba",\n "uf": "MG",\n "unidade": "",\n "ibge": "3170107",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>76840000</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro></bairro><cep>76840000</cep><cidade>Jaci Paran\xe1 (Porto Velho)</cidade><complemento2></complemento2><end></end><uf>RO</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=76840000&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"2","resultado_txt":"sucesso - cep \\u00fanico","uf":"RO - Distrito","cidade":"Jaci Paran\\u00e1 (Porto Velho)","bairro":"\\u00a0","tipo_logradouro":"","logradouro":""}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/76840000/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "76840-000",\n "logradouro": "",\n "complemento": "",\n "bairro": "",\n "localidade": "Jaci Paran\\u00e1 (Porto Velho)",\n "uf": "RO",\n "unidade": "",\n "ibge": "1100205",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>86055991</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"><return><bairro></bairro><cep>86055991</cep><cidade>Londrina</cidade><complemento2></complemento2><end>Rodovia M\xe1bio Gon\xe7alves Palhano, s/n</end><uf>PR</uf></return></ns2:consultaCEPResponse></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=86055991&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"1","resultado_txt":"sucesso - cep completo","uf":"PR","cidade":"Londrina","bairro":"\\u00a0","tipo_logradouro":"Rodovia","logradouro":"M\\u00e1bio Gon\\u00e7alves Palhano, s\\/n "}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/86055991/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {
"type": "success",
"data": b'{\n "cep": "86055-991",\n "logradouro": "Rodovia M\\u00e1bio Gon\\u00e7alves Palhano",\n "complemento": "s/n",\n "bairro": "",\n "localidade": "Londrina",\n "uf": "PR",\n "unidade": "",\n "ibge": "4113700",\n "gia": ""\n}',
},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>00000000</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "error",
"status": 500,
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>CEP INV\xc1LIDO</faultstring><detail><ns2:SigepClienteException xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/">CEP INV\xc1LIDO</ns2:SigepClienteException></detail></soap:Fault></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=00000000&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"0","resultado_txt":"sucesso - cep n\\u00e3o encontrado","uf":"","cidade":"","bairro":"","tipo_logradouro":"","logradouro":""}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/00000000/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {"type": "success", "data": b'{\n "erro": true\n}'},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>11111111</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "error",
"status": 500,
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>CEP INV\xc1LIDO</faultstring><detail><ns2:SigepClienteException xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/">CEP INV\xc1LIDO</ns2:SigepClienteException></detail></soap:Fault></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=11111111&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"0","resultado_txt":"sucesso - cep n\\u00e3o encontrado","uf":"","cidade":"","bairro":"","tipo_logradouro":"","logradouro":""}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/11111111/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {"type": "success", "data": b'{\n "erro": true\n}'},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>99999999</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "error",
"status": 500,
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>CEP INV\xc1LIDO</faultstring><detail><ns2:SigepClienteException xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/">CEP INV\xc1LIDO</ns2:SigepClienteException></detail></soap:Fault></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=99999999&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"0","resultado_txt":"sucesso - cep n\\u00e3o encontrado","uf":"","cidade":"","bairro":"","tipo_logradouro":"","logradouro":""}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/99999999/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {"type": "success", "data": b'{\n "erro": true\n}'},
},
{
"request": {
"full_url": "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente",
"method": "POST",
"headers": {},
"data": bytearray(
b'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">\n <soapenv:Header/>\n <soapenv:Body>\n <cli:consultaCEP>\n <cep>01111110</cep>\n </cli:consultaCEP>\n </soapenv:Body>\n </soapenv:Envelope>'
),
},
"response": {
"type": "success",
"data": b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:consultaCEPResponse xmlns:ns2="http://cliente.bean.master.sigep.bsb.correios.com.br/"/></soap:Body></soap:Envelope>',
},
},
{
"request": {
"full_url": "http://cep.republicavirtual.com.br/web_cep.php?cep=01111110&formato=json",
"method": "GET",
"headers": {"Accept": "application/json"},
"data": None,
},
"response": {
"type": "success",
"data": b'{"debug":" - nao encontrado via search_db cep unico - ","resultado":"0","resultado_txt":"sucesso - cep n\\u00e3o encontrado","uf":"","cidade":"","bairro":"","tipo_logradouro":"","logradouro":""}',
},
},
{
"request": {
"full_url": "https://viacep.com.br/ws/01111110/json/unicode/",
"method": "GET",
"headers": {},
"data": None,
},
"response": {"type": "success", "data": b'{\n "erro": true\n}'},
},
]
|
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
l = 0
r = len(s)-1
while l<r:
s[l],s[r]=s[r],s[l]
l+=1
r-=1
|
def check(params):
"Check input parameters"
attrs = []
for attr in attrs:
if attr not in params:
raise Exception('key {} not in {}'.format(attr, json.dumps(params)))
def execute(cur, stmt, bindings, verbose=None):
"Helper function to execute statement"
if verbose:
print(stmt)
print(bindings)
cur.execute(stmt, bindings)
rows = cur.fetchall()
for row in rows:
return row[0]
|
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
left, right = 0, len(numbers) - 1
while left < right:
curSum = numbers[left] + numbers[right]
if curSum == target:
return[left + 1, right + 1]
if curSum > target:
right -= 1
else:
left += 1
return []
|
'''
A collection of optional backends. You must manually select and
install the backend you want. If the backend is not installed,
then trying to import the module for that backend will cause
an :class:`ImportError`.
See :ref:`Choose a hashing backend` for more.
'''
SUPPORTED_BACKENDS = [
'pycryptodomex', # prefer this over pysha3, for pypy3 support
'pysha3',
]
|
class linkedList(object):
"""
custom implementation of a linked list
We need a custom implementation because in the tableMethod class we need to refere
to individual items in the linked list to quickly remove and update them.
"""
first = None
last = None
lenght = 0
def __init__(self):
super(linkedList, self).__init__()
#define the __len__ function so we can call len() on the linked list
def __len__(self):
return self.lenght
def __repr__(self):
li = self.first
string = "linkedList["
while li != None:
string += str(li) + ", "
li = li.next
string +="]"
return string
#add data at the end of the linked list as last item
def append(self, data):
newItem = listItem(data, prev=self.last)
#if the list is empty, set the new listItem as first
if self.first is None:
self.first = newItem
#if this isnt the first item, set the next of the last item to the new list item
else:
self.last.next = newItem
#update the last item in the linked list to be the new listItem.
self.last = newItem
self.lenght += 1
def removeListItem(self, listItem):
"""
remove a given listItem from the linkedList
"""
#if its the first item update the first pointer
if(listItem.prev is None):
self.first = listItem.next
#if its the last item opdate the last pointer
if(listItem.next is None):
self.last = listItem.prev
#update the previous and next items of the listItem
listItem.remove()
self.lenght -= 1
class listItem(object):
"""Item in the linkedList"""
data = None
next = None
prev = None
def __init__(self, data, prev = None, next = None):
super(listItem, self).__init__()
self.data = data
self.prev = prev
self.next = next
#prints the listItem in a friendly format
def __repr__(self):
return "<listItem data: %s>" % (self.data)
def remove(self):
"""
update the previous and next list items so this one can be removed.
"""
if(not(self.prev is None)):
self.prev.next = self.next
if(not(self.next is None)):
self.next.prev = self.prev
|
"""
from sys import argv
script, input_file = argv
def print_all(f):
print f.read()
def rewind(f):
f.seek(0)
def print_a_line(line_count, f):
print line_count, f.readline()
print "line = %d " % line_count
current_file = open(input_file)
print "First let's print the whole file: "
print_all(current_file)
#print "line = %d " % line_count
print "Now let's rewind, kind of like a tape."
rewind(current_file)
#print "line = %d " % line_count
print "Now let's print three lines: "
current_line = 1
print_a_line(current_line, current_file)
#print "line = %d " % line_count
current_line = current_line + 1
print_a_line(current_line, current_file)
#print "line = %d " % line_count
current_line = current_line + 1
print_a_line(current_line, current_file)
#print "line = %d " % line_count
current_line = current_line + 1
print_a_line(current_line, current_file)
#print "line = %d " % line_count
"""
|
class BSTIterator:
def __init__(self, root: Optional[TreeNode]):
self.stack = []
self.pushLeftsUntilNull_(root)
def next(self) -> int:
root = self.stack.pop()
self.pushLeftsUntilNull_(root.right)
return root.val
def hasNext(self) -> bool:
return self.stack
def pushLeftsUntilNull_(self, root: Optional[TreeNode]) -> None:
while root:
self.stack.append(root)
root = root.left
|
class Cache:
def __init__(self, function, limit=1000):
self.function = function
self.limit = limit
self.purge()
def get(self, key):
value = self.store.get(key)
if value is None:
value = self.function(key)
self.set(key, value)
return value
def set(self, key, value):
if self.size < self.limit:
self.size += 1
self.store[key] = value
return value
def purge(self):
self.size = 0
self.store = dict()
def __call__(self, key):
return self.get(key)
|
'''10. Write a Python program to use double quotes to display strings.'''
def double_quote_string(string):
ans = f"\"{string}\""
return ans
print(double_quote_string('This is working already'))
|
# noqa
class CustomSerializer:
"""Custom serializer implementation to test the injection of different serialization strategies to an input."""
@property
def extension(self) -> str: # noqa
return "ext"
def serialize(self, value: str) -> bytes: # noqa
return b"serialized"
def deserialize(self, serialized_value: bytes) -> str: # noqa
return "deserialized"
def __repr__(self) -> str: # noqa
return "CustomSerializerInstance"
|
#カプセル化について
"""用語
カプセル化: プログラムの外部からの操作を制御、独立性を保つ仕組み
ユーザーが使える機能を制限することでプログラムの干渉を抑えられる
メンバ: クラス内で使用する変数. つまりインスタンス変数もクラス変数もメンバ
プライベート変数: 特定の方法でのみアクセスできる変数. 不慮の事故を防げる
"""
#例
class Planet:
description = '惑星について' #publicなクラス変数を宣言
def __init__(self): #コンストラクタ
self.__name = 'Earth' #インスタンスの初期化 private(とする)なインスタンス変数を宣言
self.__half_size = 6371
self.__mass = 5.9e24
self.__surface_tenperature = 288
planet = Planet()
print('planet_name:{0}, half_size:{1}[km], mass:{2}[kg], surface_temperature:{3}[K]'\
.format(planet.__name, planet.__half_size, planet.__mass, planet.__surface_tenperature))
#AttributeError(Planetオブジェクトは__name属性を持っていないというエラー)が出る
#マングルの効果で変数の名前が変わっているため、そんな名前は存在しないと言われる
"""実は…
Pythonにデータを隠蔽する機能はなく,その気になれば参照できてしまう(デバッグ的には便利)
名前マングリング(name mangling):メンバの名前の衝突を避けるサポート機構
マングル(mangle):難号化.メンバの先頭に"アンダースコア"を2つ置くことで変数名が変わる
"""
#print(planet._Planet__name) #マングル化した後の変数名でアクセスすると参照出来てしまう
#planet._Planet__name = 'Mars' #もちろん値の変更も可能
|
# Quem é o culpado
perguntas = []
ct = 0
pt = 0
quest = input("Você telefonou a vitima: ")
perguntas.append(quest)
quest = input("Vocẽ esteve no local do crime: ")
perguntas.append(quest)
quest = input("Você mora perto da vitima? ")
perguntas.append(quest)
quest = input("Devia para a vitima? ")
perguntas.append(quest)
quest = input("Já trabalhou com a vitima? ")
perguntas.append(quest)
while ct <= len(perguntas) - 1:
if perguntas[ct] in "sim":
pt += 1
ct += 1
if pt >= 1 and pt <= 2:
print("Você é um suspeito")
elif pt >= 3 and pt <= 4:
print("Você é cumplice!")
if pt == 5:
print("CULPADO,CULPADO, VOCÊ SERÁ PRESO!!!")
|
"""
.. module:: __init__
:synopsis: finvizfinance package general information
.. moduleauthor:: Tianning Li <ltianningli@gmail.com>
"""
__version__ = "0.10"
__author__ = "Tianning Li"
|
# URI Online Judge 1176
N = 62
n1 = 0
n2 = 1
string = '0 1'
for i in range(N-2):
new = n1 + n2
string += (' ') + str(new)
n1 = n2
n2 = new
fib = [int(item) for item in string.split()]
T = -1
while (T<0) or (T>60):
T = int(input())
for t in range(T):
entrada = int(input())
print('Fib({}) = {}'.format(entrada, fib[entrada]))
|
class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:
res = ListNode(None)
output = res
while list1 and list2:
if list1.val <= list2.val:
output.next = list1
list1 = list1.next
else:
output.next = list2
list2 = list2.next
output = output.next
if list1 == None:
output.next = list2
elif list2 == None:
output.next = list1
return res.next
|
line = input().split('\\')
line_length = len(line) -1
splitted = line[line_length].split('.')
file_name = splitted[0]
ext = splitted[1]
print(f'File name: {file_name}')
print(f'File extension: {ext}')
|
#
# PySNMP MIB module Wellfleet-CCT-NAME-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-CCT-NAME-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:32:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, Counter32, ObjectIdentity, NotificationType, MibIdentifier, Integer32, Gauge32, IpAddress, ModuleIdentity, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, TimeTicks, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "Counter32", "ObjectIdentity", "NotificationType", "MibIdentifier", "Integer32", "Gauge32", "IpAddress", "ModuleIdentity", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "TimeTicks", "Bits")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
wfServices, wfCircuitNameExtension = mibBuilder.importSymbols("Wellfleet-COMMON-MIB", "wfServices", "wfCircuitNameExtension")
wfCircuitNameTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3), )
if mibBuilder.loadTexts: wfCircuitNameTable.setStatus('mandatory')
wfCircuitNameEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1), ).setIndexNames((0, "Wellfleet-CCT-NAME-MIB", "wfCircuitNumber"))
if mibBuilder.loadTexts: wfCircuitNameEntry.setStatus('mandatory')
wfCircuitNameDelete = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("create", 1), ("delete", 2))).clone('create')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitNameDelete.setStatus('mandatory')
wfCircuitNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfCircuitNumber.setStatus('mandatory')
wfCircuitName = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitName.setStatus('mandatory')
wfCircuitIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170))).clone(namedValues=NamedValues(("csmacd", 10), ("sync", 20), ("t1", 30), ("e1", 40), ("token", 50), ("fddi", 60), ("hssi", 70), ("mct1", 80), ("ds1e1", 90), ("none", 100), ("atm", 110), ("async", 120), ("isdn", 130), ("atmz", 140), ("bisync", 150), ("gre", 160), ("ds3e3", 170)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitIfType.setStatus('mandatory')
wfCircuitProtoMap = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 5), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitProtoMap.setStatus('mandatory')
wfCircuitType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("normal", 1), ("virtual", 2), ("master", 3), ("clip", 4), ("internal", 5), ("gre", 6), ("notrouted", 7))).clone('normal')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitType.setStatus('mandatory')
wfCircuitRelCctList = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 7), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitRelCctList.setStatus('mandatory')
wfCircuitLineList = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 8), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitLineList.setStatus('mandatory')
wfCircuitMultilineName = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 9), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitMultilineName.setStatus('mandatory')
wfCircuitTdmRes = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notdmresources", 1), ("switchedh110", 2), ("routedh110", 3), ("cesh110", 4))).clone('notdmresources')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitTdmRes.setStatus('mandatory')
wfCircuitTdmCctInUse = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 3, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("notinuse", 1), ("inuse", 2))).clone('notinuse')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfCircuitTdmCctInUse.setStatus('mandatory')
wfLineMappingTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 1), )
if mibBuilder.loadTexts: wfLineMappingTable.setStatus('mandatory')
wfLineMappingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 1, 1), ).setIndexNames((0, "Wellfleet-CCT-NAME-MIB", "wfLineMappingNumber"))
if mibBuilder.loadTexts: wfLineMappingEntry.setStatus('mandatory')
wfLineMappingDelete = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfLineMappingDelete.setStatus('mandatory')
wfLineMappingNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfLineMappingNumber.setStatus('mandatory')
wfLineMappingCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 1, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfLineMappingCct.setStatus('mandatory')
wfLineMappingDef = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 1, 1, 4), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfLineMappingDef.setStatus('mandatory')
wfNode = MibIdentifier((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 2))
wfNodeDelete = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfNodeDelete.setStatus('mandatory')
wfNodeProtoMap = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 3, 2, 9, 2, 2), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfNodeProtoMap.setStatus('mandatory')
mibBuilder.exportSymbols("Wellfleet-CCT-NAME-MIB", wfLineMappingDef=wfLineMappingDef, wfCircuitProtoMap=wfCircuitProtoMap, wfCircuitTdmCctInUse=wfCircuitTdmCctInUse, wfLineMappingDelete=wfLineMappingDelete, wfCircuitLineList=wfCircuitLineList, wfCircuitNumber=wfCircuitNumber, wfCircuitType=wfCircuitType, wfNodeProtoMap=wfNodeProtoMap, wfLineMappingCct=wfLineMappingCct, wfNode=wfNode, wfCircuitNameEntry=wfCircuitNameEntry, wfCircuitName=wfCircuitName, wfCircuitNameTable=wfCircuitNameTable, wfCircuitIfType=wfCircuitIfType, wfLineMappingEntry=wfLineMappingEntry, wfCircuitRelCctList=wfCircuitRelCctList, wfLineMappingNumber=wfLineMappingNumber, wfCircuitMultilineName=wfCircuitMultilineName, wfCircuitNameDelete=wfCircuitNameDelete, wfNodeDelete=wfNodeDelete, wfCircuitTdmRes=wfCircuitTdmRes, wfLineMappingTable=wfLineMappingTable)
|
word_size = 9
num_words = 256
words_per_row = 4
local_array_size = 15
output_extended_config = True
output_datasheet_info = True
netlist_only = True
nominal_corner_only = True
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.