content
stringlengths
7
1.05M
class KeplerIOError(Exception): """A base exception for any IO error that might occur.""" def __init__(self, message): """Initializes a new KeplerIOError""" super().__init__(message) class MAST_IDNotFound(KeplerIOError): """The searched ID could not be found on MAST.""" def __init__(self, kepler_id): super().__init__(f'Could not find lightcurve data for {kepler_id}.') class MAST_ServerError(KeplerIOError): """Raised when the MAST server replies with a 500 error code""" def __init__(self, url, error): if error == 503: message = ( f'Requesting {url} from MAST resulted in 503 Error. ' 'Please wait for service to resume or contact MAST ' 'support for more information.' ) elif error == 504: message = ( f'Connection to MAST resulted in 504 Gateway Timeout error. ' 'Please check connection if you\'re using a proxy or some ' 'other form of indirect connection to MAST.' ) else: message = ( f'MAST Service error {error} while requesting {url}. Please ' 'wait and try again.' ) super().__init__(message)
class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if not matrix: return False if not matrix[0]: return False left = up = 0 right = len(matrix[0])-1 down = len(matrix)-1 for i in range(len(matrix[0])): if matrix[0][i] > target: right = i-1 break for j in range(len(matrix)): if matrix[j][0] > target: down = j-1 break for x in range(down+1): for y in range(right+1): if matrix[x][y] == target: return True if matrix[x][y] > target: break return False # Two Pointers class Solution: def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ if not matrix: return False if not matrix[0]: return False i = 0 j = len(matrix[0])-1 while i < len(matrix) and j >= 0: if matrix[i][j] == target: return True elif matrix[i][j] > target: j -= 1 else: i += 1 return False
def sum(a,b): return a + b def salario_descontado_imposto(salario,imposto=27.): return salario - (salario * imposto * 0.01) c = sum(1,3) print(c) salario_real = salario_descontado_imposto(5000) print(salario_real)
x = 50 while 50 <= x <= 100: print (x) x = x + 1
# Copyright (c) 2020 Geoffrey Huntley <[email protected]>. All rights reserved. # SPDX-License-Identifier: Proprietary # Sample Test passing with nose and pytest def test_pass(): assert True, "dummy sample test"
class InputReader: """Handles reading the input""" def __init__(self, mode, filename): self.filename = filename self.mode = mode def get_next_word(self) -> str: """ Returns one word at a time from the input document :return: The next word """ # The sub functions must be generators!! if self.mode == 'txt': return self.__get_txt_input() else: raise Exception("Unrecognized Mode") def __get_txt_input(self) -> str: """ Reading a line each time from a txt file """ with open(self.filename, 'r') as f: for line in f: yield line.strip()
""" Create a function that reverses a string. For example string 'Hi My name is Faisal' should be 'lasiaF si eman yM iH' """ # Function Definition # First attempt to reverse a string. def reverse_string(string_input): split_string = list(string_input) reversed_string = [] for i in reversed(range(len(split_string))): reversed_string.append(split_string[i]) print(reversed_string) # Reverse a string using Andrei's solution to reverse a string exercise. def reverse_string_2(string_input): # Check the input for errors, What if the string is a number or undefined? if type(string_input) != str or len(string_input) < 2: return 'Please enter valid input!' backwards = [] total_items = len(string_input) - 1 for i in range(total_items, -1, -1): backwards.append(string_input[i]) print(backwards) return ''.join(backwards) # Reverse string function using inbuilt functions and in a more pythony way. def reverse_string_3(string_input): return ''.join(reversed(list(string_input))) # Declarations to_reverse = 'hello' # reverse_string(to_reverse) # string = reverse_string_2(to_reverse) string = reverse_string_3(to_reverse) print(string)
#The Course:PROG8420 #Assignment No:2 #Create date:2020/09/25 #Name: Fei Yun location1=input('put the txt file with .py same folder and input file name: ') def wordCount(location): file=open(location,"r") wordcount={} #split word and lower all words Text=file.read().lower().split() #clean -,.\n special characaters for char in '-.,\n': Text=[item.replace(char,'') for item in Text] #count word for word in Text: #creat word if not exist if word not in wordcount: wordcount[word]=1 else: #count +1 if exist wordcount[word]+=1 #sort word as alpha order for k in sorted(wordcount): print("%s : %d" %(k,wordcount[k])) file.close() wordCount(location1)
players = ['charles', 'martina', 'michael', 'florence', 'eli'] print (players) print (players[0:3]) print (players[1:4]) print (players[:4]) print (players[2:]) print ('\nHere are the first three players on my team:') for player in players[:3]: print (player.title())
# close func def CloseFunc(): print("CloseFunc") return False # an option def Option1(): print("Option1") return True # dictionary with all options_dict # your key : ("option name", function to call for that option), options_dict = { 0 : ("Close called", CloseFunc), 1 : ("Option1 function called", Option1), } # ask for option function def AskForOption(): #print each option you have with the coresponded key for key in options_dict.keys(): print("%s - %s" % (str(key), options_dict[key][0])) print("") option = input("Enter your option:") # ask for the option if not option in options_dict: # check if the key exists in your option dict print("Invalid input") return True return options_dict[option][1]() # call the function by the key entered and return the value if __name__ == "__main__": # ask for an option until AskForOption will be false while AskForOption(): pass
##Create an empty string and assign it to the variable lett. Then using range, write code such that when your code is run, lett has 7 b’s ("bbbbbbb"). lett = "" for i in range(0, 7): lett = lett + "b" print(lett)
# Strings # split -> returns a list based on the delimiter # Sample String string_01 = "The quick brown fox jumps over the lazy dog." string_02 = "10/10/2019 01:02:35 CST|10.10.21.23|HTTP 200|Duration:5s|Timeout:30s" # Using split word_list = string_01.split() # Type & Print print(" Type ".center(44, "-")) print(type(word_list)) print(word_list) # Determine length word_count = len(word_list) print(" list item count (i.e length)".center(44, "-")) print(word_count) # ------------------------------------------------------ # Using split #word_list2 = string_02.split("|") word_list2 = string_02.split("|",1) # Impact of 2nd argument # Type & Print print(" Type ".center(44, "-")) print(type(word_list2)) print(word_list2) # Determine length word_count2 = len(word_list2) print(" list item count (i.e length)".center(44, "-")) print(word_count2)
magic_create_key = "TheQuickBrownFox" class Board: class Builder: def __init__(self, board, player): if len(board) == 0: raise InvalidBoardException("Board is empty") self.board = board self.player = player self.min_array_size = 5 # Min board size is 3 if self.player == 1: self.start_char = "A" self.end_char = "B" else: self.start_char = "a" self.end_char = "b" @staticmethod def empty(player): return Board.Builder([[]], player) def load_from_file(self, file_name): """ :param file_name: The file where the board will be derived from :return: None, but the resulting array board will be stored in self.board """ board_file = open(file_name, "r") # Get rows and columns from text file rows = 0 cols = 0 for line in board_file: if rows == 0: cols = len(line) rows += 1 # Checks if line lengths are consistent current_row = 0 for line in board_file: if len(line) != cols and current_row != rows: board_file.close() raise InvalidBoardException("Inconsistent line lengths") current_row += 1 board_file.seek(0) # Return to the start of the text file cols = int(cols / 2) # Makes array if rows >= self.min_array_size and cols >= self.min_array_size: file_array = self.build_empty_board(rows, cols) else: board_file.close() raise InvalidBoardException("Board too small") # Fills the array previous_element = "" for r in range(len(file_array)): for c in range(len(file_array[0])): # Checks consistency of inner walls if not (r == 0 and c == 0): previous_element = next_array_element next_array_element = board_file.read(2) if not (r == 0 and c == 0): if c % 2 == 1: if previous_element[1] != next_array_element[1]: board_file.close() raise InvalidBoardException("Invalid inner walls") if next_array_element[0] == "+": file_array[r][c] = "?" elif next_array_element[0] == "/" or next_array_element[0] == "\\": file_array[r][c] = "?" elif next_array_element[0] == "|": file_array[r][c] = "#" elif next_array_element[0] == "-": if next_array_element[1] == next_array_element[0]: file_array[r][c] = "#" else: board_file.close() raise InvalidBoardException("Invalid inner walls") elif next_array_element[0] == " ": if next_array_element[1] == next_array_element[0]: file_array[r][c] = " " else: board_file.close() raise InvalidBoardException("Invalid inner walls") elif next_array_element[0] == self.start_char: file_array[r][c] = self.start_char elif next_array_element[0] == self.end_char: file_array[r][c] = self.end_char self.board = file_array board_file.close() def save_to_file(self, file_name): """ :param file_name: The file where the board will be written onto :return: None, but the resulting text board will be written in the file given """ new_file = open(file_name, "w") for r in range(len(self.board)): current_line = "" for c in range(len(self.board[0])): # Corners if r == 0 and c == 0: current_line += "/-" elif r == 0 and c == len(self.board[0]) - 1: current_line += "\\" elif r == len(self.board) - 1 and c == 0: current_line += "\\-" elif r == len(self.board) - 1 and c == len(self.board[0]) - 1: current_line += "/" # Regular elements elif self.board[r][c] == "#": if r % 2 == 0: current_line += "--" else: if c == len(self.board[0]) - 1: current_line += "|" else: current_line += "| " elif self.board[r][c] == " ": current_line += " " elif self.board[r][c] == "?": if c == len(self.board[0]) - 1: current_line += "+" elif self.board[r][c + 1] == " ": current_line += "+ " elif self.board[r][c + 1] == "#": current_line += "+-" elif self.board[r][c] == self.start_char: current_line += (self.start_char + " ") elif self.board[r][c] == self.end_char: current_line += (self.end_char + " ") new_file.write(current_line + "\n") new_file.close() def clear(self): self.board = Board.Builder.empty(self.player).board return self def append_row(self, cols): row = [] for c in range(cols): row.append(" ") self.board.append(row) return self def set(self, x, y, what): self.board[y][x] = what return self def width(self): return len(self.board[0]) def height(self): return len(self.board) @staticmethod def build_empty_board(rows, cols): """ :param rows: The # of rows (int) for the array :param cols: The # of columns (int) for the array :return: A new empty array with the given rows and columns """ new_board = [] for r in range(rows): row = [] for c in range(cols): row.append(" ") new_board.append(row) return new_board def fill_borders(self): """ Fills outer walls with #?#?#? pattern and fills corners with ?""" for r in range(len(self.board)): # Fills outer columns with ?#?#?# pattern if r % 2 == 0: self.board[r][0] = "?" self.board[r][len(self.board[0]) - 1] = "?" else: self.board[r][0] = "#" self.board[r][len(self.board[0]) - 1] = "#" for c in range(len(self.board[0])): # Fills outers rows with ?#?#?# pattern if c % 2 == 0: self.board[0][c] = "?" self.board[len(self.board) - 1][c] = "?" else: self.board[0][c] = "#" self.board[len(self.board) - 1][c] = "#" for r in range(len(self.board)): for c in range(len(self.board[0])): if r % 2 == 0 and c % 2 == 0: self.board[r][c] = "?" def validate(self): """ :return: None if no exceptions are raised, exceptions make sure the board fit all needed criteria """ if self.width() < self.min_array_size or self.height() < self.min_array_size: # Board too small raise InvalidBoardException("Board too small") for r in range(len(self.board)): # Checking if outer wall columns follow ?#?#?# pattern if r % 2 == 0: if not (self.board[r][0] == "?" and self.board[r][len(self.board[0]) - 1] == "?"): raise InvalidBoardException("Invalid outer columns") else: if not (self.board[r][0] == "#" and self.board[r][len(self.board[0]) - 1] == "#"): raise InvalidBoardException("Invalid outer columns") for c in range(len(self.board[0])): # Checking if outer wall rows follow ?#?#?# pattern if c % 2 == 0: if not (self.board[0][c] == "?" and self.board[len(self.board) - 1][c] == "?"): raise InvalidBoardException("Invalid outer rows") else: if not (self.board[0][c] == "#" and self.board[len(self.board) - 1][c] == "#"): raise InvalidBoardException("Invalid outer rows") for r in range(len(self.board)): for c in range(len(self.board[0])): tile = self.board[r][c] if tile == "#" and (r + c) % 2 == 0: # Wall is not placed on edge raise InvalidBoardException("Invalid wall placement") if tile == "?" and not (r % 2 == 0 or c % 2 == 0): # Corner is not placed on corner raise InvalidBoardException("Invalid corner placement") def build(self): """ :return: A new Board object using the map created by the Builder """ self.validate() return Board(magic_create_key, self.board, self.player) def __init__(self, magic, board, player): """ :param magic: A key that prevents a Board object to be created without the Builder :param board: The 2D board array to be built and edited """ if magic != magic_create_key: raise Exception("Can't create directly") self.board = board self.player = player if self.player == 1: self.start_char = "A" self.end_char = "B" else: self.start_char = "a" self.end_char = "b" def set(self, x, y, what): """ :param x: The x index of the array (different from cols) :param y: The y index of the array (different from rows) :param what: The string value to be written """ self.board[y][x] = what def get(self, x, y): return self.board[y][x] def get_start_pos(self): for r in range(len(self.board)): for c in range(len(self.board[0])): if self.board[r][c] == self.start_char: return {'x': c, 'y': r} def get_end_pos(self): for r in range(len(self.board)): for c in range(len(self.board[0])): if self.board[r][c] == self.end_char: return {'x': c, 'y': r} def width(self): return len(self.board[0]) def height(self): return len(self.board) def print(self): """ Prints the board, row by row :return: The array output of the print, to test the value of in board_test """ output = [] for r in range(len(self.board)): print(self.board[r]) output.append(self.board[r]) return output def get_num_walls(self, i=None): if i is None: i = self.board if self.player == 1: wall = "-" else: wall = "|" count = 0 for r in range(len(i)): for c in range(len(i[0])): if i[r][c] == wall: count += 1 return count def get_changes(self, old_board): old_walls = self.get_num_walls(old_board) new_walls = self.get_num_walls() num_changes = (new_walls-old_walls) for r in range(len(self.board)): for c in range(len(self.board[0])): if self.board[r][c] != old_board[r][c]: num_changes += 1 return int(num_changes/2) class InvalidBoardException(Exception): def __init__(self, why): self.why = why
""" Author: CaptCorpMURICA Project: 100DaysPython File: module1_day13_continueBreak.py Creation Date: 6/2/2019, 8:55 AM Description: Learn about continue/break operations in python. """ # Print only consonants from a given text. motivation = "Over? Did you say 'over'? Nothing is over until we decide it is! Was it over when the Germans bombed " \ "Pearl Harbor? Hell no! And it ain't over now. 'Cause when the goin' gets tough...the tough get goin'! " \ "Who's with me? Let's go!" output = "" for letter in motivation: if letter.lower() in 'bcdfghjklmnpqrstvwxyz': output += letter print(output) # However, this example can also be completed by using a continue action. If the condition is met, then the continue # advances the program to the next stage. motivation = "Over? Did you say 'over'? Nothing is over until we decide it is! Was it over when the Germans bombed " \ "Pearl Harbor? Hell no! And it ain't over now. 'Cause when the goin' gets tough...the tough get goin'! " \ "Who's with me? Let's go!" output = "" for letter in motivation: if letter.lower() not in 'bcdfghjklmnpqrstvwxyz': continue else: output += letter print(output) # Conversely, the break action halts the program when the condition is met. For instance, what if we wanted to display # all of the letters until the first instance of a non-letter? A `break` can be used to end the loop once the condition # is met. _Type and execute:_ motivation = "Over? Did you say 'over'? Nothing is over until we decide it is! Was it over when the Germans bombed " \ "Pearl Harbor? Hell no! And it ain't over now. 'Cause when the goin' gets tough...the tough get goin'! " \ "Who's with me? Let's go!" output = "" for letter in motivation: if letter.lower() not in 'abcdefghijklmnopqrstuvwxyz': output += letter else: break print(output)
def find_unique_and_common(line_1, line_2): print("\n".join(map(str, set(line_1) & set(line_2)))) line_1_count, line_2_count = map(int, input().split()) line_1 = [int(input()) for _ in range(line_1_count)] line_2 = [int(input()) for _ in range(line_2_count)] find_unique_and_common(line_1, line_2)
protos = { 0:"HOPOPT", 1:"ICMP", 2:"IGMP", 3:"GGP", 4:"IPv4", 5:"ST", 6:"TCP", 7:"CBT", 8:"EGP", 9:"IGP", 10:"BBN-RCC-MON", 11:"NVP-II", 12:"PUP", 13:"ARGUS", 14:"EMCON", 15:"XNET", 16:"CHAOS", 17:"UDP", 18:"MUX", 19:"DCN-MEAS", 20:"HMP", 21:"PRM", 22:"XNS-IDP", 23:"TRUNK-1", 24:"TRUNK-2", 25:"LEAF-1", 26:"LEAF-2", 27:"RDP", 28:"IRTP", 29:"ISO-TP4", 30:"NETBLT", 31:"MFE-NSP", 32:"MERIT-INP", 33:"DCCP", 34:"3PC", 35:"IDPR", 36:"XTP", 37:"DDP", 38:"IDPR-CMTP", 39:"TP++", 40:"IL", 41:"IPv6", 42:"SDRP", 43:"IPv6-Route", 44:"IPv6-Frag", 45:"IDRP", 46:"RSVP", 47:"GRE", 48:"DSR", 49:"BNA", 50:"ESP", 51:"AH", 52:"I-NLSP", 53:"SWIPE", 54:"NARP", 55:"MOBILE", 56:"TLSP", 57:"SKIP", 58:"IPv6-ICMP", 59:"IPv6-NoNxt", 60:"IPv6-Opts", 61:"Host-interal", 62:"CFTP", 63:"Local Network", 64:"SAT-EXPAK", 65:"KRYPTOLAN", 66:"RVD", 67:"IPPC", 68:"Dist-FS", 69:"SAT-MON", 70:"VISA", 71:"IPCV", 72:"CPNX", 73:"CPHB", 74:"WSN", 75:"PVP", 76:"BR-SAT-MON", 77:"SUN-ND", 78:"WB-MON", 79:"WB-EXPAK", 80:"ISO-IP", 81:"VMTP", 82:"SECURE-VMTP", 83:"VINES", 84:"TTP", 84:"IPTM", 85:"NSFNET-IGP", 86:"DGP", 87:"TCF", 88:"EIGRP", 89:"OSPFIGP", 90:"Sprite-RPC", 91:"LARP", 92:"MTP", 93:"AX.25", 94:"IPIP", 95:"MICP", 96:"SCC-SP", 97:"ETHERIP", 98:"ENCAP", 99:"Encryption", 100:"GMTP", 101:"IFMP", 102:"PNNI", 103:"PIM", 104:"ARIS", 105:"SCPS", 106:"QNX", 107:"A/N", 108:"IPComp", 109:"SNP", 110:"Compaq-Peer", 111:"IPX-in-IP", 112:"VRRP", 113:"PGM", 114:"0-hop", 115:"L2TP", 116:"DDX", 117:"IATP", 118:"STP", 119:"SRP", 120:"UTI", 121:"SMP", 122:"SM", 123:"PTP", 124:"ISIS over IPv4", 125:"FIRE", 126:"CRTP", 127:"CRUDP", 128:"SSCOPMCE", 129:"IPLT", 130:"SPS", 131:"PIPE", 132:"SCTP", 133:"FC", 134:"RSVP-E2E-IGNORE", 135:"Mobility Header", 136:"UDPLite", 137:"MPLS-in-IP", 138:"manet", 139:"HIP", 140:"Shim6", 141:"WESP", 142:"ROHC", 143:"Unassigned", 144:"Unassigned", 145:"Unassigned", 146:"Unassigned", 147:"Unassigned", 148:"Unassigned", 149:"Unassigned", 150:"Unassigned", 151:"Unassigned", 152:"Unassigned", 153:"Unassigned", 154:"Unassigned", 155:"Unassigned", 156:"Unassigned", 157:"Unassigned", 158:"Unassigned", 159:"Unassigned", 160:"Unassigned", 161:"Unassigned", 162:"Unassigned", 163:"Unassigned", 164:"Unassigned", 165:"Unassigned", 166:"Unassigned", 167:"Unassigned", 168:"Unassigned", 169:"Unassigned", 170:"Unassigned", 171:"Unassigned", 172:"Unassigned", 173:"Unassigned", 174:"Unassigned", 175:"Unassigned", 176:"Unassigned", 177:"Unassigned", 178:"Unassigned", 179:"Unassigned", 180:"Unassigned", 181:"Unassigned", 182:"Unassigned", 183:"Unassigned", 184:"Unassigned", 185:"Unassigned", 186:"Unassigned", 187:"Unassigned", 188:"Unassigned", 189:"Unassigned", 190:"Unassigned", 191:"Unassigned", 192:"Unassigned", 193:"Unassigned", 194:"Unassigned", 195:"Unassigned", 196:"Unassigned", 197:"Unassigned", 198:"Unassigned", 199:"Unassigned", 200:"Unassigned", 201:"Unassigned", 202:"Unassigned", 203:"Unassigned", 204:"Unassigned", 205:"Unassigned", 206:"Unassigned", 207:"Unassigned", 208:"Unassigned", 209:"Unassigned", 210:"Unassigned", 211:"Unassigned", 212:"Unassigned", 213:"Unassigned", 214:"Unassigned", 215:"Unassigned", 216:"Unassigned", 217:"Unassigned", 218:"Unassigned", 219:"Unassigned", 220:"Unassigned", 221:"Unassigned", 222:"Unassigned", 223:"Unassigned", 224:"Unassigned", 225:"Unassigned", 226:"Unassigned", 227:"Unassigned", 228:"Unassigned", 229:"Unassigned", 230:"Unassigned", 231:"Unassigned", 232:"Unassigned", 233:"Unassigned", 234:"Unassigned", 235:"Unassigned", 236:"Unassigned", 237:"Unassigned", 238:"Unassigned", 239:"Unassigned", 240:"Unassigned", 241:"Unassigned", 242:"Unassigned", 243:"Unassigned", 244:"Unassigned", 245:"Unassigned", 246:"Unassigned", 247:"Unassigned", 248:"Unassigned", 249:"Unassigned", 250:"Unassigned", 251:"Unassigned", 252:"Unassigned", 253:"Experimental", 254:"Experimental", 255:"Reserved", }
print("-"*30) nome = input("Nome do Jogador: ").strip() gols = input("NUmero de gols: ").strip() def ficha(nome,gols): if gols.isnumeric(): if nome == '': return f'O jogador <desconhecido> fez {gols} gols(s) no campeaonato' else: return f'O jogador {nome} fez {gols} gol(s) no campeonato' else: if nome == '': return f'O jogador <desconhecido> fez 0 gol(s) no campeaonato' else: return f'O jogador {nome} fez 0 gol(s) no campeonato' print(ficha(nome,gols))
def change(fname, round): with open ("renamed_{}".format(fname), "w+") as new: with open(fname, "r") as old: for file in old: id = old.split("_")[0]
#Nilo soluction arquivo = open('mobydick.txt', 'r') texto = arquivo.readlines()[:] tam = len(texto) dicionario = dict() lista = list() clinha = 1 coluna = 1 for linha in texto: linha = linha.strip().lower() palavras = linha.split() for p in palavras: if p == '': coluna += 1 if p in dicionario: dicionario[p].append((clinha, coluna)) else: dicionario[p] = [clinha, coluna] coluna += len(p)+1 clinha += 1 coluna = 1 for k, v in dicionario.items(): print(f'{k} = {v}') arquivo.close()
#Write a program that accepts as input a sequence of integers (one by #one) and then incrementally builds, and displays, a Binary Search Tree #(BST). There is no need to balance the BST. class Node: def __init__(self, number = None): self.number = number self.left = None self.right = None def new_node(self, number): if(self.number is None): self.number = number else: if(number > self.number): if(self.right is None): self.right = Node(number) #Creates the right side as a new node if doesn't already exist else: self.right.new_node(number) elif(number < self.number): if(self.left is None): self.left = Node(number) #Creates the left side as a new node if doesn't already exist else: self.left.new_node(number) class Tree: def __init__(self): self.root = None def print_tree(self, currentNode): if(currentNode is not None): if(currentNode.left is not None): self.print_tree(currentNode.left) print(currentNode.number) if(currentNode.right is not None): self.print_tree(currentNode.right) else: print("An error has occured") def new_node(self, number): #This is needed to use the node's functions without making it a subclass if(self.root is None): self.root = Node(number) #Creates new node for root else: self.root.new_node(number) seq = [10, 5, 1, 7, 40, 50] bst = Tree() for i in seq: bst.new_node(i) #Builds binary search tree bst.print_tree(bst.root)
def catAndMouse(x, y, z): if abs(x - z) == abs(y - z): return "Mouse C" if abs(x - z) > abs(y - z): return "Cat B" return "Cat A"
def unboundedKnapsack(maxWeight, numberItems, value, weight): totValue = [0]*(maxWeight+1) for i in range(maxWeight + 1): for j in range(numberItems): if (weight[j] <= i): totValue[i] = max( totValue[i], totValue[i - weight[j]] + value[j]) # print(i,totValue[i]) return totValue[maxWeight] maxWeight = 10 value = [9, 14, 16, 30] weight = [2, 3, 4, 6] numberItems = len(value) print(unboundedKnapsack(maxWeight, numberItems, value, weight))
class OtypeFeature(object): def __init__(self, api, metaData, data): self.api = api self.meta = metaData self.data = data[0] self.maxSlot = data[1] self.maxNode = data[2] self.slotType = data[3] self.all = None def items(self): slotType = self.slotType maxSlot = self.maxSlot data = self.data for n in range(1, maxSlot + 1): yield (n, slotType) maxNode = self.maxNode shift = maxSlot + 1 for n in range(maxSlot + 1, maxNode + 1): yield (n, data[n - shift]) def v(self, n): if n == 0: return None if n < self.maxSlot + 1: return self.slotType m = n - self.maxSlot if m <= len(self.data): return self.data[m - 1] return None def s(self, val): # NB: the support attribute has been added by precomputing __levels__ if val in self.support: (b, e) = self.support[val] return range(b, e + 1) else: return () def sInterval(self, val): # NB: the support attribute has been added by precomputing __levels__ if val in self.support: return self.support[val] else: return ()
""" 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? """ def Euler005(n): """Solution of fifth Euler problem.""" found = True number = 0 while found: i = 1 number += n while number % i == 0 and i <= n: if i == n: found = False i += 1 return number
''' This file contains the definitions of the DIAG chains used to load the microcode onto the various boards ''' ####################################################################### # Microcode is loaded by the 8051 on each board, by feeding a byte # at time to several serial-to-parallel registers. # The structures below have 8 lists, one for each bit in the byte # each listing the 8 signals appearing on the parallel outputs. # # The four field values are: # Name on the drawing # python member name # bit goes at (1 << this_field) # invert bit # # Fields starting with 'x' are asserted to be zero. ####################################################################### # The chain for the Decode RAMs is documented at: # [30000958] R1000_SCHEMATIC_SEQ.PDF p56 # # UADR.DEC0 and DEC8 are very hard to tell apart, but I think # the current assignment is most probable, because it gives the # layout of DECD60 a nice symmetry: # # -------- # - 1 20 - # - 2 19 - # - 3 18 - # DEC10 - 4 17 - # DEC7 - 5 16 - DEC11 # DEC4 - 6 15 - DEC8 # DEC0 - 7 14 - DEC5 # - 8 13 - DEC1 # - 9 12 - # - 10 11 - # -------- # # Note that UADR.DEC is only supplies 13 out of the 14 WCS address bits # SEQ_DECODER_SCAN = [ [ # DIAG.D0 = DECD60 E16 @p56 ("UADR.DEC0", "uadr", 13, 0), ("UADR.DEC1", "uadr", 12, 0), ("UADR.DEC4", "uadr", 9, 0), ("UADR.DEC5", "uadr", 8, 0), ("UADR.DEC7", "uadr", 6, 0), ("UADR.DEC8", "uadr", 5, 0), ("UADR.DEC10", "uadr", 3, 0), ("UADR.DEC11", "uadr", 2, 0), ], [ # DIAG.D1 = DECD61 E18 @p56 ("UADR.DEC2", "uadr", 11, 0), ("UADR.DEC3", "uadr", 10, 0), ("UADR.DEC6", "uadr", 7, 0), ("UADR.DEC9", "uadr", 4, 0), ("UADR.DEC12", "uadr", 1, 0), ("DECODER.PARITY", "parity", 0, 0), ("USES_TOS.DEC", "uses_tos", 0, 0), ("IBUFF_FILL~.DEC", "ibuff_fill", 0, 1), ], [ # DIAG.D2 = DECD62 H17 @p56 ("", "ignore", 0, 0), ("", "x21", 1, 0), ("", "x22", 2, 0), ("CSA_VALID.DEC0", "csa_valid", 2, 0), ("CSA_VALID.DEC1", "csa_valid", 1, 0), ("CSA_VALID.DEC2", "csa_valid", 0, 0), ("CSA_FREE.DEC0", "csa_free", 1, 0), ("CSA_FREE.DEC1", "csa_free", 0, 0), ], [ # DIAG.D3 = DECD63 I17 @p56 ("", "x30", 0, 0), ("MEM_STRT.DEC0", "mem_strt", 2, 0), ("MEM_STRT.DEC1", "mem_strt", 1, 0), ("MEM_STRT.DEC2", "mem_strt", 0, 0), ("CUR_CLASS0", "cur_class", 3, 0), ("CUR_CLASS1", "cur_class", 2, 0), ("CUR_CLASS2", "cur_class", 1, 0), ("CUR_CLASS3", "cur_class", 0, 0), ],[ ("", "x40", 0, 0), ("", "x41", 1, 0), ("", "x42", 2, 0), ("", "x43", 3, 0), ("", "x44", 4, 0), ("", "x45", 5, 0), ("", "x46", 6, 0), ("", "x47", 7, 0), ],[ ("", "x50", 0, 0), ("", "x51", 1, 0), ("", "x52", 2, 0), ("", "x53", 3, 0), ("", "x54", 4, 0), ("", "x55", 5, 0), ("", "x56", 6, 0), ("", "x57", 7, 0), ],[ ("", "x60", 0, 0), ("", "x61", 1, 0), ("", "x62", 2, 0), ("", "x63", 3, 0), ("", "x64", 4, 0), ("", "x65", 5, 0), ("", "x66", 6, 0), ("", "x67", 7, 0), ],[ ("", "x70", 0, 0), ("", "x71", 1, 0), ("", "x72", 2, 0), ("", "x73", 3, 0), ("", "x74", 4, 0), ("", "x75", 5, 0), ("", "x76", 6, 0), ("", "x77", 7, 0), ] ] ####################################################################### # https://datamuseum.dk/bits/30000958 R1000_SCHEMATIC_SEQ.PDF # # p3: # brnch_adr.uir<0:13> # parity.uir # latch.uir # br_type.uir<0:3> # b_timing.uir<0:1 # cond_sel.uir<0:6> # halt # l_late_macro # lex_adr.uir<0:1> # en_micro.uir # int_reads.uir<0:2> # random.uir<0:6> # p97: # UIR scan chain # SEQ_UIR_SCAN_CHAIN = [ [ # DIAG.D0 = UIR0+UIR1 L21+L23 @ p80 ("BRNCH_ADR.UIR13", "branch_adr", 0, 0), ("BRNCH_ADR.UIR12", "branch_adr", 1, 0), ("BRNCH_ADR.UIR11", "branch_adr", 2, 0), ("BRNCH_ADR.UIR10", "branch_adr", 3, 0), ("BRNCH_ADR.UIR9", "branch_adr", 4, 0), ("BRNCH_ADR.UIR8", "branch_adr", 5, 0), ("BRNCH_ADR.UIR7", "branch_adr", 6, 0), ("BRNCH_ADR.UIR6", "branch_adr", 7, 0), ],[ # DIAG.D1 = UIR2+UIR3 L25+L29 @ p80 ("BRNCH_ADR.UIR5", "branch_adr", 8, 0), ("BRNCH_ADR.UIR4", "branch_adr", 9, 0), ("BRNCH_ADR.UIR3", "branch_adr", 10, 0), ("BRNCH_ADR.UIR2", "branch_adr", 11, 0), ("BRNCH_ADR.UIR1", "branch_adr", 12, 0), ("BRNCH_ADR.UIR0", "branch_adr", 13, 0), ("COND_SEL.UIR~6", "cond_sel", 0, 1), ("COND_SEL.UIR~5", "cond_sel", 1, 1), ],[ # DIAG.D2 = UIR4+UIR5 I29+I31 @ p80 ("COND_SEL.UIR~2", "cond_sel", 4, 1), ("COND_SEL.UIR~3", "cond_sel", 3, 1), ("COND_SEL.UIR~4", "cond_sel", 2, 1), ("COND_SEL.UIR~1", "cond_sel", 5, 1), ("COND_SEL.UIR~0", "cond_sel", 6, 1), ("BR_TYPE.UIR0", "br_type", 3, 0), ("BR_TYPE.UIR1", "br_type", 2, 0), ("LATCH.UIR", "latch", 0, 0), ],[ # DIAG.D3 = UIR6+UIR7 I33+I35 @ p80 ("INT_READS.UIR0", "int_reads", 2, 0), ("B_TIMING.UIR0", "b_timing", 1, 0), ("B_TIMING.UIR1", "b_timing", 0, 0), ("EN_MICRO.UIR", "en_micro", 0, 0), ("BR_TYPE.UIR2", "br_type", 1, 0), ("BR_TYPE.UIR3", "br_type", 0, 0), ("INT_READS.UIR1", "int_reads", 1, 0), ("INT_READS.UIR2", "int_reads", 0, 0), ],[ # DIAG.D4 - unused ("", "x40", 0, 0), ("", "x41", 1, 0), ("", "x42", 2, 0), ("", "x43", 3, 0), ("", "x44", 4, 0), ("", "x45", 5, 0), ("", "x46", 6, 0), ("", "x40", 7, 0), ],[ # DIAG.D5 = UIR8+UIR9 I37+I39 @ p80 ("LEX_ADR.UIR0", "lex_adr", 1, 0), ("LEX_ADR.UIR1", "lex_adr", 0, 0), ("PARITY.UIR", "parity", 0, 0), ("RANDOM.UIR6", "random", 0, 0), ("RANDOM.UIR4", "random", 2, 0), ("RANDOM.UIR5", "random", 1, 0), ("RANDOM.UIR2", "random", 4, 0), ("RANDOM.UIR3", "random", 3, 0), ],[ # DIAG.D6 = UIRA I41 @ p80 ("RANDOM.UIR0", "random", 6, 0), ("RANDOM.UIR1", "random", 5, 0), ("", "x62", 2, 0), ("", "x63", 3, 0), ("", "x64", 4, 0), ("", "x65", 5, 0), ("", "x66", 6, 0), ("", "x67", 7, 0), ],[ # DIAG.D7 - unused ("", "x70", 0, 0), ("", "x71", 1, 0), ("", "x72", 2, 0), ("", "x73", 3, 0), ("", "x74", 4, 0), ("", "x75", 5, 0), ("", "x76", 6, 0), ("", "x77", 7, 0), ] ] ####################################################################### # https://datamuseum.dk/bits/30000957 R1000_SCHEMATIC_FIU.PDF # p8: # offs_lit<0:6> *L-14...L-20 # lfl<0:6> *L21,L6..L11 # o_reg_src *L4 # fill_mode_src *L5 # vmux_sel<0:1> *L24,L25 # op_select<0:1> *L22,L23 # lfreg_cntl<0:1> *L12,L13 # ti_vi_source<0:3> *L35...L38 # load_oreg *L39 # load_var *L41 # load_tar *L40 # load_mdr *L42 # mem_start<0:4> *L28...L32 # rdata_bus_src *L33 # parity *L34 # length_source L26 # offset_source L27 # p49: # OFFS_LIT<0:6> # LFL<0:6> # LFREG_CNTL<0:1> # OFFS_SRC # LENGTH_SRC # FILL_MODE_SRC # OREG_SRC # OP_SEL<0:1> # VMUX_SEL<0:1> # MEM_START<0:4> # RDATA_SRC # UIR.P # TIVI_SRC<0:3> # LOAD_OREG~ # LOAD_VAR~ # LOAD_TAR~ # LOAD_MDR~ # FIU_MICRO_INSTRUCTION_REGISTER = [ [ # DIAG.D0 = UIR0+UIR1 J18+J19 @ p48 ("OFFS_LIT0", "offs_lit", 6, 0), ("OFFS_LIT1", "offs_lit", 5, 0), ("OFFS_LIT2", "offs_lit", 4, 0), ("OFFS_LIT3", "offs_lit", 3, 0), ("OFFS_LIT4", "offs_lit", 2, 0), ("OFFS_LIT5", "offs_lit", 1, 0), ("OFFS_LIT6", "offs_lit", 0, 0), ("LFL0", "len_fill_lit", 6, 0), ], [ # DIAG.D1 = UIR2+UIR3 K12+K16 @ p48 ("LFL1", "len_fill_lit", 5, 0), ("LFL2", "len_fill_lit", 4, 0), ("LFL3", "len_fill_lit", 3, 0), ("LFL4", "len_fill_lit", 2, 0), ("LFL5", "len_fill_lit", 1, 0), ("LFL6", "len_fill_lit", 0, 0), ("LFREG_CNTL0", "len_fill_reg_ctl", 1, 0), ("LFREG_CNTL1", "len_fill_reg_ctl", 0, 0), ], [ # DIAG.D2 = URI4+UIR5 H20+M3 @ p48 ("OP_SEL0", "op_sel", 1, 0), ("OP_SEL1", "op_sel", 0, 0), ("VMUX_SEL0", "vmux_sel", 1, 0), ("VMUX_SEL1", "vmux_sel", 0, 0), ("FILL_MODE_SRC", "fill_mode_src", 0, 0), ("OREG_SRC", "oreg_src", 0, 0), ("", "x26", 6, 0), ("", "x27", 6, 0), ], [ # DIAG.D3 = UIR6+UIR7 K43+K47 @ p48 ("TIVI_SRC0", "tivi_src", 3, 0), ("TIVI_SRC1", "tivi_src", 2, 0), ("TIVI_SRC2", "tivi_src", 1, 0), ("TIVI_SRC3", "tivi_src", 0, 0), ("LOAD_OREG~", "load_oreg", 0, 1), ("LOAD_VAR~", "load_var", 0, 1), ("LOAD_TAR~", "load_tar", 0, 1), ("LOAD_MDR", "load_mdr", 0, 0), ], [ # DIAG.D4 = UIR8+UIR9 M35+M39 @ p48 ("MEM_START0", "mem_start", 4, 0), ("MEM_START1", "mem_start", 3, 0), ("MEM_START2", "mem_start", 2, 0), ("MEM_START3", "mem_start", 1, 0), ("MEM_START4", "mem_start", 0, 0), ("RDATA_SRC", "rdata_src", 0, 0), ("", "x46", 6, 0), ("UIR.P", "parity", 0, 0), ], [ # DIAG.D5 = UIRMX0+UIRFFA/B K20 + J25 @p48 ("OFFS_SRC", "offset_src", 0, 0), ("LENGTH_SRC", "length_src", 0, 0), ("", "x52", 2, 0), ("", "x53", 3, 0), ("", "x54", 4, 0), ("", "x55", 5, 0), ("", "x56", 6, 0), ("", "x57", 7, 0), ], [ # DIAG.D6 - unused (overlaid by IOC) ("", "x60", 0, 0), ("", "x61", 1, 0), ("", "x62", 2, 0), ("", "x63", 3, 0), ("", "x64", 4, 0), ("", "x65", 5, 0), ("", "x66", 6, 0), ("", "x67", 7, 0), ], [ # DIAG.D7 - unused (overlaid by IOC) ("", "x70", 0, 0), ("", "x71", 1, 0), ("", "x72", 2, 0), ("", "x73", 3, 0), ("", "x74", 4, 0), ("", "x75", 5, 0), ("", "x76", 6, 0), ("", "x77", 7, 0), ] ] ####################################################################### # https://datamuseum.dk/bits/30000959 R1000_SCHEMATIC_TYP.PDF # p3: # uir.a<0:5> *L23,L24,L25,L26,L27,L28 # uir.b<0:5> *L29,L30,L31,L32,L33,L34 # uir.frame<0:4> *L35,L36,L37,L38,L39 # c_lit~<0:1> *I18,I19 # uir.p *I20 # uir.rand_<0:3> *K19,J20,J19,J18 # uir.c<0:5> *K25,K24,K23,K22,J25,J24 # uir.prv_chk0 *J23 # uir.prv_chk1 *J22 # uir.prv_ch[k2] *I25 # c_mux.sel *I24 # uir.alu_func<0:4> *I23,I22,I21,J21,K21 # uir.c_source *K20 # mar_cntl_<0:3> *I17,I16,I15,I14 # csa_cntl_<0:2> *L16,L15,L14 # TYP_WRITE_DATA_REGISTER = [ [ # DIAG.D8 = K27+K30 @p63 # Inverted because DIAG.D8 is non-inverted input # to inverting mux K27 ("UIR.A0", "a_adr", 5, 1), ("UIR.A1", "a_adr", 4, 1), ("UIR.A2", "a_adr", 3, 1), ("UIR.A3", "a_adr", 2, 1), ("UIR.A4", "a_adr", 1, 1), ("UIR.A5", "a_adr", 0, 1), ("UIR.B0", "b_adr", 5, 1), ("UIR.B1", "b_adr", 4, 1), ], [ # DIAG.D9 = K33+K36 @p63 # Inverted because DIAG.D9 is non-inverted input # to inverting mux K30 ("UIR.B2", "b_adr", 3, 1), ("UIR.B3", "b_adr", 2, 1), ("UIR.B4", "b_adr", 1, 1), ("UIR.B5", "b_adr", 0, 1), ("UIR.FRAME0", "frame", 4, 1), ("UIR.FRAME1", "frame", 3, 1), ("UIR.FRAME2", "frame", 2, 1), ("UIR.FRAME3", "frame", 1, 1), ], [ # DIAG.D10 = K43 @p63 + J17+J16 @ p64 # Note that pin 2 on J17 says C_LIT~4 # That must be a mistake for UIR.FRAME4 # Compare with VAL schematic. ("UIR.FRAME4", "frame", 0, 0), ("UIR.C_LIT~0", 'c_lit', 1, 1), ("UIR.C_LIT~1", 'c_lit', 0, 1), ("UIR.P", 'parity', 0, 0), ("UIR.RAND0", 'rand', 3, 0), ("UIR.RAND1", 'rand', 2, 0), ("UIR.RAND2", 'rand', 1, 0), ("UIR.RAND3", 'rand', 0, 0), ], [ # DIAG.D11 = K26+J26 @p64 ("UIR.C0", 'c_adr', 5, 0), ("UIR.C1", 'c_adr', 4, 0), ("UIR.C2", 'c_adr', 3, 0), ("UIR.C3", 'c_adr', 2, 0), ("UIR.C4", 'c_adr', 1, 0), ("UIR.C5", 'c_adr', 0, 0), ("UIR.PRIV_CHEK0", 'priv_check', 2, 0), ("UIR.PRIV_CHEK1", 'priv_check', 1, 0), ], [ # DIAG.D12 = H23+H21 @p64 ("UIR.PRIV.CHEK2", 'priv_check', 0, 0), ("C_MUX.SEL", 'c_mux_sel', 0, 0), ("UIR.ALU_FUNC0", 'alu_func', 4, 0), ("UIR.ALU_FUNC1", 'alu_func', 3, 0), ("UIR.ALU_FUNC2", 'alu_func', 2, 0), ("UIR.ALU_FUNC3", 'alu_func', 1, 0), ("UIR.ALU_FUNC4", 'alu_func', 0, 0), ("UIR.C_SOURCE", 'c_source', 0, 0), ], [ # DIAG.D13 = I13+L13 @p65 ("MAR_CNTL0", 'mar_cntl', 3, 0), ("MAR_CNTL1", 'mar_cntl', 2, 0), ("MAR_CNTL2", 'mar_cntl', 1, 0), ("MAR_CNTL3", 'mar_cntl', 0, 0), ("CSA_CNTL0", 'csa_cntl', 2, 0), ("CSA_CNTL1", 'csa_cntl', 1, 0), ("CSA_CNTL2", 'csa_cntl', 0, 0), ("", 'x57', 7, 0), ], [ ("", 'x60', 0, 0), ("", 'x61', 1, 0), ("", 'x62', 2, 0), ("", 'x63', 3, 0), ("", 'x64', 4, 0), ("", 'x65', 5, 0), ("", 'x66', 6, 0), ("", 'x67', 7, 0), ], [ ("", 'x70', 0, 0), ("", 'x71', 1, 0), ("", 'x72', 2, 0), ("", 'x73', 3, 0), ("", 'x74', 4, 0), ("", 'x75', 5, 0), ("", 'x76', 6, 0), ("", 'x77', 7, 0), ], ] ####################################################################### # https://datamuseum.dk/bits/30000960 R1000_SCHEMATIC_VAL.PDF # p3: # uir.a_<0:5> *L23,L24,L25,L26,L27,L28 # uir.b_<0:5> *L29,L30,L31,L32,L33,L34 # uir.c_<0:5> *K25,K24,K23,K22,J25,J24 # uir.frame_<0:4> *L35,L36,L37,L38,L39 # c_mux.sel_<0:1> *I18,I19 # uir.rand_<0:3> *K19,J20,J19,J18 # uir.m_a_src_<0:1> *J23,J22 # uir.m_b_src_<0:1> *I25,I24 # uir.alu_func<0:4> *I23,I22,I21,J21,K21 # uir.c_source *K20 # uir.p(arity) *I20 # p65: parity check # c_mux_sel1 # uir.rand_<0:3> # uir.a_<0:5> # uir.b_<0:5> # uir.c_<0:5> # uir.c_source # uir.frame_<0:4> # uir.alu_func_<0:4> # uir.a_src<0:1> # uir.b_src<0:1> # uir.p<0:1> # uir.c_mux_sel0 # p66: # DIAG.D<11:12> # p67: # DIAG.D<8:10> VAL_WRITE_DATA_REGISTER = [ [ # DIAG.D8 = K27 + K30 @ p66 # Inverted because DIAG.D8 is non-inverted input # to inverting mux K27 ("UIR.A0", 'a_adr', 5, 1), ("UIR.A1", 'a_adr', 4, 1), ("UIR.A2", 'a_adr', 3, 1), ("UIR.A3", 'a_adr', 2, 1), ("UIR.A4", 'a_adr', 1, 1), ("UIR.A5", 'a_adr', 0, 1), ("UIR.B0", 'b_adr', 5, 1), ("UIR.B1", 'b_adr', 4, 1), ], [ # DIAG.D9 = K33 + K36 @ p66 # Inverted because DIAG.D9 is non-inverted input # to inverting mux K33 ("UIR.B2", 'b_adr', 3, 1), ("UIR.B3", 'b_adr', 2, 1), ("UIR.B4", 'b_adr', 1, 1), ("UIR.B5", 'b_adr', 0, 1), ("FRAME.0", 'frame', 4, 1), ("FRAME.1", 'frame', 3, 1), ("FRAME.2", 'frame', 2, 1), ("FRAME.3", 'frame', 1, 1), ], [ # DIAG.D10 = K43 @p66, J16 @p67 ("FRAME.4", 'frame', 0, 0), ("C_MUX.SEL0", 'c_mux_sel', 1, 1), ("C_MUX.SEL1", 'c_mux_sel', 0, 1), ("UIR.P", 'parity', 0, 0), ("UIR.RAND0", 'rand', 3, 1), ("UIR.RAND1", 'rand', 2, 1), ("UIR.RAND2", 'rand', 1, 1), ("UIR.RAND3", 'rand', 0, 1), ], [ # DIAG.D11 = K26 + J26 @ p67 ("UIR.C0", 'c_adr', 5, 0), ("UIR.C1", 'c_adr', 4, 0), ("UIR.C2", 'c_adr', 3, 0), ("UIR.C3", 'c_adr', 2, 0), ("UIR.C4", 'c_adr', 1, 0), ("UIR.C5", 'c_adr', 0, 0), ("UIR.M_A_SRC0", 'm_a_src', 1, 0), ("UIR.M_A_SRC1", 'm_a_src', 0, 0), ], [ # DIAG.D12 = H23+H21 @ p67 ("UIR.M_B_SRC0", 'm_b_src', 1, 0), ("UIR.M_B_SRC1", 'm_b_src', 0, 0), ("UIR.ALU_FUNC0", 'alu_func', 4, 0), ("UIR.ALU_FUNC1", 'alu_func', 3, 0), ("UIR.ALU_FUNC2", 'alu_func', 2, 0), ("UIR.ALU_FUNC3", 'alu_func', 1, 0), ("UIR_ALU_FUNC4", 'alu_func', 0, 0), ("UIR.C_SOURCE", 'c_source', 0, 0), ], [ ("", 'x50', 0, 0), ("", 'x50', 1, 0), ("", 'x50', 2, 0), ("", 'x50', 3, 0), ("", 'x50', 4, 0), ("", 'x50', 5, 0), ("", 'x50', 6, 0), ("", 'x50', 7, 0), ], [ ("", 'x60', 0, 0), ("", 'x60', 1, 0), ("", 'x60', 2, 0), ("", 'x60', 3, 0), ("", 'x60', 4, 0), ("", 'x60', 5, 0), ("", 'x60', 6, 0), ("", 'x60', 7, 0), ], [ ("", 'x70', 0, 0), ("", 'x70', 1, 0), ("", 'x70', 2, 0), ("", 'x70', 3, 0), ("", 'x70', 4, 0), ("", 'x70', 5, 0), ("", 'x70', 6, 0), ("", 'x70', 7, 0), ], ] ####################################################################### # https://datamuseum.dk/bits/30000961 R1000_SCHEMATIC_IOC.PDF # # This works differently, so to speak 90° rotated # DIAG.D0 & DIAG.D1 (p61) IOC_DIAG_CHAIN = [ [ ("UIR.ADRBS0", "adrbs", 1, 0), ("UIR.PARITY", "parity", 0, 0), ], [ ("UIR.ADRBS1", "adrbs", 0, 0), ("UIR.SPARE", "xspare", 0, 0), ], [ ("UIR.FIUBS0", "fiubs", 1, 0), ("LOAD_WDR", "load_wdr", 0, 0), ], [ ("UIR.FIUBS1", "fiubs", 0, 0), ("UIR.RANDOM0", "random", 4, 0), ], [ ("UIR.TVBS0", "tvbs", 3, 0), ("UIR.RANDOM1", "random", 3, 0), ], [ ("UIR.TVBS1", "tvbs", 2, 0), ("UIR.RANDOM2", "random", 2, 0), ], [ ("UIR.TVBS2", "tvbs", 1, 0), ("UIR.RANDOM3", "random", 1, 0), ], [ ("UIR.TVBS3", "tvbs", 0, 0), ("UIR.RANDOM4", "random", 0, 0), ] ]
class NoDict(dict): def __getitem__(self, item): return None class ParamDefault: """ This is the base class for Parameter Defaults. Credit to khazhyk (github) for this idea. """ async def default(self, ctx): raise NotImplementedError("Must be subclassed.") class EmptyFlags(ParamDefault): async def default(self, ctx): return NoDict()
l1 = [1] # 0 [<bool|int>] l2 = [''] # 0 [<bool|str>] l3 = l1 or l2 l3.append(True) l3 # 0 [<bool|int|str>]
class ModelAccessException(Exception): """Raise when user has no access to the model""" class ModelNotExistException(Exception): """Raise when model is None""" class AuthenticationFailedException(Exception): """Raise when authentication failed."""
# # PySNMP MIB module S412-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///home/tin/Dev/mibs.snmplabs.com/asn1/S412-MIB # Produced by pysmi-0.3.4 at Fri Jan 31 21:33:01 2020 # On host bier platform Linux version 5.4.0-3-amd64 by user tin # Using Python version 3.7.6 (default, Jan 19 2020, 22:34:52) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Gauge32, NotificationType, iso, Unsigned32, TimeTicks, mgmt, internet, IpAddress, Counter32, MibIdentifier, Counter64, enterprises, ModuleIdentity, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, private, Bits, ObjectIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "NotificationType", "iso", "Unsigned32", "TimeTicks", "mgmt", "internet", "IpAddress", "Counter32", "MibIdentifier", "Counter64", "enterprises", "ModuleIdentity", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "private", "Bits", "ObjectIdentity", "Integer32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") asentria = MibIdentifier((1, 3, 6, 1, 4, 1, 3052)) s412 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41)) device = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 1)) contacts = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 2)) relays = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 3)) tempsensor = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 4)) humiditysensor = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 5)) passthrough = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 6)) ftp = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 7)) analog = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 8)) eventSensorStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 10)) eventSensorConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 11)) techsupport = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 99)) mibend = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 100)) contact1 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1)) contact2 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2)) contact3 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3)) contact4 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4)) contact5 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5)) contact6 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6)) relay1 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 3, 1)) relay2 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 3, 2)) analog1 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1)) analog2 = MibIdentifier((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2)) serialNumber = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: serialNumber.setStatus('mandatory') firmwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: firmwareVersion.setStatus('mandatory') siteID = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: siteID.setStatus('mandatory') snmpManager = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 4), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: snmpManager.setStatus('deprecated') forceTraps = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: forceTraps.setStatus('mandatory') thisTrapText = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 7), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: thisTrapText.setStatus('mandatory') alarmStatus = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: alarmStatus.setStatus('mandatory') snmpManager1 = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 9), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: snmpManager1.setStatus('mandatory') snmpManager2 = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 10), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: snmpManager2.setStatus('mandatory') snmpManager3 = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: snmpManager3.setStatus('mandatory') snmpManager4 = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 12), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: snmpManager4.setStatus('mandatory') statusRepeatHours = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 13), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: statusRepeatHours.setStatus('mandatory') serialTimeout = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 14), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: serialTimeout.setStatus('mandatory') powerupTrapsend = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 15), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: powerupTrapsend.setStatus('mandatory') netlossTrapsend = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 16), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: netlossTrapsend.setStatus('mandatory') buildID = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 1, 17), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: buildID.setStatus('mandatory') contact1Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact1Name.setStatus('mandatory') contact1State = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: contact1State.setStatus('mandatory') contact1AlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact1AlarmEnable.setStatus('mandatory') contact1ActiveDirection = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact1ActiveDirection.setStatus('mandatory') contact1Threshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact1Threshold.setStatus('mandatory') contact1ReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact1ReturnNormalTrap.setStatus('mandatory') contact1TrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact1TrapRepeat.setStatus('mandatory') contact1Severity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 1, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact1Severity.setStatus('mandatory') contact2Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact2Name.setStatus('mandatory') contact2State = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: contact2State.setStatus('mandatory') contact2AlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact2AlarmEnable.setStatus('mandatory') contact2ActiveDirection = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact2ActiveDirection.setStatus('mandatory') contact2Threshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact2Threshold.setStatus('mandatory') contact2ReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact2ReturnNormalTrap.setStatus('mandatory') contact2TrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact2TrapRepeat.setStatus('mandatory') contact2Severity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 2, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact2Severity.setStatus('mandatory') contact3Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact3Name.setStatus('mandatory') contact3State = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: contact3State.setStatus('mandatory') contact3AlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact3AlarmEnable.setStatus('mandatory') contact3ActiveDirection = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact3ActiveDirection.setStatus('mandatory') contact3Threshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact3Threshold.setStatus('mandatory') contact3ReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact3ReturnNormalTrap.setStatus('mandatory') contact3TrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact3TrapRepeat.setStatus('mandatory') contact3Severity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 3, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact3Severity.setStatus('mandatory') contact4Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact4Name.setStatus('mandatory') contact4State = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: contact4State.setStatus('mandatory') contact4AlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact4AlarmEnable.setStatus('mandatory') contact4ActiveDirection = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact4ActiveDirection.setStatus('mandatory') contact4Threshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact4Threshold.setStatus('mandatory') contact4ReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact4ReturnNormalTrap.setStatus('mandatory') contact4TrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact4TrapRepeat.setStatus('mandatory') contact4Severity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 4, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact4Severity.setStatus('mandatory') contact5Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact5Name.setStatus('mandatory') contact5State = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: contact5State.setStatus('mandatory') contact5AlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact5AlarmEnable.setStatus('mandatory') contact5ActiveDirection = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact5ActiveDirection.setStatus('mandatory') contact5Threshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact5Threshold.setStatus('mandatory') contact5ReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact5ReturnNormalTrap.setStatus('mandatory') contact5TrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact5TrapRepeat.setStatus('mandatory') contact5Severity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 5, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact5Severity.setStatus('mandatory') contact6Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact6Name.setStatus('mandatory') contact6State = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: contact6State.setStatus('mandatory') contact6AlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact6AlarmEnable.setStatus('mandatory') contact6ActiveDirection = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact6ActiveDirection.setStatus('mandatory') contact6Threshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact6Threshold.setStatus('mandatory') contact6ReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact6ReturnNormalTrap.setStatus('mandatory') contact6TrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact6TrapRepeat.setStatus('mandatory') contact6Severity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 2, 6, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: contact6Severity.setStatus('mandatory') relay1Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 3, 1, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: relay1Name.setStatus('mandatory') relay1CurrentState = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 3, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: relay1CurrentState.setStatus('mandatory') relay1PowerupState = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 3, 1, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: relay1PowerupState.setStatus('mandatory') relay2Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 3, 2, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: relay2Name.setStatus('mandatory') relay2CurrentState = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 3, 2, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: relay2CurrentState.setStatus('mandatory') relay2PowerupState = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 3, 2, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: relay2PowerupState.setStatus('mandatory') tempValue = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tempValue.setStatus('mandatory') tempAlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempAlarmEnable.setStatus('mandatory') tempHighLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempHighLevel.setStatus('mandatory') tempVeryHighLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempVeryHighLevel.setStatus('mandatory') tempLowLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempLowLevel.setStatus('mandatory') tempVeryLowLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempVeryLowLevel.setStatus('mandatory') tempAlarmThreshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempAlarmThreshold.setStatus('mandatory') tempReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempReturnNormalTrap.setStatus('mandatory') tempTrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempTrapRepeat.setStatus('mandatory') tempMode = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 10), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempMode.setStatus('mandatory') tempHighSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 11), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempHighSeverity.setStatus('mandatory') tempVeryHighSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempVeryHighSeverity.setStatus('mandatory') tempLowSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 13), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempLowSeverity.setStatus('mandatory') tempVeryLowSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 14), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempVeryLowSeverity.setStatus('mandatory') tempName = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 4, 15), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: tempName.setStatus('mandatory') humidityValue = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: humidityValue.setStatus('mandatory') humidityAlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityAlarmEnable.setStatus('mandatory') humidityHighLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityHighLevel.setStatus('mandatory') humidityVeryHighLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityVeryHighLevel.setStatus('mandatory') humidityLowLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityLowLevel.setStatus('mandatory') humidityVeryLowLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityVeryLowLevel.setStatus('mandatory') humidityAlarmThreshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityAlarmThreshold.setStatus('mandatory') humidityReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityReturnNormalTrap.setStatus('mandatory') humidityTrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityTrapRepeat.setStatus('mandatory') humidityHighSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 10), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityHighSeverity.setStatus('mandatory') humidityVeryHighSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 11), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityVeryHighSeverity.setStatus('mandatory') humidityLowSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityLowSeverity.setStatus('mandatory') humidityVeryLowSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 13), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityVeryLowSeverity.setStatus('mandatory') humidityName = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 5, 14), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: humidityName.setStatus('mandatory') ptNeedPassword = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptNeedPassword.setStatus('mandatory') ptSayLoginText = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptSayLoginText.setStatus('mandatory') ptLoginText = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptLoginText.setStatus('mandatory') ptSaySiteID = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptSaySiteID.setStatus('mandatory') ptUsername = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 5), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptUsername.setStatus('mandatory') ptPassword = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 6), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptPassword.setStatus('mandatory') ptTimeout = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptTimeout.setStatus('mandatory') ptEscChar = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptEscChar.setStatus('mandatory') ptLfstripToPort = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptLfstripToPort.setStatus('mandatory') ptLfstripFromPort = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 10), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptLfstripFromPort.setStatus('mandatory') ptSerialBaudrate = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 11), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptSerialBaudrate.setStatus('mandatory') ptSerialWordlength = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptSerialWordlength.setStatus('mandatory') ptSerialParity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 13), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptSerialParity.setStatus('mandatory') ptTCPPortnumber = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 6, 14), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ptTCPPortnumber.setStatus('mandatory') ftpUsername = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 7, 1), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ftpUsername.setStatus('mandatory') ftpPassword = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 7, 2), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ftpPassword.setStatus('mandatory') analog1Value = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: analog1Value.setStatus('mandatory') analog1AlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1AlarmEnable.setStatus('mandatory') analog1HighLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1HighLevel.setStatus('mandatory') analog1VeryHighLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1VeryHighLevel.setStatus('mandatory') analog1LowLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1LowLevel.setStatus('mandatory') analog1VeryLowLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1VeryLowLevel.setStatus('mandatory') analog1AlarmThreshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1AlarmThreshold.setStatus('mandatory') analog1ReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1ReturnNormalTrap.setStatus('mandatory') analog1TrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1TrapRepeat.setStatus('mandatory') analog1HighSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 10), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1HighSeverity.setStatus('mandatory') analog1VeryHighSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 11), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1VeryHighSeverity.setStatus('mandatory') analog1LowSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1LowSeverity.setStatus('mandatory') analog1VeryLowSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 13), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1VeryLowSeverity.setStatus('mandatory') analog1Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 1, 14), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog1Name.setStatus('mandatory') analog2Value = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: analog2Value.setStatus('mandatory') analog2AlarmEnable = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2AlarmEnable.setStatus('mandatory') analog2HighLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2HighLevel.setStatus('mandatory') analog2VeryHighLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2VeryHighLevel.setStatus('mandatory') analog2LowLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2LowLevel.setStatus('mandatory') analog2VeryLowLevel = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2VeryLowLevel.setStatus('mandatory') analog2AlarmThreshold = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 7), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2AlarmThreshold.setStatus('mandatory') analog2ReturnNormalTrap = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2ReturnNormalTrap.setStatus('mandatory') analog2TrapRepeat = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2TrapRepeat.setStatus('mandatory') analog2HighSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 10), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2HighSeverity.setStatus('mandatory') analog2VeryHighSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 11), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2VeryHighSeverity.setStatus('mandatory') analog2LowSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2LowSeverity.setStatus('mandatory') analog2VeryLowSeverity = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 13), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2VeryLowSeverity.setStatus('mandatory') analog2Name = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 8, 2, 14), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: analog2Name.setStatus('mandatory') esPointTable = MibTable((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1), ) if mibBuilder.loadTexts: esPointTable.setStatus('mandatory') esPointEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1, 1), ).setIndexNames((0, "S412-MIB", "esIndexES"), (0, "S412-MIB", "esIndexPC"), (0, "S412-MIB", "esIndexPoint")) if mibBuilder.loadTexts: esPointEntry.setStatus('mandatory') esIndexES = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esIndexES.setStatus('mandatory') esIndexPC = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esIndexPC.setStatus('mandatory') esIndexPoint = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esIndexPoint.setStatus('mandatory') esPointName = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1, 1, 4), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: esPointName.setStatus('mandatory') esPointInEventState = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1, 1, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: esPointInEventState.setStatus('mandatory') esPointValueInt = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32768, 32767))).setMaxAccess("readwrite") if mibBuilder.loadTexts: esPointValueInt.setStatus('mandatory') esPointValueStr = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 10, 1, 1, 7), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: esPointValueStr.setStatus('mandatory') esNumberEventSensors = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 11, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esNumberEventSensors.setStatus('mandatory') esTable = MibTable((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2), ) if mibBuilder.loadTexts: esTable.setStatus('mandatory') esEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1), ).setIndexNames((0, "S412-MIB", "esIndex")) if mibBuilder.loadTexts: esEntry.setStatus('mandatory') esIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esIndex.setStatus('mandatory') esID = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: esID.setStatus('mandatory') esNumberTempSensors = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esNumberTempSensors.setStatus('mandatory') esTempReportingMode = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 4), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: esTempReportingMode.setStatus('mandatory') esNumberCCs = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esNumberCCs.setStatus('mandatory') esCCReportingMode = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: esCCReportingMode.setStatus('mandatory') esNumberHumidSensors = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esNumberHumidSensors.setStatus('mandatory') esHumidReportingMode = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: esHumidReportingMode.setStatus('mandatory') esNumberAnalog = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esNumberAnalog.setStatus('mandatory') esAnalogReportingMode = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 14), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: esAnalogReportingMode.setStatus('mandatory') esNumberRelayOutputs = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 15), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: esNumberRelayOutputs.setStatus('mandatory') esRelayReportingMode = MibTableColumn((1, 3, 6, 1, 4, 1, 3052, 41, 11, 2, 1, 16), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: esRelayReportingMode.setStatus('mandatory') techsupportIPAddress = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 99, 1), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: techsupportIPAddress.setStatus('mandatory') techsupportNetMask = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 99, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: techsupportNetMask.setStatus('mandatory') techsupportRouter = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 99, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: techsupportRouter.setStatus('mandatory') techsupportRestart = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 99, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: techsupportRestart.setStatus('mandatory') techsupportVersionNumber = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 99, 5), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: techsupportVersionNumber.setStatus('mandatory') mibendObject = MibScalar((1, 3, 6, 1, 4, 1, 3052, 41, 100, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: mibendObject.setStatus('mandatory') contact1ActiveTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20001)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact1Name"), ("S412-MIB", "contact1State")) contact2ActiveTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20002)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact2Name"), ("S412-MIB", "contact2State")) contact3ActiveTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20003)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact3Name"), ("S412-MIB", "contact3State")) contact4ActiveTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20004)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact4Name"), ("S412-MIB", "contact4State")) contact5ActiveTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20005)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact5Name"), ("S412-MIB", "contact5State")) contact6ActiveTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20006)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact6Name"), ("S412-MIB", "contact6State")) tempHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20010)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "tempValue")) tempVeryHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20011)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "tempValue")) tempLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20012)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "tempValue")) tempVeryLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20013)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "tempValue")) humidityHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20020)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "humidityValue")) humidityVeryHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20021)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "humidityValue")) humidityLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20022)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "humidityValue")) humidityVeryLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20023)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "humidityValue")) analog1HighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20030)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog1Name"), ("S412-MIB", "analog1Value")) analog1VeryHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20031)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog1Name"), ("S412-MIB", "analog1Value")) analog1LowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20032)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog1Name"), ("S412-MIB", "analog1Value")) analog1VeryLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20033)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog1Name"), ("S412-MIB", "analog1Value")) analog2HighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20040)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog2Name"), ("S412-MIB", "analog2Value")) analog2VeryHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20041)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog2Name"), ("S412-MIB", "analog2Value")) analog2LowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20042)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog2Name"), ("S412-MIB", "analog2Value")) analog2VeryLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20043)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog2Name"), ("S412-MIB", "analog2Value")) contactESActiveTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20101)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) tempESHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20110)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) tempESVeryHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20111)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) tempESLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20112)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) tempESVeryLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20113)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) humidityESHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20120)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) humidityESVeryHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20121)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) humidityESLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20122)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) humidityESVeryLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20123)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) voltageESHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20130)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) voltageESVeryHighTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20131)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) voltageESLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20132)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) voltageESVeryLowTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,20133)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) contact1NormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21001)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact1Name"), ("S412-MIB", "contact1State")) contact2NormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21002)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact2Name"), ("S412-MIB", "contact2State")) contact3NormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21003)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact3Name"), ("S412-MIB", "contact3State")) contact4NormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21004)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact4Name"), ("S412-MIB", "contact4State")) contact5NormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21005)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact5Name"), ("S412-MIB", "contact5State")) contact6NormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21006)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "contact6Name"), ("S412-MIB", "contact6State")) tempNormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21010)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "tempValue")) humidityNormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21020)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "humidityValue")) analog1NormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21030)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog1Name"), ("S412-MIB", "analog1Value")) analog2NormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21040)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "analog2Name"), ("S412-MIB", "analog2Value")) contactESNormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21101)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) tempESNormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21110)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) humidityESNormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21120)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) voltageESNormalTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,21130)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID"), ("S412-MIB", "esPointName"), ("S412-MIB", "esPointValueInt"), ("S412-MIB", "esIndexES"), ("S412-MIB", "esIndexPoint")) testTrap = NotificationType((1, 3, 6, 1, 4, 1, 3052, 41) + (0,22000)).setObjects(("S412-MIB", "thisTrapText"), ("S412-MIB", "siteID")) mibBuilder.exportSymbols("S412-MIB", analog2HighSeverity=analog2HighSeverity, contact6TrapRepeat=contact6TrapRepeat, tempValue=tempValue, ptUsername=ptUsername, contact1ActiveDirection=contact1ActiveDirection, ptEscChar=ptEscChar, relay1PowerupState=relay1PowerupState, contact3ActiveDirection=contact3ActiveDirection, esID=esID, contact4NormalTrap=contact4NormalTrap, contact3AlarmEnable=contact3AlarmEnable, contact4AlarmEnable=contact4AlarmEnable, contact1=contact1, contact4Severity=contact4Severity, relay2PowerupState=relay2PowerupState, tempReturnNormalTrap=tempReturnNormalTrap, analog1VeryHighLevel=analog1VeryHighLevel, analog1TrapRepeat=analog1TrapRepeat, analog1VeryLowLevel=analog1VeryLowLevel, contact4Name=contact4Name, contact3ActiveTrap=contact3ActiveTrap, contact4ActiveDirection=contact4ActiveDirection, ptTCPPortnumber=ptTCPPortnumber, humidityName=humidityName, ptSerialParity=ptSerialParity, ptLfstripToPort=ptLfstripToPort, contact3TrapRepeat=contact3TrapRepeat, humidityReturnNormalTrap=humidityReturnNormalTrap, voltageESVeryLowTrap=voltageESVeryLowTrap, statusRepeatHours=statusRepeatHours, analog2VeryLowLevel=analog2VeryLowLevel, analog1VeryLowTrap=analog1VeryLowTrap, humidityVeryHighSeverity=humidityVeryHighSeverity, tempESLowTrap=tempESLowTrap, contact5ActiveTrap=contact5ActiveTrap, esHumidReportingMode=esHumidReportingMode, humidityNormalTrap=humidityNormalTrap, contact5=contact5, contact1TrapRepeat=contact1TrapRepeat, tempTrapRepeat=tempTrapRepeat, firmwareVersion=firmwareVersion, analog1VeryHighSeverity=analog1VeryHighSeverity, contact3=contact3, tempAlarmEnable=tempAlarmEnable, tempLowSeverity=tempLowSeverity, humidityTrapRepeat=humidityTrapRepeat, contact2ActiveTrap=contact2ActiveTrap, contacts=contacts, forceTraps=forceTraps, analog1Value=analog1Value, tempESVeryLowTrap=tempESVeryLowTrap, contact1Severity=contact1Severity, analog1LowLevel=analog1LowLevel, esNumberHumidSensors=esNumberHumidSensors, tempLowTrap=tempLowTrap, analog1ReturnNormalTrap=analog1ReturnNormalTrap, analog2LowTrap=analog2LowTrap, contact1AlarmEnable=contact1AlarmEnable, contact3State=contact3State, humidityHighLevel=humidityHighLevel, tempVeryLowTrap=tempVeryLowTrap, esNumberEventSensors=esNumberEventSensors, tempHighLevel=tempHighLevel, esTempReportingMode=esTempReportingMode, analog1LowSeverity=analog1LowSeverity, contact2=contact2, esAnalogReportingMode=esAnalogReportingMode, relay2=relay2, relay2CurrentState=relay2CurrentState, relay1CurrentState=relay1CurrentState, ptSayLoginText=ptSayLoginText, voltageESNormalTrap=voltageESNormalTrap, contact5ActiveDirection=contact5ActiveDirection, analog2VeryHighLevel=analog2VeryHighLevel, netlossTrapsend=netlossTrapsend, analog2Name=analog2Name, humidityValue=humidityValue, contact3Severity=contact3Severity, esPointValueInt=esPointValueInt, techsupportIPAddress=techsupportIPAddress, humidityVeryLowSeverity=humidityVeryLowSeverity, humidityVeryHighTrap=humidityVeryHighTrap, contact2State=contact2State, contact4Threshold=contact4Threshold, contact5NormalTrap=contact5NormalTrap, mibend=mibend, ptNeedPassword=ptNeedPassword, contact6Name=contact6Name, s412=s412, analog2TrapRepeat=analog2TrapRepeat, esNumberTempSensors=esNumberTempSensors, ftp=ftp, siteID=siteID, voltageESVeryHighTrap=voltageESVeryHighTrap, humidityLowLevel=humidityLowLevel, contact4State=contact4State, humidityESVeryLowTrap=humidityESVeryLowTrap, esIndexPC=esIndexPC, serialTimeout=serialTimeout, tempESNormalTrap=tempESNormalTrap, tempVeryLowSeverity=tempVeryLowSeverity, ptSaySiteID=ptSaySiteID, contact3Name=contact3Name, tempESHighTrap=tempESHighTrap, tempMode=tempMode, analog1Name=analog1Name, analog1NormalTrap=analog1NormalTrap, analog=analog, techsupportRouter=techsupportRouter, snmpManager2=snmpManager2, contact5ReturnNormalTrap=contact5ReturnNormalTrap, contact1ReturnNormalTrap=contact1ReturnNormalTrap, snmpManager4=snmpManager4, tempVeryHighSeverity=tempVeryHighSeverity, contact4ActiveTrap=contact4ActiveTrap, humidityLowTrap=humidityLowTrap, eventSensorConfig=eventSensorConfig, esEntry=esEntry, serialNumber=serialNumber, humidityVeryHighLevel=humidityVeryHighLevel, relay1Name=relay1Name, relays=relays, eventSensorStatus=eventSensorStatus, analog2Value=analog2Value, analog1AlarmThreshold=analog1AlarmThreshold, tempHighSeverity=tempHighSeverity, contact1NormalTrap=contact1NormalTrap, esIndexPoint=esIndexPoint, contact5Threshold=contact5Threshold, analog1HighLevel=analog1HighLevel, analog1VeryLowSeverity=analog1VeryLowSeverity, analog1HighTrap=analog1HighTrap, contact4ReturnNormalTrap=contact4ReturnNormalTrap, humidityESNormalTrap=humidityESNormalTrap, voltageESLowTrap=voltageESLowTrap, esTable=esTable, contact1Name=contact1Name, esPointTable=esPointTable, techsupportRestart=techsupportRestart, humidityESVeryHighTrap=humidityESVeryHighTrap, contact2AlarmEnable=contact2AlarmEnable, humidityAlarmThreshold=humidityAlarmThreshold, ptPassword=ptPassword, ftpPassword=ftpPassword, contact5TrapRepeat=contact5TrapRepeat, ftpUsername=ftpUsername, analog2ReturnNormalTrap=analog2ReturnNormalTrap, analog2AlarmEnable=analog2AlarmEnable, techsupportNetMask=techsupportNetMask, contact3ReturnNormalTrap=contact3ReturnNormalTrap, humidityHighSeverity=humidityHighSeverity, tempVeryHighLevel=tempVeryHighLevel, contact2ActiveDirection=contact2ActiveDirection, tempVeryHighTrap=tempVeryHighTrap, esIndex=esIndex, analog1HighSeverity=analog1HighSeverity, analog2VeryLowTrap=analog2VeryLowTrap, humidityHighTrap=humidityHighTrap, contact2Severity=contact2Severity, tempLowLevel=tempLowLevel, analog2HighLevel=analog2HighLevel, humidityAlarmEnable=humidityAlarmEnable, esPointInEventState=esPointInEventState, analog1LowTrap=analog1LowTrap, humidityESHighTrap=humidityESHighTrap, testTrap=testTrap, contact5Severity=contact5Severity, contact2Name=contact2Name, alarmStatus=alarmStatus, humidityVeryLowLevel=humidityVeryLowLevel, humidityLowSeverity=humidityLowSeverity, analog2AlarmThreshold=analog2AlarmThreshold, snmpManager3=snmpManager3, esRelayReportingMode=esRelayReportingMode, snmpManager=snmpManager, contact5AlarmEnable=contact5AlarmEnable, humidityVeryLowTrap=humidityVeryLowTrap, contact5Name=contact5Name, contactESActiveTrap=contactESActiveTrap, tempESVeryHighTrap=tempESVeryHighTrap, contact6Threshold=contact6Threshold, humiditysensor=humiditysensor, contact2NormalTrap=contact2NormalTrap, analog1AlarmEnable=analog1AlarmEnable, esNumberAnalog=esNumberAnalog, thisTrapText=thisTrapText, contact6=contact6, esPointName=esPointName, tempNormalTrap=tempNormalTrap, ptLoginText=ptLoginText, analog2HighTrap=analog2HighTrap, ptSerialWordlength=ptSerialWordlength, contact6Severity=contact6Severity, contactESNormalTrap=contactESNormalTrap, contact3Threshold=contact3Threshold, powerupTrapsend=powerupTrapsend, contact6ActiveTrap=contact6ActiveTrap, contact1ActiveTrap=contact1ActiveTrap, contact3NormalTrap=contact3NormalTrap, esNumberCCs=esNumberCCs, contact4TrapRepeat=contact4TrapRepeat, analog2NormalTrap=analog2NormalTrap, humidityESLowTrap=humidityESLowTrap, tempVeryLowLevel=tempVeryLowLevel, contact5State=contact5State, passthrough=passthrough, ptSerialBaudrate=ptSerialBaudrate, contact6State=contact6State, analog1VeryHighTrap=analog1VeryHighTrap, tempAlarmThreshold=tempAlarmThreshold, tempHighTrap=tempHighTrap, analog2LowSeverity=analog2LowSeverity, relay2Name=relay2Name, device=device, analog1=analog1, contact6AlarmEnable=contact6AlarmEnable, contact6ActiveDirection=contact6ActiveDirection, relay1=relay1, ptLfstripFromPort=ptLfstripFromPort, contact6NormalTrap=contact6NormalTrap, contact4=contact4, contact2TrapRepeat=contact2TrapRepeat, contact1State=contact1State, voltageESHighTrap=voltageESHighTrap, buildID=buildID, contact6ReturnNormalTrap=contact6ReturnNormalTrap, analog2LowLevel=analog2LowLevel, snmpManager1=snmpManager1, contact1Threshold=contact1Threshold, techsupport=techsupport, tempName=tempName, esIndexES=esIndexES, analog2VeryLowSeverity=analog2VeryLowSeverity, mibendObject=mibendObject, analog2VeryHighTrap=analog2VeryHighTrap, ptTimeout=ptTimeout, esPointValueStr=esPointValueStr, contact2Threshold=contact2Threshold, esPointEntry=esPointEntry, techsupportVersionNumber=techsupportVersionNumber, analog2VeryHighSeverity=analog2VeryHighSeverity, esNumberRelayOutputs=esNumberRelayOutputs, contact2ReturnNormalTrap=contact2ReturnNormalTrap, esCCReportingMode=esCCReportingMode, asentria=asentria, tempsensor=tempsensor, analog2=analog2)
# TEE RATKAISUSI TÄHÄN: # Write your solution here: # Write your solution here: def order_by_price(item: dict): # Return the price, which is the second item within the tuple return item["rating"] def sort_by_ratings(items: list): return sorted(items, key=order_by_price, reverse=True) if __name__ == "__main__": shows = [{ "name": "Dexter", "rating" : 8.6, "seasons":9 }, { "name": "Friends", "rating" : 8.9, "seasons":10 }, { "name": "Simpsons", "rating" : 8.7, "seasons":32 } ] print("Rating according to IMDB") for show in sort_by_ratings(shows): print(f"{show['name']} {show['rating']}")
ajedrez=[[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0]] print(ajedrez[0][7]) c=0 for x in range(0,8): for y in range(0,8): if(ajedrez[x][y]==1): c+=1 print(c)
def avoidObstacles(inputArray): ''' You are given an array of integers representing coordinates of obstacles situated on a straight line. Assume that you are jumping from the point with coordinate 0 to the right. You are allowed only to make jumps of the same length represented by some integer. Find the minimal length of the jump enough to avoid all the obstacles. ''' maxValue = max(inputArray) mySet = set(inputArray) i = 2 while i <= maxValue: current = 0 collision = False while not collision: if current in mySet: collision = True if current > maxValue: return i current += i i += 1 return maxValue + 1 print(avoidObstacles([5, 3, 6, 7, 9]))
N = int(input()) S = str(input()) for i,c in enumerate(S): if c == '1': if i % 2 == 0: print('Takahashi') else: print('Aoki') break
name = "EikoNet" __version__ = "1.0" __description__ = "EikoNet: A deep neural networking approach for seismic ray tracing" __license__ = "GPL v3.0" __author__ = "Jonathan Smith, Kamyar Azizzadenesheli, Zachary E. Ross" __email__ = "[email protected]"
''' Successor with delete. Given a set of n integers S={0,1,...,n−1} and a sequence of requests of the following form: Remove x from S Find the successor of x: the smallest y in S such that y≥x. design a data type so that all operations (except construction) take logarithmic time or better in the worst case. ''' class QuickUnionLargestElement: def __init__(self, size): self.ids = [*range(size)] self.sizes = [1] * len(self.ids) self.largest_elements = [*range(size)] def __root(self, i): while (i != self.ids[i]): self.ids[i] = self.ids[self.ids[i]] i = self.ids[i] return i def union(self, p, q): p_root = self.__root(p) q_root = self.__root(q) largest_element = max(self.largest_elements[p_root], self.largest_elements[q_root]) if self.largest_elements[p_root] > p: self.largest_elements[p] = self.largest_elements[p_root] else: self.largest_elements[p_root] = self.largest_elements[p_root] if p_root == q_root: return if self.sizes[p] > self.sizes[q]: self.ids[p_root] = q_root self.sizes[q] += self.sizes[p] self.largest_elements[q_root] = largest_element else: self.ids[q_root] = p_root self.sizes[p] += self.sizes[q] self.largest_elements[p_root] = largest_element def find(self, i): return self.largest_elements[self.__root(i)] def connected(self, p, q): return self.__root(q) == self.__root(p) class SuccessorWithDelete: def __init__(self, size): self.size = size self.uf = QuickUnionLargestElement(size) self.removed = [False for x in range(size)] def remove(self, i): self.removed[i] = True if i > 0 and self.removed[i - 1]: self.uf.union(i, i - 1) if i < self.size - 1 and self.removed[i + 1]: self.uf.union(i, i + 1) def successor(self, i): if not self.removed[i]: return i else: res = self.uf.find(i) + 1 if res >= self.size: return -1 return res test = SuccessorWithDelete(10) test.remove(2) print(test.successor(2) == 3) test.remove(3) print(test.successor(2) == 4) print(test.successor(8) == 8) test.remove(8) print(test.successor(8) == 9) test.remove(9) print(test.successor(8) == -1) test.remove(5) test.remove(4) print(test.successor(3) == 6)
companies = {} while True: command = input() if command == "End": break spl_command = command.split(" -> ") name = spl_command[0] id = spl_command[1] if name not in companies: companies[name] = [] companies[name].append(id) else: if id in companies[name]: continue else: companies[name].append(id) sort_companies = dict(sorted(companies.items(), key=lambda x: x[0])) for k, v in sort_companies.items(): print(k) for i in v: print(f"-- {i}") # # d = {} # # command = input() # while command != "End": # text = command.split(" -> ") # # company_name = text[0] # id = text[1] # # if company_name not in d: # d[company_name] = [id] # # else: # if id in d[company_name]: # command = input() # continue # else: # d[company_name] += [id] # # command = input() # sorted_dict = dict(sorted(d.items(), key=lambda x: x[0])) # for (key, value) in sorted_dict.items(): # print(key) # for i in value: # print(f"-- {i}") #
print('Please.') i = int(input('Type a natural number: ')) a = float(input('Type a real number: ')) b = float(input('Type a real number: ')) c = float(input('Type a real number: ')) if i <= 0: print('Please, first, type a natural number!') else: # Hopefully you remember that this is the solution of the problem 5. # Use it ─ ascending order. if i == 1: if a < b and a < c: if b < c: print(f'{a}, {b} and {c}') else: print(f'{a}, {c} and {b}') elif b < c and b < a: if a < c: print(f'{b}, {a} and {c}') else: print(f'{b}, {c} and {a}') else: if a < b: print(f'{c}, {a} and {b}') else: print(f'{c}, {b} and {a}') # Descending order. elif i == 2: if a > b and a > c: if b > c: print(f'{a}, {b} and {c}') else: print(f'{a}, {c} and {b}') elif b > c and b > a: if a > c: print(f'{b}, {a} and {c}') else: print(f'{b}, {c} and {a}') else: if a > b: print(f'{c}, {a} and {b}') else: print(f'{c}, {b} and {a}') else: if a > b and a > c: print(f'{b}, {a} and {c}') elif b > c and b > a: print(f'{a}, {b} and {c}') else: print(f'{a}, {c} and {b}')
class Pessoa: olhos = 2 #atributo de classe , criado quando é um valor padrão, igual para todos os objetos que serão criados def __init__(self,*filhos, nome=None, idade=35, altura=1.70): #atributo de instancia ou do objeto,os valores são diferentes para cada objeto, cria um campo ao objeto que será criado p self.altura = altura self.idade = idade self.nome = nome self.filhos = list(filhos) #Atributo complexo, lista de filhos def cumprimentar(self): #método cumprimentar() - Atributo da classe print('ola', self.nome) @staticmethod # modo 01 - decorator para criação do método de classe def metodo_estatico(): #o método de classe independe do objeto, pois esta atrelado a classe, assim como o atributo de classe return 50 @classmethod def nome_atributos_de_classe(cls): #modo 02 - decorator para criação de método de classe, usado quando que acessar os atributo e métodos da prórpia classe return f'{cls}, {cls.olhos}, {cls.metodo_estatico()}' if __name__ == '__main__': jacson = Pessoa(nome='jacson') #criado o objeto p do tipo Pessoa e atribuindo valor ao campo nome joao = Pessoa(jacson, nome='joao') #criado o objeto p do tipo Pessoa e atribuindo valor ao campo nome pedro = Pessoa(joao, nome='Pedro') print(jacson.cumprimentar()) #executando o método cumprimentar print(jacson.nome) #acessando o atributo de instancia jacson.nome = 'Jacson' #Alterando o valor do atributo de instância print(jacson.nome) #acessando e Imprimindo o novo valor do atributo print(jacson.idade) print(jacson.altura) #Mostrando o valor do campo altura do objeto p jacson.cumprimentar() # executando o método cumprimentar for filho in joao.filhos: #acessando o atributo complexo filhos print(filho.nome) for filho in pedro.filhos: #acessando o atributo complexo filhos print(filho.nome) jacson.sobrenome = 'jeremias' #criando atributo dinâmico, ou seja é um atributo criado em tempo de execução do programa, ele não foi executado no __init__ print(jacson.sobrenome) #print(joao.sobrenome) #o atributo dinâmico é criado apenas no objeto que foi criado, no exemplo tentou-se acessar o atributo pelo objeto joão mas da erro print(jacson.nome, jacson.__dict__) #__dict__ acessa todos os atributos do objeto, inclusive os atributos dinâmicos print(joao.nome, joao.__dict__, '\n') #__dict__ acessa todos os atributos do objeto del joao.filhos #removendo atributo dinamicamente print('Após ser deletado o atributo filhos do objeto joão \n') print(jacson.nome, jacson.__dict__) # __dict__ acessa todos os atributos do objeto, inclusive os atributos dinâmicos, no entanto não acessa os atributos de classe print(joao.nome, joao.__dict__) # __dict__ acessa todos os atributos do objeto, no entanto não acessa os atributos de classe print(Pessoa.olhos) #Acessando o atributo de classe print(jacson.olhos) #todos os objetos criados terão automaticamente o atributo da classe print(id(Pessoa.olhos),id(jacson.olhos),id(joao.olhos)) #acessando pela classe ou pelo objeto criado o id do atributo de classe é o mesmo para todos print(Pessoa.metodo_estatico()) #o método de classe pode acessado diretamente pela classe, quanto pelo objeto print(jacson.metodo_estatico()) #acessando o método de classe atraves do objeto print(Pessoa.nome_atributos_de_classe()) #o método de classe pode acessado diretamente pela classe, quanto pelo objeto print(jacson.nome_atributos_de_classe()) #acessando o método de classe atraves do objeto
# set declaration myfruits = {"Apple", "Banana", "Grapes", "Litchi", "Mango"} mynums = {1, 2, 3, 4, 5} # Set printing before removing print("Before pop() method...") print("fruits: ", myfruits) print("numbers: ", mynums) # Elements getting popped from the set elerem = myfruits.pop() print(elerem, "is removed from fruits") elerem = myfruits.pop() print(elerem, "is removed from fruits") elerem = myfruits.pop() print(elerem, "is removed from fruits") elerem = mynums.pop() print(elerem, "is removed from numbers") elerem = mynums.pop() print(elerem, "is removed from numbers") elerem = mynums.pop() print(elerem, "is removed from numbers") print("After pop() method...") print("fruits: ", myfruits) print("numbers: ", mynums)
# # PySNMP MIB module PDN-VLAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-VLAN-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:39:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion") pdn_common, = mibBuilder.importSymbols("PDN-HEADER-MIB", "pdn-common") VlanIndex, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanIndex") ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance") Bits, ObjectIdentity, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, Gauge32, IpAddress, MibIdentifier, NotificationType, Integer32, Counter32, TimeTicks, Counter64, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "ObjectIdentity", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "Gauge32", "IpAddress", "MibIdentifier", "NotificationType", "Integer32", "Counter32", "TimeTicks", "Counter64", "iso") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") pdnVlanMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46)) pdnVlanMIB.setRevisions(('2003-11-12 00:00', '2003-04-24 00:00', '2003-04-11 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: pdnVlanMIB.setRevisionsDescriptions(('Added a second VlanId for in-band mgmt', 'Changed the compliance/conformance section to be consistent with standard MIBs.', 'Initial release.',)) if mibBuilder.loadTexts: pdnVlanMIB.setLastUpdated('200311120000Z') if mibBuilder.loadTexts: pdnVlanMIB.setOrganization('Paradyne Networks MIB Working Group Other information about group editing the MIB') if mibBuilder.loadTexts: pdnVlanMIB.setContactInfo('Paradyne Networks, Inc. 8545 126th Avenue North Largo, FL 33733 www.paradyne.com General Comments to: [email protected] Editors Clay Sikes, Jesus A. Pinto') if mibBuilder.loadTexts: pdnVlanMIB.setDescription('This MIB module contains objects pertaining to VLANs.') pdnVlanNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 0)) pdnVlanObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 1)) pdnVlanAFNs = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 2)) pdnVlanConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3)) pdnVlanReservedBlockStart = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 1, 1), VlanIndex()).setMaxAccess("readwrite") if mibBuilder.loadTexts: pdnVlanReservedBlockStart.setStatus('current') if mibBuilder.loadTexts: pdnVlanReservedBlockStart.setDescription('This object defines the starting VLAN for a sequential block of VLANS that are to be reserved for internal use. The actual size of the block reserved is not specified as it could be implementation specific. The size of the actual block being reserved should be clearly specified in the SNMP Operational Specification for the particular implementaion.') pdnVlanInbandMgmtVlanId = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 1, 2), VlanIndex()).setMaxAccess("readwrite") if mibBuilder.loadTexts: pdnVlanInbandMgmtVlanId.setStatus('current') if mibBuilder.loadTexts: pdnVlanInbandMgmtVlanId.setDescription('The VLAN ID assigned to the In-Band Management Channel.') pdnVlanInbandMgmtVlanId2 = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 1, 3), VlanIndex()).setMaxAccess("readwrite") if mibBuilder.loadTexts: pdnVlanInbandMgmtVlanId2.setStatus('current') if mibBuilder.loadTexts: pdnVlanInbandMgmtVlanId2.setDescription('The VLAN ID assigned to the second In-Band Management Channel. If the agent does not support a second In-Band Management Channel, it should return NO-SUCH-NAME for the object. *** A VALUE OF 0 IS NOT PERMITTED TO BE RETURNED *** ') pdnVlanCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 1)) pdnVlanGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 2)) pdnVlanMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 1, 1)).setObjects(("PDN-VLAN-MIB", "pdnVlanReservedBlockGroup"), ("PDN-VLAN-MIB", "pdnVlanInbandMgmtVlanGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): pdnVlanMIBCompliance = pdnVlanMIBCompliance.setStatus('current') if mibBuilder.loadTexts: pdnVlanMIBCompliance.setDescription('The compliance statement for the pdnVlan entities which implement the pdnVlanMIB.') pdnVlanObjGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 2, 1)) pdnVlanAfnGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 2, 2)) pdnVlanNtfyGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 2, 3)) pdnVlanReservedBlockGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 2, 1, 1)).setObjects(("PDN-VLAN-MIB", "pdnVlanReservedBlockStart")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): pdnVlanReservedBlockGroup = pdnVlanReservedBlockGroup.setStatus('current') if mibBuilder.loadTexts: pdnVlanReservedBlockGroup.setDescription('Objects grouped for reserving a block of sequential VLANs.') pdnVlanInbandMgmtVlanGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 2, 1, 2)).setObjects(("PDN-VLAN-MIB", "pdnVlanInbandMgmtVlanId")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): pdnVlanInbandMgmtVlanGroup = pdnVlanInbandMgmtVlanGroup.setStatus('current') if mibBuilder.loadTexts: pdnVlanInbandMgmtVlanGroup.setDescription('Objects grouped relating to the In-Band Managment VLAN.') pdnVlanInbandMgmtVlan2Group = ObjectGroup((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 46, 3, 2, 1, 3)).setObjects(("PDN-VLAN-MIB", "pdnVlanInbandMgmtVlanId"), ("PDN-VLAN-MIB", "pdnVlanInbandMgmtVlanId2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): pdnVlanInbandMgmtVlan2Group = pdnVlanInbandMgmtVlan2Group.setStatus('current') if mibBuilder.loadTexts: pdnVlanInbandMgmtVlan2Group.setDescription('Multiples objects grouped relating to the In-Band Managment VLAN.') mibBuilder.exportSymbols("PDN-VLAN-MIB", pdnVlanObjects=pdnVlanObjects, PYSNMP_MODULE_ID=pdnVlanMIB, pdnVlanMIB=pdnVlanMIB, pdnVlanAFNs=pdnVlanAFNs, pdnVlanReservedBlockStart=pdnVlanReservedBlockStart, pdnVlanMIBCompliance=pdnVlanMIBCompliance, pdnVlanObjGroups=pdnVlanObjGroups, pdnVlanAfnGroups=pdnVlanAfnGroups, pdnVlanInbandMgmtVlanGroup=pdnVlanInbandMgmtVlanGroup, pdnVlanGroups=pdnVlanGroups, pdnVlanConformance=pdnVlanConformance, pdnVlanInbandMgmtVlanId=pdnVlanInbandMgmtVlanId, pdnVlanInbandMgmtVlanId2=pdnVlanInbandMgmtVlanId2, pdnVlanCompliances=pdnVlanCompliances, pdnVlanNotifications=pdnVlanNotifications, pdnVlanNtfyGroups=pdnVlanNtfyGroups, pdnVlanReservedBlockGroup=pdnVlanReservedBlockGroup, pdnVlanInbandMgmtVlan2Group=pdnVlanInbandMgmtVlan2Group)
#ex31: Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcule o preço da passagem, cobrando R$0,50 por Km para viagens de até 200Km e R$0,45 parta viagens mais longas. distancia = float(input('Qual é a distância da viagem? ')) preco200km = 0.50 * distancia if distancia <= 200: print('O preço da passagem para uma viagem de {}km é de: R${:.2f}.' .format(distancia, preco200km)) else: preco = 0.45 * distancia print('O preço da passagem para uma viagem de {}km é de: R${:.2f}' .format(distancia, preco)) print('Tenha uma boa viagem!')
# -*- coding: utf-8 -*- config = dict( age_config={ "feature_name": "age", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [("age", "$..content.age", "f_assert_not_null->f_assert_must_digit_or_float")], "f_map_and_filter_chain": "m_get_seq_index_value(0)", "reduce_chain": "", "l_map_and_filter_chain": "" }, apply_register_duration_config={ "feature_name": "apply_register_duration", "feature_data_type": "float", "default_value": "PositiveSignedFloatTypeDefault", "json_path_list": [ ("application_on", "$.apply_data.data.application_on", "f_assert_not_null->f_assert_must_basestring"), ("registration_on", "$.portrait_data.data.registration_on", "f_assert_not_null->f_assert_must_basestring") ], "f_map_and_filter_chain": "m_to_slice(0,10)->f_assert_seq0_gte_seq1->m_get_mon_sub(2)->m_to_int", "reduce_chain": "", "l_map_and_filter_chain": "" }, gender_config={ "feature_name": "gender", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("sex", "$..content.sex", "f_assert_not_null->f_assert_must_basestring"), ], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_sex_to_code", "reduce_chain": "", "l_map_and_filter_chain": "" }, register_city_level_config={ "feature_name": "register_city_level", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("home_address", "$..content.home_address", "f_assert_not_null->f_assert_must_basestring"), ], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_get_city_name->f_assert_not_null->m_city_name_to_level2_0", "reduce_chain": "", "l_map_and_filter_chain": "" }, marital_status_config={ "feature_name": "marital_status", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("marital_status", "$..content.marital_status", "f_assert_not_null->f_assert_must_digit"), ], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_marital_status->m_to_code('marital_status')", "reduce_chain": "", "l_map_and_filter_chain": "" }, mobile_area_city_level_config={ "feature_name": "mobile_area_city_level", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("mobile_area", "$..content.mobile_area", "f_assert_not_null->f_assert_must_basestring"), ], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_get_city_name->f_assert_not_null->m_city_name_to_level2_0", "reduce_chain": "", "l_map_and_filter_chain": "" }, online_time_config={ "feature_name": "online_time", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("online_time", "$.yd_mobile_online_time_s.content.online_time", "m_yd_online_time2_0"), ("online_time", "$.unicome_mobile_online_time_s.content.online_time", "m_unicom_online_time2_0"), ("online_time", "$.telecom_mobile_online_time_s.content.online_time", "m_telecom_online_time2_0"), ], "f_map_and_filter_chain": "f_assert_not_null->m_get_seq_index_value(0)", "reduce_chain": "", "l_map_and_filter_chain": "", }, college_type_config={ "feature_name": "college_type", "feature_data_type": "string", "default_value": "StringTypeDefault", "json_path_list": [ ("school_nature", "$..content.college.school_nature", "f_assert_not_null->f_assert_must_basestring"), ("degree", "$..content.degree.degree", "f_assert_not_null->f_assert_must_basestring")], "f_map_and_filter_chain": "m_college_type->m_to_code('college_type')", "reduce_chain": "", "l_map_and_filter_chain": '' }, cur_employee_number_config={ "feature_name": "cur_employee_number", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [("staff_count", "$..staff_count", "f_assert_not_null")], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_to_int", "reduce_chain": "", "l_map_and_filter_chain": "", }, max_flight_area_config={ "feature_name": "max_flight_area", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("flight_times", "$..content.flight_times", "f_assert_not_null->f_assert_must_digit_or_float"), ("inland_count", "$..content.inland_count", "f_assert_not_null->f_assert_must_digit_or_float"), ( "international_count", "$..content.international_count", "f_assert_not_null->f_assert_must_digit_or_float"), ], "f_map_and_filter_chain": "m_max_flight_area->f_assert_not_null->m_to_code('max_flight_area')", "reduce_chain": "", "l_map_and_filter_chain": "" }, industry_change_count_config={ "feature_name": "industry_change_count", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("industry", "$..work_exp_form[*].industry", "f_assert_not_null"), ], "f_map_and_filter_chain": "m_list_to_distinct->m_to_len(1)", "reduce_chain": "", "l_map_and_filter_chain": "" }, now_work_time_config={ "feature_name": "now_work_time", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("work_exp_form", "$..work_exp_form[*]", "f_assert_not_null->f_assert_must_dict"), ], "f_map_and_filter_chain": "m_get_new_list('work_end','work_start')->f_assert_not_null" "->m_seq_inx0_sort_in_list(True)->m_get_seq_index_value(0)->m_r_to_now_work_time", "reduce_chain": "", "l_map_and_filter_chain": "" }, work_time_config={ "feature_name": "work_time", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("work_start", "$..work_exp_form[*].work_start", "f_assert_must_basestring"), ], "f_map_and_filter_chain": "f_not_null->f_assert_not_null->m_get_max_month_to_now", "reduce_chain": "", "l_map_and_filter_chain": "" }, company_addr_city_level_config={ "feature_name": "company_addr_city_level", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("address", "$..content.address", "f_assert_not_null->f_assert_must_basestring"), ], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_get_city_name->f_assert_not_null->m_city_name_to_level2_0", "reduce_chain": "", "l_map_and_filter_chain": "" }, is_cur_corp_shixin_config={ "feature_name": "is_cur_corp_shixin", "feature_data_type": "int", "default_value": "BooleanTypeDefault", "json_path_list": [("result", "$..result", "f_assert_not_null")], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_to_bool2_0('00')", "reduce_chain": "", "l_map_and_filter_chain": "", }, last_industry_code_config={ "feature_name": "last_industry_code", "feature_data_type": "string", "default_value": "StringTypeDefault", "json_path_list": [ ("work_exp_form", "$..work_exp_form[*]", "f_assert_not_null->f_assert_must_dict"), ], "f_map_and_filter_chain": "m_get_new_list('work_end','industry')->f_assert_not_null->m_seq_inx_to_int" "->m_seq_inx0_sort_in_list(True)->m_get_seq_index_value(0)->m_get_seq_index_value(1)", "reduce_chain": "", "l_map_and_filter_chain": "m_industry_code_to_str" }, now_industry_code_config={ "feature_name": "now_industry_code", "feature_data_type": "string", "default_value": "StringTypeDefault", "json_path_list": [ ("work_exp_form", "$..work_exp_form[*]", "f_assert_not_null->f_assert_must_dict"), ], "f_map_and_filter_chain": "m_get_new_list('work_end','industry')->f_assert_not_null->m_now_industry_code", "reduce_chain": "", "l_map_and_filter_chain": "m_industry_code_to_str" }, complete_degree_config={ "feature_name": "complete_degree", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [("complete_degree", "$..complete_degree", "f_assert_not_null->f_assert_must_int")], "f_map_and_filter_chain": "m_get_seq_index_value(0)", "reduce_chain": "", "l_map_and_filter_chain": "", }, contacts_config={ "feature_name": "contacts", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("contacts", "$..contacts", "f_assert_not_null->f_assert_must_digit"), ], "f_map_and_filter_chain": "m_to_int->m_get_seq_index_value(0)", "reduce_chain": "", "l_map_and_filter_chain": "" }, is_recruitment_config={ "feature_name": "is_recruitment", "feature_data_type": "int", "default_value": "BooleanTypeDefault", "json_path_list": [ ("education_approach", "$..education_approach", "f_assert_not_null->f_assert_must_basestring")], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_to_recruitment", "reduce_chain": "", "l_map_and_filter_chain": '' }, folk_config={ "feature_name": "folk", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("nation", "$..content.nation", "f_assert_not_null->f_assert_must_basestring"), ], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_folk_x_in_y('汉')", "reduce_chain": "", "l_map_and_filter_chain": "" }, graduate_college_config={ "feature_name": "graduate_college", "feature_data_type": "string", "default_value": "StringTypeDefault", "json_path_list": [("school", "$..school", "f_assert_not_null->f_assert_must_basestring")], "f_map_and_filter_chain": "m_get_seq_index_value(0)", "reduce_chain": "", "l_map_and_filter_chain": 'm_code_to_collage_type' }, education_degree_code_config={ "feature_name": "education_degree_code", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [("education_degree_code", "$..edu_exp_form[*].degree", "f_not_null->f_assert_must_digit")], "f_map_and_filter_chain": "m_to_int->r_min->m_to_str->m_to_code('education_degree_code')", "reduce_chain": "", "l_map_and_filter_chain": "", }, mobile_identity_config={ "feature_name": "mobile_identity", "feature_data_type": "int", "default_value": "BooleanTypeDefault", "json_path_list": [ ("mobile_identity", "$.unicom_mobile_identity_s.result", "m_mobile_id_judge"), ("mobile_identity", "$.yd_mobile_identity_s.result", "m_mobile_id_judge"), ("mobile_identity", "$.telecom_mobile_identity_s.result", "m_mobile_id_judge"), ], "f_map_and_filter_chain": "m_to_sum->m_to_bool2_0", "reduce_chain": "", "l_map_and_filter_chain": "" }, cur_corp_years_config={ "feature_name": "cur_corp_years", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [("start_business_date", "$..start_business_date", "f_assert_not_null")], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_get_date_to_now_years(0)", "reduce_chain": "", "l_map_and_filter_chain": "", }, education_degree_check_config={ "feature_name": "education_degree_check", "feature_data_type": "string", "default_value": "StringTypeDefault", "json_path_list": [("degree", "$..content.degree.degree", "f_assert_not_null")], "f_map_and_filter_chain": "m_get_seq_index_value(0)->m_to_code('education_degree_check')", "reduce_chain": "", "l_map_and_filter_chain": '' }, max_flight_class_config={ "feature_name": "max_flight_class", "feature_data_type": "int", "default_value": "PositiveSignedTypeDefault", "json_path_list": [ ("business_class_count", "$..content.business_class_count", "f_assert_not_null->f_assert_must_digit"), ("executive_class_count", "$..content.executive_class_count", "f_assert_not_null->f_assert_must_digit"), ("tourist_class_count", "$..content.tourist_class_count", "f_assert_not_null->f_assert_must_digit"), ], "f_map_and_filter_chain": "m_to_int->m_max_flight_class->m_to_code('max_flight_class')", "reduce_chain": "", "l_map_and_filter_chain": "" }, airfare_sum12_config={ "feature_name": "airfare_sum12", "feature_data_type": "float", "default_value": "PositiveSignedFloatTypeDefault", "json_path_list": [ ("average_price", "$..content.average_price", "f_assert_not_null->f_assert_must_digit_or_float"), ("flight_times", "$..content.flight_times", "f_assert_not_null->f_assert_must_digit"), ], "f_map_and_filter_chain": "m_str_to_int_float_in_list", "reduce_chain": "r_mul", "l_map_and_filter_chain": "" }, )
students = [] second_grades = [] for _ in range(int(input())): name = input() score = float(input()) student = [] student.append(name) student.append(score) students.append(student) my_min = float('Inf') for student in students: if student[1] <= my_min: my_min = student[1] for student in students: if student[1] == my_min: students.remove(student) my_min = float('Inf') for student in students: if student[1] <= my_min: my_min = student[1] for student in students: if student[1] == my_min: second_grades.append(student[0]) second_grades.sort() for el in second_grades: print(el) # print(students)
# Write a function that takes an integer as an input and returns the sum of all numbers from the input down to 0. def sum_to_zero(n): # print base case if n == 0: return n # if we are not at the base case - if n is not yet zero, then print("This is a recursive function with input {0}".format(n)) # call the fnction recursively and remove one number from the stack to reach the base case return n + sum_to_zero(n - 1) # call the function with an input print(sum_to_zero(10))
input = "((((()(()(((((((()))(((()((((()())(())()(((()((((((()((()(()(((()(()((())))()((()()())))))))))()((((((())((()))(((((()(((((((((()()))((()(())()((())((()(()))((()))()))()(((((()(((()()))()())((()((((())()())()((((())()(()(()(((()(())(()(())(((((((())()()(((())(()(()(()(())))(()((((())((()))(((()(()()(((((()()(()(((()(((((())()))()((()(()))()((()((((())((((())(()(((())()()(()()()()()(())((((())((())(()()))()((((())))((((()())()((((())((()())((())(())(((((()((((()(((()((((())(()(((()()))()))((((((()((())()())))(((()(()))(()()(()(((()(()))((()()()())((()()()(((())())()())())())((()))(()(()))(((((()(()(())((()(())(())()((((()())()))((((())(())((())())((((()(((())(())((()()((((()((((((()(())()()(()(()()((((()))(())()())()))(())))(())))())()()(())(()))()((()(()(())()()))(()())))))(()))(()()))(())(((((()(()(()()((())()())))))((())())((())(()(())((()))(())(((()((((((((()()()(()))()()(((()))()((()()(())(())())()(()(())))(((((()(())(())(()))))())()))(()))()(()(((((((()((((())))())())())())()((((((((((((((()()((((((()()()())())()())())())(())(())))())((()())((()(()))))))()))))))))))))))))())((())((())()()))))))(((()((()(()()))((())(()()))()()())))(())))))))(()(((())))())()())))()()(())()))()(()))())((()()))))(()))))()))(()()(())))))))()(((()))))()(()))(())())))))()))((()))((()))())(())))))))))((((())()))()))()))())(())()()(())))())))(()())()))((()()(())))(())((((((()(())((()(((()(()()(())))()))))))()))()(()((()))()(()))(()(((())((((())())(())(()))))))))())))))))())())))))())))))()()(((())()(()))))))))())))))(())()()()))()))()))(()(())()()())())))))))())()(()(()))))()()()))))())(()))))()()))))()())))))(((())()()))(()))))))))))()()))))()()()))))(()())())()()())()(()))))()(()))(())))))))(((((())(())())()()))()()))(())))))()(()))))(())(()()))()())()))()))()))()))))())()()))())())))(()))(()))))))())()(((())()))))))))()))()())))())))())))()))))))))))()()))(()()))))))(())()(()))))())(()))))(()))))(()())))))())())()()))))())()))))))))(()))))()))))))()(()())))))))()))())))())))())))())))))))())(()()))))))(()())())))()())()))))))))))))))())))()(())))()))())()()(())(()()))(())))())()())(()(()(()))))())))))))))))())(()))()))()))))(())()())()())))))))))))()()))))))))))))())())))))(()())))))))))))())(())))()))))))))())())(()))()))(())))()))()()(())()))))))()((((())()))())())))))()))()))))((()())()))))())))(())))))))))))))))))()))))()()())()))()()))))())()))((()())))())))(()))(()())))))))()))()))))(())))))))(())))))())()()(()))())()))()()))))())()()))))())()))())))))))(()))))()())()))))))))(()))())))(()))()))))(())()))())())(())())())))))))((((())))))()))()))()())()(())))()))()))()())(()())()()(()())()))))())())))))(()))()))))())(()()(())))))(())()()((())())))))(())(())))))))())))))))))()(())))))))()())())())()(()))))))))(()))))))))())()()))()(()))))))()))))))())))))))(())))()()(())()())))))(((())))()((())()))())))(()()))())(())())))()(((()())))))()(()()())))()()(()()(()()))())()(()()()))())()()))()())(()))))())))))())))(())()()))))(()))))(())(()))(())))))()()))()))))())()))()()(())())))((()))())()))))))()()))))((()(()))))()()))))))())))))())(()((()())))))))))))()())())))()))(()))))))(()))(())()())))(()))))))))())()()()()))))(()())))))))((())))()))(()))(())(())()())()))))))))(())))())))(()))()()))(()()))(()))())))()(())))())((()((()(())))((())))()))))((((())())()())))(())))()))))))())(()()((())))())()(()())))))(()())()))())))))))((())())))))))(()(()))())()()(()()(((()(((()())))))()))))))()(())(()()((()()(())()()))())()())()))()())())())))))))(((())))))))()()))))))(((())()))(()()))(()()))))(()(()()((((())()())((()()))))(()(())))))()((()()()())()()((()((()()))(()))(((()()()))(((())))()(((())()))))))((()(())())))(()())(((((()(()))(()((()))(()())()))))(()(()))()(()))(())(((())(()()))))()()))(((()))))(()()()()))())))((()()()(())()))()))))()()))()))))))((((((()()()))))())((()()(((()))))(()(())(()()())())())))()(((()()))(())((())))(()))(()()()())((())())())(()))))()))()((()(())()(()()(())(()))(())()))(())(()))))(())(())())(()()(()((()()((())))((()))()((())))(((()()()()((((()))(()()))()()()(((())((())())(()()(()()()))()((())(())()))())(((()()(())))()((()()())()())(()(())())(((())(())())((())(())()(((()()))(())))((())(()())())(())((()()()((((((())))((()(((((())()))()))(())(()()))()))(())()()))(())((()()())()()(()))())()((())))()((()()())((((()())((())())())((()((()))()))((())((()()(()((()()(((())(()()))))((()((())()(((())(()((())())((())(()((((((())())()(()())()(())(((())((((((()(())(()((()()()((()()(()()()())))()()(((((()()))()((((((()))()(()(()(()(((()())((()))())()((()))(())))()))()()))())()()))())((((())(()(()))(((((((())(((()(((((()(((()()((((())(((())())))(()()()(()(()))()))((((((()))((()(((()(())((()((((()((((((())(((((())))(((()(()))))(((()(((())()((())(()((()))(((()()(((())((((()(()(((((()))(((()(((((((()(()()()(()(()(()()())(())(((((()(())())()())(()(()(()))()(()()()())(()()(()((()))()((())())()(()))((())(()))()(()))()(((()(()(()((((((()()()()())()(((((()()(((()()()((()(((((()))((((((((()()()(((((()))))))(()()()(())(()))(()()))))(())()))(((((()(((((()()(()(()())(((()))((((()((()(()(()((()(()((())))()(((()((()))((()))(((((((((()((()((()(())))()((((()((()()))((())(((()(((((()()(()(()()((()(()()()(((((((())())()())))))((((()()(()))()))(()((())()(()(((((((((()()(((()(()())(()((()())((())())((((()(((()(((()((((()((()((((()(()((((((())((((((((((((()()(()()((((((((((((((()((()()))()((((((((((((())((((()(()())((()(()(()))()(((((()()(((()()))()())(())((()(((((()((())(((((()((()(((((()))()()((((())()((((())(((((((((()(())(()(())))())(()((())(((())(())(())())(()(()(())()()((()((())()(((()(((((()(())))()(((()((())))((()()()(((()(((()((()(()(())(()((()())(()(()(((()(((((((((())(()((((()()))(()((((()()()()(((()((((((((()(()()((((((()(()()(()((()((((((((((()()(((((((()())(())))(((()()))(((((()((()()())(()()((((())((()((((()))))(())((()(()()(((()(()(((()((((()(((((()))())())(()((())()))(((()())((())((())((((()((()((((((())(()((((()()))((((((())()(()))((()(((())((((((((((()()(((((()(((((()((()()()((((())))(()))()((()(())()()((()((((((((((()((())(())(((((()(()(()()))((((()((((()()((()(((()(((((((((()(()((()((()))((((((()(((())()()((()(((((((()())))()()(()((()((()()(((()(()()()()((((()((())((((()(((((((((()(((()()(((()(()(((()(((()((())()(()((()(()(()(()))()(((()))(()((((()((())((((())((((((())(()))(()((((())((()(()((((((((()()((((((()(()(()()()(())((()((()()(((()(((((((()()((()(((((((()))(((((()(((()(()()()(()(((()((()()((())(()(((((((((()(()((()((((((()()((())()))(((((()((())()())()(((((((((((()))((((()()()()())(()()(()(()()))()))(()))(()(((()()))())(()(()))()()((())(()())()())()(()))()))(()()(()((((((())((()(((((((((((()(())()((()(()((()((()(()((()((((((((((()()())((())()(())))((())()())()(((((()(()())((((()((()(())(()))(((())()((()))(((((())(()))()()(()))(((())((((()((((()(())))(((((((()))))())()())(())((())()(()()((()(()))()(()()(()()((()())((())((()()))((((()))()()))(()()(())()()(((((()(())((()((((()))()))(()())())(((()()(()()))(())))))(()))((())(((((()((((()))()((((()))()((())(((())))(((()())))((()(()()((" floor = 0 for char in input: if(char == "("): floor+=1 else: floor-=1 print(floor)
"""Top-level package for Takes.""" __author__ = """Chris Lawlor""" __email__ = "[email protected]" __version__ = "0.2.0"
menu = ix.application.get_main_menu() menu.add_command("Layout>") menu.add_show_callback("Layout>", "./_show.py") menu.add_command("Layout>Presets>") menu.add_show_callback("Layout>", "./presets_show.py") menu.add_command("Layout>Presets>separator") menu.add_command("Layout>Presets>Store...", "./presets_store.py") menu.add_command("Layout>Presets>Manage...", "./presets_manage.py") menu.add_command("Layout>separator") item = menu.add_command("Layout>Freeze", "./freeze.py") item.set_checkable(True) menu.add_command("Layout>separator") menu.add_command("Layout>Shelf Toolbar>Show/Hide", "./shelf_toolbar_show_hide.py") menu.add_command("Layout>Shelf Toolbar>Reset To Default", "./shelf_toolbar_reset_to_default.py") menu.add_command("Layout>separator") menu.add_command("Layout>Clear All Viewports", "./clear_all_viewports.py")
#!/usr/bin/env python FIRST_VALUE = 20151125 INPUT_COLUMN = 3083 INPUT_ROW = 2978 MAGIC_MULTIPLIER = 252533 MAGIC_MOD = 33554393 def sequence_number(row, column): return sum(range(row + column - 1)) + column def next_code(code): return (code * MAGIC_MULTIPLIER) % MAGIC_MOD if __name__ == '__main__': code_sequence_number = sequence_number(INPUT_ROW, INPUT_COLUMN) current_code = FIRST_VALUE for i in range(code_sequence_number - 1): current_code = next_code(current_code) print(current_code)
class NoSessionError(Exception): """Raised when a model from :mod:`.models` wants to ``create``/``update`` but it doesn't have an :class:`atomx.Atomx` session yet. """ pass class InvalidCredentials(Exception): """Raised when trying to login with the wrong e-mail or password.""" pass class APIError(Exception): """Raised when the atomx api returns an error that is not caught otherwise.""" pass class MissingArgumentError(Exception): """Raised when argument is missing.""" pass class ModelNotFoundError(Exception): """Raised when trying to (re-)load a model that is not in the api.""" pass class NoPandasInstalledError(Exception): """Raised when trying to access ``report.pandas`` without :mod:`pandas` installed.""" pass
class Solution: def dfs(self,row_cnt:int, col_cnt:int, i:int, j:int, solve_dict:dict): if (i, j) in solve_dict: return solve_dict[(i,j)] right_cnt = 0 down_cnt = 0 #right if i + 1 < row_cnt: if (i + 1, j) in solve_dict: right_cnt = solve_dict[(i + 1, j)] else: right_cnt = self.dfs(row_cnt, col_cnt,i + 1, j,solve_dict) #left if j + 1 < col_cnt: if (i, j + 1) in solve_dict: down_cnt = solve_dict[(i, j + 1)] else: down_cnt = self.dfs(row_cnt, col_cnt, i, j + 1, solve_dict) res = right_cnt + down_cnt solve_dict[(i, j)] = res return res def uniquePaths(self, m: int, n: int): if not n or not m: return 0 if n == 1: return 1 if m == 1: return 1 res = None res = self.dfs(m, n, 0, 0, {(m - 1, n - 1):1}) return res sl = Solution() res = sl.uniquePaths(3, 2) print(res) sl = Solution() res = sl.uniquePaths(7,3) print(res)
''' Kept for python2.7 compatibility. ''' __all__ = []
""" stringjumble.py Author: johari Credit: megsnyder, https://www.geeksforgeeks.org/reverse-string-python-5-different-ways/https://www.geeksforgeeks.org/reverse-string-python-5-different-ways/ https://stackoverflow.com/questions/529424/traverse-a-list-in-reverse-order-in-python https://stackoverflow.com/questions/4481724/convert-a-list-of-characters-into-a-string noah Assignment: The purpose of this challenge is to gain proficiency with manipulating lists. Write and submit a Python program that accepts a string from the user and prints it back in three different ways: * With all letters in reverse. * With words in reverse order, but letters within each word in the correct order. * With all words in correct order, but letters reversed within the words. Output of your program should look like this: Please enter a string of text (the bigger the better): There are a few techniques or tricks that you may find handy You entered "There are a few techniques or tricks that you may find handy". Now jumble it: ydnah dnif yam uoy taht skcirt ro seuqinhcet wef a era erehT handy find may you that tricks or techniques few a are There erehT era a wef seuqinhcet ro skcirt taht uoy yam dnif ydnah """ st= input("Please enter a string of text (the bigger the better): ") print('You entered "' + st + '". Now jumble it: ') def reverse(st): str = "" for i in st: str = i + str return str t = (reverse(st)) tt=list(t) jj=len(tt) print(str(t)) l= list(st) j=len(l) k=0 m=0 ''' for f in st: if f == " ": w = [j-k:j-j:1]) print(w) m+=len(w) k+=1 ''' for i in reversed(l): if i == " ": r=(l[j-k:j-m:1]) c = "" for i in r: c += i m+=len(r) print(c, end = ' ') k+=1 d=((l[:j-m])) c = ''.join(d) print(c) kk=0 mm=0 for ii in reversed(tt): if ii == " ": rr=(tt[jj-kk:jj-mm:1]) cc = "" for ii in rr: cc += ii print((cc), end = ' ' ) mm+=len(rr) kk+=1 dd=((tt[:jj-mm])) cc = ''.join(dd) print(cc)
STATE_NOT_STARTED = "NOT_STARTED" STATE_COIN_FLIPPED = "COIN_FLIPPED" STATE_DRAFT_COMPLETE = "COMPLETE" STATE_BANNING = "BANNING" STATE_PICKING = "PICKING" USER_READABLE_STATE_MAP = { STATE_NOT_STARTED: "Not started", STATE_BANNING: "{} Ban", STATE_PICKING: "{} Pick", STATE_DRAFT_COMPLETE: "Draft complete" } NEXT_STATE = { STATE_BANNING: STATE_PICKING, STATE_PICKING: STATE_DRAFT_COMPLETE } class Draft: def __init__(self, room_id, player_one, player_two, map_pool, draft_type): self.room_id = room_id self.banned_maps = [] self.picked_maps = [] self.player_one = player_one self.player_two = player_two self.map_pool = map_pool self.current_player = None self.state = STATE_NOT_STARTED self.start_player = None self.coin_flip_winner = None self.first_spy = None self.draft_type = draft_type def flip_coin(self, winner): self.coin_flip_winner = winner self.state = STATE_COIN_FLIPPED def coin_flip_loser(self): if self.coin_flip_winner == self.player_one: return self.player_two return self.player_one def set_start_player(self, player_no): if player_no == 1: self.start_player = self.player_one else: self.start_player = self.player_two def _swap_player(self): if self.current_player == self.player_one: self.current_player = self.player_two else: self.current_player = self.player_one def _banning_complete(self): return len(self.banned_maps) < self.draft_type.nr_bans * 2 def _picking_complete(self): return len(self.picked_maps) < self.draft_type.nr_picks * 2 def _advance_state(self): if not(self.state == STATE_BANNING and self._banning_complete() or self.state == STATE_PICKING and self._picking_complete()): self.state = NEXT_STATE[self.state] def mark_map(self, map, is_pick): if map is None: self.banned_maps.append("Nothing") elif self.state.startswith("BAN"): self.banned_maps.append(map.name) self.map_pool.remove(map) else: map_name = map.map_mode_name(is_pick) self.picked_maps.append(map_name) for x in [x for x in self.map_pool if x.family == map.family]: self.map_pool.remove(x) self._advance_state() self._swap_player() def start_draft(self): self.current_player = self.start_player self.state = STATE_BANNING def user_readable_state(self): if self.state == STATE_BANNING: return USER_READABLE_STATE_MAP[self.state].format(self.ordinal((len(self.banned_maps)+1))) elif self.state == STATE_PICKING: return USER_READABLE_STATE_MAP[self.state].format(self.ordinal((len(self.picked_maps)+1))) else: return USER_READABLE_STATE_MAP[self.state] def serializable_bans(self): bans = [] curr = self.start_player for x in self.banned_maps: bans.append({ 'picker': curr, 'map': x }) if curr == self.player_one: curr = self.player_two else: curr = self.player_one return bans def serializable_picks(self): picks = [] curr = self.start_player for x in self.picked_maps: picks.append({ 'picker': curr, 'map': x }) if curr == self.player_one: curr = self.player_two else: curr = self.player_one return picks def draft_complete(self): return self.state == STATE_DRAFT_COMPLETE ordinal = lambda self, n: "%d%s" % (n, "tsnrhtdd"[(n / 10 % 10 != 1)*(n % 10 < 4)*n % 10 :: 4])
class SearchProvider: def search(self) -> list: """ Searches a remote data source """ return []
class StringUtils: @staticmethod def is_empty(text: str) -> bool: """ 判断这个字符串是否为空 :param text: :return: """ if text is None: return True c = text.strip() if len(c) == 0: return True return False
#!/usr/bin/env python3 try: # try the following code print(a) # won't work since we have not defined a except: # if there is ANY error print('a is not defined!') # print this try: print(a) except NameError: # if the error is SPECIFICALLY NameError print('a is still not defined!') # print this except: # if error is anything else print('Something else went wrong.') print(a) # because we didn't use 'try' this will crash our code
n, k = map(int, input().split()) coin = sorted([int(input()) for _ in range(n)]) lst = [[0]*(k+1)]*n+[[1]*(k+1)] lst[0] = [1 if j%coin[0]==0 else 0 for j in range(0,k+1)] for i in range(0, len(coin)): lst[i] = [sum([lst[i-1][j - (k * coin[i])] for k in range((j//coin[i])+1)]) for j in range(k+1)] print(lst[n-1][k])
"""Top-level package for oda-ops.""" __author__ = """Volodymyr Savchenko""" __email__ = '[email protected]' __version__ = '0.1.0'
class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): class_name = cls.__name__ if class_name not in cls._instances: cls._instances[class_name] = super(Singleton, cls).__call__(*args, **kwargs) return cls._instances[class_name]
{ "targets": [ { "target_name": "samplerproxy", "sources": [ "src/node_sampler_proxy.cpp" ], "include_dirs": [ # Path to hopper root ], "libraries": [ # Path to hopper framework library # Path to hopper histogram library ], "cflags" : [ "-std=c++11", "-stdlib=libc++" ], "conditions": [ [ 'OS!="win"', { "cflags+": [ "-std=c++11" ], "cflags_c+": [ "-std=c++11" ], "cflags_cc+": [ "-std=c++11" ], }], [ 'OS=="mac"', { "xcode_settings": { "OTHER_CPLUSPLUSFLAGS" : [ "-std=c++11", "-stdlib=libc++" ], "OTHER_LDFLAGS": [ "-stdlib=libc++" ], "MACOSX_DEPLOYMENT_TARGET": "10.7" }, }], ], } ] }
class Solution: def judgeCircle(self, moves: str) -> bool: M = { 'U': (0, -1), 'D': (0, 1), 'R': (1, 0), 'L': (-1, 0) } x, y = 0, 0 for move in moves: dx, dy = M[move] x += dx y += dy return x == 0 and y == 0
class Animal(object): def run(self): print('Animal is running...') class Dog(Animal): def run(self): print('Dog is running...') class Cat(Animal): pass dog = Dog() dog.run() cat = Cat() cat.run()
__author__ = "Piotr Gawlowicz, Anatolij Zubow" __copyright__ = "Copyright (c) 2015, Technische Universitat Berlin" __version__ = "0.1.0" __email__ = "{gawlowicz, zubow}@tkn.tu-berlin.de" class NetDevice(object): ''' Base Class for all Network Devices, i.e. wired/wireless This basic functionality should be available on any device. ''' ''' Device control ''' def is_up(self): ''' Check state of net device ''' raise NotImplementedError def set_up(self): ''' Set-up net device, i.e. if-up ''' raise NotImplementedError def set_down(self): ''' Set-down net device, i.e. if-down ''' raise NotImplementedError def set_hw_address(self, addr): ''' Set device hardware address, i.e. MAC address ''' raise NotImplementedError def get_hw_address(self): ''' Get device hardware address, i.e. MAC address ''' raise NotImplementedError def get_info(self, iface=None): """ Get generic information about this device - technology dependent """ raise NotImplementedError def set_parameters(self, param_key_values): """ Generic function to set parameter on device. """ raise NotImplementedError def get_parameters(self, param_key_list): """ Generic function to get parameter on device. """ raise NotImplementedError ''' Configuration (add/del) of interfaces on that device. Note a network device can have multiple interfaces, e.g. WiFi phy0 -> wlan0, mon0, ... ''' def get_interfaces(self): ''' Returns list of network interfaces of that device ''' raise NotImplementedError def get_interface_info(self, iface): ''' Returns info about particular network interface ''' raise NotImplementedError def add_interface(self, iface, mode, **kwargs): ''' Create wireless interface with name iface and mode ''' raise NotImplementedError def del_interface(self, iface): ''' Delete interface by name ''' raise NotImplementedError def set_interface_up(self, iface): ''' Set interface UP ''' raise NotImplementedError def set_interface_down(self, iface): ''' Set interface DOWN ''' raise NotImplementedError def is_interface_up(self, iface): ''' Check if interface is up ''' raise NotImplementedError ''' Functionality on interface level ''' def get_link_info(self, iface): ''' Get link info of interface ''' raise NotImplementedError def is_connected(self, iface): ''' Check if interface is in connected state ''' raise NotImplementedError def connect(self, iface, **kwargs): ''' Connects a given interface to some network e.g. in WiFi network identified by SSID. ''' raise NotImplementedError def disconnect(self, iface): ''' Disconnect interface from network ''' raise NotImplementedError ''' DEBUG ''' def debug(self, out): ''' For debug purposes ''' raise NotImplementedError
x=9 y=3 #Im only gonna comment here but i'll separate all the operater by new lines #Same progression as the slides print(x+y) print(x-y) print(x*y) print(x/y) print(x%y) print(x**y) x=9.919555555 print(x//y) x=9 x+=3 print(x) x=9 x-=3 print(x) x*=3 print(x) x/=3 print(x) x ** 3 print(x) x=9 x=3 print(x==y) print(x!=y) print(x>y) print(x<y) print(x>=y) print(x<=y)
# Configuration # Flask DEBUG = True UPLOAD_FOLDER = "/tmp/uploads" MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) # Flask-SQLAlchemy SQLALCHEMY_DATABASE_URI = "sqlite:////tmp/db.sqlite"
# Created by MechAviv # Quest ID :: 34925 # Not coded yet sm.setSpeakerID(3001508) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendNext("#face0#We've got to find it. Looks like we've got no choice but to form a recovery team.") sm.setSpeakerID(3001508) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendSay("#face0#Let's say... Ferret, Salvo, and-") sm.setSpeakerID(3001510) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendSay("#face3#Ah! I don't want to go with him!") # Unhandled Message [47] Packet: 2F 01 00 00 00 40 9C 00 00 00 00 00 00 28 00 00 00 00 00 00 80 05 BB 46 E6 17 02 0C 00 75 73 65 72 5F 6C 76 75 70 3D 31 39 sm.setSpeakerID(3001508) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendSay("#face0#Ark, would you join the team too?") sm.setSpeakerID(3001500) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendSay("#face0#(Seeing more of this place might help me recover more of my memory.)") sm.setSpeakerID(3001500) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendSay("#face0#Yeah, I'll help.") sm.setSpeakerID(3001508) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendSay("#face0#Okay, then we should head back to the refuge and get ready. And Ferret, see if you can figure out what's wrong with the signal detector.") sm.startQuest(34925) # Update Quest Record EX | Quest ID: [34995] | Data: 00=h1;10=h0;01=h1;11=h0;02=h1;12=h0;13=h0;04=h0;23=h0;14=h0;05=h0;24=h0;15=h0;06=h0;16=h0;07=h0;17=h0;09=h0 # Unhandled Message [47] Packet: 2F 02 00 00 00 40 9C 00 00 00 00 00 00 28 00 00 00 00 00 00 80 05 BB 46 E6 17 02 0C 00 75 73 65 72 5F 6C 76 75 70 3D 31 39 B0 83 08 00 00 00 00 00 2E 02 00 00 00 00 00 80 05 BB 46 E6 17 02 00 00 sm.warp(402000600, 3)
class user: """ Class that generates new instances of user identify for creating an account in the app """ listUser = [] def __init__(self, firstName, lastName, userName, passWord): self.fname = firstName self.lname = lastName self.uname = userName self.pword = passWord def saveUser(self): ''' saveUser method saves user objects into userList ''' User.listUser.append(self) @classmethod def displayUser(cls): ''' method that returns the user list ''' return cls.listUser @classmethod def findByUserName(cls, uname): ''' Method that takes in a username and returns a user that matches that username. Args: number: userName to search for Returns : Identity of person that matches the userName. ''' for user in cls.listUser: if user.uname == uname: return user @classmethod def findUserUname(cls, uname): ''' Method that takes in a number and returns a user that matches that username. ''' for user in cls.listUser: if user.uname == uname: return user.uname @classmethod def checkUname(cls, uname): ''' Method that takes in a username and returns a boolean. ''' for user in cls.listUser: if user.uname == uname: return True return False @classmethod def findUserPword(cls,pword): ''' Method that takes in a password and returns a user that matches that password. Args: password: password to search for Returns : user that matches the password. ''' for user in cls.listUser: if user.pword == pword: return user.pword @classmethod def checkPWord(cls, pword): ''' Method that takes in a password and returns a boolean. ''' for user in cls.listUser: if user.pword == pword: return True return False
# https: // leetcode.com/problems/middle-of-the-linked-list/description/ # # algorithms # Easy (69.1%) # Total Accepted: 6.1k # Total Submissions: 8.8k # beats 9.07% of python submissions # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def middleNode(self, head): """ :type head: ListNode :rtype: ListNode """ if not head.next: return head tail = head.next while tail: head = head.next if not tail.next or not tail.next.next: break tail = tail.next.next return head
n = int(input()) a = [int(input()) for _ in range(n)] pushed = [False] * n cnt = 0 index = 0 while not (pushed[index]): cnt += 1 pushed[index] = True if index == 1: cnt -= 1 print(cnt) exit() index = a[index] - 1 print(-1)
single_port_ram = """module SinglePortRam # ( parameter DATA_WIDTH = 8, parameter ADDR_WIDTH = 4, parameter RAM_DEPTH = 1 << ADDR_WIDTH ) ( input clk, input rst, input [ADDR_WIDTH-1:0] ram_addr, input [DATA_WIDTH-1:0] ram_d, input ram_we, output [DATA_WIDTH-1:0] ram_q ); reg [DATA_WIDTH-1:0] mem [0:RAM_DEPTH-1]; reg [ADDR_WIDTH-1:0] read_addr; assign ram_q = mem[read_addr]; always @ (posedge clk) begin if (ram_we) mem[ram_addr] <= ram_d; read_addr <= ram_addr; end endmodule """ bidirectional_single_port_ram = """module BidirectionalSinglePortRam # ( parameter DATA_WIDTH = 8, parameter ADDR_WIDTH = 4, parameter RAM_LENGTH = 16, parameter RAM_DEPTH = 1 << (ADDR_WIDTH-1) ) ( input clk, input rst, input [ADDR_WIDTH-1:0] ram_addr, input [DATA_WIDTH-1:0] ram_d, input ram_we, output [DATA_WIDTH-1:0] ram_q, output [ADDR_WIDTH-1:0] ram_len ); reg [DATA_WIDTH-1:0] mem [0:RAM_DEPTH-1]; reg [ADDR_WIDTH-1:0] read_addr; /* integer i; initial begin for (i = 0; i < RAM_DEPTH; i = i + 1) mem[i] = 0; end */ function [ADDR_WIDTH-1:0] address ( input [ADDR_WIDTH-1:0] in_addr ); begin if (in_addr[ADDR_WIDTH-1] == 1'b1) begin address = RAM_LENGTH + in_addr; end else begin address = in_addr; end end endfunction // address wire [ADDR_WIDTH-1:0] a; assign a = address(ram_addr); assign ram_q = mem[read_addr]; assign ram_len = RAM_LENGTH; always @ (posedge clk) begin if (ram_we) mem[a] <= ram_d; read_addr <= a; end endmodule """ fifo = """module FIFO # ( parameter integer DATA_WIDTH = 32, parameter integer ADDR_WIDTH = 2, parameter integer LENGTH = 4 ) ( input clk, input rst, input [DATA_WIDTH - 1 : 0] din, input write, output full, output [DATA_WIDTH - 1 : 0] dout, input read, output empty, output will_full, output will_empty ); reg [ADDR_WIDTH - 1 : 0] head; reg [ADDR_WIDTH - 1 : 0] tail; reg [ADDR_WIDTH : 0] count; wire we; assign we = write && !full; reg [DATA_WIDTH - 1 : 0] mem [0 : LENGTH - 1]; initial begin : initialize_mem integer i; for (i = 0; i < LENGTH; i = i + 1) begin mem[i] = 0; end end always @(posedge clk) begin if (we) mem[head] <= din; end assign dout = mem[tail]; assign full = count >= LENGTH; assign empty = count == 0; assign will_full = write && !read && count == LENGTH-1; assign will_empty = read && !write && count == 1; always @(posedge clk) begin if (rst == 1) begin head <= 0; tail <= 0; count <= 0; end else begin if (write && read) begin if (count == LENGTH) begin count <= count - 1; tail <= (tail == (LENGTH - 1)) ? 0 : tail + 1; end else if (count == 0) begin count <= count + 1; head <= (head == (LENGTH - 1)) ? 0 : head + 1; end else begin count <= count; head <= (head == (LENGTH - 1)) ? 0 : head + 1; tail <= (tail == (LENGTH - 1)) ? 0 : tail + 1; end end else if (write) begin if (count < LENGTH) begin count <= count + 1; head <= (head == (LENGTH - 1)) ? 0 : head + 1; end end else if (read) begin if (count > 0) begin count <= count - 1; tail <= (tail == (LENGTH - 1)) ? 0 : tail + 1; end end end end endmodule """
# Source: https://leetcode.com/problems/add-digits/description/ # Author: Paulo Lemus # Date : 2017-11-16 # Info : #258, Easy, 92 ms, 92.50% # Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. # # For example: # # Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. # # Follow up: # Could you do it without any loop/recursion in O(1) runtime? # # Credits: # Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases. # 96 ms, 75% class Solution: def addDigits(self, num): """ :type num: int :rtype: int """ while num > 9: num = sum(map(int, str(num))) return num # 92 ms, 92.50% class Solution2: def addDigits(self, num): """ :type num: int :rtype: int """ while num > 9: num = num // 10 + num % 10 return num
# -*- coding: utf-8 -*- """Top-level package for Twith Chat File Reader.""" __author__ = """Yann-Sebastien Tremblay-Johnston""" __email__ = '[email protected]' __version__ = '0.1.0'
def neural_control (output): lat_stick = (output[0] - output[1]) * 21.5 pull = (output[2] - output[3]) * 25 control = [1.0, pull, lat_stick, 0.0] return control
a = input("Geef een waarde (geen 0) ") try: a = int(a) b = 100 / a print(b) except: print("Ik zei nog zo: geen 0") finally: print("Bedankt voor het meedoen")
title = """ __ \ ___| | | | | | __ \ _` | _ \ _ \ __ \ | __| _` | \ \ \ / | _ \ __| | | | | | | ( | __/ ( | | | | | ( | \ \ \ / | __/ | ____/ \__,_| _| _| \__, | \___| \___/ _| _| \____| _| \__,_| \_/\_/ _| \___| _| |___/ """ gameover = """ ___| _ \ | _` | __ `__ \ _ \ | | \ \ / _ \ __| | | ( | | | | __/ | | \ \ / __/ | \____| \__,_| _| _| _| \___| \___/ \_/ \___| _| """
# # @lc app=leetcode id=43 lang=python # # [43] Multiply Strings # # https://leetcode.com/problems/multiply-strings/description/ # # algorithms # Medium (29.99%) # Total Accepted: 185.2K # Total Submissions: 617.4K # Testcase Example: '"2"\n"3"' # # Given two non-negative integers num1 and num2 represented as strings, return # the product of num1 and num2, also represented as a string. # # Example 1: # # # Input: num1 = "2", num2 = "3" # Output: "6" # # Example 2: # # # Input: num1 = "123", num2 = "456" # Output: "56088" # # # Note: # # # The length of both num1 and num2 is < 110. # Both num1 and num2 contain only digits 0-9. # Both num1 and num2 do not contain any leading zero, except the number 0 # itself. # You must not use any built-in BigInteger library or convert the inputs to # integer directly. # # # ''' class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ num1 = num1[::-1] # Calculate the result from the rear. num2 = num2[::-1] if num1 == '0' or num2 == '0': return '0' if len(num1) < len(num2): row_len = len(num1) + 1 row_num = num1 col_len = len(num2) + 1 col_num =num2 else: row_len = len(num2) + 1 row_num = num2 col_len = len(num1) + 1 col_num = num1 num_mat = [] for row in range(row_len): num_mat.append([0]*col_len) adv = 0 # store the multiply results between each nums in a matrix. tmp_ad = [] for row in range(row_len): if row == row_len - 1: break for col in range(col_len): if col == col_len - 1: num_mat[row][col] = adv # store the adv at the last column. adv = 0 break mul_res = int(row_num[row]) * int(col_num[col]) + adv adv = mul_res / 10 num_mat[row][col] = mul_res % 10 tmp_ad.append(adv) res = '' for col in range(0, col_len): row = 0 col1 = col tmp_res = 0 while row<row_len and col1>=0: tmp_res += num_mat[row][col1] row += 1 col1 -= 1 tmp_res = tmp_res + adv res = str(tmp_res%10) + res adv = tmp_res / 10 row = 1 while row < row_len: col = col_len - 1 row1 = row tmp_res = 0 while row1<row_len and col>0: tmp_res += num_mat[row1][col] row1 += 1 col -= 1 tmp_res = tmp_res + adv res = str(tmp_res%10) + res adv = tmp_res / 10 row += 1 while res[0] == '0': res = res[1:] if adv != 0: res = str(adv) + res return res ''' class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ num1 = num1[::-1] # Calculate the result from the rear. num2 = num2[::-1] product = [0] * (len(num1)+len(num2)) pos = 1 for n1 in num1: tmp_pos = pos for n2 in num2: product[tmp_pos-1] += int(n1)*int(n2) product[tmp_pos] += product[tmp_pos-1] / 10 product[tmp_pos-1] %= 10 tmp_pos += 1 pos += 1 product = product[::-1] while product[0]==0 and len(product)!=1: product = product[1:] product = [str(x) for x in product] return ''.join(product)
#https://www.acmicpc.net/problem/2475 n = map(int, input().split()) sum = 0 for i in n: sum += (i**2) print(sum%10)
__author__ = 'mcxiaoke' class Bird(object): feather=True class Chicken(Bird): fly=False def __init__(self,age): self.age=age ck=Chicken(2) print(Bird.__dict__) print(Chicken.__dict__) print(ck.__dict__)
t=int(input()) l=list(map(int,input().split())) l=sorted(l) ans=0 c=0 for i in l: if i>=c: ans+=1 c+=i print(ans)
names = ["shiva", "sai", "azim", "mathews", "philips", "samule"] items = [name.capitalize() for name in names] print(items) items = [len(name) for name in names] print(items) def get_list_comprehensions(lambda_expression, value): return [lambda_expression(x) for x in range(value)] data = get_list_comprehensions(lambda x: x*2, 12) print(data) data = get_list_comprehensions(lambda x: x**2, 12) print(data)
numero = int(input('Digite um numero:')) sucessor = numero + 1 antecessor = numero - 1 print(f'Analisando o numero {numero}, seu sucessor é {sucessor} e seu antecessor é {antecessor}.')
TILESIZE = 29 PLAYER_LAYER = 4 ENEMY_LAYER = 3 BLOCK_LAYER = 2 GROUND_LAYER = 1 PLAYER_SPEED = 3 player_speed = 0 WHITE = (255, 255, 255) BLUE = (0, 0, 255) RED = (255, 0, 0) BLACK = (0, 0, 0) tilemap = [ 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'B.................................................................E..B', 'B...........P........................................................B', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'B....................................................................B', 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB' ]
""" Cryptocurrency network definitions """ class Network: """ Represents a cryptocurrency network (e.g. Bitcoin Mainnet) """ def __init__(self, description, version_priv, version_pub, pub_key_hash, wif): self.description = description self.version_priv = version_priv self.version_pub = version_pub self.pub_key_hash = pub_key_hash self.wif = wif @classmethod def get_supported_networks(cls): """ Returns the list of supported networks :return: list of supported networks """ return cls.__NETWORK_LIST @classmethod def set_supported_networks(cls, network_list): """ Sets up the list of supported networks :param network_list: New list of supported networks """ cls.__NETWORK_LIST = network_list def __eq__(self, other): return self.description == other.description and \ self.version_priv == other.version_priv and \ self.version_pub == other.version_pub and \ self.pub_key_hash == other.pub_key_hash and \ self.wif == other.wif def __str__(self): return self.description BITCOIN_MAINNET = Network(description="Bitcoin Mainnet", version_priv=0x0488ADE4, version_pub=0x0488B21E, pub_key_hash=b"\x00", wif=b"\x80") BITCOIN_TESTNET = Network(description="Bitcoin Testnet", version_priv=0x04358394, version_pub=0x043587CF, pub_key_hash=b"\x6F", wif=b"\xEF") # supported networks Network.set_supported_networks([BITCOIN_MAINNET, BITCOIN_TESTNET])
class VentilationTrapInstanceError(Exception): """Raised when a Ventilation Trap parameter is not int or float""" pass class TrapezeBuildGeometryError(Exception): """raised when the parameter have not good type""" pass
def fatorial(num=1): f = 1 for c in range(num,0,-1): f *= c return f def main(): ''' n = int(input(' Digite um número: ')) print(fatorial(n))''' f1 = fatorial(4) f2 = fatorial(5) f3 = fatorial() print('Os resultados são: ',f1,f2,f3) main()
#!/usr/bin/env python # -*- coding: UTF-8 -*- # python的set和其他语言类似, 是一个无序不重复元素集, 基本功能包括关系测试和消除重复元素. # 集合对象还支持union(联合), intersection(交), difference(差)和sysmmetric difference(对称差集)等数学运算. # sets 支持 x in set, len(set)和 for x in set. 作为一个无序的集合, sets不记录元素位置或者插入点. # 因此, sets不支持 indexing, slicing, 或其它类序列(sequence-like)的操作. # http://blog.csdn.net/business122/article/details/7541486 x = set('spam') y = set(['h', 'a', 'm']) print(x, y) # 交集 print(x & y) # 并集 print(x | y) # 差集, 项在t中, 但不在s中 print(x - y) # 对称差集, 项在t或s中, 但不会同时出现在二者中 print(x ^ y) # 添加一项 x.add('x') print(x) # 添加多项 x.update(['a', 'b', 'c']) print(x) # 删除一项 x.remove('s') print(x) # 去重, 不用hash方法 a = [11, 22, 33, 44, 11, 22] b = set(a) print(b) c = [i for i in b] print(c)
def moveDisk(poles, disk, pole): # move disk to pole if(disk == 0): # base case of recursive algorithm return 0, poles # find the pole the disk is currently on diskIsOn = 0 if disk in poles[1]: diskIsOn = 1 if disk in poles[2]: diskIsOn = 2 # make list of all disks that need to be moved # this could be disks that are on top of the disk, or # are smaller and on the pole we are moving to disksToMove = [] for d in poles[diskIsOn] + poles[pole]: if(d<disk): disksToMove.insert(0,d) disksToMove.sort(reverse=True) # we want to move the other disks to the # remaining pole (not pole and not diskIsOn) remainingPole = 0 if(diskIsOn!=1 and pole!=1): remainingPole = 1 if(diskIsOn!=2 and pole!=2): remainingPole = 2 moves = 0 while(len(disksToMove) > 0): # while there are still disks to move newMoves, poles = moveDisk(poles, disksToMove[0], remainingPole) moves+=newMoves disksToMove.pop(0) # now we can move the disk we wanted to in the beginning poles[diskIsOn].remove(disk) poles[pole].insert(0, disk) moves += 1 print(poles) return moves, poles def h(poles): moves = 0 for disk in range(largestDisk, 0, -1): # move each disk from largest to smallest onto the final pole # first find the pole the disk is on diskIsOn = 0 if disk in poles[1]: diskIsOn = 1 if disk in poles[2]: diskIsOn = 2 if(diskIsOn==0 or diskIsOn==1): # the disk is not on the correct pole # we must first find which disks we need to move disksToMove = [] for d in poles[diskIsOn]+poles[2]: if(d<disk): disksToMove.insert(0,d) disksToMove.sort(reverse=True) # we will move these extra disks to the remaining pole remainingPole = 0 if diskIsOn==1 else 1 while(len(disksToMove)>0): # while there are still disks to move newMoves, poles = moveDisk(poles, disksToMove[0], remainingPole) moves+=newMoves disksToMove.pop(0) # the smaller tower has been moved so we can move # the disk we are currently working on poles[diskIsOn].remove(disk) poles[2].insert(0, disk) moves +=1 print(poles) return moves largestDisk = 3 n = [[1,2,3],[],[]] print(h(n))
# -*- coding: utf-8 -*- """ Éditeur de Spyder Ceci est un script temporaire. """ print('bonjour')
TOKEN_URL = 'https://discordapp.com/api/oauth2/token' GROUP_DM_URL = 'https://discordapp.com/api/users/@me/channels' RPC_TOKEN_URL_FRAGMENT = '/rpc' RPC_HOSTNAME = 'ws://127.0.0.1:' RPC_QUERYSTRING = '?v=1&encoding=json&client_id=' CLIENT_ID = '' CLIENT_SECRET = '' REDIRECT_URI = '' RPC_ORIGIN = '' BOT_TOKEN = ''
## Automatically adapted for numpy Apr 14, 2006 by convertcode.py ARCSECTORAD = float('4.8481368110953599358991410235794797595635330237270e-6') RADTOARCSEC = float('206264.80624709635515647335733077861319665970087963') SECTORAD = float('7.2722052166430399038487115353692196393452995355905e-5') RADTOSEC = float('13750.987083139757010431557155385240879777313391975') RADTODEG = float('57.295779513082320876798154814105170332405472466564') DEGTORAD = float('1.7453292519943295769236907684886127134428718885417e-2') RADTOHRS = float('3.8197186342054880584532103209403446888270314977710') HRSTORAD = float('2.6179938779914943653855361527329190701643078328126e-1') PI = float('3.1415926535897932384626433832795028841971693993751') TWOPI = float('6.2831853071795864769252867665590057683943387987502') PIBYTWO = float('1.5707963267948966192313216916397514420985846996876') SECPERDAY = float('86400.0') SECPERJULYR = float('31557600.0') KMPERPC = float('3.0856776e13') KMPERKPC = float('3.0856776e16') Tsun = float('4.925490947e-6') # sec Msun = float('1.9891e30') # kg Mjup = float('1.8987e27') # kg Rsun = float('6.9551e8') # m Rearth = float('6.378e6') # m SOL = float('299792458.0') # m/s MSUN = float('1.989e+30') # kg G = float('6.673e-11') # m^3/s^2/kg C = SOL
CONTENT_TYPE_CHOICES = ( ('Company', 'Company'), ('Job', 'Job'), ('Topic', 'Topic'), )
class AnimalNode: def __init__(self, question, yes_child, no_child): self.question = question self.yes_child = yes_child self.no_child = no_child def name(self): """ Return the animal's name with an appropriate "a" or "an" in front. This only works for leaf nodes. """ if self.question.lower()[0] in "aeiou": return f"an {self.question}" return f"a {self.question}" class App: def __init__(self): """ Initialize the tree.""" dog_node = AnimalNode("dog", None, None) fish_node = AnimalNode("fish", None, None) self.root = AnimalNode("Is it a mammal? ", dog_node, fish_node) def play_game(self): """ Play the animal game.""" while True: # Play one round. self.play_round() # See if we should continue. response = input("\nPlay again? ").lower() if (len(response) == 0) or (response[0] != "y"): return def play_round(self): """ Play lone round of the animal game.""" node = self.root while True: # See if this is an internal or leaf node. if node.yes_child == None: # It's a leaf node. self.process_leaf_node(node) return # It's an internal node. # Ask the node's question and move to the appropriate child node. response = input(node.question + " ").lower() if response[0] == "y": node = node.yes_child else: node = node.no_child def process_leaf_node(self, leaf): """ Process a leaf node.""" # Guess the animal. prompt = f"Is your animal {leaf.name()}? " response = input(prompt).lower() if response[0] == "y": # We got it right. Gloat and exit. print("\n*** Victory is mine! ***") return else: # We got it wrong. Ask the user for the new animal. new_animal = input("What is your animal? ").lower() new_node = AnimalNode(new_animal, None, None) # Ask the user for a new question. prompt = \ f"What question could I ask to differentiate between " + \ f"{leaf.name()} and {new_node.name()}? " new_question = input(prompt) # See if the question's answer is true for the new animal. prompt = f"Is the answer to this question true for {new_node.name()}? " response = input(prompt).lower() # Update the knowledge tree. old_node = AnimalNode(leaf.question, None, None) leaf.question = new_question if response[0] == "y": leaf.yes_child = new_node leaf.no_child = old_node else: leaf.yes_child = old_node leaf.no_child = new_node if __name__ == '__main__': app = App() app.play_game() # app.root.destroy()
# Desenvolva um programa que leia o nome, idade e sexo de 4 pessoas. # No final do programa, mostre: # -> A média de idade do grupo; # -> Qual o nome do homem mais velho; # -> Quantas mulheres têm menos de 20 anos. somaidade = 0 médiaidade = 0 maioridadehomem = 0 nomehomem = '' totmulher = 0 for c in range(1, 5): print(f'----- {c}° PESSOA -----') nome = str(input('Nome: ')).upper().strip() idade = int(input('Idade: ')) print('''[ M ] - MASCULINO\n[ F ] - FEMININO''') sexo = str(input('Sexo: ')).upper().strip() somaidade += idade if c == 1 and sexo in 'Mm': maioridadehomem = idade nomehomem = nome if sexo in 'Mm' and idade > maioridadehomem: maioridadehomem = idade nomehomem = nome if sexo in 'Ff' and idade < 20: totmulher += 1 médiaidade = somaidade / 4 print(f'A média de idade do grupo é de {médiaidade} anos.') print(f'O homem mais velho se chama {nomehomem} e tem {maioridadehomem} anos.') print(f'{totmulher} mulher(es) desse grupo tem menos de 20 anos.')
class Solution(object): def angleClock(self, hour, minutes): """ :type hour: int :type minutes: int :rtype: float """ m = minutes * (360/60) if hour == 12: h = minutes * (360.0/12/60) else: h = hour * (360/12) + minutes * (360.0/12/60) res = abs(m-h) return 360 - res if res > 180 else res hour = 12 minutes = 30 res = Solution().angleClock(hour, minutes) print(res)
""" Figure parameters class """ class FigureParameters: """ Class contains figure and text sizes """ def __init__(self): self.scale = 1.25*1080/8 self.figure_size_x = int(1920/self.scale) self.figure_size_y = int(1080/self.scale) self.text_size = int(2.9*1080/self.scale) self.text_size_minor_yaxis = 8 # Colormap/ self.color_map = "inferno" # 'hot_r' # 'afmhot_r' #colormap for plotting
class Solution: def summaryRanges(self, nums): summary = [] i = 0 for j in range(len(nums)): if j + 1 < len(nums) and nums[j + 1] == nums[j] + 1: continue if i == j: summary.append(str(nums[i])) else: summary.append(str(nums[i]) + '->' + str(nums[j])) i = j + 1 return summary if __name__ == "__main__": solution = Solution() print(solution.summaryRanges([0, 1, 2, 4, 5, 7])) print(solution.summaryRanges([0, 2, 3, 4, 6, 8, 9]))
# import copy class Solution: def numIslands(self, grid: List[List[str]]) -> int: if not grid: return 0 # copyGrid = copy.deepcopy(grid) copyGrid = grid m = len(grid) n = len(grid[0]) res = 0 for i in range(m): for j in range(n): if copyGrid[i][j] == "1": res += 1 self.checkIsland(copyGrid, i, j, m-1, n-1) return res def checkIsland(self, copyGrid, i, j, m, n): if copyGrid[i][j] == "0": return else: copyGrid[i][j] = "0" # check top self.checkIsland(copyGrid, max(0, i-1), j, m, n) #check bottom self.checkIsland(copyGrid, min(m, i+1), j, m, n) #check left self.checkIsland(copyGrid, i, max(0, j-1), m, n) #check right self.checkIsland(copyGrid, i ,min(n, j+1), m , n) return
BAD_CREDENTIALS = "Unauthorized: The credentials were provided incorrectly or did not match any existing,\ active credentials." PAYMENT_REQUIRED = "Payment Required: There is no active subscription\ for the account associated with the credentials submitted with the request." FORBIDDEN = "Because the international service is currently in a limited release phase, only approved accounts" \ " may access the service." REQUEST_ENTITY_TOO_LARGE = "Request Entity Too Large: The request body has exceeded the maximum size." BAD_REQUEST = "Bad Request (Malformed Payload): A GET request lacked a street field or the request body of a\ POST request contained malformed JSON." UNPROCESSABLE_ENTITY = "GET request lacked required fields." TOO_MANY_REQUESTS = "When using public \"website key\" authentication, \ we restrict the number of requests coming from a given source over too short of a time." INTERNAL_SERVER_ERROR = "Internal Server Error." SERVICE_UNAVAILABLE = "Service Unavailable. Try again later." GATEWAY_TIMEOUT = "The upstream data provider did not respond in a timely fashion and the request failed. " \ "A serious, yet rare occurrence indeed."
#!/usr/bin/env python3 # coding: utf-8 def foreachcsv(filename, callback): with open(filename, 'rb') as f: while True: line = f.readline().strip() if not line: break callback(line) def fdata2list(filename): with open(filename, 'r') as f: data = [line.strip() for line in f.readlines()] return data
class Person: def __init__(self, name): self.name = name def display1(self): print('End of the Statement') class Student(Person): def __init__(self, name, usn, branch): super().__init__(name) self.name = name self.usn = usn self.branch = branch def display2(self): print(f'name: {self.name}') print(f'usn: {self.usn}') print(f'branch: {self.branch}') self.display1() aswin = Student('Ashwin', 31, 'SE') aswin.display2()