content stringlengths 7 1.05M |
|---|
print ('\033[35m Bem vindo a calculadora do Luis \n')
n1 = int(input('\033[33m Digite um valor: '))
n2 = int(input('\033[34m Digite outro numero: '))
s = n1 + n2
#print('A soma vale:',s)
#print ('A soma entre ',n1,'e ',n2,' eh ',s)
print ('\033[31m A soma entre {} e {} vale {}'.format(n1,n2,s)) |
def sum():
result = 21 + 14
print("Inside the function : ", result)
return result
total = sum()
print("Outside the function : ", total )
def print_info( name, age = 35 ):
print("Name: ", name)
print("Age ", age)
return
print_info( age=50, name="miki" )
print_info( name="miki" ) |
# -*- coding: utf-8 -*-
"""
micropy.utils.decorators
~~~~~~~~~~~~~~
This module contains generic decorators
used by MicropyCli
"""
__all__ = ['lazy_property']
def lazy_property(fn):
attr = '_lazy__' + fn.__name__
@property
def _lazy_property(self):
if not hasattr(self, attr):
setattr(self, attr, fn(self))
return getattr(self, attr)
return _lazy_property
|
"""
Un obrero necesita calcular su salario semanal, el cual se obtiene de la
siguiente manera:
Si trabaja 40 horas o menos se le paga 16 euros por hora
Si trabaja mas de 40 horas se le paga 16 euros por cada una de
las primeras 40 horas y 20 euros por cada hora extra.
"""
print("============SALARIO SEMANAL OBRERO============")
hours_work = int(input("Horas trabajadas: "))
if (hours_work <= 40):
print("El salario semanal del trabajador por trabajar {0} horas es: {1}".format(
hours_work, hours_work * 16
))
else :
extraHours = hours_work - 40
print(f"El trabajador ha trabajado 40 horas con {extraHours} horas extras")
print(f"El salario semanal por 40 horas son {40 * 16}")
print(f"El salario semanal por {extraHours} horas extras son {extraHours * 20}")
print("El salario semanal del trabajador por trabajar {0} es {1}".format(
hours_work, (40*16) + (extraHours * 20)
))
|
palavras = ('APRENDER', 'ESTUDAR', 'PROGRAMAR', 'AUTOMATIZAR', 'ANALISTA DE TESTES', 'PYTHON', 'ROBOT FRAMEWORK')
for c in palavras:
print(f'\nNa palavra {c.upper()} temos ',end='')
for vogal in c:
if vogal.lower() in 'aeiou':
print(vogal.lower(), end='') |
class Result:
def __init__(self):
# 总里程
self.total_dis = None
# 总车次
self.total_car_fre = None
# 中段总里程
self.mid_dis = None
# 运输路线方案
self.car_plan = None
# 运输方案时长 时间点 所取物品体积
self.plan_timezone = None
self.plan_timepoint = None
self.plan_v = None
# 运输方案截止时间
self.plan_duetime = None
# 运输方案预计库存里程成本
self.total_price = None
|
russian_word_list = []
abkhazian_word_list = []
outputfile = 'ab-ru-probability.dic'
output = open(outputfile,"w+")
cyrillic_encoding="utf-8"
probability = 0.9
#read the russian word into the list
with open('../draft/dictionary_prescript.ru', 'r+',encoding=cyrillic_encoding) as f:
russian_word_list = f.read().splitlines()
with open('../draft/dictionary.ru', 'r+',encoding=cyrillic_encoding) as f:
russian_word_list += f.read().splitlines()
# read also the abkhazian translations
with open('../draft/dictionary_prescript.ab', 'r+',encoding=cyrillic_encoding) as f:
abkhazian_word_list = f.read().splitlines()
with open('../draft/dictionary.ab', 'r+',encoding=cyrillic_encoding) as f:
abkhazian_word_list += f.read().splitlines()
for translation_tuple in zip(abkhazian_word_list, russian_word_list):
if probability:
output.write(translation_tuple[0]+"\t"+translation_tuple[1]+"\t"+str(probability)+"\n")
else:
output.write(translation_tuple[0]+"\t"+translation_tuple[1]+"\n")
'''
The generated dictionary can be used with https://github.com/bitextor
bifixer:
python3 bifixer/bifixer.py --scol 1 --tcol 2 --ignore_duplicates ru-ab-parallel.txt ru-ab-parallel.bifixed ru ab
apply the hardrules:
python3 bicleaner/bicleaner_hardrules.py ru-ab-parallel.bifixed ru-ab-parallel.clean -s ru -t ab --scol 1 --tcol 2 --disable_lm_filter
train bicleaner:
python3.7 bicleaner/bicleaner_train.py \
ru-ab-parallel.clean \
--treat_oovs --normalize_by_length \
-s ru -t ab \
-d ru-ab-probability.dic.gz -D ab-ru-probability.dic.gz \
-b 1000 -c ru-ab.classifier \
-g 10000 -w 10000 \
-m ru-ab.yaml \
--classifier_type random_forest \
--lm_training_file_sl lmtrain.ru-ab.ru --lm_training_file_tl lmtrain.ru-ab.ab \
--lm_file_sl model.ru-ab.ru --lm_file_tl model.ru-ab.ab
'''
|
num1 = 10
num2 = 3
result = num1 / num2
print(result)
# 10//3 # ==> 3
print(10//3); |
ipDDN = "192.168.0.1"
octets = ipDDN.split(".")
#convert ddn to int
ip = int(octets[0]) << 24
ip += int(octets[1]) << 16
ip += int(octets[2]) << 8
ip += int(octets[3])
print(ip) |
# Write a program to turn a number into its English name
# Assume that the number is positive below 1000
# for more info on this quiz, go to this url: http://www.programmr.com/word-representation-number
ones = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
teens = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
decade = ["", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
def first(num):
for i in num:
if num[0] == i:
return ones[i] + " " + "hundred"
def three_numb(num):
for i in num:
if num[1] == 0 and num[2] == 0:
return""
elif num[1] == 0 and num[2] == i:
return "and" + " " + ones[i]
elif num[1] == i and num[2] == 0:
return "and" + " " + decade[i]
elif num[1] == 1 and num[2] == i:
return "and" + " " + teens[i]
elif num[1] > 1 and num[2] == i:
return "and" + " " + decade[num[1]] + " " + ones[i]
def two_numb(num):
for i in num:
if num[0] == i and num[1] == 0:
return decade[i]
elif num[0] == 1 and num[1] == i:
return teens[i]
elif num[0] > 1 and num[1] == i:
return decade[num[0]] + " " + ones[i]
def single_numb(num):
for i in num:
return ones[i]
def word_rep_of_number(number):
num = list(map(int, str(number)))
if len(num) == 3:
return first(num) + " " + three_numb(num)
elif len(num) == 2:
return two_numb(num)
elif len(num) == 1:
return single_numb(num)
if __name__ == "__main__":
print(word_rep_of_number(310))
|
# https://www.codewars.com/kata/exclamation-marks-series-number-17-put-the-exclamation-marks-and-question-marks-to-the-balance-are-they-balanced/train/python
leftString = '!!'
rightString = '??'
def balance(left, right):
if ((left.count('!') * 2) + (left.count('?') * 3)) == ((right.count('!') * 2) + (right.count('?') * 3)):
return 'Balance'
elif ((left.count('!') * 2) + (left.count('?') * 3)) > ((right.count('!') * 2) + (right.count('?') * 3)):
return 'Left'
elif ((left.count('!') * 2) + (left.count('?') * 3)) < ((right.count('!') * 2) + (right.count('?') * 3)):
return 'Right'
print(balance("!!","??") == "Right")
print(balance("!??","?!!") == "Left")
print(balance("!?!!","?!?") == "Left")
print(balance("!!???!????","??!!?!!!!!!!") == "Balance")
balance = lambda * a:['Balance','Left','Right'][cmp(*map(lambda s:2*s.count('!')+3*s.count('?'),a))]
|
input_file = "" #file location
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())
current_file = open(input_file)
print("First let's print the whole file:\n")
print_all(current_file)
print("Now let's rewind, kid of like a tape.")
rewind(current_file)
print("Let's print three lines:")
current_line =1
print_a_line(current_line, current_file)
current_line += 1
print_a_line(current_line, current_file)
current_line += 1
print_a_line(current_line, current_file)
|
#!/usr/bin/env python3
# add one level of indentation to code
def indent(code):
return [ " " + l for l in code ]
# remove one level of indentation from code
def unindent(code):
cs = []
for l in code:
if l != "" and l[0:4] != " ":
print("Malformed conditional code '" + l[0:4] +"'")
assert False
cs.append(l[4:])
return cs
# Execute ASL code often has a header like this:
#
# if ConditionPassed() then
# EncodingSpecificOperations();
#
# that we need to transform into a more usable form.
# Other patterns found are:
# - declaring an enumeration before the instruction
# - inserting another line of code between the first and second lines.
# eg "if PSTATE.EL == EL2 then UNPREDICTABLE;"
# - wrapping the entire instruction in
# "if code[0].startswith("if CurrentInstrSet() == InstrSet_A32 then"):
#
# Return value consists of (top, cond, dec, exec):
# - additional top level declarations (of enumerations)
# - boolean: is the instruction conditional?
# - additional decode logic (to be added to start of decode ASL)
# - demangled execute logic
def demangleExecuteASL(code):
tops = None
conditional = False
decode = None
if code[0].startswith("enumeration ") and code[1] == "":
tops = code[0]
code = code[2:]
if code[0].startswith("if CurrentInstrSet() == InstrSet_A32 then"):
first = code[0]
code = code[1:]
mid = code.index("else")
code1 = unindent(code[:mid])
code2= unindent(code[mid+1:])
(tops1, conditional1, decode1, code1) = demangleExecuteASL(code1)
(tops2, conditional2, decode2, code2) = demangleExecuteASL(code2)
assert tops1 == None and tops2 == None
assert conditional1 == conditional2
code = [first] + indent(code1) + ["else"] + indent(code2)
([], conditional1, "\n".join([decode1 or "", decode2 or ""]), code)
if code[0] == "if ConditionPassed() then":
conditional = True
code = code[1:] # delete first line
code = unindent(code)
if code[0] == "bits(128) result;":
tmp = code[0]
code[0] = code[1]
code[1] = tmp
elif len(code) >= 2 and code[1] == "EncodingSpecificOperations();":
decode = code[0]
code = code[1:]
if code[0].startswith("EncodingSpecificOperations();"):
rest = code[0][29:].strip()
if rest == "":
code = code[1:]
else:
code[0] = rest
return (tops, conditional, decode, code)
|
BATCH_SIZE = 64
EPOCHS = 100
IMG_WIDTH = 1801
IMG_HEIGHT = 32
NUM_CHANNELS = 3
NUM_CLASSES = 2
NUM_REGRESSION_OUTPUTS = 24
K_NEGATIVE_SAMPLE_RATIO_WEIGHT = 4
INPUT_SHAPE = (IMG_HEIGHT, IMG_WIDTH, NUM_CHANNELS)
PREDICTION_FILE_NAME = 'objects_obs1_lidar_predictions.csv'
PREDICTION_MD_FILE_NAME = 'objects_obs1_metadata.csv'
WEIGHT_BB = 0.01
LEARNING_RATE = 0.001
LIDAR_CONV_VERTICAL_STRIDE = 1
IMG_CAM_WIDTH = 1368
IMG_CAM_HEIGHT = 512
NUM_CAM_CHANNELS = 1
USE_FEATURE_WISE_BATCH_NORMALIZATION = True
USE_SAMPLE_WISE_BATCH_NORMALIZATION = False
|
n1 = int(input('Digite um numero! '))
a = n1*1
b = n1*2
c = n1*3
d = n1*4
f = n1*5
print('_'* 12)
print('tabuada é\n{} X 1 = {}\n{} X 2 = {}\n{} X 3 = {}\n{} X 4 = {}\n{} X 5 = {}'.format(n1, a, n1, b, n1, c, n1, d, n1, f))
print('_'* 12)
|
class MinHeap:
def __init__(self, array):
# Do not edit the line below.
self.heap = self.buildHeap(array)
def buildHeap(self, array):
# Write your code here.
pass
def siftDown(self):
# Write your code here.
pass
def siftUp(self):
# Write your code here.
pass
def peek(self):
# Write your code here.
pass
def remove(self):
# Write your code here.
pass
def insert(self, value):
# Write your code here.
pass
|
# Leia uma distancia em quilometros e apresente-a convertida em milhas.
# A formula de conversão é: M = K / 1.61
K = float(input("Digite uma velocidade em km/h: "))
M = K / 1.61
print("A velocidade em milhas é: %0.2f milhas" % M)
|
NAMES = ["Bill", "Richie", "Ben", "Eddie", "Mike", "Beverly"]
while True:
searched_name = input("Give a member of The Losers' Club: ")
if searched_name is "":
break
elif (searched_name in NAMES) is True:
print("Correct!")
else:
print("Wrong!")
|
# -*- coding: utf-8 -*-
# @Author: Mujib
# @Date: 2017-07-15 15:05:13
# @Last Modified by: Mujib
# @Last Modified time: 2017-07-15 15:20:03
actualString = 'Monster truck rally. 4pm. Monday'
print( 'This is upperCase >>> ' + actualString.upper() )
print( '---------------------------------------------' )
print( 'This is lowerCase >>> ' + actualString.lower() )
print( '---------------------------------------------' )
print( 'Is string ends with ".jpg" >>> ' )
print( actualString.endswith( '.jpg' ) )
print( '---------------------------------------------' )
print( 'Is string starts with "Monster" >>> ' )
print( actualString.startswith( 'Monster' ) )
print( '---------------------------------------------' )
print( 'This will strip the given string.' )
print( actualString.strip() )
print( '---------------------------------------------' )
print( 'This will find the given text and return index. i.e. "python"' )
print( actualString.find( 'python' ) )
print( '---------------------------------------------' )
print( 'This will implement replace the words or letter in a given string.' )
print( actualString.replace( 'Monday', 'Friday' ) )
print( '---------------------------------------------' ) |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
def samebirth(n):
p = 1.0
for i in range(0, n):
p = p * (365 - i) / 365
return 1 - p
if __name__ == '__main__':
for n in range(1, 100, 1):
print('%d个人中至少两个人同一天生日的概率: %.10f'%(n, samebirth(n))) |
cffi_template = '''from cffi import FFI
def link_clib(block_cell_name):
ffi = FFI()
ffi.cdef(r\'\'\'{{headers}}\'\'\')
C = ffi.dlopen('{{dynlib_file}}')
return ffi, C
''' |
class Store:
def __init__(self, name, categories):
self.name = name
self.categories = categories
def __str__(self):
output = f"{self.name}\n"
for idx, category in enumerate(self.categories):
output += " " + str(idx+1) + ", " + category + "\n"
return output
my_store = Store("The Dugout", ["Running", "Baseball", "Basketball"])
print(my_store)
selection = input("Select the number of a department:")
print("The user selected " + str(selection))
|
##Faça um programa que leia um número de 0 a 9999 e mostre na tela cada um dos digítos separados.
#import random
#num = str(random.randint(0,9999))
#print('Número gerado: {}.'.format(num))
#print('Unidade: {}.'.format(num[3]))
#print('Dezena: {}.'.format(num[2]))
#print('Centena: {}.'.format(num[1]))
#print('Uni. Milhar: {}.'.format(num[0]))
num = int(input('Digite um número entra 0 e 9999: '))
u = num // 1 % 10
d = num // 10 % 10
c = num // 100 % 10
m = num // 1000 % 10
print("Analisando número...")
print('Unidade: {}.'.format(u))
print('Dezana: {}.'.format(d))
print('Centena: {}.'.format(c))
print('Milhar: {}.'.format(m))
|
'''
Gui/Views/Dialogs
_________________
Subset of views that are specifically for QDialog and QMessageBox
classes.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
'''
__all__ = [
'base',
'export',
'findreplace',
'information',
'save'
]
|
_base_ = [
'../../_base_/models/tanet_r50.py', '../../_base_/default_runtime.py'
]
# dataset settings
dataset_type = 'VideoDataset'
data_root = '/home/petros/Datasets/hmdb51/videos'
data_root_val = '/home/petros/Datasets/hmdb51/videos'
ann_file_train = '/home/petros/Datasets/hmdb51/hmdb51_train_split_1_videos.txt'
ann_file_val = '/home/petros/Datasets/hmdb51/hmdb51_val_split_1_videos.txt'
ann_file_test = '/home/petros/Datasets/hmdb51/hmdb51_val_split_1_videos.txt'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_bgr=False)
train_pipeline = [
dict(type='DecordInit'),
dict(type='DenseSampleFrames', clip_len=1, frame_interval=1, num_clips=8),
dict(type='DecordDecode'),
dict(type='Resize', scale=(-1, 256)),
dict(
type='MultiScaleCrop',
input_size=224,
scales=(1, 0.875, 0.75, 0.66),
random_crop=False,
max_wh_scale_gap=1,
num_fixed_crops=13),
dict(type='Resize', scale=(224, 224), keep_ratio=False),
dict(type='Flip', flip_ratio=0.5),
dict(type='Normalize', **img_norm_cfg),
dict(type='FormatShape', input_format='NCHW'),
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]),
dict(type='ToTensor', keys=['imgs', 'label'])
]
val_pipeline = [
dict(type='DecordInit'),
dict(
type='DenseSampleFrames',
clip_len=1,
frame_interval=1,
num_clips=8,
test_mode=False),
dict(type='DecordDecode'),
dict(type='Resize', scale=(-1, 256)),
dict(type='CenterCrop', crop_size=224),
dict(type='Normalize', **img_norm_cfg),
dict(type='FormatShape', input_format='NCHW'),
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]),
dict(type='ToTensor', keys=['imgs', 'label'])
]
test_pipeline = [
dict(type='DecordInit'),
dict(
type='SampleFrames',
clip_len=1,
frame_interval=1,
num_clips=8,
test_mode=True),
dict(type='DecordDecode'),
dict(type='Resize', scale=(-1, 256)),
# dict(type='ThreeCrop', crop_size=256),
dict(type='CenterCrop', crop_size=224),
dict(type='Normalize', **img_norm_cfg),
dict(type='FormatShape', input_format='NCHW'),
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]),
dict(type='ToTensor', keys=['imgs'])
]
data = dict(
videos_per_gpu=16,
workers_per_gpu=6,
train=dict(
type=dataset_type,
ann_file=ann_file_train,
data_prefix=data_root,
pipeline=train_pipeline),
val=dict(
type=dataset_type,
ann_file=ann_file_val,
data_prefix=data_root_val,
pipeline=val_pipeline),
test=dict(
type=dataset_type,
ann_file=ann_file_test,
data_prefix=data_root_val,
pipeline=test_pipeline))
# optimizer
optimizer = dict(
type='SGD',
constructor='TSMOptimizerConstructor',
paramwise_cfg=dict(fc_lr5=True),
lr=0.001, # this lr is used for 8 gpus
momentum=0.9,
weight_decay=0.0005)
optimizer_config = dict(grad_clip=dict(max_norm=20, norm_type=2))
# learning policy
lr_config = dict(policy='step',
warmup='linear',
warmup_by_epoch=True,
warmup_iters=5,
warmup_ratio=0.1,
step=[20, 30])
total_epochs = 40
checkpoint_config = dict(interval=5)
evaluation = dict(
interval=3, metrics=['top_k_accuracy', 'mean_class_accuracy'])
log_config = dict(
interval=20,
hooks=[
dict(type='TextLoggerHook'),
dict(type='TensorboardLoggerHook'),
])
# runtime settings
log_level = 'INFO'
work_dir = './work_dirs/tanet_r50_dense_1x1x8_100e_kinetics400_rgb/'
workflow = [('train', 1)]
# use the pre-trained model for the whole TANET network
load_from = 'checkpoints/tanet/tanet_r50_dense_1x1x8_100e_kinetics400_rgb_20210219-032c8e94.pth'
resume_from = None
|
# Implement a VotingMachine class that can be used for a simple election. Have methods
# to clear the machine state, to vote for a Democrat, to vote for a Republican, and to
# get the tallies for both parties.
class VotingMachine():
def __init__(self):
self._votes_democrats = 0
self._votes_republicans = 0
def get_votes_democrats(self):
return self._votes_democrats
def get_votes_republicans(self):
return self._votes_republicans
def vote_democrats(self):
self._votes_democrats += 1
def vote_republicans(self):
self._votes_republicans += 1
def show_tallies(self):
output = []
output = "Democrats: {}".format("*" * self.get_votes_democrats())
output = "Republicans: {}".format("*" * self.get_votes_republicans())
return "\n".join(output)
|
# https://leetcode.com/problems/kth-smallest-element-in-a-bst/
class Solution(object):
result = []
def getSmallest(self, root, k):
global y
if root != None:
left = self.getSmallest(root.left)
if left != None:
self.result.append(left.val)
y -=1
if y == 0:
self.result.append(root.val)
right = self.getSmallest(root.right)
def kthSmallest(self, root, k):
"""
:type root: TreeNode
:type k: int
:rtype: int
"""
print(root)
global y
y = k
self.getSmallest(root)
print(self.result)
if self.result == None:
return None
else:
return self.result[len(self.result)-1]
|
class Solution:
def search(self, nums, target):
low , high = 0 , len(nums)-1
while low <= high:
mid = low + (high-low) // 2 # if high is greater than low
if nums[mid] == target:
return mid
if nums[mid] > target: # if target is smaller ignore right half
high = mid - 1
else:
low = mid + 1
return -1
|
"""
Auxilliary list of HEX colors for graphic purposes.
Recommended usage, if wanted:
`from pylabutils._tools._colors import color_dict [as <name>]`
"""
__all__ = ['color_dict']
color_dict = {
"""
Auxilliary list of HEX colors for graphic purposes.
"""
'light_blue' : '#60A0FF',
'blue' : '#3385FF',
'dark_blue' : '#0A4AAA',
'light_red' : '#FC6A4B',
'red' : '#FB4A24',
'dark_red' : '#B22305',
'light_yellow' : '#F6FF6C',
'yellow' : '#EDF92B',
'dark_yellow' : '#D2D602',
'light_green' : '#4BFF4B',
'green' : '#0DC40F',
'dark_green' : '#018D01',
'light_orange' : '#FF884D',
'orange' : '#FF641E',
'dark_orange' : '#DC500A',
'light_purple' : '#D480FF',
'violet' : '#CC66FF',
# :-)
'purple' : '#BA44F4',
'dark_purple' : '#9619D7',
'light_brown' : '#B37700',
'brown' : '#965A05',
'dark_brown' : '#422804',
'black' : '#000000',
'african_american' : '#503208',
# I'm so funny
'white' : '#FFFFFF',
# I'll stop the jokes
'grey' : '#909090',
} |
# empt_dict = {'01': '31', '02': '29', '03': '31', '04': '30', '05': '31', '06': '30', '07': '31', '08': '31', '09': '30', '10': '31', '11': '30', '12': '31'}
# date = '06_04'
def get_last_seven(date_input):
dict_input = {'01': '31', '02': '29', '03': '31', '04': '30', '05': '31', '06': '30', '07': '31', '08': '31',
'09': '30', '10': '31', '11': '30', '12': '31'}
dates_to_grab = []
current_date = date_input.split('_')
month = current_date[0]
day = current_date[1]
month_before = int(month) -1
previous_month = f'0{month_before}'
days_prev_month = dict_input[previous_month]
for day_num in range(0, 7):
curr_day = int(day) - day_num
if int(day) >= 7:
for day_num in range(0, 7):
curr_day = int(day) - day_num
curr_day = str(curr_day).zfill(2)
file_add = f'2020-{month}-{curr_day}'
dates_to_grab.append(file_add)
else:
days_left = 7 - int(day)
for day_num in range(0, int(day)):
curr_day = int(day) - day_num
curr_day = str(curr_day).zfill(2)
file_add = f'2020-{month}-{curr_day}'
dates_to_grab.append(file_add)
for day_num in range(0, days_left):
curr_day = int(days_prev_month) - day_num
curr_day = str(curr_day).zfill(2)
file_add = f'2020-{previous_month}-{curr_day}'
dates_to_grab.append(file_add)
return dates_to_grab
if __name__ == '__main__':
get_last_seven(date_input)
|
class Point():
def __init__(self, input1, input2):
self.x = input1
self.y = input2
p = Point(2, 8)
# PRINT THE X&Y-VALUES OF THE POINT
print(p.x)
print(p.y)
# CREATED A CLASS (Flight which takes capacity as input)
class FLight():
# FUNCTION FOR CAPACITY
def __init__(self, capacity):
self.capacity = capacity
self.passengers = []
# FUNCTION TO APPEND PASSENGERS WITH NAME
def add_passenger(self, name):
if not self.open_seats():
return False
self.passengers.append(name)
return True
# FUNCTION TO GET EMPTY SEATS
def open_seats(self):
return self.capacity - len(self.passengers)
flight = FLight(3)
print(flight)
people = ["HIK HIK", "HIKAL LAKIH", "LAKIH HIKAL", "OTHER USER"]
for person in people:
success = flight.add_passenger(person)
if success:
print(f"Added {person}, ")
# PRINT: Added.....
else:
print(f"No available seats for {person} ")
# PRINT: No available seats for OTHER USER
|
"""noves = 0
prim3 = -1
for num in range(0, 4):
print(f'Digite o {num+1}º número: ', end='')
if num == 0:
n1 = int(input())
if n1 == 9:
noves += 1
elif n1 == 3:
prim3 = num
if num == 1:
n2 = int(input())
if n2 == 9:
noves += 1
elif n2 == 3 and prim3 == -1:
prim3 = num
if num == 2:
n3 = int(input())
if n3 == 9:
noves += 1
elif n3 == 3 and prim3 == -1:
prim3 = num
if num == 3:
n4 = int(input())
if n4 == 9:
noves += 1
elif n4 == 3 and prim3 == -1:
prim3 = num
valores = (n1, n2, n3, n4)
print('\n [ ', end='')
for num in valores:
print(f'{num} ', end='')
print(']\n')
if noves == 0:
print('-> Nesta tupla de números não apareceu nenhum Nove.')
elif noves == 1:
print('-> Nesta tupla de números apareceu 1 Nove.')
else:
print(f'-> Nesta tupla de números apareceu {noves} Noves.')
if prim3 == -1:
print('-> Nenhum número três foi encontrado.')
else:
print(f'-> O número três foi encontrado primeiramente na posição {prim3 + 1}º.')
print('-> ', end='')
for num in valores:
if num % 2 == 0:
pares = True
break
pares = False
if pares:
print('Os números pares presentes na tupla são: [ ', end='')
for num in valores:
if num % 2 == 0:
print(num , end='')
print(']')
else:
print('Não há números pares na tupla.')"""
num = (int(input('Digite um número: ')),
int(input('Digite outro número: ')),
int(input('Digite mais um número: ')),
int(input('Digite o último número: ')))
print('\n [ ', end='')
for n in num:
print(f'{n} ', end='')
print(']\n')
if num.count(9) == 0:
print('-> Nenhum número Nove foi encontrado nesta Tupla.')
elif num.count(9) == 1:
print('-> 1 número Nove foi encontrado nesta Tupla.')
else:
print(f'-> {num.count(9)} números Nove foram encontrados nesta Tupla.')
if 3 not in num:
print('-> Nenhum número Três foi encontrado nesta Tupla.')
else:
print(f'-> Na {num.index(3) + 1}ª posição um número Três foi encontrado nesta Tupla.')
printado = False
pares = False
print('-> ', end='')
for n in num:
if n % 2 == 0:
if printado is False:
printado = True
print('Os números pares presentes na tupla são: [ ', end='')
pares = True
print(n, end=' ')
if pares is True:
print(']')
else:
print('Não há números pares na tupla.')
|
fact = 1
n = int(input('Enter the no you want to factorial \t'))
for i in range(1,n+1):
fact = fact*i
print('FACTORIAL Of ',n,"is",fact)
|
entries = [
{
'env-title': 'mujoco-half-cheetah',
'score': 1668.58,
},
{
'env-title': 'mujoco-hopper',
'score': 2316.16,
},
{
'env-title': 'mujoco-inverted-pendulum',
'score': 809.43,
},
{
'env-title': 'mujoco-swimmer',
'score': 111.19,
},
{
'env-title': 'mujoco-inverted-double-pendulum',
'score': 7102.91,
},
{
'env-title': 'mujoco-reacher',
'score': -6.71,
},
{
'env-title': 'mujoco-walker2d',
'score': 3424.95,
},
]
|
COLOR = {
"bay": "鹿毛",
"dark bay": "黒鹿毛",
"brown": "青鹿毛",
"black": "青毛",
"chestnut": "栗毛",
"liver chestnut": "栃栗毛",
"gray": "芦毛",
"white": "白毛"
}
SEX = {
"stallion": "牡",
"mare": "牝",
"gelding": "セ"
}
def get_en_color(ja_color):
if ja_color == None:
return "unknown"
color = [e for e, j in COLOR.items() if j == ja_color][0]
return color
def get_en_sex(ja_sex):
color = [e for e, j in SEX.items() if j == ja_sex][0]
return color |
class Solution:
def isStable(self, board, numRows, numCols):
positions = set()
for row in range(numRows):
for col in range(numCols):
if board[row][col]:
if col > 1 and (board[row][col] == board[row][col-1] == board[row][col-2]):
positions = positions.union({(row, col), (row, col-1), (row, col-2)})
# positions.add((row, col))
# positions.add((row, col-1))
# positions.add((row, col-2))
if row > 1 and (board[row][col] == board[row-1][col] == board[row-2][col]):
positions = positions.union({(row, col), (row-1, col), (row-2, col)})
# positions.add((row, col))
# positions.add((row-1, col))
# positions.add((row-2, col))
return positions
def crush(self, board, positions):
for (row, col) in positions:
board[row][col] = 0
def fall(self, board, numRows, numCols):
for col in range(numCols):
# start from bottom most 0
zeroIdx = numRows-1
for row in range(numRows-1, -1, -1):
if board[row][col]:
board[zeroIdx][col] = board[row][col]
zeroIdx -= 1
for row in range(zeroIdx+1):
board[row][col] = 0
def candyCrush(self, board: List[List[int]]) -> List[List[int]]:
numRows = len(board)
numCols = len(board[0])
while True:
positions = self.isStable(board, numRows, numCols)
if not positions:
break
self.crush(board, positions)
self.fall(board, numRows, numCols)
return board
|
def sp_cls_count(sp_cls, n_seg_cls=8):
"""
Get the count (number of superpixels) for each segmentation class
Args:
sp_cls (dict): the key is the superpixel ID, and the value is the
class ID for the corresponding superpixel. There are n elements
in the sp_cls. Here, we use zero-indexing, which means the class
are in range [0, k)
n_seg_cls (int): number of segmentation classes
Output:
counts (list): a list for the count, where each index is the count
for the corresponding segmentation class. The length of the list
equals to the number of semantic segmentation classes.
"""
counts = [0] * n_seg_cls
for k in sp_cls.keys():
counts[sp_cls[k]] += 1
return counts
|
s = 0
for x in range(1, 10+1):
s = s+x
print("x:", x, "sum:", s)
|
class Solution:
def findMaxForm(self, strs: List[str], m: int, n: int) -> int:
'''
T: O(len(strs) * m * n) and S: (m * n)
'''
dp = [[0 for _ in range(n+1)] for _ in range(m+1)]
for s in strs:
count = collections.Counter(s)
for i in range(m, count["0"] - 1, -1):
for j in range(n, count["1"] - 1, -1):
dp[i][j] = max(dp[i][j], dp[i-count["0"]][j-count["1"]] + 1)
return dp[m][n]
|
def roman_nums():
"""Generator for roman numerals."""
mapping = [
(1, 'i'), (4, 'iv'), (5, 'v'), (9, 'ix'),
(10, 'x'), (40, 'xl'), (50, 'l'), (90, 'xc'),
(100, 'c'), (400, 'cd'), (500, 'd'), (900, 'cm'),
(1000, 'm')
]
i = 1
while True:
next_str = ''
remaining_int = i
remaining_mapping = list(mapping)
while remaining_mapping:
(amount, chars) = remaining_mapping.pop()
while remaining_int >= amount:
next_str += chars
remaining_int -= amount
yield next_str
i += 1
def title_body(text):
"""Split text into its first line (the title) and the rest of the text."""
newline = text.find("\n")
if newline < 0:
return text, ""
return text[:newline], text[newline:]
def flatten(list_of_lists):
"""List[List[X]] -> List[X]"""
return sum(list_of_lists, [])
|
expected_output={
'interfaces': {
'HundredGigE1/0/21': {
'neighbors': {
'3.3.3.3': {
'priority': 0,
'state': 'FULL/ -',
'dead_time': '00:00:35',
'interface_id': 23
}
}
}
}
}
|
config = {
"cmip6": {
"base_dir": "/badc/cmip6/data/CMIP6",
"facets": "mip_era activity_id institution_id source_id experiment_id member_id table_id variable_id grid_label version".split(),
"scan_depth": 5,
"mappings": {"variable": "variable_id", "project": "mip_era"}
},
"cmip5": {
"base_dir": "/badc/cmip5/data/cmip5",
"facets": "activity product institute model experiment frequency realm mip_table ensemble_member version variable".split(),
"scan_depth": 5,
"mappings": {"project": "activity"},
"deeper_scan": 1,
"exclude": ("derived", "retracted")
},
"cordex": {
"base_dir": "/badc/cordex/data/cordex",
"facets": "project product domain institute driving_model experiment ensemble rcm_name rcm_version time_frequency variable version".split(),
"scan_depth": 5,
"mappings": {"project": "project"},
"renamers": {"CORDEX": "cordex"}
}
}
|
'''
Created on May 12, 2022
@author: mballance
'''
class PoolSize(object):
def __init__(self, sz):
self._sz = sz
def __int__(self):
return self._sz |
n1 = float(input('Digite um número:'))
antecessor = n1 - 1
sucessor = n1 + 1
print(' Você digitou o número {}. Seu número antecessor é {}, e sucessor é {}.'.format(n1, antecessor, sucessor))
#é possível realizar o programa somente com uma variável. podemos fazer assim:
# print('voce digitou o numero {}, seu antecessor é {} e sucessor {}.format(n1, (n1-1), (n1+1))
|
""" base on http://www.ibm.com/developerworks/cn/opensource/os-cn-pythonwith/index.html demo-5
"""
class DummyResource:
def __init__(self, tag):
self.tag = tag
print('Resource [%s]' % tag)
def __enter__(self):
print('[Enter %s]: Allocate resource.' % self.tag)
return self # can return different object
def __exit__(self, exc_type, exc_value, exc_tb):
print('[Exit %s]: Free resource.' % self.tag)
if exc_tb is None:
print('[Exit %s]: Exited without exception.' % self.tag)
else:
print('[Exit %s]: Exited with exception raised.' % self.tag)
return False
""" self-implement: what if ctx_expr it self raised an exception """
class DummyResorceChild(DummyResource):
def __init__(self, tag, trigger = False):
if trigger:
raise Exception
DummyResource.__init__(self, tag)
if __name__ == '__main__':
with DummyResource('Normal'):
print('[with-body] Run without exceptions.')
try:
with DummyResource('With-Exception'): # NOTICE: ctx_expr it self has an exception will irectly raised!(in this case)
print('[with-body] Run with exception.')
raise Exception ## forcing an exception and the ctx manager will handle it
print('[with-body] Run with exception. Failed to finish statement-body!') # NOTICE: will not execute this line
except Exception:
pass
with DummyResorceChild('Without ctx_expr exception'):
print('[with-body] Run without exceptions.')
with DummyResorceChild('With ctx_expr exception', True):
print('[with-body] Run passed with exception in ctx_expr!')
|
def isStackEmpty() :
global SIZE, stack, top
if (top == -1) :
return True
else :
return False
def peek() :
global SIZE, stack, top
if (isStackEmpty()) :
print("스택이 비었습니다.")
return None
return stack[top]
SIZE = 5
stack = ["커피", "녹차", "꿀물", None, None]
top = 2
print(stack)
retData = peek()
print("top의 데이터 확인 -->", retData)
print(stack)
|
n = int(input())
for i in range (97 , 97 + n ):
for m in range (97, 97 + n):
for k in range (97, 97 + n):
print(chr(i) + chr(m) + chr(k)) |
def trainer(model, data):
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
(x, y) = data('train')
def result(epochs, batch_size):
model.fit(x, y, batch_size=batch_size, epochs=epochs, validation_split=0.1)
return model
return result
|
# print([callable(getattr(__builtins__, attr)) for attr in dir(__builtins__)])
print([(attr,type(getattr(__builtins__, attr))) for attr in dir(__builtins__)])
# print 'hello'*100
|
# https://leetcode.com/problems/count-univalue-subtrees/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def countUnivalSubtrees(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def search(root):
lu, lv = True, root.val
ru, rv = True, root.val
if root.left: lu, lv = search(root.left)
if root.right: ru, rv = search(root.right)
if not lu: return False, root.val
if not ru: return False, root.val
if not (lv == rv == root.val): return False, root.val
nonlocal univalue_subtrees
univalue_subtrees += 1
return True, root.val
univalue_subtrees = 0
if root: search(root)
return univalue_subtrees
|
#criar um programa que leia um valor em metros e o exiba convertido em centimetros e milimetros.
m = float(input('Digite um valor em metros: '))
km = m/1000
hm = m/100
dam= m/10
dm = m*10
cm = m*100
mm = m*1000
print("A medida de {} metros corresponde a {:.0f} dm, {:.0f} cm e {:.0f} mm".format(m, dm, cm, mm))
print("A medida de {} metros corresponde a {} km, {} hm e {} dam".format(m, km, hm, dam)) |
#! /usr/bin/python
# Copyright Notice:
# Copyright 2019-2020 DMTF. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Tacklebox/blob/master/LICENSE.md
"""
Resets Module
File : resets.py
Brief : This file contains the common definitions and functionalities for
reset operations
"""
reset_types = [ "On", "ForceOff", "GracefulShutdown", "GracefulRestart", "ForceRestart", "Nmi", "ForceOn", "PushPowerButton", "PowerCycle" ]
|
_base_ = './cascade_rcnn_r50_fpn_20e_coco.py'
# The new config inherits a base config to highlight the necessary modification
_base_ = 'mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py'
# We also need to change the num_classes in head to match the dataset's annotation
model = dict(
roi_head=dict(
bbox_head=dict(num_classes=6),
mask_head=dict(num_classes=6)))
# Modify dataset related settings
dataset_type = 'COCODataset'
classes = ("badge", "person", "glove", "wrongglove", "operatingbar", "powerchecker")
data_root = 'data/gloves/'
data = dict(
train=dict(
img_prefix='',
classes=classes,
ann_file='1_images/annotation_coco.json'),
val=dict(
img_prefix='',
classes=classes,
ann_file='gloves/1_images/val/annotation_coco.json'),
test=dict(
img_prefix='',
classes=classes,
ann_file='gloves/1_images/val/annotation_coco.json'))
model = dict(
type='CascadeRCNN',
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytorch'))
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 11 08:24:01 2020
@author: krishan
"""
class Student:
collegeName = 'KITS'
def __init__(self, name):
self.name = name
# Aggregation[No need for object]
print(Student.collegeName)
s = Student('Arjun')
# Composition[Without object name cannot exist]
print(s.name)
|
class DateTimeExtensions(object):
# no doc
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return DateTimeExtensions()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
@staticmethod
def AddWorkday(date):
""" AddWorkday(date: DateTime) -> DateTime """
pass
@staticmethod
def IsSameDay(dtSelf,dtOther):
""" IsSameDay(dtSelf: DateTime,dtOther: DateTime) -> bool """
pass
@staticmethod
def IsWorkday(date):
""" IsWorkday(date: DateTime) -> bool """
pass
__all__=[
'AddWorkday',
'IsSameDay',
'IsWorkday',
]
|
"""
The snake ladder board game is represented as one-dimensional array
where value in the array are the destination id cell for the snakes (lower
numbers) and ladders higher number.
"""
board = [1,15,3,4,7,6,7,8,27,10,11,12,13,14,15,16,4,29,19,21,22,23,16,
35,26,27,28,29,30,31,30,33,12,35,36]
def find_min_throws(position,count, min_count):
if position == 36:
if count[0] < min_count[0]:
min_count[0] = count[0]
return
for dice_top in [1,2,3,4,5,6]:
next_position = dice_top + position
if next_position > 36:
next_postion = position + (36-position) - (dice_top - (36 -position))
else:
next_position = next_position
actual_position = board[next_position]
count[0] += 1
find_min_throws(actual_position,count,min_count)
def play_game():
min_count = [0]
count = [0]
find_min_throws(1,count,min_count)
print(min_count)
play_game()
|
BASE_URL = 'http://api.statbank.dk/v1'
DELIMITER = ';'
DEFAULT_LANGUAGE = 'da'
LOCALES = {'da': 'en_DK.UTF-8',
'en': 'en_US.UTF-8'}
|
class TaxNotKnown(Exception):
"""
Exception for when a tax-inclusive price is requested but we don't know
what the tax applicable is (yet).
"""
class Price(object):
is_tax_known = False
def __init__(self, currency, excl_tax, incl_tax=None, tax=None):
"""
You can either pass the price including tax or simply the tax
"""
self.currency = currency
self.excl_tax = excl_tax
if incl_tax is not None:
self.incl_tax = incl_tax
self.is_tax_known = True
self.tax = incl_tax - excl_tax
elif tax is not None:
self.incl_tax = excl_tax + tax
self.is_tax_known = True
self.tax = tax
|
# def fact(x):
# if x == 1:
# return 1
# else:
# return x * fact(x - 1)
#
#
# fact(4)
#
def sum_one(nums):
if type(nums) is list:
if not nums:
return 0
return nums[0] + sum_one(nums[1:])
return "不是数组"
print(sum_one([1, 2, 3]))
def count(nums):
if type(nums) is list:
if not nums:
return 0
return 1 + count(nums[1:])
return "不是数组"
print(count([1, 2, 3]))
def max_three(nums):
if type(nums) is list:
return nums[0] if nums[0] > nums[1] else nums[1]
sub_max = max_three(nums[1:])
return nums[0] if nums[0] > sub_max else sub_max
|
def fibo(n):
if n<3:
return n-1
else:
return fibo(n-1)+fibo(n-2)
|
"""
Number of Islands
Given an m x n 2d grid map of '1's (land) and '0's (water), return the number of islands.
An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically.
You may assume all four edges of the grid are all surrounded by water.
Example 1:
Input: grid = [
["1","1","1","1","0"],
["1","1","0","1","0"],
["1","1","0","0","0"],
["0","0","0","0","0"]
]
Output: 1
Example 2:
Input: grid = [
["1","1","0","0","0"],
["1","1","0","0","0"],
["0","0","1","0","0"],
["0","0","0","1","1"]
]
Output: 3
Constraints:
m == grid.length
n == grid[i].length
1 <= m, n <= 300
grid[i][j] is '0' or '1'.
"""
class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
self.m = len(grid)
self.n = len(grid[0])
self.grid = grid
islands = 0
for row in range(self.m):
for col in range(self.n):
# print("In numIslands:", row, col, islands, "\n", self.grid,"\n")
if self.grid[row][col] == "1":
self.sink(row, col)
islands += 1
# print("Final grid:\n", self.grid, "\n")
return islands
def sink(self, row, col):
# print("In sink:", row, col, "\n", self.grid,"\n")
# Marking land as visited.
self.grid[row][col] = "-"
if row-1 >= 0 and self.grid[row-1][col] == "1":
self.sink(row-1, col)
if col-1 >= 0 and self.grid[row][col-1] == "1":
self.sink(row, col-1)
if row+1 < self.m and self.grid[row+1][col] == "1":
self.sink(row+1, col)
if col+1 < self.n and self.grid[row][col+1] == "1":
self.sink(row, col+1)
|
"""."""
class HashBrowns:
"""Makes a hash table."""
def __init__(self):
self.size = 753
self.slots = [None] * self.size
self.data = [None] * self.size
def hashingtons(self, key, size):
return key % size
def hashemagain(self, oldcountrystylehash, size):
return (oldcountrystylehash+1) % size
def set(self, key, val):
hash_val = self.hashingtons(key, len(self.slots))
def get(self, key):
starting_bucket = self.hashingtons(key, len(self.slots))
val = None
stop = False
start = False
position = starting_bucket
|
"""
Copyright 2021 Robert MacGregor
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def repositories():
maybe(
git_repository,
name = "rules_third_party",
remote = "https://github.com/DraconicEnt/rules_third_party.git",
commit = "ac695d3d2e09f4a2cd1d6e4ed625339255499ba0"
)
maybe(
http_archive,
name = "rules_foreign_cc",
strip_prefix = "rules_foreign_cc-master",
# FIXME: Ideally this is locked to a specific version
#sha256 = "3e6b0691fc57db8217d535393dcc2cf7c1d39fc87e9adb6e7d7bab1483915110",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/master.zip",
)
maybe(
git_repository,
name = "gtest",
remote = "https://github.com/google/googletest.git",
commit = "703bd9caab50b139428cea1aaff9974ebee5742e" # Tag 1.10
)
|
def doincre(delta, entity, cnt, RK, table, PK, tablesvc):
if cnt > 0:
item = {"PartitionKey": PK, "RowKey": RK, "value": int(entity.value) + delta, "etag": entity.etag}
try:
tablesvc.merge_entity(table, item)
except:
result = tablesvc.get_entity(table, PK, RK)
doincre(delta, result, cnt - 1, RK, table, PK, tablesvc)
def incrementMetric(delta, RK, table, PK, tablesvc):
try:
result = tablesvc.get_entity(table, PK, RK)
doincre(delta, result, 10000, RK, table, PK, tablesvc)
except:
pass |
# Python - 3.4.3
test.describe('Example Tests')
InterlacedSpiralCipher = {'encode': encode, 'decode': decode }
example1A = 'Romani ite domum'
example1B = 'Rntodomiimuea m'
test.assert_equals(InterlacedSpiralCipher['encode'](example1A), example1B)
test.assert_equals(InterlacedSpiralCipher['decode'](example1B), example1A)
example2A = 'Sic transit gloria mundi'
example2B = 'Stsgiriuar i ninmd l otac'
test.assert_equals(InterlacedSpiralCipher['encode'](example2A), example2B)
test.assert_equals(InterlacedSpiralCipher['decode'](example2B), example2A)
|
RESOURCES = {
'accounts': {
'schema': {
'username': {
'type': 'string',
'required': True,
'unique': True
},
'password': {
'type': 'string',
'required': True
},
'roles': {
'type': 'list',
'allowed': ['user', 'superuser'],
'required': True,
},
'location': {
'type': 'dict',
'schema': {
'country': {'type': 'string'},
'city': {'type': 'string'},
'address': {'type': 'string'}
},
},
'born': {
'type': 'datetime',
},
},
# Disable endpoint caching.
'cache_control': '',
'cache_expires': 0,
}
}
|
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
n, k = map(int, input().strip().split())
s = input()
mx = 0
ans = 0
count = {i: 0 for i in 'abc'}
for i in range(len(s)):
count[s[i]] += 1
mx = max(mx, count[s[i]])
if ans - mx < k:
ans += 1
else:
count[s[i - ans]] -= 1
print(ans)
|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def mergeTrees(self, t1: TreeNode, t2: TreeNode) -> TreeNode:
t1_ptr = t1
t2_ptr = t2
t3_ptr = None
if t1_ptr and t2_ptr:
t3_ptr = TreeNode(t1_ptr.val + t2_ptr.val)
t3_ptr.left = self.mergeTrees(t1_ptr.left , t2_ptr.left)
t3_ptr.right = self.mergeTrees(t1_ptr.right , t2_ptr.right)
elif t1_ptr:
t3_ptr = t1_ptr
else:
t3_ptr = t2_ptr
return t3_ptr
|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @return a boolean
def isPalindrome(self, head):
if head == None:
return True
prev = None
slow = head
fast = head
while fast != None and fast.next != None:
prev = slow
slow = slow.next
fast = fast.next.next
mid = slow
curr = mid
while curr != None:
temp = curr.next
curr.next = prev
prev = curr
curr = temp
left = head
right = prev
while left != mid:
if left.val != right.val:
return False
left = left.next
right = right.next
return True
|
load("//third_party/py:python_configure.bzl", "python_configure")
load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories")
load("@grpc_python_dependencies//:requirements.bzl", "pip_install")
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories")
def grpc_python_deps():
# TODO(https://github.com/grpc/grpc/issues/18256): Remove conditional.
if hasattr(native, "http_archive"):
python_configure(name = "local_config_python")
pip_repositories()
pip_install()
py_proto_repositories()
else:
print("Building Python gRPC with bazel 23.0+ is disabled pending " +
"resolution of https://github.com/grpc/grpc/issues/18256.")
|
FONT_TITLE = 18
FONT_LEGEND = 16
FONT_LABEL = 14
FONT_STICK = 12
LEGEND_FRAMEALPHA = 0.5
########## h5py -- dod ############
wake_trim_min = None
period_length_sec = 30
h5_out_dir = './h5py/output'
ignore_class = None
kappa_weights='quadratic'
plot_hypnograms=True
plot_CMs=True
###### ablation ######
ablation_out_dir = './ablation/output'
|
class CrabNavy:
def __init__(self, positions):
self.positions = positions
@classmethod
def from_str(cls, positions_str):
positions = [int(c) for c in positions_str.split(",")]
return cls(positions)
def calculate_consumption(self, alignment):
total = 0
for position in self.positions:
total += abs(alignment - position)
return total
@property
def ideal_alignment(self):
min_consumption = None
min_idx = None
for idx in range(min(self.positions), max(self.positions)):
consumption = self.calculate_consumption(idx)
if min_consumption is None or consumption < min_consumption:
min_consumption = consumption
min_idx = idx
return min_idx
@property
def ideal_alignment_consumption(self):
return self.calculate_consumption(self.ideal_alignment)
def main():
with open("input", "r") as f:
lines_raw = f.read().splitlines()
sample_navy = CrabNavy([16, 1, 2, 0, 4, 2, 7, 1, 2, 14])
navy = CrabNavy.from_str(lines_raw[0])
print(sample_navy.ideal_alignment)
print(sample_navy.ideal_alignment_consumption)
print(navy.ideal_alignment_consumption)
if __name__ == "__main__":
main()
|
###################################################
### Aluna: Renata dos Santos. Atividade: Ciclo2 ###
### Universidade: UNIS - MG ###
### Disciplina: Linguagens de programação ###
### Ano: 2021 ###
###################################################
#1) Faça um programa que leia a idade de uma pessoa expressa em dias e mostre-a expressa em anos, meses e dias.
print("Bem-Vindo a atividade do ciclo 2!")
print("")
print("1) Faça um programa que leia a idade de uma pessoa expressa em dias e mostre-a expressa em anos, meses e dias.")
print("")
print("Digite uma idade em dias: ")
print("")
idade_dias = int(input()) #Idade em Dias.
idade_anos = int(idade_dias / 365) #Idade em Anos.
idade_meses = int(idade_dias / 30) #Idade em Meses.
print("A idade " + str(idade_dias) +" em Anos é: " + str(idade_anos))
print("")
print("A idade " + str(idade_dias) +" em Meses é: " + str(idade_meses))
|
class Human:
pass
class Man(Human):
pass
class Woman(Human):
pass
def God():
""" god == PEP8 (forced to capitalize by CodeWars) """
return [Man(), Woman()]
|
# Exercise One
hash = "#"
for i in range(0, 7):
print(hash)
hash = hash + "#"
# Exercise two
for i in range(1, 101):
if i % 3 == 0:
if i % 5 == 0:
print("FizzBuzz")
else:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)
# Exercise three
size = 8
chess_board = ""
for i in range(0, size):
for j in range(0, size):
if (i + j) % 2 == 0:
chess_board = chess_board + " "
else:
chess_board = chess_board + "#"
chess_board = chess_board + "\n"
print(chess_board)
|
'''https://adoptopenjdk.net/upstream.html
'''
load("//java:common/structs/KnownOpenJdkRepository.bzl", _KnownOpenJdkRepository = "KnownOpenJdkRepository")
def adoptopenjdk_upstream_repositories():
return _KNOWN_OPENJDK_REPOSITORIES
def _Repo(**kwargs):
kwargs['provider'] = "adoptopenjdk_upstream"
return _KnownOpenJdkRepository(**kwargs)
_KNOWN_OPENJDK_REPOSITORIES = [
# JDK-11.0.9+11 ###########################################################
_Repo(
version = "11.0.9+11",
url = "https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_linux_11.0.9_11.tar.gz",
sha256 = "4fe78ca6a3afbff9c3dd7c93cc84064dcaa15578663362ded2c0d47552201e70",
strip_prefix = "openjdk-11.0.9_11",
),
_Repo(
version = "11.0.9+11",
os = "windows",
url = "https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_windows_11.0.9_11.zip",
sha256 = "a440f37531b44ee3475c9e5466e5d0545681419784fbe98ad371938e034d9d37",
strip_prefix = "openjdk-11.0.9_11",
),
# JDK8u272-b10 ############################################################
_Repo(
version = "8u272-b10",
url = "https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u272-b10/OpenJDK8U-jdk_x64_linux_8u272b10.tar.gz",
sha256 = "654a0b082be0c6830821f22a9e1de5f9e2feb9705db79e3bb0d8c203d1b12c6a",
strip_prefix = "openjdk-8u272-b10",
),
_Repo(
version = "8u272-b10",
os = "windows",
url = "https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u272-b10/OpenJDK8U-jdk_x64_windows_8u272b10.zip",
sha256 = "63fe8a555ae6553bd6f6f0937135c31e9adbb3b2ac85232e495596d39f396b1d",
strip_prefix = "openjdk-8u272-b10",
),
]
|
def map_wiimote_to_key(wiimote_index, wiimote_button, key):
# Check the global wiimote object's button state and set the global
# keyboard object's corresponding key.
if wiimote[wiimote_index].buttons.button_down(wiimote_button):
keyboard.setKeyDown(key)
else:
keyboard.setKeyUp(key)
def map_wiimote_to_vJoy(wiimote_index, wiimote_button, key):
if wiimote[wiimote_index].buttons.button_down(wiimote_button):
vJoy[wiimote_index].setButton(key, True);
else:
vJoy[wiimote_index].setButton(key, False);
def map_wiimote_to_vJoyHat(wiimote_index):
if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight):
vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Up)
if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft):
vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Down)
if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp):
vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Left)
if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown):
vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Right)
if not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown) and not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp) and not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft) and not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight):
vJoy[wiimote_index].setDigitalPov(wiimote_index, VJoyPov.Nil)
def map_wiimote_to_vJoyAHat(wiimote_index):
x = 0
y = 0
rotate = -9000
if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp):#up
x = 1
if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown):#down
x = -1
if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft):#left
y = -1
if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight):#right
y = 1
if x == 0 and y == 0:
vJoy[wiimote_index].setAnalogPov(wiimote_index, -1)#center
else:
degrees = (math.atan2(y,x)/math.pi*18000 + rotate)%36000
vJoy[wiimote_index].setAnalogPov(wiimote_index, degrees)
#diagnostics.debug("x:" + repr(x))
#diagnostics.debug("y:" + repr(y))
#diagnostics.debug("angle: " + repr(degrees))
def map_wiimote_to_vJoyAxis(wiimote_index):
diagnostics.debug("x: " + repr(wiimote[wiimote_index].acceleration.x))
diagnostics.debug("max: " +repr(vJoy[0].axisMax))
vJoy[wiimote_index].rx = (wiimote[wiimote_index].acceleration.x+vJoy[0].axisMax)*255
vJoy[wiimote_index].ry = (wiimote[wiimote_index].acceleration.y+vJoy[0].axisMax)*255
vJoy[wiimote_index].rz = (wiimote[wiimote_index].acceleration.z+vJoy[0].axisMax)*255
def update():
# Sideways controls (DPad). Map each of our desired keys.
map_wiimote_to_vJoyAHat(0)
map_wiimote_to_vJoy(0, WiimoteButtons.One, 0)
map_wiimote_to_vJoy(0, WiimoteButtons.Two, 1)
map_wiimote_to_vJoy(0, WiimoteButtons.Plus, 2)
map_wiimote_to_vJoy(0, WiimoteButtons.Home, 3)
map_wiimote_to_vJoy(0, WiimoteButtons.Minus, 4)
map_wiimote_to_vJoy(0, WiimoteButtons.A, 5)
map_wiimote_to_vJoy(0, WiimoteButtons.B, 6)
# If we're starting up, then hook up our update function.
if starting:
wiimote[0].buttons.update += update |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 12 09:23:59 2016
@author: andre
"""
num = int(input("Choose a number to convert: "))
if num < 0:
isNeg = True
num = abs(num)
else:
isNeg = False
result = ''
if num == 0:
result = '0'
while num > 0:
result = str(num%2) + result
num = num // 2
if isNeg:
result = '-' + result
print(result) |
# OpenWeatherMap API Key
weather_api_key = "reset"
# Google API Key
g_key = "reset"
|
n = int(input('Digite um número de 0 á 9999'))
u = n // 1 % 10
d = n // 10 % 10
c = n // 100 % 10
m = n // 1000 % 10
#Eu divido a parte inteira e tiro o modúlo para aparecer apenas um número
#Exemplo 1000 // 1 = 1000
print('Analisando o número')
print('A únidade é ',(u))
print('A dezena é', (d))
print('A centena é', (c))
print('A milhar é',(m))
|
def merge_sorted_list(arr1, arr2):
# m = len(arr1), n = len(arr1)
# since we know arr1 is always greater or equal to (m+n)
# we compare arr2[i] with arr1[j] element and check if it
# should be placed there
i, j = 0, 0
while i < len(arr1) and j < len(arr2):
if arr2[j] == arr1[i] or arr2[j] <= arr1[i+1]:
arr1.insert(i+1, arr2[j])
arr1.pop()
i += 2
j += 1
elif arr2[j] > arr1[i]:
if arr1[i+1] == 0:
arr1[i+1] = arr2[j]
i += 1
j += 1
else:
i += 1
elif arr2[j] < arr1[i]:
arr1.insert(i, arr2[j])
arr1.pop()
i += 1
j += 1
print(arr1)
return arr1
def merge_sorted_list_v2(nums1, m, nums2, n):
# fill up that empty space with string
stop = 0
for i in range(len(nums1)-1, 0, -1):
if stop == len(nums2):
break
else:
nums1[i] = ""
stop += 1
print(nums1)
if m == 0:
nums1 = nums2
i, j = 0, 0
empty_space = len(nums2)
while j < len(nums2):
if nums2[j] <= nums1[i] or i == empty_space:
nums1.insert(i, nums2[j])
nums1.pop()
j += 1
empty_space += 1
else:
i += 1
return nums1
a = [1, 2, 3, 0, 0, 0]
b = [2, 5, 6]
nums1 = [-1, 0, 0, 3, 3, 3, 0, 0, 0]
m = 6
nums2 = [1, 2, 2]
n = 3
result = merge_sorted_list_v2(nums1, 6, nums2, 3)
print("result: ", result)
|
data = open(0).readlines()
e = [i == "#" for i in data[0].strip()]
b = [line.strip() for line in data[2:]]
d = ((-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1))
def neighbors(i, j):
for k, (di, dj) in enumerate(d):
yield 256 >> k, i+di, j+dj
def lookup(_s, i, j, bi, bj, flip=False):
if i == bi[0] or i + 1 == bi[1] or j == bj[0] or j + 1 == bj[1]:
return ((i, j) in _s) ^ flip
return e[sum(k for k, ni, nj in neighbors(i, j) if (ni, nj) in _s)]
s = frozenset((i, j) for i in range(len(b)) for j in range(len(b[0])) if b[i][j] == "#")
bi = (-51, len(b)+51)
bj = (-51, len(b[0])+51)
def iterate(_s, bi, bj):
return frozenset((i, j) for i in range(*bi) for j in range(*bj) if lookup(_s, i, j, bi, bj, e[0]))
for _ in range(2):
s = iterate(s, bi, bj)
print("Part 1", len(s))
for _ in range(48):
s = iterate(s, bi, bj)
print("Part 2", len(s))
for i in range(*bi):
for j in range(*bj):
if (i, j) in s:
print("#", end="")
else:
print(".", end="")
print() |
distance_success_response = {'destination_addresses': ['Brighton, UK'],
'origin_addresses': ['London, UK'], 'rows': [{'elements': [
{'distance': {'text': '64.6 mi', 'value': 103964},
'duration': {'text': '1 hour 54 mins', 'value': 6854},
'status': 'OK'}]}], 'status': 'OK'}
|
"""Bazel rule for making a zip file."""
def zip_dir(name, srcs, zipname, **kwargs):
"""Zips up an entire directory or Fileset.
Args:
name: The name of the target
srcs: A single-item list with a directory or fileset
zipname: The name of the output zip file
**kwargs: Further generic arguments to pass to genrule, e.g. visibility.
"""
if len(srcs) > 1:
fail("More than one directory is not supported by zip_dir yet", attr = srcs)
native.genrule(
name = name,
srcs = srcs,
outs = [zipname],
cmd = "zip $(OUTS) $(SRCS)",
**kwargs
)
|
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def getmerge(self,l1,l2):
head = ListNode(0)
tail = head
while l1 is not None and l2 is not None:
if l1.val > l2.val:
l1,l2 = l2,l1
tail.next = l1
l1 = l1.next
tail = tail.next
if l1 is None :
tail.next = l2
if l2 is None:
tail.next = l1
return head.next
def sortList(self, head: ListNode) -> ListNode:
if head is None or head.next is None:
return head
slownode = head
fastnode = head.next
while fastnode is not None and fastnode.next is not None:
slownode = slownode.next
fastnode = fastnode.next.next
mid = slownode.next
slownode.next = None
return self.getmerge(self.sortList(head),self.sortList(mid))
A = Solution()
a1 = ListNode(4)
a2 = ListNode(2)
a3 = ListNode(1)
a4 = ListNode(3)
a1.next = a2
a2.next = a3
a3.next = a4
print(A.sortList(a1)) |
string = 'Monty Python'
print(string[0:4])
print(string[6:7])
print(string[6:20])
print(string[8:])
data = 'From robin.smorenburg@linkit.nl Sat Jan'
position = data.find('@')
print(position)
space_position = data.find(' ', position)
print(space_position)
host = data[position+1:space_position]
print(host)
|
def baz():
tmp = "!" # try to extract this assignment, either with or without this comment
baz()
def bar(self):
pass |
# Find duplicates in an array in O(N) Time and O(1) space.
# The elements in the array can be only Between 1<=x<=len(array)
# Asked in Amazon,D-E-Shaw, Flipkart and many more
# Difficulty -> Medium (for O(N) time and O(1) space)
# Approaches:
# Naive Solution: Loop through all the values checking for multiple occurrences.
# This would take O(n^2) time
# Use sorting and then look for adjacent elements and if repeated print them.
# This would take O(nlogn) time
# Use hashmap to keep a track of element and its count and if the count is greater than
# 1 then we know the elements are repeated. This would take O(n) time but O(n) space too.
# Another solution would be to use array modification to check for multiple occurrences.
# As We know that the elements can be only be in between 1 and len(arr) thus we can
# subtract one both sides to get the index.Now as we have the index so we go to
# the array[value] and negate it and repeat this for the whole array.
# So if we encounter the a value and if it is already negated then we know that element is repeated.
def findDuplicates(arr):
size = len(arr)
# Traverse through the whole array
for i in range(0, size):
# Making sure we don't a negative index
idx = abs(arr[i]) - 1
# check if the value at idx is negative or not
if arr[idx] < 0:
# if negative then we have already encountered thus a repeated element so print it as answer
# Not using arr[idx] as it is subtracted by 1.
print(abs(arr[i]))
# else negating the value
arr[idx] = -arr[idx]
# uncomment this code to get the original array back.
# for i in range(0,size-1):
# arr[i]=abs(arr[i])
# Test cases
arr1 = [2, 1, 2, 1]
arr2 = [1, 2, 3, 1, 3, 6, 6]
findDuplicates(arr1)
print()
findDuplicates(arr2)
|
# Description: Extract just the intensities for a give Miller array and print ten rows of them.
# Source: NA
"""
Iobs = miller_arrays[${1:0}]
iobsdata = Iobs.data()
list(iobsdata[${1:100:110}])
"""
Iobs = miller_arrays[0]
iobsdata = Iobs.data()
list(iobsdata[100:110])
|
'''
8-2. Favorite Book: Write a function called favorite_book() that accepts one parameter, title.
The function should print a message, such as One of my favorite books is Alice in Wonderland.
Call the function, making sure to include a book title as an argument in the function call.
'''
def favorite_book(title):
print(f"One of my favorite books is {title} in Wonderland.")
favorite_book('Alice') |
yieldlyDB = {'FMBXOFAQCSAD4UWU4Q7IX5AV4FRV6AKURJQYGXLW3CTPTQ7XBX6MALMSPY' : 'Yieldly - YLDY-YLDY/ALGO',
'VUY44SYOFFJE3ZIDEMA6PT34J3FAZUAE6VVTOTUJ5LZ343V6WZ3ZJQTCD4' : 'Yieldly - YLDY-OPUL',
'U3RJ4NNSASBOIY25KAVVFV6CFDOS22L7YLZBENMIVVVFEWT5WE5GHXH5VQ' : 'Yieldly - GEMS-GEMS',
'BXLXRYBOM7ZNYSCRLWG6THNMO6HASTIRMJGSNJANZFS6EB3X4JY2FZCJNA' : 'Yieldly - YLDY-GEMS',
'AAXO2CVK6SHKHNROZZH3435UAYMQXZP4UTLO5LQCNTDZAXEGJJ2OPHFX54' : 'Yieldly - YLDY-ARCC',
'4UPQ2HSD7O6WY3HP33JXMPGYNMV56U3YK5WT6CTSBLGS466JPOFUVCCSTA' : 'Yieldly - ARCC-ARCC',
'YCHXDWES2VJDEKAHWPC344N6WK3FQOZL5VIZYMCDHDIUTTUZPC4IA6DEZY' : 'Yieldly - YLDY-CHOICE',
'KDZS6OV5PAARFJPRZYRRQWCZOCPICB6NJ4YNHZKNCNKIVOLSL5ZCPMY24I' : 'Yieldly - YLDY-SMILE',
'55CUF2LA45PJWIUK2KZOGN54N2POJHXAWTSVGR5HFSO4JUUDJ3SOURUVGQ' : 'Yieldly - SMILE-SMILE',
'IR2HQCMN6GPTKGCTR54YXFFUBB4A7FRZR76U2BJAS4XBLNJHZX7RMOPBIQ' : 'Yieldly - YLDY-XET',
'GLHS7QEDDSQVHNTOVFELY3ISMB44TL7I7RQ36BNFW7KMJEZA4SQUFJHV6E' : 'Yieldly - CHOICE-CHOICE',
'2RQGRKUSDCZAEFFCXXCQBCVH6KOR7FZW6N3G7B547DIS76AGQJAZZVPPPY' : 'Yieldly - OPUL-OPUL',
'3OZ3HAIID3NPKB5N3B6TGFUBX44ZBZDNNRWGY6HSPQLP3NRSQW7D6ZKFEY' : 'Yieldly - XET-XET',
'ZMJVS7F3DXYDE6XIBXGWLEL6VXUYLCN4HTOW57QDLZ2TAMOWZK7EIYAQF4' : 'Yieldly - YLDY-AKITA',
'233725844' : 'Yieldly Algo Staking',
'233725850' : 'Yieldly Staking',
'233725848' : 'Yieldly',
'233725850' : 'Yieldly - YLDY-YLDY/ALGO',
'348079765' : 'Yieldly - YLDY-OPUL',
'419301793' : 'Yieldly - GEMS-GEMS',
'393388133' : 'Yieldly - YLDY-GEMS',
'385089192' : 'Yieldly - YLDY-ARCC',
'498747685' : 'Yieldly - ARCC/ARCC',
'447336112' : 'Yieldly - YLDY-CHOICE',
'352116819' : 'Yieldly - YLDY-SMILE',
'373819681' : 'Yieldly - SMILE-SMILE',
'424101057' : 'Yieldly - YLDY-XET',
'464365150' : 'Yieldly - CHOICE-CHOICE',
'367431051' : 'Yieldly - OPUL-OPUL',
'470390215' : 'Yieldly - XET-XET',
'511597182' : 'Yieldly - YLDY-AKITA',
'511593477' : 'Yieldly - (AKITA/ALGO)LP-YLDY'}
algofiDB = {'3EPGHSNBBN5M2LD6V7A63EHZQQLATVQHDBYJQIZ6BLCBTIXA5XR7ZOZEB4' : 'Algofi - Creator',
'2SGUKZCOBEVGN3HPKSXPS6DTCXZ7LSP6G3BQF6KVUIUREBBY2QTGSON7WQ' : 'Algofi - Manager',
'TY5N6G67JWHSMWFFFZ252FXWKLRO5UZLBEJ4LGV7TPR5PVSKPLDWH3YRXU' : 'Algofi - ALGO Market',
'ABQHZLNGGPWWZVA5SOQO3HBEECVJSE3OHYLKACOTC7TC4BS52ZHREPF7QY' : 'Algofi - USDC Market',
'W5UCMHDSTGKWBOV6YVLDVPJGPE4L4ISTU6TGXC7WRF63Y7GOVFOBUNJB5Q' : 'Algofi - goBTC Market',
'KATD43XBJJIDXB3U5UCPIFUDU3CZ3YQNVWA5PDDMZVGKSR4E3QWPJX67CY' : 'Algofi - goETH Market',
'OPY7XNB5LVMECF3PHJGQV2U33LZPM5FBUXA3JJPHANAG5B7GEYUPZJVYRE' : 'Algofi - STBL Market',
'DYLJJES76YQCOUK6D4RALIPJ76U5QT7L6A2KP6QTOH63OBLFKLTER2J6IA' : 'Algofi - STBL Staking',
'Z3GWRL5HGCJQYIXP4MINCRWCKWDHZ5VSYJHDLIDLEIOARIZWJX6GLAWWEI' : 'Algofi - STBL/USDC LP Staking',
'465818260' : 'Algofi - Manager',
'465814065' : 'Algofi - ALGO Market',
'465814103' : 'Algofi - USDC Market',
'465814149' : 'Algofi - goBTC Market',
'465814222' : 'Algofi - goETH Market',
'465814278' : 'Algofi - STBL Market',
'482608867' : 'Algofi - STBL Staking',
'553866305' : 'Algofi - STBL/USDC LP Staking'}
|
print ( True or False ) == True
print ( True or True ) == True
print ( False or False ) == False
print ( True and False ) == False
print ( True and True ) == True
print ( False and False ) == False
print ( not True ) == False
print ( not False ) == True
print ( not True or False ) == ( (not True) or False )
print ( not False or False ) == ( (not False) or False )
print ( not True and True ) == ( (not True) and True )
print ( not False and True ) == ( (not False) and True )
print ( not True and not False or False ) == ( ( (not True) and (not False) ) or False )
|
#
# PySNMP MIB module Wellfleet-PGM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-PGM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:41:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Bits, IpAddress, Integer32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, iso, Counter64, ObjectIdentity, Gauge32, ModuleIdentity, Unsigned32, TimeTicks, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "IpAddress", "Integer32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "iso", "Counter64", "ObjectIdentity", "Gauge32", "ModuleIdentity", "Unsigned32", "TimeTicks", "MibIdentifier")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
wfPgmGroup, = mibBuilder.importSymbols("Wellfleet-COMMON-MIB", "wfPgmGroup")
wfPgm = MibIdentifier((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1))
wfPgmCreate = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmCreate.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmCreate.setDescription('Create/Delete parameter. Default is created. Users perform a set operation on this object in order to create/delete PGM.')
wfPgmEnable = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmEnable.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmEnable.setDescription('Enable/Disable Parameter indicates whether this PGM record is enabled or disabled.')
wfPgmState = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("init", 3), ("notpres", 4))).clone('notpres')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmState.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmState.setDescription('The current state of the entire PGM.')
wfPgmDebug = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmDebug.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmDebug.setDescription('This is a debug field for PGM. Setting bits cause pgm to gernerate certain log messages. This field will NOT restart PGM. The follow bits maybe set in any combination (LS stands for least significant): 0x00000001 for no display 0x00000002 for interface to MTM 0x00000004 for session addition 0x00000008 for session deletion 0x00000010 for retransmit state addition 0x00000020 for retransmit state deletion 0x00000040 for retransmit state timeout 0x00000080 for cache env 0x00000100 for ')
wfPgmSessionLifeTime = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(300)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmSessionLifeTime.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionLifeTime.setDescription('The length of the idle time (seconds) for which a PGM session will be aged out. An idle PGM session means there is no SPM message received from the upstream.')
wfPgmNnakGenerate = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmNnakGenerate.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmNnakGenerate.setDescription('Router will send NNAK when received the redirect NCF if this parameter is set to enabled.')
wfPgmMaxReXmitStates = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmMaxReXmitStates.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmMaxReXmitStates.setDescription('The Maxium number of retransmit state entries per slot. If no value is set means network element has no limitation on this mib.')
wfPgmTotalReXmitStates = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 8), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmTotalReXmitStates.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmTotalReXmitStates.setDescription('The total number of retransmit state entries in retransmit state table.')
wfPgmMaxSessions = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(100)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmMaxSessions.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmMaxSessions.setDescription('The Maxium number of source path state sessions per slot. If no value is set means network element has no limitation on this mib.')
wfPgmTotalSessions = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 10), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmTotalSessions.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmTotalSessions.setDescription('The total number of source path session entries currently in PGM session table')
wfPgmTotalReXmitStatesTimedOut = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 11), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmTotalReXmitStatesTimedOut.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmTotalReXmitStatesTimedOut.setDescription('The total number of retransmit state entries got removed becuase of timed-out (no correspondent RDATA received).')
wfPgmTotalUniqueNaks = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 12), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmTotalUniqueNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmTotalUniqueNaks.setDescription('The total number of unique Naks received.')
wfPgmTotalUniqueParityNaks = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 13), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmTotalUniqueParityNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmTotalUniqueParityNaks.setDescription('The total number of unique Parity Naks received.')
wfPgmMaxNakRate = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(100)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmMaxNakRate.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmMaxNakRate.setDescription('The maximum number allowed of Nak per second.')
wfPgmIfTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2), )
if mibBuilder.loadTexts: wfPgmIfTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfTable.setDescription('Table of PGM Interface Statistics')
wfPgmIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1), ).setIndexNames((0, "Wellfleet-PGM-MIB", "wfPgmIfCct"))
if mibBuilder.loadTexts: wfPgmIfEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfEntry.setDescription('A PGM Interface Statistics entry')
wfPgmIfCreate = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmIfCreate.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfCreate.setDescription('Create or delete')
wfPgmIfEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmIfEnable.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfEnable.setDescription('not used. enabled/Disabled parameter.')
wfPgmIfState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("init", 3), ("notpres", 4))).clone('notpres')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfState.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfState.setDescription('The current state of the PGM interface.')
wfPgmIfCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfCct.setDescription('The PGM circuit number')
wfPgmIfNakReXmitInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 2147483647)).clone(1000)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmIfNakReXmitInterval.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfNakReXmitInterval.setDescription('The length of time (milliseconds) for which a network element will retransmit a NAK while waiting for a corresponding NCF. This interval is counted down from the transmission of a NAK')
wfPgmIfMaxNakReXmitRate = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmIfMaxNakReXmitRate.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfMaxNakReXmitRate.setDescription('The maximum retries of NAK restransmission per second is allowed. ')
wfPgmIfNakRdataInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmIfNakRdataInterval.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfNakRdataInterval.setDescription('The length of time (seconds) for which a network element will wait for the corresponding RDATA. This interval is counted down from the time a matching NCF is received.')
wfPgmIfNakEliminateInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(5)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfPgmIfNakEliminateInterval.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfNakEliminateInterval.setDescription('The length of time (seconds) for which a network element will suspend NAK elimanation for the specific TSI/SQN. .This interval is counted down from the time the first NAK is establish. This value must be smaller than wfPgmNakRdataInterval. If the value of this parameter is set to 1 then all the duplicate NAKs will be elimanated.')
wfPgmIfTotalReXmitStates = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfTotalReXmitStates.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfTotalReXmitStates.setDescription('The total retransmit state entries for this interface.')
wfPgmIfTotalReXmitTimedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfTotalReXmitTimedOut.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfTotalReXmitTimedOut.setDescription('The total time-outed retransmit state entries for this interface.')
wfPgmIfInSpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInSpms.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInSpms.setDescription('The total number of SPM received on the PGM interface.')
wfPgmIfOutSpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutSpms.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutSpms.setDescription('The total number of SPM sent out from the PGM interface.')
wfPgmIfInParitySpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInParitySpms.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInParitySpms.setDescription('The total number of parity SPM received on the PGM interface')
wfPgmIfOutParitySpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutParitySpms.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutParitySpms.setDescription('The total number of parity SPM sent out from the PGM interface')
wfPgmIfInSpmPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInSpmPortErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInSpmPortErrors.setDescription('The number of received SPM discarded on the PGM interface for the wrong inbound')
wfPgmIfInRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInRdata.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInRdata.setDescription('The total number of RDATA received on the PGM interface')
wfPgmIfOutRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutRdata.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutRdata.setDescription('The total number of RDATA sent out from the PGM interface')
wfPgmIfInParityRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInParityRdata.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInParityRdata.setDescription('The total number of Parity RDATA received on the PGM interface')
wfPgmIfOutParityRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutParityRdata.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutParityRdata.setDescription('The total number of parity RDATA sent out from the PGM interface')
wfPgmIfInRdataPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInRdataPortErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInRdataPortErrors.setDescription('The number of received RDATA discarded because of wrong inbound')
wfPgmIfInRdataNoSessionErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInRdataNoSessionErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInRdataNoSessionErrors.setDescription('The number of received RDATA discarded because of no session')
wfPgmIfUniqueNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfUniqueNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfUniqueNaks.setDescription('The total number of unique NAKs received for this interface.')
wfPgmIfInNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNaks.setDescription('The total number of NAK received on the PGM interface')
wfPgmIfOutNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutNaks.setDescription('The total number of NAK sent out from the PGM interface')
wfPgmIfUniqueParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfUniqueParityNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfUniqueParityNaks.setDescription('The total number of unique parity NAKs received for this interface.')
wfPgmIfInParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInParityNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInParityNaks.setDescription('The total number of parity NAK received on the PGM interface')
wfPgmIfOutParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 27), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutParityNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutParityNaks.setDescription('The total number of parity NAK sent out from the PGM interface')
wfPgmIfInNakPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 28), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNakPortErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNakPortErrors.setDescription('The number of received NAK discarded because of wrong outbound')
wfPgmIfInNakNoSessionErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 29), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNakNoSessionErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNakNoSessionErrors.setDescription('The number of received NAK Discarded because of no session')
wfPgmIfInNakSeqErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 30), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNakSeqErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNakSeqErrors.setDescription('The number of received NAK Discarded because of out of sequence (out of retransmit window).')
wfPgmIfInParityNakTgErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 31), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInParityNakTgErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInParityNakTgErrors.setDescription('The number of received parity NAK Discarded because of out of parity TG window.')
wfPgmIfInNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 32), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNnaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNnaks.setDescription('The total number of NNAK received on the PGM interface')
wfPgmIfOutNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 33), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutNnaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutNnaks.setDescription('The total number of NNAK sent out from the PGM interface')
wfPgmIfInParityNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 34), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInParityNnaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInParityNnaks.setDescription('The total number of parity NNAK received on the PGM interface')
wfPgmIfOutParityNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 35), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutParityNnaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutParityNnaks.setDescription('The total number of parity NNAK sent out from the PGM interface')
wfPgmIfInNnakPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 36), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNnakPortErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNnakPortErrors.setDescription('The number of received NNAK discarded because of wrong mcast outbound')
wfPgmIfInNnakNoSessionErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 37), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNnakNoSessionErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNnakNoSessionErrors.setDescription('The number of received NNAK discarded because of no session')
wfPgmIfInNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 38), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNcfs.setDescription('The total number of NCF received on the PGM interface')
wfPgmIfOutNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 39), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutNcfs.setDescription('The total number of NCF sent out from the PGM interface')
wfPgmIfInParityNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 40), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInParityNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInParityNcfs.setDescription('The total number of parity NCF received on the PGM interface')
wfPgmIfOutParityNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 41), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfOutParityNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfOutParityNcfs.setDescription('The total number of parity NCF sent out from the PGM interface')
wfPgmIfInNcfPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 42), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNcfPortErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNcfPortErrors.setDescription('The number of received NCF discarded because of the wrong inbound')
wfPgmIfInNcfNoSessionErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 43), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInNcfNoSessionErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInNcfNoSessionErrors.setDescription('The number of received NCF discarded because of no session')
wfPgmIfInRedirectNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 44), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmIfInRedirectNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmIfInRedirectNcfs.setDescription('The number of redirected NCF received on the PGM interface')
wfPgmSessionTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3), )
if mibBuilder.loadTexts: wfPgmSessionTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionTable.setDescription('Table of PGM flow for each (port,global id)')
wfPgmSessionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1), ).setIndexNames((0, "Wellfleet-PGM-MIB", "wfPgmSessionSource"), (0, "Wellfleet-PGM-MIB", "wfPgmSessionGroup"), (0, "Wellfleet-PGM-MIB", "wfPgmSessionSourcePort"), (0, "Wellfleet-PGM-MIB", "wfPgmSessionGlobalId"))
if mibBuilder.loadTexts: wfPgmSessionEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionEntry.setDescription('A PGM Session entry')
wfPgmSessionSource = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionSource.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionSource.setDescription('The source IP address of this entry.')
wfPgmSessionGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionGroup.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionGroup.setDescription('The destination group address of this entry')
wfPgmSessionSourcePort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionSourcePort.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionSourcePort.setDescription('The source port of this pgm session')
wfPgmSessionGlobalId = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionGlobalId.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionGlobalId.setDescription('The Global ID this entry')
wfPgmSessionUpstreamAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 5), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionUpstreamAddress.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionUpstreamAddress.setDescription('The IP address of the upstream interface for the entry.')
wfPgmSessionUpstreamIfCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionUpstreamIfCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionUpstreamIfCct.setDescription('The circuit number of the upstream intf for the entry.')
wfPgmSessionTrailEdgeSeq = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionTrailEdgeSeq.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionTrailEdgeSeq.setDescription('The trailing edge sequence of the transfer window.')
wfPgmSessionIncrSeq = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionIncrSeq.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionIncrSeq.setDescription('The increase sequnce number in the transfer window.')
wfPgmSessionLeadEdgeSeq = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionLeadEdgeSeq.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionLeadEdgeSeq.setDescription('The leading edge sequence of the transfer window.')
wfPgmSessionInSpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInSpms.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInSpms.setDescription('The total number of SPMs received for this session.')
wfPgmSessionOutSpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutSpms.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutSpms.setDescription('The total number of SPMs sent out for this session.')
wfPgmSessionInParitySpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInParitySpms.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInParitySpms.setDescription('The total number of ParityS PMs received for this session.')
wfPgmSessionOutParitySpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutParitySpms.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutParitySpms.setDescription('The total number of Parity SPMs sent out for this session.')
wfPgmSessionTotalReXmitStates = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionTotalReXmitStates.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionTotalReXmitStates.setDescription('The total retransmit state entries for this session.')
wfPgmSessionTotalReXmitTimedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionTotalReXmitTimedOut.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionTotalReXmitTimedOut.setDescription('The total time-outed retransmit state entries for this session.')
wfPgmSessionInRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInRdata.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInRdata.setDescription('The total number of RDATAs received for this session.')
wfPgmSessionOutRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutRdata.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutRdata.setDescription('The total number of RDATAs sent out from this session.')
wfPgmSessionInParityRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInParityRdata.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInParityRdata.setDescription('The total number of parity RDATAs received for this session.')
wfPgmSessionOutParityRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutParityRdata.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutParityRdata.setDescription('The total number of parity RDATAs sent out from this session.')
wfPgmSessionInRdataNoStateErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInRdataNoStateErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInRdataNoStateErrors.setDescription('The total number of received RDATA discarded for no Retransmit state.')
wfPgmSessionUniqueNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionUniqueNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionUniqueNaks.setDescription('The total number of unique NAKs received for this session.')
wfPgmSessionInNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInNaks.setDescription('The total number of NAKs received for this session.')
wfPgmSessionOutNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutNaks.setDescription('The total number of NAKs sent out from this session.')
wfPgmSessionUniqueParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionUniqueParityNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionUniqueParityNaks.setDescription('The total number of unique parity NAKs received for this session.')
wfPgmSessionInParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInParityNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInParityNaks.setDescription('The total number of parity NAKs received for this session.')
wfPgmSessionOutParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutParityNaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutParityNaks.setDescription('The total number of parity NAKs sent out from this session.')
wfPgmSessionInNakSeqErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 27), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInNakSeqErrors.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInNakSeqErrors.setDescription('The total number of received NAKs discarded because of out of sequence (out of retransmit window).')
wfPgmSessionInNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 28), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInNnaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInNnaks.setDescription('The total number of NNAKs received for this session.')
wfPgmSessionOutNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 29), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutNnaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutNnaks.setDescription('The total number of NNAKs sent out from this session.')
wfPgmSessionInParityNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 30), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInParityNnaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInParityNnaks.setDescription('The total number of parity NNAKs received for this session.')
wfPgmSessionOutParityNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 31), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutParityNnaks.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutParityNnaks.setDescription('The total number of Parity NNAKs sent out from this session.')
wfPgmSessionInNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 32), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInNcfs.setDescription('The total number of Ncfs received for this session.')
wfPgmSessionOutNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 33), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutNcfs.setDescription('The total number of Ncfs sent out from this session.')
wfPgmSessionInParityNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 34), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInParityNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInParityNcfs.setDescription('The total number of Parity Ncfs received for this session.')
wfPgmSessionOutParityNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 35), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionOutParityNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionOutParityNcfs.setDescription('The total number of Parity Ncfs sent out from this session.')
wfPgmSessionInRedirectNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 36), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmSessionInRedirectNcfs.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmSessionInRedirectNcfs.setDescription('The total number of redirect Ncfs received for this session.')
wfPgmReXmitTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4), )
if mibBuilder.loadTexts: wfPgmReXmitTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitTable.setDescription('Table of PGM Retransmit state')
wfPgmReXmitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1), ).setIndexNames((0, "Wellfleet-PGM-MIB", "wfPgmReXmitSource"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitGroup"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitSourcePort"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitGlobalId"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitSelectiveSeqNum"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitParityTgSeqNum"))
if mibBuilder.loadTexts: wfPgmReXmitEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitEntry.setDescription('A PGM ReXmit entry')
wfPgmReXmitSource = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitSource.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitSource.setDescription('The source IP address of this entry.')
wfPgmReXmitGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitGroup.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitGroup.setDescription('The destination group address of this entry')
wfPgmReXmitSourcePort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitSourcePort.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitSourcePort.setDescription('The source port of this pgm retransmit state')
wfPgmReXmitGlobalId = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitGlobalId.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitGlobalId.setDescription('The Global ID this entry')
wfPgmReXmitSelectiveSeqNum = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitSelectiveSeqNum.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitSelectiveSeqNum.setDescription('The Selected Sequence number for this entry.')
wfPgmReXmitParityTgSeqNum = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitParityTgSeqNum.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitParityTgSeqNum.setDescription('The Requested Parity Tg sequence number for this entry. this value will be the same as wfPgmSessionParityTgSeq.')
wfPgmReXmitReqParityTgCount = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitReqParityTgCount.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitReqParityTgCount.setDescription('The Requested number of missing Parity packets of specific Tg. The largest counter of the received NAK will be stored in this mib.')
wfPgmReXmitUpStreamCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitUpStreamCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitUpStreamCct.setDescription('The upstream interface circuit number.')
wfPgmReXmitDownStream = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 9), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfPgmReXmitDownStream.setStatus('mandatory')
if mibBuilder.loadTexts: wfPgmReXmitDownStream.setDescription('list of downstream intfs for this entry. Each one is in the format of (intf_addr(u_int32) and intf_cct(u_int16)')
mibBuilder.exportSymbols("Wellfleet-PGM-MIB", wfPgmIfInRdataNoSessionErrors=wfPgmIfInRdataNoSessionErrors, wfPgmSessionSource=wfPgmSessionSource, wfPgmIfInNnakNoSessionErrors=wfPgmIfInNnakNoSessionErrors, wfPgmTotalSessions=wfPgmTotalSessions, wfPgmMaxReXmitStates=wfPgmMaxReXmitStates, wfPgmIfInNaks=wfPgmIfInNaks, wfPgmIfInRdata=wfPgmIfInRdata, wfPgmSessionUniqueParityNaks=wfPgmSessionUniqueParityNaks, wfPgmSessionInParitySpms=wfPgmSessionInParitySpms, wfPgmTotalUniqueParityNaks=wfPgmTotalUniqueParityNaks, wfPgmIfNakReXmitInterval=wfPgmIfNakReXmitInterval, wfPgmSessionOutParitySpms=wfPgmSessionOutParitySpms, wfPgmIfInParityNaks=wfPgmIfInParityNaks, wfPgmIfInNnaks=wfPgmIfInNnaks, wfPgmSessionInRdataNoStateErrors=wfPgmSessionInRdataNoStateErrors, wfPgmIfInSpms=wfPgmIfInSpms, wfPgmIfTotalReXmitStates=wfPgmIfTotalReXmitStates, wfPgmSessionInNnaks=wfPgmSessionInNnaks, wfPgmState=wfPgmState, wfPgmIfInRedirectNcfs=wfPgmIfInRedirectNcfs, wfPgmSessionInNcfs=wfPgmSessionInNcfs, wfPgmIfInNnakPortErrors=wfPgmIfInNnakPortErrors, wfPgmSessionInRedirectNcfs=wfPgmSessionInRedirectNcfs, wfPgmMaxNakRate=wfPgmMaxNakRate, wfPgmSessionOutNaks=wfPgmSessionOutNaks, wfPgmSessionTotalReXmitStates=wfPgmSessionTotalReXmitStates, wfPgmIfState=wfPgmIfState, wfPgmSessionUpstreamIfCct=wfPgmSessionUpstreamIfCct, wfPgmMaxSessions=wfPgmMaxSessions, wfPgmIfTable=wfPgmIfTable, wfPgmSessionOutParityNaks=wfPgmSessionOutParityNaks, wfPgmSessionTrailEdgeSeq=wfPgmSessionTrailEdgeSeq, wfPgm=wfPgm, wfPgmIfOutSpms=wfPgmIfOutSpms, wfPgmNnakGenerate=wfPgmNnakGenerate, wfPgmTotalUniqueNaks=wfPgmTotalUniqueNaks, wfPgmSessionUniqueNaks=wfPgmSessionUniqueNaks, wfPgmIfMaxNakReXmitRate=wfPgmIfMaxNakReXmitRate, wfPgmEnable=wfPgmEnable, wfPgmIfInSpmPortErrors=wfPgmIfInSpmPortErrors, wfPgmSessionTable=wfPgmSessionTable, wfPgmSessionTotalReXmitTimedOut=wfPgmSessionTotalReXmitTimedOut, wfPgmIfEnable=wfPgmIfEnable, wfPgmSessionSourcePort=wfPgmSessionSourcePort, wfPgmSessionInNaks=wfPgmSessionInNaks, wfPgmReXmitParityTgSeqNum=wfPgmReXmitParityTgSeqNum, wfPgmIfNakRdataInterval=wfPgmIfNakRdataInterval, wfPgmIfOutParitySpms=wfPgmIfOutParitySpms, wfPgmReXmitSource=wfPgmReXmitSource, wfPgmSessionInParityRdata=wfPgmSessionInParityRdata, wfPgmCreate=wfPgmCreate, wfPgmIfInNcfPortErrors=wfPgmIfInNcfPortErrors, wfPgmReXmitEntry=wfPgmReXmitEntry, wfPgmSessionOutParityNcfs=wfPgmSessionOutParityNcfs, wfPgmIfInParityNnaks=wfPgmIfInParityNnaks, wfPgmIfOutNnaks=wfPgmIfOutNnaks, wfPgmIfOutParityRdata=wfPgmIfOutParityRdata, wfPgmIfOutNcfs=wfPgmIfOutNcfs, wfPgmIfInNcfNoSessionErrors=wfPgmIfInNcfNoSessionErrors, wfPgmSessionOutNcfs=wfPgmSessionOutNcfs, wfPgmSessionLifeTime=wfPgmSessionLifeTime, wfPgmIfInNakNoSessionErrors=wfPgmIfInNakNoSessionErrors, wfPgmSessionIncrSeq=wfPgmSessionIncrSeq, wfPgmIfInNakSeqErrors=wfPgmIfInNakSeqErrors, wfPgmReXmitGroup=wfPgmReXmitGroup, wfPgmReXmitReqParityTgCount=wfPgmReXmitReqParityTgCount, wfPgmIfEntry=wfPgmIfEntry, wfPgmIfTotalReXmitTimedOut=wfPgmIfTotalReXmitTimedOut, wfPgmIfOutRdata=wfPgmIfOutRdata, wfPgmIfCct=wfPgmIfCct, wfPgmIfInParitySpms=wfPgmIfInParitySpms, wfPgmSessionOutParityRdata=wfPgmSessionOutParityRdata, wfPgmReXmitTable=wfPgmReXmitTable, wfPgmSessionInRdata=wfPgmSessionInRdata, wfPgmSessionOutNnaks=wfPgmSessionOutNnaks, wfPgmSessionInParityNcfs=wfPgmSessionInParityNcfs, wfPgmSessionGlobalId=wfPgmSessionGlobalId, wfPgmSessionInParityNaks=wfPgmSessionInParityNaks, wfPgmReXmitUpStreamCct=wfPgmReXmitUpStreamCct, wfPgmIfOutNaks=wfPgmIfOutNaks, wfPgmSessionOutParityNnaks=wfPgmSessionOutParityNnaks, wfPgmSessionInSpms=wfPgmSessionInSpms, wfPgmIfOutParityNaks=wfPgmIfOutParityNaks, wfPgmIfNakEliminateInterval=wfPgmIfNakEliminateInterval, wfPgmIfInNcfs=wfPgmIfInNcfs, wfPgmIfInParityNcfs=wfPgmIfInParityNcfs, wfPgmSessionEntry=wfPgmSessionEntry, wfPgmIfOutParityNcfs=wfPgmIfOutParityNcfs, wfPgmSessionOutSpms=wfPgmSessionOutSpms, wfPgmSessionOutRdata=wfPgmSessionOutRdata, wfPgmDebug=wfPgmDebug, wfPgmIfInParityNakTgErrors=wfPgmIfInParityNakTgErrors, wfPgmReXmitSourcePort=wfPgmReXmitSourcePort, wfPgmReXmitSelectiveSeqNum=wfPgmReXmitSelectiveSeqNum, wfPgmReXmitGlobalId=wfPgmReXmitGlobalId, wfPgmTotalReXmitStatesTimedOut=wfPgmTotalReXmitStatesTimedOut, wfPgmSessionGroup=wfPgmSessionGroup, wfPgmIfCreate=wfPgmIfCreate, wfPgmIfUniqueParityNaks=wfPgmIfUniqueParityNaks, wfPgmSessionLeadEdgeSeq=wfPgmSessionLeadEdgeSeq, wfPgmReXmitDownStream=wfPgmReXmitDownStream, wfPgmIfUniqueNaks=wfPgmIfUniqueNaks, wfPgmSessionUpstreamAddress=wfPgmSessionUpstreamAddress, wfPgmIfOutParityNnaks=wfPgmIfOutParityNnaks, wfPgmSessionInNakSeqErrors=wfPgmSessionInNakSeqErrors, wfPgmIfInNakPortErrors=wfPgmIfInNakPortErrors, wfPgmSessionInParityNnaks=wfPgmSessionInParityNnaks, wfPgmIfInParityRdata=wfPgmIfInParityRdata, wfPgmTotalReXmitStates=wfPgmTotalReXmitStates, wfPgmIfInRdataPortErrors=wfPgmIfInRdataPortErrors)
|
points_str = input("Enter the lead in points: ")
points_remaining_int = int(points_str)
lead_calculation_float= float(points_remaining_int - 3)
has_ball_str = input("Does the lead team have the ball (Yes or No): ")
if has_ball_str == "Yes":
lead_calculation_float=lead_calculation_float + 0.5
else:
lead_calculation_float=lead_calculation_float - 0.5
if lead_calculation_float < 0:
lead_calculation_float = 0
lead_calculation_float= lead_calculation_float**2
seconds_remaining_int = int(input("Enter the number of seconds remaining: "))
if lead_calculation_float > seconds_remaining_int:
print("Lead is safe.")
else:
print("Lead is not safe.")
|
alien_color = 'green'
if alien_color == 'green':
print("You get 5 points.")
else:
print("\nYou get 10 points.")
alien_color = 'yellow'
if alien_color == 'green':
print("You get 5 points.")
else:
print("\nYou get 10 points.") |
class School:
def __init__(self):
"""Initiates database for the school."""
self._db = {}
def add_student(self, name, grade):
"""Add student to the school databsase."""
self._db.setdefault(grade, []).append(name)
self._db[grade].sort()
def roster(self):
"""Creates a roster for the school."""
students_list = []
for grades in sorted(self._db):
students_list.extend(self._db[grades])
return students_list
def grade(self, grade_number):
"""Returns students of respective grade."""
return self._db.get(grade_number, []).copy()
|
DATABASE_CONFIG = {
'uri': 'postgres://username:password@host/database'
}
JSREPORT_CONFIG = {
'uri': 'changeme',
'username': 'changeme',
'password': 'changeme',
'template': 'changeme'
}
ZIP_CONFIG = {
'name': 'flask_batch_download.zip'
}
|
class Prop:
MAX_HOUSE = 4
def __init__(self, name, price, lien, house_price, class_count, klass, **taxes):
self.name = name
self.price = price
self.lien = lien
self.house_price = house_price
self.taxes = taxes
self.owner = None
self.n_house = 0
self.klass = klass
self.class_count = class_count
def sell_to(self, player):
if self.owner is None:
self.owner = player
player.give_money(self.price)
return True
print("returning false")
return False
def add_house(self, house_n):
n_house = self.n_house + house_n
enough_money = self.owner.get_money() - (house_n * self.house_price) < 0
if n_house > Prop.MAX_HOUSE:
print("troppe case. Puoi comprarne massimo '{0}'".format(Prop.MAX_HOUSE - self.n_house))
elif not enough_money:
print("Non hai abbastanza soldi per comprare tutte queste case") # spostare questi print nella classe home
# trovare un altro meccanismo per gestire l'aggiunta di una casa. Le stringhe sono presentazione e vanno
# messe altrove
else:
self.n_house = n_house
def get_tax(self, series_count):
if series_count < self.class_count:
return self.taxes['none']
else:
if self.n_house == 0:
return self.taxes['complete']
elif self.n_house == 1:
return self.taxes['one']
elif self.n_house == 2:
return self.taxes['two']
elif self.n_house == 3:
return self.taxes['three']
elif self.n_house == 4:
return self.taxes['four']
elif self.n_house == 5:
return self.taxes['hotel']
def __str__(self):
return "name '{0}' price '{3}' taxes '{1}' owner '{2}'\n".format(self.name, self.taxes, self.owner, self.price)
def __repr__(self):
return self.__str__()
class Station(Prop):
def __init__(self, name, lien, price=200):
super().__init__(name, price, lien, house_price=0, class_count=4, klass=50, taxes=None)
def get_tax(self, series_count):
if series_count == 1:
return 25
if series_count == 2:
return 50
if series_count == 3:
return 100
if series_count == 5:
return 200
class Company(Prop):
def __init__(self, name, lien, price):
super().__init__(name, price, lien, house_price=0, class_count=2, klass=80, taxes=None)
def get_tax(self, series_count):
if series_count == 1:
return self.owner.roll_dice() * 4
if series_count == 2:
return self.owner.roll_dice() * 10
|
#create file myaperture.dat needed for source optimization
f = open("myaperture.dat",'w')
f.write(" 50.0 -0.002 0.002 -0.002 0.002")
f.close()
print("File written to disk: myaperture.dat")
|
"""Module containing expected string output to be used in test_game.py."""
leader_board_string = expected_string = """\n-------- LEADERBOARD --------
Clive Felix 1
Adis 0
-----------------------------"""
rules_string = """\n\x1b[92mPig is a simple dice game first described in print by\n
John Scarne in 1945. Players take turns to roll a single dice as many\n
times as they wish, adding all roll results to a running total, but losing\n
their gained score for the turn if they roll a 1.\x1b[0m\n"""
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.