content
stringlengths 7
1.05M
|
---|
# An algorithm to reconstruct the queue.
# Suppose you have a random list of people standing in a queue.
# Each person is described by a pair of integers (h,k), where h is the height of the person and k is the number of people in front of this person who have a height greater than or equal to h.
class Solution:
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
people = sorted(people, key = lambda x: (-x[0], x[1]))
ans = []
for pep in people:
ans.insert(pep[1], pep)
return ans
|
# statements that used at the start of defenition or in statements without columns
defenition_statements = {
"DROP": "DROP",
"CREATE": "CREATE",
"TABLE": "TABLE",
"DATABASE": "DATABASE",
"SCHEMA": "SCHEMA",
"ALTER": "ALTER",
"TYPE": "TYPE",
"DOMAIN": "DOMAIN",
"REPLACE": "REPLACE",
"OR": "OR",
"CLUSTERED": "CLUSTERED",
"SEQUENCE": "SEQUENCE",
"TABLESPACE": "TABLESPACE",
}
common_statements = {
"INDEX": "INDEX",
"REFERENCES": "REFERENCES",
"KEY": "KEY",
"ADD": "ADD",
"AS": "AS",
"CLONE": "CLONE",
"DEFERRABLE": "DEFERRABLE",
"INITIALLY": "INITIALLY",
"IF": "IF",
"NOT": "NOT",
"EXISTS": "EXISTS",
"ON": "ON",
"FOR": "FOR",
"ENCRYPT": "ENCRYPT",
"SALT": "SALT",
"NO": "NO",
"USING": "USING",
# bigquery
"OPTIONS": "OPTIONS",
}
columns_defenition = {
"DELETE": "DELETE",
"UPDATE": "UPDATE",
"NULL": "NULL",
"ARRAY": "ARRAY",
",": "COMMA",
"DEFAULT": "DEFAULT",
"COLLATE": "COLLATE",
"ENFORCED": "ENFORCED",
"ENCODE": "ENCODE",
"GENERATED": "GENERATED",
"COMMENT": "COMMENT",
}
first_liners = {
"LIKE": "LIKE",
"CONSTRAINT": "CONSTRAINT",
"FOREIGN": "FOREIGN",
"PRIMARY": "PRIMARY",
"UNIQUE": "UNIQUE",
"CHECK": "CHECK",
"WITH": "WITH",
}
common_statements.update(first_liners)
defenition_statements.update(common_statements)
after_columns_tokens = {
"PARTITIONED": "PARTITIONED",
"PARTITION": "PARTITION",
"BY": "BY",
# hql
"INTO": "INTO",
"STORED": "STORED",
"LOCATION": "LOCATION",
"ROW": "ROW",
"FORMAT": "FORMAT",
"TERMINATED": "TERMINATED",
"COLLECTION": "COLLECTION",
"ITEMS": "ITEMS",
"MAP": "MAP",
"KEYS": "KEYS",
"SERDE": "SERDE",
"CLUSTER": "CLUSTER",
"SERDEPROPERTIES": "SERDEPROPERTIES",
"TBLPROPERTIES": "TBLPROPERTIES",
"SKEWED": "SKEWED",
# oracle
"STORAGE": "STORAGE",
"TABLESPACE": "TABLESPACE",
# mssql
"TEXTIMAGE_ON": "TEXTIMAGE_ON",
}
sequence_reserved = {
"INCREMENT": "INCREMENT",
"START": "START",
"MINVALUE": "MINVALUE",
"MAXVALUE": "MAXVALUE",
"CACHE": "CACHE",
"NO": "NO",
}
tokens = tuple(
set(
["ID", "DOT", "STRING", "DQ_STRING", "LP", "RP", "LT", "RT", "COMMAT"]
+ list(defenition_statements.values())
+ list(common_statements.values())
+ list(columns_defenition.values())
+ list(sequence_reserved.values())
+ list(after_columns_tokens.values())
)
)
symbol_tokens = {
")": "RP",
"(": "LP",
}
symbol_tokens_no_check = {"<": "LT", ">": "RT"}
|
def kmp(P, T):
# Compute the start position (number of chars) of the longest suffix that matches a prefix,
# and store them into list K, the first element of K is set to be -1, the second
#
K = [] # K[t] store the value that when mismatch happens at t, should move Pattern P K[t] characters ahead
t = -1 # K's length is len(P) + 1, the first element is set to be -1, corresponding to no elements in P.
K.append(t) # Add the first element, keep t = -1.
for k in range(1, len(P) + 1):
# traverse all the elemtn in P, calculate the corresponding value for each element.
while(t >= 0 and P[t] != P[k - 1]): # if t=-1, then let t = 0, if t>=0 and current suffix doesn't match, then try a shorter suffix
t = K[t]
t = t + 1 # If it matches, then the matching position should be one character ahead.
K.append(t) # record the matching postion for k
print(K)
# Match the String T with P
m = 0 # Record the current matching position in P when compared with T
for i in range(0, len(T)): # traverse T one-by-one
while (m >= 0 and P[m] != T[i]): # if mismatch happens at position m, move P forward with K[m] characters and restart comparison
m = K[m]
m = m + 1 # if position m matches, move P forward to next position
if m == len(P): # if m is already the end of K (or P), the a fully match is found. Continue comparison by move P forward K[m] characters
print (i - m + 1, i)
m = K[m]
if __name__ == "__main__":
kmp('abcbabca', 'abcbabcabcbabcbabcbabcabcbabcbabca')
kmp('abab', 'ababcabababc')
|
class _FuncStorage:
def __init__(self):
self._function_map = {}
def insert_function(self, name, function):
self._function_map[name] = function
def get_all_functions(self):
return self._function_map
|
A=int(input("dame int"))
B=int(input("dame int"))
if(A>B):
print("A es mayor")
else:
print("B es mayor")
|
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-03-15 00:07:14
# Description:
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
result = set()
for i in range(0, len(nums) - 1):
# Reduce the problem to two sum(0)
two_sum = -nums[i]
cache = set()
for num in nums[i + 1:]:
remaining = two_sum - num
if remaining in cache:
#sorting to create unique tuples
triplet = tuple(sorted([nums[i], remaining, num]))
# using tuple in a set will eliminate duplicates combinations
result.add(triplet)
else:
cache.add(num)
return result
if __name__ == "__main__":
pass
|
bluelabs_format_hints = {
'field-delimiter': ',',
'record-terminator': "\n",
'compression': 'GZIP',
'quoting': None,
'quotechar': '"',
'doublequote': False,
'escape': '\\',
'encoding': 'UTF8',
'dateformat': 'YYYY-MM-DD',
'timeonlyformat': 'HH24:MI:SS',
'datetimeformattz': 'YYYY-MM-DD HH:MI:SSOF',
'datetimeformat': 'YYYY-MM-DD HH24:MI:SS',
'header-row': False,
}
csv_format_hints = {
'field-delimiter': ',',
'record-terminator': "\n",
'compression': 'GZIP',
'quoting': 'minimal',
'quotechar': '"',
'doublequote': True,
'escape': None,
'encoding': 'UTF8',
'dateformat': 'MM/DD/YY',
'timeonlyformat': 'HH24:MI:SS',
'datetimeformattz': 'MM/DD/YY HH24:MI',
'datetimeformat': 'MM/DD/YY HH24:MI',
'header-row': True,
}
vertica_format_hints = {
'field-delimiter': '\001',
'record-terminator': '\002',
'compression': None,
'quoting': None,
'quotechar': '"',
'doublequote': False,
'escape': None,
'encoding': 'UTF8',
'dateformat': 'YYYY-MM-DD',
'timeonlyformat': 'HH24:MI:SS',
'datetimeformat': 'YYYY-MM-DD HH:MI:SS',
'datetimeformattz': 'YYYY-MM-DD HH:MI:SSOF',
'header-row': False,
}
|
# FROM THE OP PAPER-ISH
MINI_BATCH_SIZE = 32
MEMORY_SIZE = 10**6
BUFFER_SIZE = 100
LHIST = 4
GAMMA = 0.99
UPDATE_FREQ_ONlINE = 4
UPDATE_TARGET = 2500 # This was 10**4 but is measured in actor steps, so it's divided update_freq_online
TEST_FREQ = 5*10**4 # Measure in updates
TEST_STEPS = 10**4
LEARNING_RATE = 0.00025
G_MOMENTUM = 0.95
EPSILON_INIT = 1.0
EPSILON_FINAL = 0.1
EPSILON_TEST = 0.05
EPSILON_LIFE = 10**6
REPLAY_START = 5*10**4
NO_OP_MAX = 30
UPDATES = 5*10**6
CLIP_REWARD = 1.0
CLIP_ERROR = 1.0
# MISC
PLAY_STEPS = 3000
BUFFER_SAMPLES = 20
CROP = (0, -1)
FRAMESIZE = [84,84]
FRAMESIZETP = (84,84)
#DROPS = [0.0,0.15,0.1,0.0]
DROPS = [0.0, 0.0, 0.0, 0.0]
Games = ['air_raid', 'alien', 'amidar', 'assault', 'asterix', 'asteroids', 'atlantis',
'bank_heist', 'battle_zone', 'beam_rider', 'bowling', 'boxing', 'breakout', 'carnival',
'centipede', 'chopper_command', 'crazy_climber', 'demon_attack', 'double_dunk',
'enduro', 'fishing_derby', 'freeway', 'frostbite', 'gopher', 'gravitar',
'hero', 'ice_hockey', 'jamesbond', 'kangaroo', 'krull', 'kung_fu_master',
'montezuma_revenge', 'ms_pacman', 'name_this_game', 'pong',
'private_eye', 'qbert', 'riverraid', 'road_runner', 'robotank', 'seaquest',
'space_invaders', 'star_gunner', 'tennis', 'time_pilot', 'tutankham', 'up_n_down',
'venture', 'video_pinball', 'wizard_of_wor', 'zaxxon']
GamesExtras = ['defender','phoenix','berzerk','skiing','yars_revenge','solaris','pitfall',]
ACTION_MEANING = {
0: "NOOP",
1: "FIRE",
2: "UP",
3: "RIGHT",
4: "LEFT",
5: "DOWN",
6: "UPRIGHT",
7: "UPLEFT",
8: "DOWNRIGHT",
9: "DOWNLEFT",
10: "UPFIRE",
11: "RIGHTFIRE",
12: "LEFTFIRE",
13: "DOWNFIRE",
14: "UPRIGHTFIRE",
15: "UPLEFTFIRE",
16: "DOWNRIGHTFIRE",
17: "DOWNLEFTFIRE",
} |
# author: jamie
# email: jinjiedeng.jjd@gmail.com
def Priority (c):
if c == '&': return 3
elif c == '|': return 2
elif c == '^': return 1
elif c == '(': return 0
def InfixToPostfix (infix, postfix):
stack = []
for c in infix:
if c == '(':
stack.append('(')
elif c == ')':
while stack[-1] != '(':
postfix.append(stack.pop())
stack.pop()
elif c == '&' or c == '|' or c == '^':
while len(stack) and Priority(c) <= Priority(stack[-1]):
postfix.append(stack.pop())
stack.append(c)
else:
postfix.append(c)
while len(stack):
postfix.append(stack.pop())
def Evaluate (postfix, value):
stack = []
for c in postfix:
if c == '&' or c == '|' or c == '^':
rhs = stack.pop()
lhs = stack.pop()
if c == '&': stack.append(lhs & rhs)
elif c == '|': stack.append(lhs | rhs)
elif c == '^': stack.append(lhs ^ rhs)
elif c == '1' or c == '0':
stack.append(ord(c) - ord('0'))
else:
stack.append(value[ord(c) - ord('A')])
return stack.pop()
if __name__ == "__main__":
infix = input()
T = int(input())
for _ in range(T):
value = list(map(int, input().split()))
postfix = []
InfixToPostfix(infix, postfix)
print(Evaluate(postfix, value)) |
class Ciclo:
def __init__(self):
self.cicloNew = ()
self.respu = ()
self.a = ()
self.b = ()
self.c = ()
def nuevoCiclo(self):
cicloNew = []
print(" ")
print("Formulario de ingreso de ciclos")
print("-----------------------------------")
respu = input("¿Quiere resgistrar un ciclo? (S/F): ")
while respu == "S" or respu == "s":
print("Ingrese el numero de semestre (1 o 2): ")
a = int(input())
print("Ingrese año: ")
b = int(input())
cicloNew.append((a, b))
respu = input("¿Quiere resgistrar otro ciclo? (S/F): ")
print(" ")
print("Datos guardados")
print("-----------------------------------")
for x in range(len(cicloNew)):
print("[Numero de semestre: ", cicloNew[x][0], "] [año: ", cicloNew[x][1],"]")
print(" ")
print(" ")
print(" ")
return None
Ciclo().nuevoCiclo() |
__version__ = 'unknown'
try:
__version__ = __import__('pkg_resources').get_distribution('django_richenum').version
except Exception as e:
pass
|
CHARACTERS_PER_LINE = 39
def break_lines(text):
chars_in_line = 1
final_text = ''
skip = False
for char in text:
if chars_in_line >= CHARACTERS_PER_LINE:
if char == ' ':
# we happen to be on a space, se we can just break here
final_text += '\n'
skip = True
else:
# work backwards to find the space to break on
for i in range(len(final_text) - 1, 0, -1):
if final_text[i] == ' ':
final_text = final_text[:i] + '\n' + final_text[i + 1:]
break
chars_in_line = 0
chars_in_line += 1
if not skip:
final_text += char
skip = False
return final_text
if __name__ == '__main__':
print(break_lines('The <y<Spirit of the Sword>> guides the goddess\' chosen hero to <r<Skyloft Village>>'))
print(break_lines('Hey, you look like you have a Questions?'))
print(break_lines('Skyloft Peater/Peatrice\'s Crystals has Bug Net'))
|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def nextLargerNodes(self, head: ListNode) -> List[int]:
nums = []
while head:
nums.append(head.val)
head = head.next
stack = []
res = [0] * len(nums)
for i, n in enumerate(nums):
while stack and nums[stack[-1]] < n:
res[stack.pop()] = n
stack.append(i)
return res
|
def is_field(token):
"""Checks if the token is a valid ogc type field
"""
return token in ["name", "description", "encodingType", "location", "properties", "metadata",
"definition", "phenomenonTime", "resultTime", "observedArea", "result", "id", "@iot.id",
"resultQuality", "validTime", "time", "parameters", "feature"]
def tokenize_parentheses(tokens):
""" Finds non parsed parentheses in tokens (ex.: ['x(y']['z)'] -> ['x']['(']['y']['z'][')']
:param tokens: a list of tokens
:return: the list with unchecked parenteses tokenized
"""
for index, token in enumerate(tokens):
if ("(" in token or ")" in token) and len(token) > 1:
parenthesis_index = token.find("(")
parenthesis = "("
if parenthesis_index < 0:
parenthesis_index = token.find(")")
parenthesis = ")"
left_side = token[:parenthesis_index]
right_side = token[parenthesis_index + 1:]
del tokens[index]
if bool(left_side):
tokens.insert(index, left_side)
index += 1
tokens.insert(index, parenthesis)
if bool(right_side):
index += 1
tokens.insert(index, right_side)
|
"""Exception utilities."""
class ParsingException(Exception):
pass
class EnvVariableNotSet(Exception):
def __init__(self, varname: str) -> None:
super(EnvVariableNotSet, self).__init__(f"Env variable [{varname}] not set.")
class InvalidLineUp(Exception):
pass
class UnsupportedLineUp(Exception):
def __init__(self, line_up_name: str) -> None:
super(UnsupportedLineUp, self).__init__(
f"Line-up [{line_up_name}] is not supported."
)
class InvalidTeamLineup(Exception):
pass
|
# (major, minor, patch, prerelease)
VERSION = (0, 0, 6, "")
__shortversion__ = '.'.join(map(str, VERSION[:3]))
__version__ = '.'.join(map(str, VERSION[:3])) + "".join(VERSION[3:])
__package_name__ = 'pyqubo'
__contact_names__ = 'Recruit Communications Co., Ltd.'
__contact_emails__ = 'rco_pyqubo@ml.cocorou.jp'
__homepage__ = 'https://pyqubo.readthedocs.io/en/latest/'
__repository_url__ = 'https://github.com/recruit-communications/pyqubo'
__download_url__ = 'https://github.com/recruit-communications/pyqubo'
__description__ = 'PyQUBO allows you to create QUBOs or Ising models from mathematical expressions.'
__license__ = 'Apache 2.0'
__keywords__ = 'QUBO, quantum annealing, annealing machine, ising model, optimization'
|
# -*- coding: utf-8 -*-
basic_table = dict(map(lambda s: s.split(u'\t'), u'''
あ a
い i
う u
え e
お o
か ka
き ki
く ku
け ke
こ ko
さ sa
し si
す su
せ se
そ so
た ta
ち ti
つ tu
て te
と to
な na
に ni
ぬ nu
ね ne
の no
は ha
ひ hi
ふ hu
へ he
ほ ho
ま ma
み mi
む mu
め me
も mo
や ya
ゆ yu
よ yo
ら ra
り ri
る ru
れ re
ろ ro
わ wa
を wo
ぁ a
ぃ i
ぅ u
ぇ e
ぉ o
が ga
ぎ gi
ぐ gu
げ ge
ご go
ざ za
じ zi
ず zu
ぜ ze
ぞ zo
だ da
ぢ di
づ du
で de
ど do
ば ba
び bi
ぶ bu
べ be
ぼ bo
ぱ pa
ぴ pi
ぷ pu
ぺ pe
ぽ po
きゃ kya
きゅ kyu
きょ kyo
しゃ sya
しゅ syu
しょ syo
ちゃ tya
ちゅ tyu
ちょ tyo
にゃ nya
にゅ nyu
にょ nyo
ひゃ hya
ひゅ hyu
ひょ hyo
みゃ mya
みゅ myu
みょ myo
りゃ rya
りゅ ryu
りょ ryo
ぎゃ gya
ぎゅ gyu
ぎょ gyo
じゃ zya
じゅ zyu
じょ zyo
でゃ dya
でゅ dyu
でょ dyo
びゃ bya
びゅ byu
びょ byo
ぴゃ pya
ぴゅ pyu
ぴょ pyo
クヮ kwa
グヮ gwa
ア a
イ i
ウ u
エ e
オ o
カ ka
キ ki
ク ku
ケ ke
コ ko
サ sa
シ si
ス su
セ se
ソ so
タ ta
チ ti
ツ tu
テ te
ト to
ナ na
ニ ni
ヌ nu
ネ ne
ノ no
ハ ha
ヒ hi
フ hu
ヘ he
ホ ho
マ ma
ミ mi
ム mu
メ me
モ mo
ヤ ya
ユ yu
ヨ yo
ラ ra
リ ri
ル ru
レ re
ロ ro
ワ wa
ヲ wo
ァ a
ィ i
ゥ u
ェ e
ォ o
ガ ga
ギ gi
グ gu
ゲ ge
ゴ go
ザ za
ジ zi
ズ zu
ゼ ze
ゾ zo
ダ da
ヂ di
ヅ du
デ de
ド do
バ ba
ビ bi
ブ bu
ベ be
ボ bo
パ pa
ピ pi
プ pu
ペ pe
ポ po
キャ kya
キュ kyu
キョ kyo
シャ sya
シュ syu
ショ syo
チャ tya
チュ tyu
チョ tyo
ニャ nya
ニュ nyu
ニョ nyo
ヒャ hya
ヒュ hyu
ヒョ hyo
ミャ mya
ミュ myu
ミョ myo
リャ rya
リュ ryu
リョ ryo
ギャ gya
ギュ gyu
ギョ gyo
ジャ zya
ジュ zyu
ジョ zyo
デャ dya
デュ dyu
デョ dyo
ビャ bya
ビュ byu
ビョ byo
ピャ pya
ピュ pyu
ピョ pyo
くゎ kwa
ぐゎ gwa
'''.strip(u'\n').split(u'\n')))
long_sound_table = dict(u'aâ iî uû eê oô'.split())
long_sounds = u'aa ii uu ee oo ou'.split()
def normalize(s):
roman = u''
l = len(s)
n = 0
while n < l:
c1 = s[n]
c2 = s[n:n+2]
c3 = s[n+1:n+2]
if roman and c1 == u'ー':
c1 = u''
if roman[-1] in u'aiueo':
roman = roman[:-1] + long_sound_table[roman[-1]]
elif c2 in long_sounds:
c1 = long_sound_table[c1]
n += 1
elif c1 in u'んン':
c1 = u'n'
if c3 and c3 in u'aiueoy':
c1 += u"'"
elif c1 in u'っッ':
if c3 in u'bcdfghjklmnpqrstvwxyz':
c1 = c3
else:
c1 = u''
roman += c1
n += 1
return roman
|
dis = float(input('Digite a distância da sua viagem em Km: '))
if dis <= 200:
print('O valor da sua passagem será {:.2f} reais'.format(dis * 0.5))
else:
print('O valor da sua passagem será {:.2f} reais'.format(dis * 0.45))
|
#033: ler tres numeros e dizer qual o maior e qual o menor:
print("Digite 3 numeros:")
maiorn = 0
n = int(input("Numero 1: "))
if n > maiorn:
maiorn = n
menorn = n
n = int(input("Numero 2: "))
if n > maiorn:
maiorn = n
if n < menorn:
menorn = n
n = int(input("Numero 3: "))
if n > maiorn:
maiorn = n
if n < menorn:
menorn = n
print(f"o maior numero foi {maiorn} e o menor foi {menorn}")
|
#!/usr/bin/python3
#coding=utf-8
def cc_debug():
print(__name__) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-03-23
Last_modify: 2016-03-23
******************************************
'''
'''
Say you have an array for which the ith element is
the price of a given stock on day i.
Design an algorithm to find the maximum profit.
You may complete at most k transactions.
Note:
You may not engage in multiple transactions at the same time
(ie, you must sell the stock before you buy again).
Credits:
Special thanks to @Freezen for adding this problem and creating all test cases.
'''
class Solution(object):
def maxProfit(self, k, prices):
"""
:type k: int
:type prices: List[int]
:rtype: int
"""
n = len(prices)
if n == 0:
return 0
if k > n // 2:
return self.quickSolve(prices)
hold = [-2 ** 31] * (k + 1)
release = [0] * (k + 1)
for p in prices:
for i in range(k):
hold[i+1] = max(hold[i+1], release[i] - p)
release[i+1] = max(release[i+1], hold[i+1] + p)
return release[k]
def quickSolve(self, prices):
res = 0
for i in range(1, len(prices)):
if prices[i] - prices[i-1] > 0:
res += prices[i] - prices[i-1]
return res
|
def drop(i_list: list,n:int) -> list:
"""
Drop at multiple of n from the list
:param n: Drop from the list i_list every N element
:param i_list: The source list
:return: The returned list
"""
assert(n>0)
_shallow_list = []
k=1
for element in i_list:
if k % n != 0:
_shallow_list.append(element)
k+=1
return _shallow_list
if __name__ == "__main__":
print(drop([1,2,3,4,5],6)) |
#!/usr/bin/python3
"""
Given a binary tree, we install cameras on the nodes of the tree.
Each camera at a node can monitor its parent, itself, and its immediate children.
Calculate the minimum number of cameras needed to monitor all nodes of the tree.
Example 1:
Input: [0,0,null,0,0]
Output: 1
Explanation: One camera is enough to monitor all nodes if placed as shown.
Example 2:
Input: [0,0,null,0,null,0,null,null,0]
Output: 2
Explanation: At least two cameras are needed to monitor all nodes of the tree.
The above image shows one of the valid configurations of camera placement.
Note:
The number of nodes in the given tree will be in the range [1, 1000].
Every node has value 0.
"""
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.covered = {None}
self.cnt = 0
def minCameraCover(self, root: TreeNode) -> int:
"""
Greedy?
Bottom up, cover leaf's parent is strictly better than cover leaf
"""
self.dfs(root, None)
if root not in self.covered:
self.covered.add(root)
self.cnt += 1
return self.cnt
def dfs(self, node, pi):
"""
post order
rely on the parents to cover it
"""
if not node:
return
self.dfs(node.left, node)
self.dfs(node.right, node)
if node.left not in self.covered or node.right not in self.covered:
self.cnt += 1
self.covered.add(node.left)
self.covered.add(node.right)
self.covered.add(node)
self.covered.add(pi)
class SolutionErrror:
def __init__(self):
self.covered = set()
def minCameraCover(self, root: TreeNode) -> int:
"""
Greedy?
Top-down, no good.
Bottom up, cover leaf's parent is strictly better than cover leaf
"""
dummy = TreeNode(0)
dummy.left = root
self.dfs(root, dummy)
self.covered.discard(dummy) # swallow KeyError
return len(self.covered)
def dfs(self, node, pi):
"""
post order
"""
if not node:
return
self.dfs(node.left, node)
self.dfs(node.right, node)
# post oder
if (
(not node.left or node.left in self.covered) and
(not node.right or node.right in self.covered)
):
self.covered.add(pi)
return
|
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'adb',
'depot_tools/bot_update',
'depot_tools/gclient',
'goma',
'recipe_engine/context',
'recipe_engine/json',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/step',
'recipe_engine/url',
'depot_tools/tryserver',
]
def _CheckoutSteps(api, buildername):
# Checkout mojo and its dependencies (specified in DEPS) using gclient
api.gclient.set_config('mojo')
if 'Android' in buildername:
api.gclient.apply_config('android')
api.bot_update.ensure_checkout()
api.gclient.runhooks()
def _BuildSteps(api, buildername, is_debug, is_official):
mojob_path = api.path['checkout'].join('mojo', 'tools', 'mojob.py')
args = []
gn_args = []
if 'Android' in buildername:
args += ['--android']
if 'ASan' in buildername:
args += ['--asan']
if api.tryserver.is_tryserver:
args += ['--dcheck_always_on']
env = {}
goma_dir = ''
if 'Win' not in buildername:
# Disable Goma on Windows as it makes the build much slower (> 1 hour vs
# 15 minutes). Try renabling once we have trybots and the cache would be
# warm.
goma_dir = api.goma.ensure_goma()
env['GOMA_SERVICE_ACCOUNT_JSON_FILE'] = api.goma.service_account_json_path
if is_debug:
build_type = "--debug"
elif is_official:
build_type = "--official"
else:
build_type = "--release"
if goma_dir:
env['GOMA_DIR'] = goma_dir
with api.context(env=env):
with api.context(cwd=api.path['checkout']):
api.python('mojob gn',
mojob_path,
args=['gn', build_type] + args + gn_args)
api.python('mojob build',
mojob_path,
args=['build', build_type] + args)
def _DeviceCheckStep(api):
known_devices_path = api.path.join(
api.path.expanduser('~'), '.android', 'known_devices.json')
# Device recovery.
args = [
'--known-devices-file', known_devices_path,
'--adb-path', api.adb.adb_path(),
'-v'
]
api.step(
'device_recovery',
[api.path['checkout'].join('third_party', 'catapult', 'devil',
'devil', 'android', 'tools',
'device_recovery.py')] + args,
infra_step=True)
# Device provisioning.
api.python(
'provision_device',
api.path['checkout'].join('third_party', 'catapult', 'devil',
'devil', 'android', 'tools',
'provision_devices.py'),
infra_step=True)
# Device Status.
try:
buildbot_file = '/home/chrome-bot/.adb_device_info'
args = [
'--json-output', api.json.output(),
'--known-devices-file', known_devices_path,
'--buildbot-path', buildbot_file,
'-v', '--overwrite-known-devices-files',
]
result = api.python(
'device_status',
api.path['checkout'].join('third_party', 'catapult', 'devil', 'devil',
'android', 'tools', 'device_status.py'),
args=args,
infra_step=True)
return result
except api.step.InfraFailure as f:
params = {
'summary': ('Device Offline on %s %s' %
(api.properties['mastername'], api.properties['bot_id'])),
'comment': ('Buildbot: %s\n(Please do not change any labels)' %
api.properties['buildername']),
'labels': 'Restrict-View-Google,OS-Android,Infra-Client,Infra-Labs',
}
link = ('https://code.google.com/p/chromium/issues/entry?%s' %
api.url.urlencode(params))
f.result.presentation.links.update({
'report a bug': link
})
raise
def _GetTestConfig(api):
buildername = api.properties.get('buildername')
test_config = {}
if 'Android' in buildername:
test_config['target_os'] = 'android'
elif 'Linux' in buildername:
test_config['target_os'] = 'linux'
elif 'Win' in buildername:
test_config['target_os'] = 'windows'
else:
raise NotImplementedError('Unknown platform') # pragma: no cover
test_config['is_debug'] = 'dbg' in buildername
if 'Official' in buildername:
# This is not reached, as we only have Android official builds.
raise NotImplementedError(
'Testing not supported for official builds') # pragma: no cover
if 'Perf' in buildername:
test_config['test_types'] = ['perf']
else:
test_config['test_types'] = ['default']
if 'ASan' in buildername:
test_config['sanitizer'] = 'asan'
test_config['master_name'] = api.properties.get('mastername')
test_config['builder_name'] = api.properties.get('buildername')
test_config['build_number'] = api.properties.get('buildnumber')
test_config['test_results_server'] = api.properties.get(
'test_results_server', 'test-results.appspot.com')
test_config['dcheck_always_on'] = api.tryserver.is_tryserver
return test_config
def _TestSteps(api):
get_test_list_path = api.path['checkout'].join('mojo', 'tools',
'get_test_list.py')
test_config = _GetTestConfig(api)
test_out = [{'name': u'Hello', 'command': ['world']}]
result = api.python('get_test_list', get_test_list_path,
args=[api.json.input(test_config), api.json.output()],
step_test_data=lambda: api.json.test_api.output(test_out))
test_list = result.json.output
with api.step.defer_results():
for entry in test_list:
name = str(entry['name']) # api.step() wants a non-Unicode string.
command = entry['command']
with api.context(cwd=api.path['checkout']):
api.step(name, command)
def _UploadShellAndApps(api, buildername):
upload_path = api.path['checkout'].join('mojo', 'tools', 'upload_binaries.py')
is_android = 'Android' in buildername
args = []
if is_android:
args.append('--android')
if 'Official' in buildername:
args.append('--official')
api.python('upload shell and app binaries', upload_path, args)
def RunSteps(api):
buildername = api.properties.get('buildername')
_CheckoutSteps(api, buildername)
is_debug = 'dbg' in buildername
is_official = 'Official' in buildername
_BuildSteps(api, buildername, is_debug, is_official)
is_linux = 'Linux' in buildername
is_win = 'Win' in buildername
is_android = 'Android' in buildername
is_tester = 'Tests' in buildername
is_try = api.tryserver.is_tryserver
is_asan = 'ASan' in buildername
is_perf = 'Perf' in buildername
if is_android and is_tester:
_DeviceCheckStep(api)
upload_binaries = ((is_linux or is_android)
and not is_debug and not is_try and not is_perf and not is_asan)
if not is_tester and not is_linux and not is_win:
# TODO(blundell): Eliminate this special case
# once there's an Android release tester bot.
if upload_binaries and is_android:
_UploadShellAndApps(api, buildername)
return
_TestSteps(api)
# TODO(blundell): Remove the "and not is_android" once there's an
# Android release tester bot and I've removed the logic uploading the
# shell on Android above.
if upload_binaries and not is_android:
_UploadShellAndApps(api, buildername)
def GenTests(api):
tests = [
['mojo_linux', 'Mojo Linux'],
['mojo_linux_dbg', 'Mojo Linux (dbg)'],
['mojo_linux_asan', 'Mojo Linux ASan'],
['mojo_linux_asan_dbg', 'Mojo Linux ASan (dbg)'],
['mojo_android_builder', 'Mojo Android Builder'],
['mojo_android_official', 'Mojo Android Official Builder'],
['mojo_android_dbg', 'Mojo Android (dbg)'],
['mojo_android_builder_tests_dbg', 'Mojo Android Builder Tests (dbg)'],
['mojo_win_dbg', 'Mojo Win (dbg)'],
['mojo_linux_perf', 'Mojo Linux Perf']
]
for test_name, buildername in tests:
test = api.test(test_name) + api.properties.generic(buildername=buildername)
if 'Android' in buildername and 'Tests' in buildername:
test += api.step_data("device_status", api.json.output([
{
"battery": {
"status": "5",
"scale": "100",
"temperature": "249",
"level": "100",
"AC powered": "false",
"health": "2",
"voltage": "4286",
"Wireless powered": "false",
"USB powered": "true",
"technology": "Li-ion",
"present": "true"
},
"wifi_ip": "",
"imei_slice": "Unknown",
"ro.build.id": "LRX21O",
"build_detail":
"google/razor/flo:5.0/LRX21O/1570415:userdebug/dev-keys",
"serial": "07a00ca4",
"ro.build.product": "flo",
"adb_status": "device",
"blacklisted": False,
"usb_status": True,
},
{
"adb_status": "offline",
"blacklisted": True,
"serial": "03e0363a003c6ad4",
"usb_status": False,
},
{
"adb_status": "unauthorized",
"blacklisted": True,
"serial": "03e0363a003c6ad5",
"usb_status": True,
},
{
"adb_status": "device",
"blacklisted": True,
"serial": "03e0363a003c6ad6",
"usb_status": True,
},
{}
]))
yield test
yield(api.test('mojo_linux_try') +
api.properties.tryserver(buildername="Mojo Linux Try"))
yield(api.test('mojo_android_builder_tests_dbg_fail_device_check') +
api.properties.tryserver(buildername="Mojo Android Builder Tests (dbg)") +
api.step_data("device_status", retcode=1))
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
##
# Copyright 2017 FIWARE Foundation, e.V.
# All Rights Reserved.
#
# 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.
##
__author__ = 'fla'
GOOGLE_ACCOUNTS_BASE_URL = 'https://accounts.google.com'
APPLICATION_NAME = 'TSC Enablers Dashboard'
CREDENTIAL_DIR = '.credentials'
CREDENTIAL_FILE = 'sheets.googleapis.com.json'
DB_NAME = 'enablers-dashboard.db'
DB_FOLDER = 'dbase'
LOG_FILE = 'tsc-dashboard.log'
# We need to add 16 rows in the number of enablers list corresponding to:
# - Title
# - Report date
# - Data sources updated on
# - Source
# - Units
# - Enabler Impl
# - INCUBATED
# - DEVELOPMENT
# - SUPPORT
# - DEPRECATED
# - And 6 extra blank rows between them
FIXED_ROWS = 16
# We keep the firsts row without change in the sheet (sheet title)
INITIAL_ROW = 2
# The number of columns to delete corresponds to:
# Source, Catalogue, ReadTheDocs, Docker, GitHub, Coverall, Academy, HelpDesk, Backlog, GitHub_Open_Issues,
# GitHub_Closed_Issues, GitHub_Adopters, GitHub_Adopters_Open_Issues, GitHub_Adopters_Closed_Issues,
# GitHub_Comits, GitHub_Forks, GitHub_Watchers, GitHub_Stars, Jira_WorkItem_Not_Closed, Jira_WorkItem_Closed
# + Extra 2 = 22
FIXED_COLUMNS = 22
# We start to delete from the initial column
INITIAL_COLUMN = 1
|
class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows == 0: return []
rls = [[1]]
for i in range(2, numRows+1):
row = [1] * i
for j in range(1, i-1):
row[j] = rls[-1][j-1] + rls[-1][j]
rls.append(row)
return rls
|
def maxProfitWithKTransactions(prices, k):
n = len(prices)
profit = [[0]*n for _ in range(k+1)]
"""
t := number of transactions
d := day at which either buy/sell stock
profit[t][d] = max ( previous day profit = profit[t][d-1] ,
profit sold at this day + max(buy for this transaction + profit at last transaction)
prices[d] + max(-prices[x] + profit[t-1][x], where 0 <= x < d)
"""
if not prices:
return 0
for t in range(1, k+1):
for d in range(1, n):
previous_day_profit = profit[t][d-1]
max_profit_buy_on_t = float("-inf")
for x in range(0, d):
max_profit_buy_on_t = max(max_profit_buy_on_t, -prices[x] + profit[t-1][x])
profit[t][d] = max(previous_day_profit, prices[d] + max_profit_buy_on_t)
debug = False
if debug:
print(prices)
for row in profit:
print(row)
print("Maximum profit for k={} transaction for {} stock prices at each day = {}".format(k, prices, profit[-1][-1] if profit else 0))
return profit[-1][-1]
if __name__ == "__main__":
maxProfitWithKTransactions([5, 11, 3, 50, 60, 90], 2)
|
# 11. Replace tabs into spaces
# Replace every occurrence of a tab character into a space. Confirm the result by using sed, tr, or expand command.
with open('popular-names.txt') as f:
for line in f:
print(line.strip().replace("\t", " "))
|
""" Test data"""
stub_films = [{
"id": "12345",
"title": "This is film one",
},{
"id": "23456",
"title": "This is film two",
}]
stub_poeple = [{
"name": "person 1",
"films": ["url/12345", "url/23456"]
},{
"name": "person 2",
"films": ["url/23456"]
},{
"name": "person 3",
"films": ["url/12345"]
},{
"name": "person 4",
"films": ["url/12345"]
}] |
"""
Melhore o Desafio 061, perguntando para o usuário se ele quer mostrar mais alguns termos.
O programa encerra quando ele disser que quer mostrar 0 termos.
"""
primeiro = int(input('Digite o termo: '))
razao = int(input('Digite a razão: '))
termo = primeiro
cont = 1
total = 0
mais = 10
while mais != 0:
total = total + mais
while cont <= total:
print('{} -> '.format(termo), end=' ')
termo = termo + razao
cont = cont + 1
print('Pausa')
mais = int(input('Quantos termos você quer mostrar a mais? '))
print('FIM') |
s = input()
num = [0] * 26
for i in range(len(s)):
num[ord(s[i])-97] += 1
for i in num:
print(i, end = " ")
if i == len(num)-1:
print(i)
|
# %% [1189. *Maximum Number of Balloons](https://leetcode.com/problems/maximum-number-of-balloons/)
# 問題:textから'ballon'を構成できる数を返せ
# 解法:collections.Counterを用いる
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
c = collections.Counter(text)
return min(c[s] // n for s, n in collections.Counter("balloon").items())
|
# Source : https://leetcode.com/problems/binary-tree-tilt/description/
# Date : 2017-12-26
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findTilt(self, root):
"""
:type root: TreeNode
:rtype: int
"""
global ans
ans = 0
self.sumOfNode(root)
return ans
def sumOfNode(self, root):
if root == None:
return 0
left = self.sumOfNode(root.left)
right = self.sumOfNode(root.right)
global ans
ans += abs(left - right)
return left + right + root.val
|
class Order():
def __init__(self, side, pair, size, price, stop_loss_price, id):
self.side = side
self.pair = pair
self.size = size
self.price = price
self.stop_loss_price = stop_loss_price
self.id = id
self.fills = []
def define_id(self, id):
self.id = id
def add_fill(self, execution):
self.fills.append(execution)
def get_fill_price(self):
nominator = sum(map(lambda f: f.size * f.price, self.fills))
fill_price = nominator/self.get_filled_quantity()
return fill_price
def get_filled_quantity(self):
return sum(map(lambda f: f.size, self.fills))
def get_fills(self):
return self.fills
|
# Ler um número em metros e mostrar seu valor em cm e mm:
m = float(input('Digite o valor em metros: '))
dm = m * 10
cm = m * 100
mm = m * 1000
km = m/1000
hm = m/100
dam = m/10
print('O valor em cm é {}' .format(cm))
print('O valor em milímetros é {}' .format(mm))
print('O valor em dm é {}' .format(dm))
print('O valor em km é {}' .format(km))
print('O valor em hm {}' .format(hm))
print('O valor em dm {}' .format(dm))
|
word = input('Type a word: ')
while word != 'chupacabra':
word = input('Type a word: ')
if word == 'chupacabra':
print('You are out of the loop')
break |
# Copyright 2021 The Pigweed Authors
#
# 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
#
# https://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.
_RTOS_NONE = "//pw_build/constraints/rtos:none"
# Common select for tagging a target as only compatible with host OS's. This
# select implements the logic '(Windows or Macos or Linux) and not RTOS'.
# Example usage:
# load("//pw_build:selects.bzl","TARGET_COMPATIBLE_WITH_HOST_SELECT")
# pw_cc_library(
# name = "some_host_only_lib",
# hdrs = ["host.h"],
# target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
# )
TARGET_COMPATIBLE_WITH_HOST_SELECT = {
"@platforms//os:windows": [_RTOS_NONE],
"@platforms//os:macos": [_RTOS_NONE],
"@platforms//os:linux": [_RTOS_NONE],
"//conditions:default": ["@platforms//:incompatible"],
}
|
class Programa:
def __init__(self, nome, ano):
self._nome = nome.title()
self.ano = ano
self._likes = 0
@property
def likes(self):
return self._likes
def dar_like(self):
self._likes += 1
@property
def nome(self):
return self._nome
@nome.setter
def nome(self, novo_nome):
self._nome = novo_nome.title()
def __str__(self):
return f'{self.nome} - {self.ano} - {self.likes}'
class Filme(Programa):
def __init__(self, nome, ano, duracao):
super().__init__(nome, ano)
self.duracao = duracao
def __str__(self):
return f'{self.nome} - {self.ano} - {self.duracao} min - {self.likes}'
class Serie(Programa):
def __init__(self, nome, ano, temporadas):
super(Serie, self).__init__(nome, ano)
self.temporadas = temporadas
def __str__(self):
return f'{self.nome} - {self.ano} - {self.temporadas} temporadas - {self.likes}'
class Playlist:
def __init__(self, nome, programas):
self.nome = nome.title()
self._programas = programas
def __getitem__(self, item):
return self._programas[item]
@property
def listagem(self):
return self._programas
def __len__(self):
return len(self._programas)
vingadores = Filme('Vigadores - Guerra Infinita', 2018, 160)
atlanta = Serie('Atlatan', 2018, 2)
tmep = Filme('Todo mundo em pânico', 1999, 100)
demolidor = Serie('Demolidor', 2016, 2)
filmes_e_series = [vingadores, atlanta, demolidor, tmep]
playlist_fim_de_semana = Playlist('fim de semana', filmes_e_series)
print(f'Tamonho do playlist: {len(playlist_fim_de_semana)}')
for dados in playlist_fim_de_semana:
print(dados) |
def factorial(n):
fact = 1
for i in range(2,n+1):
fact*= i
return fact
def main():
n = int(input("Enter a number: "))
if n >= 0:
print(f"Factorial: {factorial(n)}")
else:
print(f"Choose another number")
if __name__ == "__main__":
main()
|
users = []
class UserModel(object):
"""Class user models."""
def __init__(self):
self.db = users
def add_user(self, fname, lname, email, phone, password, confirm_password, city):
""" Method for saving user to the dictionary """
payload = {
"userId": len(self.db)+1,
"fname": fname,
"lname": lname,
"email": email,
"phone": phone,
"password": password,
"confirm_password": confirm_password,
"city": city,
}
self.db.append(payload)
return self.db
def check_email(self, email):
"""Method for checking if user email exist"""
user = [user for user in users if user['email'] == email]
if user:
return True
return False
def check_user(self, userId):
"""Method for checking if user exist"""
user = [user for user in users if user['userId'] == userId]
if user:
return True
return False
|
#Задачи на циклы и оператор условия------
#----------------------------------------
'''
Задача 1
Вывести на экран циклом пять строк из нулей, причем каждая строка должна быть пронумерована.
'''
for i in range(1, 6):
print(i, '0000000000000000000000000000000000000000000')
'''
Задача 2
Пользователь в цикле вводит 10 цифр. Найти количество введеных пользователем цифр 5.
'''
count = 0
for i in range(10):
user_data = int(input('Введите число: '))
if user_data == 5:
count += 1
print(count)
'''
Задача 3
Найти сумму ряда чисел от 1 до 100. Полученный результат вывести на экран.
'''
sum = 0
for i in range(1, 101):
sum += i
print(sum)
'''
Задача 4
Найти произведение ряда чисел от 1 до 10. Полученный результат вывести на экран.
'''
proiz = 1
for i in range(2, 11):
proiz *= i
print(proiz)
'''
Задача 5
Вывести цифры числа на каждой строчке.
'''
integer_number = 123456
start_del = len(str(integer_number)) - 1
delitel = 10 ** start_del
#print(integer_number % delitel, integer_number // delitel)
while integer_number > 0:
print(int(integer_number // delitel))
integer_number = integer_number % delitel
delitel /= 10
'''
Задача 6
Найти сумму цифр числа.
'''
integer_number = 123456
sum = 0
while integer_number > 0:
sum += integer_number % 10
integer_number = integer_number // 10
print(sum)
'''
Задача 7
Найти произведение цифр числа.
'''
integer_number = 123456
proiz = 1
while integer_number > 0:
proiz *= integer_number % 10
integer_number = integer_number // 10
print(proiz)
'''
Задача 8
Дать ответ на вопрос: есть ли среди цифр числа 5?
'''
integer_number = 125254
while integer_number > 0:
if integer_number % 10 == 5:
print('Yes')
break
integer_number = integer_number // 10
else:
print('No')
'''
Задача 9
Найти максимальную цифру в числе
'''
integer_number = 125278954
max_num = integer_number % 10
while integer_number > 0:
max_num = max(max_num, integer_number % 10)
integer_number = integer_number // 10
print(max_num)
'''
Задача 10
Найти количество цифр 5 в числе
'''
integer_number = 125278954
count_num = 0
while integer_number > 0:
if integer_number % 10 == 5:
count_num += 1
integer_number = integer_number // 10
print(count_num)
|
#DATOS DE ENTRADA
ANIMAL= int(input("¿De cual animal quiere conocer la caracteristicas? 1.Leon 2.Ballena 3.Tucan? "))
class Animal:
def __init__(self, ANIMAL):
self.ANIMAL = ANIMAL
def acciones_comun():
comun = "Comer"
return comun
def sentido_vista():
vista = "Puede ver"
return vista
class Animal_Tierra:
def acciones_Tierra():
Tierra = "camina en cuatro patas"
return Tierra
class Animal_Agua:
def acciones_Agua():
return "Nada bajo el agua"
class Animal_Aire (Animal):
def acciones_Aire():
return "Vuela"
class Leon (Animal, Animal_Tierra):
def llamar():
caracteristicas = ()
return caracteristicas
class Ballena(Animal, Animal_Agua):
def llamar():
caracteristicas = ()
return caracteristicas
class Tucan(Animal, Animal_Aire):
def llamar():
caracteristicas = ()
return caracteristicas
if ANIMAL == 1 :
print ("debe imprimir las caracteristicas del leon, el leon es clase hija de animal y debe agragar animal_tierra" )
elif ANIMAL == 2 :
print ("lo mismo que el leon, pero con la ballena")
elif ANIMAL == 3 :
print("Lo mismo pero con el tucan") |
"""
Entradas:
lectura actual--->float--->lect2
lectura anterior--->float--->lect1
valor kw--->float--->valorkw
Salidas:
consumo--->float--->consumo
total factura-->flotante--->total
"""
lect2 = float ( entrada ( "Digite lectura real:" ))
lect1 = float ( entrada ( "Digite lectura anterior:" ))
valorkw = float ( input ( "Valor del kilowatio: " ))
consumo = ( lect2 - lect1 )
total = ( consumo * valorkw )
print ( "El valor a pagar es: " + str ( total )) |
data = input()
courses = {}
while ":" in data:
student_name, id, course_name = data.split(":")
if course_name not in courses:
courses[course_name] = {}
courses[course_name][id] = student_name
data = input()
searched_course = data
searched_course_name_as_list = searched_course.split("_")
searched_course = " ".join(searched_course_name_as_list)
for course_name in courses:
if course_name == searched_course:
for id, name in courses[course_name].items():
print(f"{name} - {id}")
|
nums = list()
while True:
nStr = input('Enter a number: ')
try:
if nStr == 'done':
break
n = float(nStr)
nums.append(n)
except:
print('Invalid input')
continue
print('Maximum: ',max(nums))
print('Minimum: ',min(nums)) |
# to run this, add code from experiments_HSCC2021.py
def time_series_pulse():
path = Path(__file__).parent.parent / "data" / "real_data" / "datasets" / "basic_data"
filename1 = path / "pulse1-1.csv"
filename2 = path / "pulse1-2.csv"
filename3 = path / "pulse1-3.csv"
f1 = load_time_series(filename1, 1)
f2 = load_time_series(filename2, 1)
f3 = load_time_series(filename3, 1)
dataset = [f1, f2, f3]
return dataset
def parameters_pulse():
delta_ts = 0.02
deltas_ha = [0.1]
n_discrete_steps = 10
reachability_time_step = 1e-3
refinement_distance = 0.001
n_intermediate = 1
max_dwell_time = 4.0
min_dwell_time = None
n_simulations = 3
path_length = 6
time_step = 0.01
return delta_ts, deltas_ha, n_discrete_steps, reachability_time_step, refinement_distance, max_dwell_time,\
n_intermediate, n_simulations, path_length, time_step, min_dwell_time
|
#Day 1.3 Exercise!!
#First way I thought to do it without help
name = input("What is your name? ")
print(len(name))
#Way I found to do it from searching google
print(len(input("What is your name? "))) |
#-- THIS LINE SHOULD BE THE FIRST LINE OF YOUR SUBMISSION! --#
def tally(costs, discounts, rebate_factor):
cost = sum(costs)
discount = sum(discounts)
pre = (cost - discount) * rebate_factor
if pre < 0:
return 0
else:
return round(pre, 2)
#-- THIS LINE SHOULD BE THE LAST LINE OF YOUR SUBMISSION! ---#
### DO NOT SUBMIT THE FOLLOWING LINES!!! THESE ARE FOR LOCAL TESTING ONLY!
# ((10+24) - (3+4+3)) * 0.3
assert(tally([10,24], [3,4,3], 0.30) == 7.20)
# if the result would be negative, 0 is returned instead
assert(tally([10], [20], 0.1) == 0) |
def soma (a,b):
print(f'A = {a} e B = {b}')
s=a+b
print(f'A soma A + B ={s}')
#Programa Principal
soma(4,5)
|
def GCD(a,b):
if b == 0:
return a
else:
return GCD(b, a%b)
a = int(input())
b = int(input())
print(a*b//(GCD(a,b)))
|
# -*- coding:utf-8 -*-
"""
"""
__date__ = "14/12/2017"
__author__ = "zhaojm"
|
__author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '10/28/2020 4:52 PM'
# import re
#
#
# def format_qs_score(score_str):
# """
# help you generate a qs score
# 1 - 100 : 5
# 141-200 : 4
# =100: 4
# N/A 3
# :param score_str:
# :return:
# """
# score = 3
# if not score_str or score_str != "N/A":
# try:
# parts = int(list(filter(lambda val: val,
# list(re.split('-|=', score_str))))[0])
# except:
# return 3
# score = 5 - int(parts / 100)
# if score > 5 or score < 1:
# return 3
# return score
#
#
# print(format_qs_score("=100"))
#
# print(list(filter(lambda val: val, re.split('-|=', "=100"))))
# import csv
# import numpy as np
# import requests
#
# with open('./college_explorer.csv', newline='', encoding='utf-8') as file:
# data = list(csv.reader(file))
# data = np.array(data)
# img_list = data[1:, 33].tolist()
#
# img_list = list(filter(lambda url: url != 'N/A', img_list))
#
#
# for url in img_list:
# response = requests.get(url)
# if response.status_code == 200:
# school_name = url.split('/')[-1].split('_')[0]
# with open("./images/" + school_name + ".jpg", 'wb') as f:
# f.write(response.content) |
def Linear_Search(Test_arr, val):
index = 0
for i in range(len(Test_arr)):
if val > Test_arr[i]:
index = i+1
return index
def Insertion_Sort(Test_arr):
for i in range(1, len(Test_arr)):
val = Test_arr[i]
j = Linear_Search(Test_arr[:i], val)
Test_arr.pop(i)
Test_arr.insert(j, val)
return Test_arr
if __name__ == "__main__":
Test_list = input("Enter the list of Numbers: ").split()
Test_list = [int(i) for i in Test_list]
print(f"Binary Insertion Sort: {Insertion_Sort(Test_list)}") |
class Wrapper(object):
wrapper_classes = {}
@classmethod
def wrap(cls, obj):
return cls(obj)
def __init__(self, wrapped):
self.__dict__['wrapped'] = wrapped
def __getattr__(self, name):
return getattr(self.wrapped, name)
def __setattr__(self, name, value):
setattr(self.wrapped, name, value)
def __delattr__(self, name):
delattr(self.wrapped, name)
def __str__(self):
return str(self.wrapped)
def __repr__(self):
return repr(self.wrapped)
|
height = int(input())
for i in range(1,height+1) :
for j in range(1, i+1):
m = i*j
if(m <= 9):
print("",m,end = " ")
else:
print(m,end = " ")
print()
# Sample Input :- 5
# Output :-
# 1
# 2 4
# 3 6 9
# 4 8 12 16
# 5 10 15 20 25
|
# Continuação do ex061 (Termos de PA)
print('Gerador de PA')
print('-=' * 10)
primeiro = int(input('Primeiro termo: '))
razão = int(input('Razão: '))
i = 0
n = 10
novos = 10
total = 0
while novos != 0:
total = total + novos
while i < total:
termo = primeiro + razão * i
i += 1
print(termo, end=' -> ')
print('PAUSA')
novos = int(input('Deseja mostrar mais termos? Quantos? '))
print('FIM') |
"""WWUCS Bot module."""
__all__ = [
"__author__",
"__email__",
"__version__",
]
__author__ = "Reilly Tucker Siemens"
__email__ = "reilly@tuckersiemens.com"
__version__ = "0.1.0"
|
"""
=========== What is Matter Parameters ===================
"""
#tups = [(125.0, 1.0), (125.0, 1.5), (125.0, 2.0), (125.0, 2.5), (125.0, 3.0), (150.0, 1.0), (150.0, 1.5), (150.0, 2.0), (150.0, 2.5), (150.0, 3.0), (175.0, 1.0), (175.0, 1.5), (175.0, 2.0), (175.0, 2.5), (175.0, 3.0), (200.0, 1.0), (200.0, 1.5), (200.0, 2.0), (200.0, 2.5), (200.0, 3.0), (225.0, 1.0), (225.0, 1.5), (225.0, 2.0), (225.0, 2.5), (225.0, 3.0), (250.0, 1.0), (250.0, 1.5), (250.0, 2.0), (250.0, 2.5), (250.0, 3.0)]
"""
=========== DUC Data ==========
"""
#tups = [(64.0, 1.0), (64.0, 1.5), (64.0, 2.0), (64.0, 2.5), (70.0, 1.0), (70.0, 1.5), (70.0, 2.0), (70.0, 2.5), (76.0, 1.0), (76.0, 1.5), (76.0, 2.0), (76.0, 2.5), (82.0, 1.0), (82.0, 1.5), (82.0, 2.0), (82.0, 2.5), (88.0, 1.0), (88.0, 1.5), (88.0, 2.0), (88.0, 2.5), (96.0, 1.0), (96.0, 1.5), (96.0, 2.0), (96.0, 2.5), (100.0, 1.0), (100.0, 1.5), (100.0, 2.0), (100.0, 2.5)]
#b = [1.0,1.5,2.0,2.5,3.0]
# alpha should be from [10,40]
#a = range(len(segpool)+10,len(segpool)+60,10)
#tups = list(itertools.product(a,b))
#print "Alll combinations ", tups
#tups = [(125, 1.0), (125, 1.5), (125, 2.0), (125, 2.5), (125, 3.0), (135, 1.0), (135, 1.5), (135, 2.0), (135, 2.5), (135, 3.0), (145, 1.0), (145, 1.5), (145, 2.0), (145, 2.5), (145, 3.0), (155, 1.0), (155, 1.5), (155, 2.0), (155, 2.5), (155, 3.0), (165, 1.0), (165, 1.5), (165, 2.0), (165, 2.5), (165, 3.0)]
#thresholds = [83] |
x = 2
print(x)
# multiple assignment
a, b, c, d = (1, 2, 5, 9)
print(a, b, c, d)
print(type(str(a)))
|
"""
Conjuntos
— Conjunto em qualquer linguagem de programação, estamos fazendo referência à teoria de conjuntos da matemática
— Aqui no Python, os conjuntos são chamados de sets
Dito isto, da mesma forma que na matemática:
— Sets (conjuntos) não possuem valores duplicados;
— Sets (conjuntos) não possuem valores ordenados;
— Elementos não são acessados via índice, ou seja, conjuntos não são indexados;
Conjuntos são bons para se utilizar quando precisamos armazenar elementos mas não nos importamos com a ordenaçào deles.
Quando não precisamos se preocupar com chaves, valores e itens duplicados
Os conjuntos (sets) são referenciados em python com chaves {}
Diferença entre conjutnos (sets) e mapas (dicionários) em python:
— Um dicionário tem chave/valor
— Um conjunto tem apenas valor
# Definindo um conjunto
# Forma 1
s = set({1, 2, 3, 4, 5, 6, 7, 2, 3}) # Repare que temos valores repetidos
print(s)
print(type(s))
# OBS: Ao criar uim conjunto, caso seja adicionado um valor já existente, o mesmo será ignorado sem gerar error e nào fará parde do conjunto
# Forma 2
s = {1, 2, 3, 4, 5, 5}
print(s)
print(type(s))
# Podemos verificar se um determinado valor está contido em um conjunto
if 3 in s:
print('Encontrei o valor 3')
else:
print('Não encontrei o valor 3')
# Importante lembrar que, alem de não termos valores duplicados, os valores não são ordenados
dados = 99, 2, 34, 23, 2, 12, 1, 44, 5, 34
# Listas aceitam valores duplicados, então temos 10 elementos
lista = list(dados)
print(f"Lista: {lista} com {len(lista)} elementos")
# Tuplas aceitam valores duplicados, então temos 10 elementos
tupla = tuple(dados)
print(f"Tupla: {tupla} com {len(tupla)} elementos")
# Dicionários não aceitam chaves duplicadas, então temos 8 elementos
dicionario = {}.fromkeys(dados, 'dict')
print(f"Dicionário: {dicionario} com {len(dicionario)} elementos")
# Conjuntos não aceitam valores duplicados, então temos 8 elementos
conjunto = set(dados)
print(f"Conjunto: {conjunto} com {len(conjunto)} elementos")
# Assim como os outros conjuntos python, podemos colocar tipos de dados misturados em Sets
s = {1, 'b', True, 1.23, 44}
print(s)
print(type(s))
# Podemos iterar em um set normalmente
for valor in s:
print(valor)
# Usos interessantes com sets
# Imagine que fizemos um formulário de cadastro de visitantes em uma feira ou museu,
# os visitantes informam manualmente a cidade de onde vieram
# Nós adicionamos cada cidade em uma lista Python, já que em uma lista podemos adicionar novos elmentos e ter repetições
cidades = ['Belo Horizante', 'São Paulo', 'Campo Grande',
'Cuiaba', 'Campo Grande', 'São Paulo', 'Cuiaba']
print(cidades)
print(len(cidades))
# Agora precisamos saber quantas cidades distintas, ou seja, únicas, temos.
# O que você faria? Faria um loop na lista?
# Podemos utilizar o set para isso
print(len(set(cidades)))
s = {1, 2, 3}
s.add(4)
print(s)
s = {1, 2, 3}
s.remove(3)
print(s)
s.discard(2)
print(s)
# Copiando um conjunto para outro
# Forma 1 - Deep Copy
novo = s.copy()
print(novo)
novo.add(4)
print(novo)
print(s)
# Forma 2 - Shallow Copy
novo = s
novo.add(4)
print(novo)
print(s)
s = {1, 2, 3}
print(s)
s.clear()
print(s)
# Precisamos gerar qum conjunto com nomes de estudantes únicos
# Forma 1 - Utilizando union
# unicos1 = estudantes_python.union(estudantes_java)
# print(unicos1)
# Forma 2 - Utilizando o | pipe
unicos2 = estudantes_python | estudantes_java
print(unicos2)
# Gerar um conjunto de estudantes que estão em ambos os cursos
# Forma 1 - Utilizando union
ambos1 = estudantes_python.intersection(estudantes_java)
print(ambos1)
# Forma 2 - utilizando o &
ambos2 = estudantes_python & estudantes_java
print(ambos2)
# Métodos matemáticos de conjuntos
# Imagine que temos dois conjuntos: um contendo estudantes do curso Python e um
# Contendo estudantes do curso Java
estudantes_python = {'Pedro', 'Maria', 'Cláudia', 'João', 'Marcos', 'Patricia'}
estudantes_java = {'Ana', 'Maria', 'Cláudia', 'João', 'Marcos', 'Patricia'}
# Veja que alguns alins que estudam python também estudam java.
# Gerar um conjunto de estudantes que não estão no outro curso
so_python = estudantes_python.difference(estudantes_java)
print(so_python)
so_java = estudantes_java.difference(estudantes_python)
print(so_java)
"""
|
# OpenWeatherMap API Key
weather_api_key = "ae41fcf95db0d612b74e2b509abe9684"
# Google API Key
g_key = "AIzaSyCuF1rT6NscWq62bcBm0tZM7hKlaeWfONQ" |
"""File for holding the different verb forms for all of the verbs in the Total
English book series."""
verb_forms = {
'become' :
{
'normal' : 'become',
'present' : ['become','becomes'],
'past' : 'became',
'past participle' : 'become',
'gerund' : 'becoming',
},
'be':
{
'normal' : 'be',
'present' : ['am','is','are'],
'past' : ['was', 'were'],
'past participle' : 'been',
'gerund' : 'being',
},
'begin':
{
'normal' : 'begin',
'present' : ['begin','begins'],
'past' : 'began',
'past participle' : 'begun',
'gerund' : 'beginning',
},
'blow':
{
'normal' : 'blow',
'present' : ['blow', 'blows'],
'past' : 'blew',
'past participle' : 'blown',
'gerund' : 'blowing',
},
'bring':
{
'normal' : 'bring',
'present' : ['bring','brings'],
'past' : 'brought',
'past participle' : 'brought',
'gerund' : 'bringing',
},
'build':
{
'normal' : 'build',
'present' : ['build','builds'],
'past' : 'built',
'past participle' : 'built',
'gerund' : 'building',
},
'burn':
{
'normal' : 'burn',
'present' : ['burn','burns'],
'past' : ['burned','burnt'],
'past participle' : ['burned','burnt'],
'gerund' : 'burning',
},
'buy':
{
'normal' : 'buy',
'present' : ['buy','buys'],
'past' : 'bought',
'past participle' : 'bought',
'gerund' : 'buying',
},
'catch':
{
'normal' : 'catch',
'present' : ['catch','catches'],
'past' : 'caught',
'past participle' : 'caught',
'gerund' : 'catching',
},
'choose':
{
'normal' : 'choose',
'present' : ['choose','chooses'],
'past' : 'chose',
'past participle' : 'chosen',
'gerund' : 'choosing',
},
'come':
{
'normal' : 'come',
'present' : ['come','comes'],
'past' : 'came',
'past participle' : 'come',
'gerund' : 'coming',
},
'cut':
{
'normal' : 'cut',
'present' : ['cut','cuts'],
'past' : 'cut',
'past participle' : 'cut',
'gerund' : 'cutting',
},
'do':
{
'normal' : 'do',
'present' : ['do','does'],
'past' : 'did',
'past participle' : 'done',
'gerund' : 'doing',
},
'drink':
{
'normal' : 'drink',
'present' : ['drink','drinks'],
'past' : 'drank',
'past participle' : 'drunk',
'gerund' : 'drinking',
},
'eat':
{
'normal' : 'eat',
'present' : ['eat','eats'],
'past' : 'ate',
'past participle' : 'eaten',
'gerund' : 'eating',
},
'feel':
{
'normal' : 'feel',
'present' : ['feel','feels'],
'past' : 'felt',
'past participle' : 'felt',
'gerund' : 'feeling',
},
'fight':
{
'normal' : 'fight',
'present' : ['fight','fights'],
'past' : 'fought',
'past participle' : 'fought',
'gerund' : 'fighting',
},
'find':
{
'normal' : 'find',
'present' : ['find','finds'],
'past' : 'found',
'past participle' : 'found',
'gerund' : 'finding',
},
'fly':
{
'normal' : 'fly',
'present' : ['fly','flies'],
'past' : 'flew',
'past participle' : 'flown',
'gerund' : 'flying',
},
'forget':
{
'normal' : 'forget',
'present' : ['forget','forgets'],
'past' : 'forgot',
'past participle' : ['forgotten','forgot'],
'gerund' : 'forgetting',
},
'get':
{
'normal' : 'get',
'present' : ['get','gets'],
'past' : 'got',
'past participle' : ['gotten','got'],
'gerund' : 'getting',
},
'give':
{
'normal' : 'give',
'present' : ['give','gives'],
'past' : 'gave',
'past participle' : 'given',
'gerund' : 'giving',
},
'go':
{
'normal' : 'go',
'present' : ['go','goes'],
'past' : 'went',
'past participle' : 'gone',
'gerund' : 'going',
},
'grow':
{
'normal' : 'grow',
'present' : ['grow','grows'],
'past' : 'grew',
'past participle' : 'grown',
'gerund' : 'growing',
},
'have':
{
'normal' : 'have',
'present' : ['have','has'],
'past' : 'had',
'past participle' : 'had',
'gerund' : 'having',
},
'hear':
{
'normal' : 'hear',
'present' : ['hear','hears'],
'past' : 'heard',
'past participle' : 'heard',
'gerund' : 'hearing',
},
'hit':
{
'normal' : 'hit',
'present' : ['hit','hits'],
'past' : 'hit',
'past participle' : 'hit',
'gerund' : 'hitting',
},
'hold':
{
'normal' : 'hold',
'present' : ['hold','holds'],
'past' : 'held',
'past participle' : 'held',
'gerund' : 'holding',
},
'hurt':
{
'normal' : 'hurt',
'present' : ['hurt','hurts'],
'past' : 'hurt',
'past participle' : 'hurt',
'gerund' : 'hurting',
},
'keep':
{
'normal' : 'keep',
'present' : ['keep','keeps'],
'past' : 'kept',
'past participle' : 'kept',
'gerund' : 'keeping',
},
'know':
{
'normal' : 'know',
'present' : ['know','knows'],
'past' : 'knew',
'past participle' : 'known',
'gerund' : 'knowing',
},
'lead':
{
'normal' : 'lead',
'present' : ['lead','leads'],
'past' : 'led',
'past participle' : 'led',
'gerund' : 'leading',
},
'leave':
{
'normal' : 'leave',
'present' : ['leave','leaves'],
'past' : 'left',
'past participle' : 'left',
'gerund' : 'leaving',
},
'lend':
{
'normal' : 'lend',
'present' : ['lend','lends'],
'past' : 'lent',
'past participle' : 'lent',
'gerund' : 'lending',
},
'lie':
{
'normal' : 'lie',
'present' : ['lie','lies'],
'past' : 'lay',
'past participle' : 'lain',
'gerund' : 'lying',
},
'lose':
{
'normal' : 'lose',
'present' : ['lose','loses'],
'past' : 'lost',
'past participle' : 'lost',
'gerund' : 'losing',
},
'make':
{
'normal' : 'make',
'present' : ['make','makes'],
'past' : 'made',
'past participle' : 'made',
'gerund' : 'making',
},
'mean':
{
'normal' : 'mean',
'present' : ['mean','means'],
'past' : 'meant',
'past participle' : 'meant',
'gerund' : 'meaning',
},
'meet':
{
'normal' : 'meet',
'present' : ['meet','meets'],
'past' : 'met',
'past participle' : 'met',
'gerund' : 'meeting',
},
'put':
{
'normal' : 'put',
'present' : ['put','puts'],
'past' : 'put',
'past participle' : 'put',
'gerund' : 'putting',
},
'read':
{
'normal' : 'read',
'present' : ['read','reads'],
'past' : 'read',
'past participle' : 'read',
'gerund' : 'reading',
},
'ride':
{
'normal' : 'ride',
'present' : ['ride','rides'],
'past' : 'rode',
'past participle' : 'ridden',
'gerund' : 'riding',
},
'ring':
{
'normal' : 'ring',
'present' : ['ring','rings'],
'past' : 'rang',
'past participle' : 'rung',
'gerund' : 'ringing',
},
'run':
{
'normal' : 'run',
'present' : ['run','runs'],
'past' : 'ran',
'past participle' : 'run',
'gerund' : 'running',
},
'say':
{
'normal' : 'say',
'present' : ['say','says'],
'past' : 'said',
'past participle' : 'said',
'gerund' : 'saying',
},
'see':
{
'normal' : 'see',
'present' : ['see','sees'],
'past' : 'saw',
'past participle' : 'seen',
'gerund' : 'seeing',
},
'sell':
{
'normal' : 'sell',
'present' : ['sell','sells'],
'past' : 'sold',
'past participle' : 'sold',
'gerund' : 'selling',
},
'send':
{
'normal' : 'send',
'present' : ['send','sends'],
'past' : 'sent',
'past participle' : 'sent',
'gerund' : 'sending',
},
'shake':
{
'normal' : 'shake',
'present' : ['shake','shakes'],
'past' : 'shook',
'past participle' : 'shaken',
'gerund' : 'shaking',
},
'show':
{
'normal' : 'show',
'present' : ['show','shows'],
'past' : 'showed',
'past participle' : 'shown',
'gerund' : 'showing',
},
'shut':
{
'normal' : 'shut',
'present' : ['shut','shuts'],
'past' : 'shut',
'past participle' : 'shut',
'gerund' : 'shutting',
},
'sing':
{
'normal' : 'sing',
'present' : ['sing','sings'],
'past' : 'sang',
'past participle' : 'sung',
'gerund' : 'singing',
},
'sit':
{
'normal' : 'sit',
'present' : ['sit','sits'],
'past' : 'sat',
'past participle' : 'sat',
'gerund' : 'sitting',
},
'sleep':
{
'normal' : 'sleep',
'present' : ['sleep','sleeps'],
'past' : 'slept',
'past participle' : 'slept',
'gerund' : 'sleeping',
},
'smell':
{
'normal' : 'smell',
'present' : ['smell','smells'],
'past' : 'smelled,smelt',
'past participle' : 'smelled,smelt',
'gerund' : 'smelling',
},
'speak':
{
'normal' : 'speak',
'present' : ['speak','speaks'],
'past' : 'spoke',
'past participle' : 'spoken',
'gerund' : 'speaking',
},
'spend':
{
'normal' : 'spend',
'present' : ['spend','spends'],
'past' : 'spent',
'past participle' : 'spent',
'gerund' : 'spending',
},
'stand':
{
'normal' : 'stand',
'present' : ['stand','stands'],
'past' : 'stood',
'past participle' : 'stood',
'gerund' : 'standing',
},
'swim':
{
'normal' : 'swim',
'present' : ['swim','swims'],
'past' : 'swam',
'past participle' : 'swum',
'gerund' : 'swimming',
},
'take':
{
'normal' : 'take',
'present' : ['take','takes'],
'past' : 'took',
'past participle' : 'taken',
'gerund' : 'taking',
},
'teach':
{
'normal' : 'teach',
'present' : ['teach','teaches'],
'past' : 'taught',
'past participle' : 'taught',
'gerund' : 'teaching',
},
'tell':
{
'normal' : 'tell',
'present' : ['tell','tells'],
'past' : 'told',
'past participle' : 'told',
'gerund' : 'telling',
},
'think':
{
'normal' : 'think',
'present' : ['think','thinks'],
'past' : 'thought',
'past participle' : 'thought',
'gerund' : 'thinking',
},
'throw':
{
'normal' : 'throw',
'present' : ['throw','throws'],
'past' : 'threw',
'past participle' : 'thrown',
'gerund' : 'throwing',
},
'understand':
{
'normal' : 'understand',
'present' : ['understand','understands'],
'past' : 'understood',
'past participle' : 'understood',
'gerund' : 'unerstanding',
},
'wear':
{
'normal' : 'wear',
'present' : ['wear','wears'],
'past' : 'wore',
'past participle' : 'worn',
'gerund' : 'wearing',
},
'win':
{
'normal' : 'win',
'present' : ['win','wins'],
'past' : 'won',
'past participle' : 'won',
'gerund' : 'winning',
},
'write':
{
'normal' : 'write',
'present' : ['write','writes'],
'past' : 'wrote',
'past participle' : 'written',
'gerund' : 'writing',},}
|
# SPDX-FileCopyrightText: © 2020 The birch-books-smarthome Authors
# SPDX-License-Identifier: MIT
BOOKSTORE_GROUND_FLOOR = 0x0007
BOOKSTORE_FIRST_FLOOR = 0x0008
BOOKSTORE_TERRARIUM = 0x0010
BOOKSTORE_BEDROOM = 0x0020
HOUSE_BASEMENT = 0x0040
HOUSE_GROUND_FLOOR = 0x0380
HOUSE_BEDROOM_LIGHT = 0x0400
HOUSE_BEDROOM_LAMP = 0x0800
HOUSE_FIREPLACE_1 = 0x1000
HOUSE_FIREPLACE_2 = 0x2000
SCHEDULE = [
BOOKSTORE_BEDROOM | HOUSE_BEDROOM_LIGHT,
BOOKSTORE_TERRARIUM | BOOKSTORE_BEDROOM | HOUSE_BEDROOM_LIGHT,
BOOKSTORE_TERRARIUM | BOOKSTORE_FIRST_FLOOR | HOUSE_BEDROOM_LIGHT,
BOOKSTORE_TERRARIUM | BOOKSTORE_GROUND_FLOOR | HOUSE_GROUND_FLOOR,
BOOKSTORE_TERRARIUM | BOOKSTORE_GROUND_FLOOR | HOUSE_GROUND_FLOOR,
BOOKSTORE_TERRARIUM | BOOKSTORE_GROUND_FLOOR,
BOOKSTORE_TERRARIUM | BOOKSTORE_GROUND_FLOOR,
BOOKSTORE_TERRARIUM | BOOKSTORE_GROUND_FLOOR,
BOOKSTORE_TERRARIUM | BOOKSTORE_GROUND_FLOOR,
BOOKSTORE_TERRARIUM | BOOKSTORE_GROUND_FLOOR | HOUSE_GROUND_FLOOR,
BOOKSTORE_TERRARIUM | BOOKSTORE_FIRST_FLOOR | HOUSE_GROUND_FLOOR,
BOOKSTORE_TERRARIUM | BOOKSTORE_FIRST_FLOOR | HOUSE_BASEMENT | HOUSE_BEDROOM_LIGHT,
BOOKSTORE_TERRARIUM | BOOKSTORE_BEDROOM | HOUSE_BASEMENT | HOUSE_BEDROOM_LAMP,
BOOKSTORE_BEDROOM | HOUSE_BEDROOM_LAMP,
0,
0,
]
TEST_SCHEDULE = [
BOOKSTORE_GROUND_FLOOR,
BOOKSTORE_FIRST_FLOOR,
BOOKSTORE_TERRARIUM,
BOOKSTORE_BEDROOM,
HOUSE_BASEMENT,
HOUSE_GROUND_FLOOR,
HOUSE_BEDROOM_LIGHT,
HOUSE_BEDROOM_LAMP,
HOUSE_FIREPLACE_1,
HOUSE_FIREPLACE_2,
]
|
"""Role testing files using testinfra"""
def test_config_directory(host):
"""Check config directory"""
f = host.file("/etc/influxdb")
assert f.is_directory
assert f.user == "influxdb"
assert f.group == "root"
assert f.mode == 0o775
def test_data_directory(host):
"""Check data directory"""
d = host.file("/var/lib/influxdb")
assert d.is_directory
assert d.user == "influxdb"
assert d.group == "root"
assert d.mode == 0o700
def test_backup_directory(host):
"""Check backup directory"""
b = host.file("/var/backups/influxdb")
assert b.is_directory
assert b.user == "influxdb"
assert b.group == "root"
assert b.mode == 0o775
def test_influxdb_service(host):
"""Check InfluxDB service"""
s = host.service("influxdb")
assert s.is_running
assert s.is_enabled
def test_influxdb_docker_container(host):
"""Check InfluxDB docker container"""
d = host.docker("influxdb.service").inspect()
assert d["HostConfig"]["Memory"] == 1073741824
assert d["Config"]["Image"] == "influxdb:latest"
assert d["Config"]["Labels"]["maintainer"] == "me@example.com"
assert "INFLUXD_REPORTING_DISABLED=true" in d["Config"]["Env"]
assert "internal" in d["NetworkSettings"]["Networks"]
assert \
"influxdb" in d["NetworkSettings"]["Networks"]["internal"]["Aliases"]
def test_backup(host):
"""Check if the backup runs successfully"""
cmd = host.run("/usr/local/bin/backup-influxdb.sh")
assert cmd.succeeded
def test_backup_cron_job(host):
"""Check backup cron job"""
f = host.file("/var/spool/cron/crontabs/root")
assert "/usr/local/bin/backup-influxdb.sh" in f.content_string
def test_restore(host):
"""Check if the restore runs successfully"""
cmd = host.run("/usr/local/bin/restore-influxdb.sh")
assert cmd.succeeded
|
def apply(con, target_language="E"):
dict_field_desc = {}
try:
df = con.prepare_and_execute_query("DD03T", ["DDLANGUAGE", "FIELDNAME", "DDTEXT"], " WHERE DDLANGUAGE = '"+target_language+"'")
stream = df.to_dict("records")
for el in stream:
dict_field_desc[el["FIELDNAME"]] = el["DDTEXT"]
except:
pass
return dict_field_desc
|
#AFTER PREPROCESSING AND TARGETS DEFINITION
newdataset.describe()
LET_IS.value_counts()
LET_IS.value_counts().plot(kind='bar', color='c')
Y_unica.value_counts()
Y_unica.value_counts().plot(kind='bar', color='c')
ZSN.value_counts().plot(kind='bar', color='c')
Survive.value_counts().plot(kind='bar', color='c')
|
def binarySearch(inputArray, searchElement):
minIndex = -1
maxIndex = len(inputArray)
while minIndex < maxIndex - 1:
currentIndex = (minIndex + maxIndex) // 2
currentElement = inputArray[currentIndex]
if currentElement < searchElement:
minIndex = currentIndex
else:
maxIndex = currentIndex
if maxIndex == len(inputArray) or inputArray[maxIndex] != searchElement:
return -1
return maxIndex
|
d_soldiers = []
class Soldier:
def __init__(self, id, name, team):
self.id = id
self.name = name
self.team = team
self.x = 0
self.y = 0
self.xVelo = 0
self.yVelo = 0
self.kills = 0
self.deaths = 0
self.alive = 'true'
self.driving = 'false'
self.gun = 0
self.ammo = 0
self.reloading = 'false'
def setPosition(self, x, y, xv, yv):
self.x = x
self.y = y
self.xVelo = xv
self.yVelo = yv
def setName(self, name):
self.name = name
def setTeam(self, team):
self.team = team
def setGun(self, gun):
self.gun = gun
def setGunInfo(self, gun, ammo, reloading):
self.gun = gun
self.ammo = ammo
self.reloading = reloading
def die(self):
self.alive = 'false'
self.driving = 'false'
self.deaths += 1
def respawn(self):
self.alive = 'true'
def teleport(self, x, y):
global com
self.x = x
self.y = y
com += 'f_t s '+str(self.id)+' '+str(self.x)+' '+str(self.y)+';'
def applyForce(self, xf, yf):
global com
com += 'f_af s '+str(self.id)+' '+str(xf)+' '+str(yf)+';'
def setVelocity(self, xf, yf):
global com
self.xVelo = xf
self.yVelo = yf
com += 'f_v s '+str(self.id)+' '+str(self.xVelo)+' '+str(self.yVelo)+';'
def changeTeam(self, team):
global com
self.team = team
com += 's_ct '+str(self.id)+' '+str(self.team)+';'
def changeGun(self, gun):
global com
self.gun = gun
com += 's_cg '+str(self.id)+' '+str(self.gun)+';'
def changeAttachment(self, type, amount):
global com
com += 's_ca '+str(self.id)+' '+str(type)+' '+str(amount)+';'
def killSoldier(self):
global com
self.alive = false
com += 's_ks '+str(id)+';'
def respawnSoldier(self, spawn):
global com
com += 's_rs '+str(self.id)+' '+str(spawn)+';'
def enterVehicle(self, vehicleId):
global com
com += 's_en '+str(self.id)+' '+str(vehicleId)+';'
def exitVehicle(self):
global com
com += 's_ex '+str(self.id)+';'
def addKill(self):
global com
self.kills += 1
com += 's_ak '+str(self.id)+';'
def addDeath(self):
global com
self.deaths += 1
com += 's_ad '+str(self.id)+';'
def dropGun(self):
global com
com += 's_dg '+str(self.id)+';'
def addSoldier(team):
global com
com += 'a s '+str(team)+';'
def getSoldier(n):
global d_soldiers
return d_soldiers[n]
def getSoldierById(id):
global d_soldiers
for n in xrange(len(d_soldiers)):
s = d_soldiers[n]
if s.id == id:
return s
def getSoldiers():
global d_soldiers
return d_soldiers
def getSoldierCount():
global d_soldiers
return len(d_soldiers)
def getTeamKills(team):
amount = 0
for n in xrange(len(d_soldiers)):
s = d_soldiers[n]
if s.team == team:
amount += s.kills
return amount
def getTeamDeaths(team):
amount = 0
for n in xrange(len(d_soldiers)):
s = d_soldiers[n]
if s.team == team:
amount += s.deaths
return amount
def getTeamSize(team):
amount = 0
for n in xrange(len(d_soldiers)):
s = d_soldiers[n]
if s.team == team:
amount += 1
return amount
|
#from http://rosettacode.org/wiki/Greatest_subsequential_sum#Python
#pythran export maxsum(int list)
#pythran export maxsumseq(int list)
#pythran export maxsumit(int list)
#runas maxsum([0, 1, 0])
#runas maxsumseq([-1, 2, -1, 3, -1])
#runas maxsumit([-1, 1, 2, -5, -6])
def maxsum(sequence):
"""Return maximum sum."""
maxsofar, maxendinghere = 0, 0
for x in sequence:
# invariant: ``maxendinghere`` and ``maxsofar`` are accurate for ``x[0..i-1]``
maxendinghere = max(maxendinghere + x, 0)
maxsofar = max(maxsofar, maxendinghere)
return maxsofar
def maxsumseq(sequence):
start, end, sum_start = -1, -1, -1
maxsum_, sum_ = 0, 0
for i, x in enumerate(sequence):
sum_ += x
if maxsum_ < sum_: # found maximal subsequence so far
maxsum_ = sum_
start, end = sum_start, i
elif sum_ < 0: # start new sequence
sum_ = 0
sum_start = i
assert maxsum_ == maxsum(sequence)
assert maxsum_ == sum(sequence[start + 1:end + 1])
return sequence[start + 1:end + 1]
def maxsumit(iterable):
maxseq = seq = []
start, end, sum_start = -1, -1, -1
maxsum_, sum_ = 0, 0
for i, x in enumerate(iterable):
seq.append(x); sum_ += x
if maxsum_ < sum_:
maxseq = seq; maxsum_ = sum_
start, end = sum_start, i
elif sum_ < 0:
seq = []; sum_ = 0
sum_start = i
assert maxsum_ == sum(maxseq[:end - start])
return maxseq[:end - start]
|
def task_clean_junk():
"""Remove junk file"""
return {
'actions': ['rm -rdf $(find . | grep pycache)'],
'clean': True,
}
|
def gfg(x,l = []):
for i in range(x):
l.append(i*i)
print(l)
gfg(2)
gfg(3,[3,2,1])
gfg(3)
|
"""Module help_info."""
__author__ = 'Joan A. Pinol (japinol)'
class HelpInfo:
"""Manages information used for help purposes."""
def print_help_keys(self):
print(' F1: \t show a help screen while playing the game'
' t: \t stats on/off\n'
' L_Ctrl + R_Alt + g: grid\n'
' p: \t pause\n'
' ESC: exit game\n'
' ^m: \t pause/resume music\n'
' ^s: \t sound effects on/off\n'
' Alt + Enter: change full screen / normal screen mode\n'
' ^h: \t shows this help\n'
' \t left, a: move snake to the left\n'
' \t right, d: move snake to the right\n'
' \t up, w: move snake up\n'
' \t down, s: move snake down\n'
' \t u 4: fire a light shot\n'
' \t i 5: fire a medium shot\n'
' \t j 1: fire a strong shot\n'
' \t k 2: fire a heavy shot\n'
)
|
n = []
i = 0
for c in range(0, 5):
n1 = int(input('Digite um valor: '))
if c == 0 or n1 > n[-1]:
n.append(n1)
print(f'Adicionado na posição {c} da lista...')
else:
pos = 0
while pos < len(n):
if n1 <= n[pos]:
n.insert(pos, n1)
print(f'Adicionado na posição {pos} da lista...')
break
pos += 1
print(f'Os valores digitados em ordem foram {n}')
|
def format_sql(schedule, table):
for week, schedule in schedule.items():
print(f"UPDATE {table} SET `block`=0, `week`={week} WHERE `name`='{schedule.leader}';")
for block, staffs in schedule.staffs.items():
for staff in staffs:
print(f"UPDATE {table} SET `block`={block}, `week`={week} WHERE `name`='{staff}';")
pass
|
class Node(object):
# XXX: legacy code support
kind = property(lambda self: self.__class__)
def _iterChildren(self):
for name in self.childAttrNames:
yield (name, getattr(self, name))
return
children = property(_iterChildren)
def dump(self, stream, indent=0):
# XXX: Expand argument lists? Show declspecs? (Ditto for
# 'graphviz'.)
for attr, child in self.children:
print >>stream, "%s%s: %r" % (" " * indent, attr, child)
if hasattr(child, 'dump'):
child.dump(stream, indent + 1)
return
def graphviz(self, stream):
print >>stream, ' n%d[label="%r"];' % (id(self), self)
for attr, child in self.children:
if child is None:
pass
elif hasattr(child, 'graphviz'):
child.graphviz(stream)
else:
print >>stream, ' n%d[label="%r"];' % (id(child), child)
print >>stream
for attr, child in self.children:
if child is None:
continue
print >>stream, ' n%d->n%d[label="%s"];' % (
id(self), id(child), attr)
return
|
friendly_camera_mapping = {
"GM1913": "Oneplus 7 Pro",
"FC3170": "Mavic Air 2",
# An analogue scanner in FilmNeverDie
"SP500": "Canon AE-1 Program"
}
|
# Defutils.py -- Contains parsing functions for definition files.
# Produces an organized list of tokens in the file.
def parse(filename):
f=open(filename, "r")
contents=f.read()
f.close()
# Tokenize the file:
#contents=contents.replace('\t', '\n')
lines=contents.splitlines()
outList=[]
for l in lines:
if l[len(l)-1]==':':
outList.append([l.rstrip(':')])
elif l!="":
outList[len(outList)-1].append(l)
return outList
def search(tokList, key):
for tok in tokList:
if tok[0]==key:
return tok
return []
def write(tokList, filename):
f=open(filename, "w")
for tok in tokList:
f.write(tok[0]+":\n")
for i in range(1, len(tok), 1):
f.write(tok[i]+"\n")
f.close()
class InvalidTypeException(Exception):
typestr=""
def __init__(self, value="File cannot be read properly."):
typestr=value
def __str__(self):
return "InvalidTypeException: "+typestr
class DefFormatException(Exception):
typestr=""
def __init__(self, value="Definition format error."):
typestr=value
def __str__(self):
return "DefFormatException: "+typestr
|
class Solution:
# @param s, a string
# @param wordDict, a set<string>
# @return a string[]
def wordBreak(self, s, wordDict):
n = len(s)
res = []
chars = ''.join(wordDict)
for i in xrange(n):
if s[i] not in chars:
return res
lw = s[-1]
lw_end = False
for word in wordDict:
if word[-1] == lw:
lw_end = True
if not lw_end:
return res
self.dfs(s,[],wordDict,res)
return res
def dfs(self, s, path,wordDict,res):
if not s:
res.append(' '.join(path[:]))
return
for i in range(1,len(s)+1):
c = s[:i]
if c in wordDict:
path.append(c)
self.dfs(s[i:],path,wordDict,res)
path.pop() |
# -*- coding:utf-8 -*-
class BaseProvider(object):
@staticmethod
def loads(link_url):
raise NotImplementedError("Implemetion required.")
@staticmethod
def dumps(conf):
raise NotImplementedError("Implemetion required.")
|
session.forget()
def get(args):
if args[0].startswith('__'):
return None
try:
obj = globals(), get(args[0])
for k in range(1, len(args)):
obj = getattr(obj, args[k])
return obj
except:
return None
def vars():
"""the running controller function!"""
title = '.'.join(request.args)
attributes = {}
if not request.args:
(doc, keys, t, c, d, value) = ('Global variables', globals(), None, None, [], None)
elif len(request.args) < 3:
obj = get(request.args)
if obj:
doc = getattr(obj, '__doc__', 'no documentation')
keys = dir(obj)
t = type(obj)
c = getattr(obj, '__class__', None)
d = getattr(obj, '__bases__', None)
for key in keys:
a = getattr(obj, key, None)
if a and not isinstance(a, DAL):
doc1 = getattr(a, '__doc__', '')
t1 = type(a)
c1 = getattr(a, '__class__', None)
d1 = getattr(a, '__bases__', None)
key = '.'.join(request.args) + '.' + key
attributes[key] = (doc1, t1, c1, d1)
else:
doc = 'Unkown'
keys = []
t = c = d = None
else:
raise HTTP(400)
return dict(
title=title,
args=request.args,
t=t,
c=c,
d=d,
doc=doc,
attributes=attributes,
)
|
# https://codegolf.stackexchange.com/a/11480
multiplication = []
for i in range(10):
multiplication.append(i * (i + 1))
for x in multiplication:
print(x) |
"""
PSET-7
Part 2: Triggers (PhraseTriggers)
At this point, you have no way of writing a trigger that matches on
"New York City" -- the only triggers you know how to write would be
a trigger that would fire on "New" AND "York" AND "City" -- which
also fires on the phrase "New students at York University love the
city". It's time to fix this. Since here you're asking for an exact
match, we will require that the cases match, but we'll be a little
more flexible on word matching. So, "New York City" will match:
* New York City sees movie premiere
* In the heart of New York City's famous cafe
* New York Cityrandomtexttoproveapointhere
but will not match:
* I love new york city
* I love New York City!!!!!!!!!!!!!!
PROBLEM 9
Implement a phrase trigger (PhraseTrigger) that fires when a given
phrase is in any of the story's subject, title, or summary. The
phrase should be an argument to the class's constructor.
"""
# Enter your code for WordTrigger, TitleTrigger,
# SubjectTrigger, SummaryTrigger, and PhraseTrigger in this box
class WordTrigger(Trigger):
def __init__(self, word):
self.word = word
def internalAreCharsEqualIgnoreCase(self, c1, c2):
if type(c1) != str or type(c2) != str:
raise TypeError("Arg not of type str")
if len(c1) > 1 or len(c2) > 1:
raise TypeError("Expected a char. Length not equal to 1")
return c1[0] == c2[0] or \
(ord(c1[0]) > 0x60 and (ord(c1[0]) - 0x20 == ord(c2[0])) or ord(c1[0]) < 0x5A and (ord(c1[0]) + 0x20 == ord(c2[0])))
def isWordIn(self, text):
"""
Returns True if word is present in text as
whole word. False otherwise.
"""
charsMatched = 0
firstCharMatchInd = -1
for i in range( len(text) ):
if self.internalAreCharsEqualIgnoreCase(text[i], self.word[0]):
# case-insensitive check for text[i] == self.word[0]
firstCharMatchInd = i
charsMatched += 1
wordInd = 1
while wordInd < len(self.word) and wordInd + firstCharMatchInd < len(text):
if self.internalAreCharsEqualIgnoreCase(self.word[wordInd], text[wordInd + firstCharMatchInd]):
# case-insensitive check for self.word[wordInd] == text[wordInd + firstCharMatchInd]
charsMatched += 1
wordInd += 1
elif self.internalAreCharsEqualIgnoreCase(self.word[wordInd], self.word[0]):
# case-insensitive check for text[i] == self.word[0]
charsMatched = 1
firstCharMatchInd = wordInd + firstCharMatchInd
wordInd = firstCharMatchInd
continue
else:
charsMatched = 0
i = wordInd + firstCharMatchInd
break
if charsMatched == len(self.word):
if len(self.word) == len(text):
return True
elif firstCharMatchInd > 0 and firstCharMatchInd + len(self.word) == len(text):
if text[firstCharMatchInd - 1].isspace() or text[firstCharMatchInd - 1] in string.punctuation:
return True
elif firstCharMatchInd == 0 and firstCharMatchInd + len(self.word) + 1 < len(text):
if text[firstCharMatchInd + len(self.word)].isspace() or text[firstCharMatchInd + len(self.word)] in string.punctuation:
return True
else:
if (text[firstCharMatchInd - 1].isspace() or text[firstCharMatchInd - 1] in string.punctuation) \
and (text[firstCharMatchInd + len(self.word)].isspace() or text[firstCharMatchInd + len(self.word)] in string.punctuation):
return True
return False
class TitleTrigger(WordTrigger):
def evaluate(self, story):
"""
Returns True if an alert should be generated
for the given news item, or False otherwise.
"""
return self.isWordIn( story.getTitle() )
class SubjectTrigger(WordTrigger):
def evaluate(self, story):
"""
Returns True if an alert should be generated
for the given news item, or False otherwise.
"""
return self.isWordIn( story.getSubject() )
class SummaryTrigger(WordTrigger):
def evaluate(self, story):
"""
Returns True if an alert should be generated
for the given news item, or False otherwise.
"""
return self.isWordIn( story.getSummary() )
class PhraseTrigger(Trigger):
def __init__(self, phrase):
self.word = phrase
def isWordIn(self, text):
charsMatched = 0
firstCharMatchInd = -1
for i in range( len(text) ):
if text[i] == self.word[0]:
firstCharMatchInd = i
charsMatched += 1
wordInd = 1
while wordInd < len(self.word) and wordInd + firstCharMatchInd < len(text):
if self.word[wordInd] == text[wordInd + firstCharMatchInd]:
charsMatched += 1
wordInd += 1
elif self.word[wordInd] == self.word[0]:
charsMatched = 1
firstCharMatchInd = wordInd + firstCharMatchInd
wordInd = firstCharMatchInd
continue
else:
charsMatched = 0
i = wordInd + firstCharMatchInd
break
if charsMatched == len(self.word):
return True
return False
def evaluate(self, story):
return self.isWordIn( story.getTitle() ) or \
self.isWordIn( story.getSubject() ) or \
self.isWordIn( story.getSummary() )
|
# flake8: noqa
# errmsg.h
CR_ERROR_FIRST = 2000
CR_UNKNOWN_ERROR = 2000
CR_SOCKET_CREATE_ERROR = 2001
CR_CONNECTION_ERROR = 2002
CR_CONN_HOST_ERROR = 2003
CR_IPSOCK_ERROR = 2004
CR_UNKNOWN_HOST = 2005
CR_SERVER_GONE_ERROR = 2006
CR_VERSION_ERROR = 2007
CR_OUT_OF_MEMORY = 2008
CR_WRONG_HOST_INFO = 2009
CR_LOCALHOST_CONNECTION = 2010
CR_TCP_CONNECTION = 2011
CR_SERVER_HANDSHAKE_ERR = 2012
CR_SERVER_LOST = 2013
CR_COMMANDS_OUT_OF_SYNC = 2014
CR_NAMEDPIPE_CONNECTION = 2015
CR_NAMEDPIPEWAIT_ERROR = 2016
CR_NAMEDPIPEOPEN_ERROR = 2017
CR_NAMEDPIPESETSTATE_ERROR = 2018
CR_CANT_READ_CHARSET = 2019
CR_NET_PACKET_TOO_LARGE = 2020
CR_EMBEDDED_CONNECTION = 2021
CR_PROBE_SLAVE_STATUS = 2022
CR_PROBE_SLAVE_HOSTS = 2023
CR_PROBE_SLAVE_CONNECT = 2024
CR_PROBE_MASTER_CONNECT = 2025
CR_SSL_CONNECTION_ERROR = 2026
CR_MALFORMED_PACKET = 2027
CR_WRONG_LICENSE = 2028
CR_NULL_POINTER = 2029
CR_NO_PREPARE_STMT = 2030
CR_PARAMS_NOT_BOUND = 2031
CR_DATA_TRUNCATED = 2032
CR_NO_PARAMETERS_EXISTS = 2033
CR_INVALID_PARAMETER_NO = 2034
CR_INVALID_BUFFER_USE = 2035
CR_UNSUPPORTED_PARAM_TYPE = 2036
CR_SHARED_MEMORY_CONNECTION = 2037
CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR = 2038
CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR = 2039
CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR = 2040
CR_SHARED_MEMORY_CONNECT_MAP_ERROR = 2041
CR_SHARED_MEMORY_FILE_MAP_ERROR = 2042
CR_SHARED_MEMORY_MAP_ERROR = 2043
CR_SHARED_MEMORY_EVENT_ERROR = 2044
CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR = 2045
CR_SHARED_MEMORY_CONNECT_SET_ERROR = 2046
CR_CONN_UNKNOW_PROTOCOL = 2047
CR_INVALID_CONN_HANDLE = 2048
CR_SECURE_AUTH = 2049
CR_FETCH_CANCELED = 2050
CR_NO_DATA = 2051
CR_NO_STMT_METADATA = 2052
CR_NO_RESULT_SET = 2053
CR_NOT_IMPLEMENTED = 2054
CR_SERVER_LOST_EXTENDED = 2055
CR_STMT_CLOSED = 2056
CR_NEW_STMT_METADATA = 2057
CR_ALREADY_CONNECTED = 2058
CR_AUTH_PLUGIN_CANNOT_LOAD = 2059
CR_DUPLICATE_CONNECTION_ATTR = 2060
CR_AUTH_PLUGIN_ERR = 2061
CR_ERROR_LAST = 2061
|
# -*- coding: utf-8 -*-
class HTTP:
BAD_REQUEST = 400
UNAUTHORIZED = 401
FORBIDDEN = 403
NOT_FOUND = 404
METHOD_NOT_ALLOWED = 405
CONFLICT = 409
UNSUPPORTED_MEDIA_TYPE = 415
|
resposta = 'Ss'
numeros = 0
listaTODOS = []
listaPAR = []
listaIMPAR = []
while resposta != 'N':
numeros = int(input('Digite um número: '))
resposta = str(input('Deseja continuar [S/N]? '))
if numeros % 2 == 0:
listaPAR.append(numeros)
elif numeros % 2 == 1:
listaIMPAR.append(numeros)
listaTODOS.append(numeros)
print(f'Os valores PARES digitados foram: {listaPAR}')
print(f'Os valores IMPARES digitados foram: {listaIMPAR}')
listaTODOS.sort()
print(f'No TOTAL foram: {listaTODOS}') |
"""
面试题 29:顺时针打印矩阵
题目:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。
"""
def make_matrix(rows: int, cols: int) -> list:
res = []
k = 0
for i in range(rows):
tmp = []
for j in range(cols):
k += 1
tmp.append(k)
res.append(tmp)
return res
def print_matrix_clockwisely(matrix: list) -> list:
"""
Print the given matrix clockwesely.
Parameters
-----------
matrix: list[list]
the given matrix.
Returns
---------
out: list
the clockwise order of the matrix.
Notes
------
"""
if not matrix:
return []
if not matrix[0]:
return []
res = []
start = 0
rows, cols = len(matrix), len(matrix[0])
while rows > 2 * start and cols > 2 * start:
print_circle2(matrix, rows, cols, start, res)
start += 1
return res
def print_circle(matrix: list, rows: int, cols: int, start: int, res: list):
endx = cols - 1 - start
endy = rows - 1 - start
# left -> right
for i in range(start, endx+1):
res.append(matrix[start][i])
# up -> below
if start < endy:
for i in range(start+1, endy+1):
res.append(matrix[i][endx])
# right -> left
if start < endx and start < endy:
for i in reversed(range(start, endx)):
res.append(matrix[endy][i])
# below -> up
if start < endx and start < endy - 1:
for i in reversed(range(start+1, endy)):
res.append(matrix[i][start])
def print_circle2(matrix: list, rows: int, cols: int, start: int, res: list):
endx = cols - 1 - start
endy = rows - 1 - start
# left -> right
for i in range(start, endx+1):
res.append(matrix[start][i])
# up -> below
for i in range(start+1, endy+1):
res.append(matrix[i][endx])
# right -> left
if start < endy:
for i in reversed(range(start, endx)):
res.append(matrix[endy][i])
# below -> up
if start < endx:
for i in reversed(range(start+1, endy)):
res.append(matrix[i][start])
if __name__ == '__main__':
m = make_matrix(1,5)
print(m)
res = print_matrix_clockwisely(m)
print(res)
|
"""EnvSpec class."""
class EnvSpec:
"""EnvSpec class.
Args:
observation_space (akro.Space): The observation space of the env.
action_space (akro.Space): The action space of the env.
"""
def __init__(self, observation_space, action_space):
self.observation_space = observation_space
self.action_space = action_space
|
#
# PySNMP MIB module CISCO-DIAMETER-BASE-PROTOCOL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DIAMETER-BASE-PROTOCOL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:54:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint")
ciscoExperiment, = mibBuilder.importSymbols("CISCO-SMI", "ciscoExperiment")
InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup")
Gauge32, ObjectIdentity, Unsigned32, NotificationType, iso, MibIdentifier, Counter64, Counter32, Bits, Integer32, ModuleIdentity, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ObjectIdentity", "Unsigned32", "NotificationType", "iso", "MibIdentifier", "Counter64", "Counter32", "Bits", "Integer32", "ModuleIdentity", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks")
RowStatus, StorageType, TruthValue, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "StorageType", "TruthValue", "DisplayString", "TextualConvention")
ciscoDiameterBasePMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 10, 133))
ciscoDiameterBasePMIB.setRevisions(('2006-08-24 00:01',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: ciscoDiameterBasePMIB.setRevisionsDescriptions(('Initial version of this MIB module.',))
if mibBuilder.loadTexts: ciscoDiameterBasePMIB.setLastUpdated('200608240001Z')
if mibBuilder.loadTexts: ciscoDiameterBasePMIB.setOrganization('Cisco Systems, Inc.')
if mibBuilder.loadTexts: ciscoDiameterBasePMIB.setContactInfo('Cisco Systems Customer Service Postal: 170 W Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-aaa@cisco.com')
if mibBuilder.loadTexts: ciscoDiameterBasePMIB.setDescription("The MIB module for entities implementing the Diameter Base Protocol. Initial Cisco'ized version of the IETF draft draft-zorn-dime-diameter-base-protocol-mib-00.txt.")
ciscoDiameterBasePMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 0))
ciscoDiameterBasePMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 1))
ciscoDiameterBasePMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 2))
cdbpLocalCfgs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1))
cdbpLocalStats = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 2))
cdbpPeerCfgs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3))
cdbpPeerStats = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4))
cdbpRealmCfgs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 5))
cdbpRealmStats = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6))
cdbpTrapCfgs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 7))
ciscoDiaBaseProtEnableProtocolErrorNotif = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 7, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ciscoDiaBaseProtEnableProtocolErrorNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtEnableProtocolErrorNotif.setDescription('Setting the value of this object to true(1) enables the ciscoDiaBaseProtProtocolErrorNotif notification.')
ciscoDiaBaseProtProtocolErrorNotif = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 133, 0, 1)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsProtocolErrors"))
if mibBuilder.loadTexts: ciscoDiaBaseProtProtocolErrorNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtProtocolErrorNotif.setDescription('An ciscoDiaBaseProtProtocolErrorNotif notification is sent when both the following conditions are true: 1) the value of ciscoDiaBaseProtEnableProtocolErrorNotif is true(1) 2) the value of cdbpPeerStatsProtocolErrors changes. It can be utilized by an NMS to trigger logical/physical entity table maintenance polls.')
ciscoDiaBaseProtEnableTransientFailureNotif = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 7, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ciscoDiaBaseProtEnableTransientFailureNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtEnableTransientFailureNotif.setDescription('Setting the value of this object to true(1) enables the ciscoDiaBaseProtTransientFailureNotif notification.')
ciscoDiaBaseProtTransientFailureNotif = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 133, 0, 2)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsTransientFailures"))
if mibBuilder.loadTexts: ciscoDiaBaseProtTransientFailureNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtTransientFailureNotif.setDescription('An ciscoDiaBaseProtTransientFailureNotif notification is sent when both the following conditions are true: 1) the value of ciscoDiaBaseProtEnableTransientFailureNotif is true(1) 2) the value of cdbpPeerStatsTransientFailures changes. It can be utilized by an NMS to trigger logical/physical entity table maintenance polls.')
ciscoDiaBaseProtEnablePermanentFailureNotif = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 7, 3), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ciscoDiaBaseProtEnablePermanentFailureNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtEnablePermanentFailureNotif.setDescription('Setting the value of this object to true(1) enables the ciscoDiaBaseProtPermanentFailureNotif notification.')
ciscoDiaBaseProtPermanentFailureNotif = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 133, 0, 3)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsPermanentFailures"))
if mibBuilder.loadTexts: ciscoDiaBaseProtPermanentFailureNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtPermanentFailureNotif.setDescription('An ciscoDiaBaseProtPermanentFailureNotif notification is sent when both the following conditions are true: 1) the value of ciscoDiaBaseProtEnablePermanentFailureNotif is true(1) 2) the value of cdbpPeerStatsPermanentFailures changes. It can be utilized by an NMS to trigger logical/physical entity table maintenance polls.')
ciscoDiaBaseProtEnablePeerConnectionDownNotif = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 7, 4), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ciscoDiaBaseProtEnablePeerConnectionDownNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtEnablePeerConnectionDownNotif.setDescription('Setting the value of this object to true(1) enables the ciscoDiaBaseProtPeerConnectionDownNotif notification.')
ciscoDiaBaseProtPeerConnectionDownNotif = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 133, 0, 4)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerId"))
if mibBuilder.loadTexts: ciscoDiaBaseProtPeerConnectionDownNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtPeerConnectionDownNotif.setDescription('An ciscoDiaBaseProtPeerConnectionDownNotif notification is sent when both the following conditions are true: 1) the value of ciscoDiaBaseProtEnablePeerConnectionDownNotif is true(1) 2) cdbpPeerStatsState changes to closed(1). It can be utilized by an NMS to trigger logical/physical entity table maintenance polls.')
ciscoDiaBaseProtEnablePeerConnectionUpNotif = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 7, 5), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ciscoDiaBaseProtEnablePeerConnectionUpNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtEnablePeerConnectionUpNotif.setDescription('Setting the value of this object to true(1) enables the ciscoDiaBaseProtPeerConnectionUpNotif notification.')
ciscoDiaBaseProtPeerConnectionUpNotif = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 133, 0, 5)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerId"))
if mibBuilder.loadTexts: ciscoDiaBaseProtPeerConnectionUpNotif.setStatus('current')
if mibBuilder.loadTexts: ciscoDiaBaseProtPeerConnectionUpNotif.setDescription('An ciscoDiaBaseProtPeerConnectionUpNotif notification is sent when both the following conditions are true: 1) the value of ciscoDiaBaseProtEnablePeerConnectionUpNotif is true(1) 2) the value of cdbpPeerStatsState changes to either rOpen(6)or iOpen(7). It can be utilized by an NMS to trigger logical/physical entity table maintenance polls.')
cdbpLocalId = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 1), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalId.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalId.setDescription("The implementation identification string for the Diameter software in use on the system, for example; 'diameterd'")
cdbpLocalIpAddrTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 2), )
if mibBuilder.loadTexts: cdbpLocalIpAddrTable.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalIpAddrTable.setDescription("The table listing the Diameter local host's IP Addresses.")
cdbpLocalIpAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 2, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalIpAddrIndex"))
if mibBuilder.loadTexts: cdbpLocalIpAddrEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalIpAddrEntry.setDescription('A row entry representing a Diameter local host IP Address.')
cdbpLocalIpAddrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpLocalIpAddrIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalIpAddrIndex.setDescription('A number uniquely identifying the number of IP Addresses supported by this Diameter host.')
cdbpLocalIpAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 2, 1, 2), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalIpAddrType.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalIpAddrType.setDescription('The type of internet address stored in cdbpLocalIpAddress.')
cdbpLocalIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 2, 1, 3), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalIpAddress.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalIpAddress.setDescription('The IP-Address of the host, which is of the type specified in cdbpLocalIpAddrType.')
cdbpLocalTcpListenPort = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalTcpListenPort.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalTcpListenPort.setDescription("This object represents Diameter TCP 'listen' port.")
cdbpLocalSctpListenPort = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalSctpListenPort.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalSctpListenPort.setDescription("This object represents Diameter SCTP 'listen' port.")
cdbpLocalOriginHost = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 5), SnmpAdminString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cdbpLocalOriginHost.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalOriginHost.setDescription('This object represents the Local Origin Host.')
cdbpLocalRealm = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 6), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalRealm.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalRealm.setDescription('This object represents the Local Realm Name.')
cdbpRedundancyEnabled = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 7), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cdbpRedundancyEnabled.setStatus('current')
if mibBuilder.loadTexts: cdbpRedundancyEnabled.setDescription('This parameter indicates if cisco redundancy has been enabled, it is enabled if set to true and disabled if set to false.')
cdbpRedundancyInfraState = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14))).clone(namedValues=NamedValues(("rfUnknown", 0), ("rfDisabled", 1), ("rfInitialization", 2), ("rfNegotiation", 3), ("rfStandbyCold", 4), ("rfStandbyConfig", 5), ("rfStandbyFileSys", 6), ("rfStandbyBulk", 7), ("rfStandbyHot", 8), ("rfActiveFast", 9), ("rfActiveDrain", 10), ("rfActivePreconfig", 11), ("rfActivePostconfig", 12), ("rfActive", 13), ("rfActiveExtraload", 14)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRedundancyInfraState.setStatus('current')
if mibBuilder.loadTexts: cdbpRedundancyInfraState.setDescription("This parameter indicates the current state of cisco redundancy infrastructure state. rfUnknown(0) - unknown state rfDisabled(1) - RF is not functioning at this time rfInitialization(2) - co-ordinating init with platform rfNegotiation(3) - initial negotiation with peer to determine active-standby rfStandbyCold(4) - peer is active, we're cold rfStandbyConfig(5) - sync config from active to standby rfStandbyFileSys(6) - sync file sys from active to standby rfStandbyBulk(7) - clients bulk sync from active to standby rfStandbyHot(8) - standby ready-n-able to be active rfActiveFast(9) - immediate notification of standby going active rfActiveDrain(10) - drain queued messages from peer rfActivePreconfig(11) - active and before config rfActivePostconfig(12) - active and post config rfActive(13) - actively processing new calls rfActiveExtraload(14) - actively processing new calls extra resources other Processing is failed and I have extra load.")
cdbpRedundancyLastSwitchover = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 9), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRedundancyLastSwitchover.setStatus('current')
if mibBuilder.loadTexts: cdbpRedundancyLastSwitchover.setDescription('This object represents the Last Switchover Time.')
cdbpLocalApplTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 10), )
if mibBuilder.loadTexts: cdbpLocalApplTable.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalApplTable.setDescription('The table listing the Diameter applications supported by this server.')
cdbpLocalApplEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 10, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalApplIndex"))
if mibBuilder.loadTexts: cdbpLocalApplEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalApplEntry.setDescription('A row entry representing a Diameter application on this server.')
cdbpLocalApplIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 10, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpLocalApplIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalApplIndex.setDescription('A number uniquely identifying a supported Diameter application. Upon reload, cdbpLocalApplIndex values may be changed.')
cdbpLocalApplStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 10, 1, 2), StorageType().clone('nonVolatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpLocalApplStorageType.setReference('Textual Conventions for SMIv2, Section 2.')
if mibBuilder.loadTexts: cdbpLocalApplStorageType.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalApplStorageType.setDescription('The storage type for this conceptual row. None of the columnar objects is writable when the conceptual row is permanent.')
cdbpLocalApplRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 10, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpLocalApplRowStatus.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalApplRowStatus.setDescription("The status of this conceptual row. To create a row in this table, a manager must set this object to either createAndGo(4) or createAndWait(5). Until instances of all corresponding columns are appropriately configured, the value of the corresponding instance of the cdsgStatus column is 'notReady'. In particular, a newly created row cannot be made active until the corresponding cdbpLocalApplIndex has been set. cdbpLocalApplIndex may not be modified while the value of this object is active(1): An attempt to set these objects while the value of cdbpLocalApplStatus is active(1) will result in an inconsistentValue error. Entries in this table with cdbpLocalApplStatus equal to active(1) remain in the table until destroyed. Entries in this table with cdbpLocalApplStatus equal to values other than active(1) will be destroyed after timeout (5 minutes).")
cdbpLocalVendorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 11), )
if mibBuilder.loadTexts: cdbpLocalVendorTable.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalVendorTable.setDescription('The table listing the vendor IDs supported by local Diameter.')
cdbpLocalVendorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 11, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalVendorIndex"))
if mibBuilder.loadTexts: cdbpLocalVendorEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalVendorEntry.setDescription('A row entry representing a vendor ID supported by local Diameter.')
cdbpLocalVendorIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 11, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpLocalVendorIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalVendorIndex.setDescription('A number uniquely identifying the vendor ID supported by local Diameter. Upon reload, cdbpLocalVendorIndex values may be changed.')
cdbpLocalVendorId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 11, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 9, 10415, 12645))).clone(namedValues=NamedValues(("diameterVendorIetf", 0), ("diameterVendorCisco", 9), ("diameterVendor3gpp", 10415), ("diameterVendorVodafone", 12645))).clone('diameterVendorIetf')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpLocalVendorId.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalVendorId.setDescription('The active vendor ID used for peer connections. diameterVendorIetf(0) - Diameter vendor id ietf diameterVendorCisco(9) - Diameter vendor id cisco diameterVendor3gpp(10415) - Diameter vendor id 3gpp diameterVendorVodafone(12645) - Diameter vendor id vodafone.')
cdbpLocalVendorStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 11, 1, 3), StorageType().clone('nonVolatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpLocalVendorStorageType.setReference('Textual Conventions for SMIv2, Section 2.')
if mibBuilder.loadTexts: cdbpLocalVendorStorageType.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalVendorStorageType.setDescription('The storage type for this conceptual row. None of the objects are writable when the conceptual row is permanent.')
cdbpLocalVendorRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 11, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpLocalVendorRowStatus.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalVendorRowStatus.setDescription("The status of this conceptual row. To create a row in this table, a manager must set this object to either createAndGo(4) or createAndWait(5). Until instances of all corresponding columns are appropriately configured, the value of the corresponding instance of the cdbpLocalVendorRowStatus column is 'notReady'. In particular, a newly created row cannot be made active until the corresponding cdbpLocalVendorId has been set. cdbpLocalVendorId may not be modified while the value of this object is active(1): An attempt to set these objects while the value of cdbpLocalVendorRowStatus is active(1) will result in an inconsistentValue error. Entries in this table with cdbpLocalVendorRowStatus equal to active(1) remain in the table until destroyed. Entries in this table with cdbpLocalVendorRowStatus equal to values other than active(1) will be destroyed after timeout (5 minutes).")
cdbpAppAdvToPeerTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 12), )
if mibBuilder.loadTexts: cdbpAppAdvToPeerTable.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvToPeerTable.setDescription('The table listing the applications advertised by this host to each peer and the types of service supported: accounting, authentication or both.')
cdbpAppAdvToPeerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 12, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIndex"), (0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpAppAdvToPeerVendorId"), (0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpAppAdvToPeerIndex"))
if mibBuilder.loadTexts: cdbpAppAdvToPeerEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvToPeerEntry.setDescription('A row entry representing a discovered or configured Diameter peer server.')
cdbpAppAdvToPeerVendorId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 12, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpAppAdvToPeerVendorId.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvToPeerVendorId.setDescription('The IANA Enterprise Code value assigned to the vendor of the Diameter device.')
cdbpAppAdvToPeerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 12, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpAppAdvToPeerIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvToPeerIndex.setDescription('A number uniquely identifying the Diameter applications advertised as supported by this host to each peer. Upon reload, cdbpAppAdvToPeerIndex values may be changed.')
cdbpAppAdvToPeerServices = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 12, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("acct", 1), ("auth", 2), ("both", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpAppAdvToPeerServices.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvToPeerServices.setDescription('The type of services supported for each application, accounting, authentication or both. acct(1) - accounting auth(2) - authentication both(3) - both accounting and authentication.')
cdbpAppAdvToPeerStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 12, 1, 4), StorageType().clone('nonVolatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpAppAdvToPeerStorageType.setReference('Textual Conventions for SMIv2, Section 2.')
if mibBuilder.loadTexts: cdbpAppAdvToPeerStorageType.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvToPeerStorageType.setDescription('The storage type for this conceptual row. None of the objects are writable when the conceptual row is permanent.')
cdbpAppAdvToPeerRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 1, 12, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpAppAdvToPeerRowStatus.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvToPeerRowStatus.setDescription("The status of this conceptual row. To create a row in this table, a manager must set this object to either createAndGo(4) or createAndWait(5). Until instances of all corresponding columns are appropriately configured, the value of the corresponding instance of the cdbpAppAdvToPeerRowStatus column is 'notReady'. In particular, a newly created row cannot be made active until the corresponding cdbpAppAdvToPeerVendorId has been set. cdbpAppAdvToPeerVendorId may not be modified while the value of this object is active(1): An attempt to set these objects while the value of cdbpAppAdvToPeerRowStatus is active(1) will result in an inconsistentValue error. Entries in this table with cdbpAppAdvToPeerRowStatus equal to active(1) remain in the table until destroyed. Entries in this table with cdbpAppAdvToPeerRowStatus equal to values other than active(1) will be destroyed after timeout (5 minutes).")
cdbpLocalStatsTotalPacketsIn = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 2, 1), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalStatsTotalPacketsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalStatsTotalPacketsIn.setDescription('The total number of packets received by Diameter Base Protocol.')
cdbpLocalStatsTotalPacketsOut = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 2, 2), Counter32()).setUnits('packets').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalStatsTotalPacketsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalStatsTotalPacketsOut.setDescription('The total number of packets transmitted by Diameter Base Protocol.')
cdbpLocalStatsTotalUpTime = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 2, 3), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalStatsTotalUpTime.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalStatsTotalUpTime.setDescription('This object represents the total time the Diameter server has been up until now.')
cdbpLocalResetTime = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 2, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpLocalResetTime.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalResetTime.setDescription("If the server keeps persistent state (e.g., a process) and supports a 'reset' operation (e.g., can be told to re-read configuration files), this value will be the time elapsed (in hundredths of a second) since the server was 'reset'. For software that does not have persistence or does not support a 'reset' operation, this value will be zero.")
cdbpLocalConfigReset = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 2, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("reset", 2), ("initializing", 3), ("running", 4))).clone('other')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cdbpLocalConfigReset.setStatus('current')
if mibBuilder.loadTexts: cdbpLocalConfigReset.setDescription('Status/action object to reinitialize any persistent server state. When set to reset(2), any persistent server state (such as a process) is reinitialized as if the server had just been started. This value will never be returned by a read operation. When read, one of the following values will be returned: other(1) - server in some unknown state. reset(2) - command to reinitialize server state. initializing(3) - server (re)initializing. running(4) - server currently running.')
cdbpPeerTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1), )
if mibBuilder.loadTexts: cdbpPeerTable.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerTable.setDescription('The table listing information regarding the discovered or configured Diameter peer servers.')
cdbpPeerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIndex"))
if mibBuilder.loadTexts: cdbpPeerEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerEntry.setDescription('A row entry representing a discovered or configured Diameter peer server.')
cdbpPeerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpPeerIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerIndex.setDescription('A number uniquely identifying each Diameter peer with which the host server communicates. Upon reload, cdbpPeerIndex values may be changed.')
cdbpPeerId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 2), SnmpAdminString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpPeerId.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerId.setDescription('The server identifier for the Diameter peer. It must be unique and non-empty.')
cdbpPeerPortConnect = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerPortConnect.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerPortConnect.setDescription('The connection port this server used to connect to the Diameter peer. If there is no active connection, this value will be zero(0).')
cdbpPeerPortListen = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)).clone(3868)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpPeerPortListen.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerPortListen.setDescription('The port the server is listening on.')
cdbpPeerProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("tcp", 1), ("sctp", 2))).clone('tcp')).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerProtocol.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerProtocol.setDescription('The transport protocol (tcp/sctp) the Diameter peer is using. tcp(1) - Transmission Control Protocol sctp(2) - Stream Control Transmission Protocol.')
cdbpPeerSecurity = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("tls", 2), ("ipsec", 3))).clone('other')).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerSecurity.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerSecurity.setDescription('The security the Diameter peer is using. other(1) - Unknown Security Protocol. tls(2) - Transport Layer Security Protocol. ipsec(3) - Internet Protocol Security.')
cdbpPeerFirmwareRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerFirmwareRevision.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerFirmwareRevision.setDescription('Firmware revision of peer. If no firmware revision, the revision of the Diameter software module may be reported instead.')
cdbpPeerStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 8), StorageType().clone('nonVolatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpPeerStorageType.setReference('Textual Conventions for SMIv2, Section 2.')
if mibBuilder.loadTexts: cdbpPeerStorageType.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStorageType.setDescription('The storage type for this conceptual row. Only cdbpPeerPortListen object is writable when the conceptual row is permanent.')
cdbpPeerRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 1, 1, 9), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpPeerRowStatus.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerRowStatus.setDescription("The status of this conceptual row. To create a row in this table, a manager must set this object to either createAndGo(4) or createAndWait(5). Until instances of all corresponding columns are appropriately configured, the value of the corresponding instance of the cdbpPeerRowStatus column is 'notReady'. In particular, a newly created row cannot be made active until the corresponding cdbpPeerId has been set. cdbpPeerId may not be modified while the value of this object is active(1): An attempt to set these objects while the value of cdbpPeerRowStatus is active(1) will result in an inconsistentValue error. Entries in this table with cdbpPeerRowStatus equal to active(1) remain in the table until destroyed. Entries in this table with cdbpPeerRowStatus equal to values other than active(1) will be destroyed after timeout (5 minutes).")
cdbpPeerIpAddrTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 2), )
if mibBuilder.loadTexts: cdbpPeerIpAddrTable.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerIpAddrTable.setDescription('The table listing the Diameter server IP Addresses.')
cdbpPeerIpAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 2, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIndex"), (0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIpAddressIndex"))
if mibBuilder.loadTexts: cdbpPeerIpAddrEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerIpAddrEntry.setDescription('A row entry representing peer Diameter server IP Addresses.')
cdbpPeerIpAddressIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpPeerIpAddressIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerIpAddressIndex.setDescription('A number uniquely identifying the number of IP Addresses supported by all Diameter peers.')
cdbpPeerIpAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 2, 1, 2), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerIpAddressType.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerIpAddressType.setDescription('The type of address stored in diameterPeerIpAddress.')
cdbpPeerIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 2, 1, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cdbpPeerIpAddress.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerIpAddress.setDescription('The active IP Address(es) used for connections.')
cdbpAppAdvFromPeerTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 3), )
if mibBuilder.loadTexts: cdbpAppAdvFromPeerTable.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvFromPeerTable.setDescription('The table listing the applications advertised by each peer to this host and the types of service supported: accounting, authentication or both.')
cdbpAppAdvFromPeerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 3, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIndex"), (0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpAppAdvFromPeerVendorId"), (0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpAppAdvFromPeerIndex"))
if mibBuilder.loadTexts: cdbpAppAdvFromPeerEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvFromPeerEntry.setDescription('A row entry representing a discovered or configured Diameter peer server.')
cdbpAppAdvFromPeerVendorId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpAppAdvFromPeerVendorId.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvFromPeerVendorId.setDescription('The IANA Enterprise Code value assigned to the vendor of the Diameter device.')
cdbpAppAdvFromPeerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 3, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpAppAdvFromPeerIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvFromPeerIndex.setDescription('A number uniquely identifying the applications advertised as supported from each Diameter peer.')
cdbpAppAdvFromPeerType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 3, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("acct", 1), ("auth", 2), ("both", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpAppAdvFromPeerType.setStatus('current')
if mibBuilder.loadTexts: cdbpAppAdvFromPeerType.setDescription('The type of services supported for each application, accounting, authentication or both. acct(1) - accounting auth(2) - authentication both(3) - both accounting and authentication.')
cdbpPeerVendorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 4), )
if mibBuilder.loadTexts: cdbpPeerVendorTable.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerVendorTable.setDescription('The table listing the Vendor IDs supported by the peer.')
cdbpPeerVendorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 4, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIndex"), (0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerVendorIndex"))
if mibBuilder.loadTexts: cdbpPeerVendorEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerVendorEntry.setDescription('A row entry representing a Vendor ID supported by the peer.')
cdbpPeerVendorIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 4, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpPeerVendorIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerVendorIndex.setDescription('A number uniquely identifying the Vendor ID supported by the peer. Upon reload, cdbpPeerVendorIndex values may be changed.')
cdbpPeerVendorId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 9, 10415, 12645))).clone(namedValues=NamedValues(("diameterVendorIetf", 0), ("diameterVendorCisco", 9), ("diameterVendor3gpp", 10415), ("diameterVendorVodafone", 12645))).clone('diameterVendorIetf')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpPeerVendorId.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerVendorId.setDescription('The active vendor ID used for peer connections. diameterVendorIetf(0) - Diameter vendor id ietf diameterVendorCisco(9) - Diameter vendor id cisco diameterVendor3gpp(10415) - Diameter vendor id 3gpp diameterVendorVodafone(12645) - Diameter vendor id vodafone.')
cdbpPeerVendorStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 4, 1, 3), StorageType().clone('nonVolatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpPeerVendorStorageType.setReference('Textual Conventions for SMIv2, Section 2.')
if mibBuilder.loadTexts: cdbpPeerVendorStorageType.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerVendorStorageType.setDescription('The storage type for this conceptual row. None of the objects are writable when the conceptual row is permanent.')
cdbpPeerVendorRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 3, 4, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cdbpPeerVendorRowStatus.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerVendorRowStatus.setDescription("The status of this conceptual row. To create a row in this table, a manager must set this object to either createAndGo(4) or createAndWait(5). Until instances of all corresponding columns are appropriately configured, the value of the corresponding instance of the cdbpPeerVendorRowStatus column is 'notReady'. In particular, a newly created row cannot be made active until the corresponding cdbpPeerVendorId has been set. Also, a newly created row cannot be made active until the corresponding 'cdbpPeerIndex' has been set. cdbpPeerVendorId may not be modified while the value of this object is active(1): An attempt to set these objects while the value of cdbpPeerVendorRowStatus is active(1) will result in an inconsistentValue error. Entries in this table with cdbpPeerVendorRowStatus equal to active(1) remain in the table until destroyed. Entries in this table with cdbpPeerVendorRowStatus equal to values other than active(1) will be destroyed after timeout (5 minutes).")
cdbpPeerStatsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1), )
if mibBuilder.loadTexts: cdbpPeerStatsTable.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsTable.setDescription('The table listing the Diameter peer statistics.')
cdbpPeerStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIndex"))
if mibBuilder.loadTexts: cdbpPeerStatsEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsEntry.setDescription('A row entry representing a Diameter peer.')
cdbpPeerStatsState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("closed", 1), ("waitConnAck", 2), ("waitICEA", 3), ("elect", 4), ("waitReturns", 5), ("rOpen", 6), ("iOpen", 7), ("closing", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsState.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsState.setDescription('Connection state in the Peer State Machine of the peer with which this Diameter server is communicating. closed(1) - Connection closed with this peer. waitConnAck(2) - Waiting for an acknowledgment from this peer. waitICEA(3) - Waiting for a Capabilities-Exchange- Answer from this peer. elect(4) - When the peer and the server are both trying to bring up a connection with each other at the same time. An election process begins which determines which socket remains open. waitReturns(5) - Waiting for election returns. r-open(6) - Responder transport connection is used for communication. i-open(7) - Initiator transport connection is used for communication. closing(8) - Actively closing and doing cleanup.')
cdbpPeerStatsStateDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 2), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsStateDuration.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsStateDuration.setDescription('This object represents the Peer state duration.')
cdbpPeerStatsLastDiscCause = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("rebooting", 1), ("busy", 2), ("doNotWantToTalk", 3), ("election", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsLastDiscCause.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsLastDiscCause.setDescription("The last cause for a peers disconnection. rebooting(1) - A scheduled reboot is imminent. busy(2) - The peer's internal resources are constrained, and it has determined that the transport connection needs to be shutdown. doNotWantToTalk(3) - The peer has determined that it does not see a need for the transport connection to exist, since it does not expect any messages to be exchanged in the foreseeable future. electionLost(4) - The peer has determined that it has lost the election process and has therefore disconnected the transport connection.")
cdbpPeerStatsWhoInitDisconnect = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("host", 1), ("peer", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsWhoInitDisconnect.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsWhoInitDisconnect.setDescription('Did the host or peer initiate the disconnect? host(1) - If this server initiated the disconnect. peer(2) - If the peer with which this server was connected initiated the disconnect.')
cdbpPeerStatsDWCurrentStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("okay", 1), ("suspect", 2), ("down", 3), ("reopen", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDWCurrentStatus.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDWCurrentStatus.setDescription('This object indicates the connection status. okay(1) - Indicates the connection is presumed working. suspect(2) - Indicates the connection is possibly congested or down. down(3) - The peer is no longer reachable, causing the transport connection to be shutdown. reopen(4) - Three watchdog messages are exchanged with accepted round trip times, and the connection to the peer is considered stabilized.')
cdbpPeerStatsTimeoutConnAtmpts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 6), Counter32()).setUnits('attempts').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsTimeoutConnAtmpts.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsTimeoutConnAtmpts.setDescription('If there is no transport connection with a peer, this is the number of times the server attempts to connect to that peer. This is reset on disconnection.')
cdbpPeerStatsASRsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 7), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsASRsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsASRsIn.setDescription('Abort-Session-Request messages received from the peer.')
cdbpPeerStatsASRsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 8), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsASRsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsASRsOut.setDescription('Abort-Session-Request messages sent to the peer.')
cdbpPeerStatsASAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 9), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsASAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsASAsIn.setDescription('Number of Abort-Session-Answer messages received from the peer.')
cdbpPeerStatsASAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 10), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsASAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsASAsOut.setDescription('Number of Abort-Session-Answer messages sent to the peer.')
cdbpPeerStatsACRsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 11), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsACRsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsACRsIn.setDescription('Number of Accounting-Request messages received from the peer.')
cdbpPeerStatsACRsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 12), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsACRsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsACRsOut.setDescription('Number of Accounting-Request messages sent to the peer.')
cdbpPeerStatsACAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 13), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsACAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsACAsIn.setDescription('Number of Accounting-Answer messages received from the peer.')
cdbpPeerStatsACAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 14), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsACAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsACAsOut.setDescription('Number of Accounting-Answer messages sent to the peer.')
cdbpPeerStatsCERsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 15), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsCERsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsCERsIn.setDescription('Number of Capabilities-Exchange-Request messages received from the peer.')
cdbpPeerStatsCERsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 16), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsCERsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsCERsOut.setDescription('Number of Capabilities-Exchange-Request messages sent to the peer.')
cdbpPeerStatsCEAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 17), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsCEAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsCEAsIn.setDescription('Number of Capabilities-Exchange-Answer messages received from the peer.')
cdbpPeerStatsCEAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 18), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsCEAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsCEAsOut.setDescription('Number of Capabilities-Exchange-Answer messages sent to the peer.')
cdbpPeerStatsDWRsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 19), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDWRsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDWRsIn.setDescription('Number of Device-Watchdog-Request messages received from the peer.')
cdbpPeerStatsDWRsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 20), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDWRsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDWRsOut.setDescription('Number of Device-Watchdog-Request messages sent to the peer.')
cdbpPeerStatsDWAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 21), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDWAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDWAsIn.setDescription('Number of Device-Watchdog-Answer messages received from the peer.')
cdbpPeerStatsDWAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 22), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDWAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDWAsOut.setDescription('Number of Device-Watchdog-Answer messages sent to the peer.')
cdbpPeerStatsDPRsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 23), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDPRsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDPRsIn.setDescription('Number of Disconnect-Peer-Request messages received.')
cdbpPeerStatsDPRsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 24), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDPRsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDPRsOut.setDescription('Number of Disconnect-Peer-Request messages sent.')
cdbpPeerStatsDPAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 25), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDPAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDPAsIn.setDescription('Number of Disconnect-Peer-Answer messages received.')
cdbpPeerStatsDPAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 26), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDPAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDPAsOut.setDescription('Number of Disconnect-Peer-Answer messages sent.')
cdbpPeerStatsRARsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 27), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsRARsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsRARsIn.setDescription('Number of Re-Auth-Request messages received.')
cdbpPeerStatsRARsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 28), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsRARsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsRARsOut.setDescription('Number of Re-Auth-Request messages sent.')
cdbpPeerStatsRAAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 29), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsRAAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsRAAsIn.setDescription('Number of Re-Auth-Answer messages received.')
cdbpPeerStatsRAAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 30), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsRAAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsRAAsOut.setDescription('Number of Re-Auth-Answer messages sent.')
cdbpPeerStatsSTRsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 31), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsSTRsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsSTRsIn.setDescription('Number of Session-Termination-Request messages received from the peer.')
cdbpPeerStatsSTRsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 32), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsSTRsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsSTRsOut.setDescription('Number of Session-Termination-Request messages sent to the peer.')
cdbpPeerStatsSTAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 33), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsSTAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsSTAsIn.setDescription('Number of Session-Termination-Answer messages received from the peer.')
cdbpPeerStatsSTAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 34), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsSTAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsSTAsOut.setDescription('Number of Session-Termination-Answer messages sent to the peer.')
cdbpPeerStatsDWReqTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 35), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsDWReqTimer.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsDWReqTimer.setDescription('Device-Watchdog Request Timer, which is the interval between packets sent to peers.')
cdbpPeerStatsRedirectEvents = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 36), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsRedirectEvents.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsRedirectEvents.setDescription('Redirect Event count, which is the number of redirects sent from a peer.')
cdbpPeerStatsAccDupRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 37), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsAccDupRequests.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsAccDupRequests.setDescription('The number of duplicate Diameter Accounting-Request packets received.')
cdbpPeerStatsMalformedReqsts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 38), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsMalformedReqsts.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsMalformedReqsts.setDescription('The number of malformed Diameter packets received.')
cdbpPeerStatsAccsNotRecorded = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 39), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsAccsNotRecorded.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsAccsNotRecorded.setDescription('The number of Diameter Accounting-Request packets which were received and responded to but not recorded.')
cdbpPeerStatsAccRetrans = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 40), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsAccRetrans.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsAccRetrans.setDescription('The number of Diameter Accounting-Request packets retransmitted to this Diameter server.')
cdbpPeerStatsTotalRetrans = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 41), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsTotalRetrans.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsTotalRetrans.setDescription('The number of Diameter packets retransmitted to this Diameter server, not to include Diameter Accounting-Request packets retransmitted.')
cdbpPeerStatsAccPendReqstsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 42), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsAccPendReqstsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsAccPendReqstsOut.setDescription('The number of Diameter Accounting-Request packets sent to this peer that have not yet timed out or received a response. This variable is incremented when an Accounting-Request is sent to this server and decremented due to receipt of an Accounting-Response, a timeout or a retransmission.')
cdbpPeerStatsAccReqstsDropped = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 43), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsAccReqstsDropped.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsAccReqstsDropped.setDescription('The number of Accounting-Requests to this server that have been dropped.')
cdbpPeerStatsHByHDropMessages = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 44), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsHByHDropMessages.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsHByHDropMessages.setDescription('An answer message that is received with an unknown hop-by-hop identifier. Does not include accounting requests dropped.')
cdbpPeerStatsEToEDupMessages = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 45), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsEToEDupMessages.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsEToEDupMessages.setDescription('Duplicate answer messages that are to be locally consumed. Does not include duplicate accounting requests received.')
cdbpPeerStatsUnknownTypes = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 46), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsUnknownTypes.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsUnknownTypes.setDescription('The number of Diameter packets of unknown type which were received.')
cdbpPeerStatsProtocolErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 47), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsProtocolErrors.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsProtocolErrors.setDescription('This object represents the Number of protocol errors returned to peer, but not including redirects.')
cdbpPeerStatsTransientFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 48), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsTransientFailures.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsTransientFailures.setDescription('This object represents the transient failure count.')
cdbpPeerStatsPermanentFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 49), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsPermanentFailures.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsPermanentFailures.setDescription('This object represents the Number of permanent failures returned to peer.')
cdbpPeerStatsTransportDown = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 4, 1, 1, 50), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpPeerStatsTransportDown.setStatus('current')
if mibBuilder.loadTexts: cdbpPeerStatsTransportDown.setDescription('This object represents the Number of unexpected transport failures.')
cdbpRealmKnownPeersTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 5, 1), )
if mibBuilder.loadTexts: cdbpRealmKnownPeersTable.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmKnownPeersTable.setDescription('The table listing the Diameter realms and known peers.')
cdbpRealmKnownPeersEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 5, 1, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteIndex"), (0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmKnownPeersIndex"))
if mibBuilder.loadTexts: cdbpRealmKnownPeersEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmKnownPeersEntry.setDescription('A row entry representing a Diameter realm and known peers.')
cdbpRealmKnownPeersIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 5, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpRealmKnownPeersIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmKnownPeersIndex.setDescription('A number uniquely identifying a peer known to this realm. Upon reload, cdbpRealmKnownPeersIndex values may be changed.')
cdbpRealmKnownPeers = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 5, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmKnownPeers.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmKnownPeers.setDescription('The index of the peer this realm knows about. This is an ordered list, where the ordering signifies the order in which the peers are tried. Same as the cdbpPeerIndex')
cdbpRealmKnownPeersChosen = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 5, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("roundRobin", 1), ("loadBalance", 2), ("firstPreferred", 3), ("mostRecentFirst", 4), ("other", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmKnownPeersChosen.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmKnownPeersChosen.setDescription('How the realm chooses which peer to send packets to. roundRobin(1) - The peer used for each transaction is selected based on the order in which peers are configured. loadBalance(2) - The peer used for each transaction is based on the load metric (maybe implementation dependent) of all peers defined for the realm, with the least loaded server selected first. firstPreferred(3) - The first defined server is always used for transactions unless failover occurs. mostRecentFirst(4) - The most recently used server is used first for each transaction.')
cdbpRealmMessageRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1), )
if mibBuilder.loadTexts: cdbpRealmMessageRouteTable.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteTable.setDescription('The table listing the Diameter realm-based message route information.')
cdbpRealmMessageRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1), ).setIndexNames((0, "CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteIndex"))
if mibBuilder.loadTexts: cdbpRealmMessageRouteEntry.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteEntry.setDescription('A row entry representing a Diameter realm based message route server.')
cdbpRealmMessageRouteIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: cdbpRealmMessageRouteIndex.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteIndex.setDescription('A number uniquely identifying each realm.')
cdbpRealmMessageRouteRealm = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 2), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteRealm.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteRealm.setDescription('This object represents the realm name')
cdbpRealmMessageRouteApp = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteApp.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteApp.setDescription('Application id used to route packets to this realm.')
cdbpRealmMessageRouteType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("acct", 1), ("auth", 2), ("both", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteType.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteType.setDescription('The types of service supported for each realm application: accounting, authentication or both. acct(1) - accounting auth(2) - authentication both(3) - both accounting and authentication.')
cdbpRealmMessageRouteAction = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("local", 1), ("relay", 2), ("proxy", 3), ("redirect", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteAction.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteAction.setDescription('The action is used to identify how a message should be treated based on the realm, application and type. local(1) - Diameter messages that resolve to a route entry with the Local Action set to Local can be satisfied locally, and do not need to be routed to another server. relay(2) - All Diameter messages that fall within this category MUST be routed to a next-hop server, without modifying any non-routing AVPs. proxy(3) - All Diameter messages that fall within this category MUST be routed to a next-hop server. redirect(4) - Diameter messages that fall within this category MUST have the identity of the home Diameter server(s) appended, and returned to the sender of the message.')
cdbpRealmMessageRouteACRsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 6), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteACRsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteACRsIn.setDescription('Number of Accounting-Request messages received from the realm.')
cdbpRealmMessageRouteACRsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 7), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteACRsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteACRsOut.setDescription('Number of Accounting-Request messages sent to the realm.')
cdbpRealmMessageRouteACAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 8), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteACAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteACAsIn.setDescription('Number of Accounting-Answer messages received from the realm.')
cdbpRealmMessageRouteACAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 9), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteACAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteACAsOut.setDescription('Number of Accounting-Answer messages sent to the realm.')
cdbpRealmMessageRouteRARsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 10), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteRARsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteRARsIn.setDescription('Number of Re-Auth-Request messages received from the realm.')
cdbpRealmMessageRouteRARsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 11), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteRARsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteRARsOut.setDescription('Number of Re-Auth-Request messages sent to the realm.')
cdbpRealmMessageRouteRAAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 12), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteRAAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteRAAsIn.setDescription('Number of Re-Auth-Answer messages received from the realm.')
cdbpRealmMessageRouteRAAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 13), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteRAAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteRAAsOut.setDescription('Number of Re-Auth-Answer messages sent to the realm.')
cdbpRealmMessageRouteSTRsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 14), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteSTRsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteSTRsIn.setDescription('Number of Session-Termination-Request messages received from the realm.')
cdbpRealmMessageRouteSTRsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 15), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteSTRsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteSTRsOut.setDescription('Number of Session-Termination-Request messages sent to the realm.')
cdbpRealmMessageRouteSTAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 16), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteSTAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteSTAsIn.setDescription('Number of Session-Termination-Answer messages received from the realm.')
cdbpRealmMessageRouteSTAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 17), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteSTAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteSTAsOut.setDescription('Number of Session-Termination-Answer messages sent to the realm.')
cdbpRealmMessageRouteASRsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 18), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteASRsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteASRsIn.setDescription('Number of Abort-Session-Request messages received from the realm.')
cdbpRealmMessageRouteASRsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 19), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteASRsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteASRsOut.setDescription('Number of Abort-Session-Request messages sent to the realm.')
cdbpRealmMessageRouteASAsIn = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 20), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteASAsIn.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteASAsIn.setDescription('Number of Abort-Session-Answer messages received from the realm.')
cdbpRealmMessageRouteASAsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 21), Counter32()).setUnits('messages').setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteASAsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteASAsOut.setDescription('Number of Abort-Session-Answer messages sent to the realm.')
cdbpRealmMessageRouteAccRetrans = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteAccRetrans.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteAccRetrans.setDescription('The number of Diameter accounting packets retransmitted to this realm.')
cdbpRealmMessageRouteAccDupReqsts = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteAccDupReqsts.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteAccDupReqsts.setDescription('The number of duplicate Diameter accounting packets sent to this realm.')
cdbpRealmMessageRoutePendReqstsOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 24), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRoutePendReqstsOut.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRoutePendReqstsOut.setDescription('The number of Diameter Accounting-Request packets sent to this peer that have not yet timed out or received a response. This variable is incremented when an Accounting-Request is sent to this server and decremented due to receipt of an Accounting-Response, a timeout or a retransmission.')
cdbpRealmMessageRouteReqstsDrop = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 133, 1, 6, 1, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cdbpRealmMessageRouteReqstsDrop.setStatus('current')
if mibBuilder.loadTexts: cdbpRealmMessageRouteReqstsDrop.setDescription('The number of requests dropped by this realm.')
ciscoDiameterBasePMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 1))
ciscoDiameterBasePMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2))
ciscoDiameterBasePMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 1, 1)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBLocalCfgGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBPeerCfgGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBPeerStatsGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBNotificationsGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBTrapCfgGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBLocalCfgSkippedGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBLocalStatsSkippedGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBPeerCfgSkippedGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBPeerStatsSkippedGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBRealmCfgSkippedGroup"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiameterBasePMIBRealmStatsSkippedGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBCompliance = ciscoDiameterBasePMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBCompliance.setDescription('The compliance statement for Diameter Base Protocol entities.')
ciscoDiameterBasePMIBLocalCfgGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 1)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalRealm"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRedundancyEnabled"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRedundancyInfraState"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRedundancyLastSwitchover"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalOriginHost"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalVendorId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalVendorStorageType"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalVendorRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBLocalCfgGroup = ciscoDiameterBasePMIBLocalCfgGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBLocalCfgGroup.setDescription('A collection of objects providing configuration common to the server.')
ciscoDiameterBasePMIBPeerCfgGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 2)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerPortConnect"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerPortListen"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerProtocol"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerSecurity"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerFirmwareRevision"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStorageType"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerRowStatus"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIpAddressType"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerIpAddress"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerVendorId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerVendorStorageType"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerVendorRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBPeerCfgGroup = ciscoDiameterBasePMIBPeerCfgGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBPeerCfgGroup.setDescription('A collection of objects providing configuration of the Diameter peers.')
ciscoDiameterBasePMIBPeerStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 3)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsState"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsStateDuration"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsLastDiscCause"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsWhoInitDisconnect"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDWCurrentStatus"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsTimeoutConnAtmpts"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsASRsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsASRsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsASAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsASAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsACRsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsACRsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsACAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsACAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsCERsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsCERsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsCEAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsCEAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDWRsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDWRsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDWAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDWAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDPRsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDPRsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDPAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDPAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsRARsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsRARsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsRAAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsRAAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsSTRsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsSTRsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsSTAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsSTAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDWReqTimer"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsRedirectEvents"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsAccDupRequests"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsMalformedReqsts"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsAccsNotRecorded"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsAccRetrans"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsTotalRetrans"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsAccPendReqstsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsAccReqstsDropped"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsHByHDropMessages"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsEToEDupMessages"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsUnknownTypes"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsProtocolErrors"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsTransientFailures"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsPermanentFailures"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsTransportDown"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBPeerStatsGroup = ciscoDiameterBasePMIBPeerStatsGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBPeerStatsGroup.setDescription('A collection of objects providing statistics of the Diameter peers.')
ciscoDiameterBasePMIBNotificationsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 4)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtProtocolErrorNotif"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtTransientFailureNotif"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtPermanentFailureNotif"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtPeerConnectionDownNotif"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtPeerConnectionUpNotif"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBNotificationsGroup = ciscoDiameterBasePMIBNotificationsGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBNotificationsGroup.setDescription('The set of notifications which an agent is required to implement.')
ciscoDiameterBasePMIBTrapCfgGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 5)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtEnableProtocolErrorNotif"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtEnableTransientFailureNotif"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtEnablePermanentFailureNotif"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtEnablePeerConnectionDownNotif"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "ciscoDiaBaseProtEnablePeerConnectionUpNotif"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBTrapCfgGroup = ciscoDiameterBasePMIBTrapCfgGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBTrapCfgGroup.setDescription('A collection of objects providing configuration for base protocol notifications.')
ciscoDiameterBasePMIBLocalCfgSkippedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 6)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalId"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalIpAddrType"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalIpAddress"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalTcpListenPort"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalSctpListenPort"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalStatsTotalPacketsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalStatsTotalPacketsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalStatsTotalUpTime"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalResetTime"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalConfigReset"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalApplStorageType"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalApplRowStatus"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpAppAdvToPeerServices"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpAppAdvToPeerStorageType"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpAppAdvToPeerRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBLocalCfgSkippedGroup = ciscoDiameterBasePMIBLocalCfgSkippedGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBLocalCfgSkippedGroup.setDescription('A collection of objects providing configuration common to the server.')
ciscoDiameterBasePMIBLocalStatsSkippedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 7)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalStatsTotalPacketsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalStatsTotalPacketsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalStatsTotalUpTime"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalResetTime"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpLocalConfigReset"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBLocalStatsSkippedGroup = ciscoDiameterBasePMIBLocalStatsSkippedGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBLocalStatsSkippedGroup.setDescription('A collection of objects providing statistics common to the server.')
ciscoDiameterBasePMIBPeerCfgSkippedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 8)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpAppAdvFromPeerType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBPeerCfgSkippedGroup = ciscoDiameterBasePMIBPeerCfgSkippedGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBPeerCfgSkippedGroup.setDescription('A collection of objects providing configuration for Diameter peers.')
ciscoDiameterBasePMIBPeerStatsSkippedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 9)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDWCurrentStatus"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsDWReqTimer"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsRedirectEvents"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsAccDupRequests"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpPeerStatsEToEDupMessages"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBPeerStatsSkippedGroup = ciscoDiameterBasePMIBPeerStatsSkippedGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBPeerStatsSkippedGroup.setDescription('A collection of objects providing statistics of Diameter peers.')
ciscoDiameterBasePMIBRealmCfgSkippedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 10)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmKnownPeers"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmKnownPeersChosen"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBRealmCfgSkippedGroup = ciscoDiameterBasePMIBRealmCfgSkippedGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBRealmCfgSkippedGroup.setDescription('A collection of objects providing configuration for realm message routing.')
ciscoDiameterBasePMIBRealmStatsSkippedGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 133, 2, 2, 11)).setObjects(("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteRealm"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteApp"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteType"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteAction"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteACRsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteACRsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteACAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteACAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteRARsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteRARsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteRAAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteRAAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteSTRsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteSTRsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteSTAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteSTAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteASRsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteASRsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteASAsIn"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteASAsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteAccRetrans"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteAccDupReqsts"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRoutePendReqstsOut"), ("CISCO-DIAMETER-BASE-PROTOCOL-MIB", "cdbpRealmMessageRouteReqstsDrop"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDiameterBasePMIBRealmStatsSkippedGroup = ciscoDiameterBasePMIBRealmStatsSkippedGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDiameterBasePMIBRealmStatsSkippedGroup.setDescription('A collection of objects providing statistics of realm message routing.')
mibBuilder.exportSymbols("CISCO-DIAMETER-BASE-PROTOCOL-MIB", cdbpRealmMessageRouteACRsIn=cdbpRealmMessageRouteACRsIn, cdbpRealmStats=cdbpRealmStats, ciscoDiameterBasePMIBCompliance=ciscoDiameterBasePMIBCompliance, cdbpPeerStatsSTAsOut=cdbpPeerStatsSTAsOut, cdbpPeerProtocol=cdbpPeerProtocol, cdbpPeerTable=cdbpPeerTable, ciscoDiaBaseProtPeerConnectionDownNotif=ciscoDiaBaseProtPeerConnectionDownNotif, cdbpLocalVendorIndex=cdbpLocalVendorIndex, cdbpPeerStatsDWReqTimer=cdbpPeerStatsDWReqTimer, cdbpPeerStatsACAsIn=cdbpPeerStatsACAsIn, cdbpPeerStatsDWRsOut=cdbpPeerStatsDWRsOut, ciscoDiaBaseProtEnablePeerConnectionDownNotif=ciscoDiaBaseProtEnablePeerConnectionDownNotif, cdbpPeerStatsDPAsIn=cdbpPeerStatsDPAsIn, cdbpPeerId=cdbpPeerId, cdbpAppAdvFromPeerTable=cdbpAppAdvFromPeerTable, cdbpRealmMessageRouteSTRsIn=cdbpRealmMessageRouteSTRsIn, cdbpRealmMessageRouteApp=cdbpRealmMessageRouteApp, cdbpLocalVendorEntry=cdbpLocalVendorEntry, cdbpRealmMessageRouteAccDupReqsts=cdbpRealmMessageRouteAccDupReqsts, cdbpAppAdvToPeerVendorId=cdbpAppAdvToPeerVendorId, cdbpLocalIpAddrType=cdbpLocalIpAddrType, cdbpPeerSecurity=cdbpPeerSecurity, ciscoDiaBaseProtTransientFailureNotif=ciscoDiaBaseProtTransientFailureNotif, cdbpPeerStatsAccPendReqstsOut=cdbpPeerStatsAccPendReqstsOut, ciscoDiameterBasePMIBLocalCfgGroup=ciscoDiameterBasePMIBLocalCfgGroup, cdbpRealmMessageRouteRealm=cdbpRealmMessageRouteRealm, cdbpPeerEntry=cdbpPeerEntry, cdbpRedundancyLastSwitchover=cdbpRedundancyLastSwitchover, cdbpRealmMessageRouteAction=cdbpRealmMessageRouteAction, cdbpPeerIpAddrTable=cdbpPeerIpAddrTable, cdbpPeerStatsSTAsIn=cdbpPeerStatsSTAsIn, cdbpRealmCfgs=cdbpRealmCfgs, cdbpPeerStatsTransientFailures=cdbpPeerStatsTransientFailures, cdbpRealmKnownPeersIndex=cdbpRealmKnownPeersIndex, cdbpLocalVendorTable=cdbpLocalVendorTable, cdbpPeerStorageType=cdbpPeerStorageType, cdbpAppAdvFromPeerVendorId=cdbpAppAdvFromPeerVendorId, cdbpPeerStatsRAAsOut=cdbpPeerStatsRAAsOut, cdbpLocalId=cdbpLocalId, ciscoDiameterBasePMIBNotifs=ciscoDiameterBasePMIBNotifs, ciscoDiameterBasePMIBGroups=ciscoDiameterBasePMIBGroups, cdbpPeerStats=cdbpPeerStats, cdbpRealmMessageRouteASRsOut=cdbpRealmMessageRouteASRsOut, cdbpRealmMessageRouteAccRetrans=cdbpRealmMessageRouteAccRetrans, cdbpAppAdvToPeerServices=cdbpAppAdvToPeerServices, cdbpPeerStatsACRsOut=cdbpPeerStatsACRsOut, cdbpRedundancyEnabled=cdbpRedundancyEnabled, cdbpPeerVendorRowStatus=cdbpPeerVendorRowStatus, cdbpPeerStatsUnknownTypes=cdbpPeerStatsUnknownTypes, ciscoDiameterBasePMIBCompliances=ciscoDiameterBasePMIBCompliances, cdbpPeerStatsEToEDupMessages=cdbpPeerStatsEToEDupMessages, cdbpPeerVendorEntry=cdbpPeerVendorEntry, ciscoDiaBaseProtEnableProtocolErrorNotif=ciscoDiaBaseProtEnableProtocolErrorNotif, cdbpPeerStatsTable=cdbpPeerStatsTable, cdbpPeerIpAddrEntry=cdbpPeerIpAddrEntry, ciscoDiameterBasePMIBConform=ciscoDiameterBasePMIBConform, cdbpPeerStatsSTRsOut=cdbpPeerStatsSTRsOut, cdbpRealmMessageRouteIndex=cdbpRealmMessageRouteIndex, cdbpAppAdvToPeerIndex=cdbpAppAdvToPeerIndex, ciscoDiameterBasePMIBPeerStatsGroup=ciscoDiameterBasePMIBPeerStatsGroup, ciscoDiaBaseProtEnablePeerConnectionUpNotif=ciscoDiaBaseProtEnablePeerConnectionUpNotif, cdbpLocalApplRowStatus=cdbpLocalApplRowStatus, ciscoDiaBaseProtEnablePermanentFailureNotif=ciscoDiaBaseProtEnablePermanentFailureNotif, ciscoDiameterBasePMIBPeerStatsSkippedGroup=ciscoDiameterBasePMIBPeerStatsSkippedGroup, PYSNMP_MODULE_ID=ciscoDiameterBasePMIB, ciscoDiameterBasePMIBObjects=ciscoDiameterBasePMIBObjects, cdbpLocalRealm=cdbpLocalRealm, cdbpLocalVendorId=cdbpLocalVendorId, cdbpLocalResetTime=cdbpLocalResetTime, ciscoDiameterBasePMIBRealmCfgSkippedGroup=ciscoDiameterBasePMIBRealmCfgSkippedGroup, cdbpPeerStatsDPRsIn=cdbpPeerStatsDPRsIn, cdbpPeerStatsEntry=cdbpPeerStatsEntry, cdbpPeerStatsAccDupRequests=cdbpPeerStatsAccDupRequests, cdbpRealmMessageRoutePendReqstsOut=cdbpRealmMessageRoutePendReqstsOut, cdbpTrapCfgs=cdbpTrapCfgs, ciscoDiameterBasePMIBTrapCfgGroup=ciscoDiameterBasePMIBTrapCfgGroup, cdbpAppAdvFromPeerType=cdbpAppAdvFromPeerType, cdbpPeerIndex=cdbpPeerIndex, cdbpPeerVendorId=cdbpPeerVendorId, cdbpAppAdvToPeerRowStatus=cdbpAppAdvToPeerRowStatus, cdbpLocalStatsTotalPacketsOut=cdbpLocalStatsTotalPacketsOut, cdbpPeerStatsHByHDropMessages=cdbpPeerStatsHByHDropMessages, cdbpRealmMessageRouteASAsIn=cdbpRealmMessageRouteASAsIn, cdbpLocalStats=cdbpLocalStats, cdbpPeerStatsRedirectEvents=cdbpPeerStatsRedirectEvents, cdbpPeerStatsASRsOut=cdbpPeerStatsASRsOut, cdbpPeerStatsTotalRetrans=cdbpPeerStatsTotalRetrans, cdbpRealmMessageRouteEntry=cdbpRealmMessageRouteEntry, cdbpPeerStatsState=cdbpPeerStatsState, cdbpPeerStatsSTRsIn=cdbpPeerStatsSTRsIn, cdbpPeerFirmwareRevision=cdbpPeerFirmwareRevision, cdbpLocalTcpListenPort=cdbpLocalTcpListenPort, cdbpPeerStatsCERsOut=cdbpPeerStatsCERsOut, cdbpLocalApplStorageType=cdbpLocalApplStorageType, cdbpPeerStatsAccRetrans=cdbpPeerStatsAccRetrans, cdbpPeerStatsPermanentFailures=cdbpPeerStatsPermanentFailures, cdbpLocalIpAddrIndex=cdbpLocalIpAddrIndex, cdbpRealmKnownPeersEntry=cdbpRealmKnownPeersEntry, cdbpPeerStatsDWAsIn=cdbpPeerStatsDWAsIn, cdbpLocalStatsTotalUpTime=cdbpLocalStatsTotalUpTime, cdbpPeerStatsDPAsOut=cdbpPeerStatsDPAsOut, ciscoDiaBaseProtPermanentFailureNotif=ciscoDiaBaseProtPermanentFailureNotif, ciscoDiameterBasePMIBLocalStatsSkippedGroup=ciscoDiameterBasePMIBLocalStatsSkippedGroup, cdbpPeerStatsRAAsIn=cdbpPeerStatsRAAsIn, cdbpPeerStatsStateDuration=cdbpPeerStatsStateDuration, cdbpPeerStatsProtocolErrors=cdbpPeerStatsProtocolErrors, ciscoDiameterBasePMIBNotificationsGroup=ciscoDiameterBasePMIBNotificationsGroup, cdbpRealmMessageRouteACRsOut=cdbpRealmMessageRouteACRsOut, cdbpLocalApplEntry=cdbpLocalApplEntry, cdbpPeerStatsDWAsOut=cdbpPeerStatsDWAsOut, cdbpPeerStatsAccReqstsDropped=cdbpPeerStatsAccReqstsDropped, cdbpRealmKnownPeersTable=cdbpRealmKnownPeersTable, cdbpPeerStatsAccsNotRecorded=cdbpPeerStatsAccsNotRecorded, cdbpLocalVendorRowStatus=cdbpLocalVendorRowStatus, cdbpLocalIpAddress=cdbpLocalIpAddress, cdbpLocalIpAddrEntry=cdbpLocalIpAddrEntry, cdbpRealmMessageRouteRARsIn=cdbpRealmMessageRouteRARsIn, cdbpRealmMessageRouteACAsIn=cdbpRealmMessageRouteACAsIn, cdbpLocalOriginHost=cdbpLocalOriginHost, cdbpRealmMessageRouteRAAsIn=cdbpRealmMessageRouteRAAsIn, cdbpRealmMessageRouteRAAsOut=cdbpRealmMessageRouteRAAsOut, ciscoDiameterBasePMIBPeerCfgSkippedGroup=ciscoDiameterBasePMIBPeerCfgSkippedGroup, cdbpPeerPortConnect=cdbpPeerPortConnect, cdbpPeerStatsWhoInitDisconnect=cdbpPeerStatsWhoInitDisconnect, cdbpPeerStatsCEAsOut=cdbpPeerStatsCEAsOut, cdbpAppAdvFromPeerIndex=cdbpAppAdvFromPeerIndex, cdbpRealmMessageRouteASRsIn=cdbpRealmMessageRouteASRsIn, cdbpPeerStatsLastDiscCause=cdbpPeerStatsLastDiscCause, cdbpPeerStatsASAsIn=cdbpPeerStatsASAsIn, cdbpPeerIpAddressType=cdbpPeerIpAddressType, cdbpPeerStatsRARsOut=cdbpPeerStatsRARsOut, cdbpPeerStatsDWCurrentStatus=cdbpPeerStatsDWCurrentStatus, cdbpRealmMessageRouteSTRsOut=cdbpRealmMessageRouteSTRsOut, cdbpLocalCfgs=cdbpLocalCfgs, cdbpRealmMessageRouteReqstsDrop=cdbpRealmMessageRouteReqstsDrop, cdbpLocalStatsTotalPacketsIn=cdbpLocalStatsTotalPacketsIn, cdbpPeerCfgs=cdbpPeerCfgs, cdbpRealmKnownPeers=cdbpRealmKnownPeers, cdbpPeerStatsMalformedReqsts=cdbpPeerStatsMalformedReqsts, cdbpRealmMessageRouteRARsOut=cdbpRealmMessageRouteRARsOut, cdbpRealmMessageRouteSTAsOut=cdbpRealmMessageRouteSTAsOut, cdbpLocalIpAddrTable=cdbpLocalIpAddrTable, cdbpPeerStatsACRsIn=cdbpPeerStatsACRsIn, ciscoDiameterBasePMIBRealmStatsSkippedGroup=ciscoDiameterBasePMIBRealmStatsSkippedGroup, cdbpRealmKnownPeersChosen=cdbpRealmKnownPeersChosen, cdbpLocalApplTable=cdbpLocalApplTable, cdbpRealmMessageRouteType=cdbpRealmMessageRouteType, cdbpPeerStatsASRsIn=cdbpPeerStatsASRsIn, cdbpPeerStatsTransportDown=cdbpPeerStatsTransportDown, cdbpRedundancyInfraState=cdbpRedundancyInfraState, ciscoDiameterBasePMIBPeerCfgGroup=ciscoDiameterBasePMIBPeerCfgGroup, cdbpRealmMessageRouteACAsOut=cdbpRealmMessageRouteACAsOut, cdbpAppAdvFromPeerEntry=cdbpAppAdvFromPeerEntry, ciscoDiaBaseProtEnableTransientFailureNotif=ciscoDiaBaseProtEnableTransientFailureNotif, cdbpLocalConfigReset=cdbpLocalConfigReset, cdbpPeerIpAddress=cdbpPeerIpAddress, cdbpAppAdvToPeerTable=cdbpAppAdvToPeerTable, cdbpPeerStatsTimeoutConnAtmpts=cdbpPeerStatsTimeoutConnAtmpts, cdbpPeerStatsDWRsIn=cdbpPeerStatsDWRsIn, cdbpRealmMessageRouteTable=cdbpRealmMessageRouteTable, cdbpPeerStatsRARsIn=cdbpPeerStatsRARsIn, cdbpPeerStatsACAsOut=cdbpPeerStatsACAsOut, cdbpRealmMessageRouteSTAsIn=cdbpRealmMessageRouteSTAsIn, cdbpPeerStatsASAsOut=cdbpPeerStatsASAsOut, cdbpPeerStatsDPRsOut=cdbpPeerStatsDPRsOut, cdbpPeerVendorTable=cdbpPeerVendorTable, ciscoDiaBaseProtPeerConnectionUpNotif=ciscoDiaBaseProtPeerConnectionUpNotif, cdbpPeerVendorStorageType=cdbpPeerVendorStorageType, cdbpPeerVendorIndex=cdbpPeerVendorIndex, cdbpPeerStatsCERsIn=cdbpPeerStatsCERsIn, cdbpRealmMessageRouteASAsOut=cdbpRealmMessageRouteASAsOut, ciscoDiameterBasePMIBLocalCfgSkippedGroup=ciscoDiameterBasePMIBLocalCfgSkippedGroup, cdbpPeerPortListen=cdbpPeerPortListen, cdbpAppAdvToPeerEntry=cdbpAppAdvToPeerEntry, ciscoDiaBaseProtProtocolErrorNotif=ciscoDiaBaseProtProtocolErrorNotif, ciscoDiameterBasePMIB=ciscoDiameterBasePMIB, cdbpLocalApplIndex=cdbpLocalApplIndex, cdbpAppAdvToPeerStorageType=cdbpAppAdvToPeerStorageType, cdbpLocalVendorStorageType=cdbpLocalVendorStorageType, cdbpPeerIpAddressIndex=cdbpPeerIpAddressIndex, cdbpPeerRowStatus=cdbpPeerRowStatus, cdbpLocalSctpListenPort=cdbpLocalSctpListenPort, cdbpPeerStatsCEAsIn=cdbpPeerStatsCEAsIn)
|
# problem 29
# Distinct powers
"""
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2**2=4, 2**3=8, 2**4=16, 2**5=32
3**2=9, 3**3=27, 3**4=81, 3**5=243
4**2=16, 4**3=64, 4**4=256, 4**5=1024
5**2=25, 5**3=125, 5**4=625, 5**5=3125
If they are then placed in numerical order, with any repeats removed,
we get the following sequence of 15 distinct terms:
4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125
How many distinct terms are in the sequence generated by ab for
2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?
"""
# analysis
"""
^ | 2 | 3 | 4 | 5 | N |
---+---+---+---+----+---+
2 | 4 | 8 | 16| 25 |2^N|
---+---+---+---+----+---+
3 | 9 | 27| 81| 243|3^N|
---+---+---+---+----+---+
4 | 16| 64|256|1024|4^N|
---+---+---+---+----+---+
5 | 25|125|625|3125|5^N|
---+---+---+---+----+---+
"""
# solution
s = set(a**b for a in range(2, 101) for b in range(2, 101))
print(len(s))
|
cantidad= input("Cuantas personas van a cenar?")
cant = int(cantidad)
print(cant)
if cant > 8:
print("Lo siento, tendran que esperar")
else:
print("La mesa esta lista")
|
def parse_cookie(query: str) -> dict:
res = {}
if query:
data = query.split(';')
for i in data:
if '=' in i:
res[i.split('=')[0]] = '='.join(i.split('=')[1:])
return res
if __name__ == '__main__':
assert parse_cookie('name=Dima;') == {'name': 'Dima'}
assert parse_cookie('') == {}
assert parse_cookie('name=Dima;age=28;') == {'name': 'Dima', 'age': '28'}
assert parse_cookie('name=Dima=User;age=28;') == {'name': 'Dima=User', 'age': '28'}
|
dbConfig = {
"user": "root",
"password": "123567l098",
"host": "localhost",
"database": "trackMe_dev"
} |
def pol_V(offset=None):
yield from mv(m1_simple_fbk,0)
cur_mono_e = pgm.en.user_readback.value
yield from mv(epu1.table,6) # 4 = 3rd harmonic; 6 = "testing V" 1st harmonic
if offset is not None:
yield from mv(epu1.offset,offset)
yield from mv(epu1.phase,28.5)
yield from mv(pgm.en,cur_mono_e+1) #TODO this is dirty trick. figure out how to process epu.table.input
yield from mv(pgm.en,cur_mono_e)
yield from mv(m1_simple_fbk,1)
print('\nFinished moving the polarization to vertical.\n\tNote that the offset for epu calibration is {}eV.\n\n'.format(offset))
def pol_H(offset=None):
yield from mv(m1_simple_fbk,0)
cur_mono_e = pgm.en.user_readback.value
yield from mv(epu1.table,5) # 2 = 3rd harmonic; 5 = "testing H" 1st harmonic
if offset is not None:
yield from mv(epu1.offset,offset)
yield from mv(epu1.phase,0)
yield from mv(pgm.en,cur_mono_e+1) #TODO this is dirty trick. figure out how to process epu.table.input
yield from mv(pgm.en,cur_mono_e)
yield from mv(m1_simple_fbk,1)
print('\nFinished moving the polarization to horizontal.\n\tNote that the offset for epu calibration is {}eV.\n\n'.format(offset))
def m3_check():
yield from mv(m3_simple_fbk,0)
sclr_enable()
if pzshutter.value == 0:
print('Piezo Shutter is disabled')
flag = 0
if pzshutter.value == 2:
print('Piezo Shutter is enabled: going to be disabled')
yield from pzshutter_disable()
flag = 1
temp_extslt_vg=extslt.vg.user_readback.value
temp_extslt_hg=extslt.hg.user_readback.value
temp_gcdiag = gcdiag.y.user_readback.value
#yield from mv(qem07.averaging_time, 1)
yield from mv(sclr.preset_time, 1)
yield from mv(extslt.hg,10)
yield from mv(extslt.vg,30)
#yield from gcdiag.grid # RE-COMMENT THIS LINE 5/7/2019
#yield from rel_scan([qem07],m3.pit,-0.0005,0.0005,31, md = {'reason':'checking m3 before cff'})
yield from rel_scan([sclr],m3.pit,-0.0005,0.0005,31, md = {'reason':'checking m3'})
#yield from mv(m3.pit,peaks['cen']['gc_diag_grid'])
yield from mv(m3.pit,peaks['cen']['sclr_channels_chan8'])
#yield from mv(m3.pit,peaks['cen']['sclr_channels_chan2'])
yield from mv(extslt.hg,temp_extslt_hg)
yield from mv(extslt.vg,temp_extslt_vg)
yield from mv(gcdiag.y,temp_gcdiag)
yield from sleep(20)
#yield from mv(m1_fbk_sp,extslt_cam.stats1.centroid.x.value)
yield from mv(m3_simple_fbk_target,extslt_cam.stats1.centroid.x.value)#m3_simple_fbk_cen.value)
yield from mv(m3_simple_fbk,1)
if flag == 0:
print('Piezo Shutter remains disabled')
if flag == 1:
print('Piezo Shutter is going to renabled')
yield from pzshutter_enable()
def m1_align_fine2():
m1x_init=m1.x.user_readback.value
m1pit_init=m1.pit.user_readback.value
m1pit_step=50
m1pit_start=m1pit_init-1*m1pit_step
for i in range(0,5):
yield from mv(m1.pit,m1pit_start+i*m1pit_step)
yield from scan([qem05],m1.x,-3,3.8,35)
yield from mv(m1.pit,m1pit_init)
yield from mv(m1.x,m1x_init)
def alignM3x():
# get the exit slit positions to return to at the end
vg_init = extslt.vg.user_setpoint.value
hg_init = extslt.hg.user_setpoint.value
hc_init = extslt.hc.user_setpoint.value
print('Saving exit slit positions for later')
# get things out of the way
yield from m3diag.out
# read gas cell diode
yield from gcdiag.grid
# set detector e.g. gas cell diagnostics qem
detList=[qem07] #[sclr]
# set V exit slit value to get enough signal
yield from mv(extslt.vg, 30)
# open H slit full open
yield from mv(extslt.hg, 9000)
#move extslt.hs appropriately and scan m3.x
yield from mv(extslt.hc,-9)
yield from relative_scan(detList,m3.x,-6,6,61)
yield from mv(extslt.hc,-3)
yield from relative_scan(detList,m3.x,-6,6,61)
yield from mv(extslt.hc,3)
yield from relative_scan(detList,m3.x,-6,6,61)
print('Returning exit slit positions to the inital values')
yield from mv(extslt.hc,hc_init)
yield from mv(extslt.vg, vg_init, extslt.hg, hg_init)
def beamline_align():
yield from mv(m1_fbk,0)
yield from align.m1pit
yield from sleep(5)
yield from m3_check()
#yield from mv(m1_fbk_cam_time,0.002)
#yield from mv(m1_fbk_th,1500)
yield from sleep(5)
yield from mv(m1_fbk_sp,extslt_cam.stats1.centroid.x.value)
yield from mv(m1_fbk,1)
def beamline_align_v2():
yield from mv(m1_simple_fbk,0)
yield from mv(m3_simple_fbk,0)
yield from mv(m1_fbk,0)
yield from align.m1pit
yield from sleep(5)
yield from mv(m1_simple_fbk_target_ratio,m1_simple_fbk_ratio.value)
yield from mv(m1_simple_fbk,1)
yield from sleep(5)
yield from m3_check()
def xas(dets,motor,start_en,stop_en,num_points,sec_per_point):
sclr_enable()
sclr_set_time=sclr.preset_time.value
if pzshutter.value == 0:
print('Piezo Shutter is disabled')
flag = 0
if pzshutter.value == 2:
print('Piezo Shutter is enabled: going to be disabled')
yield from pzshutter_disable()
flag = 1
yield from mv(sclr.preset_time,sec_per_point)
yield from scan(dets,pgm.en,start_en,stop_en,num_points)
E_max = peaks['max']['sclr_channels_chan2'][0]
E_com = peaks['com']['sclr_channels_chan2']
if flag == 0:
print('Piezo Shutter remains disabled')
if flag == 1:
print('Piezo Shutter is going to renabled')
yield from pzshutter_enable()
yield from mv(sclr.preset_time,sclr_set_time)
return E_com, E_max
#TODO put this inside of rixscam
def rixscam_get_threshold(Ei = None):
'''Calculate the minimum and maximum threshold for RIXSCAM single photon counting (LS mode)
Ei\t:\t float - incident energy (default is beamline current energy)
'''
if Ei is None:
Ei = pgm.en.user_readback.value
t_min = 0.7987 * Ei - 97.964
t_max = 1.4907 * Ei + 38.249
print('\n\n\tMinimum value for RIXSCAM threshold (LS mode):\t{}'.format(t_min))
print('\tMaximum value for RIXSCAM threshold (LS mode):\t{}'.format(t_max))
print('\tFor Beamline Energy:\t\t\t\t{}'.format(Ei))
return t_min, t_max
#TODO put this insdie of rixscam
def rixscam_set_threshold(Ei=None):
'''Setup the RIXSCAM.XIP plugin values for a specific energy for single photon counting and
centroiding in LS mode.
Ei\t:\t float - incident energy (default is beamline current energy)
'''
if Ei is None:
Ei = pgm.en.user_readback.value
thold_min, thold_max = rixscam_get_threshold(Ei)
yield from mv(rixscam.xip.beamline_energy, Ei,
rixscam.xip.sum_3x3_threshold_min, thold_min,
rixscam.xip.sum_3x3_threshold_max, thold_max)
#TODO make official so that there is a m1_fbk device like m1fbk.setpoint
m1_fbk = EpicsSignal('XF:02IDA-OP{FBck}Sts:FB-Sel', name = 'm1_fbk')
m1_fbk_sp = EpicsSignal('XF:02IDA-OP{FBck}PID-SP', name = 'm1_fbk_sp')
m1_fbk_th = extslt_cam.stats1.centroid_threshold
#m1_fbk_pix_x = extslt_cam.stats1.centroid.x.value
m1_fbk_cam_time = extslt_cam.cam.acquire_time
#(mv(m1_fbk_th,1500)
m1_simple_fbk = EpicsSignal('XF:02IDA-OP{M1_simp_feed}FB-Ena', name = 'm1_simple_fbk')
m1_simple_fbk_target_ratio = EpicsSignal('XF:02IDA-OP{M1_simp_feed}FB-TarRat', name = 'm1_simple_fbk_target_ratio')
m1_simple_fbk_ratio = EpicsSignal('XF:02IDA-OP{M1_simp_feed}FB-Ratio', name = 'm1_simple_fbk_ratio')
m3_simple_fbk = EpicsSignal('XF:02IDA-OP{M3_simp_feed}FB-Ena', name = 'm3_simple_fbk')
m3_simple_fbk_target = EpicsSignal('XF:02IDA-OP{M3_simp_feed}FB-Targ', name = 'm3_simple_fbk_target')
m3_simple_fbk_cen = EpicsSignal('XF:02IDA-OP{M3_simp_feed}FB_inpbuf', name = 'm3_simple_fbk_cen')
|
COGNITO = "Cognito"
SERVERLESS_REPO = "ServerlessRepo"
MODE = "Mode"
XRAY = "XRay"
LAYERS = "Layers"
HTTP_API = "HttpApi"
IOT = "IoT"
CODE_DEPLOY = "CodeDeploy"
ARM = "ARM"
GATEWAY_RESPONSES = "GatewayResponses"
MSK = "MSK"
KMS = "KMS"
CWE_CWS_DLQ = "CweCwsDlq"
CODE_SIGN = "CodeSign"
MQ = "MQ"
USAGE_PLANS = "UsagePlans"
SCHEDULE_EVENT = "ScheduleEvent"
DYNAMO_DB = "DynamoDB"
KINESIS = "Kinesis"
SNS = "SNS"
SQS = "SQS"
CUSTOM_DOMAIN = "CustomDomain"
|
EDGE = '101'
MIDDLE = '01010'
CODES = {
'A': (
'0001101', '0011001', '0010011', '0111101', '0100011', '0110001',
'0101111', '0111011', '0110111', '0001011'
),
'B': (
'0100111', '0110011', '0011011', '0100001', '0011101', '0111001',
'0000101', '0010001', '0001001', '0010111'
),
'C': (
'1110010', '1100110', '1101100', '1000010', '1011100', '1001110',
'1010000', '1000100', '1001000', '1110100'
),
}
LEFT_PATTERN = (
'AAAAAA', 'AABABB', 'AABBAB', 'AABBBA', 'ABAABB', 'ABBAAB', 'ABBBAA',
'ABABAB', 'ABABBA', 'ABBABA'
)
|
# List Comprehensions
#########################
### Basic List Comprehensions
#########################
# allow us to circumvent constructing lists with for loops
l = [] # The Old Way
for n in range(12):
l.append(n**2)
[n ** 2 for n in range(12)] # Comprehension way
# General Syntax:
# [ `expr` for `var` in `iterable` ]
### Multiple iteration --- use tuples!
[(i, j) for i in range(2) for j in range(3)]
### Conditionals on the Iterator
[i for i in range(20) if i % 3 > 0] #S={i|0<=i<20, 3!|i, i∈I}
l = [] # equivalent old-school construction:
for val in range(20):
if val % 3:
l.append(val)
### Conditionals on the Value
# C code :: single-line conditional operator ?
# int absval = (val < 0) ? -val : val
# Python code :: single-line conditional operator if-else
val = -10
val if val >= 0 else -val
# if 3 !| val -> val in list.
# if 2 | val -> -val.
[val if val % 2 else -val
for val in range(20) if val % 3]
#########################
### Other comprehensions
#########################
{ n**2 for n in range(12) } # Set comprehension
{ n:n**2 for n in range(12) } # Dict comprehension
{ a % 3 for a in range(1000) } # a = {0, 1, 2}
# GENERATOR EXPRESSION ---- see next chapter for deets
( n**2 for n in range(12) ) |
class network_x_utils:
"""
This class provides commonly used utils which are shared between all different types
of NetworkX nodes (Feed Items, Solutions, Myths). For each of these, we want to be
able to pull basic information like the IRI, Descriptions, Images, etc.
Include any generalized NetworkX functions here.
"""
def __init__(self):
self.node = None # Current node
def set_current_node(self, node):
"""We usually pull multiple node related items simultaneously. Rather
than pass these in individually for each function, this let's us use the same
node for all of the functions in this class.
"""
self.node = node
def get_node_id(self):
"""Node IDs are the unique identifier in the IRI. This is provided to the
front-end as a reference for the feed, but is never shown to the user.
Example http://webprotege.stanford.edu/R8znJBKduM7l8XDXMalSWSl
"""
offset = 4 # .edu <- to skip these characters and get the unique IRI
full_iri = self.node["iri"]
pos = full_iri.find("edu") + offset
return full_iri[pos:]
def get_description(self):
"""Long Descriptions are used by the front-end to display explanations of the
climate effects shown in user feeds.
"""
try:
return self.node["properties"]["schema_longDescription"][0]
except:
return "No long desc available at present"
def get_short_description(self):
"""Short Descriptions are used by the front-end to display explanations of the
climate effects shown in user feeds.
"""
try:
return self.node["properties"]["schema_shortDescription"][0]
except:
return "No short desc available at present"
def get_image_url(self):
"""Images are displayed to the user in the climate feed to accompany an explanation
of the climate effects. The front-end is provided with the URL and then requests
these images from our server.
"""
try:
return self.node["properties"]["schema_image"][0]
except:
# Default image url if image is added
return "https://yaleclimateconnections.org/wp-content/uploads/2018/04/041718_child_factories.jpg"
def get_image_url_or_none(self):
"""Images are displayed to the user in the climate feed to accompany an explanation
of the climate effects. The front-end is provided with the URL and then requests
these images from our server.
"""
try:
return self.node["properties"]["schema_image"][0]
except:
# Default image url if image is added
return None
def get_causal_sources(self):
"""Sources are displayed to the user in the sources tab of the impacts overlay page.
This function returns a list of urls of the sources to show on the impact overlay page for an impact/effect.
Importantly, these sources aren't directly from the networkx node, but all the networkx edges that cause the node.
Only returns edges that are directly tied to the node (ancestor edge sources are not used)
"""
if "causal sources" in self.node and len(self.node["causal sources"]) > 0:
causal_sources = self.node["causal sources"]
try:
return causal_sources
except:
return (
[]
) # Default source if none #should this be the IPCC? or the US National Climate Assessment?
def get_solution_sources(self):
"""Returns a flattened list of custom solution source values from each node key that matches
custom_source_types string.
"""
try:
return self.node["solution sources"]
except:
return []
def get_is_possibly_local(self, node):
"""Returns whether it's possible that a node effects a particular user based on
their location. Note that here we need to pass in the node directly, rather than
using one set by the class as the node comes from the localised_acyclic_graph.py
rather than a the standard graph.
"""
if "isPossiblyLocal" in node:
if node["isPossiblyLocal"]:
return 1
else:
return 0
else:
return 0
def get_co2_eq_reduced(self):
"""
Returns the solution's CO2 Equivalent Reduced / Sequestered (2020–2050) in Gigatons.
Values taken from Project Drawdown scenario 2.
"""
if "CO2_eq_reduced" in self.node["data_properties"]:
return self.node["data_properties"]["CO2_eq_reduced"]
else:
return 0
|
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Peter Sprygada <psprygada@ansible.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
options:
provider:
description:
- A dict object containing connection details.
type: dict
suboptions:
host:
description:
- Specifies the DNS host name or address for connecting to the remote
instance of NIOS WAPI over REST
- Value can also be specified using C(INFOBLOX_HOST) environment
variable.
type: str
required: true
username:
description:
- Configures the username to use to authenticate the connection to
the remote instance of NIOS.
- Value can also be specified using C(INFOBLOX_USERNAME) environment
variable.
type: str
password:
description:
- Specifies the password to use to authenticate the connection to
the remote instance of NIOS.
- Value can also be specified using C(INFOBLOX_PASSWORD) environment
variable.
type: str
validate_certs:
description:
- Boolean value to enable or disable verifying SSL certificates
- Value can also be specified using C(INFOBLOX_SSL_VERIFY) environment
variable.
type: bool
default: no
aliases: [ ssl_verify ]
http_request_timeout:
description:
- The amount of time before to wait before receiving a response
- Value can also be specified using C(INFOBLOX_HTTP_REQUEST_TIMEOUT) environment
variable.
type: int
default: 10
max_retries:
description:
- Configures the number of attempted retries before the connection
is declared usable
- Value can also be specified using C(INFOBLOX_MAX_RETRIES) environment
variable.
type: int
default: 3
wapi_version:
description:
- Specifies the version of WAPI to use
- Value can also be specified using C(INFOBLOX_WAP_VERSION) environment
variable.
- Until ansible 2.8 the default WAPI was 1.4
type: str
default: '2.1'
max_results:
description:
- Specifies the maximum number of objects to be returned,
if set to a negative number the appliance will return an error when the
number of returned objects would exceed the setting.
- Value can also be specified using C(INFOBLOX_MAX_RESULTS) environment
variable.
type: int
default: 1000
notes:
- "This module must be run locally, which can be achieved by specifying C(connection: local)."
- Please read the :ref:`nios_guide` for more detailed information on how to use Infoblox with Ansible.
'''
|
class Display():
def __init__(self, width, height):
self.width = width
self.height = height
def getSize(self):
return (self.width, self.height)
|
# O(n ** 2)
def bubble_sort(slist, asc=True):
need_exchanges = False
for iteration in range(len(slist))[:: -1]:
for j in range(iteration):
if asc:
if slist[j] > slist[j + 1]:
need_exchanges = True
slist[j], slist[j + 1] = slist[j + 1], slist[j]
else:
if slist[j] < slist[j + 1]:
need_exchanges = True
slist[j], slist[j + 1] = slist[j + 1], slist[j]
if not need_exchanges:
return slist
return slist
print(bubble_sort([8, 1, 13, 34, 5, 2, 21, 3, 1], False))
print(bubble_sort([1, 2, 3, 4, 5, 6]))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.