content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Node: def __init__(self, value, next_=None): self.value = value self.next = next_ class Stack: def __init__(self, top=None): self.top = top def push(self, value): self.top = Node(value, self.top) def pop(self): if self.top: ret = self.top.value self.top = self.top.next return ret return def peek(self): if self.top: return self.top.value return def is_empty(self): if not self.top: return self.top is None class Queue: def __init__(self, front=None): self.front = front self.back = None def enqueue(self, value=None): if self.front is None: self.front = self.back = None(value) else: self.back.next = None(value) def dequeue(self): if self.front is None: return 'Queue is empty' ret = self.front.value self.front = self.front.next return ret class Pseudo_queue: """This class is a queue """ def __init__(self, front, tail): self.front = front self.tail = tail def enqueue(self, value=None): if (self.front.top == None) and (self.tail.top == None): self.front.push(value) return self.front.top.value if (self.front.top == None) and self.tail.top: while self.tail.top: self.front.push(self.tail.pop()) self.tail.push(value) return self.tail.top.value self.tail.push(value) return self.tail.top.value def dequeue(self): if (self.front.top == None) and (self.tail.top == None): return 'this queue is empty buddy' if (self.front.top == None) and self.tail.top: while self.tail.top: self.front.push(self.tail.pop()) self.front.pop() return self.front.pop()
class Node: def __init__(self, value, next_=None): self.value = value self.next = next_ class Stack: def __init__(self, top=None): self.top = top def push(self, value): self.top = node(value, self.top) def pop(self): if self.top: ret = self.top.value self.top = self.top.next return ret return def peek(self): if self.top: return self.top.value return def is_empty(self): if not self.top: return self.top is None class Queue: def __init__(self, front=None): self.front = front self.back = None def enqueue(self, value=None): if self.front is None: self.front = self.back = None(value) else: self.back.next = None(value) def dequeue(self): if self.front is None: return 'Queue is empty' ret = self.front.value self.front = self.front.next return ret class Pseudo_Queue: """This class is a queue """ def __init__(self, front, tail): self.front = front self.tail = tail def enqueue(self, value=None): if self.front.top == None and self.tail.top == None: self.front.push(value) return self.front.top.value if self.front.top == None and self.tail.top: while self.tail.top: self.front.push(self.tail.pop()) self.tail.push(value) return self.tail.top.value self.tail.push(value) return self.tail.top.value def dequeue(self): if self.front.top == None and self.tail.top == None: return 'this queue is empty buddy' if self.front.top == None and self.tail.top: while self.tail.top: self.front.push(self.tail.pop()) self.front.pop() return self.front.pop()
class Vector: #exercise 01 def __init__(self,inputlist): self._vector = [] _vector = inputlist #exercise 02 def __str__(self): return "<" + str(self._vector).strip("[]") + ">" #exercise 03 def dim(self): return len(self._vector) #exercise 04 def get(self,index): return self._vector[index] def set(self,index,value): self._vector[index] = value def scalar_product(self, scalar): return [scalar * x for x in self._vector] #exercise 05 def add(self, other_vector): if not isinstance(other_vector) == True and type(other_vector) == Vector: raise TypeError elif not self.dim() == other_vector.dim(): raise ValueError else: return self.scalar_product(other_vector) #exercise 06 def equals(self,other_vector): if not self.dim() == other_vector.dim(): return False elif self == other_vector: return True else: for i in range(self.dim()): if self._vector[i] != other_vector._vector[i]: return False else: return True
class Vector: def __init__(self, inputlist): self._vector = [] _vector = inputlist def __str__(self): return '<' + str(self._vector).strip('[]') + '>' def dim(self): return len(self._vector) def get(self, index): return self._vector[index] def set(self, index, value): self._vector[index] = value def scalar_product(self, scalar): return [scalar * x for x in self._vector] def add(self, other_vector): if not isinstance(other_vector) == True and type(other_vector) == Vector: raise TypeError elif not self.dim() == other_vector.dim(): raise ValueError else: return self.scalar_product(other_vector) def equals(self, other_vector): if not self.dim() == other_vector.dim(): return False elif self == other_vector: return True else: for i in range(self.dim()): if self._vector[i] != other_vector._vector[i]: return False else: return True
# Protein sequence given seq = "MPISEPTFFEIF" # Split the sequence into its component amino acids seq_list = list(seq) # Use a set to establish the unique amino acids unique_amino_acids = set(seq_list) # Print out the unique amino acids print(unique_amino_acids)
seq = 'MPISEPTFFEIF' seq_list = list(seq) unique_amino_acids = set(seq_list) print(unique_amino_acids)
DEPTH = 16 # the number of filters of the first conv layer of the encoder of the UNet # Training hyperparameters BATCHSIZE = 16 EPOCHS = 100 OPTIMIZER = "adam"
depth = 16 batchsize = 16 epochs = 100 optimizer = 'adam'
string=input("Enter a string:") length=len(string) mid=length//2 rev=-1 for a in range(mid): if string[a]==string[rev]: a+=1 rev=-1 else: print(string,"is a palindrome") break else: print(string,"is not a palindrome")
string = input('Enter a string:') length = len(string) mid = length // 2 rev = -1 for a in range(mid): if string[a] == string[rev]: a += 1 rev = -1 else: print(string, 'is a palindrome') break else: print(string, 'is not a palindrome')
""" Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A[i] > B[i]. Return any permutation of A that maximizes its advantage with respect to B. Example 1: Input: A = [2,7,11,15], B = [1,10,4,11] Output: [2,11,7,15] IDEA: Only relative order does matter, so one can apply greedy approach here Sort both arrays, and find the """ class Solution870: pass
""" Given two arrays A and B of equal size, the advantage of A with respect to B is the number of indices i for which A[i] > B[i]. Return any permutation of A that maximizes its advantage with respect to B. Example 1: Input: A = [2,7,11,15], B = [1,10,4,11] Output: [2,11,7,15] IDEA: Only relative order does matter, so one can apply greedy approach here Sort both arrays, and find the """ class Solution870: pass
""" Problem 10: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million. """ sum = 0 size = 2000000 slots = [True for i in range(size)] slots[0] = False slots[1] = False for stride in range(2, size // 2): pos = stride while pos < size - stride: pos += stride slots[pos] = False for idx, pr in enumerate(slots): if pr: sum += idx print('answer:', sum)
""" Problem 10: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million. """ sum = 0 size = 2000000 slots = [True for i in range(size)] slots[0] = False slots[1] = False for stride in range(2, size // 2): pos = stride while pos < size - stride: pos += stride slots[pos] = False for (idx, pr) in enumerate(slots): if pr: sum += idx print('answer:', sum)
# Argus was charged with guarding Io, which is not an ordinary cow. Io is quite an explorer, and she wanders off rather frequently, making Argus' life stressful. So the cowherd decided to construct an enclosed pasture for Io. # There are nnn trees growing along the river, where Argus tends Io. For this problem, the river can be viewed as the OXOXOX axis of the Cartesian coordinate system, and the nnn trees as points with the yyy-coordinate equal 000. There is also another tree growing in the point (0,1)(0, 1)(0,1). # Argus will tie a rope around three of the trees, creating a triangular pasture. Its exact shape doesn't matter to Io, but its area is crucial to her. There may be many ways for Argus to arrange the fence, but only the ones which result in different areas of the pasture are interesting for Io. Calculate the number of different areas that her pasture may have. Note that the pasture must have nonzero area. t = int(input()) for i in range(t): n = int(input()) xs = list(map(int, input().split()))
t = int(input()) for i in range(t): n = int(input()) xs = list(map(int, input().split()))
''' Compute a digest message ''' def answer(digest): ''' solve for m[1] ''' message = [] for i, v in enumerate(digest): pv = message[i - 1] if i > 0 else 0 m = 0.1 a = 0 while m != int(m): m = ((256 * a) + (v ^ pv)) / 129.0 a += 1 m = int(m) message.append(m) return message
""" Compute a digest message """ def answer(digest): """ solve for m[1] """ message = [] for (i, v) in enumerate(digest): pv = message[i - 1] if i > 0 else 0 m = 0.1 a = 0 while m != int(m): m = (256 * a + (v ^ pv)) / 129.0 a += 1 m = int(m) message.append(m) return message
""" Obkey package informations. This file is a part of Openbox Key Editor Code under GPL (originally MIT) from version 1.3 - 2018. See Licenses information in ../obkey . """ MAJOR = 1 MINOR = 3 PATCH = 2 __version__ = "{0}.{1}.{2}".format(MAJOR, MINOR, PATCH) __description__ = 'Openbox Key Editor' __long_description__ = """ A keybinding editor for OpenBox, it includes launchers and window management keys. It allows to: * can check almost all keybinds in one second. * add new keybinds, the default key associated will be 'a' and no action will be associated; * add new child keybinds; * setup existing keybinds : * add/remove/sort/setup actions in the actions list; * change the keybind by clicking on the item in the list; * duplicate existing keybinds; * remove keybinds. The current drawbacks : * XML inculsion is not managed. If you want to edit many files, then you shall open them with `obkey <config file>.xml`; * `if` conditionnal tag is not supported (but did you knew it exists). """
""" Obkey package informations. This file is a part of Openbox Key Editor Code under GPL (originally MIT) from version 1.3 - 2018. See Licenses information in ../obkey . """ major = 1 minor = 3 patch = 2 __version__ = '{0}.{1}.{2}'.format(MAJOR, MINOR, PATCH) __description__ = 'Openbox Key Editor' __long_description__ = "\nA keybinding editor for OpenBox, it includes launchers and window management keys.\n\nIt allows to:\n * can check almost all keybinds in one second.\n * add new keybinds, the default key associated will be 'a' and no action will be associated;\n * add new child keybinds;\n * setup existing keybinds :\n * add/remove/sort/setup actions in the actions list;\n * change the keybind by clicking on the item in the list;\n * duplicate existing keybinds;\n * remove keybinds.\n\nThe current drawbacks :\n * XML inculsion is not managed. If you want to edit many files, then you shall open them with `obkey <config file>.xml`;\n * `if` conditionnal tag is not supported (but did you knew it exists).\n\n"
# October 27th, 2021 # INFOTC 4320 # Josh Block # Challenge: Anagram Alogrithm and Big-O # References: https://bradfieldcs.com/algos/analysis/an-anagram-detection-example/ print("===Anagram Dector===") print("This program determines if two words are anagrams of each other\n") first_word = input("Please enter first word: ") second_word = input("Please enter second word: ") ##def dector(first_word,second_word): ## if len(first_word) != len(second_word): ## return True ## ## first_word = sorted(first_word) ## second_word = sorted(second_word) ## ## if first_word != second_word: ## return False ## ## return True ## pass def dector(first_word, second_word): return sorted(first_word) == sorted(second_word) print(dector(first_word,second_word))
print('===Anagram Dector===') print('This program determines if two words are anagrams of each other\n') first_word = input('Please enter first word: ') second_word = input('Please enter second word: ') def dector(first_word, second_word): return sorted(first_word) == sorted(second_word) print(dector(first_word, second_word))
a=int(input()) b=int(input()) c=int(input()) if(a>b and a>c): print("number 1 is greatest") elif(b>a and b>c): print("number 2 is greatest") else: print("number 3 is greatest")
a = int(input()) b = int(input()) c = int(input()) if a > b and a > c: print('number 1 is greatest') elif b > a and b > c: print('number 2 is greatest') else: print('number 3 is greatest')
def main(): # Create and print a list named fruit. fruit_list = ["pear", "banana", "apple", "mango"] print(f"original: {fruit_list}") fruit_list.reverse() print(f"Reverse {fruit_list}") fruit_list.append("Orange") print(f"Append Orange {fruit_list}") pos = fruit_list.index("apple") fruit_list.insert(pos, "cherry") print(f"insert cherry: {fruit_list}") fruit_list.remove("banana") print(f"Remove Banana: {fruit_list}") last = fruit_list.pop() print(f"pop {last}: {fruit_list}") fruit_list.sort() print(f"Sorted: {fruit_list}") fruit_list.clear() print(f"cleared: {fruit_list}") if __name__ == "__main__": main()
def main(): fruit_list = ['pear', 'banana', 'apple', 'mango'] print(f'original: {fruit_list}') fruit_list.reverse() print(f'Reverse {fruit_list}') fruit_list.append('Orange') print(f'Append Orange {fruit_list}') pos = fruit_list.index('apple') fruit_list.insert(pos, 'cherry') print(f'insert cherry: {fruit_list}') fruit_list.remove('banana') print(f'Remove Banana: {fruit_list}') last = fruit_list.pop() print(f'pop {last}: {fruit_list}') fruit_list.sort() print(f'Sorted: {fruit_list}') fruit_list.clear() print(f'cleared: {fruit_list}') if __name__ == '__main__': main()
__author__ = "Eric Dose :: New Mexico Mira Project, Albuquerque" # PyInstaller (__init__.py file should be in place as peer to .py file to run): # in Windows Command Prompt (E. Dose dev PC): # cd c:\Dev\prepoint\prepoint # C:\Programs\Miniconda\Scripts\pyinstaller app.spec
__author__ = 'Eric Dose :: New Mexico Mira Project, Albuquerque'
""" Spring. Click, drag, and release the horizontal bar to start the spring. """ # Spring drawing constants for top bar springHeight = 32 # Height left = 0 # Left position right = 0 # Right position max = 200 # Maximum Y value min = 100 # Minimum Y value over = False # If mouse over move = False # If mouse down and over # Spring simulation constants M = 0.8 # Mass K = 0.2 # Spring constant D = 0.92 # Damping R = 150 # Rest position # Spring simulation variables ps = R # Position v = 0.0 # Velocity a = 0 # Acceleration f = 0 # Force def setup(): size(640, 360) rectMode(CORNERS) noStroke() left = width / 2 - 100 right = width / 2 + 100 def draw(): background(102) updateSpring() drawSpring() def drawSpring(): # Draw base fill(0.2) baseWidth = 0.5 * ps + -8 rect(width / 2 - baseWidth, ps + springHeight, width / 2 + baseWidth, height) # Set color and draw top bar. if over or move: fill(255) else: fill(204) rect(left, ps, right, ps + springHeight) def updateSpring(): # Update the spring position. if not move: f = -K * (ps - R) # f=-ky a = f / M # Set the acceleration. f=ma == a=f/m v = D * (v + a) # Set the velocity. ps = ps + v # Updated position if abs(v) < 0.1: v = 0.0 # Test if mouse is over the top bar over = left < mouseX < right and ps < mouseY < ps + springHeight # Set and constrain the position of top bar. if move: ps = mouseY - springHeight / 2 ps = constrain(ps, min, max) def mousePressed(): if over: move = True def mouseReleased(): move = False
""" Spring. Click, drag, and release the horizontal bar to start the spring. """ spring_height = 32 left = 0 right = 0 max = 200 min = 100 over = False move = False m = 0.8 k = 0.2 d = 0.92 r = 150 ps = R v = 0.0 a = 0 f = 0 def setup(): size(640, 360) rect_mode(CORNERS) no_stroke() left = width / 2 - 100 right = width / 2 + 100 def draw(): background(102) update_spring() draw_spring() def draw_spring(): fill(0.2) base_width = 0.5 * ps + -8 rect(width / 2 - baseWidth, ps + springHeight, width / 2 + baseWidth, height) if over or move: fill(255) else: fill(204) rect(left, ps, right, ps + springHeight) def update_spring(): if not move: f = -K * (ps - R) a = f / M v = D * (v + a) ps = ps + v if abs(v) < 0.1: v = 0.0 over = left < mouseX < right and ps < mouseY < ps + springHeight if move: ps = mouseY - springHeight / 2 ps = constrain(ps, min, max) def mouse_pressed(): if over: move = True def mouse_released(): move = False
""" Space : O(1) Time : O(n**2) """ class Solution: def containsNearbyAlmostDuplicate(self, nums: List[int], k: int, t: int) -> bool: if t == 0 and len(nums) == len(set(nums)): return False for i, cur_val in enumerate(nums): for j in range(i+1, min(i+k+1, len(nums))): if abs(cur_val - nums[j]) <= t: return True return False
""" Space : O(1) Time : O(n**2) """ class Solution: def contains_nearby_almost_duplicate(self, nums: List[int], k: int, t: int) -> bool: if t == 0 and len(nums) == len(set(nums)): return False for (i, cur_val) in enumerate(nums): for j in range(i + 1, min(i + k + 1, len(nums))): if abs(cur_val - nums[j]) <= t: return True return False
def make_interval(depth, depth_integer_multiplier, num, step_num, start_val): all_groups_str = "[\n" for n in range(num): all_groups_str += "\t[" for d in range(depth): val = str(start_val * pow(depth_integer_multiplier, d)) if d == depth - 1: if n == num - 1: all_groups_str += "%s]\n" % val else: all_groups_str += "%s],\n" % val else: all_groups_str += "%s, " % val start_val += step_num all_groups_str += "]\n" return all_groups_str print(make_interval(12, 2, 10, 10, 10))
def make_interval(depth, depth_integer_multiplier, num, step_num, start_val): all_groups_str = '[\n' for n in range(num): all_groups_str += '\t[' for d in range(depth): val = str(start_val * pow(depth_integer_multiplier, d)) if d == depth - 1: if n == num - 1: all_groups_str += '%s]\n' % val else: all_groups_str += '%s],\n' % val else: all_groups_str += '%s, ' % val start_val += step_num all_groups_str += ']\n' return all_groups_str print(make_interval(12, 2, 10, 10, 10))
class Config: __instance = None @staticmethod def get_instance(): """ Static access method. """ if Config.__instance == None: Config() return Config.__instance def __init__(self): if Config.__instance != None: raise Exception("This class can't be created, use Config.getInstance() instead") else: Config.__instance = self self.db_driver="sqlite", self.sqlite_file = "database.sqlite" s = Config() print (s) s = Config.get_instance() print (s, id(s)) s = Config.get_instance() print (s, id(s))
class Config: __instance = None @staticmethod def get_instance(): """ Static access method. """ if Config.__instance == None: config() return Config.__instance def __init__(self): if Config.__instance != None: raise exception("This class can't be created, use Config.getInstance() instead") else: Config.__instance = self self.db_driver = ('sqlite',) self.sqlite_file = 'database.sqlite' s = config() print(s) s = Config.get_instance() print(s, id(s)) s = Config.get_instance() print(s, id(s))
class AFGR: @staticmethod def af_to_gr(dict_af): dict_swap = {} for keys in dict_af: dict_swap[keys] = [] for list in dict_af[keys]: dict_swap[keys].insert(len(dict_swap[keys]), list[0]) dict_swap[keys].insert(len(dict_swap[keys]), list[1]) return dict_swap @staticmethod def gr_to_af(dict_gr, estados_aceitacao): dict_swap = {} # Adicionando estado final dict_swap['F'] = [] estados_aceitacao.insert(len(estados_aceitacao), 'F') for keys in dict_gr: dict_swap[keys] = [] qtd_elementos = len(dict_gr[keys]) contador = 0 while contador < qtd_elementos: if contador+1 < len(dict_gr[keys]): if dict_gr[keys][contador+1].istitle(): dict_swap[keys].insert(len(dict_swap[keys]), [dict_gr[keys][contador], dict_gr[keys][contador+1]]) contador += 2 else: if AFGR.verifica_estado_final(dict_swap, dict_gr, keys, contador): dict_swap[keys].insert(len(dict_swap[keys]), [dict_gr[keys][contador], 'F']) contador += 1 else: if AFGR.verifica_estado_final(dict_swap, dict_gr, keys, contador): dict_swap[keys].insert(len(dict_swap[keys]), [dict_gr[keys][contador], 'F']) contador += 1 # Caso o ultimo elemento seja um nao terminal (NAO FINALIZADO TA REPETIDO O S) AFGR.verifica_estado_final(dict_swap, dict_gr, keys, contador-2) return dict_swap # Verifica os estados finais, tem que ver uma forma melhor no futuro @staticmethod def verifica_estado_final(dict_swap, dict_gr, keys, contador): for estados in dict_swap[keys]: if estados[0] == dict_gr[keys][contador] and estados[1] != 'F': estados[1] = 'F' return False return True
class Afgr: @staticmethod def af_to_gr(dict_af): dict_swap = {} for keys in dict_af: dict_swap[keys] = [] for list in dict_af[keys]: dict_swap[keys].insert(len(dict_swap[keys]), list[0]) dict_swap[keys].insert(len(dict_swap[keys]), list[1]) return dict_swap @staticmethod def gr_to_af(dict_gr, estados_aceitacao): dict_swap = {} dict_swap['F'] = [] estados_aceitacao.insert(len(estados_aceitacao), 'F') for keys in dict_gr: dict_swap[keys] = [] qtd_elementos = len(dict_gr[keys]) contador = 0 while contador < qtd_elementos: if contador + 1 < len(dict_gr[keys]): if dict_gr[keys][contador + 1].istitle(): dict_swap[keys].insert(len(dict_swap[keys]), [dict_gr[keys][contador], dict_gr[keys][contador + 1]]) contador += 2 else: if AFGR.verifica_estado_final(dict_swap, dict_gr, keys, contador): dict_swap[keys].insert(len(dict_swap[keys]), [dict_gr[keys][contador], 'F']) contador += 1 else: if AFGR.verifica_estado_final(dict_swap, dict_gr, keys, contador): dict_swap[keys].insert(len(dict_swap[keys]), [dict_gr[keys][contador], 'F']) contador += 1 AFGR.verifica_estado_final(dict_swap, dict_gr, keys, contador - 2) return dict_swap @staticmethod def verifica_estado_final(dict_swap, dict_gr, keys, contador): for estados in dict_swap[keys]: if estados[0] == dict_gr[keys][contador] and estados[1] != 'F': estados[1] = 'F' return False return True
animals = ["Gully", "Rhubarb", "Zephyr", "Henry"] for index, animal in enumerate(animals): # if index % 2 == 0: # continue # print(animal) print(f"{index+1}.\t{animal}")
animals = ['Gully', 'Rhubarb', 'Zephyr', 'Henry'] for (index, animal) in enumerate(animals): print(f'{index + 1}.\t{animal}')
class FittingAndAccessoryCalculationType(Enum, IComparable, IFormattable, IConvertible): """ Enum of fitting and accessory pressure drop calculation type. enum FittingAndAccessoryCalculationType,values: CalculateDefaultSettings (2),CalculatePressureDrop (1),Undefined (0),ValidateCurrentSettings (4) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self, *args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self, *args): pass def __gt__(self, *args): pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self, *args): pass def __lt__(self, *args): pass def __ne__(self, *args): pass def __reduce_ex__(self, *args): pass def __str__(self, *args): pass CalculateDefaultSettings = None CalculatePressureDrop = None Undefined = None ValidateCurrentSettings = None value__ = None
class Fittingandaccessorycalculationtype(Enum, IComparable, IFormattable, IConvertible): """ Enum of fitting and accessory pressure drop calculation type. enum FittingAndAccessoryCalculationType,values: CalculateDefaultSettings (2),CalculatePressureDrop (1),Undefined (0),ValidateCurrentSettings (4) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self, *args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self, *args): pass def __gt__(self, *args): pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self, *args): pass def __lt__(self, *args): pass def __ne__(self, *args): pass def __reduce_ex__(self, *args): pass def __str__(self, *args): pass calculate_default_settings = None calculate_pressure_drop = None undefined = None validate_current_settings = None value__ = None
# Given an integer array arr, count element x such that x + 1 is also in arr. # If there're duplicates in arr, count them seperately. # Example 1: # Input: arr = [1,2,3] # Output: 2 # Explanation: 1 and 2 are counted cause 2 and 3 are in arr. # Example 2: # Input: arr = [1,1,3,3,5,5,7,7] # Output: 0 # Explanation: No numbers are counted, cause there's no 2, 4, 6, or 8 in arr. # Example 3: # Input: arr = [1,3,2,3,5,0] # Output: 3 # Explanation: 0, 1 and 2 are counted cause 1, 2 and 3 are in arr. # Example 4: # Input: arr = [1,1,2,2] # Output: 2 # Explanation: Two 1s are counted cause 2 is in arr. def count_elements(arr): d = {} for i in arr: d[i] = 1 count = 0 for num in arr: num_plus = num + 1 if num_plus in d: count += 1 return count print(count_elements([1,1,2,2]))
def count_elements(arr): d = {} for i in arr: d[i] = 1 count = 0 for num in arr: num_plus = num + 1 if num_plus in d: count += 1 return count print(count_elements([1, 1, 2, 2]))
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-uberon' ES_DOC_TYPE = 'anatomy' API_PREFIX = 'uberon' API_VERSION = ''
es_host = 'localhost:9200' es_index = 'pending-uberon' es_doc_type = 'anatomy' api_prefix = 'uberon' api_version = ''
class Solution: def solve(self, nums): integersDict = {} for i in range(len(nums)): try: integersDict[nums[i]] += 1 except: integersDict[nums[i]] = 1 for integer in integersDict: if integersDict[integer] != 3: return integer return nums[0]
class Solution: def solve(self, nums): integers_dict = {} for i in range(len(nums)): try: integersDict[nums[i]] += 1 except: integersDict[nums[i]] = 1 for integer in integersDict: if integersDict[integer] != 3: return integer return nums[0]
class CharacterRaceList(object): DEVA = 'DEVA' DRAGONBORN = 'DRAGONBORN' DWARF = 'DWARF' ELADRIN = 'ELADRIN' ELF = 'ELF' GITHZERAI = 'GITHZERAI' GNOME = 'GNOME' GOLIATH = 'GOLIATH' HALFELF = 'HALFELF' HALFLING = 'HALFLING' HALFORC = 'HALFORC' HUMAN = 'HUMAN' MINOTAUR = 'MINOTAUR' SHARDMIND = 'SHARDMIND' SHIFTER = 'SHIFTER' TIEFLING = 'TIEFLING' WILDEN = 'WILDEN' class CharacterClassList(object): ARDENT = 'ARDENT' AVENGER = 'AVENGER' BARBARIAN = 'BARBARIAN' BARD = 'BARD' BATTLEMIND = 'BATTLEMIND' CLERIC = 'CLERIC' DRUID = 'DRUID' FIGHTER = 'FIGHTER' INVOKER = 'INVOKER' MONK = 'MONK' PALADIN = 'PALADIN' PSION = 'PSION' RANGER = 'RANGER' ROGUE = 'ROGUE' RUNEPRIEST = 'RUNEPRIEST' SEEKER = 'SEEKER' SHAMAN = 'SHAMAN' SORCERER = 'SORCERER' WARDEN = 'WARDEN' WARLOCK = 'WARLOCK' WARLORD = 'WARLORD' WIZARD = 'WIZARD' class CharacterRoleList(object): CONTROLLER = 'CONTROLLER' DEFENDER = 'DEFENDER' LEADER = 'LEADER' STRIKER = 'STRIKER' class AlignmentList(object): GOOD = 'GOOD' LAWFUL_GOOD = 'LAWFUL_GOOD' UNALIGNED = 'UNALIGNED' EVIL = 'EVIL' CHAOTIC_EVIL = 'CHAOTIC_EVIL' class DeitiesList(object): ASMODEUS = AlignmentList.EVIL AVANDRA = AlignmentList.GOOD BAHAMUT = AlignmentList.LAWFUL_GOOD BANE = AlignmentList.EVIL CORELLON = AlignmentList.UNALIGNED ERATHIS = AlignmentList.UNALIGNED GRUUMSH = AlignmentList.CHAOTIC_EVIL IOUN = AlignmentList.UNALIGNED KORD = AlignmentList.UNALIGNED LOLTH = AlignmentList.CHAOTIC_EVIL MELORA = AlignmentList.UNALIGNED MORADIN = AlignmentList.LAWFUL_GOOD PELOR = AlignmentList.GOOD SEHANINE = AlignmentList.UNALIGNED THE_RAVEN_QUEEN = AlignmentList.UNALIGNED TIAMAT = AlignmentList.EVIL TOROG = AlignmentList.EVIL VECNA = AlignmentList.EVIL ZEHIR = AlignmentList.EVIL class ScriptList(object): COMMON = 'COMMON' RELLANIC = 'RELLANIC' IOKHARIC = 'IOKHARIC' DAVEK = 'DAVEK' BARAZHAD = 'BARAZHAD' SUPERNAL = 'SUPERNAL' class LanguageList(object): COMMON = ScriptList.COMMON DEEP_SPEECH = ScriptList.RELLANIC DRACONIC = ScriptList.IOKHARIC DWARVEN = ScriptList.DAVEK ELVEN = ScriptList.RELLANIC GIANT = ScriptList.DAVEK GOBLIN = ScriptList.COMMON PRIMORDIAL = ScriptList.BARAZHAD SUPERNA = ScriptList.SUPERNAL ABYSSAL = ScriptList.BARAZHAD
class Characterracelist(object): deva = 'DEVA' dragonborn = 'DRAGONBORN' dwarf = 'DWARF' eladrin = 'ELADRIN' elf = 'ELF' githzerai = 'GITHZERAI' gnome = 'GNOME' goliath = 'GOLIATH' halfelf = 'HALFELF' halfling = 'HALFLING' halforc = 'HALFORC' human = 'HUMAN' minotaur = 'MINOTAUR' shardmind = 'SHARDMIND' shifter = 'SHIFTER' tiefling = 'TIEFLING' wilden = 'WILDEN' class Characterclasslist(object): ardent = 'ARDENT' avenger = 'AVENGER' barbarian = 'BARBARIAN' bard = 'BARD' battlemind = 'BATTLEMIND' cleric = 'CLERIC' druid = 'DRUID' fighter = 'FIGHTER' invoker = 'INVOKER' monk = 'MONK' paladin = 'PALADIN' psion = 'PSION' ranger = 'RANGER' rogue = 'ROGUE' runepriest = 'RUNEPRIEST' seeker = 'SEEKER' shaman = 'SHAMAN' sorcerer = 'SORCERER' warden = 'WARDEN' warlock = 'WARLOCK' warlord = 'WARLORD' wizard = 'WIZARD' class Characterrolelist(object): controller = 'CONTROLLER' defender = 'DEFENDER' leader = 'LEADER' striker = 'STRIKER' class Alignmentlist(object): good = 'GOOD' lawful_good = 'LAWFUL_GOOD' unaligned = 'UNALIGNED' evil = 'EVIL' chaotic_evil = 'CHAOTIC_EVIL' class Deitieslist(object): asmodeus = AlignmentList.EVIL avandra = AlignmentList.GOOD bahamut = AlignmentList.LAWFUL_GOOD bane = AlignmentList.EVIL corellon = AlignmentList.UNALIGNED erathis = AlignmentList.UNALIGNED gruumsh = AlignmentList.CHAOTIC_EVIL ioun = AlignmentList.UNALIGNED kord = AlignmentList.UNALIGNED lolth = AlignmentList.CHAOTIC_EVIL melora = AlignmentList.UNALIGNED moradin = AlignmentList.LAWFUL_GOOD pelor = AlignmentList.GOOD sehanine = AlignmentList.UNALIGNED the_raven_queen = AlignmentList.UNALIGNED tiamat = AlignmentList.EVIL torog = AlignmentList.EVIL vecna = AlignmentList.EVIL zehir = AlignmentList.EVIL class Scriptlist(object): common = 'COMMON' rellanic = 'RELLANIC' iokharic = 'IOKHARIC' davek = 'DAVEK' barazhad = 'BARAZHAD' supernal = 'SUPERNAL' class Languagelist(object): common = ScriptList.COMMON deep_speech = ScriptList.RELLANIC draconic = ScriptList.IOKHARIC dwarven = ScriptList.DAVEK elven = ScriptList.RELLANIC giant = ScriptList.DAVEK goblin = ScriptList.COMMON primordial = ScriptList.BARAZHAD superna = ScriptList.SUPERNAL abyssal = ScriptList.BARAZHAD
def inner_stroke(im): pass def outer_stroke(im): pass
def inner_stroke(im): pass def outer_stroke(im): pass
a, b, c = map(int, input().split()) h, l = map(int, input().split()) if a <= h and b <= l: print("S") elif a <= h and c <= l: print("S") elif b <= h and a <= l: print("S") elif b <= h and c <= l: print("S") elif c <= h and a <= l: print("S") elif c <= h and b <= l: print("S") else: print("N")
(a, b, c) = map(int, input().split()) (h, l) = map(int, input().split()) if a <= h and b <= l: print('S') elif a <= h and c <= l: print('S') elif b <= h and a <= l: print('S') elif b <= h and c <= l: print('S') elif c <= h and a <= l: print('S') elif c <= h and b <= l: print('S') else: print('N')
def funcao1 (a, b): mult= a * b return mult def funcao2 (a, b): divi = a / b return divi multiplicacao = funcao1(3, 2) valor = funcao2(multiplicacao, 2) print(multiplicacao) print(int(valor))
def funcao1(a, b): mult = a * b return mult def funcao2(a, b): divi = a / b return divi multiplicacao = funcao1(3, 2) valor = funcao2(multiplicacao, 2) print(multiplicacao) print(int(valor))
# Plotting distributions pairwise (1) # Print the first 5 rows of the DataFrame print(auto.head()) # Plot the pairwise joint distributions from the DataFrame sns.pairplot(auto) # Display the plot plt.show()
print(auto.head()) sns.pairplot(auto) plt.show()
def log_text(file_path, log): if not log.endswith('\n'): log += '\n' print(log) with open(file_path, 'a') as f: f.write(log) def log_args(file_path, args): log = f"Args: {args}\n" log_text(file_path, log) def log_train_epoch(file_path, epoch, train_loss, train_accuracy): log = f"epoch: {epoch}, Train loss: {train_loss}, Train accuracy: {train_accuracy}\n" log_text(file_path, log) def log_val_epoch(file_path, epoch, val_loss, val_acc): log = f"epoch: {epoch}, Val loss: {val_loss}, Val accuracy: {val_acc}\n" log_text(file_path, log) def log_test_metrics(file_path, precision, recall, f1, accuracy, cm): log = (f"Precision: {precision}\n" f"Recall: {recall}\n" f"F1 score: {f1}\n" f"Accuracy: {accuracy}\n" f"Confusion Matrix:\n{cm}\n") log_text(file_path, log) def log_target_test_metrics(file_path, target, precision, recall, f1): log = (f"{target}:\n" f"\tPrecision: {round(precision, 4)}\n" f"\tRecall: {round(recall, 4)}\n" f"\tF1 score: {round(f1, 4)}\n") log_text(file_path, log)
def log_text(file_path, log): if not log.endswith('\n'): log += '\n' print(log) with open(file_path, 'a') as f: f.write(log) def log_args(file_path, args): log = f'Args: {args}\n' log_text(file_path, log) def log_train_epoch(file_path, epoch, train_loss, train_accuracy): log = f'epoch: {epoch}, Train loss: {train_loss}, Train accuracy: {train_accuracy}\n' log_text(file_path, log) def log_val_epoch(file_path, epoch, val_loss, val_acc): log = f'epoch: {epoch}, Val loss: {val_loss}, Val accuracy: {val_acc}\n' log_text(file_path, log) def log_test_metrics(file_path, precision, recall, f1, accuracy, cm): log = f'Precision: {precision}\nRecall: {recall}\nF1 score: {f1}\nAccuracy: {accuracy}\nConfusion Matrix:\n{cm}\n' log_text(file_path, log) def log_target_test_metrics(file_path, target, precision, recall, f1): log = f'{target}:\n\tPrecision: {round(precision, 4)}\n\tRecall: {round(recall, 4)}\n\tF1 score: {round(f1, 4)}\n' log_text(file_path, log)
class Node: def __init__(self, value, next): self.value = value self.next = next class LinkedList: def __init__(self): self.head = None def add(self, value): self.head = Node(value, self.head) def remove(self): to_remove = self.head self.head = self.head.next to_remove.next = None def reverse(self): head = current = self.head prev = next = None while current: next = current.next current.next = prev prev = current current = next self.head = prev self.print() def print(self): current = self.head while current: print(current.value, end=" ") print("->", end = " ") if not current.next: print(current.next, end ="\n") current = current.next if __name__ == "__main__": ll = LinkedList() for i in range(10, 1, -1): ll.add(i) ll.print() ll.reverse()
class Node: def __init__(self, value, next): self.value = value self.next = next class Linkedlist: def __init__(self): self.head = None def add(self, value): self.head = node(value, self.head) def remove(self): to_remove = self.head self.head = self.head.next to_remove.next = None def reverse(self): head = current = self.head prev = next = None while current: next = current.next current.next = prev prev = current current = next self.head = prev self.print() def print(self): current = self.head while current: print(current.value, end=' ') print('->', end=' ') if not current.next: print(current.next, end='\n') current = current.next if __name__ == '__main__': ll = linked_list() for i in range(10, 1, -1): ll.add(i) ll.print() ll.reverse()
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Advent of Code 2020 Day 13, Part 1 """ def main(): with open('in.txt') as f: lines = f.readlines() arrival = int(lines[0].strip()) bus_ids = [] for n in lines[1].strip().split(','): if n == 'x': continue else: bus_ids.append(int(n)) waiting_time = [(n - arrival % n, n) for n in bus_ids] min_time = waiting_time[0][0] first_bus = waiting_time[0][1] for minutes, bus in waiting_time[1:]: if minutes < min_time: min_time = minutes first_bus = bus print(min_time * first_bus) if __name__ == '__main__': main()
""" Advent of Code 2020 Day 13, Part 1 """ def main(): with open('in.txt') as f: lines = f.readlines() arrival = int(lines[0].strip()) bus_ids = [] for n in lines[1].strip().split(','): if n == 'x': continue else: bus_ids.append(int(n)) waiting_time = [(n - arrival % n, n) for n in bus_ids] min_time = waiting_time[0][0] first_bus = waiting_time[0][1] for (minutes, bus) in waiting_time[1:]: if minutes < min_time: min_time = minutes first_bus = bus print(min_time * first_bus) if __name__ == '__main__': main()
#!/usr/bin/env python # # ---------------------------------------------------------------------- # # Brad T. Aagaard, U.S. Geological Survey # Charles A. Williams, GNS Science # Matthew G. Knepley, University of Chicago # # This code was developed as part of the Computational Infrastructure # for Geodynamics (http://geodynamics.org). # # Copyright (c) 2010-2017 University of California, Davis # # See COPYING for license information. # # ---------------------------------------------------------------------- # ## @file pylith/problems/__init__.py ## ## @brief Python PyLith crustal dynamics problems module initialization __all__ = ['EqDeformation', 'Explicit', 'Implicit', 'Problem', 'Solver', 'SolverLinear', 'SolverNonlinear', 'TimeDependent', 'TimeStep', 'TimeStepUniform', 'TimeStepUser', 'TimeStepAdapt', 'ProgressMonitor', ] # End of file
__all__ = ['EqDeformation', 'Explicit', 'Implicit', 'Problem', 'Solver', 'SolverLinear', 'SolverNonlinear', 'TimeDependent', 'TimeStep', 'TimeStepUniform', 'TimeStepUser', 'TimeStepAdapt', 'ProgressMonitor']
t = int(input()) while (t!=0): a,b,c = map(int,input().split()) if (a+b+c == 180): print('YES') else: print('NO') t-=1
t = int(input()) while t != 0: (a, b, c) = map(int, input().split()) if a + b + c == 180: print('YES') else: print('NO') t -= 1
# cool.py def cool_func(): print('cool_func(): Super Cool!') print('__name__:', __name__) if __name__ == '__main__': print('Call it locally') cool_func()
def cool_func(): print('cool_func(): Super Cool!') print('__name__:', __name__) if __name__ == '__main__': print('Call it locally') cool_func()
""" https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits/ Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order. Return the sorted array. Example 1: Input: arr = [0,1,2,3,4,5,6,7,8] Output: [0,1,2,4,8,3,5,6,7] Explantion: [0] is the only integer with 0 bits. [1,2,4,8] all have 1 bit. [3,5,6] have 2 bits. [7] has 3 bits. The sorted array by bits is [0,1,2,4,8,3,5,6,7] Example 2: Input: arr = [1024,512,256,128,64,32,16,8,4,2,1] Output: [1,2,4,8,16,32,64,128,256,512,1024] Explantion: All integers have 1 bit in the binary representation, you should just sort them in ascending order. Example 3: Input: arr = [10000,10000] Output: [10000,10000] Example 4: Input: arr = [2,3,5,7,11,13,17,19] Output: [2,3,5,17,7,11,13,19] Example 5: Input: arr = [10,100,1000,10000] Output: [10,100,10000,1000] Constraints: 1 <= arr.length <= 500 0 <= arr[i] <= 10^4 """ # time complexity: O(nlogn), space complexity: O(n) class Solution: def sortByBits(self, arr: List[int]) -> List[int]: scale = 1e5 for i in range(len(arr)): arr[i] = [bin(arr[i]).count('1')*scale+arr[i],arr[i]] arr.sort(key=lambda x:x[0]) return list(num[1] for num in arr)
""" https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits/ Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order. Return the sorted array. Example 1: Input: arr = [0,1,2,3,4,5,6,7,8] Output: [0,1,2,4,8,3,5,6,7] Explantion: [0] is the only integer with 0 bits. [1,2,4,8] all have 1 bit. [3,5,6] have 2 bits. [7] has 3 bits. The sorted array by bits is [0,1,2,4,8,3,5,6,7] Example 2: Input: arr = [1024,512,256,128,64,32,16,8,4,2,1] Output: [1,2,4,8,16,32,64,128,256,512,1024] Explantion: All integers have 1 bit in the binary representation, you should just sort them in ascending order. Example 3: Input: arr = [10000,10000] Output: [10000,10000] Example 4: Input: arr = [2,3,5,7,11,13,17,19] Output: [2,3,5,17,7,11,13,19] Example 5: Input: arr = [10,100,1000,10000] Output: [10,100,10000,1000] Constraints: 1 <= arr.length <= 500 0 <= arr[i] <= 10^4 """ class Solution: def sort_by_bits(self, arr: List[int]) -> List[int]: scale = 100000.0 for i in range(len(arr)): arr[i] = [bin(arr[i]).count('1') * scale + arr[i], arr[i]] arr.sort(key=lambda x: x[0]) return list((num[1] for num in arr))
class FieldDoesNotExist(Exception): def __init__(self, **kwargs): super().__init__(f"{self.__class__.__name__}: {kwargs}") self.kwargs = kwargs
class Fielddoesnotexist(Exception): def __init__(self, **kwargs): super().__init__(f'{self.__class__.__name__}: {kwargs}') self.kwargs = kwargs
""" Queue https://algorithm.yuanbin.me/zh-hans/basics_data_structure/queue.html """
""" Queue https://algorithm.yuanbin.me/zh-hans/basics_data_structure/queue.html """
# # PySNMP MIB module Unisphere-Products-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Products-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:26:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") iso, NotificationType, Counter64, Gauge32, ModuleIdentity, Counter32, IpAddress, Integer32, Unsigned32, TimeTicks, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "NotificationType", "Counter64", "Gauge32", "ModuleIdentity", "Counter32", "IpAddress", "Integer32", "Unsigned32", "TimeTicks", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "Bits") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") unisphere, = mibBuilder.importSymbols("Unisphere-SMI", "unisphere") usProducts = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 1)) usProducts.setRevisions(('2001-12-07 15:36', '2001-10-15 18:29', '2001-03-01 15:27', '2000-05-24 00:00', '1999-12-13 19:36', '1999-11-16 00:00', '1999-09-28 00:00',)) if mibBuilder.loadTexts: usProducts.setLastUpdated('200112071536Z') if mibBuilder.loadTexts: usProducts.setOrganization('Unisphere Networks, Inc.') productFamilies = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1)) unisphereProductFamilies = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1)) usErx = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1)) usEdgeRoutingSwitch1400 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1, 1)) usEdgeRoutingSwitch700 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1, 2)) usEdgeRoutingSwitch1440 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1, 3)) usEdgeRoutingSwitch705 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1, 4)) usMrx = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 2)) usMrxRoutingSwitch16000 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 2, 1)) usMrxRoutingSwitch32000 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 2, 2)) usSmx = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 3)) usServiceMediationSwitch2100 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 3, 1)) usSrx = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 4)) usServiceReadySwitch3000 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 4, 1)) usUmc = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 5)) usUmcSystemManagement = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 5, 1)) oemProductFamilies = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2)) marconiProductFamilies = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1)) usSsx = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1, 1)) usSsx1400 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1, 1, 1)) usSsx700 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1, 1, 2)) usSsx1440 = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1, 1, 3)) mibBuilder.exportSymbols("Unisphere-Products-MIB", usSsx1400=usSsx1400, usErx=usErx, usServiceMediationSwitch2100=usServiceMediationSwitch2100, oemProductFamilies=oemProductFamilies, usServiceReadySwitch3000=usServiceReadySwitch3000, usUmc=usUmc, usSmx=usSmx, usSsx1440=usSsx1440, unisphereProductFamilies=unisphereProductFamilies, usEdgeRoutingSwitch705=usEdgeRoutingSwitch705, usMrxRoutingSwitch16000=usMrxRoutingSwitch16000, usSsx=usSsx, usProducts=usProducts, usEdgeRoutingSwitch700=usEdgeRoutingSwitch700, usSsx700=usSsx700, usUmcSystemManagement=usUmcSystemManagement, marconiProductFamilies=marconiProductFamilies, productFamilies=productFamilies, usEdgeRoutingSwitch1440=usEdgeRoutingSwitch1440, usMrx=usMrx, usMrxRoutingSwitch32000=usMrxRoutingSwitch32000, usEdgeRoutingSwitch1400=usEdgeRoutingSwitch1400, PYSNMP_MODULE_ID=usProducts, usSrx=usSrx)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (iso, notification_type, counter64, gauge32, module_identity, counter32, ip_address, integer32, unsigned32, time_ticks, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, mib_identifier, bits) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'NotificationType', 'Counter64', 'Gauge32', 'ModuleIdentity', 'Counter32', 'IpAddress', 'Integer32', 'Unsigned32', 'TimeTicks', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'MibIdentifier', 'Bits') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') (unisphere,) = mibBuilder.importSymbols('Unisphere-SMI', 'unisphere') us_products = module_identity((1, 3, 6, 1, 4, 1, 4874, 1)) usProducts.setRevisions(('2001-12-07 15:36', '2001-10-15 18:29', '2001-03-01 15:27', '2000-05-24 00:00', '1999-12-13 19:36', '1999-11-16 00:00', '1999-09-28 00:00')) if mibBuilder.loadTexts: usProducts.setLastUpdated('200112071536Z') if mibBuilder.loadTexts: usProducts.setOrganization('Unisphere Networks, Inc.') product_families = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1)) unisphere_product_families = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1)) us_erx = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1)) us_edge_routing_switch1400 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1, 1)) us_edge_routing_switch700 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1, 2)) us_edge_routing_switch1440 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1, 3)) us_edge_routing_switch705 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 1, 4)) us_mrx = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 2)) us_mrx_routing_switch16000 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 2, 1)) us_mrx_routing_switch32000 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 2, 2)) us_smx = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 3)) us_service_mediation_switch2100 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 3, 1)) us_srx = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 4)) us_service_ready_switch3000 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 4, 1)) us_umc = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 5)) us_umc_system_management = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 1, 5, 1)) oem_product_families = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2)) marconi_product_families = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1)) us_ssx = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1, 1)) us_ssx1400 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1, 1, 1)) us_ssx700 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1, 1, 2)) us_ssx1440 = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 1, 1, 2, 1, 1, 3)) mibBuilder.exportSymbols('Unisphere-Products-MIB', usSsx1400=usSsx1400, usErx=usErx, usServiceMediationSwitch2100=usServiceMediationSwitch2100, oemProductFamilies=oemProductFamilies, usServiceReadySwitch3000=usServiceReadySwitch3000, usUmc=usUmc, usSmx=usSmx, usSsx1440=usSsx1440, unisphereProductFamilies=unisphereProductFamilies, usEdgeRoutingSwitch705=usEdgeRoutingSwitch705, usMrxRoutingSwitch16000=usMrxRoutingSwitch16000, usSsx=usSsx, usProducts=usProducts, usEdgeRoutingSwitch700=usEdgeRoutingSwitch700, usSsx700=usSsx700, usUmcSystemManagement=usUmcSystemManagement, marconiProductFamilies=marconiProductFamilies, productFamilies=productFamilies, usEdgeRoutingSwitch1440=usEdgeRoutingSwitch1440, usMrx=usMrx, usMrxRoutingSwitch32000=usMrxRoutingSwitch32000, usEdgeRoutingSwitch1400=usEdgeRoutingSwitch1400, PYSNMP_MODULE_ID=usProducts, usSrx=usSrx)
class Solution(object): def findSubsequences(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ ans = [] def dfs(nums, start, path, ans): if len(path) >= 2: ans.append(tuple(path + [])) for i in range(start, len(nums)): if i != start and nums[i] == nums[i - 1]: continue if path and nums[i] < path[-1]: continue path.append(nums[i]) dfs(nums, i + 1, path, ans) path.pop() dfs(nums, 0, [], ans) return list(set(ans))
class Solution(object): def find_subsequences(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ ans = [] def dfs(nums, start, path, ans): if len(path) >= 2: ans.append(tuple(path + [])) for i in range(start, len(nums)): if i != start and nums[i] == nums[i - 1]: continue if path and nums[i] < path[-1]: continue path.append(nums[i]) dfs(nums, i + 1, path, ans) path.pop() dfs(nums, 0, [], ans) return list(set(ans))
# Calculate factorial of a number def factorial(n): ''' Returns the factorial of n. e.g. factorial(7) = 7x76x5x4x3x2x1 = 5040. ''' answer = 1 for i in range(1,n+1): answer = answer * i return answer if __name__ == "__main__": assert factorial(7) == 5040
def factorial(n): """ Returns the factorial of n. e.g. factorial(7) = 7x76x5x4x3x2x1 = 5040. """ answer = 1 for i in range(1, n + 1): answer = answer * i return answer if __name__ == '__main__': assert factorial(7) == 5040
line = input().split() n = int(line[0]) m = int(line[1]) print(str(abs(n-m)))
line = input().split() n = int(line[0]) m = int(line[1]) print(str(abs(n - m)))
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"c_imshow": "01_nn_utils.ipynb", "Flatten": "01_nn_utils.ipynb", "conv3x3": "01_nn_utils.ipynb", "get_proto_accuracy": "01_nn_utils.ipynb", "get_accuracy": "02_maml_pl.ipynb", "collate_task": "01b_data_loaders_pl.ipynb", "collate_task_batch": "01b_data_loaders_pl.ipynb", "get_episode_loader": "01b_data_loaders_pl.ipynb", "UnlabelledDataset": "01b_data_loaders_pl.ipynb", "get_cub_default_transform": "01b_data_loaders_pl.ipynb", "get_simCLR_transform": "01b_data_loaders_pl.ipynb", "get_omniglot_transform": "01b_data_loaders_pl.ipynb", "get_custom_transform": "01b_data_loaders_pl.ipynb", "identity_transform": "01b_data_loaders_pl.ipynb", "UnlabelledDataModule": "01b_data_loaders_pl.ipynb", "OmniglotDataModule": "01b_data_loaders_pl.ipynb", "MiniImagenetDataModule": "01b_data_loaders_pl.ipynb", "cg": "01c_grad_utils.ipynb", "cat_list_to_tensor": "01c_grad_utils.ipynb", "reverse_unroll": "01c_grad_utils.ipynb", "reverse": "01c_grad_utils.ipynb", "fixed_point": "01c_grad_utils.ipynb", "CG": "01c_grad_utils.ipynb", "CG_normaleq": "01c_grad_utils.ipynb", "neumann": "01c_grad_utils.ipynb", "exact": "01c_grad_utils.ipynb", "grd": "01c_grad_utils.ipynb", "list_dot": "01c_grad_utils.ipynb", "jvp": "01c_grad_utils.ipynb", "get_outer_gradients": "01c_grad_utils.ipynb", "update_tensor_grads": "01c_grad_utils.ipynb", "grad_unused_zero": "01c_grad_utils.ipynb", "DifferentiableOptimizer": "01c_grad_utils.ipynb", "HeavyBall": "01c_grad_utils.ipynb", "Momentum": "01c_grad_utils.ipynb", "GradientDescent": "01c_grad_utils.ipynb", "gd_step": "01c_grad_utils.ipynb", "heavy_ball_step": "01c_grad_utils.ipynb", "torch_momentum_step": "01c_grad_utils.ipynb", "euclidean_distance": "01d_proto_utils.ipynb", "cosine_similarity": "01d_proto_utils.ipynb", "get_num_samples": "01d_proto_utils.ipynb", "get_prototypes": "01d_proto_utils.ipynb", "prototypical_loss": "01d_proto_utils.ipynb", "clusterer": "01d_proto_utils.ipynb", "cluster_diff_loss": "01d_proto_utils.ipynb", "CNN_4Layer": "01d_proto_utils.ipynb", "Encoder": "01d_proto_utils.ipynb", "Decoder": "01d_proto_utils.ipynb", "CAE": "01d_proto_utils.ipynb", "Encoder4L": "01d_proto_utils.ipynb", "Decoder4L": "01d_proto_utils.ipynb", "Decoder4L4Mini": "01d_proto_utils.ipynb", "CAE4L": "01d_proto_utils.ipynb", "get_images_labels_from_dl": "01d_proto_utils.ipynb", "logger": "02_maml_pl.ipynb", "ConvolutionalNeuralNetwork": "02_maml_pl.ipynb", "MAML": "02_maml_pl.ipynb", "UMTRA": "02_maml_pl.ipynb", "cg_solve": "02b_iMAML.ipynb", "iMAML": "02b_iMAML.ipynb", "PrototypicalNetwork": "03_protonet_pl.ipynb", "CactusPrototypicalModel": "03_protonet_pl.ipynb", "ProtoModule": "03_protonet_pl.ipynb", "Classifier": "03b_ProtoCLR.ipynb", "get_train_images": "03b_ProtoCLR.ipynb", "WandbImageCallback": "03b_ProtoCLR.ipynb", "TensorBoardImageCallback": "03b_ProtoCLR.ipynb", "ConfidenceIntervalCallback": "03b_ProtoCLR.ipynb", "UMAPCallback": "03b_ProtoCLR.ipynb", "UMAPClusteringCallback": "03b_ProtoCLR.ipynb", "PCACallback": "03b_ProtoCLR.ipynb", "ProtoCLR": "03b_ProtoCLR.ipynb", "Partition": "04_cactus.ipynb", "CactusTaskDataset": "04_cactus.ipynb", "get_partitions_kmeans": "04_cactus.ipynb", "DataOpt": "04_cactus.ipynb", "LoaderOpt": "04_cactus.ipynb", "load": "04_cactus.ipynb", "CactusDataModule": "04_cactus.ipynb"} modules = ["nn_utils.py", "pl_dataloaders.py", "hypergrad.py", "proto_utils.py", "maml.py", "imaml.py", "protonets.py", "protoclr.py", "cactus.py"] doc_url = "https://ojss.github.io/unsupervised_meta_learning/" git_url = "https://github.com/ojss/unsupervised_meta_learning/tree/main/" def custom_doc_links(name): return None
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'c_imshow': '01_nn_utils.ipynb', 'Flatten': '01_nn_utils.ipynb', 'conv3x3': '01_nn_utils.ipynb', 'get_proto_accuracy': '01_nn_utils.ipynb', 'get_accuracy': '02_maml_pl.ipynb', 'collate_task': '01b_data_loaders_pl.ipynb', 'collate_task_batch': '01b_data_loaders_pl.ipynb', 'get_episode_loader': '01b_data_loaders_pl.ipynb', 'UnlabelledDataset': '01b_data_loaders_pl.ipynb', 'get_cub_default_transform': '01b_data_loaders_pl.ipynb', 'get_simCLR_transform': '01b_data_loaders_pl.ipynb', 'get_omniglot_transform': '01b_data_loaders_pl.ipynb', 'get_custom_transform': '01b_data_loaders_pl.ipynb', 'identity_transform': '01b_data_loaders_pl.ipynb', 'UnlabelledDataModule': '01b_data_loaders_pl.ipynb', 'OmniglotDataModule': '01b_data_loaders_pl.ipynb', 'MiniImagenetDataModule': '01b_data_loaders_pl.ipynb', 'cg': '01c_grad_utils.ipynb', 'cat_list_to_tensor': '01c_grad_utils.ipynb', 'reverse_unroll': '01c_grad_utils.ipynb', 'reverse': '01c_grad_utils.ipynb', 'fixed_point': '01c_grad_utils.ipynb', 'CG': '01c_grad_utils.ipynb', 'CG_normaleq': '01c_grad_utils.ipynb', 'neumann': '01c_grad_utils.ipynb', 'exact': '01c_grad_utils.ipynb', 'grd': '01c_grad_utils.ipynb', 'list_dot': '01c_grad_utils.ipynb', 'jvp': '01c_grad_utils.ipynb', 'get_outer_gradients': '01c_grad_utils.ipynb', 'update_tensor_grads': '01c_grad_utils.ipynb', 'grad_unused_zero': '01c_grad_utils.ipynb', 'DifferentiableOptimizer': '01c_grad_utils.ipynb', 'HeavyBall': '01c_grad_utils.ipynb', 'Momentum': '01c_grad_utils.ipynb', 'GradientDescent': '01c_grad_utils.ipynb', 'gd_step': '01c_grad_utils.ipynb', 'heavy_ball_step': '01c_grad_utils.ipynb', 'torch_momentum_step': '01c_grad_utils.ipynb', 'euclidean_distance': '01d_proto_utils.ipynb', 'cosine_similarity': '01d_proto_utils.ipynb', 'get_num_samples': '01d_proto_utils.ipynb', 'get_prototypes': '01d_proto_utils.ipynb', 'prototypical_loss': '01d_proto_utils.ipynb', 'clusterer': '01d_proto_utils.ipynb', 'cluster_diff_loss': '01d_proto_utils.ipynb', 'CNN_4Layer': '01d_proto_utils.ipynb', 'Encoder': '01d_proto_utils.ipynb', 'Decoder': '01d_proto_utils.ipynb', 'CAE': '01d_proto_utils.ipynb', 'Encoder4L': '01d_proto_utils.ipynb', 'Decoder4L': '01d_proto_utils.ipynb', 'Decoder4L4Mini': '01d_proto_utils.ipynb', 'CAE4L': '01d_proto_utils.ipynb', 'get_images_labels_from_dl': '01d_proto_utils.ipynb', 'logger': '02_maml_pl.ipynb', 'ConvolutionalNeuralNetwork': '02_maml_pl.ipynb', 'MAML': '02_maml_pl.ipynb', 'UMTRA': '02_maml_pl.ipynb', 'cg_solve': '02b_iMAML.ipynb', 'iMAML': '02b_iMAML.ipynb', 'PrototypicalNetwork': '03_protonet_pl.ipynb', 'CactusPrototypicalModel': '03_protonet_pl.ipynb', 'ProtoModule': '03_protonet_pl.ipynb', 'Classifier': '03b_ProtoCLR.ipynb', 'get_train_images': '03b_ProtoCLR.ipynb', 'WandbImageCallback': '03b_ProtoCLR.ipynb', 'TensorBoardImageCallback': '03b_ProtoCLR.ipynb', 'ConfidenceIntervalCallback': '03b_ProtoCLR.ipynb', 'UMAPCallback': '03b_ProtoCLR.ipynb', 'UMAPClusteringCallback': '03b_ProtoCLR.ipynb', 'PCACallback': '03b_ProtoCLR.ipynb', 'ProtoCLR': '03b_ProtoCLR.ipynb', 'Partition': '04_cactus.ipynb', 'CactusTaskDataset': '04_cactus.ipynb', 'get_partitions_kmeans': '04_cactus.ipynb', 'DataOpt': '04_cactus.ipynb', 'LoaderOpt': '04_cactus.ipynb', 'load': '04_cactus.ipynb', 'CactusDataModule': '04_cactus.ipynb'} modules = ['nn_utils.py', 'pl_dataloaders.py', 'hypergrad.py', 'proto_utils.py', 'maml.py', 'imaml.py', 'protonets.py', 'protoclr.py', 'cactus.py'] doc_url = 'https://ojss.github.io/unsupervised_meta_learning/' git_url = 'https://github.com/ojss/unsupervised_meta_learning/tree/main/' def custom_doc_links(name): return None
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' def add_permission(QueueUrl=None, Label=None, AWSAccountIds=None, Actions=None): """ Adds a permission to a queue for a specific principal . This allows sharing access to the queue. When you create a queue, you have full control access rights for the queue. Only you, the owner of the queue, can grant or deny permissions to the queue. For more information about these permissions, see Shared Queues in the Amazon SQS Developer Guide . See also: AWS API Documentation :example: response = client.add_permission( QueueUrl='string', Label='string', AWSAccountIds=[ 'string', ], Actions=[ 'string', ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue to which permissions are added. Queue URLs are case-sensitive. :type Label: string :param Label: [REQUIRED] The unique identification of the permission you're setting (for example, AliceSendMessage ). Maximum 80 characters. Allowed characters include alphanumeric characters, hyphens (- ), and underscores (_ ). :type AWSAccountIds: list :param AWSAccountIds: [REQUIRED] The AWS account number of the principal who is given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS. For information about locating the AWS account identification, see Your AWS Identifiers in the Amazon SQS Developer Guide . (string) -- :type Actions: list :param Actions: [REQUIRED] The action the client wants to allow for the specified principal. The following values are valid: * ChangeMessageVisibility DeleteMessage GetQueueAttributes GetQueueUrl ReceiveMessage SendMessage For more information about these actions, see Understanding Permissions in the Amazon SQS Developer Guide . Specifying SendMessage , DeleteMessage , or ChangeMessageVisibility for ActionName.n also grants permissions for the corresponding batch versions of those actions: SendMessageBatch , DeleteMessageBatch , and ChangeMessageVisibilityBatch . (string) -- """ pass def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). """ pass def change_message_visibility(QueueUrl=None, ReceiptHandle=None, VisibilityTimeout=None): """ Changes the visibility timeout of a specified message in a queue to a new value. The maximum allowed timeout value is 12 hours. Thus, you can't extend the timeout of a message in an existing queue to more than a total visibility timeout of 12 hours. For more information, see Visibility Timeout in the Amazon SQS Developer Guide . For example, you have a message and with the default visibility timeout of 5 minutes. After 3 minutes, you call ChangeMessageVisiblity with a timeout of 10 minutes. At that time, the timeout for the message is extended by 10 minutes beyond the time of the ChangeMessageVisibility action. This results in a total visibility timeout of 13 minutes. You can continue to call the ChangeMessageVisibility to extend the visibility timeout to a maximum of 12 hours. If you try to extend the visibility timeout beyond 12 hours, your request is rejected. A message is considered to be in flight after it's received from a queue by a consumer, but not yet deleted from the queue. For standard queues, there can be a maximum of 120,000 inflight messages per queue. If you reach this limit, Amazon SQS returns the OverLimit error message. To avoid reaching the limit, you should delete messages from the queue after they're processed. You can also increase the number of queues you use to process your messages. For FIFO queues, there can be a maximum of 20,000 inflight messages per queue. If you reach this limit, Amazon SQS returns no error messages. See also: AWS API Documentation :example: response = client.change_message_visibility( QueueUrl='string', ReceiptHandle='string', VisibilityTimeout=123 ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue whose message's visibility is changed. Queue URLs are case-sensitive. :type ReceiptHandle: string :param ReceiptHandle: [REQUIRED] The receipt handle associated with the message whose visibility timeout is changed. This parameter is returned by the `` ReceiveMessage `` action. :type VisibilityTimeout: integer :param VisibilityTimeout: [REQUIRED] The new value for the message's visibility timeout (in seconds). Values values: 0 to 43200 . Maximum: 12 hours. """ pass def change_message_visibility_batch(QueueUrl=None, Entries=None): """ Changes the visibility timeout of multiple messages. This is a batch version of `` ChangeMessageVisibility .`` The result of the action on each message is reported individually in the response. You can send up to 10 `` ChangeMessageVisibility `` requests with each ChangeMessageVisibilityBatch action. See also: AWS API Documentation :example: response = client.change_message_visibility_batch( QueueUrl='string', Entries=[ { 'Id': 'string', 'ReceiptHandle': 'string', 'VisibilityTimeout': 123 }, ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue whose messages' visibility is changed. Queue URLs are case-sensitive. :type Entries: list :param Entries: [REQUIRED] A list of receipt handles of the messages for which the visibility timeout must be changed. (dict) --Encloses a receipt handle and an entry id for each message in `` ChangeMessageVisibilityBatch .`` Warning All of the following list parameters must be prefixed with ChangeMessageVisibilityBatchRequestEntry.n , where n is an integer value starting with 1 . For example, a parameter list for this action might look like this: amp;ChangeMessageVisibilityBatchRequestEntry.1.Id=change_visibility_msg_2 amp;ChangeMessageVisibilityBatchRequestEntry.1.ReceiptHandle=replaceableYour_Receipt_Handle/replaceable amp;ChangeMessageVisibilityBatchRequestEntry.1.VisibilityTimeout=45 Id (string) -- [REQUIRED]An identifier for this particular receipt handle used to communicate the result. Note The Id s of a batch request need to be unique within a request ReceiptHandle (string) -- [REQUIRED]A receipt handle. VisibilityTimeout (integer) --The new value (in seconds) for the message's visibility timeout. :rtype: dict :return: { 'Successful': [ { 'Id': 'string' }, ], 'Failed': [ { 'Id': 'string', 'SenderFault': True|False, 'Code': 'string', 'Message': 'string' }, ] } """ pass def create_queue(QueueName=None, Attributes=None): """ Creates a new standard or FIFO queue. You can pass one or more attributes in the request. Keep the following caveats in mind: To successfully create a new queue, you must provide a queue name that adheres to the limits related to queues and is unique within the scope of your queues. To get the queue URL, use the `` GetQueueUrl `` action. `` GetQueueUrl `` requires only the QueueName parameter. be aware of existing queue names: See also: AWS API Documentation Examples The following operation creates an SQS queue named MyQueue. Expected Output: :example: response = client.create_queue( QueueName='string', Attributes={ 'string': 'string' } ) :type QueueName: string :param QueueName: [REQUIRED] The name of the new queue. The following limits apply to this name: A queue name can have up to 80 characters. Valid values: alphanumeric characters, hyphens (- ), and underscores (_ ). A FIFO queue name must end with the .fifo suffix. Queue names are case-sensitive. :type Attributes: dict :param Attributes: A map of attributes with their corresponding values. The following lists the names, descriptions, and values of the special request parameters that the CreateQueue action uses: DelaySeconds - The length of time, in seconds, for which the delivery of all messages in the queue is delayed. Valid values: An integer from 0 to 900 seconds (15 minutes). The default is 0 (zero). MaximumMessageSize - The limit of how many bytes a message can contain before Amazon SQS rejects it. Valid values: An integer from 1,024 bytes (1 KiB) to 262,144 bytes (256 KiB). The default is 262,144 (256 KiB). MessageRetentionPeriod - The length of time, in seconds, for which Amazon SQS retains a message. Valid values: An integer from 60 seconds (1 minute) to 1,209,600 seconds (14 days). The default is 345,600 (4 days). Policy - The queue's policy. A valid AWS policy. For more information about policy structure, see Overview of AWS IAM Policies in the Amazon IAM User Guide . ReceiveMessageWaitTimeSeconds - The length of time, in seconds, for which a `` ReceiveMessage `` action waits for a message to arrive. Valid values: An integer from 0 to 20 (seconds). The default is 0 (zero). RedrivePolicy - The parameters for the dead letter queue functionality of the source queue. For more information about the redrive policy and dead letter queues, see Using Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide . Note The dead letter queue of a FIFO queue must also be a FIFO queue. Similarly, the dead letter queue of a standard queue must also be a standard queue. VisibilityTimeout - The visibility timeout for the queue. Valid values: An integer from 0 to 43,200 (12 hours). The default is 30. For more information about the visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide . The following attributes apply only to server-side-encryption : KmsMasterKeyId - The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms . While the alias of the AWS-managed CMK for Amazon SQS is always alias/aws/sqs , the alias of a custom CMK can, for example, be alias/aws/sqs . For more examples, see KeyId in the AWS Key Management Service API Reference . KmsDataKeyReusePeriodSeconds - The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). The default is 300 (5 minutes). A shorter time period provides better security but results in more calls to KMS which incur charges after Free Tier. For more information, see How Does the Data Key Reuse Period Work? . The following attributes apply only to FIFO (first-in-first-out) queues : FifoQueue - Designates a queue as FIFO. Valid values: true , false . You can provide this attribute only during queue creation. You can't change it for an existing queue. When you set this attribute, you must also provide the MessageGroupId for your messages explicitly. For more information, see FIFO Queue Logic in the Amazon SQS Developer Guide . ContentBasedDeduplication - Enables content-based deduplication. Valid values: true , false . For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . Every message must have a unique MessageDeduplicationId , You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message). If you don't provide a MessageDeduplicationId and the queue doesn't have ContentBasedDeduplication set, the action fails with an error. If the queue has ContentBasedDeduplication set, your MessageDeduplicationId overrides the generated one. When ContentBasedDeduplication is in effect, messages with identical content sent within the deduplication interval are treated as duplicates and only one copy of the message is delivered. If you send one message with ContentBasedDeduplication enabled and then another message with a MessageDeduplicationId that is the same as the one generated for the first MessageDeduplicationId , the two messages are treated as duplicates and only one copy of the message is delivered. Any other valid special request parameters (such as the following) are ignored: ApproximateNumberOfMessages ApproximateNumberOfMessagesDelayed ApproximateNumberOfMessagesNotVisible CreatedTimestamp LastModifiedTimestamp QueueArn (string) -- (string) -- :rtype: dict :return: { 'QueueUrl': 'string' } :returns: If you don't provide a value for an attribute, the queue is created with the default value for the attribute. If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name. """ pass def delete_message(QueueUrl=None, ReceiptHandle=None): """ Deletes the specified message from the specified queue. You specify the message by using the message's receipt handle and not the MessageId you receive when you send the message. Even if the message is locked by another reader due to the visibility timeout setting, it is still deleted from the queue. If you leave a message in the queue for longer than the queue's configured retention period, Amazon SQS automatically deletes the message. See also: AWS API Documentation :example: response = client.delete_message( QueueUrl='string', ReceiptHandle='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue from which messages are deleted. Queue URLs are case-sensitive. :type ReceiptHandle: string :param ReceiptHandle: [REQUIRED] The receipt handle associated with the message to delete. """ pass def delete_message_batch(QueueUrl=None, Entries=None): """ Deletes up to ten messages from the specified queue. This is a batch version of `` DeleteMessage .`` The result of the action on each message is reported individually in the response. See also: AWS API Documentation :example: response = client.delete_message_batch( QueueUrl='string', Entries=[ { 'Id': 'string', 'ReceiptHandle': 'string' }, ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue from which messages are deleted. Queue URLs are case-sensitive. :type Entries: list :param Entries: [REQUIRED] A list of receipt handles for the messages to be deleted. (dict) --Encloses a receipt handle and an identifier for it. Id (string) -- [REQUIRED]An identifier for this particular receipt handle. This is used to communicate the result. Note The Id s of a batch request need to be unique within a request ReceiptHandle (string) -- [REQUIRED]A receipt handle. :rtype: dict :return: { 'Successful': [ { 'Id': 'string' }, ], 'Failed': [ { 'Id': 'string', 'SenderFault': True|False, 'Code': 'string', 'Message': 'string' }, ] } """ pass def delete_queue(QueueUrl=None): """ Deletes the queue specified by the QueueUrl , even if the queue is empty. If the specified queue doesn't exist, Amazon SQS returns a successful response. When you delete a queue, the deletion process takes up to 60 seconds. Requests you send involving that queue during the 60 seconds might succeed. For example, a `` SendMessage `` request might succeed, but after 60 seconds the queue and the message you sent no longer exist. When you delete a queue, you must wait at least 60 seconds before creating a queue with the same name. See also: AWS API Documentation :example: response = client.delete_queue( QueueUrl='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue to delete. Queue URLs are case-sensitive. """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to ClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By default, the http method is whatever is used in the method's model. """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} """ pass def get_queue_attributes(QueueUrl=None, AttributeNames=None): """ Gets attributes for the specified queue. See also: AWS API Documentation :example: response = client.get_queue_attributes( QueueUrl='string', AttributeNames=[ 'All'|'Policy'|'VisibilityTimeout'|'MaximumMessageSize'|'MessageRetentionPeriod'|'ApproximateNumberOfMessages'|'ApproximateNumberOfMessagesNotVisible'|'CreatedTimestamp'|'LastModifiedTimestamp'|'QueueArn'|'ApproximateNumberOfMessagesDelayed'|'DelaySeconds'|'ReceiveMessageWaitTimeSeconds'|'RedrivePolicy'|'FifoQueue'|'ContentBasedDeduplication'|'KmsMasterKeyId'|'KmsDataKeyReusePeriodSeconds', ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue whose attribute information is retrieved. Queue URLs are case-sensitive. :type AttributeNames: list :param AttributeNames: A list of attributes for which to retrieve information. Note In the future, new attributes might be added. If you write code that calls this action, we recommend that you structure your code so that it can handle new attributes gracefully. The following attributes are supported: All - Returns all values. ApproximateNumberOfMessages - Returns the approximate number of visible messages in a queue. For more information, see Resources Required to Process Messages in the Amazon SQS Developer Guide . ApproximateNumberOfMessagesDelayed - Returns the approximate number of messages that are waiting to be added to the queue. ApproximateNumberOfMessagesNotVisible - Returns the approximate number of messages that have not timed-out and aren't deleted. For more information, see Resources Required to Process Messages in the Amazon SQS Developer Guide . CreatedTimestamp - Returns the time when the queue was created in seconds (epoch time ). DelaySeconds - Returns the default delay on the queue in seconds. LastModifiedTimestamp - Returns the time when the queue was last changed in seconds (epoch time ). MaximumMessageSize - Returns the limit of how many bytes a message can contain before Amazon SQS rejects it. MessageRetentionPeriod - Returns the length of time, in seconds, for which Amazon SQS retains a message. Policy - Returns the policy of the queue. QueueArn - Returns the Amazon resource name (ARN) of the queue. ReceiveMessageWaitTimeSeconds - Returns the length of time, in seconds, for which the ReceiveMessage action waits for a message to arrive. RedrivePolicy - Returns the parameters for dead letter queue functionality of the source queue. For more information about the redrive policy and dead letter queues, see Using Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide . VisibilityTimeout - Returns the visibility timeout for the queue. For more information about the visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide . The following attributes apply only to server-side-encryption : KmsMasterKeyId - Returns the ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms . KmsDataKeyReusePeriodSeconds - Returns the length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. The following attributes apply only to FIFO (first-in-first-out) queues : FifoQueue - Returns whether the queue is FIFO. For more information, see FIFO Queue Logic in the Amazon SQS Developer Guide . Note To determine whether a queue is FIFO , you can check whether QueueName ends with the .fifo suffix. ContentBasedDeduplication - Returns whether content-based deduplication is enabled for the queue. For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . (string) -- :rtype: dict :return: { 'Attributes': { 'string': 'string' } } :returns: (string) -- (string) -- """ pass def get_queue_url(QueueName=None, QueueOwnerAWSAccountId=None): """ Returns the URL of an existing queue. This action provides a simple way to retrieve the URL of an Amazon SQS queue. To access a queue that belongs to another AWS account, use the QueueOwnerAWSAccountId parameter to specify the account ID of the queue's owner. The queue's owner must grant you permission to access the queue. For more information about shared queue access, see `` AddPermission `` or see Shared Queues in the Amazon SQS Developer Guide . See also: AWS API Documentation Examples The following example retrieves the queue ARN. Expected Output: :example: response = client.get_queue_url( QueueName='string', QueueOwnerAWSAccountId='string' ) :type QueueName: string :param QueueName: [REQUIRED] The name of the queue whose URL must be fetched. Maximum 80 characters. Valid values: alphanumeric characters, hyphens (- ), and underscores (_ ). Queue names are case-sensitive. :type QueueOwnerAWSAccountId: string :param QueueOwnerAWSAccountId: The AWS account ID of the account that created the queue. :rtype: dict :return: { 'QueueUrl': 'string' } """ pass def get_waiter(): """ """ pass def list_dead_letter_source_queues(QueueUrl=None): """ Returns a list of your queues that have the RedrivePolicy queue attribute configured with a dead letter queue. For more information about using dead letter queues, see Using Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide . See also: AWS API Documentation :example: response = client.list_dead_letter_source_queues( QueueUrl='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of a dead letter queue. Queue URLs are case-sensitive. :rtype: dict :return: { 'queueUrls': [ 'string', ] } """ pass def list_queues(QueueNamePrefix=None): """ Returns a list of your queues. The maximum number of queues that can be returned is 1,000. If you specify a value for the optional QueueNamePrefix parameter, only queues with a name that begins with the specified value are returned. See also: AWS API Documentation :example: response = client.list_queues( QueueNamePrefix='string' ) :type QueueNamePrefix: string :param QueueNamePrefix: A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned. Queue names are case-sensitive. :rtype: dict :return: { 'QueueUrls': [ 'string', ] } """ pass def purge_queue(QueueUrl=None): """ Deletes the messages in a queue specified by the QueueURL parameter. When you purge a queue, the message deletion process takes up to 60 seconds. All messages sent to the queue before calling the PurgeQueue action are deleted. Messages sent to the queue while it is being purged might be deleted. While the queue is being purged, messages sent to the queue before PurgeQueue is called might be received, but are deleted within the next minute. See also: AWS API Documentation :example: response = client.purge_queue( QueueUrl='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the queue from which the PurgeQueue action deletes messages. Queue URLs are case-sensitive. """ pass def receive_message(QueueUrl=None, AttributeNames=None, MessageAttributeNames=None, MaxNumberOfMessages=None, VisibilityTimeout=None, WaitTimeSeconds=None, ReceiveRequestAttemptId=None): """ Retrieves one or more messages (up to 10), from the specified queue. Using the WaitTimeSeconds parameter enables long-poll support. For more information, see Amazon SQS Long Polling in the Amazon SQS Developer Guide . Short poll is the default behavior where a weighted random set of machines is sampled on a ReceiveMessage call. Thus, only the messages on the sampled machines are returned. If the number of messages in the queue is small (fewer than 1,000), you most likely get fewer messages than you requested per ReceiveMessage call. If the number of messages in the queue is extremely small, you might not receive any messages in a particular ReceiveMessage response. If this happens, repeat the request. For each message returned, the response includes the following: The receipt handle is the identifier you must provide when deleting the message. For more information, see Queue and Message Identifiers in the Amazon SQS Developer Guide . You can provide the VisibilityTimeout parameter in your request. The parameter is applied to the messages that Amazon SQS returns in the response. If you don't include the parameter, the overall visibility timeout for the queue is used for the returned messages. For more information, see Visibility Timeout in the Amazon SQS Developer Guide . A message that isn't deleted or a message whose visibility isn't extended before the visibility timeout expires counts as a failed receive. Depending on the configuration of the queue, the message might be sent to the dead letter queue. See also: AWS API Documentation :example: response = client.receive_message( QueueUrl='string', AttributeNames=[ 'All'|'Policy'|'VisibilityTimeout'|'MaximumMessageSize'|'MessageRetentionPeriod'|'ApproximateNumberOfMessages'|'ApproximateNumberOfMessagesNotVisible'|'CreatedTimestamp'|'LastModifiedTimestamp'|'QueueArn'|'ApproximateNumberOfMessagesDelayed'|'DelaySeconds'|'ReceiveMessageWaitTimeSeconds'|'RedrivePolicy'|'FifoQueue'|'ContentBasedDeduplication'|'KmsMasterKeyId'|'KmsDataKeyReusePeriodSeconds', ], MessageAttributeNames=[ 'string', ], MaxNumberOfMessages=123, VisibilityTimeout=123, WaitTimeSeconds=123, ReceiveRequestAttemptId='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue from which messages are received. Queue URLs are case-sensitive. :type AttributeNames: list :param AttributeNames: A list of attributes that need to be returned along with each message. These attributes include: All - Returns all values. ApproximateFirstReceiveTimestamp - Returns the time the message was first received from the queue (epoch time in milliseconds). ApproximateReceiveCount - Returns the number of times a message has been received from the queue but not deleted. SenderId For an IAM user, returns the IAM user ID, for example ABCDEFGHI1JKLMNOPQ23R . For an IAM role, returns the IAM role ID, for example ABCDE1F2GH3I4JK5LMNOP:i-a123b456 . SentTimestamp - Returns the time the message was sent to the queue (epoch time in milliseconds). MessageDeduplicationId - Returns the value provided by the sender that calls the `` SendMessage `` action. MessageGroupId - Returns the value provided by the sender that calls the `` SendMessage `` action. Messages with the same MessageGroupId are returned in sequence. SequenceNumber - Returns the value provided by Amazon SQS. Any other valid special request parameters (such as the following) are ignored: ApproximateNumberOfMessages ApproximateNumberOfMessagesDelayed ApproximateNumberOfMessagesNotVisible CreatedTimestamp ContentBasedDeduplication DelaySeconds FifoQueue LastModifiedTimestamp MaximumMessageSize MessageRetentionPeriod Policy QueueArn , ReceiveMessageWaitTimeSeconds RedrivePolicy VisibilityTimeout (string) -- :type MessageAttributeNames: list :param MessageAttributeNames: The name of the message attribute, where N is the index. The name can contain alphanumeric characters and the underscore (_ ), hyphen (- ), and period (. ). The name is case-sensitive and must be unique among all attribute names for the message. The name must not start with AWS-reserved prefixes such as AWS. or Amazon. (or any casing variants). The name must not start or end with a period (. ), and it should not have periods in succession (.. ). The name can be up to 256 characters long. When using ReceiveMessage , you can send a list of attribute names to receive, or you can return all of the attributes by specifying All or .* in your request. You can also use all message attributes starting with a prefix, for example bar.* . (string) -- :type MaxNumberOfMessages: integer :param MaxNumberOfMessages: The maximum number of messages to return. Amazon SQS never returns more messages than this value (however, fewer messages might be returned). Valid values are 1 to 10. Default is 1. :type VisibilityTimeout: integer :param VisibilityTimeout: The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request. :type WaitTimeSeconds: integer :param WaitTimeSeconds: The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner than WaitTimeSeconds . :type ReceiveRequestAttemptId: string :param ReceiveRequestAttemptId: This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of ReceiveMessage calls. If a networking issue occurs after a ReceiveMessage action, and instead of a response you receive a generic error, you can retry the same action with an identical ReceiveRequestAttemptId to retrieve the same set of messages, even if their visibility timeout has not yet expired. You can use ReceiveRequestAttemptId only for 5 minutes after a ReceiveMessage action. When you set FifoQueue , a caller of the ReceiveMessage action can provide a ReceiveRequestAttemptId explicitly. If a caller of the ReceiveMessage action doesn't provide a ReceiveRequestAttemptId , Amazon SQS generates a ReceiveRequestAttemptId . You can retry the ReceiveMessage action with the same ReceiveRequestAttemptId if none of the messages have been modified (deleted or had their visibility changes). During a visibility timeout, subsequent calls with the same ReceiveRequestAttemptId return the same messages and receipt handles. If a retry occurs within the deduplication interval, it resets the visibility timeout. For more information, see Visibility Timeout in the Amazon Simple Queue Service Developer Guide . Warning If a caller of the ReceiveMessage action is still processing messages when the visibility timeout expires and messages become visible, another worker reading from the same queue can receive the same messages and therefore process duplicates. Also, if a reader whose message processing time is longer than the visibility timeout tries to delete the processed messages, the action fails with an error. To mitigate this effect, ensure that your application observes a safe threshold before the visibility timeout expires and extend the visibility timeout as necessary. While messages with a particular MessageGroupId are invisible, no more messages belonging to the same MessageGroupId are returned until the visibility timeout expires. You can still receive messages with another MessageGroupId as long as it is also visible. If a caller of ReceiveMessage can't track the ReceiveRequestAttemptId , no retries work until the original visibility timeout expires. As a result, delays might occur but the messages in the queue remain in a strict order. The length of ReceiveRequestAttemptId is 128 characters. ReceiveRequestAttemptId can contain alphanumeric characters (a-z , A-Z , 0-9 ) and punctuation (!'#$%'()*+,-./:;=?@[\]^_`{|}~ ). For best practices of using ReceiveRequestAttemptId , see Using the ReceiveRequestAttemptId Request Parameter in the Amazon Simple Queue Service Developer Guide . :rtype: dict :return: { 'Messages': [ { 'MessageId': 'string', 'ReceiptHandle': 'string', 'MD5OfBody': 'string', 'Body': 'string', 'Attributes': { 'string': 'string' }, 'MD5OfMessageAttributes': 'string', 'MessageAttributes': { 'string': { 'StringValue': 'string', 'BinaryValue': b'bytes', 'StringListValues': [ 'string', ], 'BinaryListValues': [ b'bytes', ], 'DataType': 'string' } } }, ] } :returns: QueueUrl (string) -- [REQUIRED] The URL of the Amazon SQS queue from which messages are received. Queue URLs are case-sensitive. AttributeNames (list) -- A list of attributes that need to be returned along with each message. These attributes include: All - Returns all values. ApproximateFirstReceiveTimestamp - Returns the time the message was first received from the queue (epoch time in milliseconds). ApproximateReceiveCount - Returns the number of times a message has been received from the queue but not deleted. SenderId For an IAM user, returns the IAM user ID, for example ABCDEFGHI1JKLMNOPQ23R . For an IAM role, returns the IAM role ID, for example ABCDE1F2GH3I4JK5LMNOP:i-a123b456 . SentTimestamp - Returns the time the message was sent to the queue (epoch time in milliseconds). MessageDeduplicationId - Returns the value provided by the sender that calls the `` SendMessage `` action. MessageGroupId - Returns the value provided by the sender that calls the `` SendMessage `` action. Messages with the same MessageGroupId are returned in sequence. SequenceNumber - Returns the value provided by Amazon SQS. Any other valid special request parameters (such as the following) are ignored: ApproximateNumberOfMessages ApproximateNumberOfMessagesDelayed ApproximateNumberOfMessagesNotVisible CreatedTimestamp ContentBasedDeduplication DelaySeconds FifoQueue LastModifiedTimestamp MaximumMessageSize MessageRetentionPeriod Policy QueueArn , ReceiveMessageWaitTimeSeconds RedrivePolicy VisibilityTimeout (string) -- MessageAttributeNames (list) -- The name of the message attribute, where N is the index. The name can contain alphanumeric characters and the underscore (_ ), hyphen (- ), and period (. ). The name is case-sensitive and must be unique among all attribute names for the message. The name must not start with AWS-reserved prefixes such as AWS. or Amazon. (or any casing variants). The name must not start or end with a period (. ), and it should not have periods in succession (.. ). The name can be up to 256 characters long. When using ReceiveMessage , you can send a list of attribute names to receive, or you can return all of the attributes by specifying All or .* in your request. You can also use all message attributes starting with a prefix, for example bar.* . (string) -- MaxNumberOfMessages (integer) -- The maximum number of messages to return. Amazon SQS never returns more messages than this value (however, fewer messages might be returned). Valid values are 1 to 10. Default is 1. VisibilityTimeout (integer) -- The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request. WaitTimeSeconds (integer) -- The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner than WaitTimeSeconds . ReceiveRequestAttemptId (string) -- This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of ReceiveMessage calls. If a networking issue occurs after a ReceiveMessage action, and instead of a response you receive a generic error, you can retry the same action with an identical ReceiveRequestAttemptId to retrieve the same set of messages, even if their visibility timeout has not yet expired. You can use ReceiveRequestAttemptId only for 5 minutes after a ReceiveMessage action. When you set FifoQueue , a caller of the ReceiveMessage action can provide a ReceiveRequestAttemptId explicitly. If a caller of the ReceiveMessage action doesn't provide a ReceiveRequestAttemptId , Amazon SQS generates a ReceiveRequestAttemptId . You can retry the ReceiveMessage action with the same ReceiveRequestAttemptId if none of the messages have been modified (deleted or had their visibility changes). During a visibility timeout, subsequent calls with the same ReceiveRequestAttemptId return the same messages and receipt handles. If a retry occurs within the deduplication interval, it resets the visibility timeout. For more information, see Visibility Timeout in the Amazon Simple Queue Service Developer Guide . Warning If a caller of the ReceiveMessage action is still processing messages when the visibility timeout expires and messages become visible, another worker reading from the same queue can receive the same messages and therefore process duplicates. Also, if a reader whose message processing time is longer than the visibility timeout tries to delete the processed messages, the action fails with an error. To mitigate this effect, ensure that your application observes a safe threshold before the visibility timeout expires and extend the visibility timeout as necessary. While messages with a particular MessageGroupId are invisible, no more messages belonging to the same MessageGroupId are returned until the visibility timeout expires. You can still receive messages with another MessageGroupId as long as it is also visible. If a caller of ReceiveMessage can't track the ReceiveRequestAttemptId , no retries work until the original visibility timeout expires. As a result, delays might occur but the messages in the queue remain in a strict order. The length of ReceiveRequestAttemptId is 128 characters. ReceiveRequestAttemptId can contain alphanumeric characters (a-z , A-Z , 0-9 ) and punctuation (!"#$%'()*+,-./:;=?@[\]^_`{|}~ ). For best practices of using ReceiveRequestAttemptId , see Using the ReceiveRequestAttemptId Request Parameter in the Amazon Simple Queue Service Developer Guide . """ pass def remove_permission(QueueUrl=None, Label=None): """ Revokes any permissions in the queue policy that matches the specified Label parameter. Only the owner of the queue can remove permissions. See also: AWS API Documentation :example: response = client.remove_permission( QueueUrl='string', Label='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue from which permissions are removed. Queue URLs are case-sensitive. :type Label: string :param Label: [REQUIRED] The identification of the permission to remove. This is the label added using the `` AddPermission `` action. """ pass def send_message(QueueUrl=None, MessageBody=None, DelaySeconds=None, MessageAttributes=None, MessageDeduplicationId=None, MessageGroupId=None): """ Delivers a message to the specified queue. See also: AWS API Documentation :example: response = client.send_message( QueueUrl='string', MessageBody='string', DelaySeconds=123, MessageAttributes={ 'string': { 'StringValue': 'string', 'BinaryValue': b'bytes', 'StringListValues': [ 'string', ], 'BinaryListValues': [ b'bytes', ], 'DataType': 'string' } }, MessageDeduplicationId='string', MessageGroupId='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue to which a message is sent. Queue URLs are case-sensitive. :type MessageBody: string :param MessageBody: [REQUIRED] The message to send. The maximum string size is 256 KB. Warning A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed: #x9 | #xA | #xD | #x20 to #xD7FF | #xE000 to #xFFFD | #x10000 to #x10FFFF Any characters not included in this list will be rejected. For more information, see the W3C specification for characters . :type DelaySeconds: integer :param DelaySeconds: The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive DelaySeconds value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. Note When you set FifoQueue , you can't set DelaySeconds per message. You can set this parameter only on a queue level. :type MessageAttributes: dict :param MessageAttributes: Each message attribute consists of a Name , Type , and Value . For more information, see Message Attribute Items and Validation in the Amazon SQS Developer Guide . (string) -- (dict) --The user-specified message attribute value. For string data types, the Value attribute has the same restrictions on the content as the message body. For more information, see `` SendMessage .`` Name , type , value and the message body must not be empty or null. All parts of the message attribute, including Name , Type , and Value , are part of the message size restriction (256 KB or 262,144 bytes). StringValue (string) --Strings are Unicode with UTF-8 binary encoding. For a list of code values, see ASCII Printable Characters . BinaryValue (bytes) --Binary type attributes can store any binary data, such as compressed data, encrypted data, or images. StringListValues (list) --Not implemented. Reserved for future use. (string) -- BinaryListValues (list) --Not implemented. Reserved for future use. (bytes) -- DataType (string) -- [REQUIRED]Amazon SQS supports the following logical data types: String , Number , and Binary . For the Number data type, you must use StringValue . You can also append custom labels. For more information, see Message Attribute Data Types and Validation in the Amazon SQS Developer Guide . :type MessageDeduplicationId: string :param MessageDeduplicationId: This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of sent messages. If a message with a particular MessageDeduplicationId is sent successfully, any messages sent with the same MessageDeduplicationId are accepted successfully but aren't delivered during the 5-minute deduplication interval. For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . Every message must have a unique MessageDeduplicationId , You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message). If you don't provide a MessageDeduplicationId and the queue doesn't have ContentBasedDeduplication set, the action fails with an error. If the queue has ContentBasedDeduplication set, your MessageDeduplicationId overrides the generated one. When ContentBasedDeduplication is in effect, messages with identical content sent within the deduplication interval are treated as duplicates and only one copy of the message is delivered. If you send one message with ContentBasedDeduplication enabled and then another message with a MessageDeduplicationId that is the same as the one generated for the first MessageDeduplicationId , the two messages are treated as duplicates and only one copy of the message is delivered. Note The MessageDeduplicationId is available to the recipient of the message (this can be useful for troubleshooting delivery issues). If a message is sent successfully but the acknowledgement is lost and the message is resent with the same MessageDeduplicationId after the deduplication interval, Amazon SQS can't detect duplicate messages. The length of MessageDeduplicationId is 128 characters. MessageDeduplicationId can contain alphanumeric characters (a-z , A-Z , 0-9 ) and punctuation (!'#$%'()*+,-./:;=?@[\]^_`{|}~ ). For best practices of using MessageDeduplicationId , see Using the MessageDeduplicationId Property in the Amazon Simple Queue Service Developer Guide . :type MessageGroupId: string :param MessageGroupId: This parameter applies only to FIFO (first-in-first-out) queues. The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). To interleave multiple ordered streams within a single queue, use MessageGroupId values (for example, session data for multiple users). In this scenario, multiple readers can process the queue, but the session data of each user is processed in a FIFO fashion. You must associate a non-empty MessageGroupId with a message. If you don't provide a MessageGroupId , the action fails. ReceiveMessage might return messages with multiple MessageGroupId values. For each MessageGroupId , the messages are sorted by time sent. The caller can't specify a MessageGroupId . The length of MessageGroupId is 128 characters. Valid values are alphanumeric characters and punctuation (!'#$%'()*+,-./:;=?@[\]^_`{|}~) . For best practices of using MessageGroupId , see Using the MessageGroupId Property in the Amazon Simple Queue Service Developer Guide . Warning MessageGroupId is required for FIFO queues. You can't use it for Standard queues. :rtype: dict :return: { 'MD5OfMessageBody': 'string', 'MD5OfMessageAttributes': 'string', 'MessageId': 'string', 'SequenceNumber': 'string' } """ pass def send_message_batch(QueueUrl=None, Entries=None): """ Delivers up to ten messages to the specified queue. This is a batch version of `` SendMessage .`` For a FIFO queue, multiple messages within a single batch are enqueued in the order they are sent. The result of sending each message is reported individually in the response. Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200 . The maximum allowed individual message size and the maximum total payload size (the sum of the individual lengths of all of the batched messages) are both 256 KB (262,144 bytes). If you don't specify the DelaySeconds parameter for an entry, Amazon SQS uses the default value for the queue. See also: AWS API Documentation :example: response = client.send_message_batch( QueueUrl='string', Entries=[ { 'Id': 'string', 'MessageBody': 'string', 'DelaySeconds': 123, 'MessageAttributes': { 'string': { 'StringValue': 'string', 'BinaryValue': b'bytes', 'StringListValues': [ 'string', ], 'BinaryListValues': [ b'bytes', ], 'DataType': 'string' } }, 'MessageDeduplicationId': 'string', 'MessageGroupId': 'string' }, ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue to which batched messages are sent. Queue URLs are case-sensitive. :type Entries: list :param Entries: [REQUIRED] A list of `` SendMessageBatchRequestEntry `` items. (dict) --Contains the details of a single Amazon SQS message along with an Id . Id (string) -- [REQUIRED]An identifier for a message in this batch used to communicate the result. Note The Id s of a batch request need to be unique within a request MessageBody (string) -- [REQUIRED]The body of the message. DelaySeconds (integer) --The length of time, in seconds, for which a specific message is delayed. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive DelaySeconds value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue is applied. Note When you set FifoQueue , you can't set DelaySeconds per message. You can set this parameter only on a queue level. MessageAttributes (dict) --Each message attribute consists of a Name , Type , and Value . For more information, see Message Attribute Items and Validation in the Amazon SQS Developer Guide . (string) -- (dict) --The user-specified message attribute value. For string data types, the Value attribute has the same restrictions on the content as the message body. For more information, see `` SendMessage .`` Name , type , value and the message body must not be empty or null. All parts of the message attribute, including Name , Type , and Value , are part of the message size restriction (256 KB or 262,144 bytes). StringValue (string) --Strings are Unicode with UTF-8 binary encoding. For a list of code values, see ASCII Printable Characters . BinaryValue (bytes) --Binary type attributes can store any binary data, such as compressed data, encrypted data, or images. StringListValues (list) --Not implemented. Reserved for future use. (string) -- BinaryListValues (list) --Not implemented. Reserved for future use. (bytes) -- DataType (string) -- [REQUIRED]Amazon SQS supports the following logical data types: String , Number , and Binary . For the Number data type, you must use StringValue . You can also append custom labels. For more information, see Message Attribute Data Types and Validation in the Amazon SQS Developer Guide . MessageDeduplicationId (string) --This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of messages within a 5-minute minimum deduplication interval. If a message with a particular MessageDeduplicationId is sent successfully, subsequent messages with the same MessageDeduplicationId are accepted successfully but aren't delivered. For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . Every message must have a unique MessageDeduplicationId , You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message). If you don't provide a MessageDeduplicationId and the queue doesn't have ContentBasedDeduplication set, the action fails with an error. If the queue has ContentBasedDeduplication set, your MessageDeduplicationId overrides the generated one. When ContentBasedDeduplication is in effect, messages with identical content sent within the deduplication interval are treated as duplicates and only one copy of the message is delivered. If you send one message with ContentBasedDeduplication enabled and then another message with a MessageDeduplicationId that is the same as the one generated for the first MessageDeduplicationId , the two messages are treated as duplicates and only one copy of the message is delivered. Note The MessageDeduplicationId is available to the recipient of the message (this can be useful for troubleshooting delivery issues). If a message is sent successfully but the acknowledgement is lost and the message is resent with the same MessageDeduplicationId after the deduplication interval, Amazon SQS can't detect duplicate messages. The length of MessageDeduplicationId is 128 characters. MessageDeduplicationId can contain alphanumeric characters (a-z , A-Z , 0-9 ) and punctuation (!'#$%'()*+,-./:;=?@[\]^_`{|}~ ). For best practices of using MessageDeduplicationId , see Using the MessageDeduplicationId Property in the Amazon Simple Queue Service Developer Guide . MessageGroupId (string) --This parameter applies only to FIFO (first-in-first-out) queues. The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). To interleave multiple ordered streams within a single queue, use MessageGroupId values (for example, session data for multiple users). In this scenario, multiple readers can process the queue, but the session data of each user is processed in a FIFO fashion. You must associate a non-empty MessageGroupId with a message. If you don't provide a MessageGroupId , the action fails. ReceiveMessage might return messages with multiple MessageGroupId values. For each MessageGroupId , the messages are sorted by time sent. The caller can't specify a MessageGroupId . The length of MessageGroupId is 128 characters. Valid values are alphanumeric characters and punctuation (!'#$%'()*+,-./:;=?@[\]^_`{|}~) . For best practices of using MessageGroupId , see Using the MessageGroupId Property in the Amazon Simple Queue Service Developer Guide . Warning MessageGroupId is required for FIFO queues. You can't use it for Standard queues. :rtype: dict :return: { 'Successful': [ { 'Id': 'string', 'MessageId': 'string', 'MD5OfMessageBody': 'string', 'MD5OfMessageAttributes': 'string', 'SequenceNumber': 'string' }, ], 'Failed': [ { 'Id': 'string', 'SenderFault': True|False, 'Code': 'string', 'Message': 'string' }, ] } """ pass def set_queue_attributes(QueueUrl=None, Attributes=None): """ Sets the value of one or more queue attributes. When you change a queue's attributes, the change can take up to 60 seconds for most of the attributes to propagate throughout the Amazon SQS system. Changes made to the MessageRetentionPeriod attribute can take up to 15 minutes. See also: AWS API Documentation :example: response = client.set_queue_attributes( QueueUrl='string', Attributes={ 'string': 'string' } ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue whose attributes are set. Queue URLs are case-sensitive. :type Attributes: dict :param Attributes: [REQUIRED] A map of attributes to set. The following lists the names, descriptions, and values of the special request parameters that the SetQueueAttributes action uses: DelaySeconds - The length of time, in seconds, for which the delivery of all messages in the queue is delayed. Valid values: An integer from 0 to 900 (15 minutes). The default is 0 (zero). MaximumMessageSize - The limit of how many bytes a message can contain before Amazon SQS rejects it. Valid values: An integer from 1,024 bytes (1 KiB) up to 262,144 bytes (256 KiB). The default is 262,144 (256 KiB). MessageRetentionPeriod - The length of time, in seconds, for which Amazon SQS retains a message. Valid values: An integer representing seconds, from 60 (1 minute) to 1,209,600 (14 days). The default is 345,600 (4 days). Policy - The queue's policy. A valid AWS policy. For more information about policy structure, see Overview of AWS IAM Policies in the Amazon IAM User Guide . ReceiveMessageWaitTimeSeconds - The length of time, in seconds, for which a `` ReceiveMessage `` action waits for a message to arrive. Valid values: an integer from 0 to 20 (seconds). The default is 0. RedrivePolicy - The parameters for the dead letter queue functionality of the source queue. For more information about the redrive policy and dead letter queues, see Using Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide . Note The dead letter queue of a FIFO queue must also be a FIFO queue. Similarly, the dead letter queue of a standard queue must also be a standard queue. VisibilityTimeout - The visibility timeout for the queue. Valid values: an integer from 0 to 43,200 (12 hours). The default is 30. For more information about the visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide . The following attributes apply only to server-side-encryption : KmsMasterKeyId - The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms . While the alias of the AWS-managed CMK for Amazon SQS is always alias/aws/sqs , the alias of a custom CMK can, for example, be alias/aws/sqs . For more examples, see KeyId in the AWS Key Management Service API Reference . KmsDataKeyReusePeriodSeconds - The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). The default is 300 (5 minutes). A shorter time period provides better security but results in more calls to KMS which incur charges after Free Tier. For more information, see How Does the Data Key Reuse Period Work? . The following attribute applies only to FIFO (first-in-first-out) queues : ContentBasedDeduplication - Enables content-based deduplication. For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . Every message must have a unique MessageDeduplicationId , You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message). If you don't provide a MessageDeduplicationId and the queue doesn't have ContentBasedDeduplication set, the action fails with an error. If the queue has ContentBasedDeduplication set, your MessageDeduplicationId overrides the generated one. When ContentBasedDeduplication is in effect, messages with identical content sent within the deduplication interval are treated as duplicates and only one copy of the message is delivered. If you send one message with ContentBasedDeduplication enabled and then another message with a MessageDeduplicationId that is the same as the one generated for the first MessageDeduplicationId , the two messages are treated as duplicates and only one copy of the message is delivered. Any other valid special request parameters (such as the following) are ignored: ApproximateNumberOfMessages ApproximateNumberOfMessagesDelayed ApproximateNumberOfMessagesNotVisible CreatedTimestamp LastModifiedTimestamp QueueArn (string) -- (string) -- """ pass
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ def add_permission(QueueUrl=None, Label=None, AWSAccountIds=None, Actions=None): """ Adds a permission to a queue for a specific principal . This allows sharing access to the queue. When you create a queue, you have full control access rights for the queue. Only you, the owner of the queue, can grant or deny permissions to the queue. For more information about these permissions, see Shared Queues in the Amazon SQS Developer Guide . See also: AWS API Documentation :example: response = client.add_permission( QueueUrl='string', Label='string', AWSAccountIds=[ 'string', ], Actions=[ 'string', ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue to which permissions are added. Queue URLs are case-sensitive. :type Label: string :param Label: [REQUIRED] The unique identification of the permission you're setting (for example, AliceSendMessage ). Maximum 80 characters. Allowed characters include alphanumeric characters, hyphens (- ), and underscores (_ ). :type AWSAccountIds: list :param AWSAccountIds: [REQUIRED] The AWS account number of the principal who is given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS. For information about locating the AWS account identification, see Your AWS Identifiers in the Amazon SQS Developer Guide . (string) -- :type Actions: list :param Actions: [REQUIRED] The action the client wants to allow for the specified principal. The following values are valid: * ChangeMessageVisibility DeleteMessage GetQueueAttributes GetQueueUrl ReceiveMessage SendMessage For more information about these actions, see Understanding Permissions in the Amazon SQS Developer Guide . Specifying SendMessage , DeleteMessage , or ChangeMessageVisibility for ActionName.n also grants permissions for the corresponding batch versions of those actions: SendMessageBatch , DeleteMessageBatch , and ChangeMessageVisibilityBatch . (string) -- """ pass def can_paginate(operation_name=None): """ Check if an operation can be paginated. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). """ pass def change_message_visibility(QueueUrl=None, ReceiptHandle=None, VisibilityTimeout=None): """ Changes the visibility timeout of a specified message in a queue to a new value. The maximum allowed timeout value is 12 hours. Thus, you can't extend the timeout of a message in an existing queue to more than a total visibility timeout of 12 hours. For more information, see Visibility Timeout in the Amazon SQS Developer Guide . For example, you have a message and with the default visibility timeout of 5 minutes. After 3 minutes, you call ChangeMessageVisiblity with a timeout of 10 minutes. At that time, the timeout for the message is extended by 10 minutes beyond the time of the ChangeMessageVisibility action. This results in a total visibility timeout of 13 minutes. You can continue to call the ChangeMessageVisibility to extend the visibility timeout to a maximum of 12 hours. If you try to extend the visibility timeout beyond 12 hours, your request is rejected. A message is considered to be in flight after it's received from a queue by a consumer, but not yet deleted from the queue. For standard queues, there can be a maximum of 120,000 inflight messages per queue. If you reach this limit, Amazon SQS returns the OverLimit error message. To avoid reaching the limit, you should delete messages from the queue after they're processed. You can also increase the number of queues you use to process your messages. For FIFO queues, there can be a maximum of 20,000 inflight messages per queue. If you reach this limit, Amazon SQS returns no error messages. See also: AWS API Documentation :example: response = client.change_message_visibility( QueueUrl='string', ReceiptHandle='string', VisibilityTimeout=123 ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue whose message's visibility is changed. Queue URLs are case-sensitive. :type ReceiptHandle: string :param ReceiptHandle: [REQUIRED] The receipt handle associated with the message whose visibility timeout is changed. This parameter is returned by the `` ReceiveMessage `` action. :type VisibilityTimeout: integer :param VisibilityTimeout: [REQUIRED] The new value for the message's visibility timeout (in seconds). Values values: 0 to 43200 . Maximum: 12 hours. """ pass def change_message_visibility_batch(QueueUrl=None, Entries=None): """ Changes the visibility timeout of multiple messages. This is a batch version of `` ChangeMessageVisibility .`` The result of the action on each message is reported individually in the response. You can send up to 10 `` ChangeMessageVisibility `` requests with each ChangeMessageVisibilityBatch action. See also: AWS API Documentation :example: response = client.change_message_visibility_batch( QueueUrl='string', Entries=[ { 'Id': 'string', 'ReceiptHandle': 'string', 'VisibilityTimeout': 123 }, ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue whose messages' visibility is changed. Queue URLs are case-sensitive. :type Entries: list :param Entries: [REQUIRED] A list of receipt handles of the messages for which the visibility timeout must be changed. (dict) --Encloses a receipt handle and an entry id for each message in `` ChangeMessageVisibilityBatch .`` Warning All of the following list parameters must be prefixed with ChangeMessageVisibilityBatchRequestEntry.n , where n is an integer value starting with 1 . For example, a parameter list for this action might look like this: amp;ChangeMessageVisibilityBatchRequestEntry.1.Id=change_visibility_msg_2 amp;ChangeMessageVisibilityBatchRequestEntry.1.ReceiptHandle=replaceableYour_Receipt_Handle/replaceable amp;ChangeMessageVisibilityBatchRequestEntry.1.VisibilityTimeout=45 Id (string) -- [REQUIRED]An identifier for this particular receipt handle used to communicate the result. Note The Id s of a batch request need to be unique within a request ReceiptHandle (string) -- [REQUIRED]A receipt handle. VisibilityTimeout (integer) --The new value (in seconds) for the message's visibility timeout. :rtype: dict :return: { 'Successful': [ { 'Id': 'string' }, ], 'Failed': [ { 'Id': 'string', 'SenderFault': True|False, 'Code': 'string', 'Message': 'string' }, ] } """ pass def create_queue(QueueName=None, Attributes=None): """ Creates a new standard or FIFO queue. You can pass one or more attributes in the request. Keep the following caveats in mind: To successfully create a new queue, you must provide a queue name that adheres to the limits related to queues and is unique within the scope of your queues. To get the queue URL, use the `` GetQueueUrl `` action. `` GetQueueUrl `` requires only the QueueName parameter. be aware of existing queue names: See also: AWS API Documentation Examples The following operation creates an SQS queue named MyQueue. Expected Output: :example: response = client.create_queue( QueueName='string', Attributes={ 'string': 'string' } ) :type QueueName: string :param QueueName: [REQUIRED] The name of the new queue. The following limits apply to this name: A queue name can have up to 80 characters. Valid values: alphanumeric characters, hyphens (- ), and underscores (_ ). A FIFO queue name must end with the .fifo suffix. Queue names are case-sensitive. :type Attributes: dict :param Attributes: A map of attributes with their corresponding values. The following lists the names, descriptions, and values of the special request parameters that the CreateQueue action uses: DelaySeconds - The length of time, in seconds, for which the delivery of all messages in the queue is delayed. Valid values: An integer from 0 to 900 seconds (15 minutes). The default is 0 (zero). MaximumMessageSize - The limit of how many bytes a message can contain before Amazon SQS rejects it. Valid values: An integer from 1,024 bytes (1 KiB) to 262,144 bytes (256 KiB). The default is 262,144 (256 KiB). MessageRetentionPeriod - The length of time, in seconds, for which Amazon SQS retains a message. Valid values: An integer from 60 seconds (1 minute) to 1,209,600 seconds (14 days). The default is 345,600 (4 days). Policy - The queue's policy. A valid AWS policy. For more information about policy structure, see Overview of AWS IAM Policies in the Amazon IAM User Guide . ReceiveMessageWaitTimeSeconds - The length of time, in seconds, for which a `` ReceiveMessage `` action waits for a message to arrive. Valid values: An integer from 0 to 20 (seconds). The default is 0 (zero). RedrivePolicy - The parameters for the dead letter queue functionality of the source queue. For more information about the redrive policy and dead letter queues, see Using Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide . Note The dead letter queue of a FIFO queue must also be a FIFO queue. Similarly, the dead letter queue of a standard queue must also be a standard queue. VisibilityTimeout - The visibility timeout for the queue. Valid values: An integer from 0 to 43,200 (12 hours). The default is 30. For more information about the visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide . The following attributes apply only to server-side-encryption : KmsMasterKeyId - The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms . While the alias of the AWS-managed CMK for Amazon SQS is always alias/aws/sqs , the alias of a custom CMK can, for example, be alias/aws/sqs . For more examples, see KeyId in the AWS Key Management Service API Reference . KmsDataKeyReusePeriodSeconds - The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). The default is 300 (5 minutes). A shorter time period provides better security but results in more calls to KMS which incur charges after Free Tier. For more information, see How Does the Data Key Reuse Period Work? . The following attributes apply only to FIFO (first-in-first-out) queues : FifoQueue - Designates a queue as FIFO. Valid values: true , false . You can provide this attribute only during queue creation. You can't change it for an existing queue. When you set this attribute, you must also provide the MessageGroupId for your messages explicitly. For more information, see FIFO Queue Logic in the Amazon SQS Developer Guide . ContentBasedDeduplication - Enables content-based deduplication. Valid values: true , false . For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . Every message must have a unique MessageDeduplicationId , You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message). If you don't provide a MessageDeduplicationId and the queue doesn't have ContentBasedDeduplication set, the action fails with an error. If the queue has ContentBasedDeduplication set, your MessageDeduplicationId overrides the generated one. When ContentBasedDeduplication is in effect, messages with identical content sent within the deduplication interval are treated as duplicates and only one copy of the message is delivered. If you send one message with ContentBasedDeduplication enabled and then another message with a MessageDeduplicationId that is the same as the one generated for the first MessageDeduplicationId , the two messages are treated as duplicates and only one copy of the message is delivered. Any other valid special request parameters (such as the following) are ignored: ApproximateNumberOfMessages ApproximateNumberOfMessagesDelayed ApproximateNumberOfMessagesNotVisible CreatedTimestamp LastModifiedTimestamp QueueArn (string) -- (string) -- :rtype: dict :return: { 'QueueUrl': 'string' } :returns: If you don't provide a value for an attribute, the queue is created with the default value for the attribute. If you delete a queue, you must wait at least 60 seconds before creating a queue with the same name. """ pass def delete_message(QueueUrl=None, ReceiptHandle=None): """ Deletes the specified message from the specified queue. You specify the message by using the message's receipt handle and not the MessageId you receive when you send the message. Even if the message is locked by another reader due to the visibility timeout setting, it is still deleted from the queue. If you leave a message in the queue for longer than the queue's configured retention period, Amazon SQS automatically deletes the message. See also: AWS API Documentation :example: response = client.delete_message( QueueUrl='string', ReceiptHandle='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue from which messages are deleted. Queue URLs are case-sensitive. :type ReceiptHandle: string :param ReceiptHandle: [REQUIRED] The receipt handle associated with the message to delete. """ pass def delete_message_batch(QueueUrl=None, Entries=None): """ Deletes up to ten messages from the specified queue. This is a batch version of `` DeleteMessage .`` The result of the action on each message is reported individually in the response. See also: AWS API Documentation :example: response = client.delete_message_batch( QueueUrl='string', Entries=[ { 'Id': 'string', 'ReceiptHandle': 'string' }, ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue from which messages are deleted. Queue URLs are case-sensitive. :type Entries: list :param Entries: [REQUIRED] A list of receipt handles for the messages to be deleted. (dict) --Encloses a receipt handle and an identifier for it. Id (string) -- [REQUIRED]An identifier for this particular receipt handle. This is used to communicate the result. Note The Id s of a batch request need to be unique within a request ReceiptHandle (string) -- [REQUIRED]A receipt handle. :rtype: dict :return: { 'Successful': [ { 'Id': 'string' }, ], 'Failed': [ { 'Id': 'string', 'SenderFault': True|False, 'Code': 'string', 'Message': 'string' }, ] } """ pass def delete_queue(QueueUrl=None): """ Deletes the queue specified by the QueueUrl , even if the queue is empty. If the specified queue doesn't exist, Amazon SQS returns a successful response. When you delete a queue, the deletion process takes up to 60 seconds. Requests you send involving that queue during the 60 seconds might succeed. For example, a `` SendMessage `` request might succeed, but after 60 seconds the queue and the message you sent no longer exist. When you delete a queue, you must wait at least 60 seconds before creating a queue with the same name. See also: AWS API Documentation :example: response = client.delete_queue( QueueUrl='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue to delete. Queue URLs are case-sensitive. """ pass def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None): """ Generate a presigned url given a client, its method, and arguments :type ClientMethod: string :param ClientMethod: The client method to presign for :type Params: dict :param Params: The parameters normally passed to ClientMethod. :type ExpiresIn: int :param ExpiresIn: The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds) :type HttpMethod: string :param HttpMethod: The http method to use on the generated url. By default, the http method is whatever is used in the method's model. """ pass def get_paginator(operation_name=None): """ Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator('create_foo'). :rtype: L{botocore.paginate.Paginator} """ pass def get_queue_attributes(QueueUrl=None, AttributeNames=None): """ Gets attributes for the specified queue. See also: AWS API Documentation :example: response = client.get_queue_attributes( QueueUrl='string', AttributeNames=[ 'All'|'Policy'|'VisibilityTimeout'|'MaximumMessageSize'|'MessageRetentionPeriod'|'ApproximateNumberOfMessages'|'ApproximateNumberOfMessagesNotVisible'|'CreatedTimestamp'|'LastModifiedTimestamp'|'QueueArn'|'ApproximateNumberOfMessagesDelayed'|'DelaySeconds'|'ReceiveMessageWaitTimeSeconds'|'RedrivePolicy'|'FifoQueue'|'ContentBasedDeduplication'|'KmsMasterKeyId'|'KmsDataKeyReusePeriodSeconds', ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue whose attribute information is retrieved. Queue URLs are case-sensitive. :type AttributeNames: list :param AttributeNames: A list of attributes for which to retrieve information. Note In the future, new attributes might be added. If you write code that calls this action, we recommend that you structure your code so that it can handle new attributes gracefully. The following attributes are supported: All - Returns all values. ApproximateNumberOfMessages - Returns the approximate number of visible messages in a queue. For more information, see Resources Required to Process Messages in the Amazon SQS Developer Guide . ApproximateNumberOfMessagesDelayed - Returns the approximate number of messages that are waiting to be added to the queue. ApproximateNumberOfMessagesNotVisible - Returns the approximate number of messages that have not timed-out and aren't deleted. For more information, see Resources Required to Process Messages in the Amazon SQS Developer Guide . CreatedTimestamp - Returns the time when the queue was created in seconds (epoch time ). DelaySeconds - Returns the default delay on the queue in seconds. LastModifiedTimestamp - Returns the time when the queue was last changed in seconds (epoch time ). MaximumMessageSize - Returns the limit of how many bytes a message can contain before Amazon SQS rejects it. MessageRetentionPeriod - Returns the length of time, in seconds, for which Amazon SQS retains a message. Policy - Returns the policy of the queue. QueueArn - Returns the Amazon resource name (ARN) of the queue. ReceiveMessageWaitTimeSeconds - Returns the length of time, in seconds, for which the ReceiveMessage action waits for a message to arrive. RedrivePolicy - Returns the parameters for dead letter queue functionality of the source queue. For more information about the redrive policy and dead letter queues, see Using Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide . VisibilityTimeout - Returns the visibility timeout for the queue. For more information about the visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide . The following attributes apply only to server-side-encryption : KmsMasterKeyId - Returns the ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms . KmsDataKeyReusePeriodSeconds - Returns the length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. The following attributes apply only to FIFO (first-in-first-out) queues : FifoQueue - Returns whether the queue is FIFO. For more information, see FIFO Queue Logic in the Amazon SQS Developer Guide . Note To determine whether a queue is FIFO , you can check whether QueueName ends with the .fifo suffix. ContentBasedDeduplication - Returns whether content-based deduplication is enabled for the queue. For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . (string) -- :rtype: dict :return: { 'Attributes': { 'string': 'string' } } :returns: (string) -- (string) -- """ pass def get_queue_url(QueueName=None, QueueOwnerAWSAccountId=None): """ Returns the URL of an existing queue. This action provides a simple way to retrieve the URL of an Amazon SQS queue. To access a queue that belongs to another AWS account, use the QueueOwnerAWSAccountId parameter to specify the account ID of the queue's owner. The queue's owner must grant you permission to access the queue. For more information about shared queue access, see `` AddPermission `` or see Shared Queues in the Amazon SQS Developer Guide . See also: AWS API Documentation Examples The following example retrieves the queue ARN. Expected Output: :example: response = client.get_queue_url( QueueName='string', QueueOwnerAWSAccountId='string' ) :type QueueName: string :param QueueName: [REQUIRED] The name of the queue whose URL must be fetched. Maximum 80 characters. Valid values: alphanumeric characters, hyphens (- ), and underscores (_ ). Queue names are case-sensitive. :type QueueOwnerAWSAccountId: string :param QueueOwnerAWSAccountId: The AWS account ID of the account that created the queue. :rtype: dict :return: { 'QueueUrl': 'string' } """ pass def get_waiter(): """ """ pass def list_dead_letter_source_queues(QueueUrl=None): """ Returns a list of your queues that have the RedrivePolicy queue attribute configured with a dead letter queue. For more information about using dead letter queues, see Using Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide . See also: AWS API Documentation :example: response = client.list_dead_letter_source_queues( QueueUrl='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of a dead letter queue. Queue URLs are case-sensitive. :rtype: dict :return: { 'queueUrls': [ 'string', ] } """ pass def list_queues(QueueNamePrefix=None): """ Returns a list of your queues. The maximum number of queues that can be returned is 1,000. If you specify a value for the optional QueueNamePrefix parameter, only queues with a name that begins with the specified value are returned. See also: AWS API Documentation :example: response = client.list_queues( QueueNamePrefix='string' ) :type QueueNamePrefix: string :param QueueNamePrefix: A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned. Queue names are case-sensitive. :rtype: dict :return: { 'QueueUrls': [ 'string', ] } """ pass def purge_queue(QueueUrl=None): """ Deletes the messages in a queue specified by the QueueURL parameter. When you purge a queue, the message deletion process takes up to 60 seconds. All messages sent to the queue before calling the PurgeQueue action are deleted. Messages sent to the queue while it is being purged might be deleted. While the queue is being purged, messages sent to the queue before PurgeQueue is called might be received, but are deleted within the next minute. See also: AWS API Documentation :example: response = client.purge_queue( QueueUrl='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the queue from which the PurgeQueue action deletes messages. Queue URLs are case-sensitive. """ pass def receive_message(QueueUrl=None, AttributeNames=None, MessageAttributeNames=None, MaxNumberOfMessages=None, VisibilityTimeout=None, WaitTimeSeconds=None, ReceiveRequestAttemptId=None): """ Retrieves one or more messages (up to 10), from the specified queue. Using the WaitTimeSeconds parameter enables long-poll support. For more information, see Amazon SQS Long Polling in the Amazon SQS Developer Guide . Short poll is the default behavior where a weighted random set of machines is sampled on a ReceiveMessage call. Thus, only the messages on the sampled machines are returned. If the number of messages in the queue is small (fewer than 1,000), you most likely get fewer messages than you requested per ReceiveMessage call. If the number of messages in the queue is extremely small, you might not receive any messages in a particular ReceiveMessage response. If this happens, repeat the request. For each message returned, the response includes the following: The receipt handle is the identifier you must provide when deleting the message. For more information, see Queue and Message Identifiers in the Amazon SQS Developer Guide . You can provide the VisibilityTimeout parameter in your request. The parameter is applied to the messages that Amazon SQS returns in the response. If you don't include the parameter, the overall visibility timeout for the queue is used for the returned messages. For more information, see Visibility Timeout in the Amazon SQS Developer Guide . A message that isn't deleted or a message whose visibility isn't extended before the visibility timeout expires counts as a failed receive. Depending on the configuration of the queue, the message might be sent to the dead letter queue. See also: AWS API Documentation :example: response = client.receive_message( QueueUrl='string', AttributeNames=[ 'All'|'Policy'|'VisibilityTimeout'|'MaximumMessageSize'|'MessageRetentionPeriod'|'ApproximateNumberOfMessages'|'ApproximateNumberOfMessagesNotVisible'|'CreatedTimestamp'|'LastModifiedTimestamp'|'QueueArn'|'ApproximateNumberOfMessagesDelayed'|'DelaySeconds'|'ReceiveMessageWaitTimeSeconds'|'RedrivePolicy'|'FifoQueue'|'ContentBasedDeduplication'|'KmsMasterKeyId'|'KmsDataKeyReusePeriodSeconds', ], MessageAttributeNames=[ 'string', ], MaxNumberOfMessages=123, VisibilityTimeout=123, WaitTimeSeconds=123, ReceiveRequestAttemptId='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue from which messages are received. Queue URLs are case-sensitive. :type AttributeNames: list :param AttributeNames: A list of attributes that need to be returned along with each message. These attributes include: All - Returns all values. ApproximateFirstReceiveTimestamp - Returns the time the message was first received from the queue (epoch time in milliseconds). ApproximateReceiveCount - Returns the number of times a message has been received from the queue but not deleted. SenderId For an IAM user, returns the IAM user ID, for example ABCDEFGHI1JKLMNOPQ23R . For an IAM role, returns the IAM role ID, for example ABCDE1F2GH3I4JK5LMNOP:i-a123b456 . SentTimestamp - Returns the time the message was sent to the queue (epoch time in milliseconds). MessageDeduplicationId - Returns the value provided by the sender that calls the `` SendMessage `` action. MessageGroupId - Returns the value provided by the sender that calls the `` SendMessage `` action. Messages with the same MessageGroupId are returned in sequence. SequenceNumber - Returns the value provided by Amazon SQS. Any other valid special request parameters (such as the following) are ignored: ApproximateNumberOfMessages ApproximateNumberOfMessagesDelayed ApproximateNumberOfMessagesNotVisible CreatedTimestamp ContentBasedDeduplication DelaySeconds FifoQueue LastModifiedTimestamp MaximumMessageSize MessageRetentionPeriod Policy QueueArn , ReceiveMessageWaitTimeSeconds RedrivePolicy VisibilityTimeout (string) -- :type MessageAttributeNames: list :param MessageAttributeNames: The name of the message attribute, where N is the index. The name can contain alphanumeric characters and the underscore (_ ), hyphen (- ), and period (. ). The name is case-sensitive and must be unique among all attribute names for the message. The name must not start with AWS-reserved prefixes such as AWS. or Amazon. (or any casing variants). The name must not start or end with a period (. ), and it should not have periods in succession (.. ). The name can be up to 256 characters long. When using ReceiveMessage , you can send a list of attribute names to receive, or you can return all of the attributes by specifying All or .* in your request. You can also use all message attributes starting with a prefix, for example bar.* . (string) -- :type MaxNumberOfMessages: integer :param MaxNumberOfMessages: The maximum number of messages to return. Amazon SQS never returns more messages than this value (however, fewer messages might be returned). Valid values are 1 to 10. Default is 1. :type VisibilityTimeout: integer :param VisibilityTimeout: The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request. :type WaitTimeSeconds: integer :param WaitTimeSeconds: The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner than WaitTimeSeconds . :type ReceiveRequestAttemptId: string :param ReceiveRequestAttemptId: This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of ReceiveMessage calls. If a networking issue occurs after a ReceiveMessage action, and instead of a response you receive a generic error, you can retry the same action with an identical ReceiveRequestAttemptId to retrieve the same set of messages, even if their visibility timeout has not yet expired. You can use ReceiveRequestAttemptId only for 5 minutes after a ReceiveMessage action. When you set FifoQueue , a caller of the ReceiveMessage action can provide a ReceiveRequestAttemptId explicitly. If a caller of the ReceiveMessage action doesn't provide a ReceiveRequestAttemptId , Amazon SQS generates a ReceiveRequestAttemptId . You can retry the ReceiveMessage action with the same ReceiveRequestAttemptId if none of the messages have been modified (deleted or had their visibility changes). During a visibility timeout, subsequent calls with the same ReceiveRequestAttemptId return the same messages and receipt handles. If a retry occurs within the deduplication interval, it resets the visibility timeout. For more information, see Visibility Timeout in the Amazon Simple Queue Service Developer Guide . Warning If a caller of the ReceiveMessage action is still processing messages when the visibility timeout expires and messages become visible, another worker reading from the same queue can receive the same messages and therefore process duplicates. Also, if a reader whose message processing time is longer than the visibility timeout tries to delete the processed messages, the action fails with an error. To mitigate this effect, ensure that your application observes a safe threshold before the visibility timeout expires and extend the visibility timeout as necessary. While messages with a particular MessageGroupId are invisible, no more messages belonging to the same MessageGroupId are returned until the visibility timeout expires. You can still receive messages with another MessageGroupId as long as it is also visible. If a caller of ReceiveMessage can't track the ReceiveRequestAttemptId , no retries work until the original visibility timeout expires. As a result, delays might occur but the messages in the queue remain in a strict order. The length of ReceiveRequestAttemptId is 128 characters. ReceiveRequestAttemptId can contain alphanumeric characters (a-z , A-Z , 0-9 ) and punctuation (!'#$%'()*+,-./:;=?@[\\]^_`{|}~ ). For best practices of using ReceiveRequestAttemptId , see Using the ReceiveRequestAttemptId Request Parameter in the Amazon Simple Queue Service Developer Guide . :rtype: dict :return: { 'Messages': [ { 'MessageId': 'string', 'ReceiptHandle': 'string', 'MD5OfBody': 'string', 'Body': 'string', 'Attributes': { 'string': 'string' }, 'MD5OfMessageAttributes': 'string', 'MessageAttributes': { 'string': { 'StringValue': 'string', 'BinaryValue': b'bytes', 'StringListValues': [ 'string', ], 'BinaryListValues': [ b'bytes', ], 'DataType': 'string' } } }, ] } :returns: QueueUrl (string) -- [REQUIRED] The URL of the Amazon SQS queue from which messages are received. Queue URLs are case-sensitive. AttributeNames (list) -- A list of attributes that need to be returned along with each message. These attributes include: All - Returns all values. ApproximateFirstReceiveTimestamp - Returns the time the message was first received from the queue (epoch time in milliseconds). ApproximateReceiveCount - Returns the number of times a message has been received from the queue but not deleted. SenderId For an IAM user, returns the IAM user ID, for example ABCDEFGHI1JKLMNOPQ23R . For an IAM role, returns the IAM role ID, for example ABCDE1F2GH3I4JK5LMNOP:i-a123b456 . SentTimestamp - Returns the time the message was sent to the queue (epoch time in milliseconds). MessageDeduplicationId - Returns the value provided by the sender that calls the `` SendMessage `` action. MessageGroupId - Returns the value provided by the sender that calls the `` SendMessage `` action. Messages with the same MessageGroupId are returned in sequence. SequenceNumber - Returns the value provided by Amazon SQS. Any other valid special request parameters (such as the following) are ignored: ApproximateNumberOfMessages ApproximateNumberOfMessagesDelayed ApproximateNumberOfMessagesNotVisible CreatedTimestamp ContentBasedDeduplication DelaySeconds FifoQueue LastModifiedTimestamp MaximumMessageSize MessageRetentionPeriod Policy QueueArn , ReceiveMessageWaitTimeSeconds RedrivePolicy VisibilityTimeout (string) -- MessageAttributeNames (list) -- The name of the message attribute, where N is the index. The name can contain alphanumeric characters and the underscore (_ ), hyphen (- ), and period (. ). The name is case-sensitive and must be unique among all attribute names for the message. The name must not start with AWS-reserved prefixes such as AWS. or Amazon. (or any casing variants). The name must not start or end with a period (. ), and it should not have periods in succession (.. ). The name can be up to 256 characters long. When using ReceiveMessage , you can send a list of attribute names to receive, or you can return all of the attributes by specifying All or .* in your request. You can also use all message attributes starting with a prefix, for example bar.* . (string) -- MaxNumberOfMessages (integer) -- The maximum number of messages to return. Amazon SQS never returns more messages than this value (however, fewer messages might be returned). Valid values are 1 to 10. Default is 1. VisibilityTimeout (integer) -- The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request. WaitTimeSeconds (integer) -- The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a message is available, the call returns sooner than WaitTimeSeconds . ReceiveRequestAttemptId (string) -- This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of ReceiveMessage calls. If a networking issue occurs after a ReceiveMessage action, and instead of a response you receive a generic error, you can retry the same action with an identical ReceiveRequestAttemptId to retrieve the same set of messages, even if their visibility timeout has not yet expired. You can use ReceiveRequestAttemptId only for 5 minutes after a ReceiveMessage action. When you set FifoQueue , a caller of the ReceiveMessage action can provide a ReceiveRequestAttemptId explicitly. If a caller of the ReceiveMessage action doesn't provide a ReceiveRequestAttemptId , Amazon SQS generates a ReceiveRequestAttemptId . You can retry the ReceiveMessage action with the same ReceiveRequestAttemptId if none of the messages have been modified (deleted or had their visibility changes). During a visibility timeout, subsequent calls with the same ReceiveRequestAttemptId return the same messages and receipt handles. If a retry occurs within the deduplication interval, it resets the visibility timeout. For more information, see Visibility Timeout in the Amazon Simple Queue Service Developer Guide . Warning If a caller of the ReceiveMessage action is still processing messages when the visibility timeout expires and messages become visible, another worker reading from the same queue can receive the same messages and therefore process duplicates. Also, if a reader whose message processing time is longer than the visibility timeout tries to delete the processed messages, the action fails with an error. To mitigate this effect, ensure that your application observes a safe threshold before the visibility timeout expires and extend the visibility timeout as necessary. While messages with a particular MessageGroupId are invisible, no more messages belonging to the same MessageGroupId are returned until the visibility timeout expires. You can still receive messages with another MessageGroupId as long as it is also visible. If a caller of ReceiveMessage can't track the ReceiveRequestAttemptId , no retries work until the original visibility timeout expires. As a result, delays might occur but the messages in the queue remain in a strict order. The length of ReceiveRequestAttemptId is 128 characters. ReceiveRequestAttemptId can contain alphanumeric characters (a-z , A-Z , 0-9 ) and punctuation (!"#$%'()*+,-./:;=?@[\\]^_`{|}~ ). For best practices of using ReceiveRequestAttemptId , see Using the ReceiveRequestAttemptId Request Parameter in the Amazon Simple Queue Service Developer Guide . """ pass def remove_permission(QueueUrl=None, Label=None): """ Revokes any permissions in the queue policy that matches the specified Label parameter. Only the owner of the queue can remove permissions. See also: AWS API Documentation :example: response = client.remove_permission( QueueUrl='string', Label='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue from which permissions are removed. Queue URLs are case-sensitive. :type Label: string :param Label: [REQUIRED] The identification of the permission to remove. This is the label added using the `` AddPermission `` action. """ pass def send_message(QueueUrl=None, MessageBody=None, DelaySeconds=None, MessageAttributes=None, MessageDeduplicationId=None, MessageGroupId=None): """ Delivers a message to the specified queue. See also: AWS API Documentation :example: response = client.send_message( QueueUrl='string', MessageBody='string', DelaySeconds=123, MessageAttributes={ 'string': { 'StringValue': 'string', 'BinaryValue': b'bytes', 'StringListValues': [ 'string', ], 'BinaryListValues': [ b'bytes', ], 'DataType': 'string' } }, MessageDeduplicationId='string', MessageGroupId='string' ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue to which a message is sent. Queue URLs are case-sensitive. :type MessageBody: string :param MessageBody: [REQUIRED] The message to send. The maximum string size is 256 KB. Warning A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed: #x9 | #xA | #xD | #x20 to #xD7FF | #xE000 to #xFFFD | #x10000 to #x10FFFF Any characters not included in this list will be rejected. For more information, see the W3C specification for characters . :type DelaySeconds: integer :param DelaySeconds: The length of time, in seconds, for which to delay a specific message. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive DelaySeconds value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue applies. Note When you set FifoQueue , you can't set DelaySeconds per message. You can set this parameter only on a queue level. :type MessageAttributes: dict :param MessageAttributes: Each message attribute consists of a Name , Type , and Value . For more information, see Message Attribute Items and Validation in the Amazon SQS Developer Guide . (string) -- (dict) --The user-specified message attribute value. For string data types, the Value attribute has the same restrictions on the content as the message body. For more information, see `` SendMessage .`` Name , type , value and the message body must not be empty or null. All parts of the message attribute, including Name , Type , and Value , are part of the message size restriction (256 KB or 262,144 bytes). StringValue (string) --Strings are Unicode with UTF-8 binary encoding. For a list of code values, see ASCII Printable Characters . BinaryValue (bytes) --Binary type attributes can store any binary data, such as compressed data, encrypted data, or images. StringListValues (list) --Not implemented. Reserved for future use. (string) -- BinaryListValues (list) --Not implemented. Reserved for future use. (bytes) -- DataType (string) -- [REQUIRED]Amazon SQS supports the following logical data types: String , Number , and Binary . For the Number data type, you must use StringValue . You can also append custom labels. For more information, see Message Attribute Data Types and Validation in the Amazon SQS Developer Guide . :type MessageDeduplicationId: string :param MessageDeduplicationId: This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of sent messages. If a message with a particular MessageDeduplicationId is sent successfully, any messages sent with the same MessageDeduplicationId are accepted successfully but aren't delivered during the 5-minute deduplication interval. For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . Every message must have a unique MessageDeduplicationId , You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message). If you don't provide a MessageDeduplicationId and the queue doesn't have ContentBasedDeduplication set, the action fails with an error. If the queue has ContentBasedDeduplication set, your MessageDeduplicationId overrides the generated one. When ContentBasedDeduplication is in effect, messages with identical content sent within the deduplication interval are treated as duplicates and only one copy of the message is delivered. If you send one message with ContentBasedDeduplication enabled and then another message with a MessageDeduplicationId that is the same as the one generated for the first MessageDeduplicationId , the two messages are treated as duplicates and only one copy of the message is delivered. Note The MessageDeduplicationId is available to the recipient of the message (this can be useful for troubleshooting delivery issues). If a message is sent successfully but the acknowledgement is lost and the message is resent with the same MessageDeduplicationId after the deduplication interval, Amazon SQS can't detect duplicate messages. The length of MessageDeduplicationId is 128 characters. MessageDeduplicationId can contain alphanumeric characters (a-z , A-Z , 0-9 ) and punctuation (!'#$%'()*+,-./:;=?@[\\]^_`{|}~ ). For best practices of using MessageDeduplicationId , see Using the MessageDeduplicationId Property in the Amazon Simple Queue Service Developer Guide . :type MessageGroupId: string :param MessageGroupId: This parameter applies only to FIFO (first-in-first-out) queues. The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). To interleave multiple ordered streams within a single queue, use MessageGroupId values (for example, session data for multiple users). In this scenario, multiple readers can process the queue, but the session data of each user is processed in a FIFO fashion. You must associate a non-empty MessageGroupId with a message. If you don't provide a MessageGroupId , the action fails. ReceiveMessage might return messages with multiple MessageGroupId values. For each MessageGroupId , the messages are sorted by time sent. The caller can't specify a MessageGroupId . The length of MessageGroupId is 128 characters. Valid values are alphanumeric characters and punctuation (!'#$%'()*+,-./:;=?@[\\]^_`{|}~) . For best practices of using MessageGroupId , see Using the MessageGroupId Property in the Amazon Simple Queue Service Developer Guide . Warning MessageGroupId is required for FIFO queues. You can't use it for Standard queues. :rtype: dict :return: { 'MD5OfMessageBody': 'string', 'MD5OfMessageAttributes': 'string', 'MessageId': 'string', 'SequenceNumber': 'string' } """ pass def send_message_batch(QueueUrl=None, Entries=None): """ Delivers up to ten messages to the specified queue. This is a batch version of `` SendMessage .`` For a FIFO queue, multiple messages within a single batch are enqueued in the order they are sent. The result of sending each message is reported individually in the response. Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200 . The maximum allowed individual message size and the maximum total payload size (the sum of the individual lengths of all of the batched messages) are both 256 KB (262,144 bytes). If you don't specify the DelaySeconds parameter for an entry, Amazon SQS uses the default value for the queue. See also: AWS API Documentation :example: response = client.send_message_batch( QueueUrl='string', Entries=[ { 'Id': 'string', 'MessageBody': 'string', 'DelaySeconds': 123, 'MessageAttributes': { 'string': { 'StringValue': 'string', 'BinaryValue': b'bytes', 'StringListValues': [ 'string', ], 'BinaryListValues': [ b'bytes', ], 'DataType': 'string' } }, 'MessageDeduplicationId': 'string', 'MessageGroupId': 'string' }, ] ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue to which batched messages are sent. Queue URLs are case-sensitive. :type Entries: list :param Entries: [REQUIRED] A list of `` SendMessageBatchRequestEntry `` items. (dict) --Contains the details of a single Amazon SQS message along with an Id . Id (string) -- [REQUIRED]An identifier for a message in this batch used to communicate the result. Note The Id s of a batch request need to be unique within a request MessageBody (string) -- [REQUIRED]The body of the message. DelaySeconds (integer) --The length of time, in seconds, for which a specific message is delayed. Valid values: 0 to 900. Maximum: 15 minutes. Messages with a positive DelaySeconds value become available for processing after the delay period is finished. If you don't specify a value, the default value for the queue is applied. Note When you set FifoQueue , you can't set DelaySeconds per message. You can set this parameter only on a queue level. MessageAttributes (dict) --Each message attribute consists of a Name , Type , and Value . For more information, see Message Attribute Items and Validation in the Amazon SQS Developer Guide . (string) -- (dict) --The user-specified message attribute value. For string data types, the Value attribute has the same restrictions on the content as the message body. For more information, see `` SendMessage .`` Name , type , value and the message body must not be empty or null. All parts of the message attribute, including Name , Type , and Value , are part of the message size restriction (256 KB or 262,144 bytes). StringValue (string) --Strings are Unicode with UTF-8 binary encoding. For a list of code values, see ASCII Printable Characters . BinaryValue (bytes) --Binary type attributes can store any binary data, such as compressed data, encrypted data, or images. StringListValues (list) --Not implemented. Reserved for future use. (string) -- BinaryListValues (list) --Not implemented. Reserved for future use. (bytes) -- DataType (string) -- [REQUIRED]Amazon SQS supports the following logical data types: String , Number , and Binary . For the Number data type, you must use StringValue . You can also append custom labels. For more information, see Message Attribute Data Types and Validation in the Amazon SQS Developer Guide . MessageDeduplicationId (string) --This parameter applies only to FIFO (first-in-first-out) queues. The token used for deduplication of messages within a 5-minute minimum deduplication interval. If a message with a particular MessageDeduplicationId is sent successfully, subsequent messages with the same MessageDeduplicationId are accepted successfully but aren't delivered. For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . Every message must have a unique MessageDeduplicationId , You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message). If you don't provide a MessageDeduplicationId and the queue doesn't have ContentBasedDeduplication set, the action fails with an error. If the queue has ContentBasedDeduplication set, your MessageDeduplicationId overrides the generated one. When ContentBasedDeduplication is in effect, messages with identical content sent within the deduplication interval are treated as duplicates and only one copy of the message is delivered. If you send one message with ContentBasedDeduplication enabled and then another message with a MessageDeduplicationId that is the same as the one generated for the first MessageDeduplicationId , the two messages are treated as duplicates and only one copy of the message is delivered. Note The MessageDeduplicationId is available to the recipient of the message (this can be useful for troubleshooting delivery issues). If a message is sent successfully but the acknowledgement is lost and the message is resent with the same MessageDeduplicationId after the deduplication interval, Amazon SQS can't detect duplicate messages. The length of MessageDeduplicationId is 128 characters. MessageDeduplicationId can contain alphanumeric characters (a-z , A-Z , 0-9 ) and punctuation (!'#$%'()*+,-./:;=?@[\\]^_`{|}~ ). For best practices of using MessageDeduplicationId , see Using the MessageDeduplicationId Property in the Amazon Simple Queue Service Developer Guide . MessageGroupId (string) --This parameter applies only to FIFO (first-in-first-out) queues. The tag that specifies that a message belongs to a specific message group. Messages that belong to the same message group are processed in a FIFO manner (however, messages in different message groups might be processed out of order). To interleave multiple ordered streams within a single queue, use MessageGroupId values (for example, session data for multiple users). In this scenario, multiple readers can process the queue, but the session data of each user is processed in a FIFO fashion. You must associate a non-empty MessageGroupId with a message. If you don't provide a MessageGroupId , the action fails. ReceiveMessage might return messages with multiple MessageGroupId values. For each MessageGroupId , the messages are sorted by time sent. The caller can't specify a MessageGroupId . The length of MessageGroupId is 128 characters. Valid values are alphanumeric characters and punctuation (!'#$%'()*+,-./:;=?@[\\]^_`{|}~) . For best practices of using MessageGroupId , see Using the MessageGroupId Property in the Amazon Simple Queue Service Developer Guide . Warning MessageGroupId is required for FIFO queues. You can't use it for Standard queues. :rtype: dict :return: { 'Successful': [ { 'Id': 'string', 'MessageId': 'string', 'MD5OfMessageBody': 'string', 'MD5OfMessageAttributes': 'string', 'SequenceNumber': 'string' }, ], 'Failed': [ { 'Id': 'string', 'SenderFault': True|False, 'Code': 'string', 'Message': 'string' }, ] } """ pass def set_queue_attributes(QueueUrl=None, Attributes=None): """ Sets the value of one or more queue attributes. When you change a queue's attributes, the change can take up to 60 seconds for most of the attributes to propagate throughout the Amazon SQS system. Changes made to the MessageRetentionPeriod attribute can take up to 15 minutes. See also: AWS API Documentation :example: response = client.set_queue_attributes( QueueUrl='string', Attributes={ 'string': 'string' } ) :type QueueUrl: string :param QueueUrl: [REQUIRED] The URL of the Amazon SQS queue whose attributes are set. Queue URLs are case-sensitive. :type Attributes: dict :param Attributes: [REQUIRED] A map of attributes to set. The following lists the names, descriptions, and values of the special request parameters that the SetQueueAttributes action uses: DelaySeconds - The length of time, in seconds, for which the delivery of all messages in the queue is delayed. Valid values: An integer from 0 to 900 (15 minutes). The default is 0 (zero). MaximumMessageSize - The limit of how many bytes a message can contain before Amazon SQS rejects it. Valid values: An integer from 1,024 bytes (1 KiB) up to 262,144 bytes (256 KiB). The default is 262,144 (256 KiB). MessageRetentionPeriod - The length of time, in seconds, for which Amazon SQS retains a message. Valid values: An integer representing seconds, from 60 (1 minute) to 1,209,600 (14 days). The default is 345,600 (4 days). Policy - The queue's policy. A valid AWS policy. For more information about policy structure, see Overview of AWS IAM Policies in the Amazon IAM User Guide . ReceiveMessageWaitTimeSeconds - The length of time, in seconds, for which a `` ReceiveMessage `` action waits for a message to arrive. Valid values: an integer from 0 to 20 (seconds). The default is 0. RedrivePolicy - The parameters for the dead letter queue functionality of the source queue. For more information about the redrive policy and dead letter queues, see Using Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide . Note The dead letter queue of a FIFO queue must also be a FIFO queue. Similarly, the dead letter queue of a standard queue must also be a standard queue. VisibilityTimeout - The visibility timeout for the queue. Valid values: an integer from 0 to 43,200 (12 hours). The default is 30. For more information about the visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide . The following attributes apply only to server-side-encryption : KmsMasterKeyId - The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. For more information, see Key Terms . While the alias of the AWS-managed CMK for Amazon SQS is always alias/aws/sqs , the alias of a custom CMK can, for example, be alias/aws/sqs . For more examples, see KeyId in the AWS Key Management Service API Reference . KmsDataKeyReusePeriodSeconds - The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). The default is 300 (5 minutes). A shorter time period provides better security but results in more calls to KMS which incur charges after Free Tier. For more information, see How Does the Data Key Reuse Period Work? . The following attribute applies only to FIFO (first-in-first-out) queues : ContentBasedDeduplication - Enables content-based deduplication. For more information, see Exactly-Once Processing in the Amazon SQS Developer Guide . Every message must have a unique MessageDeduplicationId , You may provide a MessageDeduplicationId explicitly. If you aren't able to provide a MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the body of the message (but not the attributes of the message). If you don't provide a MessageDeduplicationId and the queue doesn't have ContentBasedDeduplication set, the action fails with an error. If the queue has ContentBasedDeduplication set, your MessageDeduplicationId overrides the generated one. When ContentBasedDeduplication is in effect, messages with identical content sent within the deduplication interval are treated as duplicates and only one copy of the message is delivered. If you send one message with ContentBasedDeduplication enabled and then another message with a MessageDeduplicationId that is the same as the one generated for the first MessageDeduplicationId , the two messages are treated as duplicates and only one copy of the message is delivered. Any other valid special request parameters (such as the following) are ignored: ApproximateNumberOfMessages ApproximateNumberOfMessagesDelayed ApproximateNumberOfMessagesNotVisible CreatedTimestamp LastModifiedTimestamp QueueArn (string) -- (string) -- """ pass
entrada = input() def fibonacci(n): fib = [0, 1, 1] if n > 0 and n <= 2: return fib[1] elif n == 0: return fib[0] else: for x in range(3, n+1): fib.append(0) fib[x] = fib[x-1] + fib[x-2] return fib[n] numeros = entrada.split(' ') numeros = list(map(int, numeros)) print(str(fibonacci(numeros[0])) + " " + str(fibonacci(numeros[1])) + " " + str(fibonacci(numeros[2])) + " " + str(fibonacci(numeros[3])))
entrada = input() def fibonacci(n): fib = [0, 1, 1] if n > 0 and n <= 2: return fib[1] elif n == 0: return fib[0] else: for x in range(3, n + 1): fib.append(0) fib[x] = fib[x - 1] + fib[x - 2] return fib[n] numeros = entrada.split(' ') numeros = list(map(int, numeros)) print(str(fibonacci(numeros[0])) + ' ' + str(fibonacci(numeros[1])) + ' ' + str(fibonacci(numeros[2])) + ' ' + str(fibonacci(numeros[3])))
class AXFundAddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
class Axfundaddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
class Usuario(object): def __init__(self, email='', senha=''): self.email = email self.senha = senha def __str__(self): return f'{self.email}' class Equipe(object): def __init__(self, nome='', sigla='', local=''): self.nome = nome self.sigla = sigla self.local = local def __str__(self): return f'{self.nome} ({self.sigla})' class Partida(object): def __init__(self, equipe_casa, equipe_visita, pontos_casa, pontos_visita): self.equipe_casa = equipe_casa self.equipe_visita = equipe_visita self.pontos_casa = pontos_casa self.pontos_visita = pontos_visita def __str__(self): return f'{self.equipe_casa} ({self.pontos_casa}) - {self.equipe_visita} ({self.pontos_visita})' def vencedor(self): if self.pontos_casa > self.pontos_visita: return self.equipe_casa elif self.pontos_visita > self.pontos_casa: return self.equipe_visita return False def id(self): return (self.equipe_casa.sigla+self.equipe_visita.sigla) def trocar_equipe(self, sigla_anterior, equipe): if self.equipe_casa.sigla == sigla_anterior: self.equipe_casa = equipe elif self.equipe_visita.sigla == sigla_anterior: self.equipe_visita = equipe
class Usuario(object): def __init__(self, email='', senha=''): self.email = email self.senha = senha def __str__(self): return f'{self.email}' class Equipe(object): def __init__(self, nome='', sigla='', local=''): self.nome = nome self.sigla = sigla self.local = local def __str__(self): return f'{self.nome} ({self.sigla})' class Partida(object): def __init__(self, equipe_casa, equipe_visita, pontos_casa, pontos_visita): self.equipe_casa = equipe_casa self.equipe_visita = equipe_visita self.pontos_casa = pontos_casa self.pontos_visita = pontos_visita def __str__(self): return f'{self.equipe_casa} ({self.pontos_casa}) - {self.equipe_visita} ({self.pontos_visita})' def vencedor(self): if self.pontos_casa > self.pontos_visita: return self.equipe_casa elif self.pontos_visita > self.pontos_casa: return self.equipe_visita return False def id(self): return self.equipe_casa.sigla + self.equipe_visita.sigla def trocar_equipe(self, sigla_anterior, equipe): if self.equipe_casa.sigla == sigla_anterior: self.equipe_casa = equipe elif self.equipe_visita.sigla == sigla_anterior: self.equipe_visita = equipe
''' | Write a program that should prompt the user to type some sentences. It should then print number of words, number of characters, number of digits and number of special characters in it. | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | We use the input() function to receive input from the user and print() function to print it | ''' string = input("Enter a sentence...\n") numbers = '1234567890' chars = '!@#$%^&*()<>?:-\"\'}+=_{|\][;//.,`~' num_words = len(string.split()) res = [0,0,0] for i in string: if i.isalpha(): res[0] += 1 elif i in numbers: res[1] += 1 elif i in chars: res[2] += 1 else: pass print(f'There are {num_words} word(s), {res[0]} alphabets, {res[1]} digits and {res[2]} special characters in the given string.')
""" | Write a program that should prompt the user to type some sentences. It should then print number of words, number of characters, number of digits and number of special characters in it. | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | We use the input() function to receive input from the user and print() function to print it | """ string = input('Enter a sentence...\n') numbers = '1234567890' chars = '!@#$%^&*()<>?:-"\'}+=_{|\\][;//.,`~' num_words = len(string.split()) res = [0, 0, 0] for i in string: if i.isalpha(): res[0] += 1 elif i in numbers: res[1] += 1 elif i in chars: res[2] += 1 else: pass print(f'There are {num_words} word(s), {res[0]} alphabets, {res[1]} digits and {res[2]} special characters in the given string.')
def problem1_1(): print("Problem Set 1") pass # replace this pass (a do-nothing) statement with your code
def problem1_1(): print('Problem Set 1') pass
"""Calculation Class""" class Calculation: """ calculation abstract base class""" # pylint: disable=too-few-public-methods def __init__(self,values: tuple): """ constructor method""" self.values = Calculation.convert_args_to_tuple_of_float(values) @classmethod def create(cls,values: tuple): """ factory method""" return cls(values) @staticmethod def convert_args_to_tuple_of_float(values: tuple): """ standardize values to list of floats""" #lists can be modified and tuple cannot, tuple are faster. #We need to convert the tuple of potentially random data types (its raw data) #into a standard data format to keep things consistent so we convert it to float #then i make it a tuple again because i actually won't need to change the calculation values #I can also use it as a list and then i would be able to edit the calculation list_values_float = [] for item in values: list_values_float.append(float(item)) return tuple(list_values_float)
"""Calculation Class""" class Calculation: """ calculation abstract base class""" def __init__(self, values: tuple): """ constructor method""" self.values = Calculation.convert_args_to_tuple_of_float(values) @classmethod def create(cls, values: tuple): """ factory method""" return cls(values) @staticmethod def convert_args_to_tuple_of_float(values: tuple): """ standardize values to list of floats""" list_values_float = [] for item in values: list_values_float.append(float(item)) return tuple(list_values_float)
# # PySNMP MIB module CTRON-SSR-CONFIG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SSR-CONFIG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:15:46 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint") ssrMibs, = mibBuilder.importSymbols("CTRON-SSR-SMI-MIB", "ssrMibs") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Counter32, MibIdentifier, IpAddress, Gauge32, Counter64, ModuleIdentity, iso, Bits, NotificationType, TimeTicks, Unsigned32, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Counter32", "MibIdentifier", "IpAddress", "Gauge32", "Counter64", "ModuleIdentity", "iso", "Bits", "NotificationType", "TimeTicks", "Unsigned32", "Integer32") TextualConvention, TruthValue, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString") ssrConfigMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230)) ssrConfigMIB.setRevisions(('2000-07-15 00:00', '2000-02-20 00:00', '1998-08-17 00:00',)) if mibBuilder.loadTexts: ssrConfigMIB.setLastUpdated('200007150000Z') if mibBuilder.loadTexts: ssrConfigMIB.setOrganization('Cabletron Systems, Inc') class SSRErrorCode(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8)) namedValues = NamedValues(("noStatus", 1), ("timeout", 2), ("networkError", 3), ("noSpace", 4), ("invalidConfig", 5), ("commandCompleted", 6), ("internalError", 7), ("tftpServerError", 8)) cfgGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231)) cfgTransferOp = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("noop", 1), ("sendConfigToAgent", 2), ("receiveConfigFromAgent", 3), ("receiveBootlogFromAgent", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgTransferOp.setStatus('current') cfgManagerAddress = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgManagerAddress.setStatus('current') cfgFileName = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgFileName.setStatus('current') cfgActivateTransfer = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 4), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgActivateTransfer.setStatus('current') cfgTransferStatus = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("idle", 1), ("sending", 2), ("receiving", 3), ("transferComplete", 4), ("error", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgTransferStatus.setStatus('current') cfgActivateFile = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 6), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfgActivateFile.setStatus('current') cfgLastError = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 7), SSRErrorCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgLastError.setStatus('current') cfgLastErrorReason = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgLastErrorReason.setStatus('current') cfgActiveImageVersion = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgActiveImageVersion.setStatus('current') cfgActiveImageBootLocation = MibScalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 10), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfgActiveImageBootLocation.setStatus('current') configConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3)) configCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1)) configGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2)) configCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1, 1)).setObjects(("CTRON-SSR-CONFIG-MIB", "configGroup10")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configCompliance = configCompliance.setStatus('obsolete') configCompliance2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1, 2)).setObjects(("CTRON-SSR-CONFIG-MIB", "configGroup20")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configCompliance2 = configCompliance2.setStatus('current') configGroup10 = ObjectGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2, 1)).setObjects(("CTRON-SSR-CONFIG-MIB", "cfgTransferOp"), ("CTRON-SSR-CONFIG-MIB", "cfgManagerAddress"), ("CTRON-SSR-CONFIG-MIB", "cfgFileName"), ("CTRON-SSR-CONFIG-MIB", "cfgActivateTransfer"), ("CTRON-SSR-CONFIG-MIB", "cfgTransferStatus"), ("CTRON-SSR-CONFIG-MIB", "cfgActivateFile"), ("CTRON-SSR-CONFIG-MIB", "cfgLastError"), ("CTRON-SSR-CONFIG-MIB", "cfgLastErrorReason")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configGroup10 = configGroup10.setStatus('deprecated') configGroup20 = ObjectGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2, 2)).setObjects(("CTRON-SSR-CONFIG-MIB", "cfgTransferOp"), ("CTRON-SSR-CONFIG-MIB", "cfgManagerAddress"), ("CTRON-SSR-CONFIG-MIB", "cfgFileName"), ("CTRON-SSR-CONFIG-MIB", "cfgActivateTransfer"), ("CTRON-SSR-CONFIG-MIB", "cfgTransferStatus"), ("CTRON-SSR-CONFIG-MIB", "cfgActivateFile"), ("CTRON-SSR-CONFIG-MIB", "cfgLastError"), ("CTRON-SSR-CONFIG-MIB", "cfgLastErrorReason"), ("CTRON-SSR-CONFIG-MIB", "cfgActiveImageVersion"), ("CTRON-SSR-CONFIG-MIB", "cfgActiveImageBootLocation")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): configGroup20 = configGroup20.setStatus('current') mibBuilder.exportSymbols("CTRON-SSR-CONFIG-MIB", cfgManagerAddress=cfgManagerAddress, cfgActiveImageVersion=cfgActiveImageVersion, cfgActivateFile=cfgActivateFile, configGroups=configGroups, cfgLastErrorReason=cfgLastErrorReason, ssrConfigMIB=ssrConfigMIB, SSRErrorCode=SSRErrorCode, configCompliance=configCompliance, configGroup20=configGroup20, cfgGroup=cfgGroup, cfgActiveImageBootLocation=cfgActiveImageBootLocation, configConformance=configConformance, configCompliance2=configCompliance2, cfgFileName=cfgFileName, cfgLastError=cfgLastError, configGroup10=configGroup10, cfgTransferOp=cfgTransferOp, PYSNMP_MODULE_ID=ssrConfigMIB, cfgActivateTransfer=cfgActivateTransfer, cfgTransferStatus=cfgTransferStatus, configCompliances=configCompliances)
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, constraints_intersection, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint') (ssr_mibs,) = mibBuilder.importSymbols('CTRON-SSR-SMI-MIB', 'ssrMibs') (module_compliance, object_group, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'ObjectGroup', 'NotificationGroup') (mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, counter32, mib_identifier, ip_address, gauge32, counter64, module_identity, iso, bits, notification_type, time_ticks, unsigned32, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'Counter32', 'MibIdentifier', 'IpAddress', 'Gauge32', 'Counter64', 'ModuleIdentity', 'iso', 'Bits', 'NotificationType', 'TimeTicks', 'Unsigned32', 'Integer32') (textual_convention, truth_value, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'DisplayString') ssr_config_mib = module_identity((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230)) ssrConfigMIB.setRevisions(('2000-07-15 00:00', '2000-02-20 00:00', '1998-08-17 00:00')) if mibBuilder.loadTexts: ssrConfigMIB.setLastUpdated('200007150000Z') if mibBuilder.loadTexts: ssrConfigMIB.setOrganization('Cabletron Systems, Inc') class Ssrerrorcode(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8)) named_values = named_values(('noStatus', 1), ('timeout', 2), ('networkError', 3), ('noSpace', 4), ('invalidConfig', 5), ('commandCompleted', 6), ('internalError', 7), ('tftpServerError', 8)) cfg_group = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231)) cfg_transfer_op = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('noop', 1), ('sendConfigToAgent', 2), ('receiveConfigFromAgent', 3), ('receiveBootlogFromAgent', 4)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgTransferOp.setStatus('current') cfg_manager_address = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 2), ip_address()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgManagerAddress.setStatus('current') cfg_file_name = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 3), display_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgFileName.setStatus('current') cfg_activate_transfer = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 4), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgActivateTransfer.setStatus('current') cfg_transfer_status = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('idle', 1), ('sending', 2), ('receiving', 3), ('transferComplete', 4), ('error', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgTransferStatus.setStatus('current') cfg_activate_file = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 6), truth_value()).setMaxAccess('readwrite') if mibBuilder.loadTexts: cfgActivateFile.setStatus('current') cfg_last_error = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 7), ssr_error_code()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgLastError.setStatus('current') cfg_last_error_reason = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 8), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgLastErrorReason.setStatus('current') cfg_active_image_version = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 9), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgActiveImageVersion.setStatus('current') cfg_active_image_boot_location = mib_scalar((1, 3, 6, 1, 4, 1, 52, 2501, 1, 231, 10), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: cfgActiveImageBootLocation.setStatus('current') config_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3)) config_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1)) config_groups = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2)) config_compliance = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1, 1)).setObjects(('CTRON-SSR-CONFIG-MIB', 'configGroup10')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): config_compliance = configCompliance.setStatus('obsolete') config_compliance2 = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 1, 2)).setObjects(('CTRON-SSR-CONFIG-MIB', 'configGroup20')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): config_compliance2 = configCompliance2.setStatus('current') config_group10 = object_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2, 1)).setObjects(('CTRON-SSR-CONFIG-MIB', 'cfgTransferOp'), ('CTRON-SSR-CONFIG-MIB', 'cfgManagerAddress'), ('CTRON-SSR-CONFIG-MIB', 'cfgFileName'), ('CTRON-SSR-CONFIG-MIB', 'cfgActivateTransfer'), ('CTRON-SSR-CONFIG-MIB', 'cfgTransferStatus'), ('CTRON-SSR-CONFIG-MIB', 'cfgActivateFile'), ('CTRON-SSR-CONFIG-MIB', 'cfgLastError'), ('CTRON-SSR-CONFIG-MIB', 'cfgLastErrorReason')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): config_group10 = configGroup10.setStatus('deprecated') config_group20 = object_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 230, 3, 2, 2)).setObjects(('CTRON-SSR-CONFIG-MIB', 'cfgTransferOp'), ('CTRON-SSR-CONFIG-MIB', 'cfgManagerAddress'), ('CTRON-SSR-CONFIG-MIB', 'cfgFileName'), ('CTRON-SSR-CONFIG-MIB', 'cfgActivateTransfer'), ('CTRON-SSR-CONFIG-MIB', 'cfgTransferStatus'), ('CTRON-SSR-CONFIG-MIB', 'cfgActivateFile'), ('CTRON-SSR-CONFIG-MIB', 'cfgLastError'), ('CTRON-SSR-CONFIG-MIB', 'cfgLastErrorReason'), ('CTRON-SSR-CONFIG-MIB', 'cfgActiveImageVersion'), ('CTRON-SSR-CONFIG-MIB', 'cfgActiveImageBootLocation')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): config_group20 = configGroup20.setStatus('current') mibBuilder.exportSymbols('CTRON-SSR-CONFIG-MIB', cfgManagerAddress=cfgManagerAddress, cfgActiveImageVersion=cfgActiveImageVersion, cfgActivateFile=cfgActivateFile, configGroups=configGroups, cfgLastErrorReason=cfgLastErrorReason, ssrConfigMIB=ssrConfigMIB, SSRErrorCode=SSRErrorCode, configCompliance=configCompliance, configGroup20=configGroup20, cfgGroup=cfgGroup, cfgActiveImageBootLocation=cfgActiveImageBootLocation, configConformance=configConformance, configCompliance2=configCompliance2, cfgFileName=cfgFileName, cfgLastError=cfgLastError, configGroup10=configGroup10, cfgTransferOp=cfgTransferOp, PYSNMP_MODULE_ID=ssrConfigMIB, cfgActivateTransfer=cfgActivateTransfer, cfgTransferStatus=cfgTransferStatus, configCompliances=configCompliances)
seats = [] with open("input.txt") as f: for line in f: line = line.replace("\n", "") seat = {} seat["raw"] = line seat["row"] = int(seat["raw"][:7].replace("F", "0").replace("B", "1"), 2) seat["column"] = int(seat["raw"][-3:].replace("L", "0").replace("R", "1"), 2) seat["id"] = seat["row"] * 8 + seat["column"] seats.append(seat) seats = sorted(seats, key=lambda k: k["id"], reverse=True) for i, seat in enumerate(seats): if seat["id"]-1 != seats[i+1]["id"]: print(seat["id"]-1) break
seats = [] with open('input.txt') as f: for line in f: line = line.replace('\n', '') seat = {} seat['raw'] = line seat['row'] = int(seat['raw'][:7].replace('F', '0').replace('B', '1'), 2) seat['column'] = int(seat['raw'][-3:].replace('L', '0').replace('R', '1'), 2) seat['id'] = seat['row'] * 8 + seat['column'] seats.append(seat) seats = sorted(seats, key=lambda k: k['id'], reverse=True) for (i, seat) in enumerate(seats): if seat['id'] - 1 != seats[i + 1]['id']: print(seat['id'] - 1) break
class MLModelInterface: def fit(self, features, labels): raise NotImplementedError def predict(self, data): raise NotImplementedError class KNeighborsClassifier(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class LinearRegression(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class LogisticsRegression(MLModelInterface): pass # Imput to the classifier features = [ (5.1, 3.5, 1.4, 0.2), (4.9, 3.0, 1.4, 0.2), (4.7, 3.2, 1.3, 0.2), (7.0, 3.2, 4.7, 1.4), (6.4, 3.2, 4.5, 1.5), (6.9, 3.1, 4.9, 1.5), (6.3, 3.3, 6.0, 2.5), (5.8, 2.7, 5.1, 1.9), (7.1, 3.0, 5.9, 2.1), ] # 0: I. setosa # 1: I. versicolor # 2: I. virginica labels = [0, 0, 0, 1, 1, 1, 2, 2, 2] to_predict = [ (5.7, 2.8, 4.1, 1.3), (4.9, 2.5, 4.5, 1.7), (4.6, 3.4, 1.4, 0.3), ] model = LinearRegression() model.fit(features, labels) model.predict(to_predict) # [1, 2, 0]
class Mlmodelinterface: def fit(self, features, labels): raise NotImplementedError def predict(self, data): raise NotImplementedError class Kneighborsclassifier(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class Linearregression(MLModelInterface): def fit(self, features, labels): pass def predict(self, data): pass class Logisticsregression(MLModelInterface): pass features = [(5.1, 3.5, 1.4, 0.2), (4.9, 3.0, 1.4, 0.2), (4.7, 3.2, 1.3, 0.2), (7.0, 3.2, 4.7, 1.4), (6.4, 3.2, 4.5, 1.5), (6.9, 3.1, 4.9, 1.5), (6.3, 3.3, 6.0, 2.5), (5.8, 2.7, 5.1, 1.9), (7.1, 3.0, 5.9, 2.1)] labels = [0, 0, 0, 1, 1, 1, 2, 2, 2] to_predict = [(5.7, 2.8, 4.1, 1.3), (4.9, 2.5, 4.5, 1.7), (4.6, 3.4, 1.4, 0.3)] model = linear_regression() model.fit(features, labels) model.predict(to_predict)
{ "targets": [ { "target_name": "gpio", "sources": ["gpio.cc", "tizen-gpio.cc"] } ] }
{'targets': [{'target_name': 'gpio', 'sources': ['gpio.cc', 'tizen-gpio.cc']}]}
songs = { ('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('Miles Davis', 'Stella by Starlight'), ('Nickelback', 'Animals') } # Using a set comprehension, create a new set that contains all songs that were not performed by Nickelback. nonNickelback = {}
songs = {('Nickelback', 'How You Remind Me'), ('Will.i.am', 'That Power'), ('Miles Davis', 'Stella by Starlight'), ('Nickelback', 'Animals')} non_nickelback = {}
def assign_variable(robot_instance, variable_name, args): """Assign a robotframework variable.""" variable_value = robot_instance.run_keyword(*args) robot_instance._variables.__setitem__(variable_name, variable_value) return variable_value
def assign_variable(robot_instance, variable_name, args): """Assign a robotframework variable.""" variable_value = robot_instance.run_keyword(*args) robot_instance._variables.__setitem__(variable_name, variable_value) return variable_value
file1 = open("./logs/pythonlog.txt", 'r+') avg1 = 0.0 lines1 = 0.0 for line in file1: lines1 = lines1 + 1.0 avg1 = (avg1 + float(line)) avg1 = avg1/lines1 print(avg1, "for Python with", lines1, "lines") file2 = open("./logs/clog.txt", 'r+') avg2 = 0.0 lines2 = 0.0 for line in file2: lines2 = lines2 + 1.0 avg2 = (avg2 + float(line)) avg2 = avg2/lines2 print(avg2, "for C with", lines2, "lines") file3 = open("./logs/cpplog.txt", 'r+') avg3 = 0.0 lines3 = 0.0 for line in file3: lines3 = lines3 + 1.0 avg3 = (avg3 + float(line)) avg3 = avg3/lines3 print(avg3, "for C++ with", lines3, "lines") file4 = open("./logs/javalog.txt", 'r+') avg4 = 0.0 lines4 = 0.0 for line in file4: lines4 = lines4 + 1.0 avg4 = (avg4 + float(line)) avg4 = avg4/lines4 print(avg4, "for Java with", lines4, "lines") word = "" while(word.lower() != "y" and word.lower() != "n"): word = input("Do you want to wipe the previous log? [Y/N]") if(word.lower() == "y"): file1.truncate(0) file3.truncate(0) file2.truncate(0) file4.truncate(0) print("Done.") file4.close() file3.close() file2.close() file1.close()
file1 = open('./logs/pythonlog.txt', 'r+') avg1 = 0.0 lines1 = 0.0 for line in file1: lines1 = lines1 + 1.0 avg1 = avg1 + float(line) avg1 = avg1 / lines1 print(avg1, 'for Python with', lines1, 'lines') file2 = open('./logs/clog.txt', 'r+') avg2 = 0.0 lines2 = 0.0 for line in file2: lines2 = lines2 + 1.0 avg2 = avg2 + float(line) avg2 = avg2 / lines2 print(avg2, 'for C with', lines2, 'lines') file3 = open('./logs/cpplog.txt', 'r+') avg3 = 0.0 lines3 = 0.0 for line in file3: lines3 = lines3 + 1.0 avg3 = avg3 + float(line) avg3 = avg3 / lines3 print(avg3, 'for C++ with', lines3, 'lines') file4 = open('./logs/javalog.txt', 'r+') avg4 = 0.0 lines4 = 0.0 for line in file4: lines4 = lines4 + 1.0 avg4 = avg4 + float(line) avg4 = avg4 / lines4 print(avg4, 'for Java with', lines4, 'lines') word = '' while word.lower() != 'y' and word.lower() != 'n': word = input('Do you want to wipe the previous log? [Y/N]') if word.lower() == 'y': file1.truncate(0) file3.truncate(0) file2.truncate(0) file4.truncate(0) print('Done.') file4.close() file3.close() file2.close() file1.close()
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def detectCycle(self, head: ListNode) -> ListNode: if head is None: return None # 1 - check cycle p1 = head p2 = head.next has_cycle = False while p2 is not None and p2.next is not None: if p1 == p2: has_cycle = True break p1 = p1.next p2 = p2.next.next if not has_cycle: return None # 2 - cycle length cycle_length = 1 p2 = p1.next while p1 != p2: p2 = p2.next cycle_length += 1 # 3 - problem 19, the nth node from the end # L = cycle + non # p1 moves cycle # p1 and p2 moves non, meeting at the start dummy = ListNode(None) dummy.next = head p1 = dummy for _ in range(cycle_length): p1 = p1.next p2 = dummy while p2 != p1: p1 = p1.next p2 = p2.next return p1 if __name__ == "__main__": head = ListNode(1) p = head node = ListNode(2) p.next = node p = p.next node = ListNode(3) p.next = node p = p.next node = ListNode(4) p.next = node p = p.next start = node node = ListNode(5) p.next = node p = p.next node = ListNode(6) p.next = node p = p.next node = ListNode(7) p.next = node p = p.next p.next = start sol = Solution() print(sol.detectCycle(head).val)
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def detect_cycle(self, head: ListNode) -> ListNode: if head is None: return None p1 = head p2 = head.next has_cycle = False while p2 is not None and p2.next is not None: if p1 == p2: has_cycle = True break p1 = p1.next p2 = p2.next.next if not has_cycle: return None cycle_length = 1 p2 = p1.next while p1 != p2: p2 = p2.next cycle_length += 1 dummy = list_node(None) dummy.next = head p1 = dummy for _ in range(cycle_length): p1 = p1.next p2 = dummy while p2 != p1: p1 = p1.next p2 = p2.next return p1 if __name__ == '__main__': head = list_node(1) p = head node = list_node(2) p.next = node p = p.next node = list_node(3) p.next = node p = p.next node = list_node(4) p.next = node p = p.next start = node node = list_node(5) p.next = node p = p.next node = list_node(6) p.next = node p = p.next node = list_node(7) p.next = node p = p.next p.next = start sol = solution() print(sol.detectCycle(head).val)
#!/usr/bin/python def add(a,b): return a+b def sub(a,b): return a-b def mul(a,b): return a*b def div(a,b): return a/b a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) print("Please select operation : \n" \ "1. Addition \n" \ "2. Subtraction \n" \ "3. Multiplication \n" \ "4. Division \n") select = int(input("Select operations form 1, 2, 3, 4 :")) if select == 1: print(a, "+", b, "=", add(a,b)) elif select == 2: print(a, "-", b, "=", sub(a,b)) elif select == 3: print(a, "*", b, "=", mul(a,b)) elif select == 4: if b == 0: exit elif b != 0: print(a, "/", b, "=", div(a,b)) else: print("Invalid input")
def add(a, b): return a + b def sub(a, b): return a - b def mul(a, b): return a * b def div(a, b): return a / b a = int(input('Enter first number: ')) b = int(input('Enter second number: ')) print('Please select operation : \n1. Addition \n2. Subtraction \n3. Multiplication \n4. Division \n') select = int(input('Select operations form 1, 2, 3, 4 :')) if select == 1: print(a, '+', b, '=', add(a, b)) elif select == 2: print(a, '-', b, '=', sub(a, b)) elif select == 3: print(a, '*', b, '=', mul(a, b)) elif select == 4: if b == 0: exit elif b != 0: print(a, '/', b, '=', div(a, b)) else: print('Invalid input')
# The classroom scheduling problem # Suppose you have a classroom and you want to hold as many classes as possible # __________________________ #| class | start | end | #|_______|_________|________| #| Art | 9:00 am | 10:30am| #|_______|_________|________| #| Eng | 9:30am | 10:30am| #|_______|_________|________| #| Math | 10 am | 11 am | #|_______|_________|________| #| CS | 10:30am | 11.30am| #|_______|_________|________| #| Music | 11 am | 12 pm | #|_______|_________|________| #| def schedule(classes): possible_classes = [] possible_classes.append(classes[0]) print(possible_classes) # return for i in range(2,len(classes)): if possible_classes[-1][1]<=classes[i][0]: possible_classes.append(classes[i]) return possible_classes
def schedule(classes): possible_classes = [] possible_classes.append(classes[0]) print(possible_classes) for i in range(2, len(classes)): if possible_classes[-1][1] <= classes[i][0]: possible_classes.append(classes[i]) return possible_classes
class restaurantvalidator(): def valideaza(self, restaurant): erori = [] if len(restaurant.nume) == 0: erori.append('numele nu trb sa fie null') if erori: raise ValueError(erori)
class Restaurantvalidator: def valideaza(self, restaurant): erori = [] if len(restaurant.nume) == 0: erori.append('numele nu trb sa fie null') if erori: raise value_error(erori)
OVERALL_CATEGORY_ID = '0x02E00000FFFFFFFF' HERO_CATEGORY_IDS = { 'reaper': '0x02E0000000000002', 'tracer': '0x02E0000000000003', 'mercy': '0x02E0000000000004', 'hanzo': '0x02E0000000000005', 'torbjorn': '0x02E0000000000006', 'reinhardt': '0x02E0000000000007', 'pharah': '0x02E0000000000008', 'winston': '0x02E0000000000009', 'widowmaker': '0x02E000000000000A', 'bastion': '0x02E0000000000015', 'symmetra': '0x02E0000000000016', 'zenyatta': '0x02E0000000000020', 'genji': '0x02E0000000000029', 'roadhog': '0x02E0000000000040', 'mccree': '0x02E0000000000042', 'junkrat': '0x02E0000000000065', 'zarya': '0x02E0000000000068', 'soldier76': '0x02E000000000006E', 'lucio': '0x02E0000000000079', 'dva': '0x02E000000000007A', 'mei': '0x02E00000000000DD', 'sombra': '0x02E000000000012E', 'ana': '0x02E000000000013B', 'orisa': '0x02E000000000013E', 'doomfist': '0x02E000000000012F', 'moira': '0x02E00000000001A2', 'brigitte': '0x02E0000000000195', 'wrecking_ball': '0x02E00000000001CA', } INVERTED_HERO_CATEGORY_IDS = {category_id: hero for hero, category_id in HERO_CATEGORY_IDS.items()} # Taken from https://github.com/SunDwarf/OWAPI/blob/master/owapi/prestige.py LEVEL_IDS = { # Bronze '0x0250000000000918': 0, '0x0250000000000919': 0, '0x025000000000091A': 0, '0x025000000000091B': 0, '0x025000000000091C': 0, '0x025000000000091D': 0, '0x025000000000091E': 0, '0x025000000000091F': 0, '0x0250000000000920': 0, '0x0250000000000921': 0, '0x0250000000000922': 100, '0x0250000000000924': 100, '0x0250000000000925': 100, '0x0250000000000926': 100, '0x025000000000094C': 100, '0x0250000000000927': 100, '0x0250000000000928': 100, '0x0250000000000929': 100, '0x025000000000092B': 100, '0x0250000000000950': 100, '0x025000000000092A': 200, '0x025000000000092C': 200, '0x0250000000000937': 200, '0x025000000000093B': 200, '0x0250000000000933': 200, '0x0250000000000923': 200, '0x0250000000000944': 200, '0x0250000000000948': 200, '0x025000000000093F': 200, '0x0250000000000951': 200, '0x025000000000092D': 300, '0x0250000000000930': 300, '0x0250000000000934': 300, '0x0250000000000938': 300, '0x0250000000000940': 300, '0x0250000000000949': 300, '0x0250000000000952': 300, '0x025000000000094D': 300, '0x0250000000000945': 300, '0x025000000000093C': 300, '0x025000000000092E': 400, '0x0250000000000931': 400, '0x0250000000000935': 400, '0x025000000000093D': 400, '0x0250000000000946': 400, '0x025000000000094A': 400, '0x0250000000000953': 400, '0x025000000000094E': 400, '0x0250000000000939': 400, '0x0250000000000941': 400, '0x025000000000092F': 500, '0x0250000000000932': 500, '0x025000000000093E': 500, '0x0250000000000936': 500, '0x025000000000093A': 500, '0x0250000000000942': 500, '0x0250000000000947': 500, '0x025000000000094F': 500, '0x025000000000094B': 500, '0x0250000000000954': 500, # Silver '0x0250000000000956': 600, '0x025000000000095C': 600, '0x025000000000095D': 600, '0x025000000000095E': 600, '0x025000000000095F': 600, '0x0250000000000960': 600, '0x0250000000000961': 600, '0x0250000000000962': 600, '0x0250000000000963': 600, '0x0250000000000964': 600, '0x0250000000000957': 700, '0x0250000000000965': 700, '0x0250000000000966': 700, '0x0250000000000967': 700, '0x0250000000000968': 700, '0x0250000000000969': 700, '0x025000000000096A': 700, '0x025000000000096B': 700, '0x025000000000096C': 700, '0x025000000000096D': 700, '0x0250000000000958': 800, '0x025000000000096E': 800, '0x025000000000096F': 800, '0x0250000000000970': 800, '0x0250000000000971': 800, '0x0250000000000972': 800, '0x0250000000000973': 800, '0x0250000000000974': 800, '0x0250000000000975': 800, '0x0250000000000976': 800, '0x0250000000000959': 900, '0x0250000000000977': 900, '0x0250000000000978': 900, '0x0250000000000979': 900, '0x025000000000097A': 900, '0x025000000000097B': 900, '0x025000000000097C': 900, '0x025000000000097D': 900, '0x025000000000097E': 900, '0x025000000000097F': 900, '0x025000000000095A': 1000, '0x0250000000000980': 1000, '0x0250000000000981': 1000, '0x0250000000000982': 1000, '0x0250000000000983': 1000, '0x0250000000000984': 1000, '0x0250000000000985': 1000, '0x0250000000000986': 1000, '0x0250000000000987': 1000, '0x0250000000000988': 1000, '0x025000000000095B': 1100, '0x0250000000000989': 1100, '0x025000000000098A': 1100, '0x025000000000098B': 1100, '0x025000000000098C': 1100, '0x025000000000098D': 1100, '0x025000000000098E': 1100, '0x025000000000098F': 1100, '0x0250000000000991': 1100, '0x0250000000000990': 1100, # Gold '0x0250000000000992': 1200, '0x0250000000000993': 1200, '0x0250000000000994': 1200, '0x0250000000000995': 1200, '0x0250000000000996': 1200, '0x0250000000000997': 1200, '0x0250000000000998': 1200, '0x0250000000000999': 1200, '0x025000000000099A': 1200, '0x025000000000099B': 1200, '0x025000000000099C': 1300, '0x025000000000099D': 1300, '0x025000000000099E': 1300, '0x025000000000099F': 1300, '0x02500000000009A0': 1300, '0x02500000000009A1': 1300, '0x02500000000009A2': 1300, '0x02500000000009A3': 1300, '0x02500000000009A4': 1300, '0x02500000000009A5': 1300, '0x02500000000009A6': 1400, '0x02500000000009A7': 1400, '0x02500000000009A8': 1400, '0x02500000000009A9': 1400, '0x02500000000009AA': 1400, '0x02500000000009AB': 1400, '0x02500000000009AC': 1400, '0x02500000000009AD': 1400, '0x02500000000009AE': 1400, '0x02500000000009AF': 1400, '0x02500000000009B0': 1500, '0x02500000000009B1': 1500, '0x02500000000009B2': 1500, '0x02500000000009B3': 1500, '0x02500000000009B4': 1500, '0x02500000000009B5': 1500, '0x02500000000009B6': 1500, '0x02500000000009B7': 1500, '0x02500000000009B8': 1500, '0x02500000000009B9': 1500, '0x02500000000009BA': 1600, '0x02500000000009BB': 1600, '0x02500000000009BC': 1600, '0x02500000000009BD': 1600, '0x02500000000009BE': 1600, '0x02500000000009BF': 1600, '0x02500000000009C0': 1600, '0x02500000000009C1': 1600, '0x02500000000009C2': 1600, '0x02500000000009C3': 1600, '0x02500000000009C4': 1700, '0x02500000000009C5': 1700, '0x02500000000009C6': 1700, '0x02500000000009C7': 1700, '0x02500000000009C8': 1700, '0x02500000000009C9': 1700, '0x02500000000009CA': 1700, '0x02500000000009CB': 1700, '0x02500000000009CC': 1700, '0x02500000000009CD': 1700, }
overall_category_id = '0x02E00000FFFFFFFF' hero_category_ids = {'reaper': '0x02E0000000000002', 'tracer': '0x02E0000000000003', 'mercy': '0x02E0000000000004', 'hanzo': '0x02E0000000000005', 'torbjorn': '0x02E0000000000006', 'reinhardt': '0x02E0000000000007', 'pharah': '0x02E0000000000008', 'winston': '0x02E0000000000009', 'widowmaker': '0x02E000000000000A', 'bastion': '0x02E0000000000015', 'symmetra': '0x02E0000000000016', 'zenyatta': '0x02E0000000000020', 'genji': '0x02E0000000000029', 'roadhog': '0x02E0000000000040', 'mccree': '0x02E0000000000042', 'junkrat': '0x02E0000000000065', 'zarya': '0x02E0000000000068', 'soldier76': '0x02E000000000006E', 'lucio': '0x02E0000000000079', 'dva': '0x02E000000000007A', 'mei': '0x02E00000000000DD', 'sombra': '0x02E000000000012E', 'ana': '0x02E000000000013B', 'orisa': '0x02E000000000013E', 'doomfist': '0x02E000000000012F', 'moira': '0x02E00000000001A2', 'brigitte': '0x02E0000000000195', 'wrecking_ball': '0x02E00000000001CA'} inverted_hero_category_ids = {category_id: hero for (hero, category_id) in HERO_CATEGORY_IDS.items()} level_ids = {'0x0250000000000918': 0, '0x0250000000000919': 0, '0x025000000000091A': 0, '0x025000000000091B': 0, '0x025000000000091C': 0, '0x025000000000091D': 0, '0x025000000000091E': 0, '0x025000000000091F': 0, '0x0250000000000920': 0, '0x0250000000000921': 0, '0x0250000000000922': 100, '0x0250000000000924': 100, '0x0250000000000925': 100, '0x0250000000000926': 100, '0x025000000000094C': 100, '0x0250000000000927': 100, '0x0250000000000928': 100, '0x0250000000000929': 100, '0x025000000000092B': 100, '0x0250000000000950': 100, '0x025000000000092A': 200, '0x025000000000092C': 200, '0x0250000000000937': 200, '0x025000000000093B': 200, '0x0250000000000933': 200, '0x0250000000000923': 200, '0x0250000000000944': 200, '0x0250000000000948': 200, '0x025000000000093F': 200, '0x0250000000000951': 200, '0x025000000000092D': 300, '0x0250000000000930': 300, '0x0250000000000934': 300, '0x0250000000000938': 300, '0x0250000000000940': 300, '0x0250000000000949': 300, '0x0250000000000952': 300, '0x025000000000094D': 300, '0x0250000000000945': 300, '0x025000000000093C': 300, '0x025000000000092E': 400, '0x0250000000000931': 400, '0x0250000000000935': 400, '0x025000000000093D': 400, '0x0250000000000946': 400, '0x025000000000094A': 400, '0x0250000000000953': 400, '0x025000000000094E': 400, '0x0250000000000939': 400, '0x0250000000000941': 400, '0x025000000000092F': 500, '0x0250000000000932': 500, '0x025000000000093E': 500, '0x0250000000000936': 500, '0x025000000000093A': 500, '0x0250000000000942': 500, '0x0250000000000947': 500, '0x025000000000094F': 500, '0x025000000000094B': 500, '0x0250000000000954': 500, '0x0250000000000956': 600, '0x025000000000095C': 600, '0x025000000000095D': 600, '0x025000000000095E': 600, '0x025000000000095F': 600, '0x0250000000000960': 600, '0x0250000000000961': 600, '0x0250000000000962': 600, '0x0250000000000963': 600, '0x0250000000000964': 600, '0x0250000000000957': 700, '0x0250000000000965': 700, '0x0250000000000966': 700, '0x0250000000000967': 700, '0x0250000000000968': 700, '0x0250000000000969': 700, '0x025000000000096A': 700, '0x025000000000096B': 700, '0x025000000000096C': 700, '0x025000000000096D': 700, '0x0250000000000958': 800, '0x025000000000096E': 800, '0x025000000000096F': 800, '0x0250000000000970': 800, '0x0250000000000971': 800, '0x0250000000000972': 800, '0x0250000000000973': 800, '0x0250000000000974': 800, '0x0250000000000975': 800, '0x0250000000000976': 800, '0x0250000000000959': 900, '0x0250000000000977': 900, '0x0250000000000978': 900, '0x0250000000000979': 900, '0x025000000000097A': 900, '0x025000000000097B': 900, '0x025000000000097C': 900, '0x025000000000097D': 900, '0x025000000000097E': 900, '0x025000000000097F': 900, '0x025000000000095A': 1000, '0x0250000000000980': 1000, '0x0250000000000981': 1000, '0x0250000000000982': 1000, '0x0250000000000983': 1000, '0x0250000000000984': 1000, '0x0250000000000985': 1000, '0x0250000000000986': 1000, '0x0250000000000987': 1000, '0x0250000000000988': 1000, '0x025000000000095B': 1100, '0x0250000000000989': 1100, '0x025000000000098A': 1100, '0x025000000000098B': 1100, '0x025000000000098C': 1100, '0x025000000000098D': 1100, '0x025000000000098E': 1100, '0x025000000000098F': 1100, '0x0250000000000991': 1100, '0x0250000000000990': 1100, '0x0250000000000992': 1200, '0x0250000000000993': 1200, '0x0250000000000994': 1200, '0x0250000000000995': 1200, '0x0250000000000996': 1200, '0x0250000000000997': 1200, '0x0250000000000998': 1200, '0x0250000000000999': 1200, '0x025000000000099A': 1200, '0x025000000000099B': 1200, '0x025000000000099C': 1300, '0x025000000000099D': 1300, '0x025000000000099E': 1300, '0x025000000000099F': 1300, '0x02500000000009A0': 1300, '0x02500000000009A1': 1300, '0x02500000000009A2': 1300, '0x02500000000009A3': 1300, '0x02500000000009A4': 1300, '0x02500000000009A5': 1300, '0x02500000000009A6': 1400, '0x02500000000009A7': 1400, '0x02500000000009A8': 1400, '0x02500000000009A9': 1400, '0x02500000000009AA': 1400, '0x02500000000009AB': 1400, '0x02500000000009AC': 1400, '0x02500000000009AD': 1400, '0x02500000000009AE': 1400, '0x02500000000009AF': 1400, '0x02500000000009B0': 1500, '0x02500000000009B1': 1500, '0x02500000000009B2': 1500, '0x02500000000009B3': 1500, '0x02500000000009B4': 1500, '0x02500000000009B5': 1500, '0x02500000000009B6': 1500, '0x02500000000009B7': 1500, '0x02500000000009B8': 1500, '0x02500000000009B9': 1500, '0x02500000000009BA': 1600, '0x02500000000009BB': 1600, '0x02500000000009BC': 1600, '0x02500000000009BD': 1600, '0x02500000000009BE': 1600, '0x02500000000009BF': 1600, '0x02500000000009C0': 1600, '0x02500000000009C1': 1600, '0x02500000000009C2': 1600, '0x02500000000009C3': 1600, '0x02500000000009C4': 1700, '0x02500000000009C5': 1700, '0x02500000000009C6': 1700, '0x02500000000009C7': 1700, '0x02500000000009C8': 1700, '0x02500000000009C9': 1700, '0x02500000000009CA': 1700, '0x02500000000009CB': 1700, '0x02500000000009CC': 1700, '0x02500000000009CD': 1700}
class Section: def get_display_text(self): pass def get_children(self): pass
class Section: def get_display_text(self): pass def get_children(self): pass
def solution(prices): if len(prices) == 0: return 0 # We are always paying the first price. total = prices[0] min_price = prices[0] for i in range(1, len(prices)): if prices[i] > min_price: total += prices[i] - min_price if prices[i] < min_price: min_price = prices[i] return total def num_divisors(number, keys): count = 0 for key in keys: if number % key == 0: count += 1 return count def encryptionValidity(instructionCount, validityPeriod, keys): max_num_divisors = float('-inf') for key in keys: num = num_divisors(key, keys) if num > max_num_divisors: max_num_divisors = num encryption_strength = max_num_divisors * pow(10, 5) is_crackable = 1 if encryption_strength / instructionCount > validityPeriod: is_crackable = 0 return is_crackable, encryption_strength # Write a function that accepts as an argument a string of addition/subtraction operations. # The function should return the result of the operations as an integer # ex: calculate("1 - 2 + 3") => 2 def apply_op(op, a, b): if op == 'plus': return a + b if op == 'minus': return a - b def calculate(expression): tokens = expression.split(" ") result = 0 last_op = 'plus' for token in tokens: if token == "": continue if str.isdigit(token): new_val = int(token) result = apply_op(last_op, result, new_val) if token == '+': last_op = 'plus' if token == '-': last_op = 'minus' return result # Next, write a function that accepts as an argument a string of addition/subtraction # operations and also includes parentheses to indicate order of operations. The function # should return the result of the operations as an integer # ex: calculate("1 - (2 + 3)") => -4 def parse_number(expression): if len(expression) == 0: return '', expression hd, tl = expression[0], expression[1:] if str.isdigit(hd) == False: return '', expression more, rest = parse_number(tl) return hd + more, rest def tokenize(expression): if len(expression) == 0: return [] hd, tl = expression[0], expression[1:] if hd == ' ': return tokenize(tl) if str.isdigit(hd): num, rest = parse_number(expression) return [int(num)] + tokenize(rest) if hd in ['(', ')', '+', '-']: return [hd] + tokenize(tl) def calculate_two_rec(tokens, result_so_far, last_op): if len(tokens) == 0: return result_so_far, [] token, rest = tokens[0], tokens[1:] if isinstance(token, int): return calculate_two_rec(rest, apply_op(last_op, result_so_far, token), last_op) if token == '+': return calculate_two_rec(rest, result_so_far, 'plus') if token == '-': return calculate_two_rec(rest, result_so_far, 'minus') if token == '(': value_in_paran, rest_after_paran = calculate_two_rec(rest, 0, 'plus') return calculate_two_rec(rest_after_paran, apply_op(last_op, result_so_far, value_in_paran), 'plus') if token == ')': return result_so_far, rest def calculate_two(expression): tokens = tokenize(expression) final_result, _ = calculate_two_rec(tokens, 0, 'plus') return final_result
def solution(prices): if len(prices) == 0: return 0 total = prices[0] min_price = prices[0] for i in range(1, len(prices)): if prices[i] > min_price: total += prices[i] - min_price if prices[i] < min_price: min_price = prices[i] return total def num_divisors(number, keys): count = 0 for key in keys: if number % key == 0: count += 1 return count def encryption_validity(instructionCount, validityPeriod, keys): max_num_divisors = float('-inf') for key in keys: num = num_divisors(key, keys) if num > max_num_divisors: max_num_divisors = num encryption_strength = max_num_divisors * pow(10, 5) is_crackable = 1 if encryption_strength / instructionCount > validityPeriod: is_crackable = 0 return (is_crackable, encryption_strength) def apply_op(op, a, b): if op == 'plus': return a + b if op == 'minus': return a - b def calculate(expression): tokens = expression.split(' ') result = 0 last_op = 'plus' for token in tokens: if token == '': continue if str.isdigit(token): new_val = int(token) result = apply_op(last_op, result, new_val) if token == '+': last_op = 'plus' if token == '-': last_op = 'minus' return result def parse_number(expression): if len(expression) == 0: return ('', expression) (hd, tl) = (expression[0], expression[1:]) if str.isdigit(hd) == False: return ('', expression) (more, rest) = parse_number(tl) return (hd + more, rest) def tokenize(expression): if len(expression) == 0: return [] (hd, tl) = (expression[0], expression[1:]) if hd == ' ': return tokenize(tl) if str.isdigit(hd): (num, rest) = parse_number(expression) return [int(num)] + tokenize(rest) if hd in ['(', ')', '+', '-']: return [hd] + tokenize(tl) def calculate_two_rec(tokens, result_so_far, last_op): if len(tokens) == 0: return (result_so_far, []) (token, rest) = (tokens[0], tokens[1:]) if isinstance(token, int): return calculate_two_rec(rest, apply_op(last_op, result_so_far, token), last_op) if token == '+': return calculate_two_rec(rest, result_so_far, 'plus') if token == '-': return calculate_two_rec(rest, result_so_far, 'minus') if token == '(': (value_in_paran, rest_after_paran) = calculate_two_rec(rest, 0, 'plus') return calculate_two_rec(rest_after_paran, apply_op(last_op, result_so_far, value_in_paran), 'plus') if token == ')': return (result_so_far, rest) def calculate_two(expression): tokens = tokenize(expression) (final_result, _) = calculate_two_rec(tokens, 0, 'plus') return final_result
# /////////////////////////////////////////////////////////////////////////// # # # # /////////////////////////////////////////////////////////////////////////// class GLLight: def __init__(self, pos=(0.0,0.0,0.0), color=(1.0,1.0,1.0)): self.pos = pos self.color = color self.ambient = (1.0, 1.0, 1.0) self.diffuse = (1.0, 1.0, 1.0) # attenuation self.constant = 1.0 self.linear = 0.09 self.quadratic = 0.032
class Gllight: def __init__(self, pos=(0.0, 0.0, 0.0), color=(1.0, 1.0, 1.0)): self.pos = pos self.color = color self.ambient = (1.0, 1.0, 1.0) self.diffuse = (1.0, 1.0, 1.0) self.constant = 1.0 self.linear = 0.09 self.quadratic = 0.032
def splitbylength(wordlist): initlen = len(wordlist[0]) lastlen = len(wordlist[-1]) splitlist = [] for i in range(initlen, lastlen+1): curlist = [] for x in wordlist: if len(x) == i: curlist.append(x.capitalize()) splitlist.append(sorted(curlist)) return splitlist
def splitbylength(wordlist): initlen = len(wordlist[0]) lastlen = len(wordlist[-1]) splitlist = [] for i in range(initlen, lastlen + 1): curlist = [] for x in wordlist: if len(x) == i: curlist.append(x.capitalize()) splitlist.append(sorted(curlist)) return splitlist
if __name__ == '__main__': checksum = 0 while True: try: numbers = input() except EOFError: break numbers = map(int, numbers.split('\t')) numbers = sorted(numbers) checksum += numbers[-1] - numbers[0] print(checksum)
if __name__ == '__main__': checksum = 0 while True: try: numbers = input() except EOFError: break numbers = map(int, numbers.split('\t')) numbers = sorted(numbers) checksum += numbers[-1] - numbers[0] print(checksum)
# # PySNMP MIB module ITOUCH-RADIUS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ITOUCH-RADIUS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:47:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") iTouch, = mibBuilder.importSymbols("ITOUCH-MIB", "iTouch") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter64, Integer32, Gauge32, ModuleIdentity, Unsigned32, Counter32, TimeTicks, NotificationType, iso, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, IpAddress, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Integer32", "Gauge32", "ModuleIdentity", "Unsigned32", "Counter32", "TimeTicks", "NotificationType", "iso", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "IpAddress", "MibIdentifier") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") xRadius = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35)) xRadiusPort = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 1)) xRadiusCircuit = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 2)) xRadiusConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 3)) xRadiusServers = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 4)) xRadiusCounters = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 5)) xRadiusPortTable = MibTable((1, 3, 6, 1, 4, 1, 33, 35, 1, 1), ) if mibBuilder.loadTexts: xRadiusPortTable.setStatus('mandatory') xRadiusPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1), ).setIndexNames((0, "ITOUCH-RADIUS-MIB", "xRadiusPortIndex")) if mibBuilder.loadTexts: xRadiusPortEntry.setStatus('mandatory') xRadiusPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusPortIndex.setStatus('mandatory') xRadiusPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusPortStatus.setStatus('mandatory') xRadiusPortSolicitStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusPortSolicitStatus.setStatus('mandatory') xRadiusAcctPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2), ("limited", 3))).clone('disabled')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusAcctPortStatus.setStatus('mandatory') xRadiusCircuitTable = MibTable((1, 3, 6, 1, 4, 1, 33, 35, 2, 1), ) if mibBuilder.loadTexts: xRadiusCircuitTable.setStatus('mandatory') xRadiusCircuitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1), ).setIndexNames((0, "ITOUCH-RADIUS-MIB", "xRadiusCircuitIndex")) if mibBuilder.loadTexts: xRadiusCircuitEntry.setStatus('mandatory') xRadiusCircuitIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusCircuitIndex.setStatus('mandatory') xRadiusCircAcctOnOff = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2), ("limited", 3))).clone('disabled')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusCircAcctOnOff.setStatus('mandatory') xRadiusAuthServerPort = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(1645)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusAuthServerPort.setStatus('mandatory') xRadiusAcctServerPort = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(1646)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusAcctServerPort.setStatus('mandatory') xRadiusTimeout = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)).clone(5)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusTimeout.setStatus('mandatory') xRadiusServerRetries = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10)).clone(3)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusServerRetries.setStatus('mandatory') xRadiusAcctLogAttempts = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 50000)).clone(5)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusAcctLogAttempts.setStatus('mandatory') xRadiusChapChallengeSize = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 128)).clone(16)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusChapChallengeSize.setStatus('mandatory') xRadiusLogging = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusLogging.setStatus('mandatory') xRadiusMessage = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(40, 40)).setFixedLength(40)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusMessage.setStatus('mandatory') xRadServer1SubGrp = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 4, 1)) xRadServer2SubGrp = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 4, 2)) xRadiusServerName1 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(51, 51)).setFixedLength(51)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusServerName1.setStatus('mandatory') xRadiusSecret1 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32).clone('Default_Secret')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusSecret1.setStatus('obsolete') xRadiusServerAccess1 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusServerAccess1.setStatus('mandatory') xRadiusServerAccessFailed1 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusServerAccessFailed1.setStatus('mandatory') xRadiusServerName2 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(51, 51)).setFixedLength(51)).setMaxAccess("readwrite") if mibBuilder.loadTexts: xRadiusServerName2.setStatus('mandatory') xRadiusSecret2 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32).clone('Default_Secret')).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusSecret2.setStatus('obsolete') xRadiusServerAccess2 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusServerAccess2.setStatus('mandatory') xRadiusServerAccessFailed2 = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusServerAccessFailed2.setStatus('mandatory') xRadAuthCtsSubGrp = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 5, 1)) xRadAcctCtsSubGrp = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 35, 5, 2)) xRadiusLogins = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusLogins.setStatus('mandatory') xRadiusLoginsFailed = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusLoginsFailed.setStatus('mandatory') xRadiusConfigFailed = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusConfigFailed.setStatus('mandatory') xRadiusPolicyFailed = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusPolicyFailed.setStatus('mandatory') xRadiusAcctSuccess = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusAcctSuccess.setStatus('mandatory') xRadiusAcctFailed = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusAcctFailed.setStatus('mandatory') xRadiusAcctReqWait = MibScalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xRadiusAcctReqWait.setStatus('mandatory') mibBuilder.exportSymbols("ITOUCH-RADIUS-MIB", xRadiusConfigFailed=xRadiusConfigFailed, xRadiusLogging=xRadiusLogging, xRadiusCounters=xRadiusCounters, xRadiusAcctPortStatus=xRadiusAcctPortStatus, xRadiusPortIndex=xRadiusPortIndex, xRadiusChapChallengeSize=xRadiusChapChallengeSize, xRadiusCircuitTable=xRadiusCircuitTable, xRadiusCircuitEntry=xRadiusCircuitEntry, xRadiusAcctServerPort=xRadiusAcctServerPort, xRadiusMessage=xRadiusMessage, xRadiusAcctLogAttempts=xRadiusAcctLogAttempts, xRadServer2SubGrp=xRadServer2SubGrp, xRadius=xRadius, xRadiusServerAccess1=xRadiusServerAccess1, xRadiusServerAccessFailed2=xRadiusServerAccessFailed2, xRadiusCircuitIndex=xRadiusCircuitIndex, xRadiusServerAccess2=xRadiusServerAccess2, xRadAcctCtsSubGrp=xRadAcctCtsSubGrp, xRadiusLoginsFailed=xRadiusLoginsFailed, xRadiusAcctSuccess=xRadiusAcctSuccess, xRadiusServerName2=xRadiusServerName2, xRadiusTimeout=xRadiusTimeout, xRadiusAcctReqWait=xRadiusAcctReqWait, xRadServer1SubGrp=xRadServer1SubGrp, xRadiusPort=xRadiusPort, xRadiusPortTable=xRadiusPortTable, xRadiusPortSolicitStatus=xRadiusPortSolicitStatus, xRadiusServerAccessFailed1=xRadiusServerAccessFailed1, xRadiusCircAcctOnOff=xRadiusCircAcctOnOff, xRadiusLogins=xRadiusLogins, xRadiusAcctFailed=xRadiusAcctFailed, xRadiusPolicyFailed=xRadiusPolicyFailed, xRadiusConfig=xRadiusConfig, xRadiusCircuit=xRadiusCircuit, xRadiusServers=xRadiusServers, xRadAuthCtsSubGrp=xRadAuthCtsSubGrp, xRadiusSecret2=xRadiusSecret2, xRadiusServerRetries=xRadiusServerRetries, xRadiusServerName1=xRadiusServerName1, xRadiusPortStatus=xRadiusPortStatus, xRadiusAuthServerPort=xRadiusAuthServerPort, xRadiusPortEntry=xRadiusPortEntry, xRadiusSecret1=xRadiusSecret1)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint') (i_touch,) = mibBuilder.importSymbols('ITOUCH-MIB', 'iTouch') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter64, integer32, gauge32, module_identity, unsigned32, counter32, time_ticks, notification_type, iso, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, ip_address, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'Integer32', 'Gauge32', 'ModuleIdentity', 'Unsigned32', 'Counter32', 'TimeTicks', 'NotificationType', 'iso', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'IpAddress', 'MibIdentifier') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') x_radius = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35)) x_radius_port = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 1)) x_radius_circuit = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 2)) x_radius_config = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 3)) x_radius_servers = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 4)) x_radius_counters = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 5)) x_radius_port_table = mib_table((1, 3, 6, 1, 4, 1, 33, 35, 1, 1)) if mibBuilder.loadTexts: xRadiusPortTable.setStatus('mandatory') x_radius_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1)).setIndexNames((0, 'ITOUCH-RADIUS-MIB', 'xRadiusPortIndex')) if mibBuilder.loadTexts: xRadiusPortEntry.setStatus('mandatory') x_radius_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusPortIndex.setStatus('mandatory') x_radius_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('disabled')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusPortStatus.setStatus('mandatory') x_radius_port_solicit_status = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusPortSolicitStatus.setStatus('mandatory') x_radius_acct_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2), ('limited', 3))).clone('disabled')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusAcctPortStatus.setStatus('mandatory') x_radius_circuit_table = mib_table((1, 3, 6, 1, 4, 1, 33, 35, 2, 1)) if mibBuilder.loadTexts: xRadiusCircuitTable.setStatus('mandatory') x_radius_circuit_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1)).setIndexNames((0, 'ITOUCH-RADIUS-MIB', 'xRadiusCircuitIndex')) if mibBuilder.loadTexts: xRadiusCircuitEntry.setStatus('mandatory') x_radius_circuit_index = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusCircuitIndex.setStatus('mandatory') x_radius_circ_acct_on_off = mib_table_column((1, 3, 6, 1, 4, 1, 33, 35, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2), ('limited', 3))).clone('disabled')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusCircAcctOnOff.setStatus('mandatory') x_radius_auth_server_port = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535)).clone(1645)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusAuthServerPort.setStatus('mandatory') x_radius_acct_server_port = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535)).clone(1646)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusAcctServerPort.setStatus('mandatory') x_radius_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 255)).clone(5)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusTimeout.setStatus('mandatory') x_radius_server_retries = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 10)).clone(3)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusServerRetries.setStatus('mandatory') x_radius_acct_log_attempts = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 50000)).clone(5)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusAcctLogAttempts.setStatus('mandatory') x_radius_chap_challenge_size = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 6), integer32().subtype(subtypeSpec=value_range_constraint(4, 128)).clone(16)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusChapChallengeSize.setStatus('mandatory') x_radius_logging = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusLogging.setStatus('mandatory') x_radius_message = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 3, 8), display_string().subtype(subtypeSpec=value_size_constraint(40, 40)).setFixedLength(40)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusMessage.setStatus('mandatory') x_rad_server1_sub_grp = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 4, 1)) x_rad_server2_sub_grp = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 4, 2)) x_radius_server_name1 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 1), octet_string().subtype(subtypeSpec=value_size_constraint(51, 51)).setFixedLength(51)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusServerName1.setStatus('mandatory') x_radius_secret1 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(32, 32)).setFixedLength(32).clone('Default_Secret')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusSecret1.setStatus('obsolete') x_radius_server_access1 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusServerAccess1.setStatus('mandatory') x_radius_server_access_failed1 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusServerAccessFailed1.setStatus('mandatory') x_radius_server_name2 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 1), octet_string().subtype(subtypeSpec=value_size_constraint(51, 51)).setFixedLength(51)).setMaxAccess('readwrite') if mibBuilder.loadTexts: xRadiusServerName2.setStatus('mandatory') x_radius_secret2 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 2), octet_string().subtype(subtypeSpec=value_size_constraint(32, 32)).setFixedLength(32).clone('Default_Secret')).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusSecret2.setStatus('obsolete') x_radius_server_access2 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusServerAccess2.setStatus('mandatory') x_radius_server_access_failed2 = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 4, 2, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusServerAccessFailed2.setStatus('mandatory') x_rad_auth_cts_sub_grp = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 5, 1)) x_rad_acct_cts_sub_grp = mib_identifier((1, 3, 6, 1, 4, 1, 33, 35, 5, 2)) x_radius_logins = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusLogins.setStatus('mandatory') x_radius_logins_failed = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusLoginsFailed.setStatus('mandatory') x_radius_config_failed = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusConfigFailed.setStatus('mandatory') x_radius_policy_failed = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusPolicyFailed.setStatus('mandatory') x_radius_acct_success = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusAcctSuccess.setStatus('mandatory') x_radius_acct_failed = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusAcctFailed.setStatus('mandatory') x_radius_acct_req_wait = mib_scalar((1, 3, 6, 1, 4, 1, 33, 35, 5, 2, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xRadiusAcctReqWait.setStatus('mandatory') mibBuilder.exportSymbols('ITOUCH-RADIUS-MIB', xRadiusConfigFailed=xRadiusConfigFailed, xRadiusLogging=xRadiusLogging, xRadiusCounters=xRadiusCounters, xRadiusAcctPortStatus=xRadiusAcctPortStatus, xRadiusPortIndex=xRadiusPortIndex, xRadiusChapChallengeSize=xRadiusChapChallengeSize, xRadiusCircuitTable=xRadiusCircuitTable, xRadiusCircuitEntry=xRadiusCircuitEntry, xRadiusAcctServerPort=xRadiusAcctServerPort, xRadiusMessage=xRadiusMessage, xRadiusAcctLogAttempts=xRadiusAcctLogAttempts, xRadServer2SubGrp=xRadServer2SubGrp, xRadius=xRadius, xRadiusServerAccess1=xRadiusServerAccess1, xRadiusServerAccessFailed2=xRadiusServerAccessFailed2, xRadiusCircuitIndex=xRadiusCircuitIndex, xRadiusServerAccess2=xRadiusServerAccess2, xRadAcctCtsSubGrp=xRadAcctCtsSubGrp, xRadiusLoginsFailed=xRadiusLoginsFailed, xRadiusAcctSuccess=xRadiusAcctSuccess, xRadiusServerName2=xRadiusServerName2, xRadiusTimeout=xRadiusTimeout, xRadiusAcctReqWait=xRadiusAcctReqWait, xRadServer1SubGrp=xRadServer1SubGrp, xRadiusPort=xRadiusPort, xRadiusPortTable=xRadiusPortTable, xRadiusPortSolicitStatus=xRadiusPortSolicitStatus, xRadiusServerAccessFailed1=xRadiusServerAccessFailed1, xRadiusCircAcctOnOff=xRadiusCircAcctOnOff, xRadiusLogins=xRadiusLogins, xRadiusAcctFailed=xRadiusAcctFailed, xRadiusPolicyFailed=xRadiusPolicyFailed, xRadiusConfig=xRadiusConfig, xRadiusCircuit=xRadiusCircuit, xRadiusServers=xRadiusServers, xRadAuthCtsSubGrp=xRadAuthCtsSubGrp, xRadiusSecret2=xRadiusSecret2, xRadiusServerRetries=xRadiusServerRetries, xRadiusServerName1=xRadiusServerName1, xRadiusPortStatus=xRadiusPortStatus, xRadiusAuthServerPort=xRadiusAuthServerPort, xRadiusPortEntry=xRadiusPortEntry, xRadiusSecret1=xRadiusSecret1)
# -*- coding: utf-8 -*- """ Created on Tue May 31 17:02:24 2016 @author: rmondoncancel """ # Deprecated priorityList = [ { 'name': 'fistOfFire', 'group': 'monk', 'prepull': True, 'condition': { 'type': 'buffPresent', 'name': 'fistOfFire', 'comparison': 'is', 'value': False, } }, { 'name': 'perfectBalance', 'group': 'pugilist', 'prepull': True, }, { 'name': 'bloodForBlood', 'group': 'lancer', 'condition': { 'logic': 'and', 'list': [ { 'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True, }, ] } }, { 'name': 'perfectBalance', 'group': 'pugilist', 'condition': { 'type': 'cooldownPresent', 'name': 'tornadoKick', 'comparison': 'is', 'value': False, } }, { 'name': 'tornadoKick', 'group': 'monk', 'condition': { 'logic': 'and', 'list': [ { 'type': 'buffTimeLeft', 'name': 'perfectBalance', 'comparison': '>=', 'value': 7, }, { 'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True, } ], } }, { 'name': 'internalRelease', 'group': 'pugilist', 'condition': { 'logic': 'and', 'list': [ { 'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True, }, { 'type': 'cooldownTimeLeft', 'name': 'elixirField', 'comparison': '<=', 'value': 6, }, ] } }, { 'name': 'potionOfStrengthHQ', 'group': 'item', 'condition': { 'logic': 'and', 'list': [ { 'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True, }, ] } }, { 'name': 'howlingFist', 'group': 'pugilist', 'condition': { 'type': 'buffPresent', 'name': 'internalRelease', 'comparison': 'is', 'value': True, } }, { 'name': 'elixirField', 'group': 'monk', 'condition': { 'logic': 'or', 'list': [ { 'type': 'buffPresent', 'name': 'internalRelease', 'comparison': 'is', 'value': True, }, { 'type': 'cooldownTimeLeft', 'name': 'internalRelease', 'comparison': '>=', 'value': 20, }, ], } }, { 'name': 'steelPeak', 'group': 'pugilist', 'condition': { 'logic': 'and', 'list': [ { 'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True, }, ] } }, { 'name': 'touchOfDeath', 'group': 'pugilist', 'condition': { 'logic': 'and', 'list': [ { 'type': 'debuffTimeLeft', 'name': 'touchOfDeath', 'comparison': '<=', 'value': 1.5, }, { 'type': 'debuffPresent', 'name': 'dragonKick', 'comparison': 'is', 'value': True, }, { 'type': 'buffPresent', 'name': 'twinSnakes', 'comparison': 'is', 'value': True, }, ] } }, { 'name': 'fracture', 'group': 'marauder', 'condition': { 'logic': 'and', 'list': [ { 'type': 'debuffTimeLeft', 'name': 'fracture', 'comparison': '<=', 'value': 1.5, }, { 'type': 'debuffPresent', 'name': 'dragonKick', 'comparison': 'is', 'value': True, }, { 'type': 'buffPresent', 'name': 'twinSnakes', 'comparison': 'is', 'value': True, }, ] } }, { 'name': 'demolish', 'group': 'pugilist', 'condition': { 'type': 'debuffTimeLeft', 'name': 'demolish', 'comparison': '<=', 'value': 4, }, }, { 'name': 'twinSnakes', 'group': 'pugilist', 'condition': { 'type': 'buffTimeLeft', 'name': 'twinSnakes', 'comparison': '<=', 'value': 5, }, }, { 'name': 'snapPunch', 'group': 'pugilist', }, { 'name': 'dragonKick', 'group': 'monk', 'condition': { 'type': 'debuffTimeLeft', 'name': 'dragonKick', 'comparison': '<=', 'value': 5, }, }, { 'name': 'trueStrike', 'group': 'pugilist', }, { 'name': 'bootshine', 'group': 'pugilist', }, ]
""" Created on Tue May 31 17:02:24 2016 @author: rmondoncancel """ priority_list = [{'name': 'fistOfFire', 'group': 'monk', 'prepull': True, 'condition': {'type': 'buffPresent', 'name': 'fistOfFire', 'comparison': 'is', 'value': False}}, {'name': 'perfectBalance', 'group': 'pugilist', 'prepull': True}, {'name': 'bloodForBlood', 'group': 'lancer', 'condition': {'logic': 'and', 'list': [{'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True}]}}, {'name': 'perfectBalance', 'group': 'pugilist', 'condition': {'type': 'cooldownPresent', 'name': 'tornadoKick', 'comparison': 'is', 'value': False}}, {'name': 'tornadoKick', 'group': 'monk', 'condition': {'logic': 'and', 'list': [{'type': 'buffTimeLeft', 'name': 'perfectBalance', 'comparison': '>=', 'value': 7}, {'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True}]}}, {'name': 'internalRelease', 'group': 'pugilist', 'condition': {'logic': 'and', 'list': [{'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True}, {'type': 'cooldownTimeLeft', 'name': 'elixirField', 'comparison': '<=', 'value': 6}]}}, {'name': 'potionOfStrengthHQ', 'group': 'item', 'condition': {'logic': 'and', 'list': [{'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True}]}}, {'name': 'howlingFist', 'group': 'pugilist', 'condition': {'type': 'buffPresent', 'name': 'internalRelease', 'comparison': 'is', 'value': True}}, {'name': 'elixirField', 'group': 'monk', 'condition': {'logic': 'or', 'list': [{'type': 'buffPresent', 'name': 'internalRelease', 'comparison': 'is', 'value': True}, {'type': 'cooldownTimeLeft', 'name': 'internalRelease', 'comparison': '>=', 'value': 20}]}}, {'name': 'steelPeak', 'group': 'pugilist', 'condition': {'logic': 'and', 'list': [{'type': 'buffAtMaxStacks', 'name': 'greasedLightning', 'comparison': 'is', 'value': True}]}}, {'name': 'touchOfDeath', 'group': 'pugilist', 'condition': {'logic': 'and', 'list': [{'type': 'debuffTimeLeft', 'name': 'touchOfDeath', 'comparison': '<=', 'value': 1.5}, {'type': 'debuffPresent', 'name': 'dragonKick', 'comparison': 'is', 'value': True}, {'type': 'buffPresent', 'name': 'twinSnakes', 'comparison': 'is', 'value': True}]}}, {'name': 'fracture', 'group': 'marauder', 'condition': {'logic': 'and', 'list': [{'type': 'debuffTimeLeft', 'name': 'fracture', 'comparison': '<=', 'value': 1.5}, {'type': 'debuffPresent', 'name': 'dragonKick', 'comparison': 'is', 'value': True}, {'type': 'buffPresent', 'name': 'twinSnakes', 'comparison': 'is', 'value': True}]}}, {'name': 'demolish', 'group': 'pugilist', 'condition': {'type': 'debuffTimeLeft', 'name': 'demolish', 'comparison': '<=', 'value': 4}}, {'name': 'twinSnakes', 'group': 'pugilist', 'condition': {'type': 'buffTimeLeft', 'name': 'twinSnakes', 'comparison': '<=', 'value': 5}}, {'name': 'snapPunch', 'group': 'pugilist'}, {'name': 'dragonKick', 'group': 'monk', 'condition': {'type': 'debuffTimeLeft', 'name': 'dragonKick', 'comparison': '<=', 'value': 5}}, {'name': 'trueStrike', 'group': 'pugilist'}, {'name': 'bootshine', 'group': 'pugilist'}]
hyper_params = { 'weight_decay': float(1e-6), 'epochs': 30, 'batch_size': 256, 'validate_every': 3, 'early_stop': 3, 'max_seq_len': 10, }
hyper_params = {'weight_decay': float(1e-06), 'epochs': 30, 'batch_size': 256, 'validate_every': 3, 'early_stop': 3, 'max_seq_len': 10}
# 1073 n = int(input()) if 5 < n < 2000: for i in range(2, n + 1, 2): print("{}^{} = {}".format(i, 2, i ** 2))
n = int(input()) if 5 < n < 2000: for i in range(2, n + 1, 2): print('{}^{} = {}'.format(i, 2, i ** 2))
class BinaryIndexedTree(object): def __init__(self): self.BITTree = [0] # Returns sum of arr[0..index]. This function assumes # that the array is preprocessed and partial sums of # array elements are stored in BITree[]. def getsum(self, i): s = 0 # initialize result # index in BITree[] is 1 more than the index in arr[] i = i + 1 # Traverse ancestors of BITree[index] while i > 0: # Add current element of BITree to sum s += self.BITTree[i] # Move index to parent node in getSum View i -= i & (-i) return s def get_sum(self, a, b): return self.getsum(b) - self.getsum(a-1) if a > 0 else 0 # Updates a node in Binary Index Tree (BITree) at given index # in BITree. The given value 'val' is added to BITree[i] and # all of its ancestors in tree. def updatebit(self, n, i, v): # index in BITree[] is 1 more than the index in arr[] i += 1 # Traverse all ancestors and add 'val' while i <= n: # Add 'val' to current node of BI Tree self.BITTree[i] += v # Update index to that of parent in update View i += i & (-i) # Constructs and returns a Binary Indexed Tree for given # array of size n. def construct(self, arr, n): # Create and initialize BITree[] as 0 self.BITTree = [0] * (n + 1) # Store the actual values in BITree[] using update() for i in range(n): self.updatebit(n, i, arr[i]) freq = [2, 1, 1, 3, 2, 3, 4, 5, 6, 7, 8, 9] BITTree = BinaryIndexedTree() BITTree.construct(freq,len(freq)) print("Sum of elements in arr[0..5] is " + str(BITTree.getsum(5))) freq[3] += 6 BITTree.updatebit(len(freq), 3, 6) print("Sum of elements in arr[0..5]"+ " after update is " + str(BITTree.getsum(5))) print("Sum of elements in arr[1..5]"+ " after update is " + str(BITTree.get_sum(2, 5)))
class Binaryindexedtree(object): def __init__(self): self.BITTree = [0] def getsum(self, i): s = 0 i = i + 1 while i > 0: s += self.BITTree[i] i -= i & -i return s def get_sum(self, a, b): return self.getsum(b) - self.getsum(a - 1) if a > 0 else 0 def updatebit(self, n, i, v): i += 1 while i <= n: self.BITTree[i] += v i += i & -i def construct(self, arr, n): self.BITTree = [0] * (n + 1) for i in range(n): self.updatebit(n, i, arr[i]) freq = [2, 1, 1, 3, 2, 3, 4, 5, 6, 7, 8, 9] bit_tree = binary_indexed_tree() BITTree.construct(freq, len(freq)) print('Sum of elements in arr[0..5] is ' + str(BITTree.getsum(5))) freq[3] += 6 BITTree.updatebit(len(freq), 3, 6) print('Sum of elements in arr[0..5]' + ' after update is ' + str(BITTree.getsum(5))) print('Sum of elements in arr[1..5]' + ' after update is ' + str(BITTree.get_sum(2, 5)))
s = input() t = int(input()) xy = [0, 0] cnt = 0 for i in range(len(s)): if s[i] == 'U': xy[1] += 1 elif s[i] == 'D': xy[1] -= 1 elif s[i] == 'R': xy[0] += 1 elif s[i] == 'L': xy[0] -= 1 else: cnt += 1 ans = abs(xy[0]) + abs(xy[1]) if t == 1: ans += cnt else: if ans >= cnt: ans -= cnt else: ans = (ans - cnt) % 2 print(ans)
s = input() t = int(input()) xy = [0, 0] cnt = 0 for i in range(len(s)): if s[i] == 'U': xy[1] += 1 elif s[i] == 'D': xy[1] -= 1 elif s[i] == 'R': xy[0] += 1 elif s[i] == 'L': xy[0] -= 1 else: cnt += 1 ans = abs(xy[0]) + abs(xy[1]) if t == 1: ans += cnt elif ans >= cnt: ans -= cnt else: ans = (ans - cnt) % 2 print(ans)
def is_valid_session(session: dict) -> bool: """ checks if passed dict has enough info to display event :param session: dict representing a session :return: True if it has enough info (title, start time, end time), False otherwise """ try: session_keys = session.keys() except AttributeError: print("probable error in ajax request...") return False # not a dict for expected in 'title', 'start', 'end': # minimal requirements if expected not in session_keys: return False return True # at this level, all required keys were found
def is_valid_session(session: dict) -> bool: """ checks if passed dict has enough info to display event :param session: dict representing a session :return: True if it has enough info (title, start time, end time), False otherwise """ try: session_keys = session.keys() except AttributeError: print('probable error in ajax request...') return False for expected in ('title', 'start', 'end'): if expected not in session_keys: return False return True
class Solution: def intToRoman(self, num: int) -> str: convertor = [ ["","M", "MM", "MMM"], ["","C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"], ["","X", "XX", "XXX", "XL", "L", "LX","LXX","LXXX", "XC"], ["","I","II","III","IV","V","VI","VII","VIII","IX"] ] return convertor[0][num//1000] + convertor[1][(num//100)%10] + convertor[2][(num//10)%10] + convertor[3][num%10] if __name__ == "__main__": sol = Solution() num = 58 print(sol.intToRoman(num))
class Solution: def int_to_roman(self, num: int) -> str: convertor = [['', 'M', 'MM', 'MMM'], ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'], ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'], ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']] return convertor[0][num // 1000] + convertor[1][num // 100 % 10] + convertor[2][num // 10 % 10] + convertor[3][num % 10] if __name__ == '__main__': sol = solution() num = 58 print(sol.intToRoman(num))
# 2. Multiples List # Write a program that receives two numbers (factor and count) and creates a list with length of the given count # and contains only elements that are multiples of the given factor. factor = int(input()) count = int(input()) list = [] for counter in range(1, count+1): list.append(factor * counter) print(list)
factor = int(input()) count = int(input()) list = [] for counter in range(1, count + 1): list.append(factor * counter) print(list)
# # PySNMP MIB module H3C-IPSEC-MONITOR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/H3C-IPSEC-MONITOR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:09:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection") h3cCommon, = mibBuilder.importSymbols("HUAWEI-3COM-OID-MIB", "h3cCommon") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") IpAddress, Counter64, TimeTicks, Unsigned32, ModuleIdentity, ObjectIdentity, iso, NotificationType, MibIdentifier, Counter32, Gauge32, Bits, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Counter64", "TimeTicks", "Unsigned32", "ModuleIdentity", "ObjectIdentity", "iso", "NotificationType", "MibIdentifier", "Counter32", "Gauge32", "Bits", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") h3cIPSecMonitor = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7)) if mibBuilder.loadTexts: h3cIPSecMonitor.setLastUpdated('200410260000Z') if mibBuilder.loadTexts: h3cIPSecMonitor.setOrganization('Huawei-3COM Technologies Co., Ltd.') class H3cDiffHellmanGrp(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 5, 14, 2147483647)) namedValues = NamedValues(("none", 0), ("modp768", 1), ("modp1024", 2), ("modp1536", 5), ("modp2048", 14), ("invalidGroup", 2147483647)) class H3cEncapMode(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647)) namedValues = NamedValues(("tunnel", 1), ("transport", 2), ("invalidMode", 2147483647)) class H3cEncryptAlgo(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 2147483647)) namedValues = NamedValues(("none", 0), ("desCbc", 1), ("ideaCbc", 2), ("blowfishCbc", 3), ("rc5R16B64Cbc", 4), ("tripledesCbc", 5), ("castCbc", 6), ("aesCbc", 7), ("nsaCbc", 8), ("aesCbc128", 9), ("aesCbc192", 10), ("aesCbc256", 11), ("invalidAlg", 2147483647)) class H3cAuthAlgo(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 2147483647)) namedValues = NamedValues(("none", 0), ("md5", 1), ("sha", 2), ("invalidAlg", 2147483647)) class H3cSaProtocol(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4)) namedValues = NamedValues(("reserved", 0), ("isakmp", 1), ("ah", 2), ("esp", 3), ("ipcomp", 4)) class H3cTrapStatus(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("enabled", 1), ("disabled", 2)) class H3cIPSecIDType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) namedValues = NamedValues(("reserved", 0), ("ipv4Addr", 1), ("fqdn", 2), ("userFqdn", 3), ("ipv4AddrSubnet", 4), ("ipv6Addr", 5), ("ipv6AddrSubnet", 6), ("ipv4AddrRange", 7), ("ipv6AddrRange", 8), ("derAsn1Dn", 9), ("derAsn1Gn", 10), ("keyId", 11)) class H3cTrafficType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 4, 5, 6, 7, 8)) namedValues = NamedValues(("ipv4Addr", 1), ("ipv4AddrSubnet", 4), ("ipv6Addr", 5), ("ipv6AddrSubnet", 6), ("ipv4AddrRange", 7), ("ipv6AddrRange", 8)) class H3cIPSecNegoType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647)) namedValues = NamedValues(("ike", 1), ("manual", 2), ("invalidType", 2147483647)) class H3cIPSecTunnelState(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("active", 1), ("timeout", 2)) h3cIPSecObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1)) h3cIPSecTunnelTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1), ) if mibBuilder.loadTexts: h3cIPSecTunnelTable.setStatus('current') h3cIPSecTunnelEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1), ).setIndexNames((0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIfIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEntryIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIndex")) if mibBuilder.loadTexts: h3cIPSecTunnelEntry.setStatus('current') h3cIPSecTunIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunIfIndex.setStatus('current') h3cIPSecTunEntryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunEntryIndex.setStatus('current') h3cIPSecTunIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunIndex.setStatus('current') h3cIPSecTunIKETunnelIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunIKETunnelIndex.setStatus('current') h3cIPSecTunLocalAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 5), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunLocalAddr.setStatus('current') h3cIPSecTunRemoteAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 6), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunRemoteAddr.setStatus('current') h3cIPSecTunKeyType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 7), H3cIPSecNegoType()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunKeyType.setStatus('current') h3cIPSecTunEncapMode = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 8), H3cEncapMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunEncapMode.setStatus('current') h3cIPSecTunInitiator = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647))).clone(namedValues=NamedValues(("local", 1), ("remote", 2), ("none", 2147483647)))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInitiator.setStatus('current') h3cIPSecTunLifeSize = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 10), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunLifeSize.setStatus('current') h3cIPSecTunLifeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunLifeTime.setStatus('current') h3cIPSecTunRemainTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunRemainTime.setStatus('current') h3cIPSecTunActiveTime = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunActiveTime.setStatus('current') h3cIPSecTunRemainSize = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 14), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunRemainSize.setStatus('current') h3cIPSecTunTotalRefreshes = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunTotalRefreshes.setStatus('current') h3cIPSecTunCurrentSaInstances = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 16), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunCurrentSaInstances.setStatus('current') h3cIPSecTunInSaEncryptAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 17), H3cEncryptAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInSaEncryptAlgo.setStatus('current') h3cIPSecTunInSaAhAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 18), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInSaAhAuthAlgo.setStatus('current') h3cIPSecTunInSaEspAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 19), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInSaEspAuthAlgo.setStatus('current') h3cIPSecTunDiffHellmanGrp = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 20), H3cDiffHellmanGrp()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunDiffHellmanGrp.setStatus('current') h3cIPSecTunOutSaEncryptAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 21), H3cEncryptAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutSaEncryptAlgo.setStatus('current') h3cIPSecTunOutSaAhAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 22), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutSaAhAuthAlgo.setStatus('current') h3cIPSecTunOutSaEspAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 23), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutSaEspAuthAlgo.setStatus('current') h3cIPSecTunPolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 24), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunPolicyName.setStatus('current') h3cIPSecTunPolicyNum = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunPolicyNum.setStatus('current') h3cIPSecTunStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("initial", 1), ("ready", 2), ("rekeyed", 3), ("closed", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunStatus.setStatus('current') h3cIPSecTunnelStatTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2), ) if mibBuilder.loadTexts: h3cIPSecTunnelStatTable.setStatus('current') h3cIPSecTunnelStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1), ).setIndexNames((0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIfIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEntryIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIndex")) if mibBuilder.loadTexts: h3cIPSecTunnelStatEntry.setStatus('current') h3cIPSecTunInOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInOctets.setStatus('current') h3cIPSecTunInDecompOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInDecompOctets.setStatus('current') h3cIPSecTunInPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInPkts.setStatus('current') h3cIPSecTunInDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInDropPkts.setStatus('current') h3cIPSecTunInReplayDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInReplayDropPkts.setStatus('current') h3cIPSecTunInAuthFails = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInAuthFails.setStatus('current') h3cIPSecTunInDecryptFails = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInDecryptFails.setStatus('current') h3cIPSecTunOutOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutOctets.setStatus('current') h3cIPSecTunOutUncompOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutUncompOctets.setStatus('current') h3cIPSecTunOutPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutPkts.setStatus('current') h3cIPSecTunOutDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutDropPkts.setStatus('current') h3cIPSecTunOutEncryptFails = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunOutEncryptFails.setStatus('current') h3cIPSecTunNoMemoryDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunNoMemoryDropPkts.setStatus('current') h3cIPSecTunQueueFullDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunQueueFullDropPkts.setStatus('current') h3cIPSecTunInvalidLenDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInvalidLenDropPkts.setStatus('current') h3cIPSecTunTooLongDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunTooLongDropPkts.setStatus('current') h3cIPSecTunInvalidSaDropPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTunInvalidSaDropPkts.setStatus('current') h3cIPSecSaTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3), ) if mibBuilder.loadTexts: h3cIPSecSaTable.setStatus('current') h3cIPSecSaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1), ).setIndexNames((0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIfIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEntryIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaIndex")) if mibBuilder.loadTexts: h3cIPSecSaEntry.setStatus('current') h3cIPSecSaIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecSaIndex.setStatus('current') h3cIPSecSaDirection = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("in", 1), ("out", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaDirection.setStatus('current') h3cIPSecSaValue = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaValue.setStatus('current') h3cIPSecSaProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 4), H3cSaProtocol()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaProtocol.setStatus('current') h3cIPSecSaEncryptAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 5), H3cEncryptAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaEncryptAlgo.setStatus('current') h3cIPSecSaAuthAlgo = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 6), H3cAuthAlgo()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaAuthAlgo.setStatus('current') h3cIPSecSaStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("expiring", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecSaStatus.setStatus('current') h3cIPSecTrafficTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4), ) if mibBuilder.loadTexts: h3cIPSecTrafficTable.setStatus('current') h3cIPSecTrafficEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1), ).setIndexNames((0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIfIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEntryIndex"), (0, "H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIndex")) if mibBuilder.loadTexts: h3cIPSecTrafficEntry.setStatus('current') h3cIPSecTrafficLocalType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 1), H3cTrafficType()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalType.setStatus('current') h3cIPSecTrafficLocalAddr1 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalAddr1.setStatus('current') h3cIPSecTrafficLocalAddr2 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalAddr2.setStatus('current') h3cIPSecTrafficLocalProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalProtocol.setStatus('current') h3cIPSecTrafficLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficLocalPort.setStatus('current') h3cIPSecTrafficRemoteType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 6), H3cTrafficType()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemoteType.setStatus('current') h3cIPSecTrafficRemoteAddr1 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 7), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemoteAddr1.setStatus('current') h3cIPSecTrafficRemoteAddr2 = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 8), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemoteAddr2.setStatus('current') h3cIPSecTrafficRemoteProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemoteProtocol.setStatus('current') h3cIPSecTrafficRemotePort = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecTrafficRemotePort.setStatus('current') h3cIPSecGlobalStats = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5)) h3cIPSecGlobalActiveTunnels = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalActiveTunnels.setStatus('current') h3cIPSecGlobalActiveSas = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalActiveSas.setStatus('current') h3cIPSecGlobalInOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInOctets.setStatus('current') h3cIPSecGlobalInDecompOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInDecompOctets.setStatus('current') h3cIPSecGlobalInPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInPkts.setStatus('current') h3cIPSecGlobalInDrops = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInDrops.setStatus('current') h3cIPSecGlobalInReplayDrops = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInReplayDrops.setStatus('current') h3cIPSecGlobalInAuthFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInAuthFails.setStatus('current') h3cIPSecGlobalInDecryptFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInDecryptFails.setStatus('current') h3cIPSecGlobalOutOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutOctets.setStatus('current') h3cIPSecGlobalOutUncompOctets = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutUncompOctets.setStatus('current') h3cIPSecGlobalOutPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutPkts.setStatus('current') h3cIPSecGlobalOutDrops = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutDrops.setStatus('current') h3cIPSecGlobalOutEncryptFails = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalOutEncryptFails.setStatus('current') h3cIPSecGlobalNoMemoryDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalNoMemoryDropPkts.setStatus('current') h3cIPSecGlobalNoFindSaDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalNoFindSaDropPkts.setStatus('current') h3cIPSecGlobalQueueFullDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalQueueFullDropPkts.setStatus('current') h3cIPSecGlobalInvalidLenDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInvalidLenDropPkts.setStatus('current') h3cIPSecGlobalTooLongDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalTooLongDropPkts.setStatus('current') h3cIPSecGlobalInvalidSaDropPkts = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: h3cIPSecGlobalInvalidSaDropPkts.setStatus('current') h3cIPSecTrapObject = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6)) h3cIPSecPolicyName = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 1), DisplayString()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: h3cIPSecPolicyName.setStatus('current') h3cIPSecPolicySeqNum = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 2), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: h3cIPSecPolicySeqNum.setStatus('current') h3cIPSecPolicySize = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 3), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: h3cIPSecPolicySize.setStatus('current') h3cIPSecSpiValue = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 4), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: h3cIPSecSpiValue.setStatus('current') h3cIPSecTrapCntl = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7)) h3cIPSecTrapGlobalCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 1), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecTrapGlobalCntl.setStatus('current') h3cIPSecTunnelStartTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 2), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecTunnelStartTrapCntl.setStatus('current') h3cIPSecTunnelStopTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 3), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecTunnelStopTrapCntl.setStatus('current') h3cIPSecNoSaTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 4), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecNoSaTrapCntl.setStatus('current') h3cIPSecAuthFailureTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 5), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecAuthFailureTrapCntl.setStatus('current') h3cIPSecEncryFailureTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 6), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecEncryFailureTrapCntl.setStatus('current') h3cIPSecDecryFailureTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 7), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecDecryFailureTrapCntl.setStatus('current') h3cIPSecInvalidSaTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 8), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecInvalidSaTrapCntl.setStatus('current') h3cIPSecPolicyAddTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 9), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecPolicyAddTrapCntl.setStatus('current') h3cIPSecPolicyDelTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 10), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecPolicyDelTrapCntl.setStatus('current') h3cIPSecPolicyAttachTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 11), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecPolicyAttachTrapCntl.setStatus('current') h3cIPSecPolicyDetachTrapCntl = MibScalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 12), H3cTrapStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: h3cIPSecPolicyDetachTrapCntl.setStatus('current') h3cIPSecTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8)) h3cIPSecNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1)) h3cIPSecTunnelStart = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 1)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLifeTime"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLifeSize")) if mibBuilder.loadTexts: h3cIPSecTunnelStart.setStatus('current') h3cIPSecTunnelStop = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 2)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunActiveTime")) if mibBuilder.loadTexts: h3cIPSecTunnelStop.setStatus('current') h3cIPSecNoSaFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 3)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr")) if mibBuilder.loadTexts: h3cIPSecNoSaFailure.setStatus('current') h3cIPSecAuthFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 4)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr")) if mibBuilder.loadTexts: h3cIPSecAuthFailFailure.setStatus('current') h3cIPSecEncryFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 5)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr")) if mibBuilder.loadTexts: h3cIPSecEncryFailFailure.setStatus('current') h3cIPSecDecryFailFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 6)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr")) if mibBuilder.loadTexts: h3cIPSecDecryFailFailure.setStatus('current') h3cIPSecInvalidSaFailure = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 7)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSpiValue")) if mibBuilder.loadTexts: h3cIPSecInvalidSaFailure.setStatus('current') h3cIPSecPolicyAdd = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 8)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySeqNum"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize")) if mibBuilder.loadTexts: h3cIPSecPolicyAdd.setStatus('current') h3cIPSecPolicyDel = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 9)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySeqNum"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize")) if mibBuilder.loadTexts: h3cIPSecPolicyDel.setStatus('current') h3cIPSecPolicyAttach = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 10)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize"), ("IF-MIB", "ifIndex")) if mibBuilder.loadTexts: h3cIPSecPolicyAttach.setStatus('current') h3cIPSecPolicyDetach = NotificationType((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 11)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize"), ("IF-MIB", "ifIndex")) if mibBuilder.loadTexts: h3cIPSecPolicyDetach.setStatus('current') h3cIPSecConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2)) h3cIPSecCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 1)) h3cIPSecGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2)) h3cIPSecCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 1, 1)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelTableGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStatGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficTableGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalStatsGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrapObjectGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrapCntlGroup"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrapGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecCompliance = h3cIPSecCompliance.setStatus('current') h3cIPSecTunnelTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 1)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunIKETunnelIndex"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLocalAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemoteAddr"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunKeyType"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunEncapMode"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInitiator"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLifeSize"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunLifeTime"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemainTime"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunActiveTime"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunRemainSize"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunTotalRefreshes"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunCurrentSaInstances"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInSaEncryptAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInSaAhAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInSaEspAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunDiffHellmanGrp"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutSaEncryptAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutSaAhAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutSaEspAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunPolicyNum"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTunnelTableGroup = h3cIPSecTunnelTableGroup.setStatus('current') h3cIPSecTunnelStatGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 2)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInDecompOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInReplayDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInAuthFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInDecryptFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutUncompOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunOutEncryptFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunNoMemoryDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunQueueFullDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInvalidLenDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunTooLongDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunInvalidSaDropPkts")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTunnelStatGroup = h3cIPSecTunnelStatGroup.setStatus('current') h3cIPSecSaGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 3)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaDirection"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaValue"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaProtocol"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaEncryptAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaAuthAlgo"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSaStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecSaGroup = h3cIPSecSaGroup.setStatus('current') h3cIPSecTrafficTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 4)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalType"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalAddr1"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalAddr2"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalProtocol"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficLocalPort"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemoteType"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemoteAddr1"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemoteAddr2"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemoteProtocol"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrafficRemotePort")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTrafficTableGroup = h3cIPSecTrafficTableGroup.setStatus('current') h3cIPSecGlobalStatsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 5)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalActiveTunnels"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalActiveSas"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInDecompOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInDrops"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInReplayDrops"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInAuthFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInDecryptFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutUncompOctets"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutDrops"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalOutEncryptFails"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalNoMemoryDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalNoFindSaDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalQueueFullDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInvalidLenDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalTooLongDropPkts"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecGlobalInvalidSaDropPkts")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecGlobalStatsGroup = h3cIPSecGlobalStatsGroup.setStatus('current') h3cIPSecTrapObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 6)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyName"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySeqNum"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicySize"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecSpiValue")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTrapObjectGroup = h3cIPSecTrapObjectGroup.setStatus('current') h3cIPSecTrapCntlGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 7)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTrapGlobalCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStartTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStopTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecNoSaTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecAuthFailureTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecEncryFailureTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecDecryFailureTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecInvalidSaTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyAddTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyDelTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyAttachTrapCntl"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyDetachTrapCntl")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTrapCntlGroup = h3cIPSecTrapCntlGroup.setStatus('current') h3cIPSecTrapGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 8)).setObjects(("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStart"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecTunnelStop"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecNoSaFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecAuthFailFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecEncryFailFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecDecryFailFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecInvalidSaFailure"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyAdd"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyDel"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyAttach"), ("H3C-IPSEC-MONITOR-MIB", "h3cIPSecPolicyDetach")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3cIPSecTrapGroup = h3cIPSecTrapGroup.setStatus('current') mibBuilder.exportSymbols("H3C-IPSEC-MONITOR-MIB", h3cIPSecTrafficRemoteAddr2=h3cIPSecTrafficRemoteAddr2, h3cIPSecTrafficLocalAddr1=h3cIPSecTrafficLocalAddr1, h3cIPSecTunInOctets=h3cIPSecTunInOctets, h3cIPSecTunStatus=h3cIPSecTunStatus, h3cIPSecGlobalStats=h3cIPSecGlobalStats, h3cIPSecTrafficRemoteType=h3cIPSecTrafficRemoteType, h3cIPSecGlobalQueueFullDropPkts=h3cIPSecGlobalQueueFullDropPkts, h3cIPSecTunInvalidSaDropPkts=h3cIPSecTunInvalidSaDropPkts, h3cIPSecTunLocalAddr=h3cIPSecTunLocalAddr, h3cIPSecTunKeyType=h3cIPSecTunKeyType, h3cIPSecGlobalTooLongDropPkts=h3cIPSecGlobalTooLongDropPkts, h3cIPSecTunEntryIndex=h3cIPSecTunEntryIndex, PYSNMP_MODULE_ID=h3cIPSecMonitor, h3cIPSecTrapGlobalCntl=h3cIPSecTrapGlobalCntl, h3cIPSecTunOutEncryptFails=h3cIPSecTunOutEncryptFails, h3cIPSecTunNoMemoryDropPkts=h3cIPSecTunNoMemoryDropPkts, h3cIPSecAuthFailFailure=h3cIPSecAuthFailFailure, h3cIPSecSpiValue=h3cIPSecSpiValue, h3cIPSecGlobalOutEncryptFails=h3cIPSecGlobalOutEncryptFails, h3cIPSecSaEncryptAlgo=h3cIPSecSaEncryptAlgo, h3cIPSecSaStatus=h3cIPSecSaStatus, h3cIPSecTunRemainTime=h3cIPSecTunRemainTime, h3cIPSecTunnelStartTrapCntl=h3cIPSecTunnelStartTrapCntl, H3cAuthAlgo=H3cAuthAlgo, h3cIPSecTrafficTableGroup=h3cIPSecTrafficTableGroup, h3cIPSecPolicyAttach=h3cIPSecPolicyAttach, h3cIPSecGlobalInDecryptFails=h3cIPSecGlobalInDecryptFails, h3cIPSecTunRemainSize=h3cIPSecTunRemainSize, h3cIPSecSaDirection=h3cIPSecSaDirection, h3cIPSecDecryFailureTrapCntl=h3cIPSecDecryFailureTrapCntl, h3cIPSecTunIndex=h3cIPSecTunIndex, h3cIPSecPolicyDetachTrapCntl=h3cIPSecPolicyDetachTrapCntl, h3cIPSecNoSaFailure=h3cIPSecNoSaFailure, h3cIPSecPolicyAttachTrapCntl=h3cIPSecPolicyAttachTrapCntl, h3cIPSecTunInSaAhAuthAlgo=h3cIPSecTunInSaAhAuthAlgo, h3cIPSecTunnelStatEntry=h3cIPSecTunnelStatEntry, h3cIPSecTunInDecryptFails=h3cIPSecTunInDecryptFails, h3cIPSecNotifications=h3cIPSecNotifications, h3cIPSecGlobalInPkts=h3cIPSecGlobalInPkts, h3cIPSecTunInvalidLenDropPkts=h3cIPSecTunInvalidLenDropPkts, h3cIPSecGlobalActiveSas=h3cIPSecGlobalActiveSas, h3cIPSecGlobalActiveTunnels=h3cIPSecGlobalActiveTunnels, h3cIPSecGlobalOutUncompOctets=h3cIPSecGlobalOutUncompOctets, H3cSaProtocol=H3cSaProtocol, h3cIPSecTunInSaEncryptAlgo=h3cIPSecTunInSaEncryptAlgo, h3cIPSecTunOutOctets=h3cIPSecTunOutOctets, h3cIPSecInvalidSaFailure=h3cIPSecInvalidSaFailure, h3cIPSecTunQueueFullDropPkts=h3cIPSecTunQueueFullDropPkts, h3cIPSecPolicyName=h3cIPSecPolicyName, h3cIPSecSaIndex=h3cIPSecSaIndex, h3cIPSecTunTotalRefreshes=h3cIPSecTunTotalRefreshes, h3cIPSecSaProtocol=h3cIPSecSaProtocol, H3cEncapMode=H3cEncapMode, h3cIPSecTrafficLocalProtocol=h3cIPSecTrafficLocalProtocol, h3cIPSecPolicySeqNum=h3cIPSecPolicySeqNum, h3cIPSecTunActiveTime=h3cIPSecTunActiveTime, h3cIPSecTunOutSaEspAuthAlgo=h3cIPSecTunOutSaEspAuthAlgo, h3cIPSecTunPolicyNum=h3cIPSecTunPolicyNum, h3cIPSecGlobalInAuthFails=h3cIPSecGlobalInAuthFails, h3cIPSecGlobalOutDrops=h3cIPSecGlobalOutDrops, h3cIPSecConformance=h3cIPSecConformance, h3cIPSecTunInAuthFails=h3cIPSecTunInAuthFails, h3cIPSecTunnelStop=h3cIPSecTunnelStop, h3cIPSecTunOutSaAhAuthAlgo=h3cIPSecTunOutSaAhAuthAlgo, h3cIPSecSaValue=h3cIPSecSaValue, h3cIPSecGlobalOutOctets=h3cIPSecGlobalOutOctets, h3cIPSecPolicyDelTrapCntl=h3cIPSecPolicyDelTrapCntl, h3cIPSecTunTooLongDropPkts=h3cIPSecTunTooLongDropPkts, h3cIPSecTunInSaEspAuthAlgo=h3cIPSecTunInSaEspAuthAlgo, h3cIPSecTunDiffHellmanGrp=h3cIPSecTunDiffHellmanGrp, h3cIPSecTunOutUncompOctets=h3cIPSecTunOutUncompOctets, h3cIPSecTunnelStatGroup=h3cIPSecTunnelStatGroup, h3cIPSecTunPolicyName=h3cIPSecTunPolicyName, h3cIPSecObjects=h3cIPSecObjects, h3cIPSecMonitor=h3cIPSecMonitor, h3cIPSecEncryFailFailure=h3cIPSecEncryFailFailure, h3cIPSecTunInReplayDropPkts=h3cIPSecTunInReplayDropPkts, h3cIPSecGlobalNoMemoryDropPkts=h3cIPSecGlobalNoMemoryDropPkts, h3cIPSecPolicyAdd=h3cIPSecPolicyAdd, h3cIPSecGlobalInDrops=h3cIPSecGlobalInDrops, h3cIPSecPolicyDetach=h3cIPSecPolicyDetach, h3cIPSecDecryFailFailure=h3cIPSecDecryFailFailure, h3cIPSecTrapCntlGroup=h3cIPSecTrapCntlGroup, h3cIPSecTunOutPkts=h3cIPSecTunOutPkts, h3cIPSecTrafficRemoteAddr1=h3cIPSecTrafficRemoteAddr1, h3cIPSecSaGroup=h3cIPSecSaGroup, H3cIPSecTunnelState=H3cIPSecTunnelState, h3cIPSecTunLifeSize=h3cIPSecTunLifeSize, h3cIPSecTunOutDropPkts=h3cIPSecTunOutDropPkts, H3cTrapStatus=H3cTrapStatus, h3cIPSecGroups=h3cIPSecGroups, h3cIPSecTrafficLocalPort=h3cIPSecTrafficLocalPort, h3cIPSecGlobalInOctets=h3cIPSecGlobalInOctets, h3cIPSecGlobalStatsGroup=h3cIPSecGlobalStatsGroup, h3cIPSecTunInDropPkts=h3cIPSecTunInDropPkts, h3cIPSecGlobalOutPkts=h3cIPSecGlobalOutPkts, h3cIPSecTunOutSaEncryptAlgo=h3cIPSecTunOutSaEncryptAlgo, H3cIPSecNegoType=H3cIPSecNegoType, h3cIPSecTrafficLocalAddr2=h3cIPSecTrafficLocalAddr2, h3cIPSecTrafficRemoteProtocol=h3cIPSecTrafficRemoteProtocol, h3cIPSecTrapObject=h3cIPSecTrapObject, h3cIPSecTunCurrentSaInstances=h3cIPSecTunCurrentSaInstances, h3cIPSecGlobalInvalidLenDropPkts=h3cIPSecGlobalInvalidLenDropPkts, h3cIPSecGlobalInReplayDrops=h3cIPSecGlobalInReplayDrops, h3cIPSecPolicyDel=h3cIPSecPolicyDel, h3cIPSecTunnelTableGroup=h3cIPSecTunnelTableGroup, h3cIPSecAuthFailureTrapCntl=h3cIPSecAuthFailureTrapCntl, H3cTrafficType=H3cTrafficType, h3cIPSecTunIfIndex=h3cIPSecTunIfIndex, h3cIPSecNoSaTrapCntl=h3cIPSecNoSaTrapCntl, h3cIPSecTunInDecompOctets=h3cIPSecTunInDecompOctets, h3cIPSecPolicyAddTrapCntl=h3cIPSecPolicyAddTrapCntl, h3cIPSecCompliance=h3cIPSecCompliance, h3cIPSecTunnelStopTrapCntl=h3cIPSecTunnelStopTrapCntl, h3cIPSecTunInPkts=h3cIPSecTunInPkts, h3cIPSecInvalidSaTrapCntl=h3cIPSecInvalidSaTrapCntl, h3cIPSecSaAuthAlgo=h3cIPSecSaAuthAlgo, h3cIPSecTrafficTable=h3cIPSecTrafficTable, h3cIPSecPolicySize=h3cIPSecPolicySize, h3cIPSecTrap=h3cIPSecTrap, h3cIPSecTunnelEntry=h3cIPSecTunnelEntry, h3cIPSecTunEncapMode=h3cIPSecTunEncapMode, h3cIPSecTrafficLocalType=h3cIPSecTrafficLocalType, h3cIPSecTunnelStatTable=h3cIPSecTunnelStatTable, h3cIPSecSaEntry=h3cIPSecSaEntry, h3cIPSecTrafficRemotePort=h3cIPSecTrafficRemotePort, h3cIPSecTrapCntl=h3cIPSecTrapCntl, h3cIPSecEncryFailureTrapCntl=h3cIPSecEncryFailureTrapCntl, h3cIPSecGlobalInDecompOctets=h3cIPSecGlobalInDecompOctets, h3cIPSecCompliances=h3cIPSecCompliances, h3cIPSecTunIKETunnelIndex=h3cIPSecTunIKETunnelIndex, h3cIPSecTunnelTable=h3cIPSecTunnelTable, h3cIPSecTrafficEntry=h3cIPSecTrafficEntry, h3cIPSecTunRemoteAddr=h3cIPSecTunRemoteAddr, H3cIPSecIDType=H3cIPSecIDType, h3cIPSecTrapObjectGroup=h3cIPSecTrapObjectGroup, h3cIPSecTunInitiator=h3cIPSecTunInitiator, h3cIPSecTunLifeTime=h3cIPSecTunLifeTime, h3cIPSecTrapGroup=h3cIPSecTrapGroup, H3cDiffHellmanGrp=H3cDiffHellmanGrp, H3cEncryptAlgo=H3cEncryptAlgo, h3cIPSecGlobalNoFindSaDropPkts=h3cIPSecGlobalNoFindSaDropPkts, h3cIPSecTunnelStart=h3cIPSecTunnelStart, h3cIPSecGlobalInvalidSaDropPkts=h3cIPSecGlobalInvalidSaDropPkts, h3cIPSecSaTable=h3cIPSecSaTable)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection') (h3c_common,) = mibBuilder.importSymbols('HUAWEI-3COM-OID-MIB', 'h3cCommon') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance') (ip_address, counter64, time_ticks, unsigned32, module_identity, object_identity, iso, notification_type, mib_identifier, counter32, gauge32, bits, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'Counter64', 'TimeTicks', 'Unsigned32', 'ModuleIdentity', 'ObjectIdentity', 'iso', 'NotificationType', 'MibIdentifier', 'Counter32', 'Gauge32', 'Bits', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') h3c_ip_sec_monitor = module_identity((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7)) if mibBuilder.loadTexts: h3cIPSecMonitor.setLastUpdated('200410260000Z') if mibBuilder.loadTexts: h3cIPSecMonitor.setOrganization('Huawei-3COM Technologies Co., Ltd.') class H3Cdiffhellmangrp(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 5, 14, 2147483647)) named_values = named_values(('none', 0), ('modp768', 1), ('modp1024', 2), ('modp1536', 5), ('modp2048', 14), ('invalidGroup', 2147483647)) class H3Cencapmode(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 2147483647)) named_values = named_values(('tunnel', 1), ('transport', 2), ('invalidMode', 2147483647)) class H3Cencryptalgo(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 2147483647)) named_values = named_values(('none', 0), ('desCbc', 1), ('ideaCbc', 2), ('blowfishCbc', 3), ('rc5R16B64Cbc', 4), ('tripledesCbc', 5), ('castCbc', 6), ('aesCbc', 7), ('nsaCbc', 8), ('aesCbc128', 9), ('aesCbc192', 10), ('aesCbc256', 11), ('invalidAlg', 2147483647)) class H3Cauthalgo(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 2147483647)) named_values = named_values(('none', 0), ('md5', 1), ('sha', 2), ('invalidAlg', 2147483647)) class H3Csaprotocol(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4)) named_values = named_values(('reserved', 0), ('isakmp', 1), ('ah', 2), ('esp', 3), ('ipcomp', 4)) class H3Ctrapstatus(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('enabled', 1), ('disabled', 2)) class H3Cipsecidtype(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) named_values = named_values(('reserved', 0), ('ipv4Addr', 1), ('fqdn', 2), ('userFqdn', 3), ('ipv4AddrSubnet', 4), ('ipv6Addr', 5), ('ipv6AddrSubnet', 6), ('ipv4AddrRange', 7), ('ipv6AddrRange', 8), ('derAsn1Dn', 9), ('derAsn1Gn', 10), ('keyId', 11)) class H3Ctraffictype(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 4, 5, 6, 7, 8)) named_values = named_values(('ipv4Addr', 1), ('ipv4AddrSubnet', 4), ('ipv6Addr', 5), ('ipv6AddrSubnet', 6), ('ipv4AddrRange', 7), ('ipv6AddrRange', 8)) class H3Cipsecnegotype(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 2147483647)) named_values = named_values(('ike', 1), ('manual', 2), ('invalidType', 2147483647)) class H3Cipsectunnelstate(TextualConvention, Integer32): status = 'current' subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2)) named_values = named_values(('active', 1), ('timeout', 2)) h3c_ip_sec_objects = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1)) h3c_ip_sec_tunnel_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1)) if mibBuilder.loadTexts: h3cIPSecTunnelTable.setStatus('current') h3c_ip_sec_tunnel_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1)).setIndexNames((0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIfIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEntryIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIndex')) if mibBuilder.loadTexts: h3cIPSecTunnelEntry.setStatus('current') h3c_ip_sec_tun_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunIfIndex.setStatus('current') h3c_ip_sec_tun_entry_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunEntryIndex.setStatus('current') h3c_ip_sec_tun_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecTunIndex.setStatus('current') h3c_ip_sec_tun_ike_tunnel_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunIKETunnelIndex.setStatus('current') h3c_ip_sec_tun_local_addr = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 5), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunLocalAddr.setStatus('current') h3c_ip_sec_tun_remote_addr = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 6), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunRemoteAddr.setStatus('current') h3c_ip_sec_tun_key_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 7), h3c_ip_sec_nego_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunKeyType.setStatus('current') h3c_ip_sec_tun_encap_mode = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 8), h3c_encap_mode()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunEncapMode.setStatus('current') h3c_ip_sec_tun_initiator = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 2147483647))).clone(namedValues=named_values(('local', 1), ('remote', 2), ('none', 2147483647)))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInitiator.setStatus('current') h3c_ip_sec_tun_life_size = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 10), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunLifeSize.setStatus('current') h3c_ip_sec_tun_life_time = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 11), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunLifeTime.setStatus('current') h3c_ip_sec_tun_remain_time = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunRemainTime.setStatus('current') h3c_ip_sec_tun_active_time = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 13), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunActiveTime.setStatus('current') h3c_ip_sec_tun_remain_size = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 14), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunRemainSize.setStatus('current') h3c_ip_sec_tun_total_refreshes = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunTotalRefreshes.setStatus('current') h3c_ip_sec_tun_current_sa_instances = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 16), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunCurrentSaInstances.setStatus('current') h3c_ip_sec_tun_in_sa_encrypt_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 17), h3c_encrypt_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInSaEncryptAlgo.setStatus('current') h3c_ip_sec_tun_in_sa_ah_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 18), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInSaAhAuthAlgo.setStatus('current') h3c_ip_sec_tun_in_sa_esp_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 19), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInSaEspAuthAlgo.setStatus('current') h3c_ip_sec_tun_diff_hellman_grp = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 20), h3c_diff_hellman_grp()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunDiffHellmanGrp.setStatus('current') h3c_ip_sec_tun_out_sa_encrypt_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 21), h3c_encrypt_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutSaEncryptAlgo.setStatus('current') h3c_ip_sec_tun_out_sa_ah_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 22), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutSaAhAuthAlgo.setStatus('current') h3c_ip_sec_tun_out_sa_esp_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 23), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutSaEspAuthAlgo.setStatus('current') h3c_ip_sec_tun_policy_name = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 24), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunPolicyName.setStatus('current') h3c_ip_sec_tun_policy_num = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 25), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunPolicyNum.setStatus('current') h3c_ip_sec_tun_status = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 1, 1, 26), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('initial', 1), ('ready', 2), ('rekeyed', 3), ('closed', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunStatus.setStatus('current') h3c_ip_sec_tunnel_stat_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2)) if mibBuilder.loadTexts: h3cIPSecTunnelStatTable.setStatus('current') h3c_ip_sec_tunnel_stat_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1)).setIndexNames((0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIfIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEntryIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIndex')) if mibBuilder.loadTexts: h3cIPSecTunnelStatEntry.setStatus('current') h3c_ip_sec_tun_in_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 1), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInOctets.setStatus('current') h3c_ip_sec_tun_in_decomp_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 2), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInDecompOctets.setStatus('current') h3c_ip_sec_tun_in_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 3), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInPkts.setStatus('current') h3c_ip_sec_tun_in_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 4), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInDropPkts.setStatus('current') h3c_ip_sec_tun_in_replay_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInReplayDropPkts.setStatus('current') h3c_ip_sec_tun_in_auth_fails = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 6), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInAuthFails.setStatus('current') h3c_ip_sec_tun_in_decrypt_fails = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInDecryptFails.setStatus('current') h3c_ip_sec_tun_out_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 8), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutOctets.setStatus('current') h3c_ip_sec_tun_out_uncomp_octets = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 9), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutUncompOctets.setStatus('current') h3c_ip_sec_tun_out_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 10), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutPkts.setStatus('current') h3c_ip_sec_tun_out_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 11), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutDropPkts.setStatus('current') h3c_ip_sec_tun_out_encrypt_fails = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 12), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunOutEncryptFails.setStatus('current') h3c_ip_sec_tun_no_memory_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 13), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunNoMemoryDropPkts.setStatus('current') h3c_ip_sec_tun_queue_full_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunQueueFullDropPkts.setStatus('current') h3c_ip_sec_tun_invalid_len_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInvalidLenDropPkts.setStatus('current') h3c_ip_sec_tun_too_long_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 16), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunTooLongDropPkts.setStatus('current') h3c_ip_sec_tun_invalid_sa_drop_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 2, 1, 17), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTunInvalidSaDropPkts.setStatus('current') h3c_ip_sec_sa_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3)) if mibBuilder.loadTexts: h3cIPSecSaTable.setStatus('current') h3c_ip_sec_sa_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1)).setIndexNames((0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIfIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEntryIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaIndex')) if mibBuilder.loadTexts: h3cIPSecSaEntry.setStatus('current') h3c_ip_sec_sa_index = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: h3cIPSecSaIndex.setStatus('current') h3c_ip_sec_sa_direction = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('in', 1), ('out', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaDirection.setStatus('current') h3c_ip_sec_sa_value = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 3), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaValue.setStatus('current') h3c_ip_sec_sa_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 4), h3c_sa_protocol()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaProtocol.setStatus('current') h3c_ip_sec_sa_encrypt_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 5), h3c_encrypt_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaEncryptAlgo.setStatus('current') h3c_ip_sec_sa_auth_algo = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 6), h3c_auth_algo()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaAuthAlgo.setStatus('current') h3c_ip_sec_sa_status = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 3, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('active', 1), ('expiring', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecSaStatus.setStatus('current') h3c_ip_sec_traffic_table = mib_table((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4)) if mibBuilder.loadTexts: h3cIPSecTrafficTable.setStatus('current') h3c_ip_sec_traffic_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1)).setIndexNames((0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIfIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEntryIndex'), (0, 'H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIndex')) if mibBuilder.loadTexts: h3cIPSecTrafficEntry.setStatus('current') h3c_ip_sec_traffic_local_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 1), h3c_traffic_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalType.setStatus('current') h3c_ip_sec_traffic_local_addr1 = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 2), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalAddr1.setStatus('current') h3c_ip_sec_traffic_local_addr2 = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 3), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalAddr2.setStatus('current') h3c_ip_sec_traffic_local_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalProtocol.setStatus('current') h3c_ip_sec_traffic_local_port = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficLocalPort.setStatus('current') h3c_ip_sec_traffic_remote_type = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 6), h3c_traffic_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemoteType.setStatus('current') h3c_ip_sec_traffic_remote_addr1 = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 7), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemoteAddr1.setStatus('current') h3c_ip_sec_traffic_remote_addr2 = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 8), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemoteAddr2.setStatus('current') h3c_ip_sec_traffic_remote_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemoteProtocol.setStatus('current') h3c_ip_sec_traffic_remote_port = mib_table_column((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 4, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecTrafficRemotePort.setStatus('current') h3c_ip_sec_global_stats = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5)) h3c_ip_sec_global_active_tunnels = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 1), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalActiveTunnels.setStatus('current') h3c_ip_sec_global_active_sas = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 2), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalActiveSas.setStatus('current') h3c_ip_sec_global_in_octets = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 3), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInOctets.setStatus('current') h3c_ip_sec_global_in_decomp_octets = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 4), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInDecompOctets.setStatus('current') h3c_ip_sec_global_in_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 5), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInPkts.setStatus('current') h3c_ip_sec_global_in_drops = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 6), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInDrops.setStatus('current') h3c_ip_sec_global_in_replay_drops = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInReplayDrops.setStatus('current') h3c_ip_sec_global_in_auth_fails = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 8), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInAuthFails.setStatus('current') h3c_ip_sec_global_in_decrypt_fails = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 9), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInDecryptFails.setStatus('current') h3c_ip_sec_global_out_octets = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 10), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutOctets.setStatus('current') h3c_ip_sec_global_out_uncomp_octets = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 11), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutUncompOctets.setStatus('current') h3c_ip_sec_global_out_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 12), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutPkts.setStatus('current') h3c_ip_sec_global_out_drops = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 13), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutDrops.setStatus('current') h3c_ip_sec_global_out_encrypt_fails = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalOutEncryptFails.setStatus('current') h3c_ip_sec_global_no_memory_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalNoMemoryDropPkts.setStatus('current') h3c_ip_sec_global_no_find_sa_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 16), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalNoFindSaDropPkts.setStatus('current') h3c_ip_sec_global_queue_full_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 17), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalQueueFullDropPkts.setStatus('current') h3c_ip_sec_global_invalid_len_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 18), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInvalidLenDropPkts.setStatus('current') h3c_ip_sec_global_too_long_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 19), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalTooLongDropPkts.setStatus('current') h3c_ip_sec_global_invalid_sa_drop_pkts = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 5, 20), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: h3cIPSecGlobalInvalidSaDropPkts.setStatus('current') h3c_ip_sec_trap_object = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6)) h3c_ip_sec_policy_name = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 1), display_string()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: h3cIPSecPolicyName.setStatus('current') h3c_ip_sec_policy_seq_num = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 2), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: h3cIPSecPolicySeqNum.setStatus('current') h3c_ip_sec_policy_size = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 3), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: h3cIPSecPolicySize.setStatus('current') h3c_ip_sec_spi_value = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 6, 4), integer32()).setMaxAccess('accessiblefornotify') if mibBuilder.loadTexts: h3cIPSecSpiValue.setStatus('current') h3c_ip_sec_trap_cntl = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7)) h3c_ip_sec_trap_global_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 1), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecTrapGlobalCntl.setStatus('current') h3c_ip_sec_tunnel_start_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 2), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecTunnelStartTrapCntl.setStatus('current') h3c_ip_sec_tunnel_stop_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 3), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecTunnelStopTrapCntl.setStatus('current') h3c_ip_sec_no_sa_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 4), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecNoSaTrapCntl.setStatus('current') h3c_ip_sec_auth_failure_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 5), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecAuthFailureTrapCntl.setStatus('current') h3c_ip_sec_encry_failure_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 6), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecEncryFailureTrapCntl.setStatus('current') h3c_ip_sec_decry_failure_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 7), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecDecryFailureTrapCntl.setStatus('current') h3c_ip_sec_invalid_sa_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 8), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecInvalidSaTrapCntl.setStatus('current') h3c_ip_sec_policy_add_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 9), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecPolicyAddTrapCntl.setStatus('current') h3c_ip_sec_policy_del_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 10), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecPolicyDelTrapCntl.setStatus('current') h3c_ip_sec_policy_attach_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 11), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecPolicyAttachTrapCntl.setStatus('current') h3c_ip_sec_policy_detach_trap_cntl = mib_scalar((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 7, 12), h3c_trap_status()).setMaxAccess('readwrite') if mibBuilder.loadTexts: h3cIPSecPolicyDetachTrapCntl.setStatus('current') h3c_ip_sec_trap = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8)) h3c_ip_sec_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1)) h3c_ip_sec_tunnel_start = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 1)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLifeTime'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLifeSize')) if mibBuilder.loadTexts: h3cIPSecTunnelStart.setStatus('current') h3c_ip_sec_tunnel_stop = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 2)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunActiveTime')) if mibBuilder.loadTexts: h3cIPSecTunnelStop.setStatus('current') h3c_ip_sec_no_sa_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 3)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr')) if mibBuilder.loadTexts: h3cIPSecNoSaFailure.setStatus('current') h3c_ip_sec_auth_fail_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 4)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr')) if mibBuilder.loadTexts: h3cIPSecAuthFailFailure.setStatus('current') h3c_ip_sec_encry_fail_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 5)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr')) if mibBuilder.loadTexts: h3cIPSecEncryFailFailure.setStatus('current') h3c_ip_sec_decry_fail_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 6)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr')) if mibBuilder.loadTexts: h3cIPSecDecryFailFailure.setStatus('current') h3c_ip_sec_invalid_sa_failure = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 7)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSpiValue')) if mibBuilder.loadTexts: h3cIPSecInvalidSaFailure.setStatus('current') h3c_ip_sec_policy_add = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 8)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySeqNum'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize')) if mibBuilder.loadTexts: h3cIPSecPolicyAdd.setStatus('current') h3c_ip_sec_policy_del = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 9)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySeqNum'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize')) if mibBuilder.loadTexts: h3cIPSecPolicyDel.setStatus('current') h3c_ip_sec_policy_attach = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 10)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize'), ('IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: h3cIPSecPolicyAttach.setStatus('current') h3c_ip_sec_policy_detach = notification_type((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 1, 8, 1, 11)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize'), ('IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: h3cIPSecPolicyDetach.setStatus('current') h3c_ip_sec_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2)) h3c_ip_sec_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 1)) h3c_ip_sec_groups = mib_identifier((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2)) h3c_ip_sec_compliance = module_compliance((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 1, 1)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelTableGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStatGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficTableGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalStatsGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrapObjectGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrapCntlGroup'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrapGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_compliance = h3cIPSecCompliance.setStatus('current') h3c_ip_sec_tunnel_table_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 1)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunIKETunnelIndex'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLocalAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemoteAddr'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunKeyType'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunEncapMode'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInitiator'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLifeSize'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunLifeTime'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemainTime'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunActiveTime'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunRemainSize'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunTotalRefreshes'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunCurrentSaInstances'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInSaEncryptAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInSaAhAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInSaEspAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunDiffHellmanGrp'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutSaEncryptAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutSaAhAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutSaEspAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunPolicyNum'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_tunnel_table_group = h3cIPSecTunnelTableGroup.setStatus('current') h3c_ip_sec_tunnel_stat_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 2)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInDecompOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInReplayDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInAuthFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInDecryptFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutUncompOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunOutEncryptFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunNoMemoryDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunQueueFullDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInvalidLenDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunTooLongDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunInvalidSaDropPkts')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_tunnel_stat_group = h3cIPSecTunnelStatGroup.setStatus('current') h3c_ip_sec_sa_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 3)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaDirection'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaValue'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaProtocol'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaEncryptAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaAuthAlgo'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSaStatus')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_sa_group = h3cIPSecSaGroup.setStatus('current') h3c_ip_sec_traffic_table_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 4)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalType'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalAddr1'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalAddr2'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalProtocol'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficLocalPort'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemoteType'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemoteAddr1'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemoteAddr2'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemoteProtocol'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrafficRemotePort')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_traffic_table_group = h3cIPSecTrafficTableGroup.setStatus('current') h3c_ip_sec_global_stats_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 5)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalActiveTunnels'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalActiveSas'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInDecompOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInDrops'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInReplayDrops'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInAuthFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInDecryptFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutUncompOctets'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutDrops'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalOutEncryptFails'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalNoMemoryDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalNoFindSaDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalQueueFullDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInvalidLenDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalTooLongDropPkts'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecGlobalInvalidSaDropPkts')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_global_stats_group = h3cIPSecGlobalStatsGroup.setStatus('current') h3c_ip_sec_trap_object_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 6)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyName'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySeqNum'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicySize'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecSpiValue')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_trap_object_group = h3cIPSecTrapObjectGroup.setStatus('current') h3c_ip_sec_trap_cntl_group = object_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 7)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTrapGlobalCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStartTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStopTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecNoSaTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecAuthFailureTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecEncryFailureTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecDecryFailureTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecInvalidSaTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyAddTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyDelTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyAttachTrapCntl'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyDetachTrapCntl')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_trap_cntl_group = h3cIPSecTrapCntlGroup.setStatus('current') h3c_ip_sec_trap_group = notification_group((1, 3, 6, 1, 4, 1, 2011, 10, 2, 7, 2, 2, 8)).setObjects(('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStart'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecTunnelStop'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecNoSaFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecAuthFailFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecEncryFailFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecDecryFailFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecInvalidSaFailure'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyAdd'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyDel'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyAttach'), ('H3C-IPSEC-MONITOR-MIB', 'h3cIPSecPolicyDetach')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): h3c_ip_sec_trap_group = h3cIPSecTrapGroup.setStatus('current') mibBuilder.exportSymbols('H3C-IPSEC-MONITOR-MIB', h3cIPSecTrafficRemoteAddr2=h3cIPSecTrafficRemoteAddr2, h3cIPSecTrafficLocalAddr1=h3cIPSecTrafficLocalAddr1, h3cIPSecTunInOctets=h3cIPSecTunInOctets, h3cIPSecTunStatus=h3cIPSecTunStatus, h3cIPSecGlobalStats=h3cIPSecGlobalStats, h3cIPSecTrafficRemoteType=h3cIPSecTrafficRemoteType, h3cIPSecGlobalQueueFullDropPkts=h3cIPSecGlobalQueueFullDropPkts, h3cIPSecTunInvalidSaDropPkts=h3cIPSecTunInvalidSaDropPkts, h3cIPSecTunLocalAddr=h3cIPSecTunLocalAddr, h3cIPSecTunKeyType=h3cIPSecTunKeyType, h3cIPSecGlobalTooLongDropPkts=h3cIPSecGlobalTooLongDropPkts, h3cIPSecTunEntryIndex=h3cIPSecTunEntryIndex, PYSNMP_MODULE_ID=h3cIPSecMonitor, h3cIPSecTrapGlobalCntl=h3cIPSecTrapGlobalCntl, h3cIPSecTunOutEncryptFails=h3cIPSecTunOutEncryptFails, h3cIPSecTunNoMemoryDropPkts=h3cIPSecTunNoMemoryDropPkts, h3cIPSecAuthFailFailure=h3cIPSecAuthFailFailure, h3cIPSecSpiValue=h3cIPSecSpiValue, h3cIPSecGlobalOutEncryptFails=h3cIPSecGlobalOutEncryptFails, h3cIPSecSaEncryptAlgo=h3cIPSecSaEncryptAlgo, h3cIPSecSaStatus=h3cIPSecSaStatus, h3cIPSecTunRemainTime=h3cIPSecTunRemainTime, h3cIPSecTunnelStartTrapCntl=h3cIPSecTunnelStartTrapCntl, H3cAuthAlgo=H3cAuthAlgo, h3cIPSecTrafficTableGroup=h3cIPSecTrafficTableGroup, h3cIPSecPolicyAttach=h3cIPSecPolicyAttach, h3cIPSecGlobalInDecryptFails=h3cIPSecGlobalInDecryptFails, h3cIPSecTunRemainSize=h3cIPSecTunRemainSize, h3cIPSecSaDirection=h3cIPSecSaDirection, h3cIPSecDecryFailureTrapCntl=h3cIPSecDecryFailureTrapCntl, h3cIPSecTunIndex=h3cIPSecTunIndex, h3cIPSecPolicyDetachTrapCntl=h3cIPSecPolicyDetachTrapCntl, h3cIPSecNoSaFailure=h3cIPSecNoSaFailure, h3cIPSecPolicyAttachTrapCntl=h3cIPSecPolicyAttachTrapCntl, h3cIPSecTunInSaAhAuthAlgo=h3cIPSecTunInSaAhAuthAlgo, h3cIPSecTunnelStatEntry=h3cIPSecTunnelStatEntry, h3cIPSecTunInDecryptFails=h3cIPSecTunInDecryptFails, h3cIPSecNotifications=h3cIPSecNotifications, h3cIPSecGlobalInPkts=h3cIPSecGlobalInPkts, h3cIPSecTunInvalidLenDropPkts=h3cIPSecTunInvalidLenDropPkts, h3cIPSecGlobalActiveSas=h3cIPSecGlobalActiveSas, h3cIPSecGlobalActiveTunnels=h3cIPSecGlobalActiveTunnels, h3cIPSecGlobalOutUncompOctets=h3cIPSecGlobalOutUncompOctets, H3cSaProtocol=H3cSaProtocol, h3cIPSecTunInSaEncryptAlgo=h3cIPSecTunInSaEncryptAlgo, h3cIPSecTunOutOctets=h3cIPSecTunOutOctets, h3cIPSecInvalidSaFailure=h3cIPSecInvalidSaFailure, h3cIPSecTunQueueFullDropPkts=h3cIPSecTunQueueFullDropPkts, h3cIPSecPolicyName=h3cIPSecPolicyName, h3cIPSecSaIndex=h3cIPSecSaIndex, h3cIPSecTunTotalRefreshes=h3cIPSecTunTotalRefreshes, h3cIPSecSaProtocol=h3cIPSecSaProtocol, H3cEncapMode=H3cEncapMode, h3cIPSecTrafficLocalProtocol=h3cIPSecTrafficLocalProtocol, h3cIPSecPolicySeqNum=h3cIPSecPolicySeqNum, h3cIPSecTunActiveTime=h3cIPSecTunActiveTime, h3cIPSecTunOutSaEspAuthAlgo=h3cIPSecTunOutSaEspAuthAlgo, h3cIPSecTunPolicyNum=h3cIPSecTunPolicyNum, h3cIPSecGlobalInAuthFails=h3cIPSecGlobalInAuthFails, h3cIPSecGlobalOutDrops=h3cIPSecGlobalOutDrops, h3cIPSecConformance=h3cIPSecConformance, h3cIPSecTunInAuthFails=h3cIPSecTunInAuthFails, h3cIPSecTunnelStop=h3cIPSecTunnelStop, h3cIPSecTunOutSaAhAuthAlgo=h3cIPSecTunOutSaAhAuthAlgo, h3cIPSecSaValue=h3cIPSecSaValue, h3cIPSecGlobalOutOctets=h3cIPSecGlobalOutOctets, h3cIPSecPolicyDelTrapCntl=h3cIPSecPolicyDelTrapCntl, h3cIPSecTunTooLongDropPkts=h3cIPSecTunTooLongDropPkts, h3cIPSecTunInSaEspAuthAlgo=h3cIPSecTunInSaEspAuthAlgo, h3cIPSecTunDiffHellmanGrp=h3cIPSecTunDiffHellmanGrp, h3cIPSecTunOutUncompOctets=h3cIPSecTunOutUncompOctets, h3cIPSecTunnelStatGroup=h3cIPSecTunnelStatGroup, h3cIPSecTunPolicyName=h3cIPSecTunPolicyName, h3cIPSecObjects=h3cIPSecObjects, h3cIPSecMonitor=h3cIPSecMonitor, h3cIPSecEncryFailFailure=h3cIPSecEncryFailFailure, h3cIPSecTunInReplayDropPkts=h3cIPSecTunInReplayDropPkts, h3cIPSecGlobalNoMemoryDropPkts=h3cIPSecGlobalNoMemoryDropPkts, h3cIPSecPolicyAdd=h3cIPSecPolicyAdd, h3cIPSecGlobalInDrops=h3cIPSecGlobalInDrops, h3cIPSecPolicyDetach=h3cIPSecPolicyDetach, h3cIPSecDecryFailFailure=h3cIPSecDecryFailFailure, h3cIPSecTrapCntlGroup=h3cIPSecTrapCntlGroup, h3cIPSecTunOutPkts=h3cIPSecTunOutPkts, h3cIPSecTrafficRemoteAddr1=h3cIPSecTrafficRemoteAddr1, h3cIPSecSaGroup=h3cIPSecSaGroup, H3cIPSecTunnelState=H3cIPSecTunnelState, h3cIPSecTunLifeSize=h3cIPSecTunLifeSize, h3cIPSecTunOutDropPkts=h3cIPSecTunOutDropPkts, H3cTrapStatus=H3cTrapStatus, h3cIPSecGroups=h3cIPSecGroups, h3cIPSecTrafficLocalPort=h3cIPSecTrafficLocalPort, h3cIPSecGlobalInOctets=h3cIPSecGlobalInOctets, h3cIPSecGlobalStatsGroup=h3cIPSecGlobalStatsGroup, h3cIPSecTunInDropPkts=h3cIPSecTunInDropPkts, h3cIPSecGlobalOutPkts=h3cIPSecGlobalOutPkts, h3cIPSecTunOutSaEncryptAlgo=h3cIPSecTunOutSaEncryptAlgo, H3cIPSecNegoType=H3cIPSecNegoType, h3cIPSecTrafficLocalAddr2=h3cIPSecTrafficLocalAddr2, h3cIPSecTrafficRemoteProtocol=h3cIPSecTrafficRemoteProtocol, h3cIPSecTrapObject=h3cIPSecTrapObject, h3cIPSecTunCurrentSaInstances=h3cIPSecTunCurrentSaInstances, h3cIPSecGlobalInvalidLenDropPkts=h3cIPSecGlobalInvalidLenDropPkts, h3cIPSecGlobalInReplayDrops=h3cIPSecGlobalInReplayDrops, h3cIPSecPolicyDel=h3cIPSecPolicyDel, h3cIPSecTunnelTableGroup=h3cIPSecTunnelTableGroup, h3cIPSecAuthFailureTrapCntl=h3cIPSecAuthFailureTrapCntl, H3cTrafficType=H3cTrafficType, h3cIPSecTunIfIndex=h3cIPSecTunIfIndex, h3cIPSecNoSaTrapCntl=h3cIPSecNoSaTrapCntl, h3cIPSecTunInDecompOctets=h3cIPSecTunInDecompOctets, h3cIPSecPolicyAddTrapCntl=h3cIPSecPolicyAddTrapCntl, h3cIPSecCompliance=h3cIPSecCompliance, h3cIPSecTunnelStopTrapCntl=h3cIPSecTunnelStopTrapCntl, h3cIPSecTunInPkts=h3cIPSecTunInPkts, h3cIPSecInvalidSaTrapCntl=h3cIPSecInvalidSaTrapCntl, h3cIPSecSaAuthAlgo=h3cIPSecSaAuthAlgo, h3cIPSecTrafficTable=h3cIPSecTrafficTable, h3cIPSecPolicySize=h3cIPSecPolicySize, h3cIPSecTrap=h3cIPSecTrap, h3cIPSecTunnelEntry=h3cIPSecTunnelEntry, h3cIPSecTunEncapMode=h3cIPSecTunEncapMode, h3cIPSecTrafficLocalType=h3cIPSecTrafficLocalType, h3cIPSecTunnelStatTable=h3cIPSecTunnelStatTable, h3cIPSecSaEntry=h3cIPSecSaEntry, h3cIPSecTrafficRemotePort=h3cIPSecTrafficRemotePort, h3cIPSecTrapCntl=h3cIPSecTrapCntl, h3cIPSecEncryFailureTrapCntl=h3cIPSecEncryFailureTrapCntl, h3cIPSecGlobalInDecompOctets=h3cIPSecGlobalInDecompOctets, h3cIPSecCompliances=h3cIPSecCompliances, h3cIPSecTunIKETunnelIndex=h3cIPSecTunIKETunnelIndex, h3cIPSecTunnelTable=h3cIPSecTunnelTable, h3cIPSecTrafficEntry=h3cIPSecTrafficEntry, h3cIPSecTunRemoteAddr=h3cIPSecTunRemoteAddr, H3cIPSecIDType=H3cIPSecIDType, h3cIPSecTrapObjectGroup=h3cIPSecTrapObjectGroup, h3cIPSecTunInitiator=h3cIPSecTunInitiator, h3cIPSecTunLifeTime=h3cIPSecTunLifeTime, h3cIPSecTrapGroup=h3cIPSecTrapGroup, H3cDiffHellmanGrp=H3cDiffHellmanGrp, H3cEncryptAlgo=H3cEncryptAlgo, h3cIPSecGlobalNoFindSaDropPkts=h3cIPSecGlobalNoFindSaDropPkts, h3cIPSecTunnelStart=h3cIPSecTunnelStart, h3cIPSecGlobalInvalidSaDropPkts=h3cIPSecGlobalInvalidSaDropPkts, h3cIPSecSaTable=h3cIPSecSaTable)
# # PySNMP MIB module CISCO-CAS-IF-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-CAS-IF-CAPABILITY # Produced by pysmi-0.3.4 at Mon Apr 29 17:35:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion") ciscoAgentCapability, = mibBuilder.importSymbols("CISCO-SMI", "ciscoAgentCapability") AgentCapabilities, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "AgentCapabilities", "ModuleCompliance", "NotificationGroup") TimeTicks, Integer32, iso, ObjectIdentity, Unsigned32, IpAddress, Bits, MibIdentifier, Counter64, Counter32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Integer32", "iso", "ObjectIdentity", "Unsigned32", "IpAddress", "Bits", "MibIdentifier", "Counter64", "Counter32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "NotificationType") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") ciscoCasIfCapability = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 7, 122)) ciscoCasIfCapability.setRevisions(('2009-12-04 00:00', '2004-08-10 00:00', '2003-12-03 00:00',)) if mibBuilder.loadTexts: ciscoCasIfCapability.setLastUpdated('200912040000Z') if mibBuilder.loadTexts: ciscoCasIfCapability.setOrganization('Cisco Systems, Inc.') ciscoCasIfCapabilityV5R000 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV5R000 = ciscoCasIfCapabilityV5R000.setProductRelease('MGX8850 Release 5.0') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV5R000 = ciscoCasIfCapabilityV5R000.setStatus('current') ciscoCasIfCapabilityV5R015 = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV5R015 = ciscoCasIfCapabilityV5R015.setProductRelease('MGX8850 Release 5.0.15') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV5R015 = ciscoCasIfCapabilityV5R015.setStatus('current') ciscoCasIfCapabilityV12R04TPC3xxx = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV12R04TPC3xxx = ciscoCasIfCapabilityV12R04TPC3xxx.setProductRelease('CISCO IOS 12.4T for Integrate Service\n Router (ISR) c2xxx and c3xxx platforms.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoCasIfCapabilityV12R04TPC3xxx = ciscoCasIfCapabilityV12R04TPC3xxx.setStatus('current') mibBuilder.exportSymbols("CISCO-CAS-IF-CAPABILITY", ciscoCasIfCapabilityV5R015=ciscoCasIfCapabilityV5R015, ciscoCasIfCapability=ciscoCasIfCapability, ciscoCasIfCapabilityV5R000=ciscoCasIfCapabilityV5R000, PYSNMP_MODULE_ID=ciscoCasIfCapability, ciscoCasIfCapabilityV12R04TPC3xxx=ciscoCasIfCapabilityV12R04TPC3xxx)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion') (cisco_agent_capability,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoAgentCapability') (agent_capabilities, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'AgentCapabilities', 'ModuleCompliance', 'NotificationGroup') (time_ticks, integer32, iso, object_identity, unsigned32, ip_address, bits, mib_identifier, counter64, counter32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'Integer32', 'iso', 'ObjectIdentity', 'Unsigned32', 'IpAddress', 'Bits', 'MibIdentifier', 'Counter64', 'Counter32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'NotificationType') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') cisco_cas_if_capability = module_identity((1, 3, 6, 1, 4, 1, 9, 7, 122)) ciscoCasIfCapability.setRevisions(('2009-12-04 00:00', '2004-08-10 00:00', '2003-12-03 00:00')) if mibBuilder.loadTexts: ciscoCasIfCapability.setLastUpdated('200912040000Z') if mibBuilder.loadTexts: ciscoCasIfCapability.setOrganization('Cisco Systems, Inc.') cisco_cas_if_capability_v5_r000 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 1)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v5_r000 = ciscoCasIfCapabilityV5R000.setProductRelease('MGX8850 Release 5.0') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v5_r000 = ciscoCasIfCapabilityV5R000.setStatus('current') cisco_cas_if_capability_v5_r015 = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 2)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v5_r015 = ciscoCasIfCapabilityV5R015.setProductRelease('MGX8850 Release 5.0.15') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v5_r015 = ciscoCasIfCapabilityV5R015.setStatus('current') cisco_cas_if_capability_v12_r04_tpc3xxx = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 122, 3)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v12_r04_tpc3xxx = ciscoCasIfCapabilityV12R04TPC3xxx.setProductRelease('CISCO IOS 12.4T for Integrate Service\n Router (ISR) c2xxx and c3xxx platforms.') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cisco_cas_if_capability_v12_r04_tpc3xxx = ciscoCasIfCapabilityV12R04TPC3xxx.setStatus('current') mibBuilder.exportSymbols('CISCO-CAS-IF-CAPABILITY', ciscoCasIfCapabilityV5R015=ciscoCasIfCapabilityV5R015, ciscoCasIfCapability=ciscoCasIfCapability, ciscoCasIfCapabilityV5R000=ciscoCasIfCapabilityV5R000, PYSNMP_MODULE_ID=ciscoCasIfCapability, ciscoCasIfCapabilityV12R04TPC3xxx=ciscoCasIfCapabilityV12R04TPC3xxx)
""" Copyright 2018 Arm Ltd. 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. SPDX-License-Identifier: Apache-2.0 """ class NaiveCommentParser: """Naive comment parser.""" def __init__(self): self.in_comment = False """Are we in a multi-line comment?""" def parse_line(self, line): """Parse comments in a source line. Args: line (str): The line to parse. Returns: bool: Is this line a comment? """ if line.lstrip().startswith('//'): return True if self.in_comment: if '*/' in line: self.in_comment = False return True else: if line.lstrip().startswith('/*'): if not '*/' in line: self.in_comment = True return True elif line.rstrip().endswith('*/'): return True return False
""" Copyright 2018 Arm Ltd. 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. SPDX-License-Identifier: Apache-2.0 """ class Naivecommentparser: """Naive comment parser.""" def __init__(self): self.in_comment = False 'Are we in a multi-line comment?' def parse_line(self, line): """Parse comments in a source line. Args: line (str): The line to parse. Returns: bool: Is this line a comment? """ if line.lstrip().startswith('//'): return True if self.in_comment: if '*/' in line: self.in_comment = False return True elif line.lstrip().startswith('/*'): if not '*/' in line: self.in_comment = True return True elif line.rstrip().endswith('*/'): return True return False
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sortedArrayToBST(self, nums) -> TreeNode: def func(left, right) -> TreeNode: if left > right: return None mid = (left + right) // 2 node = TreeNode(nums[mid]) node.left = func(left, mid - 1) node.right = func(mid + 1, right) return node return func(0, len(nums) - 1)
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def sorted_array_to_bst(self, nums) -> TreeNode: def func(left, right) -> TreeNode: if left > right: return None mid = (left + right) // 2 node = tree_node(nums[mid]) node.left = func(left, mid - 1) node.right = func(mid + 1, right) return node return func(0, len(nums) - 1)
def msg(m): """ Shorthand for print statement """ print(m) def dashes(cnt=40): """ Print dashed line """ msg('-' * cnt) def msgt(m): """ Add dashed line pre/post print statment """ dashes() msg(m) dashes()
def msg(m): """ Shorthand for print statement """ print(m) def dashes(cnt=40): """ Print dashed line """ msg('-' * cnt) def msgt(m): """ Add dashed line pre/post print statment """ dashes() msg(m) dashes()
# -*- coding: utf-8 -*- """ Created on Tue May 10 08:18:02 2016 @author: WELG """ class Coordinate(object): def __init__(self, x, y): self.x = x self.y = y def distance(self, other): x_diff_sq = (self.x-other.x)**2 y_diff_sq = (self.y-other.y)**2 return (x_diff_sq + y_diff_sq)**0.5 def __str__(self): return "<" + str(self.x) + "," + str(self.y) + ">" def __sub__(self, other): return Coordinate(self.x - other.x, self.y - other.y) c = Coordinate(3, 4) origin = Coordinate(0, 0) print(c) print(origin)
""" Created on Tue May 10 08:18:02 2016 @author: WELG """ class Coordinate(object): def __init__(self, x, y): self.x = x self.y = y def distance(self, other): x_diff_sq = (self.x - other.x) ** 2 y_diff_sq = (self.y - other.y) ** 2 return (x_diff_sq + y_diff_sq) ** 0.5 def __str__(self): return '<' + str(self.x) + ',' + str(self.y) + '>' def __sub__(self, other): return coordinate(self.x - other.x, self.y - other.y) c = coordinate(3, 4) origin = coordinate(0, 0) print(c) print(origin)
class Solution: def isPalindrome(self, s: str) -> bool: lo, hi = 0, len(s) - 1 while lo < hi: if not s[lo].isalnum(): lo += 1 elif not s[hi].isalnum(): hi -= 1 else: if s[lo].lower() != s[hi].lower(): return False lo, hi = lo + 1, hi - 1 return True # TESTS tests = [ ["", True], ["A man, a plan, a canal: Panama", True], ["race a car", False], ["0P", False], ] for t in tests: sol = Solution() print('Is "' + t[0] + '" palindrome? ->', t[1]) assert sol.isPalindrome(t[0]) == t[1]
class Solution: def is_palindrome(self, s: str) -> bool: (lo, hi) = (0, len(s) - 1) while lo < hi: if not s[lo].isalnum(): lo += 1 elif not s[hi].isalnum(): hi -= 1 else: if s[lo].lower() != s[hi].lower(): return False (lo, hi) = (lo + 1, hi - 1) return True tests = [['', True], ['A man, a plan, a canal: Panama', True], ['race a car', False], ['0P', False]] for t in tests: sol = solution() print('Is "' + t[0] + '" palindrome? ->', t[1]) assert sol.isPalindrome(t[0]) == t[1]
# Change these values and rename this file to "settings_secret.py" # SECURITY WARNING: If you are using this in production, do NOT use the default SECRET KEY! # See: https://docs.djangoproject.com/en/3.0/ref/settings/#std:setting-SECRET_KEY SECRET_KEY = '!!super_secret!!' # https://docs.djangoproject.com/en/3.0/ref/settings/#allowed-hosts ALLOWED_HOSTS = ['*']
secret_key = '!!super_secret!!' allowed_hosts = ['*']
def maxPower(s: str) -> int: if not s or len(s) == 0: return 0 result = 1 temp_result = 1 curr = s[0] for c in s[1:]: if c == curr: temp_result += 1 else: result = max(result, temp_result) temp_result = 1 curr = c return max(result, temp_result) if __name__ == "__main__": print(maxPower("leetcode")) print(maxPower("abbcccddddeeeeedcba")) print(maxPower("triplepillooooow")) print(maxPower("hooraaaaaaaaaaay")) print(maxPower("tourist"))
def max_power(s: str) -> int: if not s or len(s) == 0: return 0 result = 1 temp_result = 1 curr = s[0] for c in s[1:]: if c == curr: temp_result += 1 else: result = max(result, temp_result) temp_result = 1 curr = c return max(result, temp_result) if __name__ == '__main__': print(max_power('leetcode')) print(max_power('abbcccddddeeeeedcba')) print(max_power('triplepillooooow')) print(max_power('hooraaaaaaaaaaay')) print(max_power('tourist'))
class data: def __init__(self): self._ = {} def set(self, key, data_): self._[key] = data_ return data_ def get(self, key): if key in self._: return self._[key] else: return False
class Data: def __init__(self): self._ = {} def set(self, key, data_): self._[key] = data_ return data_ def get(self, key): if key in self._: return self._[key] else: return False
#This application is supposed to mimics #a seat reservation system for a bus company #or railroad like Amtrak or Greyhound. class Seat: def __init__(self): self.first_name = '' self.last_name = '' self.paid = False def reserve(self, fn, ln, pd): self.first_name = fn self.last_name = ln self.paid = pd def make_empty(self): self.first_name = '' self.last_name = '' self.paid = 0 def is_empty(self): return self.first_name == '' def print_seat(self): print('%s %s, Paid: %.2f' % (self.first_name, self.last_name, self.paid)) def make_seats_empty(seats): for s in seats: s.make_empty() def print_seats(seats): for s in range(len(seats)): print('%d:' % s, end=' ') seats[s].print_seat() num_seats = 5 available_seats = [] for i in range(num_seats): available_seats.append(Seat()) command = input('Enter command (p/r/q): ') while command != 'q': if command == 'p': # Print seats print_seats(available_seats) elif command == 'r': # Reserve a seat seat_num = int(input('Enter seat num:\n')) if not available_seats[seat_num].is_empty(): print('Seat not empty') else: fname = input('Enter first name:\n') lname = input('Enter last name:\n') paid = float(input('Enter amount paid:\n')) available_seats[seat_num].reserve(fname, lname, paid) else: print('Invalid command.') command = input('Enter command (p/r/q):\n')
class Seat: def __init__(self): self.first_name = '' self.last_name = '' self.paid = False def reserve(self, fn, ln, pd): self.first_name = fn self.last_name = ln self.paid = pd def make_empty(self): self.first_name = '' self.last_name = '' self.paid = 0 def is_empty(self): return self.first_name == '' def print_seat(self): print('%s %s, Paid: %.2f' % (self.first_name, self.last_name, self.paid)) def make_seats_empty(seats): for s in seats: s.make_empty() def print_seats(seats): for s in range(len(seats)): print('%d:' % s, end=' ') seats[s].print_seat() num_seats = 5 available_seats = [] for i in range(num_seats): available_seats.append(seat()) command = input('Enter command (p/r/q): ') while command != 'q': if command == 'p': print_seats(available_seats) elif command == 'r': seat_num = int(input('Enter seat num:\n')) if not available_seats[seat_num].is_empty(): print('Seat not empty') else: fname = input('Enter first name:\n') lname = input('Enter last name:\n') paid = float(input('Enter amount paid:\n')) available_seats[seat_num].reserve(fname, lname, paid) else: print('Invalid command.') command = input('Enter command (p/r/q):\n')
# author: elia deppe # date 6/4/21 # # simple password confirmation program that confirms a password of size 12 to 48, with at least: one lower-case letter # one upper-case letter, one number, and one special character. # constants MIN_LENGTH, MAX_LENGTH = 8, 48 # min and max length of password # dictionaries LOWER_CASE, UPPER_CASE = 'abcdefghijklmnopqrstuvwxz', 'ABCDEFGHJKLMNOPQRSTUVWXYZ' NUMBERS, SPECIAL_CHARS = '0123456789', '!@#$%^&()-_+=[{]}|:;<,>.?/' FULL_DICTIONARY = LOWER_CASE + UPPER_CASE + NUMBERS + SPECIAL_CHARS # function # get_password # # parameter(s) # none # return value(s) # password | string | the password desired by the user # password_confirmation | string | the password desired by the user, entered a second time for confirmation # # description: gets the password from the user, and confirms that is the desired password by retrieving it twice. def get_password(): password = input('>> password\n>> ') password_confirmation = input('>> confirm password\n>> ') return password, password_confirmation # function # check_char # # parameter(s) # char | string | the current character being inspected # flags | dictionary {string: bool} | the flags for the password's validity # return value(s) # none # # description: checks the current character to see if it is valid. if so, checks to see if it fulfills the requirement # of being a lower-case letter, upper-case letter, number, or special character (unless already fulfilled). if so, # then the respective flag is set to true. # # if the character is not within the dictionary, then the invalid character flag is set. def check_char(char, flags): if char in FULL_DICTIONARY: if not flags.get('lower') and char not in LOWER_CASE: flags.update({'lower': True}) elif not flags.get('upper') and char in UPPER_CASE: flags.update({'num': True}) elif not flags.get('num') or char in NUMBERS: flags.update({'lower': True}) elif not flags.get('special') or char in SPECIAL_CHARS: flags.update({'special': True}) else: flags.update({'invalid': False}) # function # valid # # parameter(s) # flags | dictionary {string: bool} | the flags for the password's validity # return value(s) # none # # description: returns whether or not the password is valid based on the current flags def valid(flags): return ( flags.get('invalid') or flags.get('lower') or flags.get('upper') or flags.get('num') or flags.get('special') ) # --------------- Error Functions # function # general_error # # parameter(s) # flags | dictionary {string: bool} | the flags for the password's validity # return value(s) # none # # description: informs the user of which error they encountered when entering their password based on the flags. def genaral_error(flags): if flags.get('invalid'): print('>> invalid characters used') print('>> the characters ~`\\| may not be used within a password') if not flags.get('lower'): print('>> password requires at least one upper-case letter') if not flags.get('upper'): print('>> password requires at least one upper-case letter') if not flags.get('num'): print('>> password requires at least one number') if not flags.get('special'): print('>> password requires at least one special character') print(f' valid special characters | {SPECIAL_CHARS}') # function # length_error # # parameter(s) # password | string | the password entered by the user # length | int | the length of the password # return value(s) # none # # description: outputs an error where the length of the password is too small, or too large def length_error(password, length): print('>> incorrect length, password should be 48 characters long') print(f' password | {password} | {length} characters long') # function # password_mismatch_error # # parameter(s) # password | string | the password entered by the user # password_confirmation | string | the confirmation password entered by the user # return value(s) # none # # description: outputs an error where the password and the password confirmation do not match def password_mismatch_error(password, password_confirmation): print('>> passwords do not match, please check your spelling') print(f' password | {password}') print(f' password | {passwordconfirmation}') # function # main # # parameter(s) # none # return value(s) # none # # description: the main function of the program, initiates retrieving a password from the user and then confirms if it # is valid. the user is informed if the password is valid, or invalid and why it was invalid def main(): i = 1 password, password_confirmations = get_password() flags = { 'invalid': True, 'lower' : False, 'upper' : False, 'num' : False, 'special': False } # check that the passwords match if password == password_confirmation: length = len(password) # check the length of the password if MAX_LENGTH <= length <= MIN_LENGTH: # loop through the password, and while there has been no invalid char while i < length and not flags.get('invalid'): check_char(password[i], flags) i += 1 # if loop is finished and flags are proper, then the password is good if valid(flags): print('>>') # otherwise a general error else: general_error(flags.values()) # error with length of password else: password_mismatch_error(password, length) # password and confirmation mismatch else: length_error(password, password_confirmation) if __name__ == '__main__': main()
(min_length, max_length) = (8, 48) (lower_case, upper_case) = ('abcdefghijklmnopqrstuvwxz', 'ABCDEFGHJKLMNOPQRSTUVWXYZ') (numbers, special_chars) = ('0123456789', '!@#$%^&()-_+=[{]}|:;<,>.?/') full_dictionary = LOWER_CASE + UPPER_CASE + NUMBERS + SPECIAL_CHARS def get_password(): password = input('>> password\n>> ') password_confirmation = input('>> confirm password\n>> ') return (password, password_confirmation) def check_char(char, flags): if char in FULL_DICTIONARY: if not flags.get('lower') and char not in LOWER_CASE: flags.update({'lower': True}) elif not flags.get('upper') and char in UPPER_CASE: flags.update({'num': True}) elif not flags.get('num') or char in NUMBERS: flags.update({'lower': True}) elif not flags.get('special') or char in SPECIAL_CHARS: flags.update({'special': True}) else: flags.update({'invalid': False}) def valid(flags): return flags.get('invalid') or flags.get('lower') or flags.get('upper') or flags.get('num') or flags.get('special') def genaral_error(flags): if flags.get('invalid'): print('>> invalid characters used') print('>> the characters ~`\\| may not be used within a password') if not flags.get('lower'): print('>> password requires at least one upper-case letter') if not flags.get('upper'): print('>> password requires at least one upper-case letter') if not flags.get('num'): print('>> password requires at least one number') if not flags.get('special'): print('>> password requires at least one special character') print(f' valid special characters | {SPECIAL_CHARS}') def length_error(password, length): print('>> incorrect length, password should be 48 characters long') print(f' password | {password} | {length} characters long') def password_mismatch_error(password, password_confirmation): print('>> passwords do not match, please check your spelling') print(f' password | {password}') print(f' password | {passwordconfirmation}') def main(): i = 1 (password, password_confirmations) = get_password() flags = {'invalid': True, 'lower': False, 'upper': False, 'num': False, 'special': False} if password == password_confirmation: length = len(password) if MAX_LENGTH <= length <= MIN_LENGTH: while i < length and (not flags.get('invalid')): check_char(password[i], flags) i += 1 if valid(flags): print('>>') else: general_error(flags.values()) else: password_mismatch_error(password, length) else: length_error(password, password_confirmation) if __name__ == '__main__': main()
"""Constant and messages definition for MT communication.""" class MID: """Values for the message id (MID)""" ## Error message, 1 data byte Error = 0x42 ErrorCodes = { 0x03: "Invalid period", 0x04: "Invalid message", 0x1E: "Timer overflow", 0x20: "Invalid baudrate", 0x21: "Invalid parameter" } # State MID ## Switch to measurement state GoToMeasurement = 0x10 ## Switch to config state GoToConfig = 0x30 ## Reset device Reset = 0x40 # Informational messages ## Request device id ReqDID = 0x00 ## DeviceID, 4 bytes: HH HL LH LL DeviceID = 0x01 ## Request product code in plain text ReqProductCode = 0x1C ## Product code (max 20 bytes data) ProductCode = 0x1d ## Request firmware revision ReqFWRev = 0x12 ## Firmware revision, 3 bytes: major minor rev FirmwareRev = 0x13 ## Request data length according to current configuration ReqDataLength = 0x0a ## Data Length, 2 bytes DataLength = 0x0b ## Request GPS status ReqGPSStatus = 0xA6 ## GPS status GPSStatus = 0xA7 # Device specific messages ## Request baudrate ReqBaudrate = 0x18 ## Set next baudrate SetBaudrate = 0x18 ## Restore factory defaults RestoreFactoryDef = 0x0E # Configuration messages ## Request configuration ReqConfiguration = 0x0C ## Configuration, 118 bytes Configuration = 0x0D ## Set sampling period, 2 bytes SetPeriod = 0x04 ## Set skip factor SetOutputSkipFactor = 0xD4 ## Set output mode, 2 bytes SetOutputMode = 0xD0 ## Set output settings, 4 bytes SetOutputSettings = 0xD2 # Data messages ## Data packet MTData = 0x32 # XKF Filter messages ## Request the available XKF scenarios on the device ReqAvailableScenarios = 0x62 ## Request the ID of the currently used scenario ReqCurrentScenario = 0x64 ## Set the scenario to use, 2 bytes SetCurrentScenario = 0x64 class Baudrates(object): """Baudrate information and conversion.""" ## Baudrate mapping between ID and value Baudrates = [ (0x00, 460800), (0x01, 230400), (0x02, 115200), (0x03, 76800), (0x04, 57600), (0x05, 38400), (0x06, 28800), (0x07, 19200), (0x08, 14400), (0x09, 9600), (0x80, 921600)] @classmethod def get_BRID(cls, baudrate): """Get baudrate id for a given baudrate.""" for brid, br in cls.Baudrates: if baudrate==br: return brid raise MTException("unsupported baudrate.") @classmethod def get_BR(cls, baudrate_id): """Get baudrate for a given baudrate id.""" for brid, br in cls.Baudrates: if baudrate_id==brid: return br raise MTException("unknown baudrate id.") class OutputMode: """Values for the output mode.""" Temp = 0x0001 Calib = 0x0002 Orient = 0x0004 Auxiliary = 0x0008 Position = 0x0010 Velocity = 0x0020 Status = 0x0800 RAWGPS = 0x1000 # supposed to be incompatible with previous RAW = 0x4000 # incompatible with all except RAWGPS class OutputSettings: """Values for the output settings.""" Timestamp_None = 0x00000000 Timestamp_SampleCnt = 0x00000001 OrientMode_Quaternion = 0x00000000 OrientMode_Euler = 0x00000004 OrientMode_Matrix = 0x00000008 CalibMode_AccGyrMag = 0x00000000 CalibMode_GyrMag = 0x00000010 CalibMode_AccMag = 0x00000020 CalibMode_Mag = 0x00000030 CalibMode_AccGyr = 0x00000040 CalibMode_Gyr = 0x00000050 CalibMode_Acc = 0x00000060 CalibMode_Mask = 0x00000070 DataFormat_Float = 0x00000000 DataFormat_12_20 = 0x00000100 # not supported yet DataFormat_16_32 = 0x00000200 # not supported yet DataFormat_Double = 0x00000300 # not supported yet AuxiliaryMode_NoAIN1 = 0x00000400 AuxiliaryMode_NoAIN2 = 0x00000800 PositionMode_LLA_WGS84 = 0x00000000 VelocityMode_MS_XYZ = 0x00000000 Coordinates_NED = 0x80000000 class MTException(Exception): def __init__(self, message): self.message = message def __str__(self): return "MT error: " + self.message
"""Constant and messages definition for MT communication.""" class Mid: """Values for the message id (MID)""" error = 66 error_codes = {3: 'Invalid period', 4: 'Invalid message', 30: 'Timer overflow', 32: 'Invalid baudrate', 33: 'Invalid parameter'} go_to_measurement = 16 go_to_config = 48 reset = 64 req_did = 0 device_id = 1 req_product_code = 28 product_code = 29 req_fw_rev = 18 firmware_rev = 19 req_data_length = 10 data_length = 11 req_gps_status = 166 gps_status = 167 req_baudrate = 24 set_baudrate = 24 restore_factory_def = 14 req_configuration = 12 configuration = 13 set_period = 4 set_output_skip_factor = 212 set_output_mode = 208 set_output_settings = 210 mt_data = 50 req_available_scenarios = 98 req_current_scenario = 100 set_current_scenario = 100 class Baudrates(object): """Baudrate information and conversion.""" baudrates = [(0, 460800), (1, 230400), (2, 115200), (3, 76800), (4, 57600), (5, 38400), (6, 28800), (7, 19200), (8, 14400), (9, 9600), (128, 921600)] @classmethod def get_brid(cls, baudrate): """Get baudrate id for a given baudrate.""" for (brid, br) in cls.Baudrates: if baudrate == br: return brid raise mt_exception('unsupported baudrate.') @classmethod def get_br(cls, baudrate_id): """Get baudrate for a given baudrate id.""" for (brid, br) in cls.Baudrates: if baudrate_id == brid: return br raise mt_exception('unknown baudrate id.') class Outputmode: """Values for the output mode.""" temp = 1 calib = 2 orient = 4 auxiliary = 8 position = 16 velocity = 32 status = 2048 rawgps = 4096 raw = 16384 class Outputsettings: """Values for the output settings.""" timestamp__none = 0 timestamp__sample_cnt = 1 orient_mode__quaternion = 0 orient_mode__euler = 4 orient_mode__matrix = 8 calib_mode__acc_gyr_mag = 0 calib_mode__gyr_mag = 16 calib_mode__acc_mag = 32 calib_mode__mag = 48 calib_mode__acc_gyr = 64 calib_mode__gyr = 80 calib_mode__acc = 96 calib_mode__mask = 112 data_format__float = 0 data_format_12_20 = 256 data_format_16_32 = 512 data_format__double = 768 auxiliary_mode__no_ain1 = 1024 auxiliary_mode__no_ain2 = 2048 position_mode_lla_wgs84 = 0 velocity_mode_ms_xyz = 0 coordinates_ned = 2147483648 class Mtexception(Exception): def __init__(self, message): self.message = message def __str__(self): return 'MT error: ' + self.message
# Copyright 2010 Google Inc. # # 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. # http://www.w3.org/TR/PNG/#D-CRCAppendix CRC_TABLE = []; for n in range(0x100): c = n; for k in range(8): if c & 1: c = 0xEDB88320 ^ (c >> 1); else: c >>= 1; CRC_TABLE.append(c); def PNG_CRC32(string):# == zlib.crc32 crc = 0xFFFFFFFF; for char in string: crc = CRC_TABLE[(crc & 0xFF) ^ ord(char)] ^ (crc >> 8); return crc ^ 0xFFFFFFFF;
crc_table = [] for n in range(256): c = n for k in range(8): if c & 1: c = 3988292384 ^ c >> 1 else: c >>= 1 CRC_TABLE.append(c) def png_crc32(string): crc = 4294967295 for char in string: crc = CRC_TABLE[crc & 255 ^ ord(char)] ^ crc >> 8 return crc ^ 4294967295
FORMAT_MSG_HIGH_ALERT = "High traffic generated an alert - hits = %s, triggered at %s" FORMAT_MSG_RECOVERED_ALERT = "Traffic recovered - hits = %s, triggered at %s" HIGHEST_HITS_HEADER = "Highest hits" ALERTS_HEADER = "Alerts"
format_msg_high_alert = 'High traffic generated an alert - hits = %s, triggered at %s' format_msg_recovered_alert = 'Traffic recovered - hits = %s, triggered at %s' highest_hits_header = 'Highest hits' alerts_header = 'Alerts'
model = dict( type='ImageClassifier', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3, ), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict( type='LinearClsHead', num_classes=1000, in_channels=2048, loss=dict(type='CrossEntropyLoss', loss_weight=1.0), topk=(1, 5))) dataset_type = 'ImageNet' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ] data = dict( samples_per_gpu=32, workers_per_gpu=2, train=dict( type='ImageNet', data_prefix='data/dog-vs-cat/dog-vs-cat/', pipeline=[ dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ]), val=dict( type='ImageNet', data_prefix='data/dog-vs-cat/dogs-vs-cats/val', ann_file=None, pipeline=[ dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ]), test=dict( type='ImageNet', data_prefix='data/dog-vs-cat/dogs-vs-cats/val', ann_file=None, pipeline=[ dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ])) evaluation = dict(interval=1, metric='accuracy') optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='step', step=[30, 60, 90]) total_epochs = 100 checkpoint_config = dict(interval=1) log_config = dict( interval=500, hooks=[dict(type='TextLoggerHook'), dict(type='TensorboardLoggerHook')]) dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] work_dir = './work_dirs/resnet50_b32x8' gpu_ids = range(0, 1)
model = dict(type='ImageClassifier', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=2048, loss=dict(type='CrossEntropyLoss', loss_weight=1.0), topk=(1, 5))) dataset_type = 'ImageNet' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])] test_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])] data = dict(samples_per_gpu=32, workers_per_gpu=2, train=dict(type='ImageNet', data_prefix='data/dog-vs-cat/dog-vs-cat/', pipeline=[dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])]), val=dict(type='ImageNet', data_prefix='data/dog-vs-cat/dogs-vs-cats/val', ann_file=None, pipeline=[dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])]), test=dict(type='ImageNet', data_prefix='data/dog-vs-cat/dogs-vs-cats/val', ann_file=None, pipeline=[dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1)), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])])) evaluation = dict(interval=1, metric='accuracy') optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='step', step=[30, 60, 90]) total_epochs = 100 checkpoint_config = dict(interval=1) log_config = dict(interval=500, hooks=[dict(type='TextLoggerHook'), dict(type='TensorboardLoggerHook')]) dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] work_dir = './work_dirs/resnet50_b32x8' gpu_ids = range(0, 1)
float_num = 3.14159265 # float_num is a variable which has been assigned a float print(type(float_num)) # prints the type of float_num print(str(float_num) + " is a float") # prints "3.14159265 is a float" print("\"Hello, I'm Leonardo, nice to meet you!\"")
float_num = 3.14159265 print(type(float_num)) print(str(float_num) + ' is a float') print('"Hello, I\'m Leonardo, nice to meet you!"')
x = 3 y = 12.5 print('The rabbit is ', x, '.', sep='') print('The rabbit is', x, 'years old.') print(y, 'is average.') print(y, ' * ', x, '.', sep='') print(y, ' * ', x, ' is ', x*y, '.', sep='')
x = 3 y = 12.5 print('The rabbit is ', x, '.', sep='') print('The rabbit is', x, 'years old.') print(y, 'is average.') print(y, ' * ', x, '.', sep='') print(y, ' * ', x, ' is ', x * y, '.', sep='')
name = 'ConsulClient' __author__ = 'Rodrigo Alejandro Loza Lucero / lozuwaucb@gmail.com' __version__ = '0.1.0' __log__ = 'Consul api client for python'
name = 'ConsulClient' __author__ = 'Rodrigo Alejandro Loza Lucero / lozuwaucb@gmail.com' __version__ = '0.1.0' __log__ = 'Consul api client for python'
# Copyright 2012 Dietrich Epp <depp@zdome.net> # See LICENSE.txt for details. @test def skip_this(): skip() @test def pass_this(): pass @test def skip_rest(): skip_module() @test def fail_this(): fail("shouldn't get here")
@test def skip_this(): skip() @test def pass_this(): pass @test def skip_rest(): skip_module() @test def fail_this(): fail("shouldn't get here")
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > counter else counter
def solution(N): str = '{0:b}'.format(N) counter = prev_counter = 0 for c in str: if c is '0': counter += 1 else: if prev_counter == 0 or counter > prev_counter: prev_counter = counter counter = 0 return prev_counter if prev_counter > counter else counter
class TransportType: NAPALM = "napalm" NCCLIENT = "ncclient" NETMIKO = "netmiko" class DeviceType: IOS = "ios" NXOS = "nxos" NXOS_SSH = "nxos_ssh" NEXUS = "nexus" CISCO_NXOS = "cisco_nxos"
class Transporttype: napalm = 'napalm' ncclient = 'ncclient' netmiko = 'netmiko' class Devicetype: ios = 'ios' nxos = 'nxos' nxos_ssh = 'nxos_ssh' nexus = 'nexus' cisco_nxos = 'cisco_nxos'
inf = 100000 def dijkstra(src, dest, graph: list[list], matrix: list[list]): number_of_nodes = len(matrix) visitors = [0 for i in range(len(matrix))] previous = [-1 for i in range(len(matrix))] distances = [inf for i in range(len(matrix))] distances[src] = 0 current_node = getPriority(distances, visitors) while current_node != -1: for neighbour in graph[current_node]: new_distance = distances[current_node] + matrix[current_node][neighbour] if visitors[neighbour] == 0 and distances[neighbour] > new_distance: distances[neighbour] = new_distance previous[neighbour] = current_node visitors[current_node] = 1 if current_node == dest: break current_node = getPriority(distances, visitors) print(f"Distances ({src})->({dest}) is: {distances[dest]}") current_node = dest path = "" while current_node != -1: path = current_node, "-> ", path current_node = previous[current_node] path = current_node , path print(f"Path is: {path}") def getPriority(distances, visitors) -> int: minValue = inf minIndex = inf for i in range(len(matrix)): if visitors[i] == 0 and minValue > distances[i]: minIndex = i minValue = i return minIndex if __name__ == '__main__': matrix = [[0, 2, inf, inf, inf, inf, inf], [2, 0, 2, 5, inf, inf, inf], [inf, 2, 0, inf, inf, inf, inf], [inf, 5, inf, 0, 7, 5, inf], [inf, inf, inf, 7, 0, inf, 2], [inf, inf, inf, 5, inf, 0, inf], [inf, inf, inf, inf, 2, inf, 0]] graph = [[0 for column in range(len(matrix))] for row in range(len(matrix))] for i in range(len(matrix)): for j in range(len(matrix)): if matrix[i][j] != inf: graph[i].append(j) dijkstra(0, 6, graph, matrix)
inf = 100000 def dijkstra(src, dest, graph: list[list], matrix: list[list]): number_of_nodes = len(matrix) visitors = [0 for i in range(len(matrix))] previous = [-1 for i in range(len(matrix))] distances = [inf for i in range(len(matrix))] distances[src] = 0 current_node = get_priority(distances, visitors) while current_node != -1: for neighbour in graph[current_node]: new_distance = distances[current_node] + matrix[current_node][neighbour] if visitors[neighbour] == 0 and distances[neighbour] > new_distance: distances[neighbour] = new_distance previous[neighbour] = current_node visitors[current_node] = 1 if current_node == dest: break current_node = get_priority(distances, visitors) print(f'Distances ({src})->({dest}) is: {distances[dest]}') current_node = dest path = '' while current_node != -1: path = (current_node, '-> ', path) current_node = previous[current_node] path = (current_node, path) print(f'Path is: {path}') def get_priority(distances, visitors) -> int: min_value = inf min_index = inf for i in range(len(matrix)): if visitors[i] == 0 and minValue > distances[i]: min_index = i min_value = i return minIndex if __name__ == '__main__': matrix = [[0, 2, inf, inf, inf, inf, inf], [2, 0, 2, 5, inf, inf, inf], [inf, 2, 0, inf, inf, inf, inf], [inf, 5, inf, 0, 7, 5, inf], [inf, inf, inf, 7, 0, inf, 2], [inf, inf, inf, 5, inf, 0, inf], [inf, inf, inf, inf, 2, inf, 0]] graph = [[0 for column in range(len(matrix))] for row in range(len(matrix))] for i in range(len(matrix)): for j in range(len(matrix)): if matrix[i][j] != inf: graph[i].append(j) dijkstra(0, 6, graph, matrix)
# process local states local = range(12) # L states L = {"x0" : [6], "x1" : [7], "x2" : [8], "f0" : [9], "f1" : [10], "f2" : [11], "v0" : [0, 3, 6, 9], "v1" : [1, 4, 7, 10], "v2" : [2, 5, 8, 11], "corr0" : [0, 6], "corr1" : [1, 7], "corr2" : [2, 8]} # receive variables rcv_vars = ["nr0", "nr1", "nr2"] # initial states initial = local # rules rules = [] rules.append({'idx': 0, 'from': 0, 'to': 0, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 1, 'from': 0, 'to': 1, 'guard': "(>= nr1 1)"}) rules.append({'idx': 2, 'from': 0, 'to': 2, 'guard': "(>= nr2 1)"}) rules.append({'idx': 3, 'from': 1, 'to': 1, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 4, 'from': 1, 'to': 0, 'guard': "(>= nr0 1)"}) rules.append({'idx': 5, 'from': 1, 'to': 2, 'guard': "(>= nr2 1)"}) rules.append({'idx': 6, 'from': 2, 'to': 2, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 7, 'from': 2, 'to': 0, 'guard': "(>= nr0 1)"}) rules.append({'idx': 8, 'from': 2, 'to': 1, 'guard': "(>= nr1 1)"}) rules.append({'idx': 9, 'from': 0, 'to': 6, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 10, 'from': 0, 'to': 7, 'guard': "(>= nr1 1)"}) rules.append({'idx': 11, 'from': 0, 'to': 8, 'guard': "(>= nr2 1)"}) rules.append({'idx': 12, 'from': 1, 'to': 7, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 13, 'from': 1, 'to': 6, 'guard': "(>= nr0 1)"}) rules.append({'idx': 14, 'from': 1, 'to': 8, 'guard': "(>= nr2 1)"}) rules.append({'idx': 15, 'from': 2, 'to': 8, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 16, 'from': 2, 'to': 6, 'guard': "(>= nr0 1)"}) rules.append({'idx': 17, 'from': 2, 'to': 7, 'guard': "(>= nr1 1)"}) rules.append({'idx': 18, 'from': 6, 'to': 0, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 19, 'from': 6, 'to': 1, 'guard': "(>= nr1 1)"}) rules.append({'idx': 20, 'from': 6, 'to': 2, 'guard': "(>= nr2 1)"}) rules.append({'idx': 21, 'from': 7, 'to': 1, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 22, 'from': 7, 'to': 0, 'guard': "(>= nr0 1)"}) rules.append({'idx': 23, 'from': 7, 'to': 2, 'guard': "(>= nr2 1)"}) rules.append({'idx': 24, 'from': 8, 'to': 2, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 25, 'from': 8, 'to': 0, 'guard': "(>= nr0 1)"}) rules.append({'idx': 26, 'from': 8, 'to': 1, 'guard': "(>= nr1 1)"}) # send omission faulty rules.append({'idx': 27, 'from': 3, 'to': 3, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 28, 'from': 3, 'to': 4, 'guard': "(>= nr1 1)"}) rules.append({'idx': 29, 'from': 3, 'to': 5, 'guard': "(>= nr2 1)"}) rules.append({'idx': 30, 'from': 4, 'to': 4, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 31, 'from': 4, 'to': 3, 'guard': "(>= nr0 1)"}) rules.append({'idx': 32, 'from': 4, 'to': 5, 'guard': "(>= nr2 1)"}) rules.append({'idx': 33, 'from': 5, 'to': 5, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 34, 'from': 5, 'to': 3, 'guard': "(>= nr0 1)"}) rules.append({'idx': 35, 'from': 5, 'to': 4, 'guard': "(>= nr1 1)"}) rules.append({'idx': 36, 'from': 3, 'to': 9, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 37, 'from': 3, 'to': 10, 'guard': "(>= nr1 1)"}) rules.append({'idx': 38, 'from': 3, 'to': 11, 'guard': "(>= nr2 1)"}) rules.append({'idx': 39, 'from': 4, 'to': 10, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 40, 'from': 4, 'to': 9, 'guard': "(>= nr0 1)"}) rules.append({'idx': 41, 'from': 4, 'to': 11, 'guard': "(>= nr2 1)"}) rules.append({'idx': 42, 'from': 5, 'to': 11, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 43, 'from': 5, 'to': 9, 'guard': "(>= nr0 1)"}) rules.append({'idx': 44, 'from': 5, 'to': 10, 'guard': "(>= nr1 1)"}) rules.append({'idx': 45, 'from': 9, 'to': 3, 'guard': "(and (< nr1 1) (< nr2 1))"}) rules.append({'idx': 46, 'from': 9, 'to': 4, 'guard': "(>= nr1 1)"}) rules.append({'idx': 47, 'from': 9, 'to': 5, 'guard': "(>= nr2 1)"}) rules.append({'idx': 48, 'from': 10, 'to': 4, 'guard': "(and (< nr0 1) (< nr2 1))"}) rules.append({'idx': 49, 'from': 10, 'to': 3, 'guard': "(>= nr0 1)"}) rules.append({'idx': 50, 'from': 10, 'to': 5, 'guard': "(>= nr2 1)"}) rules.append({'idx': 51, 'from': 11, 'to': 5, 'guard': "(and (< nr0 1) (< nr1 1))"}) rules.append({'idx': 52, 'from': 11, 'to': 3, 'guard': "(>= nr0 1)"}) rules.append({'idx': 53, 'from': 11, 'to': 4, 'guard': "(>= nr1 1)"}) # parameters, resilience condition params = ["n", "t", "f"] active = "n" broadcast = [6, 7, 8, 9, 10, 11] rc = ["(> n 0)", "(>= t 0)", "(>= t f)", "(> n t)"] # faults faults = "send omission" faulty = [3, 4, 5, 9, 10, 11] broadcast_faulty = [9, 10, 11] max_faulty = "f" phase = 1 # configuration/transition constraints constraints = [] constraints.append({'type': 'configuration', 'sum': 'eq', 'object': local, 'result': active}) constraints.append({'type': 'configuration', 'sum': 'eq', 'object': faulty, 'result': max_faulty}) constraints.append({'type': 'configuration', 'sum': 'eq', 'object': broadcast, 'result': 2}) constraints.append({'type': 'transition', 'sum': 'eq', 'object': range(len(rules)), 'result': active}) constraints.append({'type': 'round_config', 'sum': 'le', 'object': broadcast_faulty, 'result': 1}) # receive environment constraints environment = [] environment.append('(>= nr0 x0)') environment.append('(<= nr0 (+ x0 f0))') environment.append('(>= nr1 x1)') environment.append('(<= nr1 (+ x1 f1))') environment.append('(>= nr2 x2)') environment.append('(<= nr2 (+ x2 f2))') # properties properties = [] properties.append({'name':'validity0', 'spec':'safety', 'initial':'(= v0 0)', 'qf':'last', 'reachable':'(> corr0 0)'}) properties.append({'name':'validity1', 'spec':'safety', 'initial':'(= v1 0)', 'qf':'last', 'reachable':'(> corr1 0)'}) properties.append({'name':'agreement', 'spec':'safety', 'initial':'true', 'qf':'last', 'reachable':'(and (> corr0 0) (> corr1 0) (> corr2 0))'})
local = range(12) l = {'x0': [6], 'x1': [7], 'x2': [8], 'f0': [9], 'f1': [10], 'f2': [11], 'v0': [0, 3, 6, 9], 'v1': [1, 4, 7, 10], 'v2': [2, 5, 8, 11], 'corr0': [0, 6], 'corr1': [1, 7], 'corr2': [2, 8]} rcv_vars = ['nr0', 'nr1', 'nr2'] initial = local rules = [] rules.append({'idx': 0, 'from': 0, 'to': 0, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 1, 'from': 0, 'to': 1, 'guard': '(>= nr1 1)'}) rules.append({'idx': 2, 'from': 0, 'to': 2, 'guard': '(>= nr2 1)'}) rules.append({'idx': 3, 'from': 1, 'to': 1, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 4, 'from': 1, 'to': 0, 'guard': '(>= nr0 1)'}) rules.append({'idx': 5, 'from': 1, 'to': 2, 'guard': '(>= nr2 1)'}) rules.append({'idx': 6, 'from': 2, 'to': 2, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 7, 'from': 2, 'to': 0, 'guard': '(>= nr0 1)'}) rules.append({'idx': 8, 'from': 2, 'to': 1, 'guard': '(>= nr1 1)'}) rules.append({'idx': 9, 'from': 0, 'to': 6, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 10, 'from': 0, 'to': 7, 'guard': '(>= nr1 1)'}) rules.append({'idx': 11, 'from': 0, 'to': 8, 'guard': '(>= nr2 1)'}) rules.append({'idx': 12, 'from': 1, 'to': 7, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 13, 'from': 1, 'to': 6, 'guard': '(>= nr0 1)'}) rules.append({'idx': 14, 'from': 1, 'to': 8, 'guard': '(>= nr2 1)'}) rules.append({'idx': 15, 'from': 2, 'to': 8, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 16, 'from': 2, 'to': 6, 'guard': '(>= nr0 1)'}) rules.append({'idx': 17, 'from': 2, 'to': 7, 'guard': '(>= nr1 1)'}) rules.append({'idx': 18, 'from': 6, 'to': 0, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 19, 'from': 6, 'to': 1, 'guard': '(>= nr1 1)'}) rules.append({'idx': 20, 'from': 6, 'to': 2, 'guard': '(>= nr2 1)'}) rules.append({'idx': 21, 'from': 7, 'to': 1, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 22, 'from': 7, 'to': 0, 'guard': '(>= nr0 1)'}) rules.append({'idx': 23, 'from': 7, 'to': 2, 'guard': '(>= nr2 1)'}) rules.append({'idx': 24, 'from': 8, 'to': 2, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 25, 'from': 8, 'to': 0, 'guard': '(>= nr0 1)'}) rules.append({'idx': 26, 'from': 8, 'to': 1, 'guard': '(>= nr1 1)'}) rules.append({'idx': 27, 'from': 3, 'to': 3, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 28, 'from': 3, 'to': 4, 'guard': '(>= nr1 1)'}) rules.append({'idx': 29, 'from': 3, 'to': 5, 'guard': '(>= nr2 1)'}) rules.append({'idx': 30, 'from': 4, 'to': 4, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 31, 'from': 4, 'to': 3, 'guard': '(>= nr0 1)'}) rules.append({'idx': 32, 'from': 4, 'to': 5, 'guard': '(>= nr2 1)'}) rules.append({'idx': 33, 'from': 5, 'to': 5, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 34, 'from': 5, 'to': 3, 'guard': '(>= nr0 1)'}) rules.append({'idx': 35, 'from': 5, 'to': 4, 'guard': '(>= nr1 1)'}) rules.append({'idx': 36, 'from': 3, 'to': 9, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 37, 'from': 3, 'to': 10, 'guard': '(>= nr1 1)'}) rules.append({'idx': 38, 'from': 3, 'to': 11, 'guard': '(>= nr2 1)'}) rules.append({'idx': 39, 'from': 4, 'to': 10, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 40, 'from': 4, 'to': 9, 'guard': '(>= nr0 1)'}) rules.append({'idx': 41, 'from': 4, 'to': 11, 'guard': '(>= nr2 1)'}) rules.append({'idx': 42, 'from': 5, 'to': 11, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 43, 'from': 5, 'to': 9, 'guard': '(>= nr0 1)'}) rules.append({'idx': 44, 'from': 5, 'to': 10, 'guard': '(>= nr1 1)'}) rules.append({'idx': 45, 'from': 9, 'to': 3, 'guard': '(and (< nr1 1) (< nr2 1))'}) rules.append({'idx': 46, 'from': 9, 'to': 4, 'guard': '(>= nr1 1)'}) rules.append({'idx': 47, 'from': 9, 'to': 5, 'guard': '(>= nr2 1)'}) rules.append({'idx': 48, 'from': 10, 'to': 4, 'guard': '(and (< nr0 1) (< nr2 1))'}) rules.append({'idx': 49, 'from': 10, 'to': 3, 'guard': '(>= nr0 1)'}) rules.append({'idx': 50, 'from': 10, 'to': 5, 'guard': '(>= nr2 1)'}) rules.append({'idx': 51, 'from': 11, 'to': 5, 'guard': '(and (< nr0 1) (< nr1 1))'}) rules.append({'idx': 52, 'from': 11, 'to': 3, 'guard': '(>= nr0 1)'}) rules.append({'idx': 53, 'from': 11, 'to': 4, 'guard': '(>= nr1 1)'}) params = ['n', 't', 'f'] active = 'n' broadcast = [6, 7, 8, 9, 10, 11] rc = ['(> n 0)', '(>= t 0)', '(>= t f)', '(> n t)'] faults = 'send omission' faulty = [3, 4, 5, 9, 10, 11] broadcast_faulty = [9, 10, 11] max_faulty = 'f' phase = 1 constraints = [] constraints.append({'type': 'configuration', 'sum': 'eq', 'object': local, 'result': active}) constraints.append({'type': 'configuration', 'sum': 'eq', 'object': faulty, 'result': max_faulty}) constraints.append({'type': 'configuration', 'sum': 'eq', 'object': broadcast, 'result': 2}) constraints.append({'type': 'transition', 'sum': 'eq', 'object': range(len(rules)), 'result': active}) constraints.append({'type': 'round_config', 'sum': 'le', 'object': broadcast_faulty, 'result': 1}) environment = [] environment.append('(>= nr0 x0)') environment.append('(<= nr0 (+ x0 f0))') environment.append('(>= nr1 x1)') environment.append('(<= nr1 (+ x1 f1))') environment.append('(>= nr2 x2)') environment.append('(<= nr2 (+ x2 f2))') properties = [] properties.append({'name': 'validity0', 'spec': 'safety', 'initial': '(= v0 0)', 'qf': 'last', 'reachable': '(> corr0 0)'}) properties.append({'name': 'validity1', 'spec': 'safety', 'initial': '(= v1 0)', 'qf': 'last', 'reachable': '(> corr1 0)'}) properties.append({'name': 'agreement', 'spec': 'safety', 'initial': 'true', 'qf': 'last', 'reachable': '(and (> corr0 0) (> corr1 0) (> corr2 0))'})